]> git.ipfire.org Git - thirdparty/linux.git/commit
iommupt: Add a mock pagetable format for iommufd selftest to use
authorJason Gunthorpe <jgg@nvidia.com>
Tue, 4 Nov 2025 18:30:08 +0000 (14:30 -0400)
committerJoerg Roedel <joerg.roedel@amd.com>
Wed, 5 Nov 2025 08:07:13 +0000 (09:07 +0100)
commite5359dcc617a2174d834bab4083340196615d8bd
tree82a45fc71cd65323634e630e283ff3d3d323ed2e
parent1dd4187f53c35165262691795109879e37ddca62
iommupt: Add a mock pagetable format for iommufd selftest to use

The iommufd self test uses an xarray to store the pfns and their orders to
emulate a page table. Slightly modify the amdv1 page table to create a
real page table that has similar properties:

 - 2k base granule to simulate something like a 4k page table on a 64K
   PAGE_SIZE ARM system
 - Contiguous page support for every PFN order
 - Dirty tracking

AMDv1 is the closest format, as it is the only one that already supports
every page size. Tweak it to have only 5 levels and an 11 bit base granule
and compile it separately as a format variant.

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/fmt/Makefile
drivers/iommu/generic_pt/fmt/amdv1.h
drivers/iommu/generic_pt/fmt/iommu_mock.c [new file with mode: 0644]
include/linux/generic_pt/iommu.h