lib: sbi: Use SBI_SSE_EVENT_LOCAL_UNKNOWN_NMI with unknown interrupts
PATCH 1/1 lib: sbi: Use SBI_SSE_EVENT_LOCAL_UNKNOWN_NMI with unknown interrupts
An mcause of 0 means "unknown cause" according to the riscv priviledged spec. When this occurs, the interrupt should be forwarded to S-mode software via SBI_SSE_EVENT_GLOBAL_UNKNOWN_NMI if SSE is enabled.
---
This patch builds off of [1] to trigger the UNKNOWN_NMI SSE call. That patch depends on the SBI spec patch [2].
[1] https://lore.kernel.org/opensbi/[email protected]/
[2] https://github.com/riscv-non-isa/riscv-sbi-doc/pull/223
--- include/sbi/riscv_encoding.h | 1 + lib/sbi/sbi_trap.c | 4 ++++ 2 files changed, 5 insertions(+)
include/sbi/riscv_encoding.h +1 -0
@@ -90,6 +90,7 @@#define MCAUSE_IRQ_MASK (_UL(1) << (__riscv_xlen - 1)) +#define IRQ_UNKNOWN 0#define IRQ_S_SOFT 1#define IRQ_VS_SOFT 2#define IRQ_M_SOFT 3
lib/sbi/sbi_trap.c +4 -0
@@ -234,6 +234,10 @@ int sbi_trap_redirect(struct sbi_trap_regs *regs,static int sbi_trap_nonaia_irq (unsigned long irq) {switch (irq) { +#if defined(CONFIG_SBI_ECALL_SSE ) +case IRQ_UNKNOWN : +return sbi_sse_inject_event (SBI_SSE_EVENT_LOCAL_UNKNOWN_NMI ); +#endif case IRQ_M_TIMER :sbi_timer_process ();break ;
---
base-commit: b27ecec76b8acfece9c28078d02cbc6bc762135c
change-id: 20260217-nmi-11064af8e897
- Charlie
Hi,
Quoted 7 lines · On Wed, Feb 18, 2026 at 7:58 AM Charlie Jenkins via B4 Relay…
From: Charlie Jenkins <[email protected]>
An mcause of 0 means "unknown cause" according to the riscv privileged spec. When this occurs, the interrupt should be forwarded to S-mode software via
SBI_SSE_EVENT_GLOBAL_UNKNOWN_NMIif SSE is enabled.
This is an incorrect interpretation of the spec. The specification has "reserved" the mcause exception code 0 of interrupts.
IMHO, a reserved interrupt, if occurs, shouldn't be forwarded to supervisor software.
Regards
Himanshu
Signature · 3 lines
opensbi mailing list [email protected] http://lists.infradead.org/mailman/listinfo/opensbi
Quoted 12 lines · Himanshu Chauhan
Hi,
Quoted 7 lines · On Wed, Feb 18, 2026 at 7:58 AM Charlie Jenkins via B4 Relay…
From: Charlie Jenkins <[email protected]>
An mcause of 0 means "unknown cause" according to the riscv privileged spec. When this occurs, the interrupt should be forwarded to S-mode software via
SBI_SSE_EVENT_GLOBAL_UNKNOWN_NMIif SSE is enabled.
Quoted 4 lines
This is an incorrect interpretation of the spec. The specification has "reserved" the mcause exception code 0 of interrupts.
IMHO, a reserved interrupt, if occurs, shouldn't be forwarded to supervisor software.
Yeah that was a misinformed interpretation, thank you for your feedback.
- Charlie
Quoted 8 lines
Regards
HimanshuSignature · 3 lines
opensbi mailing list [email protected] http://lists.infradead.org/mailman/listinfo/opensbi
Signature · 3 lines
opensbi mailing list [email protected] http://lists.infradead.org/mailman/listinfo/opensbi