[PATCH 0/2] lib: sbi: Fix Smrnmi/RNMI trap handling issues
Nia Su
nia.su at sifive.com
Thu Aug 27 23:09:30 PDT 2026
This series fixes two issues in the Smrnmi extension and RNMI trap
handling code:
Patch 1 moves the Smrnmi CSR setup into a dedicated
sbi_smrnmi_hart_init() helper so it also runs on the non-retentive
suspend resume path (sbi_hart_reinit()), and relaxes
smrnmi_handlers_init to allow a NULL callback and to report failure
via an int return value instead of void.
Patch 2 fixes sbi_trap_rnmi_handler(), which never updates
prev_context and can inherit a stale value from an earlier trap
that reused the same M-mode exception-stack slot. This can make
sbi_trap_error() loop indefinitely instead of printing diagnostics.
The fix maintains the trap-context pointer the same way
sbi_trap_handler() does, so nested contexts always link correctly.
Signed-off-by: Nia Su <nia.su at sifive.com>
---
Nia Su (1):
lib: sbi: Fix stale prev_context in RNMI handler
Nylon Chen (1):
lib: sbi: Fix Smrnmi init and non-retentive suspend handling
include/sbi/sbi_hart.h | 1 +
include/sbi/sbi_platform.h | 2 +-
lib/sbi/sbi_hart.c | 55 +++++++++++++++++++++++++++++-----------------
lib/sbi/sbi_trap.c | 10 +++++++--
4 files changed, 45 insertions(+), 23 deletions(-)
---
base-commit: 4e79fd7de59f1b2899092c1a84ce68c8ebc68f93
change-id: 20260826-rnmi-trap-fixes-91347b53b0dd
--
More information about the opensbi
mailing list