]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
drm/xe: Don't compare GT ID to GT count when determining valid GTs
authorMatt Roper <matthew.d.roper@intel.com>
Tue, 1 Jul 2025 20:13:27 +0000 (13:13 -0700)
committerMatt Roper <matthew.d.roper@intel.com>
Wed, 2 Jul 2025 23:08:54 +0000 (16:08 -0700)
commit457123d5a0351792280c7441107db49560bdd3c3
tree12f1266ce32c61f5c5bb646b9fc0733d39aa6f54
parentbd6a4b978584cb633be0d5cdfbf79803fd31da07
drm/xe: Don't compare GT ID to GT count when determining valid GTs

On current platforms with multiple GTs, all of the GT IDs are
consecutive; as a result we know that the GT IDs range from 0 to
gt_count-1 and can determine if a GT ID is valid by comparing against
the count.  The consecutive nature of GT IDs may not hold true on future
platforms if/when we have platforms that are both multi-tile and have
multiple GTs within each tile.  Once such platforms exist, it's quite
possible that we could wind up with something like a GT list composed of
IDs 0, 2, and 3 with no GT 1 (which would be a 2-tile platform with
media only on the second tile).

To future-proof the code we should stop comparing against the GT count
to determine whether a GT ID is valid or not.  Instead we should do an
actual lookup of the ID to determine whether the GT exists.  This also
means that our GT loop macro should not end at the GT count, but should
rather examine the entire space up to (# of tiles) * (max GT per tile)
to ensure it doesn't stop prematurely.

Reviewed-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
Link: https://lore.kernel.org/r/20250701201320.2514369-15-matthew.d.roper@intel.com
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
drivers/gpu/drm/xe/xe_device.h
drivers/gpu/drm/xe/xe_eu_stall.c
drivers/gpu/drm/xe/xe_exec_queue.c
drivers/gpu/drm/xe/xe_hw_engine.c