Both patches look good overall and provide valuable MMIO_REMAP subtests. 2 improvements are suggested:

1. Remove Excess Debug Logs for both patches except when igt_skip is called.
   Please reduce the verbosity by removing non-essential igt_info() calls, such as:
    igt_info("[mmio_remap] alloc request: size=%u align=%u domain=0x%x flags=0x%llx\n", ...)   etc..
 
 2. Ensure MMIO Write Posting (Patch 2/2)
   In the HDP flush subtest, please insert a memory barrier to ensure the MMIO write is posted before the read:
   mmio[flush_idx] = 0x1;
  __sync_synchronize(); 
 (void)mmio[flush_idx];
This ensures correctness on platforms with weak memory ordering (e.g., ARM, RISC-V), where MMIO writes can be delayed or reordered.

Reviewed-by: Vitaly Prosyak vitaly.prosyak@amd.com


On 2025-09-18 04:46, Srinivasan Shanmugam wrote:
This series adds two IGT subtests in amd_bo.c to exercise the MMIO_REMAP
remap page:

  1) mmio_remap_gem_create_close
     - Allocates a 4 KiB, page-aligned BO in
       AMDGPU_GEM_DOMAIN_MMIO_REMAP and immediately frees it. Skips
       gracefully when the domain is not supported
       (-EOPNOTSUPP/-ENODEV/-EINVAL) or system PAGE_SIZE > 4K.

  2) mmio_remap_map_and_poke
     - Allocates and CPU-maps the 4 KiB remap page, then write-1 to
       HDP_MEM_FLUSH_CNTL (offset 0) twice, followed by a dummy read to
       post the writes. Unmaps and frees on exit.
	   
These tests help cover the basic KGD/KFD MMIO_REMAP path (allocation and
BAR-mapped MMIO access).

TODO: A kernel patch enabling this path is pending merge; once it lands,
the Link below can serve as the stable reference.

Link: https://patchwork.freedesktop.org/series/153209/#rev5
Cc: Vitaly Prosyak <vitaly.prosyak@amd.com>
Cc: David Yat Sin <David.YatSin@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>

Srinivasan Shanmugam (2):
  tests/amdgpu/amd_bo: Add mmio_remap_gem_create_close subtest
  tests/amdgpu/amd_bo: Add mmio_remap_map_and_poke (HDP flush) subtest

 tests/amdgpu/amd_bo.c | 144 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 144 insertions(+)