[PATCH 2/2] drm/xe: Init MCR before any mcr register read

Tejas Upadhyay tejas.upadhyay at intel.com
Thu Aug 8 06:02:51 UTC 2024


enable host l2 RAM is example where MCR register is
getting read before fully MCR init is done. Lets move
MCR init early and merge early mcr init into main MCR
init.

Cc: Lucas De Marchi <lucas.demarchi at intel.com>
Signed-off-by: Tejas Upadhyay <tejas.upadhyay at intel.com>
---
 drivers/gpu/drm/xe/xe_gt.c     |  3 +--
 drivers/gpu/drm/xe/xe_gt_mcr.c | 21 +++++----------------
 drivers/gpu/drm/xe/xe_gt_mcr.h |  1 -
 3 files changed, 6 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_gt.c b/drivers/gpu/drm/xe/xe_gt.c
index c6296dc8897f..e2e3a1eabde8 100644
--- a/drivers/gpu/drm/xe/xe_gt.c
+++ b/drivers/gpu/drm/xe/xe_gt.c
@@ -555,7 +555,7 @@ int xe_gt_init_hwconfig(struct xe_gt *gt)
 	if (err)
 		goto out;
 
-	xe_gt_mcr_init_early(gt);
+	xe_gt_mcr_init(gt);
 	xe_pat_init(gt);
 	xe_gt_enable_host_l2_vram(gt);
 
@@ -568,7 +568,6 @@ int xe_gt_init_hwconfig(struct xe_gt *gt)
 		goto out_fw;
 
 	xe_gt_topology_init(gt);
-	xe_gt_mcr_init(gt);
 
 out_fw:
 	xe_force_wake_put(gt_to_fw(gt), XE_FW_GT);
diff --git a/drivers/gpu/drm/xe/xe_gt_mcr.c b/drivers/gpu/drm/xe/xe_gt_mcr.c
index 6d948a469126..9c4c4a627bc4 100644
--- a/drivers/gpu/drm/xe/xe_gt_mcr.c
+++ b/drivers/gpu/drm/xe/xe_gt_mcr.c
@@ -375,22 +375,6 @@ static const struct {
 	[IMPLICIT_STEERING] = { "IMPLICIT", NULL },
 };
 
-/**
- * xe_gt_mcr_init_early - Early initialization of the MCR support
- * @gt: GT structure
- *
- * Perform early software only initialization of the MCR lock to allow
- * the synchronization on accessing the STEER_SEMAPHORE register and
- * use the xe_gt_mcr_multicast_write() function.
- */
-void xe_gt_mcr_init_early(struct xe_gt *gt)
-{
-	BUILD_BUG_ON(IMPLICIT_STEERING + 1 != NUM_STEERING_TYPES);
-	BUILD_BUG_ON(ARRAY_SIZE(xe_steering_types) != NUM_STEERING_TYPES);
-
-	spin_lock_init(&gt->mcr_lock);
-}
-
 /**
  * xe_gt_mcr_init - Normal initialization of the MCR support
  * @gt: GT structure
@@ -401,9 +385,14 @@ void xe_gt_mcr_init(struct xe_gt *gt)
 {
 	struct xe_device *xe = gt_to_xe(gt);
 
+	BUILD_BUG_ON(IMPLICIT_STEERING + 1 != NUM_STEERING_TYPES);
+	BUILD_BUG_ON(ARRAY_SIZE(xe_steering_types) != NUM_STEERING_TYPES);
+
 	if (IS_SRIOV_VF(xe))
 		return;
 
+	spin_lock_init(&gt->mcr_lock);
+
 	if (gt->info.type == XE_GT_TYPE_MEDIA) {
 		drm_WARN_ON(&xe->drm, MEDIA_VER(xe) < 13);
 
diff --git a/drivers/gpu/drm/xe/xe_gt_mcr.h b/drivers/gpu/drm/xe/xe_gt_mcr.h
index 8d119a0d5493..e7d03e001a49 100644
--- a/drivers/gpu/drm/xe/xe_gt_mcr.h
+++ b/drivers/gpu/drm/xe/xe_gt_mcr.h
@@ -12,7 +12,6 @@
 struct drm_printer;
 struct xe_gt;
 
-void xe_gt_mcr_init_early(struct xe_gt *gt);
 void xe_gt_mcr_init(struct xe_gt *gt);
 
 void xe_gt_mcr_set_implicit_defaults(struct xe_gt *gt);
-- 
2.25.1



More information about the Intel-xe mailing list