Skip to content

Commit bd6a4b9

Browse files
committed
drm/xe: Assign GT IDs properly on multi-tile + multi-GT platforms
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>
1 parent fb72cd2 commit bd6a4b9

2 files changed

Lines changed: 14 additions & 16 deletions

File tree

drivers/gpu/drm/xe/xe_mmio.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ static void tiles_fini(void *arg)
5555
static void mmio_multi_tile_setup(struct xe_device *xe, size_t tile_mmio_size)
5656
{
5757
struct xe_tile *tile;
58+
struct xe_gt *gt;
5859
u8 id;
5960

6061
/*
@@ -67,7 +68,7 @@ static void mmio_multi_tile_setup(struct xe_device *xe, size_t tile_mmio_size)
6768
/* Possibly override number of tile based on configuration register */
6869
if (!xe->info.skip_mtcfg) {
6970
struct xe_mmio *mmio = xe_root_tile_mmio(xe);
70-
u8 tile_count;
71+
u8 tile_count, gt_count;
7172
u32 mtcfg;
7273

7374
/*
@@ -84,12 +85,15 @@ static void mmio_multi_tile_setup(struct xe_device *xe, size_t tile_mmio_size)
8485
xe->info.tile_count = tile_count;
8586

8687
/*
87-
* FIXME: Needs some work for standalone media, but
88-
* should be impossible with multi-tile for now:
89-
* multi-tile platform with standalone media doesn't
90-
* exist
88+
* We've already setup gt_count according to the full
89+
* tile count. Re-calculate it to only include the GTs
90+
* that belong to the remaining tile(s).
9191
*/
92-
xe->info.gt_count = xe->info.tile_count;
92+
gt_count = 0;
93+
for_each_gt(gt, xe, id)
94+
if (gt->info.id < tile_count * xe->info.max_gt_per_tile)
95+
gt_count++;
96+
xe->info.gt_count = gt_count;
9397
}
9498
}
9599

drivers/gpu/drm/xe/xe_pci.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -689,10 +689,11 @@ static int xe_info_init(struct xe_device *xe,
689689
*/
690690
for_each_tile(tile, xe, id) {
691691
gt = tile->primary_gt;
692-
gt->info.id = xe->info.gt_count++;
693692
gt->info.type = XE_GT_TYPE_MAIN;
693+
gt->info.id = tile->id * xe->info.max_gt_per_tile;
694694
gt->info.has_indirect_ring_state = graphics_desc->has_indirect_ring_state;
695695
gt->info.engine_mask = graphics_desc->hw_engine_mask;
696+
xe->info.gt_count++;
696697

697698
if (MEDIA_VER(xe) < 13 && media_desc)
698699
gt->info.engine_mask |= media_desc->hw_engine_mask;
@@ -710,17 +711,10 @@ static int xe_info_init(struct xe_device *xe,
710711

711712
gt = tile->media_gt;
712713
gt->info.type = XE_GT_TYPE_MEDIA;
714+
gt->info.id = tile->id * xe->info.max_gt_per_tile + 1;
713715
gt->info.has_indirect_ring_state = media_desc->has_indirect_ring_state;
714716
gt->info.engine_mask = media_desc->hw_engine_mask;
715-
716-
/*
717-
* FIXME: At the moment multi-tile and standalone media are
718-
* mutually exclusive on current platforms. We'll need to
719-
* come up with a better way to number GTs if we ever wind
720-
* up with platforms that support both together.
721-
*/
722-
drm_WARN_ON(&xe->drm, id != 0);
723-
gt->info.id = xe->info.gt_count++;
717+
xe->info.gt_count++;
724718
}
725719

726720
return 0;

0 commit comments

Comments
 (0)