diff options
| author | Samuel Holland <[email protected]> | 2025-09-07 22:56:38 -0700 |
|---|---|---|
| committer | Anup Patel <[email protected]> | 2025-09-16 10:03:53 +0530 |
| commit | 55135abcd555b72ca4edf481461fb37acd27e9cc (patch) | |
| tree | fcd8c0e6a23a1918c2a2199daac9505a6920a34c | |
| parent | cb70dffa0a726b68e9e84c52c07ad174f7ddac86 (diff) | |
lib: sbi_hsm: Save mideleg across non-retentive suspend
OpenSBI updates mideleg when registering or unregistering the PMU SSE
event. The updated CSR value must be saved across non-retentive suspend,
or PMU SSE events will not be delivered after the hart is resumed.
Fixes: b31a0a24279d ("lib: sbi: pmu: Add SSE register/unregister() callbacks")
Signed-off-by: Samuel Holland <[email protected]>
Reviewed-by: Anup Patel <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Anup Patel <[email protected]>
| -rw-r--r-- | lib/sbi/sbi_hsm.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/sbi/sbi_hsm.c b/lib/sbi/sbi_hsm.c index 557ab131..8ec94d2b 100644 --- a/lib/sbi/sbi_hsm.c +++ b/lib/sbi/sbi_hsm.c @@ -47,6 +47,7 @@ struct sbi_hsm_data { unsigned long saved_mie; unsigned long saved_mip; unsigned long saved_medeleg; + unsigned long saved_mideleg; unsigned long saved_menvcfg; #if __riscv_xlen == 32 unsigned long saved_menvcfgh; @@ -429,6 +430,7 @@ void __sbi_hsm_suspend_non_ret_save(struct sbi_scratch *scratch) hdata->saved_mie = csr_read(CSR_MIE); hdata->saved_mip = csr_read(CSR_MIP) & (MIP_SSIP | MIP_STIP); hdata->saved_medeleg = csr_read(CSR_MEDELEG); + hdata->saved_mideleg = csr_read(CSR_MIDELEG); if (sbi_hart_priv_version(scratch) >= SBI_HART_PRIV_VER_1_12) { #if __riscv_xlen == 32 hdata->saved_menvcfgh = csr_read(CSR_MENVCFGH); @@ -448,6 +450,7 @@ static void __sbi_hsm_suspend_non_ret_restore(struct sbi_scratch *scratch) csr_write(CSR_MENVCFGH, hdata->saved_menvcfgh); #endif } + csr_write(CSR_MIDELEG, hdata->saved_mideleg); csr_write(CSR_MEDELEG, hdata->saved_medeleg); csr_write(CSR_MIE, hdata->saved_mie); csr_set(CSR_MIP, (hdata->saved_mip & (MIP_SSIP | MIP_STIP))); |
