Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: be614ea19dad ("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>

+34 -2
+24 -2
drivers/gpu/drm/xe/xe_gt_mcr.c
··· 268 268 {}, 269 269 }; 270 270 271 + static const struct xe_mmio_range xe3p_xpc_node_steering_table[] = { 272 + { 0x00B000, 0x00B0FF }, 273 + { 0x00D880, 0x00D8FF }, 274 + {}, 275 + }; 276 + 271 277 static const struct xe_mmio_range xe3p_xpc_instance0_steering_table[] = { 272 278 { 0x00B500, 0x00B6FF }, /* PSMI */ 273 279 { 0x00C800, 0x00CFFF }, /* GAMCTRL */ ··· 283 277 284 278 static void init_steering_l3bank(struct xe_gt *gt) 285 279 { 280 + struct xe_device *xe = gt_to_xe(gt); 286 281 struct xe_mmio *mmio = &gt->mmio; 287 282 288 - if (GRAPHICS_VERx100(gt_to_xe(gt)) >= 1270) { 283 + if (GRAPHICS_VER(xe) >= 35) { 284 + unsigned int first_bank = xe_l3_bank_mask_ffs(gt->fuse_topo.l3_bank_mask); 285 + const int banks_per_node = 4; 286 + unsigned int node = first_bank / banks_per_node; 287 + 288 + /* L3BANK ranges place node in grpID, bank in instanceid */ 289 + gt->steering[L3BANK].group_target = node; 290 + gt->steering[L3BANK].instance_target = first_bank % banks_per_node; 291 + 292 + /* NODE ranges split the node across grpid and instanceid */ 293 + gt->steering[NODE].group_target = node >> 1; 294 + gt->steering[NODE].instance_target = node & 1; 295 + } else if (GRAPHICS_VERx100(xe) >= 1270) { 289 296 u32 mslice_mask = REG_FIELD_GET(MEML3_EN_MASK, 290 297 xe_mmio_read32(mmio, MIRROR_FUSE3)); 291 298 u32 bank_mask = REG_FIELD_GET(GT_L3_EXC_MASK, ··· 311 292 gt->steering[L3BANK].group_target = __ffs(mslice_mask); 312 293 gt->steering[L3BANK].instance_target = 313 294 bank_mask & BIT(0) ? 0 : 2; 314 - } else if (gt_to_xe(gt)->info.platform == XE_DG2) { 295 + } else if (xe->info.platform == XE_DG2) { 315 296 u32 mslice_mask = REG_FIELD_GET(MEML3_EN_MASK, 316 297 xe_mmio_read32(mmio, MIRROR_FUSE3)); 317 298 u32 bank = __ffs(mslice_mask) * 8; ··· 477 458 void (*init)(struct xe_gt *gt); 478 459 } xe_steering_types[] = { 479 460 [L3BANK] = { "L3BANK", init_steering_l3bank }, 461 + [NODE] = { "NODE", NULL }, /* initialized by l3bank init */ 480 462 [MSLICE] = { "MSLICE", init_steering_mslice }, 481 463 [LNCF] = { "LNCF", NULL }, /* initialized by mslice init */ 482 464 [DSS] = { "DSS / XeCore", init_steering_dss }, ··· 532 512 gt->steering[DSS].ranges = xe3p_xpc_xecore_steering_table; 533 513 gt->steering[GAM1].ranges = xe3p_xpc_gam_grp1_steering_table; 534 514 gt->steering[INSTANCE0].ranges = xe3p_xpc_instance0_steering_table; 515 + gt->steering[L3BANK].ranges = xelpg_l3bank_steering_table; 516 + gt->steering[NODE].ranges = xe3p_xpc_node_steering_table; 535 517 } else if (GRAPHICS_VER(xe) >= 20) { 536 518 gt->steering[DSS].ranges = xe2lpg_dss_steering_table; 537 519 gt->steering[SQIDI_PSMI].ranges = xe2lpg_sqidi_psmi_steering_table;
+7
drivers/gpu/drm/xe/xe_gt_topology.c
··· 309 309 return find_next_bit(mask, XE_MAX_DSS_FUSE_BITS, groupnum * groupsize); 310 310 } 311 311 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 + 312 319 /** 313 320 * xe_gt_topology_has_dss_in_quadrant - check fusing of DSS in GT quadrant 314 321 * @gt: GT to check
+2
drivers/gpu/drm/xe/xe_gt_topology.h
··· 40 40 41 41 unsigned int 42 42 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); 43 45 44 46 bool 45 47 xe_gt_topology_has_dss_in_quadrant(struct xe_gt *gt, int quad);
+1
drivers/gpu/drm/xe/xe_gt_types.h
··· 66 66 */ 67 67 enum xe_steering_type { 68 68 L3BANK, 69 + NODE, 69 70 MSLICE, 70 71 LNCF, 71 72 DSS,