Thread (34 messages) flat view 34 messages, 6 authors, 4d ago

Re: [PATCH 03/20] KVM: selftests: Use vm_alloc_page_table() to allocate LoongArch page tables

From: Bibo Mao <maobibo@loongson.cn>
Date: 2026-08-27 06:44:07
Also in: kvm, kvm-riscv, kvmarm, linux-riscv, lkml, loongarch


On 2026/8/27 上午7:04, Sean Christopherson wrote:
quoted hunk ↗ jump to hunk
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@google.com>
---
  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;
  	}
Reviewed-by: Bibo Mao <maobibo@loongson.cn>

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help