[PATCH 2/2] drm/xe/vf: Fix guc_info debugfs for VFs
Daniele Ceraolo Spurio
daniele.ceraolospurio at intel.com
Fri Feb 28 20:02:46 UTC 2025
There are 2 issues with the guc_info debugfs when using it from a VF:
1 - We report a GuC binary path and a GuC release version as wanted, but
the VF actually wants a compatibility version and no specific binary
2 - We attempt to read a bunch of registers that the VFs doesn't have
access to.
Fix #1 by setting the VF expected value during handshake and #2 by not
accessing those registers if VF. The output of the debugfs changes from:
GuC firmware: xe/ptl_guc_70.38.1.bin
status: PRELOADED
wanted release version 70.38.1
found compatibility version 1.18.1
to:
GuC firmware: Loaded by PF
status: PRELOADED
wanted compatibility version 1.2.0
found compatibility version 1.18.1
Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio at intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko at intel.com>
Cc: Lukasz Laguna <lukasz.laguna at intel.com>
---
drivers/gpu/drm/xe/xe_gt_sriov_vf.c | 9 ++++++
drivers/gpu/drm/xe/xe_guc.c | 44 +++++++++++++++--------------
drivers/gpu/drm/xe/xe_uc_fw.c | 8 +++++-
3 files changed, 39 insertions(+), 22 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_vf.c b/drivers/gpu/drm/xe/xe_gt_sriov_vf.c
index eeccbf4cb4b4..751e6a9a26cb 100644
--- a/drivers/gpu/drm/xe/xe_gt_sriov_vf.c
+++ b/drivers/gpu/drm/xe/xe_gt_sriov_vf.c
@@ -154,6 +154,13 @@ static void vf_wanted_guc_version(struct xe_gt *gt, struct xe_uc_fw_version *ver
return vf_minimum_guc_version(gt, ver);
}
+static void set_guc_wanted_version(struct xe_guc *guc, struct xe_uc_fw_version *wanted)
+{
+ guc->fw.path = "Loaded by PF";
+ guc->fw.versions.wanted_type = XE_UC_FW_VER_COMPATIBILITY;
+ memcpy(&guc->fw.versions.wanted, wanted, sizeof(struct xe_uc_fw_version));
+}
+
static int vf_handshake_with_guc(struct xe_gt *gt)
{
struct xe_guc *guc = >->uc.guc;
@@ -172,6 +179,8 @@ static int vf_handshake_with_guc(struct xe_gt *gt)
} else {
vf_wanted_guc_version(gt, &wanted);
xe_gt_assert(gt, wanted.major != GUC_VERSION_MAJOR_ANY);
+
+ set_guc_wanted_version(guc, &wanted);
}
err = guc_action_match_version(guc, &wanted, &found);
diff --git a/drivers/gpu/drm/xe/xe_guc.c b/drivers/gpu/drm/xe/xe_guc.c
index bc1ff0a4e1e7..fdd6e90c1258 100644
--- a/drivers/gpu/drm/xe/xe_guc.c
+++ b/drivers/gpu/drm/xe/xe_guc.c
@@ -1516,30 +1516,32 @@ void xe_guc_print_info(struct xe_guc *guc, struct drm_printer *p)
xe_uc_fw_print(&guc->fw, p);
- fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
- if (!fw_ref)
- return;
+ if (!IS_SRIOV_VF(gt_to_xe(gt))) {
+ fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
+ if (!fw_ref)
+ return;
+
+ status = xe_mmio_read32(>->mmio, GUC_STATUS);
+
+ drm_printf(p, "\nGuC status 0x%08x:\n", status);
+ drm_printf(p, "\tBootrom status = 0x%x\n",
+ REG_FIELD_GET(GS_BOOTROM_MASK, status));
+ drm_printf(p, "\tuKernel status = 0x%x\n",
+ REG_FIELD_GET(GS_UKERNEL_MASK, status));
+ drm_printf(p, "\tMIA Core status = 0x%x\n",
+ REG_FIELD_GET(GS_MIA_MASK, status));
+ drm_printf(p, "\tLog level = %d\n",
+ xe_guc_log_get_level(&guc->log));
+
+ drm_puts(p, "\nScratch registers:\n");
+ for (i = 0; i < SOFT_SCRATCH_COUNT; i++) {
+ drm_printf(p, "\t%2d: \t0x%x\n",
+ i, xe_mmio_read32(>->mmio, SOFT_SCRATCH(i)));
+ }
- status = xe_mmio_read32(>->mmio, GUC_STATUS);
-
- drm_printf(p, "\nGuC status 0x%08x:\n", status);
- drm_printf(p, "\tBootrom status = 0x%x\n",
- REG_FIELD_GET(GS_BOOTROM_MASK, status));
- drm_printf(p, "\tuKernel status = 0x%x\n",
- REG_FIELD_GET(GS_UKERNEL_MASK, status));
- drm_printf(p, "\tMIA Core status = 0x%x\n",
- REG_FIELD_GET(GS_MIA_MASK, status));
- drm_printf(p, "\tLog level = %d\n",
- xe_guc_log_get_level(&guc->log));
-
- drm_puts(p, "\nScratch registers:\n");
- for (i = 0; i < SOFT_SCRATCH_COUNT; i++) {
- drm_printf(p, "\t%2d: \t0x%x\n",
- i, xe_mmio_read32(>->mmio, SOFT_SCRATCH(i)));
+ xe_force_wake_put(gt_to_fw(gt), fw_ref);
}
- xe_force_wake_put(gt_to_fw(gt), fw_ref);
-
drm_puts(p, "\n");
xe_guc_ct_print(&guc->ct, p, false);
diff --git a/drivers/gpu/drm/xe/xe_uc_fw.c b/drivers/gpu/drm/xe/xe_uc_fw.c
index 18e06ee9e23f..b9c32f5a8715 100644
--- a/drivers/gpu/drm/xe/xe_uc_fw.c
+++ b/drivers/gpu/drm/xe/xe_uc_fw.c
@@ -234,6 +234,10 @@ uc_fw_auto_select(struct xe_device *xe, struct xe_uc_fw *uc_fw)
entries = blobs_all[uc_fw->type].entries;
count = blobs_all[uc_fw->type].count;
+ /* For VFs the GuC path and wanted version are set during the handshake */
+ if (uc_fw->path)
+ return;
+
for (i = 0; i < count && p <= entries[i].platform; i++) {
if (p == entries[i].platform) {
uc_fw->path = entries[i].path;
@@ -663,7 +667,9 @@ static int uc_fw_request(struct xe_uc_fw *uc_fw, const struct firmware **firmwar
*/
BUILD_BUG_ON(XE_UC_FIRMWARE_UNINITIALIZED);
xe_assert(xe, !uc_fw->status);
- xe_assert(xe, !uc_fw->path);
+
+ /* For VFs the GuC path is set during the handshake */
+ xe_assert(xe, IS_SRIOV_VF(xe) || !uc_fw->path);
uc_fw_auto_select(xe, uc_fw);
--
2.43.0
More information about the Intel-xe
mailing list