[PATCH] drm/xe/vf: Postpone GT topology initialization if VF

Michal Wajdeczko michal.wajdeczko at intel.com
Tue May 28 20:48:37 UTC 2024


We can't properly initialize GT topology without knowing the
values of the fuse registers. However, VF drivers will learn
those values only after establishing communication with the
GuC and the PF. While we need GT topology to correctly setup
MCR, which is required to program HW PAT table, both steps are
only applicable to the PF driver. For VF driver case, we can
postpone all these steps after xe_uc_init_hwconfig().

Signed-off-by: Michal Wajdeczko <michal.wajdeczko at intel.com>
Cc: Matt Roper <matthew.d.roper at intel.com>
Cc: Michał Winiarski <michal.winiarski at intel.com>
---
 drivers/gpu/drm/xe/xe_gt.c | 27 ++++++++++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_gt.c b/drivers/gpu/drm/xe/xe_gt.c
index 34c1896807e9..354f83677cc6 100644
--- a/drivers/gpu/drm/xe/xe_gt.c
+++ b/drivers/gpu/drm/xe/xe_gt.c
@@ -496,15 +496,23 @@ static int all_fw_domain_init(struct xe_gt *gt)
  */
 int xe_gt_init_hwconfig(struct xe_gt *gt)
 {
+	struct xe_device *xe = gt_to_xe(gt);
 	int err;
 
 	err = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
 	if (err)
 		goto out;
 
-	xe_gt_topology_init(gt);
-	xe_gt_mcr_init(gt);
-	xe_pat_init(gt);
+	if (!IS_SRIOV_VF(xe)) {
+		/*
+		 * Only native (or PF) driver need to initialize the HW PAT
+		 * table, and thus initialize GT topology and MCR, prior to
+		 * making any allocations required for GuC loading.
+		 */
+		xe_gt_topology_init(gt);
+		xe_gt_mcr_init(gt);
+		xe_pat_init(gt);
+	}
 
 	err = xe_uc_init(&gt->uc);
 	if (err)
@@ -514,6 +522,19 @@ int xe_gt_init_hwconfig(struct xe_gt *gt)
 	if (err)
 		goto out_fw;
 
+	if (IS_SRIOV_VF(xe)) {
+		/*
+		 * By now VFs should have obtained the values of the fuse
+		 * registers from the PF and can continue with GT topology
+		 * initialization skipped above.
+		 *
+		 * Keep no-op MCR/PAT initializations for reference only.
+		 */
+		xe_gt_topology_init(gt);
+		xe_gt_mcr_init(gt);
+		xe_pat_init(gt);
+	}
+
 out_fw:
 	xe_force_wake_put(gt_to_fw(gt), XE_FW_GT);
 out:
-- 
2.43.0



More information about the Intel-xe mailing list