[PATCH 2/3] lib: sbi_hart: Do not call delegate_traps() in the resume flow
Anup Patel
anup at brainfault.org
Mon Sep 15 21:41:09 PDT 2025
On Mon, Sep 8, 2025 at 11:26 AM Samuel Holland
<samuel.holland at sifive.com> wrote:
>
> The only purpose of this function is to program the initial values of
> mideleg and medeleg. However, both of these CSRs are now saved/restored
> across non-retentive suspend, so the values from this function are
> always overwritten by the restored values.
>
> Signed-off-by: Samuel Holland <samuel.holland at sifive.com>
LGTM.
Reviewed-by: Anup Patel <anup at brainfault.org>
Applied this patch to the riscv/opensbi repo.
Thanks,
Anup
> ---
>
> lib/sbi/sbi_hart.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/lib/sbi/sbi_hart.c b/lib/sbi/sbi_hart.c
> index 6a2d7d6f..1b50f671 100644
> --- a/lib/sbi/sbi_hart.c
> +++ b/lib/sbi/sbi_hart.c
> @@ -1037,10 +1037,6 @@ int sbi_hart_reinit(struct sbi_scratch *scratch)
> if (rc)
> return rc;
>
> - rc = delegate_traps(scratch);
> - if (rc)
> - return rc;
> -
> return 0;
> }
>
> @@ -1068,6 +1064,10 @@ int sbi_hart_init(struct sbi_scratch *scratch, bool cold_boot)
> if (rc)
> return rc;
>
> + rc = delegate_traps(scratch);
> + if (rc)
> + return rc;
> +
> return sbi_hart_reinit(scratch);
> }
>
> --
> 2.47.2
>
> base-commit: 153cdeea5350837c1206a2d2b6189fd0ba06d1f2
> branch: up/mideleg-fix
>
> --
> opensbi mailing list
> opensbi at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/opensbi
More information about the opensbi
mailing list