Skip to content

[PW_SID:965558] Enable hstateen bits lazily for the KVM RISC-V Guests#434

Closed
linux-riscv-bot wants to merge 5 commits into
workflow__riscv__fixesfrom
pw965558
Closed

[PW_SID:965558] Enable hstateen bits lazily for the KVM RISC-V Guests#434
linux-riscv-bot wants to merge 5 commits into
workflow__riscv__fixesfrom
pw965558

Conversation

@linux-riscv-bot
Copy link
Copy Markdown

PR for series 965558 applied to workflow__riscv__fixes

Name: Enable hstateen bits lazily for the KVM RISC-V Guests
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=965558
Version: 2

atishp04 added 5 commits May 22, 2025 20:47
Currently, we enable the smstateen bit at vcpu configure time by
only checking the presence of required ISA extensions.

These bits are not required to be enabled if the guest never uses
the corresponding architectural state. Enable the smstaeen bits
at runtime lazily upon first access.

Signed-off-by: Atish Patra <atishp@rivosinc.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Hstateen has different bits that can be enabled lazily at runtime.
Most of them have similar functionality where the hstateen bit must
be enabled if not enabled already. The correpsonding config bit in
vcpu must be enabled as well so that hstateen CSR is updated correctly
during the next vcpu load. In absesnce of Smstateen extension, exit
to the userspace in the trap because CSR access control exists
architecturally only if Smstateen extension is available.

Add a common helper function to achieve the above said objective.

Signed-off-by: Atish Patra <atishp@rivosinc.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Smstateen extension controls the SISELECT and SIPH/SIEH register
through hstateen.AIA bit (58). Add lazy enabling support for those
bits.

Signed-off-by: Atish Patra <atishp@rivosinc.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
SENVCFG and SSTATEEN CSRs are controlled by HSENVCFG(62) and
SSTATEEN0(63) bits in hstateen. Enable them lazily at runtime
instead of bootime.

Signed-off-by: Atish Patra <atishp@rivosinc.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
All the existing hstateen bits can be enabled at runtime upon
first access now. Remove the default enabling at bootime now.

Signed-off-by: Atish Patra <atishp@rivosinc.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v2,1/5] RISC-V: KVM: Lazy enable hstateen IMSIC & ISEL bit"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 104.89 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v2,1/5] RISC-V: KVM: Lazy enable hstateen IMSIC & ISEL bit"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 983.66 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v2,1/5] RISC-V: KVM: Lazy enable hstateen IMSIC & ISEL bit"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1272.19 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v2,1/5] RISC-V: KVM: Lazy enable hstateen IMSIC & ISEL bit"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 20.41 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v2,1/5] RISC-V: KVM: Lazy enable hstateen IMSIC & ISEL bit"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 21.66 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v2,1/5] RISC-V: KVM: Lazy enable hstateen IMSIC & ISEL bit"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 1.19 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v2,1/5] RISC-V: KVM: Lazy enable hstateen IMSIC & ISEL bit"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 66.24 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v2,1/5] RISC-V: KVM: Lazy enable hstateen IMSIC & ISEL bit"
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: "[v2,1/5] RISC-V: KVM: Lazy enable hstateen IMSIC & ISEL bit"
kdoc
Desc: Detects for kdoc errors
Duration: 0.86 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v2,1/5] RISC-V: KVM: Lazy enable hstateen IMSIC & ISEL bit"
module-param
Desc: Detect module_param changes
Duration: 0.40 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v2,1/5] RISC-V: KVM: Lazy enable hstateen IMSIC & ISEL bit"
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: "[v2,1/5] RISC-V: KVM: Lazy enable hstateen IMSIC & ISEL bit"
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 2: "[v2,2/5] RISC-V: KVM: Add a hstateen lazy enabler helper function"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 104.58 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v2,2/5] RISC-V: KVM: Add a hstateen lazy enabler helper function"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 986.38 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v2,2/5] RISC-V: KVM: Add a hstateen lazy enabler helper function"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1276.73 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v2,2/5] RISC-V: KVM: Add a hstateen lazy enabler helper function"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 20.32 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v2,2/5] RISC-V: KVM: Add a hstateen lazy enabler helper function"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 21.58 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v2,2/5] RISC-V: KVM: Add a hstateen lazy enabler helper function"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 0.96 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v2,2/5] RISC-V: KVM: Add a hstateen lazy enabler helper function"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 66.97 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v2,2/5] RISC-V: KVM: Add a hstateen lazy enabler helper function"
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 2: "[v2,2/5] RISC-V: KVM: Add a hstateen lazy enabler helper function"
kdoc
Desc: Detects for kdoc errors
Duration: 0.86 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v2,2/5] RISC-V: KVM: Add a hstateen lazy enabler helper function"
module-param
Desc: Detect module_param changes
Duration: 0.37 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v2,2/5] RISC-V: KVM: Add a hstateen lazy enabler helper function"
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: "[v2,2/5] RISC-V: KVM: Add a hstateen lazy enabler helper function"
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 3: "[v2,3/5] RISC-V: KVM: Support lazy enabling of siselect and aia bits"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 105.46 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[v2,3/5] RISC-V: KVM: Support lazy enabling of siselect and aia bits"
kdoc
Desc: Detects for kdoc errors
Duration: 1.16 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[v2,3/5] RISC-V: KVM: Support lazy enabling of siselect and aia bits"
module-param
Desc: Detect module_param changes
Duration: 0.25 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[v2,3/5] RISC-V: KVM: Support lazy enabling of siselect and aia bits"
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: "[v2,3/5] RISC-V: KVM: Support lazy enabling of siselect and aia bits"
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 4: "[v2,4/5] RISC-V: KVM: Enable envcfg and sstateen bits lazily"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 105.91 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 4: "[v2,4/5] RISC-V: KVM: Enable envcfg and sstateen bits lazily"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 907.88 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 4: "[v2,4/5] RISC-V: KVM: Enable envcfg and sstateen bits lazily"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1179.14 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 4: "[v2,4/5] RISC-V: KVM: Enable envcfg and sstateen bits lazily"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 20.58 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 4: "[v2,4/5] RISC-V: KVM: Enable envcfg and sstateen bits lazily"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 21.66 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 4: "[v2,4/5] RISC-V: KVM: Enable envcfg and sstateen bits lazily"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 1.51 seconds
Result: ERROR
Output:

