]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/xe: Utilize for_each_gt_with_type() for type-specific GT loops
authorMatt Roper <matthew.d.roper@intel.com>
Thu, 5 Mar 2026 22:59:28 +0000 (14:59 -0800)
committerMatt Roper <matthew.d.roper@intel.com>
Mon, 9 Mar 2026 21:19:45 +0000 (14:19 -0700)
Convert existing loops with Coccinelle via the following semantic patch:

    @@
    identifier GT, XE, ID;
    iterator name for_each_gt, for_each_gt_with_type;
    @@
    - for_each_gt(GT, XE, ID) {
    + for_each_gt_with_type(GT, XE, ID, BIT(XE_GT_TYPE_MAIN)) {
    -         if (xe_gt_is_media_type(GT))
    -                 continue;
              ...
      }

    @@
    identifier GT, XE, ID;
    iterator name for_each_gt, for_each_gt_with_type;
    @@
    - for_each_gt(GT, XE, ID) {
    + for_each_gt_with_type(GT, XE, ID, BIT(XE_GT_TYPE_MEDIA)) {
    -         if (xe_gt_is_main_type(GT))
    -                 continue;
              ...
      }

    @@
    identifier GT, XE, ID;
    iterator name for_each_gt, for_each_gt_with_type;
    @@
    - for_each_gt(GT, XE, ID) {
    + for_each_gt_with_type(GT, XE, ID, BIT(XE_GT_TYPE_MAIN)) {
    -         if (!xe_gt_is_main_type(GT))
    -                 continue;
              ...
      }

    @@
    identifier GT, XE, ID;
    iterator name for_each_gt, for_each_gt_with_type;
    @@
    - for_each_gt(GT, XE, ID) {
    + for_each_gt_with_type(GT, XE, ID, BIT(XE_GT_TYPE_MEDIA)) {
    -         if (xe_gt_is_media_type(GT))
    -                 continue;
              ...
      }

No functional change expected.

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patch.msgid.link/20260305-gt-type-loops-v1-2-aa42e9fc3f06@intel.com
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
drivers/gpu/drm/xe/xe_device.c
drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c

index 4b68a2d5565122ac7e9e653b57ed7fe3e13070c9..3ac9c5611b814987f6accf4abf6e4f579a8fa868 100644 (file)
@@ -1074,10 +1074,7 @@ static void tdf_request_sync(struct xe_device *xe)
        struct xe_gt *gt;
        u8 id;
 
-       for_each_gt(gt, xe, id) {
-               if (xe_gt_is_media_type(gt))
-                       continue;
-
+       for_each_gt_with_type(gt, xe, id, BIT(XE_GT_TYPE_MAIN)) {
                CLASS(xe_force_wake, fw_ref)(gt_to_fw(gt), XE_FW_GT);
                if (!fw_ref.domains)
                        return;
index b867203b49977537a31c1a1780c0409d5541c83d..2f376b5fb08827d81a070735c4b4a35338723552 100644 (file)
@@ -1579,10 +1579,7 @@ static int pf_update_vf_lmtt(struct xe_device *xe, unsigned int vfid)
                        goto fail;
 
                offset = 0;
-               for_each_gt(gt, xe, gtid) {
-                       if (xe_gt_is_media_type(gt))
-                               continue;
-
+               for_each_gt_with_type(gt, xe, gtid, BIT(XE_GT_TYPE_MAIN)) {
                        config = pf_pick_vf_config(gt, vfid);
                        bo = config->lmem_obj;
                        if (!bo)