drm/xe: Add for_each_tile iterator
authorMatt Roper <matthew.d.roper@intel.com>
Thu, 1 Jun 2023 21:52:18 +0000 (14:52 -0700)
committerRodrigo Vivi <rodrigo.vivi@intel.com>
Tue, 19 Dec 2023 23:34:11 +0000 (18:34 -0500)
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.

v2:
 - s/(id__++)/(id__)++/  (Gustavo)

Cc: Gustavo Sousa <gustavo.sousa@intel.com>
Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
Acked-by: Gustavo Sousa <gustavo.sousa@intel.com>
Link: https://lore.kernel.org/r/20230601215244.678611-6-matthew.d.roper@intel.com
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
drivers/gpu/drm/xe/xe_device.h
drivers/gpu/drm/xe/xe_pci.c

index f7acaf51a1fc74a7a29f6b4c859e717f3c9fe54f..3516ac1dcbc46744428cbd525e93e0c4f3edba83 100644 (file)
@@ -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__)++) \
+               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__)))
index f0db422def9d2404d677a9aad75c93e27294f183..e8931661c0041dea59bcc33fd3686b5597e66cf8 100644 (file)
@@ -537,8 +537,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;