[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260120080013.2153519-20-anup.patel@oss.qualcomm.com>
Date: Tue, 20 Jan 2026 13:30:05 +0530
From: Anup Patel <anup.patel@....qualcomm.com>
To: Paolo Bonzini <pbonzini@...hat.com>, Atish Patra <atish.patra@...ux.dev>
Cc: Palmer Dabbelt <palmer@...belt.com>, Paul Walmsley <pjw@...nel.org>,
Alexandre Ghiti <alex@...ti.fr>, Shuah Khan <shuah@...nel.org>,
Anup Patel <anup@...infault.org>,
Andrew Jones <andrew.jones@....qualcomm.com>,
kvm-riscv@...ts.infradead.org, kvm@...r.kernel.org,
linux-riscv@...ts.infradead.org, linux-kernel@...r.kernel.org,
linux-kselftest@...r.kernel.org,
Anup Patel <anup.patel@....qualcomm.com>
Subject: [PATCH 19/27] RISC-V: KVM: Redirect nested supervisor ecall and breakpoint traps
The supervisor ecall and breakpoint traps from Guest VS/VU-mode
(aka L2/nested guest) should be redirected to Guest HS-mode (aka
L1/guest hypervisor).
Signed-off-by: Anup Patel <anup.patel@....qualcomm.com>
---
arch/riscv/kvm/vcpu_exit.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/arch/riscv/kvm/vcpu_exit.c b/arch/riscv/kvm/vcpu_exit.c
index aeec4c4eee06..6627c2c25a71 100644
--- a/arch/riscv/kvm/vcpu_exit.c
+++ b/arch/riscv/kvm/vcpu_exit.c
@@ -274,12 +274,18 @@ int kvm_riscv_vcpu_exit(struct kvm_vcpu *vcpu, struct kvm_run *run,
ret = gstage_page_fault(vcpu, run, trap);
break;
case EXC_SUPERVISOR_SYSCALL:
- if (vcpu->arch.guest_context.hstatus & HSTATUS_SPV)
+ if (kvm_riscv_vcpu_nested_virt(vcpu))
+ ret = vcpu_redirect(vcpu, trap);
+ else if (vcpu->arch.guest_context.hstatus & HSTATUS_SPV)
ret = kvm_riscv_vcpu_sbi_ecall(vcpu, run);
break;
case EXC_BREAKPOINT:
- run->exit_reason = KVM_EXIT_DEBUG;
- ret = 0;
+ if (kvm_riscv_vcpu_nested_virt(vcpu)) {
+ ret = vcpu_redirect(vcpu, trap);
+ } else {
+ run->exit_reason = KVM_EXIT_DEBUG;
+ ret = 0;
+ }
break;
default:
break;
--
2.43.0
Powered by blists - more mailing lists