All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Matt Roper <matthew.d.roper@intel.com>
Cc: <intel-xe@lists.freedesktop.org>,
	Farah Kassabri <farah.kassabri@intel.com>,
	Gustavo Sousa <gustavo.sousa@intel.com>
Subject: Re: [PATCH 1/2] drm/xe: Add for_each_gt_with_type() iterator
Date: Thu, 5 Mar 2026 19:49:09 -0500	[thread overview]
Message-ID: <aaokhZKjmILjakBh@intel.com> (raw)
In-Reply-To: <20260305-gt-type-loops-v1-1-aa42e9fc3f06@intel.com>

On Thu, Mar 05, 2026 at 02:59:27PM -0800, Matt Roper wrote:
> There are a couple places in the driver today that have GT loops that
> only need to operate on a specific type of GT.  E.g.,
> 
>         for_each_gt(...) {
>                 if (xe_gt_is_media_type(gt))
>                         continue;
>                 ...
>         }
> 
> Some upcoming development is expected to utilize this pattern a bit more
> widely, so add a dedicated iterator that allows looping over specific GT
> type(s).
> 
> Note that this iterator uses a mask for the "type" parameter rather than
> a direct value match.  That's probably a bit overkill for now given that
> there are only two possible types of GTs, but if additional types of GTs
> ever show up in the future, this approach will fit more naturally and
> allow cases where we might want to loop over a subset of the possible
> types, or specifically mask off one single type.
> 
> Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
> ---
>  drivers/gpu/drm/xe/xe_device.h | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/gpu/drm/xe/xe_device.h b/drivers/gpu/drm/xe/xe_device.h
> index 39464650533b5fd9aa7d9fc3dd432710303311b5..c4d26700266115f91330cff0a115a716e6899c50 100644
> --- a/drivers/gpu/drm/xe/xe_device.h
> +++ b/drivers/gpu/drm/xe/xe_device.h
> @@ -131,6 +131,10 @@ static inline bool xe_device_uc_enabled(struct xe_device *xe)
>  	for ((id__) = 0; (id__) < (xe__)->info.tile_count * (xe__)->info.max_gt_per_tile; (id__)++) \
>  		for_each_if((gt__) = xe_device_get_gt((xe__), (id__)))
>  
> +#define for_each_gt_with_type(gt__, xe__, id__, typemask__) \

perhaps we could leave it as:

for_each_gt_with(gt, xe, id, something)

where something for now is the gt_type, but it could later
be extended to some capability bitmask.

But nothing that cannot be done later/on-top.

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

> +	for_each_gt((gt__), (xe__), (id__)) \
> +		for_each_if((typemask__) & BIT((gt__)->info.type))
> +
>  #define for_each_gt_on_tile(gt__, tile__, id__) \
>  	for_each_gt((gt__), (tile__)->xe, (id__)) \
>  		for_each_if((gt__)->tile == (tile__))
> 
> -- 
> 2.53.0
> 

  reply	other threads:[~2026-03-06  0:49 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 [this message]
2026-03-05 22:59 ` [PATCH 2/2] drm/xe: Utilize for_each_gt_with_type() for type-specific GT loops Matt Roper
2026-03-06  0:49   ` 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=aaokhZKjmILjakBh@intel.com \
    --to=rodrigo.vivi@intel.com \
    --cc=farah.kassabri@intel.com \
    --cc=gustavo.sousa@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.d.roper@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.