[PATCH v2 4/5] drm/xe: Assign GT IDs properly on multi-tile + multi-GT platforms
Matt Roper
matthew.d.roper at intel.com
Mon Jun 30 16:48:11 UTC 2025
On Wed, Jun 25, 2025 at 05:11:27PM +0530, Vodapalli, Ravi Kumar wrote:
>
>
> On 6/17/2025 7:39 AM, Matt Roper wrote:
> > 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.
> >
> > Signed-off-by: Matt Roper<matthew.d.roper at intel.com>
> > ---
> > drivers/gpu/drm/xe/xe_mmio.c | 8 --------
> > drivers/gpu/drm/xe/xe_pci.c | 14 ++++----------
> > 2 files changed, 4 insertions(+), 18 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/xe/xe_mmio.c b/drivers/gpu/drm/xe/xe_mmio.c
> > index 7357458bc0d2..b65d888ee8e4 100644
> > --- a/drivers/gpu/drm/xe/xe_mmio.c
> > +++ b/drivers/gpu/drm/xe/xe_mmio.c
> > @@ -82,14 +82,6 @@ static void mmio_multi_tile_setup(struct xe_device *xe, size_t tile_mmio_size)
> > drm_info(&xe->drm, "tile_count: %d, reduced_tile_count %d\n",
> > xe->info.tile_count, tile_count);
> > 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
> > - */
> > - xe->info.gt_count = xe->info.tile_count;
> > }
> > }
> > diff --git a/drivers/gpu/drm/xe/xe_pci.c b/drivers/gpu/drm/xe/xe_pci.c
> > index a4885f64c2c4..b29252abbf3e 100644
> > --- a/drivers/gpu/drm/xe/xe_pci.c
> > +++ b/drivers/gpu/drm/xe/xe_pci.c
> > @@ -687,10 +687,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;
> why gt->info.id is equal to tile->id * xe->info.max_gt_per_tile then the
> resultant number exceeds max_gt_per_tile , i dont know whether we can assign
> gt->info.id as equal to tile->id
Yes, this is correct. Supposed a future platform has four types of GTs:
primary, media, foo, and bar. That platform would have max_gt_per_tile
set to 4. Also supposed that the same future platform has three tiles.
In this example, the overall possible GT IDs in the system would be
assigned as:
0: tile 0 primary
1: tile 0 media
2: tile 0 foo
3: tile 0 bar
4: tile 1 primary
5: tile 1 media
6: tile 1 foo
7: tile 1 bar
8: tile 2 primary
9: tile 2 media
10: tile 2 foo
11: tile 2 bar
So the GT ID for a specific tile's GTs are:
primary: tile ID * max_gt_per_tile + 0
media: tile ID * max_gt_per_tile + 1
foo: tile ID * max_gt_per_tile + 2
bar: tile ID * max_gt_per_tile + 3
Some of these GTs may or may not exist depending on fusing or other
platform details; userspace uses the GT query ioctl to discover the
available GTs. It might see something from the query interface like:
(GT0 primary, GT1 media, GT3 bar, GT4 primary, GT6 foo, GT8 primary)
meaning there are 6 usable GTs in the system, and the IDs "skip" some
numbers for cases where a GT does not exist.
Matt
> > 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;
> > @@ -708,17 +709,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;
--
Matt Roper
Graphics Software Engineer
Linux GPU Platform Enablement
Intel Corporation
More information about the Intel-xe
mailing list