Skip to content

[PW_SID:1076438] Support runtime configuration for per-VM's HGATP mode#1712

Closed
linux-riscv-bot wants to merge 4 commits into
workflow__riscv__for-nextfrom
pw1076438
Closed

[PW_SID:1076438] Support runtime configuration for per-VM's HGATP mode#1712
linux-riscv-bot wants to merge 4 commits into
workflow__riscv__for-nextfrom
pw1076438

Conversation

@linux-riscv-bot
Copy link
Copy Markdown

PR for series 1076438 applied to workflow__riscv__for-next

Name: Support runtime configuration for per-VM's HGATP mode
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=1076438
Version: 7

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>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Gstage page-table helpers frequently chase gstage->kvm->arch to
fetch pgd_levels. This adds noise and repeats the same dereference
chain in hot paths.

Add pgd_levels to struct kvm_gstage and initialize it from kvm->arch
when setting up a gstage instance. Introduce kvm_riscv_gstage_init()
to centralize initialization and switch gstage code to use
gstage->pgd_levels.

Suggested-by: Anup Patel <anup@brainfault.org>
Signed-off-by: Fangyu Yu <fangyu.yu@linux.alibaba.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Extend kvm_riscv_gstage_mode_detect() to record HGATP.MODE values in a
bitmask. Keep tracking the maximum supported G-stage page table level
for existing internal users.

Also provide lightweight helpers to retrieve the supported-mode bitmask
and validate a requested HGATP.MODE against it.

Signed-off-by: Fangyu Yu <fangyu.yu@linux.alibaba.com>
Reviewed-by: Andrew Jones <andrew.jones@oss.qualcomm.com>
Reviewed-by: Guo Ren <guoren@kernel.org>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Add a VM capability that allows userspace to select the G-stage page table
format by setting HGATP.MODE on a per-VM basis.

Userspace enables the capability via KVM_ENABLE_CAP, passing the requested
HGATP.MODE in args[0]. The request is rejected with -EINVAL if the mode is
not supported by the host, and with -EBUSY if the VM has already been
committed (e.g. vCPUs have been created or any memslot is populated).

KVM_CHECK_EXTENSION(KVM_CAP_RISCV_SET_HGATP_MODE) returns a bitmask of the
HGATP.MODE formats supported by the host.

Signed-off-by: Fangyu Yu <fangyu.yu@linux.alibaba.com>
Reviewed-by: Andrew Jones <andrew.jones@oss.qualcomm.com>
Reviewed-by: Guo Ren <guoren@kernel.org>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v7,1/4] RISC-V: KVM: Support runtime configuration for per-VM's HGATP mode"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 138.37 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v7,1/4] RISC-V: KVM: Support runtime configuration for per-VM's HGATP mode"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1051.28 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v7,1/4] RISC-V: KVM: Support runtime configuration for per-VM's HGATP mode"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1415.35 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v7,1/4] RISC-V: KVM: Support runtime configuration for per-VM's HGATP mode"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 25.38 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v7,1/4] RISC-V: KVM: Support runtime configuration for per-VM's HGATP mode"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 26.77 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v7,1/4] RISC-V: KVM: Support runtime configuration for per-VM's HGATP mode"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 3.19 seconds
Result: WARNING
Output:

CHECK: Alignment should match open parenthesis
#402: FILE: arch/riscv/kvm/mmu.c:595:
+		kvm_riscv_gstage_unmap_range(&gstage, 0UL,
+			kvm_riscv_gstage_gpa_size(kvm->arch.pgd_levels), false);

total: 0 errors, 0 warnings, 1 checks, 365 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

Commit 83e48c398825 ("RISC-V: KVM: Support runtime configuration for per-VM's HGATP mode") has style problems, please review.

NOTE: Ignored message types: ALLOC_SIZEOF_STRUCT CAMELCASE COMMIT_LOG_LONG_LINE GIT_COMMIT_ID MACRO_ARG_REUSE NO_AUTHOR_SIGN_OFF

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.
total: 0 errors, 0 warnings, 1 checks, 365 lines checked
CHECK: Alignment should match open parenthesis


