Re: [External] Re: [PATCH] RISC-V: KVM: Delegate illegal instruction fault
From: Xu Lu
Date: Sun Jun 22 2025 - 06:12:19 EST
Hi Radim,
On Fri, Jun 20, 2025 at 8:04 PM Radim Krčmář <rkrcmar@xxxxxxxxxxxxxxxx> wrote:
>
> 2025-06-20T17:17:20+08:00, Xu Lu <luxu.kernel@xxxxxxxxxxxxx>:
> > Delegate illegal instruction fault to VS mode in default to avoid such
> > exceptions being trapped to HS and redirected back to VS.
> >
> > Signed-off-by: Xu Lu <luxu.kernel@xxxxxxxxxxxxx>
> > ---
> > diff --git a/arch/riscv/include/asm/kvm_host.h b/arch/riscv/include/asm/kvm_host.h
> > @@ -48,6 +48,7 @@
> > + BIT(EXC_INST_ILLEGAL) | \
>
> You should also remove the dead code in kvm_riscv_vcpu_exit.
I only want to delegate it by default. And KVM may still want to
delegate different exceptions for different VMs like what it does for
EXC_BREAKPOINT. So maybe it is better to reserve these codes?
>
> And why not delegate the others as well?
> (EXC_LOAD_MISALIGNED, EXC_STORE_MISALIGNED, EXC_LOAD_ACCESS,
> EXC_STORE_ACCESS, and EXC_INST_ACCESS.)
Thanks for the reminder. I will have a test and resend the patch if it works.
>
> Thanks.
Best Regards,
Xu Lu