All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/3] drm/amdgpu: Handle MMIO_REMAP as fixed I/O via dma-buf
@ 2025-09-12 11:11 Srinivasan Shanmugam
  2025-09-12 11:11 ` [PATCH v2 1/3] drm/amdgpu/ttm: Pin 4K MMIO_REMAP Singleton BO at Init Srinivasan Shanmugam
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Srinivasan Shanmugam @ 2025-09-12 11:11 UTC (permalink / raw)
  To: Christian König, Alex Deucher; +Cc: amd-gfx, Srinivasan Shanmugam

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.koenig@amd.com>
Suggested-by: Alex Deucher <alexander.deucher@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@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


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2025-11-06 17:10 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-12 11:11 [PATCH v2 0/3] drm/amdgpu: Handle MMIO_REMAP as fixed I/O via dma-buf Srinivasan Shanmugam
2025-09-12 11:11 ` [PATCH v2 1/3] drm/amdgpu/ttm: Pin 4K MMIO_REMAP Singleton BO at Init Srinivasan Shanmugam
2025-09-22 11:26   ` Christian König
2025-09-12 11:11 ` [PATCH v2 2/3] drm/amdgpu/dma-buf: Add helpers to map/unmap BAR I/O with dma_map_resource() Srinivasan Shanmugam
2025-09-22 11:27   ` Christian König
2025-09-12 11:11 ` [PATCH v2 3/3] drm/amdgpu/dma-buf: Map/Unmap MMIO_REMAP as BAR register window (dma_map_resource) Srinivasan Shanmugam
2025-09-22 11:31   ` Christian König
2025-10-06 14:16 ` [PATCH v3 0/2] drm/amdgpu: Handle MMIO_REMAP as fixed I/O via dma-buf v3 Srinivasan Shanmugam
2025-10-06 14:16   ` [PATCH v3 1/2] drm/amdgpu/ttm: Pin 4K MMIO_REMAP Singleton BO at Init Srinivasan Shanmugam
2025-10-06 14:16   ` [PATCH v3 2/2] drm/amdgpu: Map/Unmap MMIO_REMAP as BAR register window; add TTM sg helpers; wire dma-buf Srinivasan Shanmugam
2025-11-06 17:10     ` Alex Deucher

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.