[GIT PULL] KVM: selftests: Add PPC support
From: Sean Christopherson
Date: Fri Oct 16 2026 - 00:48:06 EST
Add PPC selftests support. I grabbed the patches because it seemed easier
overall than coordinating a stable tag with maintainers that don't usually
send you pull requests. The expectation going forward is that PPC selftests
changes will be routed through the KVM tree[1], since KVM selftests tend to
have a lot more cross-arch interactions/collisions than KVM proper
The memory regions rework will also show up in the "selftests" pull request
(I don't know why I didn't throw those changes in a dedicated branch), and
they have a silent conflict with kvm/master[2] due to the new vgic_its_save
arm64 test that came in through a 7.3 fixes pull request. This is roughly
the resolution we've been using in next.
+static void setup_memslot(size_t sz)
+{
+ size_t pages = sz / vm->page_size;
+
+ gpa_base = ((vm_compute_max_gfn(vm) + 1) * vm->page_size) - sz;
- vm_userspace_mem_region_add(vm, VM_MEM_SRC_ANONYMOUS, gpa_base,
- TEST_MEMSLOT_INDEX, pages, 0);
++ vm_override_mem_region(vm, MEM_REGION_TEST_EXTRA, VM_MEM_SRC_ANONYMOUS,
++ gpa_base, TEST_MEMSLOT_INDEX, pages);
+}
+
+static gpa_t alloc_64k(size_t nr)
+{
+ size_t pages_per_64k = vm_calc_num_guest_pages(vm->mode, SZ_64K);
- gpa_t gpa = vm_phy_pages_alloc(vm, nr * pages_per_64k, gpa_base,
- TEST_MEMSLOT_INDEX);
++ gpa_t gpa = vm_phy_pages_alloc(vm, nr * pages_per_64k,
++ MEM_REGION_TEST_EXTRA);
+
+ TEST_ASSERT(IS_ALIGNED(gpa, SZ_64K),
+ "Allocation at 0x%lx is not 64K aligned, GITS_BASER cannot address it",
+ gpa);
+ return gpa;
+}
[1] https://lore.kernel.org/all/ld8fjt6w.ritesh.list@xxxxxxxxx
[2] https://lore.kernel.org/all/aqqap3DngKznNrSA@xxxxxxxxxxxxx
The following changes since commit d4b7fb647204f0c81dfeae2d1a708e4d858e0c94:
Merge branch 'kvm-xen-longmode' into HEAD (2026-09-04 17:35:03 +0200)
are available in the Git repository at:
https://github.com/kvm-x86/linux.git tags/kvm-x86-ppc_selftests-7.4
for you to fetch changes up to 23140d6e54ac31e2f4ef3bcd7fb586a14360be34:
KVM: selftests: Enable hardware disable test PPC (without pSeries LPAR) (2026-10-13 12:07:29 -0700)
----------------------------------------------------------------
KVM PPC selftests support for 7.4
Rework KVM selftest's handling of memory regions all so that PPC can force its
page table allocations to be naturally aligned, and then add initial selftests
support for PPC.
----------------------------------------------------------------
Hisam Mehboob (1):
KVM: selftests: Replace ulong with unsigned long
Nicholas Piggin (2):
KVM: selftests: Use goto instead of do-while to retry finding unused physical pages
KVM: PPC: selftests: add support for powerpc
Ritesh Harjani (IBM) (7):
KVM: selftests: Don't limit LE dirty-bitmap bitops to s390x
KVM: selftests: Move memslot_perf_test off the 256M ELF load address
KVM: selftests: Skip the max vCPU ID test when KVM_CAP_PPC_SMT is set
KVM: selftests: Add helper for checking if running on powerpc pseries LPAR
KVM: selftests: Skip kvm_create_max_vcpus on powerpc pseries LPAR
KVM: selftests: Enable access tracking perf test for PPC (with LPAR clause)
KVM: selftests: Enable hardware disable test PPC (without pSeries LPAR)
Sean Christopherson (19):
KVM: selftests: Use MEM_REGION_PT memslot instead of '0' for s390 regions/segments
KVM: selftests: Use the common minimum GPA for page tables on LoongArch
KVM: selftests: Use vm_alloc_page_table() to allocate LoongArch page tables
KVM: selftests: Rename "num" param to "nr_pages" for physical page allocators
KVM: selftests: Extend page allocator to support naturally aligned allocations
KVM: selftests: Make the single-page allocator APIs static inline
KVM: selftests: Use the innermost page allocator API in the memslot perf test
KVM: selftests: Use the innermost page allocator API in s390's IRQ routing test
KVM: selftests: Add a wrapper API to allocate multiple page table pages
KVM: selftests: Initialize vm->memslots[] with invalid memslots during creation
KVM: selftests: Add APIs to override memory region types with custom memslots
KVM: selftests: Add TEST_EXTRA memory region type for "special" memslots
KVM: selftests: Use TEST_EXTRA region in arm64's vGIC LPI stress test
KVM: selftests: Use TEST_EXTRA region in x86's smaller MAXPHYADDR test
KVM: selftests: Use TEST_EXTRA region in set memory region test
KVM: selftests: Take the memory region type, not memslot, in page allocators
KVM: selftests: Use TEST_ASSERT(), not assert(), in vm_get_mem_region()
KVM: selftests: Automatically pick min_gpa for allocations based on region type
KVM: selftests: Add arch hook to force page tables to be naturally aligned
MAINTAINERS | 2 +
tools/testing/selftests/kvm/Makefile | 2 +-
tools/testing/selftests/kvm/Makefile.kvm | 9 +
.../selftests/kvm/access_tracking_perf_test.c | 10 +
tools/testing/selftests/kvm/arm64/hypercalls.c | 2 +-
.../testing/selftests/kvm/arm64/page_fault_test.c | 18 +-
.../testing/selftests/kvm/arm64/vgic_lpi_stress.c | 21 +-
tools/testing/selftests/kvm/dirty_log_test.c | 12 +-
.../testing/selftests/kvm/hardware_disable_test.c | 3 +
tools/testing/selftests/kvm/include/kvm_util.h | 132 +++++-
.../testing/selftests/kvm/include/powerpc/hcall.h | 17 +
.../selftests/kvm/include/powerpc/kvm_util_arch.h | 22 +
.../selftests/kvm/include/powerpc/ppc_asm.h | 32 ++
.../selftests/kvm/include/powerpc/processor.h | 39 ++
.../testing/selftests/kvm/include/powerpc/ucall.h | 21 +
tools/testing/selftests/kvm/include/x86/smm.h | 2 +-
tools/testing/selftests/kvm/kvm_create_max_vcpus.c | 14 +-
tools/testing/selftests/kvm/lib/arm64/processor.c | 4 +-
tools/testing/selftests/kvm/lib/guest_modes.c | 20 +-
tools/testing/selftests/kvm/lib/kvm_util.c | 135 ++++--
.../selftests/kvm/lib/loongarch/processor.c | 5 +-
tools/testing/selftests/kvm/lib/powerpc/handlers.S | 93 ++++
tools/testing/selftests/kvm/lib/powerpc/hcall.c | 45 ++
.../testing/selftests/kvm/lib/powerpc/processor.c | 512 +++++++++++++++++++++
tools/testing/selftests/kvm/lib/powerpc/ucall.c | 22 +
tools/testing/selftests/kvm/lib/riscv/processor.c | 4 +-
tools/testing/selftests/kvm/lib/s390/processor.c | 7 +-
tools/testing/selftests/kvm/lib/x86/processor.c | 15 +-
tools/testing/selftests/kvm/memslot_perf_test.c | 7 +-
tools/testing/selftests/kvm/s390/cmma_test.c | 19 +-
tools/testing/selftests/kvm/s390/irq_routing.c | 2 +-
.../testing/selftests/kvm/set_memory_region_test.c | 8 +-
tools/testing/selftests/kvm/steal_time.c | 20 +-
tools/testing/selftests/kvm/x86/amx_test.c | 2 +-
tools/testing/selftests/kvm/x86/cpuid_test.c | 2 +-
tools/testing/selftests/kvm/x86/hyperv_clock.c | 2 +-
tools/testing/selftests/kvm/x86/hyperv_evmcs.c | 4 +-
tools/testing/selftests/kvm/x86/hyperv_svm_test.c | 2 +-
tools/testing/selftests/kvm/x86/set_boot_cpu_id.c | 2 +-
.../kvm/x86/smaller_maxphyaddr_emulation_test.c | 9 +-
tools/testing/selftests/kvm/x86/state_test.c | 4 +-
tools/testing/selftests/kvm/x86/tsc_msrs_test.c | 2 +-
.../selftests/kvm/x86/vmx_nested_la57_state_test.c | 2 +-
.../selftests/kvm/x86/vmx_preemption_timer_test.c | 4 +-
44 files changed, 1144 insertions(+), 167 deletions(-)
create mode 100644 tools/testing/selftests/kvm/include/powerpc/hcall.h
create mode 100644 tools/testing/selftests/kvm/include/powerpc/kvm_util_arch.h
create mode 100644 tools/testing/selftests/kvm/include/powerpc/ppc_asm.h
create mode 100644 tools/testing/selftests/kvm/include/powerpc/processor.h
create mode 100644 tools/testing/selftests/kvm/include/powerpc/ucall.h
create mode 100644 tools/testing/selftests/kvm/lib/powerpc/handlers.S
create mode 100644 tools/testing/selftests/kvm/lib/powerpc/hcall.c
create mode 100644 tools/testing/selftests/kvm/lib/powerpc/processor.c
create mode 100644 tools/testing/selftests/kvm/lib/powerpc/ucall.c