Skip to content

Commit 6d5511e

Browse files
committed
drm/xe/xe3p_xpc: Add MCR steering for NODE and L3BANK ranges
The bspec was originally missing the information related to steering of L3-related ranges. Now that a late-breaking spec update has added the necessary information, implement the steering rules in the code. Note that the sole L3BANK range is the same as the one used on Xe_LPG, so we can re-use the existing table for that MCR type. Bspec: 74418 Fixes: be614ea ("drm/xe/xe3p_xpc: Add MCR steering") Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com> Link: https://lore.kernel.org/r/20251021224556.437970-3-matthew.d.roper@intel.com Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
1 parent 5fa20ff commit 6d5511e

4 files changed

Lines changed: 34 additions & 2 deletions

File tree

drivers/gpu/drm/xe/xe_gt_mcr.c

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,12 @@ static const struct xe_mmio_range xe3p_xpc_gam_grp1_steering_table[] = {
268268
{},
269269
};
270270

271+
static const struct xe_mmio_range xe3p_xpc_node_steering_table[] = {
272+
{ 0x00B000, 0x00B0FF },
273+
{ 0x00D880, 0x00D8FF },
274+
{},
275+
};
276+
271277
static const struct xe_mmio_range xe3p_xpc_instance0_steering_table[] = {
272278
{ 0x00B500, 0x00B6FF }, /* PSMI */
273279
{ 0x00C800, 0x00CFFF }, /* GAMCTRL */
@@ -277,9 +283,22 @@ static const struct xe_mmio_range xe3p_xpc_instance0_steering_table[] = {
277283

278284
static void init_steering_l3bank(struct xe_gt *gt)
279285
{
286+
struct xe_device *xe = gt_to_xe(gt);
280287
struct xe_mmio *mmio = &gt->mmio;
281288

282-
if (GRAPHICS_VERx100(gt_to_xe(gt)) >= 1270) {
289+
if (GRAPHICS_VER(xe) >= 35) {
290+
unsigned int first_bank = xe_l3_bank_mask_ffs(gt->fuse_topo.l3_bank_mask);
291+
const int banks_per_node = 4;
292+
unsigned int node = first_bank / banks_per_node;
293+
294+
/* L3BANK ranges place node in grpID, bank in instanceid */
295+
gt->steering[L3BANK].group_target = node;
296+
gt->steering[L3BANK].instance_target = first_bank % banks_per_node;
297+
298+
/* NODE ranges split the node across grpid and instanceid */
299+
gt->steering[NODE].group_target = node >> 1;
300+
gt->steering[NODE].instance_target = node & 1;
301+
} else if (GRAPHICS_VERx100(xe) >= 1270) {
283302
u32 mslice_mask = REG_FIELD_GET(MEML3_EN_MASK,
284303
xe_mmio_read32(mmio, MIRROR_FUSE3));
285304
u32 bank_mask = REG_FIELD_GET(GT_L3_EXC_MASK,
@@ -292,7 +311,7 @@ static void init_steering_l3bank(struct xe_gt *gt)
292311
gt->steering[L3BANK].group_target = __ffs(mslice_mask);
293312
gt->steering[L3BANK].instance_target =
294313
bank_mask & BIT(0) ? 0 : 2;
295-
} else if (gt_to_xe(gt)->info.platform == XE_DG2) {
314+
} else if (xe->info.platform == XE_DG2) {
296315
u32 mslice_mask = REG_FIELD_GET(MEML3_EN_MASK,
297316
xe_mmio_read32(mmio, MIRROR_FUSE3));
298317
u32 bank = __ffs(mslice_mask) * 8;
@@ -458,6 +477,7 @@ static const struct {
458477
void (*init)(struct xe_gt *gt);
459478
} xe_steering_types[] = {
460479
[L3BANK] = { "L3BANK", init_steering_l3bank },
480+
[NODE] = { "NODE", NULL }, /* initialized by l3bank init */
461481
[MSLICE] = { "MSLICE", init_steering_mslice },
462482
[LNCF] = { "LNCF", NULL }, /* initialized by mslice init */
463483
[DSS] = { "DSS / XeCore", init_steering_dss },
@@ -512,6 +532,8 @@ void xe_gt_mcr_init_early(struct xe_gt *gt)
512532
gt->steering[DSS].ranges = xe3p_xpc_xecore_steering_table;
513533
gt->steering[GAM1].ranges = xe3p_xpc_gam_grp1_steering_table;
514534
gt->steering[INSTANCE0].ranges = xe3p_xpc_instance0_steering_table;
535+
gt->steering[L3BANK].ranges = xelpg_l3bank_steering_table;
536+
gt->steering[NODE].ranges = xe3p_xpc_node_steering_table;
515537
} else if (GRAPHICS_VER(xe) >= 20) {
516538
gt->steering[DSS].ranges = xe2lpg_dss_steering_table;
517539
gt->steering[SQIDI_PSMI].ranges = xe2lpg_sqidi_psmi_steering_table;

drivers/gpu/drm/xe/xe_gt_topology.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,13 @@ xe_dss_mask_group_ffs(const xe_dss_mask_t mask, int groupsize, int groupnum)
309309
return find_next_bit(mask, XE_MAX_DSS_FUSE_BITS, groupnum * groupsize);
310310
}
311311

312+
/* Used to obtain the index of the first L3 bank. */
313+
unsigned int
314+
xe_l3_bank_mask_ffs(const xe_l3_bank_mask_t mask)
315+
{
316+
return find_first_bit(mask, XE_MAX_L3_BANK_MASK_BITS);
317+
}
318+
312319
/**
313320
* xe_gt_topology_has_dss_in_quadrant - check fusing of DSS in GT quadrant
314321
* @gt: GT to check

drivers/gpu/drm/xe/xe_gt_topology.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ xe_gt_topology_mask_last_dss(const xe_dss_mask_t mask)
4040

4141
unsigned int
4242
xe_dss_mask_group_ffs(const xe_dss_mask_t mask, int groupsize, int groupnum);
43+
unsigned int
44+
xe_l3_bank_mask_ffs(const xe_l3_bank_mask_t mask);
4345

4446
bool
4547
xe_gt_topology_has_dss_in_quadrant(struct xe_gt *gt, int quad);

drivers/gpu/drm/xe/xe_gt_types.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ struct xe_mmio_range {
6666
*/
6767
enum xe_steering_type {
6868
L3BANK,
69+
NODE,
6970
MSLICE,
7071
LNCF,
7172
DSS,

0 commit comments

Comments
 (0)