[RFC PATCH 0/7] drm/amdgpu: add MMIO-remap singleton BO for HDP flush

Alex Deucher alexdeucher at gmail.com
Wed Aug 20 21:47:31 UTC 2025


On Wed, Aug 20, 2025 at 7:58 AM Srinivasan Shanmugam
<srinivasan.shanmugam at amd.com> wrote:
>
> This series introduces a kernel-managed singleton BO representing the
> MMIO-remap (HDP flush) page and exposes it to userspace through a new
> GEM domain.
>
> Design ------
> - A tiny (1-page) TTM bucket is introduced for AMDGPU_PL_MMIO_REMAP
>   (mirroring doorbells).
> - A singleton BO is created during amdgpu_ttm_init() and freed at
>   fini().
> - The BO is kernel-owned and never evicted.
> - amdgpu_gem_create_ioctl() recognizes the new GEM domain bit
>   (AMDGPU_GEM_DOMAIN_MMIO_REMAP) and returns a handle to the pre-created
> singleton BO, enforcing size/alignment checks.
> - Userspace thus gets a stable GEM handle and can mmap it to issue HDP
>   flushes.
>
> * Only compilation tested so far (x86_64, defconfig + amdgpu enabled).
> * No runtime validation yet.
>
> Cc: Christian König <christian.koenig at amd.com>
> Cc: Alex Deucher <alexander.deucher at amd.com>
>
> Srinivasan Shanmugam (7):
>   drm/amdgpu/uapi: add AMDGPU_GEM_DOMAIN_MMIO_REMAP
>   drm/amdgpu: Add New TTM Placement - AMDGPU_PL_MMIO_REMAP and wire up
>     plumbing
>   drm/amdgpu: Plumbing for MMIO_REMAP memtype and user-visible strings
>   drm/amdgpu: Add mmio_remap fields to amdgpu_device
>   drm/amdgpu: Implement TTM handling for MMIO_REMAP placement
>   drm/amdgpu: Create Singleton MMIO_REMAP BO and Initialize its pool
>   drm/amdgpu: Return Handle to MMIO_REMAP Singleton for GEM Create

You also need a patch which sets adev->mmio_remap.base and
adev->mmio_remap.size.
E.g.,

adev->mmio_remap.base = adev->rmmio_remap.bus_addr;
adev->mmio_remap.size = 4096;

Better yet, replace adev->rmmio_remap.bus_addr with
adev->mmio_remap.base and just use that everywhere.

Alex

>
>  drivers/gpu/drm/amd/amdgpu/amdgpu.h           |   7 ++
>  drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c    |   1 +
>  drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c       |  56 +++++++++
>  drivers/gpu/drm/amd/amdgpu/amdgpu_object.c    |  13 ++
>  drivers/gpu/drm/amd/amdgpu/amdgpu_object.h    |   2 +
>  .../gpu/drm/amd/amdgpu/amdgpu_res_cursor.h    |   2 +
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c       | 112 +++++++++++++++++-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h       |   3 +-
>  include/drm/ttm/ttm_resource.h                |   2 +-
>  include/uapi/drm/amdgpu_drm.h                 |   8 +-
>  10 files changed, 198 insertions(+), 8 deletions(-)
>
> --
> 2.34.1
>


More information about the amd-gfx mailing list