@@ -291,7 +291,7 @@ static void init_steering_mslice(struct xe_gt *gt)
gt->steering[LNCF].instance_target = 0; /* unused */
}
-static int num_dss_per_grp(struct xe_gt *gt)
+int xe_gt_mcr_get_dss_per_group(struct xe_gt *gt)
{
struct xe_device *xe = gt_to_xe(gt);
@@ -313,7 +313,7 @@ static void init_steering_dss(struct xe_gt *gt)
{
unsigned int dss = min(xe_dss_mask_group_ffs(gt->fuse_topo.g_dss_mask, 0, 0),
xe_dss_mask_group_ffs(gt->fuse_topo.c_dss_mask, 0, 0));
- unsigned int dss_per_grp = num_dss_per_grp(gt);
+ int dss_per_grp = xe_gt_mcr_get_dss_per_group(gt);
gt->steering[DSS].group_target = dss / dss_per_grp;
gt->steering[DSS].instance_target = dss % dss_per_grp;
@@ -14,6 +14,7 @@ struct xe_gt;
void xe_gt_mcr_init(struct xe_gt *gt);
void xe_gt_mcr_set_implicit_defaults(struct xe_gt *gt);
+int xe_gt_mcr_get_dss_per_group(struct xe_gt *gt);
u32 xe_gt_mcr_unicast_read(struct xe_gt *gt, struct xe_reg_mcr mcr_reg,
int group, int instance);
@@ -11,9 +11,6 @@
#include "xe_gt.h"
#include "xe_mmio.h"
-#define XE_MAX_DSS_FUSE_BITS (32 * XE_MAX_DSS_FUSE_REGS)
-#define XE_MAX_EU_FUSE_BITS (32 * XE_MAX_EU_FUSE_REGS)
-
static void
load_dss_mask(struct xe_gt *gt, xe_dss_mask_t mask, int numregs, ...)
{
@@ -93,6 +93,33 @@
{ SFC_DONE(2), 0, 0, "SFC_DONE[2]" }, \
{ SFC_DONE(3), 0, 0, "SFC_DONE[3]" }
+static inline void xe_gt_mcr_get_ss_steering(struct xe_gt *gt, unsigned int dss,
+ unsigned int *group, unsigned int *instance)
+{
+ int dss_per_grp = xe_gt_mcr_get_dss_per_group(gt);
+ *group = dss / dss_per_grp;
+ *instance = dss % dss_per_grp;
+}
+
+static inline bool xe_sseu_has_subslice(struct xe_gt *gt, int slice, int subslice)
+{
+ int dss_per_grp = xe_gt_mcr_get_dss_per_group(gt);
+ int index = slice * dss_per_grp + subslice;
+ return index >= XE_MAX_DSS_FUSE_BITS ? false : test_bit(index, gt->fuse_topo.g_dss_mask);
+}
+
+#define _HAS_SS(ss_, gt_, group_, instance_) xe_sseu_has_subslice(gt_, group_, instance_)
+
+/*
+ * Loop over each subslice/DSS and determine the group and instance IDs that
+ * should be used to steer MCR accesses toward this DSS.
+ */
+#define for_each_ss_steering(ss_, gt_, group_, instance_) \
+ for (ss_ = 0, xe_gt_mcr_get_ss_steering(gt_, 0, &group_, &instance_); \
+ ss_ < XE_MAX_DSS_FUSE_BITS; \
+ ss_++, xe_gt_mcr_get_ss_steering(gt_, ss_, &group_, &instance_)) \
+ for_each_if(_HAS_SS(ss_, gt_, group_, instance_))
+
int xe_guc_capture_init(struct xe_guc *guc)
{
return 0;
@@ -65,6 +65,9 @@ struct xe_bo;
struct xe_execlist_port;
struct xe_gt;
+#define XE_MAX_DSS_FUSE_BITS (32 * XE_MAX_DSS_FUSE_REGS)
+#define XE_MAX_EU_FUSE_BITS (32 * XE_MAX_EU_FUSE_REGS)
+
/**
* struct xe_hw_engine_class_intf - per hw engine class struct interface
*
Expose helper for dss per group of mcr, GuC error capture feature need this info to prepare buffer required. Signed-off-by: Zhanjun Dong <zhanjun.dong@intel.com> --- drivers/gpu/drm/xe/xe_gt_mcr.c | 4 ++-- drivers/gpu/drm/xe/xe_gt_mcr.h | 1 + drivers/gpu/drm/xe/xe_gt_topology.c | 3 --- drivers/gpu/drm/xe/xe_guc_capture.c | 27 +++++++++++++++++++++++++ drivers/gpu/drm/xe/xe_hw_engine_types.h | 3 +++ 5 files changed, 33 insertions(+), 5 deletions(-)