@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v7,1/4] RISC-V: KVM: Support runtime configuration for per-VM's HGATP mode"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 83.77 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v7,1/4] RISC-V: KVM: Support runtime configuration for per-VM's HGATP mode"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.24 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v7,1/4] RISC-V: KVM: Support runtime configuration for per-VM's HGATP mode"
kdoc
Desc: Detects for kdoc errors
Duration: 0.88 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v7,1/4] RISC-V: KVM: Support runtime configuration for per-VM's HGATP mode"
module-param
Desc: Detect module_param changes
Duration: 0.26 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v7,1/4] RISC-V: KVM: Support runtime configuration for per-VM's HGATP mode"
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: "[v7,1/4] RISC-V: KVM: Support runtime configuration for per-VM's HGATP mode"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.30 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v7,2/4] RISC-V: KVM: Cache gstage pgd_levels in struct kvm_gstage"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 136.99 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v7,2/4] RISC-V: KVM: Cache gstage pgd_levels in struct kvm_gstage"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1049.21 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v7,2/4] RISC-V: KVM: Cache gstage pgd_levels in struct kvm_gstage"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1412.98 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v7,2/4] RISC-V: KVM: Cache gstage pgd_levels in struct kvm_gstage"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 25.48 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v7,2/4] RISC-V: KVM: Cache gstage pgd_levels in struct kvm_gstage"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 26.92 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v7,2/4] RISC-V: KVM: Cache gstage pgd_levels in struct kvm_gstage"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 1.25 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v7,2/4] RISC-V: KVM: Cache gstage pgd_levels in struct kvm_gstage"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 85.35 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v7,2/4] RISC-V: KVM: Cache gstage pgd_levels in struct kvm_gstage"
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: "[v7,2/4] RISC-V: KVM: Cache gstage pgd_levels in struct kvm_gstage"
kdoc
Desc: Detects for kdoc errors
Duration: 0.85 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v7,2/4] RISC-V: KVM: Cache gstage pgd_levels in struct kvm_gstage"
module-param
Desc: Detect module_param changes
Duration: 0.26 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v7,2/4] RISC-V: KVM: Cache gstage pgd_levels in struct kvm_gstage"
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: "[v7,2/4] RISC-V: KVM: Cache gstage pgd_levels in struct kvm_gstage"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.29 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[v7,3/4] RISC-V: KVM: Detect and expose supported HGATP G-stage modes"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 138.00 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[v7,3/4] RISC-V: KVM: Detect and expose supported HGATP G-stage modes"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1049.61 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[v7,3/4] RISC-V: KVM: Detect and expose supported HGATP G-stage modes"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1420.66 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[v7,3/4] RISC-V: KVM: Detect and expose supported HGATP G-stage modes"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 24.96 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[v7,3/4] RISC-V: KVM: Detect and expose supported HGATP G-stage modes"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 26.52 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[v7,3/4] RISC-V: KVM: Detect and expose supported HGATP G-stage modes"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 1.04 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[v7,3/4] RISC-V: KVM: Detect and expose supported HGATP G-stage modes"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 84.27 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[v7,3/4] RISC-V: KVM: Detect and expose supported HGATP G-stage modes"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.24 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[v7,3/4] RISC-V: KVM: Detect and expose supported HGATP G-stage modes"
kdoc
Desc: Detects for kdoc errors
Duration: 0.87 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[v7,3/4] RISC-V: KVM: Detect and expose supported HGATP G-stage modes"
module-param
Desc: Detect module_param changes
Duration: 0.26 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[v7,3/4] RISC-V: KVM: Detect and expose supported HGATP G-stage modes"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.23 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[v7,3/4] RISC-V: KVM: Detect and expose supported HGATP G-stage modes"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.31 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 4: "[v7,4/4] RISC-V: KVM: add KVM_CAP_RISCV_SET_HGATP_MODE"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 136.39 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 4: "[v7,4/4] RISC-V: KVM: add KVM_CAP_RISCV_SET_HGATP_MODE"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1047.19 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 4: "[v7,4/4] RISC-V: KVM: add KVM_CAP_RISCV_SET_HGATP_MODE"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1415.17 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 4: "[v7,4/4] RISC-V: KVM: add KVM_CAP_RISCV_SET_HGATP_MODE"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 25.39 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 4: "[v7,4/4] RISC-V: KVM: add KVM_CAP_RISCV_SET_HGATP_MODE"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 26.73 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 4: "[v7,4/4] RISC-V: KVM: add KVM_CAP_RISCV_SET_HGATP_MODE"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 1.21 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 4: "[v7,4/4] RISC-V: KVM: add KVM_CAP_RISCV_SET_HGATP_MODE"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 83.77 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 4: "[v7,4/4] RISC-V: KVM: add KVM_CAP_RISCV_SET_HGATP_MODE"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.24 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 4: "[v7,4/4] RISC-V: KVM: add KVM_CAP_RISCV_SET_HGATP_MODE"
kdoc
Desc: Detects for kdoc errors
Duration: 0.89 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 4: "[v7,4/4] RISC-V: KVM: add KVM_CAP_RISCV_SET_HGATP_MODE"
module-param
Desc: Detect module_param changes
Duration: 0.29 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 4: "[v7,4/4] RISC-V: KVM: add KVM_CAP_RISCV_SET_HGATP_MODE"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.22 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 4: "[v7,4/4] RISC-V: KVM: add KVM_CAP_RISCV_SET_HGATP_MODE"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.30 seconds
Result: PASS

@linux-riscv-bot linux-riscv-bot deleted the pw1076438 branch April 3, 2026 04:48
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.

2 participants