[Intel-xe] [PATCH v3 05/31] drm/xe: Add for_each_tile iterator

Matt Roper matthew.d.roper at intel.com
Wed May 31 17:56:02 UTC 2023


On Wed, May 31, 2023 at 11:35:32AM -0300, Gustavo Sousa wrote:
> Quoting Matt Roper (2023-05-30 18:15:23-03:00)
> >As we start splitting tile handling out from GT handling, we'll need to
> >be able to iterate over tiles separately from GTs.  This iterator will
> >be used in upcoming patches.
> >
> >Reviewed-by: Lucas De Marchi <lucas.demarchi at intel.com>
> >Signed-off-by: Matt Roper <matthew.d.roper at intel.com>
> >---
> > drivers/gpu/drm/xe/xe_device.h | 4 ++++
> > drivers/gpu/drm/xe/xe_pci.c    | 3 +--
> > 2 files changed, 5 insertions(+), 2 deletions(-)
> >
> >diff --git a/drivers/gpu/drm/xe/xe_device.h b/drivers/gpu/drm/xe/xe_device.h
> >index f7acaf51a1fc..745dbb16d417 100644
> >--- a/drivers/gpu/drm/xe/xe_device.h
> >+++ b/drivers/gpu/drm/xe/xe_device.h
> >@@ -83,6 +83,10 @@ static inline void xe_device_guc_submission_disable(struct xe_device *xe)
> >         xe->info.enable_guc = false;
> > }
> > 
> >+#define for_each_tile(tile__, xe__, id__) \
> >+        for ((id__) = 0; (id__) < (xe__)->info.tile_count; (id__++)) \
> 
> Wouldn't it be safer to use (id__)++ above?

Yeah, that would be better; I'll make the change.  This was copy/pasted
from for_each_gt, and since I'm making other changes to that macro in
patch #28, I'll put a similar change there.


Matt

> 
> --
> Gustavo Sousa
> 
> >+                for_each_if ((tile__) = &(xe__)->tiles[(id__)])
> >+
> > #define for_each_gt(gt__, xe__, id__) \
> >         for ((id__) = 0; (id__) < (xe__)->info.tile_count; (id__++)) \
> >                 for_each_if ((gt__) = xe_device_get_gt((xe__), (id__)))
> >diff --git a/drivers/gpu/drm/xe/xe_pci.c b/drivers/gpu/drm/xe/xe_pci.c
> >index 551ba20083b9..91d5dc59aa7e 100644
> >--- a/drivers/gpu/drm/xe/xe_pci.c
> >+++ b/drivers/gpu/drm/xe/xe_pci.c
> >@@ -559,8 +559,7 @@ static int xe_info_init(struct xe_device *xe,
> >          */
> >         xe->info.tile_count = 1 + graphics_desc->max_remote_tiles;
> > 
> >-        for (id = 0; id < xe->info.tile_count; ++id) {
> >-                tile = &xe->tiles[id];
> >+        for_each_tile(tile, xe, id) {
> >                 tile->xe = xe;
> >                 tile->id = id;
> > 
> >-- 
> >2.40.1
> >

-- 
Matt Roper
Graphics Software Engineer
Linux GPU Platform Enablement
Intel Corporation


More information about the Intel-xe mailing list