]> git.ipfire.org Git - thirdparty/linux.git/commit
RISC-V: KVM: Support runtime configuration for per-VM's HGATP mode
authorFangyu Yu <fangyu.yu@linux.alibaba.com>
Fri, 3 Apr 2026 15:30:16 +0000 (23:30 +0800)
committerAnup Patel <anup@brainfault.org>
Sat, 4 Apr 2026 07:51:21 +0000 (13:21 +0530)
commitefcac8424ba6ab75f2e16be9b0ccfdf60b13b294
tree70ba6d7fe682d24391529f8337b9c526cbbd9ed2
parente2494f83f9d717a7f607cfaefb4e69e55b8e024d
RISC-V: KVM: Support runtime configuration for per-VM's HGATP mode

Introduces one per-VM architecture-specific fields to support runtime
configuration of the G-stage page table format:

- kvm->arch.pgd_levels: the corresponding number of page table levels
  for the selected mode.

These fields replace the previous global variables
kvm_riscv_gstage_mode and kvm_riscv_gstage_pgd_levels, enabling different
virtual machines to independently select their G-stage page table format
instead of being forced to share the maximum mode detected by the kernel
at boot time.

Signed-off-by: Fangyu Yu <fangyu.yu@linux.alibaba.com>
Reviewed-by: Andrew Jones <andrew.jones@oss.qualcomm.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
Reviewed-by: Guo Ren <guoren@kernel.org>
Reviewed-by: Nutty Liu <nutty.liu@hotmail.com>
Link: https://lore.kernel.org/r/20260403153019.9916-2-fangyu.yu@linux.alibaba.com
Signed-off-by: Anup Patel <anup@brainfault.org>
arch/riscv/include/asm/kvm_gstage.h
arch/riscv/include/asm/kvm_host.h
arch/riscv/kvm/gstage.c
arch/riscv/kvm/main.c
arch/riscv/kvm/mmu.c
arch/riscv/kvm/vm.c
arch/riscv/kvm/vmid.c