[PATCH 2/3] drm/xe/vf: Add helper to get negotiated GuC ABI version
Lukasz Laguna
lukasz.laguna at intel.com
Tue Feb 25 13:23:36 UTC 2025
Introduce a helper function to retrieve the negotiated GuC ABI version
in the generic xe_uc_fw_version structure format.
Signed-off-by: Lukasz Laguna <lukasz.laguna at intel.com>
---
drivers/gpu/drm/xe/xe_gt_sriov_vf.c | 26 ++++++++++++++++++++++++++
drivers/gpu/drm/xe/xe_gt_sriov_vf.h | 2 ++
2 files changed, 28 insertions(+)
diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_vf.c b/drivers/gpu/drm/xe/xe_gt_sriov_vf.c
index 4831549da319..d0dbc00dd8ae 100644
--- a/drivers/gpu/drm/xe/xe_gt_sriov_vf.c
+++ b/drivers/gpu/drm/xe/xe_gt_sriov_vf.c
@@ -1014,6 +1014,32 @@ void xe_gt_sriov_vf_write32(struct xe_gt *gt, struct xe_reg reg, u32 val)
val, reg.addr, addr - reg.addr);
}
+/**
+ * xe_gt_sriov_vf_get_guc_ver - Get negotiated GuC ABI version.
+ * @gt: the &xe_gt
+ * @ver: pointer to storage for read GuC ABI version
+ *
+ * This function is for VF use only.
+ *
+ * Return: 0 on success or a negative error code on failure.
+ */
+int xe_gt_sriov_vf_get_guc_ver(struct xe_gt *gt, struct xe_uc_fw_version *ver)
+{
+ struct xe_gt_sriov_vf_guc_version *guc_version = >->sriov.vf.guc_version;
+
+ xe_gt_assert(gt, IS_SRIOV_VF(gt_to_xe(gt)));
+
+ if (!guc_version->major)
+ return -ENOPKG;
+
+ ver->major = guc_version->major;
+ ver->minor = guc_version->minor;
+ ver->patch = guc_version->patch;
+ ver->build = 0;
+
+ return 0;
+}
+
/**
* xe_gt_sriov_vf_print_config - Print VF self config.
* @gt: the &xe_gt
diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_vf.h b/drivers/gpu/drm/xe/xe_gt_sriov_vf.h
index ba6c5d74e326..b139d1e026e5 100644
--- a/drivers/gpu/drm/xe/xe_gt_sriov_vf.h
+++ b/drivers/gpu/drm/xe/xe_gt_sriov_vf.h
@@ -11,6 +11,7 @@
struct drm_printer;
struct xe_gt;
struct xe_reg;
+struct xe_uc_fw_version;
int xe_gt_sriov_vf_reset(struct xe_gt *gt);
int xe_gt_sriov_vf_bootstrap(struct xe_gt *gt);
@@ -26,6 +27,7 @@ u16 xe_gt_sriov_vf_guc_ids(struct xe_gt *gt);
u64 xe_gt_sriov_vf_lmem(struct xe_gt *gt);
u32 xe_gt_sriov_vf_read32(struct xe_gt *gt, struct xe_reg reg);
void xe_gt_sriov_vf_write32(struct xe_gt *gt, struct xe_reg reg, u32 val);
+int xe_gt_sriov_vf_get_guc_ver(struct xe_gt *gt, struct xe_uc_fw_version *ver);
void xe_gt_sriov_vf_print_config(struct xe_gt *gt, struct drm_printer *p);
void xe_gt_sriov_vf_print_runtime(struct xe_gt *gt, struct drm_printer *p);
--
2.40.0
More information about the Intel-xe
mailing list