]> git.ipfire.org Git - thirdparty/linux.git/commit
iommufd: Change the selftest to use iommupt instead of xarray
authorJason Gunthorpe <jgg@nvidia.com>
Tue, 4 Nov 2025 18:30:09 +0000 (14:30 -0400)
committerJoerg Roedel <joerg.roedel@amd.com>
Wed, 5 Nov 2025 08:07:13 +0000 (09:07 +0100)
commite93d5945ed5bb086431e83eed7ab98b6c058cc0b
tree1d7a703c4ddccbf25cd1b70259db5c1342a72ed1
parente5359dcc617a2174d834bab4083340196615d8bd
iommufd: Change the selftest to use iommupt instead of xarray

The iommufd self test uses an xarray to store the pfns and their orders to
emulate a page table. Make it act more like a real iommu driver by
replacing the xarray with an iommupt based page table. The new AMDv1 mock
format behaves similarly to the xarray.

Add set_dirty() as a iommu_pt operation to allow the test suite to
simulate HW dirty.

Userspace can select between several formats including the normal AMDv1
format and a special MOCK_IOMMUPT_HUGE variation for testing huge page
dirty tracking. To make the dirty tracking test work the page table must
only store exactly 2M huge pages otherwise the logic the test uses
fails. They cannot be broken up or combined.

Aside from aligning the selftest with a real page table implementation,
this helps test the iommupt code itself.

Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Samiullah Khawaja <skhawaja@google.com>
Tested-by: Alejandro Jimenez <alejandro.j.jimenez@oracle.com>
Tested-by: Pasha Tatashin <pasha.tatashin@soleen.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
drivers/iommu/generic_pt/iommu_pt.h
drivers/iommu/iommufd/Kconfig
drivers/iommu/iommufd/iommufd_test.h
drivers/iommu/iommufd/selftest.c
include/linux/generic_pt/iommu.h
tools/testing/selftests/iommu/iommufd.c
tools/testing/selftests/iommu/iommufd_utils.h