[PATCH] riscv: Add macros for software check and hardware error exception codes
Austin Kim
austindh.kim at gmail.com
Mon Jan 26 01:39:48 PST 2026
Hello,
2026년 1월 24일 (토) PM 4:57, Paul Walmsley <pjw at kernel.org>님이 작성:
>
> Hi Austin,
>
> On Thu, 22 Jan 2026, Austin Kim wrote:
>
> > The latest RISC-V Privileged specification defines new synchronous
> > exception codes in the scause register:
> >
> > 18: Software check
> > 19: Hardware error
> >
> > Link: https://docs.riscv.org/reference/isa/priv/supervisor.html
> > - 12.1.8. Supervisor Cause (scause) Register
> >
> > Add these macros for future use.
> >
> > Signed-off-by: Austin Kim <austindh.kim at gmail.com>
>
> Thanks for the patch. Though, maybe it makes more sense to add these
> along with code that uses them?
Thank you for the feedback.
Could you consider adding macro definitions for the upcoming exception codes?
These might be used later when trying to handle exceptions for
SOFTWARE_CHECK or HARDWARE_ERROR.
18 = integrity fault
19 = corrupt/poisoned memory
<From: https://lists.riscv.org/g/tech-privileged/topic/new_exception_cause_codes_for/100518912>
As for SOFTWARE_CHECK(18), Deepak Gupta is now developing patch-set
for the entire patch for
CFI with SOFTWARE_CHECK error, as below.
https://lkml.org/lkml/2025/6/4/979
And HARDWARE_ERROR(19) is intented for 'implementation defined'.
I guess the following switch~case is the right place to put
EXC_SOFTWARE_CHECK and
EXC_HARDWARE_ERROR.
arch/riscv/kvm/vcpu_exit.c
int kvm_riscv_vcpu_exit(struct kvm_vcpu *vcpu, struct kvm_run *run,
struct kvm_cpu_trap *trap)
{
[...]
case EXC_BREAKPOINT:
run->exit_reason = KVM_EXIT_DEBUG;
ret = 0;
break;
+ case EXC_SOFTWARE_CHECK:
+ case EXC_HARDWARE_ERROR:
+ /* Todo: This exception code is added at Privileged
ISA version 1.13,
+ further actions will follow */
+ break;
If code with the macro definition should be added, I will propose a
new version later
with these macro definition.
Thank you again.
BR,
Austin Kim
>
>
> - Paul
More information about the linux-riscv
mailing list