[PW_SID:1143857] KVM: riscv: Add KVM_PRE_FAULT_MEMORY support - #2445
[PW_SID:1143857] KVM: riscv: Add KVM_PRE_FAULT_MEMORY support#2445linux-riscv-bot wants to merge 3 commits into
Conversation
The generic KVM_PRE_FAULT_MEMORY ioctl lets userspace populate KVM page tables before running a vCPU over a GPA range. x86 already supports the ioctl, but RISC-V does not expose the capability and has no arch hook. Add the RISC-V arch hook and reuse the existing G-stage fault mapping path with a read access. Report progress using the G-stage mapping returned by the map path, so the ioctl can advance by the actual leaf size that covers the requested GPA. Unlike x86, RISC-V's G-stage fault path does not return a detailed result such as RET_PF_FIXED or RET_PF_RETRY. Treat a successful call that does not return a visible G-stage mapping as no progress, instead of reporting that a page was prefaulted. Signed-off-by: Jinyu Tang <jinyu.tang@linux.dev> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
RISC-V selftests can create guests with five page-table levels, for example when the selected guest mode is Sv57. The RISC-V page-table walker only had index arrays for levels 0 through 3, so virt_arch_pg_map() indexed past the end of the arrays when level 4 was used. Add the missing L4 index mask and shift so selftests can build guest page tables for Sv57 VMs. Signed-off-by: Jinyu Tang <jinyu.tang@linux.dev> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
RISC-V now supports KVM_PRE_FAULT_MEMORY, so include the generic pre_fault_memory_test in the RISC-V KVM selftest build. The test uses PAGE_SIZE from the architecture processor header. Define the normal 4K RISC-V selftest page size so the generic test can build for RISC-V. RISC-V selects VM_MODE_DEFAULT at runtime. Initialize the supported guest modes before creating the VM so the generic test can run on RISC-V hosts where the default mode is discovered from KVM capabilities. Signed-off-by: Jinyu Tang <jinyu.tang@linux.dev> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
|
Patch 1: "[1/3] KVM: riscv: Implement KVM_PRE_FAULT_MEMORY" |
|
Patch 1: "[1/3] KVM: riscv: Implement KVM_PRE_FAULT_MEMORY" |
|
Patch 1: "[1/3] KVM: riscv: Implement KVM_PRE_FAULT_MEMORY" |
|
Patch 1: "[1/3] KVM: riscv: Implement KVM_PRE_FAULT_MEMORY" |
|
Patch 1: "[1/3] KVM: riscv: Implement KVM_PRE_FAULT_MEMORY" |
|
Patch 1: "[1/3] KVM: riscv: Implement KVM_PRE_FAULT_MEMORY" |
|
Patch 1: "[1/3] KVM: riscv: Implement KVM_PRE_FAULT_MEMORY" |
|
Patch 1: "[1/3] KVM: riscv: Implement KVM_PRE_FAULT_MEMORY" |
|
Patch 1: "[1/3] KVM: riscv: Implement KVM_PRE_FAULT_MEMORY" |
|
Patch 1: "[1/3] KVM: riscv: Implement KVM_PRE_FAULT_MEMORY" |
|
Patch 1: "[1/3] KVM: riscv: Implement KVM_PRE_FAULT_MEMORY" |
|
Patch 1: "[1/3] KVM: riscv: Implement KVM_PRE_FAULT_MEMORY" |
|
Patch 2: "[2/3] KVM: selftests: Add RISC-V Sv57 page table indexing" |
|
Patch 2: "[2/3] KVM: selftests: Add RISC-V Sv57 page table indexing" |
|
Patch 2: "[2/3] KVM: selftests: Add RISC-V Sv57 page table indexing" |
|
Patch 2: "[2/3] KVM: selftests: Add RISC-V Sv57 page table indexing" |
|
Patch 2: "[2/3] KVM: selftests: Add RISC-V Sv57 page table indexing" |
|
Patch 2: "[2/3] KVM: selftests: Add RISC-V Sv57 page table indexing" |
|
Patch 2: "[2/3] KVM: selftests: Add RISC-V Sv57 page table indexing" |
|
Patch 2: "[2/3] KVM: selftests: Add RISC-V Sv57 page table indexing" |
|
Patch 2: "[2/3] KVM: selftests: Add RISC-V Sv57 page table indexing" |
|
Patch 2: "[2/3] KVM: selftests: Add RISC-V Sv57 page table indexing" |
|
Patch 2: "[2/3] KVM: selftests: Add RISC-V Sv57 page table indexing" |
|
Patch 2: "[2/3] KVM: selftests: Add RISC-V Sv57 page table indexing" |
|
Patch 3: "[3/3] KVM: selftests: Enable pre_fault_memory_test for RISC-V" |
|
Patch 3: "[3/3] KVM: selftests: Enable pre_fault_memory_test for RISC-V" |
|
Patch 3: "[3/3] KVM: selftests: Enable pre_fault_memory_test for RISC-V" |
|
Patch 3: "[3/3] KVM: selftests: Enable pre_fault_memory_test for RISC-V" |
|
Patch 3: "[3/3] KVM: selftests: Enable pre_fault_memory_test for RISC-V" |
|
Patch 3: "[3/3] KVM: selftests: Enable pre_fault_memory_test for RISC-V" |
|
Patch 3: "[3/3] KVM: selftests: Enable pre_fault_memory_test for RISC-V" |
|
Patch 3: "[3/3] KVM: selftests: Enable pre_fault_memory_test for RISC-V" |
|
Patch 3: "[3/3] KVM: selftests: Enable pre_fault_memory_test for RISC-V" |
|
Patch 3: "[3/3] KVM: selftests: Enable pre_fault_memory_test for RISC-V" |
|
Patch 3: "[3/3] KVM: selftests: Enable pre_fault_memory_test for RISC-V" |
|
Patch 3: "[3/3] KVM: selftests: Enable pre_fault_memory_test for RISC-V" |
PR for series 1143857 applied to workflow__riscv__fixes
Name: KVM: riscv: Add KVM_PRE_FAULT_MEMORY support
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=1143857
Version: 1