> From: Jason Gunthorpe <[email protected]> > Sent: Wednesday, October 8, 2025 12:12 AM > > This intends to have high coverage of the page table format functions, it > uses the IOMMU implementation to create a tree which it then walks > through > and directly calls the generic page table functions to test them. > > It is a good starting point to test a new format header as it is often > able to find typos and inconsistencies much more directly, rather than > with an obscure failure in the iommu implementation. > > The tests can be run with commands like: > > tools/testing/kunit/kunit.py run --build_dir build_kunit_arm64 --arch arm64 - > -make_options LLVM=-19 -- > kunitconfig ./drivers/iommu/generic_pt/.kunitconfig > tools/testing/kunit/kunit.py run --build_dir build_kunit_uml -- > kunitconfig ./drivers/iommu/generic_pt/.kunitconfig --kconfig_add > CONFIG_WERROR=n > tools/testing/kunit/kunit.py run --build_dir build_kunit_x86_64 --arch x86_64 > --kunitconfig ./drivers/iommu/generic_pt/.kunitconfig > tools/testing/kunit/kunit.py run --build_dir build_kunit_i386 --arch i386 -- > kunitconfig ./drivers/iommu/generic_pt/.kunitconfig > tools/testing/kunit/kunit.py run --build_dir build_kunit_i386pae --arch i386 > -- > kunitconfig ./drivers/iommu/generic_pt/.kunitconfig --kconfig_add > CONFIG_X86_PAE=y > > There are several interesting corner cases on the 32 bit platforms that > need checking. > > The format can declare a list of configurations that generate different > configurations the initialize the page table, for instance with different > top levels or other parameters. The kunit will turn these into "params" > which cause each test to run multiple times. > > The tests are repeated to run at every table level to check that all the > item encoding formats work. > > The following are checked: > - Basic init works for each configuration > - The various log2 functions have the expected behavior at the limits > - pt_compute_best_pgsize() works > - pt_table_pa() reads back what pt_install_table() writes > - range.max_vasz_lg2 works properly > - pt_table_oa_lg2sz() and pt_table_item_lg2sz() use a contiguous > non-overlapping set of bits from the VA up to the defined max_va > - pt_possible_sizes() and pt_can_have_leaf() produces a sensible layout > - pt_item_oa(), pt_entry_oa(), and pt_entry_num_contig_lg2() read back > what pt_install_leaf_entry() writes > - pt_clear_entry() works > - pt_attr_from_entry() reads back what pt_iommu_set_prot() & > pt_install_leaf_entry() writes > - pt_entry_set_write_clean(), pt_entry_make_write_dirty(), and > pt_entry_write_is_dirty() work > > Tested-by: Alejandro Jimenez <[email protected]> > Signed-off-by: Jason Gunthorpe <[email protected]>
Reviewed-by: Kevin Tian <[email protected]>
