[PATCH v2 0/2] lib: sbi: Fix stale trap_context/prev_context linking

Anup Patel anup at brainfault.org
Tue Oct 27 00:58:19 PDT 2026


On Mon, Sep 14, 2026 at 2:09 PM Nia Su <nia.su at sifive.com> wrote:
>
> Patch 1 clears scratch->trap_context on warm boot, since
> non-retentive suspend/resume jumps straight there without restoring
> it, leaving a stale pointer misused as the next trap's prev_context.
>
> Patch 2 fixes sbi_trap_rnmi_handler() to link prev_context on entry
> and restore it on exit, the same way sbi_trap_handler() does.
>
> Signed-off-by: Nia Su <nia.su at sifive.com>
> ---
> Changes in v2:
> - Patch 1: trimmed the commit message, added a Fixes tag.
> - Added Reviewed-by from Evgeny Voevodin.
> - Link to v1: https://lore.kernel.org/r/20260904-trap-context-fix-v1-0-6bf7fa45d5f1@sifive.com
>
> ---
> Nia Su (2):
>       firmware: Clear scratch->trap_context on warm boot
>       lib: sbi: Fix stale prev_context in RNMI handler

LGTM.

Reviewed-by: Anup Patel <anup at brainfault.org>

Applied this series to the riscv/opensbi repo.

Thanks,
Anup



More information about the opensbi mailing list