This series makes the amdgpu dma-buf exporter handle AMDGPU_PL_MMIO_REMAP (the HDP flush page) as a BAR-mapped register window (MMIO)
The HDP flush “MMIO_REMAP” page is a BAR-backed I/O window (not RAM). When another PCIe device (GPU) needs to poke that window (e.g., device-to-device HDP flush), we must share it as a stable I/O span that never migrates, and we must map it for importers using the correct API for I/O resources (not page-backed memory). This series makes MMIO_REMAP sharable through dma-buf by: representing it as a singleton, pinned 4 KB BO for the device lifetime, and mapping/unmapping it for importers via dma_map_resource()/dma_unmap_resource() using a 1-entry sg_table v2: Design-level adjustments (Christian’s feedback): - Pin at creation, not at export. We now pin the MMIO_REMAP BO in TTM during init using ttm_bo_pin(). This enforces “never migrate/evict” from birth and removes the need for export-time pinning and release-time unpinning. - No begin_cpu_access hacks. Since the object is pinned and treated as fixed I/O, we removed the special-casing in begin_cpu_access(); migration heuristics are irrelevant. - No pin/unpin no-ops in dma-buf paths. Those were a workaround for export-time pinning. With creation-time pinning, they’re unnecessary and are dropped. * Only compilation tested so far (x86_64, defconfig + amdgpu enabled). Suggested-by: Christian König <christian.koe...@amd.com> Suggested-by: Alex Deucher <alexander.deuc...@amd.com> Cc: Christian König <christian.koe...@amd.com> Cc: Alex Deucher <alexander.deuc...@amd.com> Srinivasan Shanmugam (3): drm/amdgpu/ttm: Pin 4K MMIO_REMAP Singleton BO at Init drm/amdgpu/dma-buf: Add helpers to map/unmap BAR I/O with dma_map_resource() drm/amdgpu/dma-buf: Map/Unmap MMIO_REMAP as BAR register window (dma_map_resource) drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c | 86 +++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 26 +++++++ 2 files changed, 112 insertions(+) base-commit: bc52ed7845660e03827131505f95fcb4dd2fcf4f -- 2.34.1