Skip to content

[PW_SID:1143857] KVM: riscv: Add KVM_PRE_FAULT_MEMORY support - #2445

Open
linux-riscv-bot wants to merge 3 commits into
workflow__riscv__fixesfrom
pw1143857
Open

[PW_SID:1143857] KVM: riscv: Add KVM_PRE_FAULT_MEMORY support#2445
linux-riscv-bot wants to merge 3 commits into
workflow__riscv__fixesfrom
pw1143857

Conversation

@linux-riscv-bot

Copy link
Copy Markdown

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

Jinyu Tang added 3 commits August 11, 2026 06:58
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>
@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[1/3] KVM: riscv: Implement KVM_PRE_FAULT_MEMORY"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 118.06 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[1/3] KVM: riscv: Implement KVM_PRE_FAULT_MEMORY"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1158.04 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[1/3] KVM: riscv: Implement KVM_PRE_FAULT_MEMORY"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1444.49 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[1/3] KVM: riscv: Implement KVM_PRE_FAULT_MEMORY"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 19.75 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[1/3] KVM: riscv: Implement KVM_PRE_FAULT_MEMORY"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 21.21 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[1/3] KVM: riscv: Implement KVM_PRE_FAULT_MEMORY"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 1.14 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[1/3] KVM: riscv: Implement KVM_PRE_FAULT_MEMORY"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 78.69 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[1/3] KVM: riscv: Implement KVM_PRE_FAULT_MEMORY"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.27 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[1/3] KVM: riscv: Implement KVM_PRE_FAULT_MEMORY"
kdoc
Desc: Detects for kdoc errors
Duration: 0.70 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[1/3] KVM: riscv: Implement KVM_PRE_FAULT_MEMORY"
module-param
Desc: Detect module_param changes
Duration: 0.24 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[1/3] KVM: riscv: Implement KVM_PRE_FAULT_MEMORY"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.22 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[1/3] KVM: riscv: Implement KVM_PRE_FAULT_MEMORY"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.26 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[2/3] KVM: selftests: Add RISC-V Sv57 page table indexing"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 117.19 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[2/3] KVM: selftests: Add RISC-V Sv57 page table indexing"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1117.97 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[2/3] KVM: selftests: Add RISC-V Sv57 page table indexing"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1408.07 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[2/3] KVM: selftests: Add RISC-V Sv57 page table indexing"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 19.64 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[2/3] KVM: selftests: Add RISC-V Sv57 page table indexing"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 21.19 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[2/3] KVM: selftests: Add RISC-V Sv57 page table indexing"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 0.75 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[2/3] KVM: selftests: Add RISC-V Sv57 page table indexing"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 79.49 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[2/3] KVM: selftests: Add RISC-V Sv57 page table indexing"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.23 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[2/3] KVM: selftests: Add RISC-V Sv57 page table indexing"
kdoc
Desc: Detects for kdoc errors
Duration: 0.72 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[2/3] KVM: selftests: Add RISC-V Sv57 page table indexing"
module-param
Desc: Detect module_param changes
Duration: 0.24 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[2/3] KVM: selftests: Add RISC-V Sv57 page table indexing"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.22 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[2/3] KVM: selftests: Add RISC-V Sv57 page table indexing"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.26 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 3: "[3/3] KVM: selftests: Enable pre_fault_memory_test for RISC-V"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 121.37 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 3: "[3/3] KVM: selftests: Enable pre_fault_memory_test for RISC-V"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1113.07 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 3: "[3/3] KVM: selftests: Enable pre_fault_memory_test for RISC-V"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1400.46 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 3: "[3/3] KVM: selftests: Enable pre_fault_memory_test for RISC-V"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 20.07 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 3: "[3/3] KVM: selftests: Enable pre_fault_memory_test for RISC-V"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 21.09 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 3: "[3/3] KVM: selftests: Enable pre_fault_memory_test for RISC-V"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 0.92 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 3: "[3/3] KVM: selftests: Enable pre_fault_memory_test for RISC-V"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 77.37 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 3: "[3/3] KVM: selftests: Enable pre_fault_memory_test for RISC-V"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.23 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 3: "[3/3] KVM: selftests: Enable pre_fault_memory_test for RISC-V"
kdoc
Desc: Detects for kdoc errors
Duration: 0.72 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 3: "[3/3] KVM: selftests: Enable pre_fault_memory_test for RISC-V"
module-param
Desc: Detect module_param changes
Duration: 0.24 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 3: "[3/3] KVM: selftests: Enable pre_fault_memory_test for RISC-V"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.22 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 3: "[3/3] KVM: selftests: Enable pre_fault_memory_test for RISC-V"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.26 seconds
Result: PASS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant