From: Charlie Jenkins via B4 Relay <devnull+thecharlesjenkins.gmail.com@kernel.org>
To: opensbi@lists.infradead.org
Cc: weidongwd <weidong.wd@bytedance.com>,
Charlie Jenkins <thecharlesjenkins@gmail.com>
Subject: [PATCH] lib: sbi: Use SBI_SSE_EVENT_LOCAL_UNKNOWN_NMI with unknown interrupts
Date: Tue, 17 Feb 2026 18:26:52 -0800 [thread overview]
Message-ID: <20260217-nmi-v1-1-eb4b4b3ad70e@gmail.com> (raw)
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
next reply other threads:[~2026-02-18 2:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-18 2:26 Charlie Jenkins via B4 Relay [this message]
2026-02-19 6:53 ` [PATCH] lib: sbi: Use SBI_SSE_EVENT_LOCAL_UNKNOWN_NMI with unknown interrupts Himanshu Chauhan
2026-02-26 0:37 ` Charlie Jenkins
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260217-nmi-v1-1-eb4b4b3ad70e@gmail.com \
--to=devnull+thecharlesjenkins.gmail.com@kernel.org \
--cc=opensbi@lists.infradead.org \
--cc=thecharlesjenkins@gmail.com \
--cc=weidong.wd@bytedance.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox