Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Matt Roper <matthew.d.roper@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: Farah Kassabri <farah.kassabri@intel.com>,
	 Rodrigo Vivi <rodrigo.vivi@intel.com>,
	 Gustavo Sousa <gustavo.sousa@intel.com>,
	 Matt Roper <matthew.d.roper@intel.com>
Subject: [PATCH 2/2] drm/xe: Utilize for_each_gt_with_type() for type-specific GT loops
Date: Thu, 05 Mar 2026 14:59:28 -0800	[thread overview]
Message-ID: <20260305-gt-type-loops-v1-2-aa42e9fc3f06@intel.com> (raw)
In-Reply-To: <20260305-gt-type-loops-v1-0-aa42e9fc3f06@intel.com>

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.

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
---
 drivers/gpu/drm/xe/xe_device.c             | 5 +----
 drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c | 5 +----
 2 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c
index 3462645ca13c79b9cfed0de86cfffe150b51942a..e77a3a3db73dbf8509d857b58a2dc3964d9aa0ca 100644
--- a/drivers/gpu/drm/xe/xe_device.c
+++ b/drivers/gpu/drm/xe/xe_device.c
@@ -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;
diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c b/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c
index b867203b49977537a31c1a1780c0409d5541c83d..2f376b5fb08827d81a070735c4b4a35338723552 100644
--- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c
+++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c
@@ -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)

-- 
2.53.0


  parent reply	other threads:[~2026-03-05 23:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-05 22:59 [PATCH 0/2] Add type-specific GT loop iterator Matt Roper
2026-03-05 22:59 ` [PATCH 1/2] drm/xe: Add for_each_gt_with_type() iterator Matt Roper
2026-03-06  0:49   ` Rodrigo Vivi
2026-03-05 22:59 ` Matt Roper [this message]
2026-03-06  0:49   ` [PATCH 2/2] drm/xe: Utilize for_each_gt_with_type() for type-specific GT loops Rodrigo Vivi
2026-03-06 17:11 ` ✗ CI.checkpatch: warning for Add type-specific GT loop iterator Patchwork
2026-03-06 17:12 ` ✓ CI.KUnit: success " Patchwork
2026-03-06 18:11 ` ✓ Xe.CI.BAT: " Patchwork
2026-03-07 19:57 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-03-09 21:41   ` Matt Roper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260305-gt-type-loops-v1-2-aa42e9fc3f06@intel.com \
    --to=matthew.d.roper@intel.com \
    --cc=farah.kassabri@intel.com \
    --cc=gustavo.sousa@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=rodrigo.vivi@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox