[RFC PATCH 1/2] drm/xe: Add has_wmpt GT info

Nirmoy Das nirmoy.das at intel.com
Sat Feb 3 06:05:33 UTC 2024


Add a GT info member to reflect wmtp feature status.

Signed-off-by: Nirmoy Das <nirmoy.das at intel.com>
---
 drivers/gpu/drm/xe/xe_gt_types.h  |  2 ++
 drivers/gpu/drm/xe/xe_hw_engine.c | 15 +++++++++++----
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_gt_types.h b/drivers/gpu/drm/xe/xe_gt_types.h
index 70c615dd1498..2f2fa00c1a04 100644
--- a/drivers/gpu/drm/xe/xe_gt_types.h
+++ b/drivers/gpu/drm/xe/xe_gt_types.h
@@ -119,6 +119,8 @@ struct xe_gt {
 		u64 __engine_mask;
 		/** @info.gmdid: raw GMD_ID value from hardware */
 		u32 gmdid;
+		/** @has_wmtp: gt supports mid-thread preemption */
+		bool has_wmtp;
 	} info;
 
 	/**
diff --git a/drivers/gpu/drm/xe/xe_hw_engine.c b/drivers/gpu/drm/xe/xe_hw_engine.c
index 0d17e32d70c8..82424e5d6033 100644
--- a/drivers/gpu/drm/xe/xe_hw_engine.c
+++ b/drivers/gpu/drm/xe/xe_hw_engine.c
@@ -319,14 +319,11 @@ static bool xe_hw_engine_match_fixed_cslice_mode(const struct xe_gt *gt,
 static bool xe_rtp_cfeg_wmtp_disabled(const struct xe_gt *gt,
 				      const struct xe_hw_engine *hwe)
 {
-	if (GRAPHICS_VER(gt_to_xe(gt)) < 20)
-		return false;
-
 	if (hwe->class != XE_ENGINE_CLASS_COMPUTE &&
 	    hwe->class != XE_ENGINE_CLASS_RENDER)
 		return false;
 
-	return xe_mmio_read32(hwe->gt, XEHP_FUSE4) & CFEG_WMTP_DISABLE;
+	return !gt->info.has_wmtp;
 }
 
 void
@@ -671,6 +668,15 @@ static void read_compute_fuses(struct xe_gt *gt)
 		read_compute_fuses_from_dss(gt);
 }
 
+static void read_wmpt_fuses(struct xe_gt *gt)
+{
+	if (GRAPHICS_VER(gt_to_xe(gt)) < 20)
+		return;
+
+	gt->info.has_wmtp = !(xe_mmio_read32(gt, XEHP_FUSE4) &
+			    CFEG_WMTP_DISABLE);
+}
+
 static void check_gsc_availability(struct xe_gt *gt)
 {
 	struct xe_device *xe = gt_to_xe(gt);
@@ -696,6 +702,7 @@ int xe_hw_engines_init_early(struct xe_gt *gt)
 	read_media_fuses(gt);
 	read_copy_fuses(gt);
 	read_compute_fuses(gt);
+	read_wmpt_fuses(gt);
 	check_gsc_availability(gt);
 
 	BUILD_BUG_ON(XE_HW_ENGINE_PREEMPT_TIMEOUT < XE_HW_ENGINE_PREEMPT_TIMEOUT_MIN);
-- 
2.42.0



More information about the Intel-xe mailing list