drm/xe: Add xe_tile backpointer to xe_mmio

Once MMIO operations stop being (incorrectly) tied to a GT, we'll still
need a backpointer for feature checks, message logging, and tracepoints.
Use a tile backpointer since that may allow the most useful debugging
output, while also providing access to the xe_device.

v2:
 - Make backpointer an xe_tile instead of xe_device.  (Michal)

Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>  # v1
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240910234719.3335472-52-matthew.d.roper@intel.com
This commit is contained in:
Matt Roper
2024-09-10 16:47:27 -07:00
parent 960a83799f
commit 1877c88fa9
3 changed files with 8 additions and 0 deletions

View File

@@ -115,6 +115,9 @@ struct xe_mem_region {
* subregions of the overall IO space).
*/
struct xe_mmio {
/** @tile: Backpointer to tile, used for tracing */
struct xe_tile *tile;
/** @regs: Map used to access registers. */
void __iomem *regs;

View File

@@ -98,6 +98,7 @@ static void mmio_multi_tile_setup(struct xe_device *xe, size_t tile_mmio_size)
for_each_tile(tile, xe, id) {
tile->mmio.regs_size = SZ_4M;
tile->mmio.regs = regs;
tile->mmio.tile = tile;
regs += tile_mmio_size;
}
}
@@ -134,6 +135,7 @@ static void mmio_extension_setup(struct xe_device *xe, size_t tile_mmio_size,
for_each_tile(tile, xe, id) {
tile->mmio_ext.regs_size = tile_mmio_ext_size;
tile->mmio_ext.regs = regs;
tile->mmio_ext.tile = tile;
regs += tile_mmio_ext_size;
}
}
@@ -179,6 +181,7 @@ int xe_mmio_init(struct xe_device *xe)
/* Setup first tile; other tiles (if present) will be setup later. */
root_tile->mmio.regs_size = SZ_4M;
root_tile->mmio.regs = xe->mmio.regs;
root_tile->mmio.tile = root_tile;
return devm_add_action_or_reset(xe->drm.dev, mmio_fini, xe);
}

View File

@@ -713,6 +713,7 @@ static int xe_info_init(struct xe_device *xe,
gt->info.engine_mask = graphics_desc->hw_engine_mask;
gt->mmio.regs = tile->mmio.regs;
gt->mmio.regs_size = tile->mmio.regs_size;
gt->mmio.tile = tile;
if (MEDIA_VER(xe) < 13 && media_desc)
gt->info.engine_mask |= media_desc->hw_engine_mask;
@@ -735,6 +736,7 @@ static int xe_info_init(struct xe_device *xe,
gt->mmio.regs_size = tile->mmio.regs_size;
gt->mmio.adj_offset = MEDIA_GT_GSI_OFFSET;
gt->mmio.adj_limit = MEDIA_GT_GSI_LENGTH;
gt->mmio.tile = tile;
/*
* FIXME: At the moment multi-tile and standalone media are