[Intel-xe] [RFC 06/25] drm/xe: Introduce for_each_dss_steering loop

Mika Kuoppala mika.kuoppala at linux.intel.com
Mon Nov 6 11:18:26 UTC 2023


From: Dominik Grzegorzek <dominik.grzegorzek at intel.com>

Implement macro allowing to loop over each DSS (both compute and
geometry) and get mcr steering for each.

v2: - Respect pre-XE_Hp platforms (with HSW-style slice).

Signed-off-by: Dominik Grzegorzek <dominik.grzegorzek at intel.com>
---
 drivers/gpu/drm/xe/xe_gt_mcr.c | 27 +++++++++++++++++++++++++++
 drivers/gpu/drm/xe/xe_gt_mcr.h | 15 +++++++++++++++
 2 files changed, 42 insertions(+)

diff --git a/drivers/gpu/drm/xe/xe_gt_mcr.c b/drivers/gpu/drm/xe/xe_gt_mcr.c
index 77925b35cf8d..2994adf7e605 100644
--- a/drivers/gpu/drm/xe/xe_gt_mcr.c
+++ b/drivers/gpu/drm/xe/xe_gt_mcr.c
@@ -683,3 +683,30 @@ void xe_gt_mcr_steering_dump(struct xe_gt *gt, struct drm_printer *p)
 		}
 	}
 }
+
+/**
+ * xe_gt_mcr_get_dss_steering - returns the group/instance steering for a SS
+ * @gt: GT structure
+ * @dss: DSS ID to obtain steering for
+ * @group: pointer to storage for steering group ID
+ * @instance: pointer to storage for steering instance ID
+ *
+ * Returns the steering IDs (via the @group and @instance parameters) that
+ * correspond to a specific subslice/DSS ID.
+ */
+void xe_gt_mcr_get_dss_steering(struct xe_gt *gt, int dss,
+				int *group, int *instance)
+{
+	struct xe_device *xe = gt_to_xe(gt);
+	unsigned int dss_per_grp;
+
+	if (xe->info.platform == XE_PVC)
+		dss_per_grp = 8;
+	else if (GRAPHICS_VERx100(xe) >= 1250)
+		dss_per_grp = 4;
+	else
+		dss_per_grp = 6;
+
+	*group = dss / dss_per_grp;
+	*instance = dss % dss_per_grp;
+}
diff --git a/drivers/gpu/drm/xe/xe_gt_mcr.h b/drivers/gpu/drm/xe/xe_gt_mcr.h
index 27ca1bc880a0..71716f0f7cde 100644
--- a/drivers/gpu/drm/xe/xe_gt_mcr.h
+++ b/drivers/gpu/drm/xe/xe_gt_mcr.h
@@ -7,6 +7,7 @@
 #define _XE_GT_MCR_H_
 
 #include "regs/xe_reg_defs.h"
+#include "xe_gt_types.h"
 
 struct drm_printer;
 struct xe_gt;
@@ -26,4 +27,18 @@ void xe_gt_mcr_multicast_write(struct xe_gt *gt, struct xe_reg_mcr mcr_reg,
 
 void xe_gt_mcr_steering_dump(struct xe_gt *gt, struct drm_printer *p);
 
+void xe_gt_mcr_get_dss_steering(struct xe_gt *gt, int dss, int *group, int *instance);
+
+/* Loop over each DSS (inlc. geometry and compute) and determine the group and instance IDs that
+ * should be used to steer MCR accesses toward this DSS. Fused-off subslices
+ * are skipped.
+ */
+#define for_each_dss_steering(ss_, gt_, group_, instance_) \
+	for (ss_ = 0, xe_gt_mcr_get_dss_steering(gt_, 0, &group_, &instance_); \
+	     ss_ < XE_MAX_DSS_FUSE_BITS; \
+	     ss_++, xe_gt_mcr_get_dss_steering(gt_, ss_, &group_, &instance_)) \
+		for_each_if(test_bit(ss_, gt_->fuse_topo.c_dss_mask) || \
+			    test_bit(ss_, gt_->fuse_topo.g_dss_mask))
+
+
 #endif /* _XE_GT_MCR_H_ */
-- 
2.34.1



More information about the Intel-xe mailing list