]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/xe/gt: Add engine masks for each class
authorDaniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Thu, 18 Dec 2025 22:38:47 +0000 (14:38 -0800)
committerDaniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Mon, 22 Dec 2025 18:21:56 +0000 (10:21 -0800)
Follow up patches will need the engine masks for VCS and VECS engines.
Since we already have a macro for the CCS engines, just extend the same
approach to all classes.

To avoid confusion with the XE_HW_ENGINE_*_MASK masks, the new macros
use the _INSTANCES suffix instead. For consistency, rename CCS_MASK to
CCS_INSTANCES as well.

Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Reviewed-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Link: https://patch.msgid.link/20251218223846.1146344-15-daniele.ceraolospurio@intel.com
drivers/gpu/drm/xe/xe_gt.h
drivers/gpu/drm/xe/xe_gt_ccs_mode.c
drivers/gpu/drm/xe/xe_gt_ccs_mode.h
drivers/gpu/drm/xe/xe_guc.c
drivers/gpu/drm/xe/xe_guc_submit.c

index 94969ddd9d8853b4be8782537f057ff443a3c2af..a2ba80c954a64a878bf6153cfe61d80ab1d88b53 100644 (file)
                for_each_if(((hwe__) = (gt__)->hw_engines + (id__)) && \
                          xe_hw_engine_is_valid((hwe__)))
 
-#define CCS_MASK(gt) (((gt)->info.engine_mask & XE_HW_ENGINE_CCS_MASK) >> XE_HW_ENGINE_CCS0)
+#define XE_ENGINE_INSTANCES_FROM_MASK(gt, NAME) \
+       (((gt)->info.engine_mask & XE_HW_ENGINE_##NAME##_MASK) >> XE_HW_ENGINE_##NAME##0)
+
+#define RCS_INSTANCES(gt) XE_ENGINE_INSTANCES_FROM_MASK(gt, RCS)
+#define VCS_INSTANCES(gt) XE_ENGINE_INSTANCES_FROM_MASK(gt, VCS)
+#define VECS_INSTANCES(gt) XE_ENGINE_INSTANCES_FROM_MASK(gt, VECS)
+#define CCS_INSTANCES(gt) XE_ENGINE_INSTANCES_FROM_MASK(gt, CCS)
+#define GSCCS_INSTANCES(gt) XE_ENGINE_INSTANCES_FROM_MASK(gt, GSCCS)
 
 #define GT_VER(gt) ({ \
        typeof(gt) gt_ = (gt); \
index 50fffc9ebf62a1d0a051bbfd8698d4ec6de4d93e..91ac22ef5703b312922a2a10bd5cbb58a55a7795 100644 (file)
@@ -17,7 +17,7 @@
 static void __xe_gt_apply_ccs_mode(struct xe_gt *gt, u32 num_engines)
 {
        u32 mode = CCS_MODE_CSLICE_0_3_MASK; /* disable all by default */
-       int num_slices = hweight32(CCS_MASK(gt));
+       int num_slices = hweight32(CCS_INSTANCES(gt));
        struct xe_device *xe = gt_to_xe(gt);
        int width, cslice = 0;
        u32 config = 0;
@@ -59,7 +59,7 @@ static void __xe_gt_apply_ccs_mode(struct xe_gt *gt, u32 num_engines)
                        config |= BIT(hwe->instance) << XE_HW_ENGINE_CCS0;
 
                        /* If a slice is fused off, leave disabled */
-                       while ((CCS_MASK(gt) & BIT(cslice)) == 0)
+                       while ((CCS_INSTANCES(gt) & BIT(cslice)) == 0)
                                cslice++;
 
                        mode &= ~CCS_MODE_CSLICE(cslice, CCS_MODE_CSLICE_MASK);
@@ -94,7 +94,7 @@ num_cslices_show(struct device *kdev,
 {
        struct xe_gt *gt = kobj_to_gt(&kdev->kobj);
 
-       return sysfs_emit(buf, "%u\n", hweight32(CCS_MASK(gt)));
+       return sysfs_emit(buf, "%u\n", hweight32(CCS_INSTANCES(gt)));
 }
 
 static DEVICE_ATTR_RO(num_cslices);
@@ -131,7 +131,7 @@ ccs_mode_store(struct device *kdev, struct device_attribute *attr,
         * Ensure number of engines specified is valid and there is an
         * exact multiple of engines for slices.
         */
-       num_slices = hweight32(CCS_MASK(gt));
+       num_slices = hweight32(CCS_INSTANCES(gt));
        if (!num_engines || num_engines > num_slices || num_slices % num_engines) {
                xe_gt_dbg(gt, "Invalid compute config, %d engines %d slices\n",
                          num_engines, num_slices);
index f8779852cf0d26587e3b579f351dcdeaf93efa5d..ef3b853f5c8c0eefae0bccd88249d5814104f08e 100644 (file)
@@ -17,7 +17,7 @@ int xe_gt_ccs_mode_sysfs_init(struct xe_gt *gt);
 static inline bool xe_gt_ccs_mode_enabled(const struct xe_gt *gt)
 {
        /* Check if there are more than one compute engines available */
-       return hweight32(CCS_MASK(gt)) > 1;
+       return hweight32(CCS_INSTANCES(gt)) > 1;
 }
 
 #endif
index 09ac092c3687497c2b324fb629d733670588aaf1..44360437beeb05460838e276e591cebdc7f2db97 100644 (file)
@@ -175,7 +175,7 @@ static bool needs_wa_dual_queue(struct xe_gt *gt)
         * the DUAL_QUEUE_WA on all newer platforms on GTs that have CCS engines
         * to move management back to the GuC.
         */
-       if (CCS_MASK(gt) && GRAPHICS_VERx100(gt_to_xe(gt)) >= 1270)
+       if (CCS_INSTANCES(gt) && GRAPHICS_VERx100(gt_to_xe(gt)) >= 1270)
                return true;
 
        return false;
index 0b590271c32688aafa16db1b9ffe3cd09c790213..b8d20c05d343a7aa9f2b08d0c30e49008fc9d3e6 100644 (file)
@@ -407,7 +407,7 @@ static int guc_init_global_schedule_policy(struct xe_guc *guc)
 
        *emit++ = XE_GUC_ACTION_UPDATE_SCHEDULING_POLICIES_KLV;
 
-       if (CCS_MASK(guc_to_gt(guc)))
+       if (CCS_INSTANCES(guc_to_gt(guc)))
                emit = emit_render_compute_yield_klv(emit);
 
        count = emit - data;