* [PATCH] lib: sbi: Use SBI_SSE_EVENT_LOCAL_UNKNOWN_NMI with unknown interrupts
@ 2026-02-18 2:26 Charlie Jenkins via B4 Relay
2026-02-19 6:53 ` Himanshu Chauhan
0 siblings, 1 reply; 3+ messages in thread
From: Charlie Jenkins via B4 Relay @ 2026-02-18 2:26 UTC (permalink / raw)
To: opensbi; +Cc: weidongwd, Charlie Jenkins
From: Charlie Jenkins <thecharlesjenkins@gmail.com>
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.
Signed-off-by: Charlie Jenkins <thecharlesjenkins@gmail.com>
---
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/20251014055330.59506-1-weidong.wd@bytedance.com/
[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(+)
diff --git a/include/sbi/riscv_encoding.h b/include/sbi/riscv_encoding.h
index b5a4ce81..1c634a45 100644
--- a/include/sbi/riscv_encoding.h
+++ b/include/sbi/riscv_encoding.h
@@ -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
diff --git a/lib/sbi/sbi_trap.c b/lib/sbi/sbi_trap.c
index f41db4d1..f6576bd9 100644
--- a/lib/sbi/sbi_trap.c
+++ b/lib/sbi/sbi_trap.c
@@ -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
--
opensbi mailing list
opensbi@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] lib: sbi: Use SBI_SSE_EVENT_LOCAL_UNKNOWN_NMI with unknown interrupts
2026-02-18 2:26 [PATCH] lib: sbi: Use SBI_SSE_EVENT_LOCAL_UNKNOWN_NMI with unknown interrupts Charlie Jenkins via B4 Relay
@ 2026-02-19 6:53 ` Himanshu Chauhan
2026-02-26 0:37 ` Charlie Jenkins
0 siblings, 1 reply; 3+ messages in thread
From: Himanshu Chauhan @ 2026-02-19 6:53 UTC (permalink / raw)
To: thecharlesjenkins; +Cc: opensbi, weidongwd
Hi,
On Wed, Feb 18, 2026 at 7:58 AM Charlie Jenkins via B4 Relay
<devnull+thecharlesjenkins.gmail.com@kernel.org> wrote:
>
> From: Charlie Jenkins <thecharlesjenkins@gmail.com>
>
> 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_NMI if 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
--
opensbi mailing list
opensbi@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] lib: sbi: Use SBI_SSE_EVENT_LOCAL_UNKNOWN_NMI with unknown interrupts
2026-02-19 6:53 ` Himanshu Chauhan
@ 2026-02-26 0:37 ` Charlie Jenkins
0 siblings, 0 replies; 3+ messages in thread
From: Charlie Jenkins @ 2026-02-26 0:37 UTC (permalink / raw)
To: Himanshu Chauhan; +Cc: opensbi, weidongwd
On Thu, Feb 19, 2026 at 12:23:23PM +0530, Himanshu Chauhan wrote:
> Hi,
>
> On Wed, Feb 18, 2026 at 7:58 AM Charlie Jenkins via B4 Relay
> <devnull+thecharlesjenkins.gmail.com@kernel.org> wrote:
> >
> > From: Charlie Jenkins <thecharlesjenkins@gmail.com>
> >
> > 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_NMI if 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.
Yeah that was a misinformed interpretation, thank you for your feedback.
- Charlie
>
> Regards
> Himanshu
>
> --
> opensbi mailing list
> opensbi@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/opensbi
--
opensbi mailing list
opensbi@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-02-26 0:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-18 2:26 [PATCH] lib: sbi: Use SBI_SSE_EVENT_LOCAL_UNKNOWN_NMI with unknown interrupts Charlie Jenkins via B4 Relay
2026-02-19 6:53 ` Himanshu Chauhan
2026-02-26 0:37 ` Charlie Jenkins
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox