This builds on the v1 fix for nx_huge_pages_test for TDP-disabled hosts. Originally this was just 1 patch but now it is 3 to add the necessary infrastructure to check if TDP is enabled or not so that we can conditionally use 4KiB or 2MiB mappings in the test. Sean, I opted not to refactor virt_map() to take nr_bytes since that will take a bit more work than I have cycles for at the moment and I want to get this fix in. That being said, I coded up the new virt_map_level() using nr_bytes so that there will be less to clean up in the future. v2: - Still use 4K mappins on TDP-enabled hosts [Sean] - Generalize virt_map_2m() to virt_map_level() [me] - Pass nr_bytes instead of nr_pages to virt_map_level() [Sean] v1: https://lore.kernel.org/kvm/20220926175219.605113-1-dmatlack@xxxxxxxxxx/ David Matlack (3): KVM: selftests: Tell the compiler that code after TEST_FAIL() is unreachable KVM: selftests: Add helper to read boolean module parameters KVM: selftests: Fix nx_huge_pages_test on TDP-disabled hosts .../testing/selftests/kvm/include/test_util.h | 7 +++- .../selftests/kvm/include/x86_64/processor.h | 4 ++ tools/testing/selftests/kvm/lib/test_util.c | 31 ++++++++++++++ .../selftests/kvm/lib/x86_64/processor.c | 40 +++++++++++++------ .../selftests/kvm/x86_64/nx_huge_pages_test.c | 19 ++++++++- 5 files changed, 85 insertions(+), 16 deletions(-) base-commit: 372d07084593dc7a399bf9bee815711b1fb1bcf2 prerequisite-patch-id: 2e3661ba8856c29b769499bac525b6943d9284b8 -- 2.37.3.998.g577e59143f-goog