[PATCH 07/43] drm/xe: Add xe_device backpointer to xe_mmio
Michal Wajdeczko
michal.wajdeczko at intel.com
Fri Sep 6 14:15:19 UTC 2024
On 04.09.2024 02:21, Matt Roper wrote:
> Once MMIO operations stop being (incorrectly) tied to a GT, we'll still
> need a device backpointer for feature checks, message logging, and
> tracepoints.
>
> Signed-off-by: Matt Roper <matthew.d.roper at intel.com>
> ---
> drivers/gpu/drm/xe/xe_device_types.h | 3 +++
> drivers/gpu/drm/xe/xe_mmio.c | 3 +++
> drivers/gpu/drm/xe/xe_pci.c | 2 ++
> 3 files changed, 8 insertions(+)
>
> diff --git a/drivers/gpu/drm/xe/xe_device_types.h b/drivers/gpu/drm/xe/xe_device_types.h
> index 75490753feda..19c21e55e153 100644
> --- a/drivers/gpu/drm/xe/xe_device_types.h
> +++ b/drivers/gpu/drm/xe/xe_device_types.h
> @@ -115,6 +115,9 @@ struct xe_mem_region {
> * subregions of the overall IO space).
> */
> struct xe_mmio {
> + /** @xe: Backpointer to Xe device, used for tracing */
> + struct xe_device *xe;
since all MMIO register regions are still more/less tile-based, then
maybe it would be better to have backpointer to the xe_tile, where this
MMIO region belongs, rather than xe_device?
we can always use tile->xe if needed
> +
> /** @regs: Map used to access registers. */
> void __iomem *regs;
>
> diff --git a/drivers/gpu/drm/xe/xe_mmio.c b/drivers/gpu/drm/xe/xe_mmio.c
> index 4c7215ed3954..dd2076b9003e 100644
> --- a/drivers/gpu/drm/xe/xe_mmio.c
> +++ b/drivers/gpu/drm/xe/xe_mmio.c
> @@ -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_length = SZ_4M;
> tile->mmio.regs = regs;
> + tile->mmio.xe = xe;
> 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_length = tile_mmio_ext_size;
> tile->mmio_ext.regs = regs;
> + tile->mmio_ext.xe = xe;
> regs += tile_mmio_ext_size;
> }
> }
> @@ -180,6 +182,7 @@ int xe_mmio_init(struct xe_device *xe)
> /* Setup first tile; other tiles (if present) will be setup later. */
> root_tile->mmio.regs_length = SZ_4M;
> root_tile->mmio.regs = xe->mmio.regs;
> + root_tile->mmio.xe = xe;
>
> return devm_add_action_or_reset(xe->drm.dev, mmio_fini, xe);
> }
> diff --git a/drivers/gpu/drm/xe/xe_pci.c b/drivers/gpu/drm/xe/xe_pci.c
> index 5b09a1cbd821..e222539022d5 100644
> --- a/drivers/gpu/drm/xe/xe_pci.c
> +++ b/drivers/gpu/drm/xe/xe_pci.c
> @@ -714,6 +714,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_length = tile->mmio.regs_length;
> + gt->mmio.xe = xe;
> if (MEDIA_VER(xe) < 13 && media_desc)
> gt->info.engine_mask |= media_desc->hw_engine_mask;
>
> @@ -736,6 +737,7 @@ static int xe_info_init(struct xe_device *xe,
> gt->mmio.regs_length = tile->mmio.regs_length;
> gt->mmio.adj_offset = MEDIA_GT_GSI_OFFSET;
> gt->mmio.adj_limit = MEDIA_GT_GSI_LENGTH;
> + gt->mmio.xe = xe;
>
> /*
> * FIXME: At the moment multi-tile and standalone media are
More information about the Intel-xe
mailing list