]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/xe/vf: Store negotiated VF/PF ABI version at device level
authorMichal Wajdeczko <michal.wajdeczko@intel.com>
Sun, 13 Jul 2025 10:36:25 +0000 (12:36 +0200)
committerMichal Wajdeczko <michal.wajdeczko@intel.com>
Mon, 14 Jul 2025 16:19:39 +0000 (18:19 +0200)
There is no need to maintain PF ABI version on per-GT level.

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Reviewed-by: Piotr Piórkowski <piotr.piorkowski@intel.com>
Link: https://lore.kernel.org/r/20250713103625.1964-8-michal.wajdeczko@intel.com
drivers/gpu/drm/xe/xe_gt_sriov_vf.c
drivers/gpu/drm/xe/xe_gt_sriov_vf_types.h
drivers/gpu/drm/xe/xe_sriov_vf_types.h

index d65eafd91b179a2c3e507fa15822d72a6954f988..b282838d59e61b3e9089e134caa1ee94e3d6ab7d 100644 (file)
@@ -686,21 +686,22 @@ static int relay_action_handshake(struct xe_gt *gt, u32 *major, u32 *minor)
        return 0;
 }
 
-static void vf_connect_pf(struct xe_gt *gt, u16 major, u16 minor)
+static void vf_connect_pf(struct xe_device *xe, u16 major, u16 minor)
 {
-       xe_gt_assert(gt, IS_SRIOV_VF(gt_to_xe(gt)));
+       xe_assert(xe, IS_SRIOV_VF(xe));
 
-       gt->sriov.vf.pf_version.major = major;
-       gt->sriov.vf.pf_version.minor = minor;
+       xe->sriov.vf.pf_version.major = major;
+       xe->sriov.vf.pf_version.minor = minor;
 }
 
-static void vf_disconnect_pf(struct xe_gt *gt)
+static void vf_disconnect_pf(struct xe_device *xe)
 {
-       vf_connect_pf(gt, 0, 0);
+       vf_connect_pf(xe, 0, 0);
 }
 
 static int vf_handshake_with_pf(struct xe_gt *gt)
 {
+       struct xe_device *xe = gt_to_xe(gt);
        u32 major_wanted = GUC_RELAY_VERSION_LATEST_MAJOR;
        u32 minor_wanted = GUC_RELAY_VERSION_LATEST_MINOR;
        u32 major = major_wanted, minor = minor_wanted;
@@ -716,13 +717,13 @@ static int vf_handshake_with_pf(struct xe_gt *gt)
        }
 
        xe_gt_sriov_dbg(gt, "using VF/PF ABI %u.%u\n", major, minor);
-       vf_connect_pf(gt, major, minor);
+       vf_connect_pf(xe, major, minor);
        return 0;
 
 failed:
        xe_gt_sriov_err(gt, "Unable to confirm VF/PF ABI version %u.%u (%pe)\n",
                        major, minor, ERR_PTR(err));
-       vf_disconnect_pf(gt);
+       vf_disconnect_pf(xe);
        return err;
 }
 
@@ -775,10 +776,12 @@ void xe_gt_sriov_vf_migrated_event_handler(struct xe_gt *gt)
 
 static bool vf_is_negotiated(struct xe_gt *gt, u16 major, u16 minor)
 {
-       xe_gt_assert(gt, IS_SRIOV_VF(gt_to_xe(gt)));
+       struct xe_device *xe = gt_to_xe(gt);
 
-       return major == gt->sriov.vf.pf_version.major &&
-              minor <= gt->sriov.vf.pf_version.minor;
+       xe_gt_assert(gt, IS_SRIOV_VF(xe));
+
+       return major == xe->sriov.vf.pf_version.major &&
+              minor <= xe->sriov.vf.pf_version.minor;
 }
 
 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)
  */
 void xe_gt_sriov_vf_print_version(struct xe_gt *gt, struct drm_printer *p)
 {
+       struct xe_device *xe = gt_to_xe(gt);
        struct xe_uc_fw_version *guc_version = &gt->sriov.vf.guc_version;
        struct xe_uc_fw_version *wanted = &gt->sriov.vf.wanted_guc_version;
-       struct xe_gt_sriov_vf_relay_version *pf_version = &gt->sriov.vf.pf_version;
+       struct xe_sriov_vf_relay_version *pf_version = &xe->sriov.vf.pf_version;
        struct xe_uc_fw_version ver;
 
        xe_gt_assert(gt, IS_SRIOV_VF(gt_to_xe(gt)));
index ef041679e9d4c23f7a448a9cfc80494929ca9345..298dedf4b009e6ae68850be797ce45baae67ea64 100644 (file)
@@ -9,16 +9,6 @@
 #include <linux/types.h>
 #include "xe_uc_fw_types.h"
 
-/**
- * struct xe_gt_sriov_vf_relay_version - PF ABI version details.
- */
-struct xe_gt_sriov_vf_relay_version {
-       /** @major: major version. */
-       u16 major;
-       /** @minor: minor version. */
-       u16 minor;
-};
-
 /**
  * struct xe_gt_sriov_vf_selfconfig - VF configuration data.
  */
@@ -66,8 +56,6 @@ struct xe_gt_sriov_vf {
        struct xe_uc_fw_version guc_version;
        /** @self_config: resource configurations. */
        struct xe_gt_sriov_vf_selfconfig self_config;
-       /** @pf_version: negotiated VF/PF ABI version. */
-       struct xe_gt_sriov_vf_relay_version pf_version;
        /** @runtime: runtime data retrieved from the PF. */
        struct xe_gt_sriov_vf_runtime runtime;
 };
index 55c2421d4b2e3a369bafbcb9e18e993ca33c76d1..8300416a622687c796400b59d0e8b874eafe9eab 100644 (file)
@@ -6,8 +6,19 @@
 #ifndef _XE_SRIOV_VF_TYPES_H_
 #define _XE_SRIOV_VF_TYPES_H_
 
+#include <linux/types.h>
 #include <linux/workqueue_types.h>
 
+/**
+ * struct xe_sriov_vf_relay_version - PF ABI version details.
+ */
+struct xe_sriov_vf_relay_version {
+       /** @major: major version. */
+       u16 major;
+       /** @minor: minor version. */
+       u16 minor;
+};
+
 /**
  * struct xe_device_vf - Xe Virtual Function related data
  *
@@ -15,6 +26,9 @@
  * @XE_SRIOV_MODE_VF mode.
  */
 struct xe_device_vf {
+       /** @pf_version: negotiated VF/PF ABI version. */
+       struct xe_sriov_vf_relay_version pf_version;
+
        /** @migration: VF Migration state data */
        struct {
                /** @migration.worker: VF migration recovery worker */