]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/xe: Assign GT IDs properly on multi-tile + multi-GT platforms
authorMatt Roper <matthew.d.roper@intel.com>
Tue, 1 Jul 2025 20:13:26 +0000 (13:13 -0700)
committerMatt Roper <matthew.d.roper@intel.com>
Wed, 2 Jul 2025 23:08:54 +0000 (16:08 -0700)
Although "multi-tile" and "multiple GTs per tile" are mutually-exclusive
characteristics on all of our platforms today, this may not always be
true.  Assign GT IDs according to xe->info.max_gt_per_tile in a way that
should work even if future platforms have different configurations.

This patch should not change the behavior of current platforms; it only
future-proofs for potential future designs.

v2:
 - Re-calculate gt_count if tile count gets reduced by MTCFG.  (PVC CI)

Reviewed-by: Ravi Kumar Vodapalli <ravi.kumar.vodapalli@intel.com>
Link: https://lore.kernel.org/r/20250701201320.2514369-14-matthew.d.roper@intel.com
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
drivers/gpu/drm/xe/xe_mmio.c
drivers/gpu/drm/xe/xe_pci.c

index 7357458bc0d2129764004e528c8a618692a7435e..751586d6806ad191d3bbf7007f97c00316865c78 100644 (file)
@@ -55,6 +55,7 @@ static void tiles_fini(void *arg)
 static void mmio_multi_tile_setup(struct xe_device *xe, size_t tile_mmio_size)
 {
        struct xe_tile *tile;
+       struct xe_gt *gt;
        u8 id;
 
        /*
@@ -67,7 +68,7 @@ static void mmio_multi_tile_setup(struct xe_device *xe, size_t tile_mmio_size)
        /* Possibly override number of tile based on configuration register */
        if (!xe->info.skip_mtcfg) {
                struct xe_mmio *mmio = xe_root_tile_mmio(xe);
-               u8 tile_count;
+               u8 tile_count, gt_count;
                u32 mtcfg;
 
                /*
@@ -84,12 +85,15 @@ static void mmio_multi_tile_setup(struct xe_device *xe, size_t tile_mmio_size)
                        xe->info.tile_count = tile_count;
 
                        /*
-                        * FIXME: Needs some work for standalone media, but
-                        * should be impossible with multi-tile for now:
-                        * multi-tile platform with standalone media doesn't
-                        * exist
+                        * We've already setup gt_count according to the full
+                        * tile count.  Re-calculate it to only include the GTs
+                        * that belong to the remaining tile(s).
                         */
-                       xe->info.gt_count = xe->info.tile_count;
+                       gt_count = 0;
+                       for_each_gt(gt, xe, id)
+                               if (gt->info.id < tile_count * xe->info.max_gt_per_tile)
+                                       gt_count++;
+                       xe->info.gt_count = gt_count;
                }
        }
 
index 99dede6e7b212937e1aefc5e1ffe4f3dcae3751a..42aaef9fa2ea9fc16a80816fad17cb0e1dfa2e32 100644 (file)
@@ -689,10 +689,11 @@ static int xe_info_init(struct xe_device *xe,
         */
        for_each_tile(tile, xe, id) {
                gt = tile->primary_gt;
-               gt->info.id = xe->info.gt_count++;
                gt->info.type = XE_GT_TYPE_MAIN;
+               gt->info.id = tile->id * xe->info.max_gt_per_tile;
                gt->info.has_indirect_ring_state = graphics_desc->has_indirect_ring_state;
                gt->info.engine_mask = graphics_desc->hw_engine_mask;
+               xe->info.gt_count++;
 
                if (MEDIA_VER(xe) < 13 && media_desc)
                        gt->info.engine_mask |= media_desc->hw_engine_mask;
@@ -710,17 +711,10 @@ static int xe_info_init(struct xe_device *xe,
 
                gt = tile->media_gt;
                gt->info.type = XE_GT_TYPE_MEDIA;
+               gt->info.id = tile->id * xe->info.max_gt_per_tile + 1;
                gt->info.has_indirect_ring_state = media_desc->has_indirect_ring_state;
                gt->info.engine_mask = media_desc->hw_engine_mask;
-
-               /*
-                * FIXME: At the moment multi-tile and standalone media are
-                * mutually exclusive on current platforms.  We'll need to
-                * come up with a better way to number GTs if we ever wind
-                * up with platforms that support both together.
-                */
-               drm_WARN_ON(&xe->drm, id != 0);
-               gt->info.id = xe->info.gt_count++;
+               xe->info.gt_count++;
        }
 
        return 0;