[PATCH v3 6/8] RISC-V: KVM: Delegate SPELP bit to VS/VU mode if landing pad is enabled.
From: Inochi Amaoto
Date: Sun Jun 07 2026 - 04:16:56 EST
Delegate the newly added SPELP bit from Zicfilp extension to VS/VU mode
if it enables landing pad support.
Signed-off-by: Inochi Amaoto <inochiama@xxxxxxxxx>
---
arch/riscv/kvm/vcpu_exit.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/arch/riscv/kvm/vcpu_exit.c b/arch/riscv/kvm/vcpu_exit.c
index 12eebeabdf14..61305da5256d 100644
--- a/arch/riscv/kvm/vcpu_exit.c
+++ b/arch/riscv/kvm/vcpu_exit.c
@@ -154,6 +154,12 @@ void kvm_riscv_vcpu_trap_redirect(struct kvm_vcpu *vcpu,
/* Clear Guest SSTATUS.SIE bit */
vsstatus &= ~SR_SIE;
+ /* Change Guest SSTATUS.SPELP bit */
+ if (vcpu->arch.cfg.henvcfg & ENVCFG_LPE) {
+ vsstatus &= ~SR_SPELP;
+ vsstatus |= vcpu->arch.guest_context.sstatus & SR_SPELP;
+ }
+
/* Update Guest SSTATUS */
ncsr_write(CSR_VSSTATUS, vsstatus);
--
2.54.0