drm/xe: Add xe_tile backpointer to xe_mmio
authorMatt Roper <matthew.d.roper@intel.com>
Tue, 10 Sep 2024 23:47:27 +0000 (16:47 -0700)
committerMatt Roper <matthew.d.roper@intel.com>
Wed, 11 Sep 2024 22:17:34 +0000 (15:17 -0700)
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
drivers/gpu/drm/xe/xe_device_types.h
drivers/gpu/drm/xe/xe_mmio.c
drivers/gpu/drm/xe/xe_pci.c

index e5af3f5..3a23083 100644 (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;
 
index d271ff4..47b505a 100644 (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);
 }
index 935f56c..d68f568 100644 (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