[PATCH 2/3] lib: sbi_hart: Do not call delegate_traps() in the resume flow
Samuel Holland
samuel.holland at sifive.com
Sun Sep 7 22:56:39 PDT 2025
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>
---
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
More information about the opensbi
mailing list