Thread (29 messages) flat view 29 messages, 7 authors, 5h ago

Re: [PATCH v2 02/20] KVM: selftests: Use the common minimum GPA for page tables on LoongArch

From: Bibo Mao <maobibo@loongson.cn>
Date: 2026-09-03 01:01:44
Also in: kvm, kvm-riscv, kvmarm, linux-riscv, lkml, loongarch


On 2026/9/3 上午12:41, Sean Christopherson wrote:
quoted hunk ↗ jump to hunk
Use the common minimum GPA for page tables (0x180000) on LoongArch instead
of LoongArch's custom minimum of 0x200000, so that LoongArch can use
vm_alloc_page_table() instead of open coding a rough equivalent.  There are
no known reasons why LoongArch can't use a lower, less-aligned minimum.
The more-aligned value was originally selected to support huge pages for
the guest, but that only requires the address of the final allocation to be
aligned, the addresses of page table pages is irrelevant on that front.

Signed-off-by: Sean Christopherson <seanjc@google.com>
---
  tools/testing/selftests/kvm/lib/loongarch/processor.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/tools/testing/selftests/kvm/lib/loongarch/processor.c b/tools/testing/selftests/kvm/lib/loongarch/processor.c
index 47bbde3e205a..057a77713542 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,7 +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,
+		table = vm_phy_page_alloc(vm, KVM_GUEST_PAGE_TABLE_MIN_PADDR,
  				vm->memslots[MEM_REGION_PT]);
  		TEST_ASSERT(table, "Fail to allocate page tale at level %d\n", i);
  		virt_set_pgtable(vm, table, child);
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