Linux-RISC-V Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] Support runtime configuration for per-VM's HGATP mode
@ 2026-01-05 14:32 fangyu.yu
  2026-01-05 14:32 ` [PATCH v2] RISC-V: KVM: " fangyu.yu
  2026-01-05 14:32 ` [PATCH v2] RISC-V: KVM: add KVM_CAP_RISCV_SET_HGATP_MODE fangyu.yu
  0 siblings, 2 replies; 11+ messages in thread
From: fangyu.yu @ 2026-01-05 14:32 UTC (permalink / raw)
  To: pbonzini, corbet, anup, atish.patra, pjw, palmer, aou, alex
  Cc: guoren, ajones, rkrcmar, linux-doc, kvm, kvm-riscv, linux-riscv,
	linux-kernel, Fangyu Yu

From: Fangyu Yu <fangyu.yu@linux.alibaba.com>

Currently, RISC-V KVM hardcodes the G-stage page table format (HGATP mode)
to the maximum mode detected at boot time (e.g., SV57x4 if supported). but
often such a wide GPA is unnecessary, just as a host sometimes doesn't need
sv57.

This patch introduces per-VM configurability of the G-stage mode via a new
KVM capability: KVM_CAP_RISCV_SET_HGATP_MODE. User-space can now explicitly
request a specific HGATP mode (SV39x4, SV48x4, or SV57x4 on 64-bit) during
VM creation.

Fangyu Yu (2):
  RISC-V: KVM: Support runtime configuration for per-VM's HGATP mode
  RISC-V: KVM: add KVM_CAP_RISCV_SET_HGATP_MODE

 Documentation/virt/kvm/api.rst      | 14 +++++
 arch/riscv/include/asm/kvm_gstage.h | 12 ++---
 arch/riscv/include/asm/kvm_host.h   |  4 ++
 arch/riscv/kvm/gstage.c             | 82 +++++++++++++++++------------
 arch/riscv/kvm/main.c               |  4 +-
 arch/riscv/kvm/mmu.c                | 18 +++++--
 arch/riscv/kvm/vm.c                 | 28 ++++++++--
 arch/riscv/kvm/vmid.c               |  2 +-
 include/uapi/linux/kvm.h            |  1 +
 9 files changed, 113 insertions(+), 52 deletions(-)

-- 
2.50.1


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2026-01-20 14:23 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-05 14:32 [PATCH v2] Support runtime configuration for per-VM's HGATP mode fangyu.yu
2026-01-05 14:32 ` [PATCH v2] RISC-V: KVM: " fangyu.yu
2026-01-15 23:37   ` Andrew Jones
2026-01-16 14:29     ` fangyu.yu
2026-01-05 14:32 ` [PATCH v2] RISC-V: KVM: add KVM_CAP_RISCV_SET_HGATP_MODE fangyu.yu
2026-01-15 23:56   ` Andrew Jones
2026-01-16 14:29     ` fangyu.yu
2026-01-16 19:03   ` Andrew Jones
2026-01-20 14:22     ` fangyu.yu
2026-01-19 13:56   ` Radim Krčmář
2026-01-20 14:22     ` fangyu.yu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox