[PW_SID:1076438] Support runtime configuration for per-VM's HGATP mode#1712
[PW_SID:1076438] Support runtime configuration for per-VM's HGATP mode#1712linux-riscv-bot wants to merge 4 commits into
Conversation
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>
|
Patch 1: "[v7,1/4] RISC-V: KVM: Support runtime configuration for per-VM's HGATP mode" |
|
Patch 1: "[v7,1/4] RISC-V: KVM: Support runtime configuration for per-VM's HGATP mode" |
|
Patch 1: "[v7,1/4] RISC-V: KVM: Support runtime configuration for per-VM's HGATP mode" |
|
Patch 1: "[v7,1/4] RISC-V: KVM: Support runtime configuration for per-VM's HGATP mode" |
|
Patch 1: "[v7,1/4] RISC-V: KVM: Support runtime configuration for per-VM's HGATP mode" |
|
Patch 1: "[v7,1/4] RISC-V: KVM: Support runtime configuration for per-VM's HGATP mode" |
|
Patch 1: "[v7,1/4] RISC-V: KVM: Support runtime configuration for per-VM's HGATP mode" |
|
Patch 1: "[v7,1/4] RISC-V: KVM: Support runtime configuration for per-VM's HGATP mode" |
|
Patch 1: "[v7,1/4] RISC-V: KVM: Support runtime configuration for per-VM's HGATP mode" |
|
Patch 1: "[v7,1/4] RISC-V: KVM: Support runtime configuration for per-VM's HGATP mode" |
|
Patch 1: "[v7,1/4] RISC-V: KVM: Support runtime configuration for per-VM's HGATP mode" |
|
Patch 1: "[v7,1/4] RISC-V: KVM: Support runtime configuration for per-VM's HGATP mode" |
|
Patch 2: "[v7,2/4] RISC-V: KVM: Cache gstage pgd_levels in struct kvm_gstage" |
|
Patch 2: "[v7,2/4] RISC-V: KVM: Cache gstage pgd_levels in struct kvm_gstage" |
|
Patch 2: "[v7,2/4] RISC-V: KVM: Cache gstage pgd_levels in struct kvm_gstage" |
|
Patch 2: "[v7,2/4] RISC-V: KVM: Cache gstage pgd_levels in struct kvm_gstage" |
|
Patch 2: "[v7,2/4] RISC-V: KVM: Cache gstage pgd_levels in struct kvm_gstage" |
|
Patch 2: "[v7,2/4] RISC-V: KVM: Cache gstage pgd_levels in struct kvm_gstage" |
|
Patch 2: "[v7,2/4] RISC-V: KVM: Cache gstage pgd_levels in struct kvm_gstage" |
|
Patch 2: "[v7,2/4] RISC-V: KVM: Cache gstage pgd_levels in struct kvm_gstage" |
|
Patch 2: "[v7,2/4] RISC-V: KVM: Cache gstage pgd_levels in struct kvm_gstage" |
|
Patch 2: "[v7,2/4] RISC-V: KVM: Cache gstage pgd_levels in struct kvm_gstage" |
|
Patch 2: "[v7,2/4] RISC-V: KVM: Cache gstage pgd_levels in struct kvm_gstage" |
|
Patch 2: "[v7,2/4] RISC-V: KVM: Cache gstage pgd_levels in struct kvm_gstage" |
|
Patch 3: "[v7,3/4] RISC-V: KVM: Detect and expose supported HGATP G-stage modes" |
|
Patch 3: "[v7,3/4] RISC-V: KVM: Detect and expose supported HGATP G-stage modes" |
|
Patch 3: "[v7,3/4] RISC-V: KVM: Detect and expose supported HGATP G-stage modes" |
|
Patch 3: "[v7,3/4] RISC-V: KVM: Detect and expose supported HGATP G-stage modes" |
|
Patch 3: "[v7,3/4] RISC-V: KVM: Detect and expose supported HGATP G-stage modes" |
|
Patch 3: "[v7,3/4] RISC-V: KVM: Detect and expose supported HGATP G-stage modes" |
|
Patch 3: "[v7,3/4] RISC-V: KVM: Detect and expose supported HGATP G-stage modes" |
|
Patch 3: "[v7,3/4] RISC-V: KVM: Detect and expose supported HGATP G-stage modes" |
|
Patch 3: "[v7,3/4] RISC-V: KVM: Detect and expose supported HGATP G-stage modes" |
|
Patch 3: "[v7,3/4] RISC-V: KVM: Detect and expose supported HGATP G-stage modes" |
|
Patch 3: "[v7,3/4] RISC-V: KVM: Detect and expose supported HGATP G-stage modes" |
|
Patch 3: "[v7,3/4] RISC-V: KVM: Detect and expose supported HGATP G-stage modes" |
|
Patch 4: "[v7,4/4] RISC-V: KVM: add KVM_CAP_RISCV_SET_HGATP_MODE" |
|
Patch 4: "[v7,4/4] RISC-V: KVM: add KVM_CAP_RISCV_SET_HGATP_MODE" |
|
Patch 4: "[v7,4/4] RISC-V: KVM: add KVM_CAP_RISCV_SET_HGATP_MODE" |
|
Patch 4: "[v7,4/4] RISC-V: KVM: add KVM_CAP_RISCV_SET_HGATP_MODE" |
|
Patch 4: "[v7,4/4] RISC-V: KVM: add KVM_CAP_RISCV_SET_HGATP_MODE" |
|
Patch 4: "[v7,4/4] RISC-V: KVM: add KVM_CAP_RISCV_SET_HGATP_MODE" |
|
Patch 4: "[v7,4/4] RISC-V: KVM: add KVM_CAP_RISCV_SET_HGATP_MODE" |
|
Patch 4: "[v7,4/4] RISC-V: KVM: add KVM_CAP_RISCV_SET_HGATP_MODE" |
|
Patch 4: "[v7,4/4] RISC-V: KVM: add KVM_CAP_RISCV_SET_HGATP_MODE" |
|
Patch 4: "[v7,4/4] RISC-V: KVM: add KVM_CAP_RISCV_SET_HGATP_MODE" |
|
Patch 4: "[v7,4/4] RISC-V: KVM: add KVM_CAP_RISCV_SET_HGATP_MODE" |
|
Patch 4: "[v7,4/4] RISC-V: KVM: add KVM_CAP_RISCV_SET_HGATP_MODE" |
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