[PATCH 03/20] KVM: selftests: Use vm_alloc_page_table() to allocate LoongArch page tables
From: Sean Christopherson
Date: Wed Aug 26 2026 - 19:07:58 EST
Now that KVM_GUEST_PAGE_TABLE_MIN_PADDR == LOONGARCH_PAGE_TABLE_PHYS_MIN,
use the common vm_alloc_page_table() instead of open coding the same.
Opportunistically drop the assert that the allocation succeeded, as the
allocator itself guarantees success.
For all intents and purposes, no functional change intended.
Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx>
---
tools/testing/selftests/kvm/lib/loongarch/processor.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/tools/testing/selftests/kvm/lib/loongarch/processor.c b/tools/testing/selftests/kvm/lib/loongarch/processor.c
index 47bbde3e205a..fcd41bc6fbda 100644
--- a/tools/testing/selftests/kvm/lib/loongarch/processor.c
+++ b/tools/testing/selftests/kvm/lib/loongarch/processor.c
@@ -9,7 +9,6 @@
#include "processor.h"
#include "ucall_common.h"
-#define LOONGARCH_PAGE_TABLE_PHYS_MIN 0x200000
#define LOONGARCH_GUEST_STACK_VADDR_MIN 0x200000
static gpa_t invalid_pgtable[4];
@@ -57,9 +56,7 @@ void virt_arch_pgd_alloc(struct kvm_vm *vm)
child = table = 0;
for (i = 0; i < vm->mmu.pgtable_levels; i++) {
invalid_pgtable[i] = child;
- table = vm_phy_page_alloc(vm, LOONGARCH_PAGE_TABLE_PHYS_MIN,
- vm->memslots[MEM_REGION_PT]);
- TEST_ASSERT(table, "Fail to allocate page tale at level %d\n", i);
+ table = vm_alloc_page_table(vm);
virt_set_pgtable(vm, table, child);
child = table;
}
--
2.55.0.887.g758fc8c411-goog