From f04ae48263533503a0432e6a7ba31cc20518c310 Mon Sep 17 00:00:00 2001 From: Samuel Holland Date: Sun, 7 Sep 2025 22:56:39 -0700 Subject: [PATCH] lib: sbi_hart: Do not call delegate_traps() in the resume flow 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 Reviewed-by: Anup Patel Link: https://lore.kernel.org/r/20250908055646.2391370-2-samuel.holland@sifive.com Signed-off-by: Anup Patel --- 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); }