diff options
author | Koby Elbaz <kelbaz@habana.ai> | 2023-10-05 18:06:19 +0300 |
---|---|---|
committer | Rodrigo Vivi <rodrigo.vivi@intel.com> | 2023-12-21 19:42:59 +0300 |
commit | a4e2f3a299ea1c9c4b6d0e51048273eac28256b9 (patch) | |
tree | 572e09c68ee5e82d61a209a6c9e5c3594d484501 /drivers/gpu | |
parent | ef29b390c7345f081412454538ab94c395068153 (diff) | |
download | linux-a4e2f3a299ea1c9c4b6d0e51048273eac28256b9.tar.xz |
drm/xe: refactor xe_mmio_probe_tiles to support MMIO extension
In future ASICs, there will be an additional MMIO extension space
for all tiles altogether, residing on top of MMIO address space.
Signed-off-by: Koby Elbaz <kelbaz@habana.ai>
Reviewed-by: Ofir Bitton <obitton@habana.ai>
Reviewed-by: Moti Haimovski <mhaimovski@habana.ai>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/xe/xe_mmio.c | 70 |
1 files changed, 38 insertions, 32 deletions
diff --git a/drivers/gpu/drm/xe/xe_mmio.c b/drivers/gpu/drm/xe/xe_mmio.c index 52e4572e3c4a..e4cf9bfec422 100644 --- a/drivers/gpu/drm/xe/xe_mmio.c +++ b/drivers/gpu/drm/xe/xe_mmio.c @@ -318,50 +318,56 @@ int xe_mmio_probe_vram(struct xe_device *xe) static void xe_mmio_probe_tiles(struct xe_device *xe) { - u8 adj_tile_count = xe->info.tile_count; + size_t tile_mmio_size = SZ_16M, tile_mmio_ext_size = xe->info.tile_mmio_ext_size; + u8 id, tile_count = xe->info.tile_count; struct xe_gt *gt = xe_root_mmio_gt(xe); + const int mmio_bar = 0; + struct xe_tile *tile; + void *regs; u32 mtcfg; - u8 id; - if (xe->info.tile_count == 1) - return; + if (tile_count == 1) + goto add_mmio_ext; if (!xe->info.bypass_mtcfg) { mtcfg = xe_mmio_read64_2x32(gt, XEHP_MTCFG_ADDR); - adj_tile_count = xe->info.tile_count = - REG_FIELD_GET(TILE_COUNT, mtcfg) + 1; - - /* - * FIXME: Needs some work for standalone media, but should be impossible - * with multi-tile for now. - */ - xe->info.gt_count = xe->info.tile_count; - - drm_info(&xe->drm, "tile_count: %d, adj_tile_count %d\n", - xe->info.tile_count, adj_tile_count); - } - - if (xe->info.tile_count > 1) { - const int mmio_bar = 0; - struct xe_tile *tile; - size_t size; - void *regs; - - if (adj_tile_count > 1) { + tile_count = REG_FIELD_GET(TILE_COUNT, mtcfg) + 1; + if (tile_count < xe->info.tile_count) { + drm_info(&xe->drm, "tile_count: %d, reduced_tile_count %d\n", + xe->info.tile_count, tile_count); pci_iounmap(to_pci_dev(xe->drm.dev), xe->mmio.regs); - xe->mmio.size = SZ_16M * adj_tile_count; - xe->mmio.regs = pci_iomap(to_pci_dev(xe->drm.dev), - mmio_bar, xe->mmio.size); + xe->mmio.size = (tile_mmio_size + tile_mmio_ext_size) * tile_count; + xe->mmio.regs = pci_iomap(to_pci_dev(xe->drm.dev), mmio_bar, xe->mmio.size); + xe->info.tile_count = tile_count; + + /* + * FIXME: Needs some work for standalone media, but should be impossible + * with multi-tile for now. + */ + xe->info.gt_count = xe->info.tile_count; } + } - size = xe->mmio.size / adj_tile_count; - regs = xe->mmio.regs; + regs = xe->mmio.regs; + for_each_tile(tile, xe, id) { + tile->mmio.size = tile_mmio_size; + tile->mmio.regs = regs; + regs += tile_mmio_size; + } + +add_mmio_ext: + /* By design, there's a contiguous multi-tile MMIO space (16MB hard coded per tile). + * When supported, there could be an additional contiguous multi-tile MMIO extension + * space ON TOP of it, and hence the necessity for distinguished MMIO spaces. + */ + if (xe->info.supports_mmio_ext) { + regs = xe->mmio.regs + tile_mmio_size * tile_count; for_each_tile(tile, xe, id) { - tile->mmio.size = size; - tile->mmio.regs = regs; + tile->mmio_ext.size = tile_mmio_ext_size; + tile->mmio_ext.regs = regs; - regs += size; + regs += tile_mmio_ext_size; } } } |