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

drm/xe: Add helpers to loop over geometry and compute DSS

Some DSS can only be available for geometry while others can only be
available for compute.
So here adding helpers to loop only available DSS for given usage.

User of this helper will come in the next patch.

v2:
- drop has_dss()

Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Matt Roper <matthew.d.roper@intel.com>
Cc: Zhanjun Dong <zhanjun.dong@intel.com>
Cc: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240424140319.61651-2-jose.souza@intel.com

+37
+24
drivers/gpu/drm/xe/xe_gt_mcr.h
··· 40 40 for_each_dss((dss), (gt)) \ 41 41 for_each_if((xe_gt_mcr_get_dss_steering((gt), (dss), &(group), &(instance)), true)) 42 42 43 + /* 44 + * Loop over each DSS available for geometry and determine the group and 45 + * instance IDs that should be used to steer MCR accesses toward this DSS. 46 + * @dss: DSS ID to obtain steering for 47 + * @gt: GT structure 48 + * @group: steering group ID, data type: u16 49 + * @instance: steering instance ID, data type: u16 50 + */ 51 + #define for_each_geometry_dss(dss, gt, group, instance) \ 52 + for_each_dss_steering(dss, gt, group, instance) \ 53 + if (xe_gt_has_geometry_dss(gt, dss)) 54 + 55 + /* 56 + * Loop over each DSS available for compute and determine the group and 57 + * instance IDs that should be used to steer MCR accesses toward this DSS. 58 + * @dss: DSS ID to obtain steering for 59 + * @gt: GT structure 60 + * @group: steering group ID, data type: u16 61 + * @instance: steering instance ID, data type: u16 62 + */ 63 + #define for_each_compute_dss(dss, gt, group, instance) \ 64 + for_each_dss_steering(dss, gt, group, instance) \ 65 + if (xe_gt_has_compute_dss(gt, dss)) 66 + 43 67 #endif /* _XE_GT_MCR_H_ */
+10
drivers/gpu/drm/xe/xe_gt_topology.c
··· 278 278 279 279 return quad_first < (quad + 1) * dss_per_quad; 280 280 } 281 + 282 + bool xe_gt_has_geometry_dss(struct xe_gt *gt, unsigned int dss) 283 + { 284 + return test_bit(dss, gt->fuse_topo.g_dss_mask); 285 + } 286 + 287 + bool xe_gt_has_compute_dss(struct xe_gt *gt, unsigned int dss) 288 + { 289 + return test_bit(dss, gt->fuse_topo.c_dss_mask); 290 + }
+3
drivers/gpu/drm/xe/xe_gt_topology.h
··· 33 33 bool 34 34 xe_gt_topology_has_dss_in_quadrant(struct xe_gt *gt, int quad); 35 35 36 + bool xe_gt_has_geometry_dss(struct xe_gt *gt, unsigned int dss); 37 + bool xe_gt_has_compute_dss(struct xe_gt *gt, unsigned int dss); 38 + 36 39 #endif /* _XE_GT_TOPOLOGY_H_ */