On Mon, Jul 13, 2026 at 6:34 AM Inochi Amaoto <[email protected]> wrote: > > The extension Zicfiss/Zicfilp introduces a software-check exception > to the privilege architecture. Delegate this exception to VS mode > when vCPU enable Zicfiss/Zicfilp so the CFI violations in VU/VS could > be reported.
The patch6 must be squashed into this patch. Regards, Anup > > Assisted-by: YuanSheng:claude-4.7-opus > Co-developed-by: Quan Zhou <[email protected]> > Signed-off-by: Quan Zhou <[email protected]> > Signed-off-by: Inochi Amaoto <[email protected]> > --- > arch/riscv/include/asm/csr.h | 1 + > arch/riscv/kvm/vcpu_exit.c | 4 ++++ > 2 files changed, 5 insertions(+) > > diff --git a/arch/riscv/include/asm/csr.h b/arch/riscv/include/asm/csr.h > index 31b8988f4488..224af9facf1f 100644 > --- a/arch/riscv/include/asm/csr.h > +++ b/arch/riscv/include/asm/csr.h > @@ -117,6 +117,7 @@ > #define EXC_INST_PAGE_FAULT 12 > #define EXC_LOAD_PAGE_FAULT 13 > #define EXC_STORE_PAGE_FAULT 15 > +#define EXC_SOFTWARE_CHECK 18 > #define EXC_INST_GUEST_PAGE_FAULT 20 > #define EXC_LOAD_GUEST_PAGE_FAULT 21 > #define EXC_VIRTUAL_INST_FAULT 22 > diff --git a/arch/riscv/kvm/vcpu_exit.c b/arch/riscv/kvm/vcpu_exit.c > index 0bb0c51e3c89..12eebeabdf14 100644 > --- a/arch/riscv/kvm/vcpu_exit.c > +++ b/arch/riscv/kvm/vcpu_exit.c > @@ -243,6 +243,10 @@ int kvm_riscv_vcpu_exit(struct kvm_vcpu *vcpu, struct > kvm_run *run, > run->exit_reason = KVM_EXIT_DEBUG; > ret = 0; > break; > + case EXC_SOFTWARE_CHECK: > + if (vcpu->arch.cfg.henvcfg & (ENVCFG_LPE | ENVCFG_SSE)) > + ret = vcpu_redirect(vcpu, trap); > + break; > default: > break; > } > -- > 2.55.0 >

