]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/xe: Add helpers to loop over geometry and compute DSS
authorJosé Roberto de Souza <jose.souza@intel.com>
Wed, 24 Apr 2024 14:03:02 +0000 (07:03 -0700)
committerJosé Roberto de Souza <jose.souza@intel.com>
Wed, 24 Apr 2024 16:06:38 +0000 (09:06 -0700)
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
drivers/gpu/drm/xe/xe_gt_mcr.h
drivers/gpu/drm/xe/xe_gt_topology.c
drivers/gpu/drm/xe/xe_gt_topology.h

index a7f4ab1aa584b8568bea7db13cce1662cf9d9579..e7d03e001a49f6abcae355bca4acf42db67f3fd5 100644 (file)
@@ -40,4 +40,28 @@ void xe_gt_mcr_get_dss_steering(struct xe_gt *gt, unsigned int dss, u16 *group,
        for_each_dss((dss), (gt)) \
                for_each_if((xe_gt_mcr_get_dss_steering((gt), (dss), &(group), &(instance)), true))
 
+/*
+ * Loop over each DSS available for geometry and determine the group and
+ * instance IDs that should be used to steer MCR accesses toward this DSS.
+ * @dss: DSS ID to obtain steering for
+ * @gt: GT structure
+ * @group: steering group ID, data type: u16
+ * @instance: steering instance ID, data type: u16
+ */
+#define for_each_geometry_dss(dss, gt, group, instance) \
+               for_each_dss_steering(dss, gt, group, instance) \
+                       if (xe_gt_has_geometry_dss(gt, dss))
+
+/*
+ * Loop over each DSS available for compute and determine the group and
+ * instance IDs that should be used to steer MCR accesses toward this DSS.
+ * @dss: DSS ID to obtain steering for
+ * @gt: GT structure
+ * @group: steering group ID, data type: u16
+ * @instance: steering instance ID, data type: u16
+ */
+#define for_each_compute_dss(dss, gt, group, instance) \
+               for_each_dss_steering(dss, gt, group, instance) \
+                       if (xe_gt_has_compute_dss(gt, dss))
+
 #endif /* _XE_GT_MCR_H_ */
index 3733e7a6860d365226eadb3967cd726c1fe63795..af841d801a8f566af0fd7a1e8309819948c725a0 100644 (file)
@@ -278,3 +278,13 @@ bool xe_gt_topology_has_dss_in_quadrant(struct xe_gt *gt, int quad)
 
        return quad_first < (quad + 1) * dss_per_quad;
 }
+
+bool xe_gt_has_geometry_dss(struct xe_gt *gt, unsigned int dss)
+{
+       return test_bit(dss, gt->fuse_topo.g_dss_mask);
+}
+
+bool xe_gt_has_compute_dss(struct xe_gt *gt, unsigned int dss)
+{
+       return test_bit(dss, gt->fuse_topo.c_dss_mask);
+}
index b3e357777a6e79a732cc1d9d429b7ce332a80024..746b325bbf6e4a51fe9c6a7cb8fb6ce18f93b408 100644 (file)
@@ -33,4 +33,7 @@ bool xe_dss_mask_empty(const xe_dss_mask_t mask);
 bool
 xe_gt_topology_has_dss_in_quadrant(struct xe_gt *gt, int quad);
 
+bool xe_gt_has_geometry_dss(struct xe_gt *gt, unsigned int dss);
+bool xe_gt_has_compute_dss(struct xe_gt *gt, unsigned int dss);
+
 #endif /* _XE_GT_TOPOLOGY_H_ */