ERROR: Macros with complex values should be enclosed in parentheses
#47: FILE: arch/riscv/kvm/vcpu_insn.c:291:
+#define KVM_RISCV_VCPU_STATEEN_CSR_FUNCS \
+{ .base = CSR_SENVCFG,    .count = 1, .func = kvm_riscv_vcpu_hstateen_enable_senvcfg }, \
+{ .base = CSR_SSTATEEN0,  .count = 1, .func = kvm_riscv_vcpu_hstateen_enable_stateen },\
+

total: 1 errors, 0 warnings, 0 checks, 37 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 d506bfa484f0 ("RISC-V: KVM: Enable envcfg and sstateen bits lazily") 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.
ERROR: Macros with complex values should be enclosed in parentheses


@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 4: "[v2,4/5] RISC-V: KVM: Enable envcfg and sstateen bits lazily"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 66.57 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 4: "[v2,4/5] RISC-V: KVM: Enable envcfg and sstateen bits lazily"
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 4: "[v2,4/5] RISC-V: KVM: Enable envcfg and sstateen bits lazily"
kdoc
Desc: Detects for kdoc errors
Duration: 0.88 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 4: "[v2,4/5] RISC-V: KVM: Enable envcfg and sstateen bits lazily"
module-param
Desc: Detect module_param changes
Duration: 0.25 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 4: "[v2,4/5] RISC-V: KVM: Enable envcfg and sstateen bits lazily"
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: "[v2,4/5] RISC-V: KVM: Enable envcfg and sstateen bits lazily"
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 5: "[v2,5/5] RISC-V: KVM: Remove the boot time enabling of hstateen bits"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 103.93 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 5: "[v2,5/5] RISC-V: KVM: Remove the boot time enabling of hstateen bits"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 910.76 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 5: "[v2,5/5] RISC-V: KVM: Remove the boot time enabling of hstateen bits"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1181.62 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 5: "[v2,5/5] RISC-V: KVM: Remove the boot time enabling of hstateen bits"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 20.80 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 5: "[v2,5/5] RISC-V: KVM: Remove the boot time enabling of hstateen bits"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 21.73 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 5: "[v2,5/5] RISC-V: KVM: Remove the boot time enabling of hstateen bits"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 0.63 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 5: "[v2,5/5] RISC-V: KVM: Remove the boot time enabling of hstateen bits"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 66.70 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 5: "[v2,5/5] RISC-V: KVM: Remove the boot time enabling of hstateen bits"
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 5: "[v2,5/5] RISC-V: KVM: Remove the boot time enabling of hstateen bits"
kdoc
Desc: Detects for kdoc errors
Duration: 0.88 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 5: "[v2,5/5] RISC-V: KVM: Remove the boot time enabling of hstateen bits"
module-param
Desc: Detect module_param changes
Duration: 0.26 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 5: "[v2,5/5] RISC-V: KVM: Remove the boot time enabling of hstateen bits"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.23 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 5: "[v2,5/5] RISC-V: KVM: Remove the boot time enabling of hstateen bits"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.31 seconds
Result: PASS

@linux-riscv-bot linux-riscv-bot deleted the pw965558 branch May 30, 2025 01:04
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