[PATCH 0/3] KVM: riscv: Add KVM_PRE_FAULT_MEMORY support
Jinyu Tang
jinyu.tang at linux.dev
Mon Aug 10 23:01:31 PDT 2026
This series adds RISC-V support for the generic KVM_PRE_FAULT_MEMORY
vcpu ioctl and enables the existing generic KVM selftest for RISC-V.
KVM_PRE_FAULT_MEMORY lets userspace ask KVM to populate stage-2 mappings
for a GPA range before running a vCPU that is expected to access that
range. x86 already supports the ioctl; RISC-V currently falls back to
normal first-touch G-stage faults.
Patch 1 implements the RISC-V arch hook using the existing G-stage map
path. Patch 2 fixes the RISC-V selftest page-table walker for Sv57,
which can be selected as the default guest mode. Patch 3 enables
pre_fault_memory_test for RISC-V.
Tested with pre_fault_memory_test on a RISC-V KVM host.
Jinyu Tang (3):
KVM: riscv: Implement KVM_PRE_FAULT_MEMORY
KVM: selftests: Add RISC-V Sv57 page table indexing
KVM: selftests: Enable pre_fault_memory_test for RISC-V
arch/riscv/kvm/Kconfig | 1 +
arch/riscv/kvm/gstage.c | 3 ++
arch/riscv/kvm/mmu.c | 33 +++++++++++++++++++
arch/riscv/kvm/vm.c | 1 +
tools/testing/selftests/kvm/Makefile.kvm | 1 +
.../selftests/kvm/include/riscv/processor.h | 6 ++++
.../selftests/kvm/lib/riscv/processor.c | 2 ++
.../selftests/kvm/pre_fault_memory_test.c | 3 ++
8 files changed, 50 insertions(+)
--
2.43.0
More information about the kvm-riscv
mailing list