Skip to content

Commit b533b8e

Browse files
committed
drm/xe/vf: Store negotiated VF/PF ABI version at device level
There is no need to maintain PF ABI version on per-GT level. Signed-off-by: Michal Wajdeczko <[email protected]> Reviewed-by: Piotr Piórkowski <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent a6c384b commit b533b8e

File tree

3 files changed

+30
-24
lines changed

3 files changed

+30
-24
lines changed

drivers/gpu/drm/xe/xe_gt_sriov_vf.c

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -686,21 +686,22 @@ static int relay_action_handshake(struct xe_gt *gt, u32 *major, u32 *minor)
686686
return 0;
687687
}
688688

689-
static void vf_connect_pf(struct xe_gt *gt, u16 major, u16 minor)
689+
static void vf_connect_pf(struct xe_device *xe, u16 major, u16 minor)
690690
{
691-
xe_gt_assert(gt, IS_SRIOV_VF(gt_to_xe(gt)));
691+
xe_assert(xe, IS_SRIOV_VF(xe));
692692

693-
gt->sriov.vf.pf_version.major = major;
694-
gt->sriov.vf.pf_version.minor = minor;
693+
xe->sriov.vf.pf_version.major = major;
694+
xe->sriov.vf.pf_version.minor = minor;
695695
}
696696

697-
static void vf_disconnect_pf(struct xe_gt *gt)
697+
static void vf_disconnect_pf(struct xe_device *xe)
698698
{
699-
vf_connect_pf(gt, 0, 0);
699+
vf_connect_pf(xe, 0, 0);
700700
}
701701

702702
static int vf_handshake_with_pf(struct xe_gt *gt)
703703
{
704+
struct xe_device *xe = gt_to_xe(gt);
704705
u32 major_wanted = GUC_RELAY_VERSION_LATEST_MAJOR;
705706
u32 minor_wanted = GUC_RELAY_VERSION_LATEST_MINOR;
706707
u32 major = major_wanted, minor = minor_wanted;
@@ -716,13 +717,13 @@ static int vf_handshake_with_pf(struct xe_gt *gt)
716717
}
717718

718719
xe_gt_sriov_dbg(gt, "using VF/PF ABI %u.%u\n", major, minor);
719-
vf_connect_pf(gt, major, minor);
720+
vf_connect_pf(xe, major, minor);
720721
return 0;
721722

722723
failed:
723724
xe_gt_sriov_err(gt, "Unable to confirm VF/PF ABI version %u.%u (%pe)\n",
724725
major, minor, ERR_PTR(err));
725-
vf_disconnect_pf(gt);
726+
vf_disconnect_pf(xe);
726727
return err;
727728
}
728729

@@ -775,10 +776,12 @@ void xe_gt_sriov_vf_migrated_event_handler(struct xe_gt *gt)
775776

776777
static bool vf_is_negotiated(struct xe_gt *gt, u16 major, u16 minor)
777778
{
778-
xe_gt_assert(gt, IS_SRIOV_VF(gt_to_xe(gt)));
779+
struct xe_device *xe = gt_to_xe(gt);
779780

780-
return major == gt->sriov.vf.pf_version.major &&
781-
minor <= gt->sriov.vf.pf_version.minor;
781+
xe_gt_assert(gt, IS_SRIOV_VF(xe));
782+
783+
return major == xe->sriov.vf.pf_version.major &&
784+
minor <= xe->sriov.vf.pf_version.minor;
782785
}
783786

784787
static int vf_prepare_runtime_info(struct xe_gt *gt, unsigned int num_regs)
@@ -1072,9 +1075,10 @@ void xe_gt_sriov_vf_print_runtime(struct xe_gt *gt, struct drm_printer *p)
10721075
*/
10731076
void xe_gt_sriov_vf_print_version(struct xe_gt *gt, struct drm_printer *p)
10741077
{
1078+
struct xe_device *xe = gt_to_xe(gt);
10751079
struct xe_uc_fw_version *guc_version = &gt->sriov.vf.guc_version;
10761080
struct xe_uc_fw_version *wanted = &gt->sriov.vf.wanted_guc_version;
1077-
struct xe_gt_sriov_vf_relay_version *pf_version = &gt->sriov.vf.pf_version;
1081+
struct xe_sriov_vf_relay_version *pf_version = &xe->sriov.vf.pf_version;
10781082
struct xe_uc_fw_version ver;
10791083

10801084
xe_gt_assert(gt, IS_SRIOV_VF(gt_to_xe(gt)));

drivers/gpu/drm/xe/xe_gt_sriov_vf_types.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,6 @@
99
#include <linux/types.h>
1010
#include "xe_uc_fw_types.h"
1111

12-
/**
13-
* struct xe_gt_sriov_vf_relay_version - PF ABI version details.
14-
*/
15-
struct xe_gt_sriov_vf_relay_version {
16-
/** @major: major version. */
17-
u16 major;
18-
/** @minor: minor version. */
19-
u16 minor;
20-
};
21-
2212
/**
2313
* struct xe_gt_sriov_vf_selfconfig - VF configuration data.
2414
*/
@@ -66,8 +56,6 @@ struct xe_gt_sriov_vf {
6656
struct xe_uc_fw_version guc_version;
6757
/** @self_config: resource configurations. */
6858
struct xe_gt_sriov_vf_selfconfig self_config;
69-
/** @pf_version: negotiated VF/PF ABI version. */
70-
struct xe_gt_sriov_vf_relay_version pf_version;
7159
/** @runtime: runtime data retrieved from the PF. */
7260
struct xe_gt_sriov_vf_runtime runtime;
7361
};

drivers/gpu/drm/xe/xe_sriov_vf_types.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,29 @@
66
#ifndef _XE_SRIOV_VF_TYPES_H_
77
#define _XE_SRIOV_VF_TYPES_H_
88

9+
#include <linux/types.h>
910
#include <linux/workqueue_types.h>
1011

12+
/**
13+
* struct xe_sriov_vf_relay_version - PF ABI version details.
14+
*/
15+
struct xe_sriov_vf_relay_version {
16+
/** @major: major version. */
17+
u16 major;
18+
/** @minor: minor version. */
19+
u16 minor;
20+
};
21+
1122
/**
1223
* struct xe_device_vf - Xe Virtual Function related data
1324
*
1425
* The data in this structure is valid only if driver is running in the
1526
* @XE_SRIOV_MODE_VF mode.
1627
*/
1728
struct xe_device_vf {
29+
/** @pf_version: negotiated VF/PF ABI version. */
30+
struct xe_sriov_vf_relay_version pf_version;
31+
1832
/** @migration: VF Migration state data */
1933
struct {
2034
/** @migration.worker: VF migration recovery worker */

0 commit comments

Comments
 (0)