Skip to contentSkip to conversation

lib: sbi: Update system suspend to spec

PATCH New Andrew Jones 2 participants 2 messages Jul 20, 2023 – Jul 31, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib: sbi: Update system suspend to spec

commit 68e66106120f ("SUSP: Add SBI_ERR_DENIED") of the SBI spec adds a new error code, SBI_ERR_DENIED, which is returned when entry criteria has not be meant. Update the system suspend implementation to return this error when it has detected that not all harts are in the STOPPED state.

---
 lib/sbi/sbi_system.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/sbi/sbi_system.c +1 -1
index d803ffa84189..2e917c9e9130 100644
@@ -174,7 +174,7 @@ int sbi_system_suspend(u32 sleep_type, ulong resume_addr, ulong opaque)
 		if (i == hartid)
 			continue;
 		if (__sbi_hsm_hart_get_state(i) != SBI_HSM_STATE_STOPPED)
-			return SBI_EFAIL;
+			return SBI_ERR_DENIED;
 	}
 
 	if (!sbi_domain_check_addr(dom, resume_addr, prev_mode,
Signature · 1 line
2.41.0
Applied
#1 lore raw

PATCH 1/1 lib: sbi: Update system suspend to spec

Quoted 8 lines · On Thu, Jul 20, 2023 at 9:18?PM Andrew Jones <[email protected]> wrote:

commit 68e66106120f ("SUSP: Add SBI_ERR_DENIED") of the SBI spec adds a new error code, SBI_ERR_DENIED, which is returned when entry criteria has not be meant. Update the system suspend implementation to return this error when it has detected that not all harts are in the STOPPED state.

Looks good to me.

Applied this patch to the riscv/opensbi repo.

Thanks,
Anup

Quoted 20 lines
---
 lib/sbi/sbi_system.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/sbi/sbi_system.c +1 -2
index d803ffa84189..2e917c9e9130 100644
@@ -174,7 +174,7 @@ int sbi_system_suspend(u32 sleep_type, ulong resume_addr, ulong opaque)
                if (i == hartid)
                        continue;
                if (__sbi_hsm_hart_get_state(i) != SBI_HSM_STATE_STOPPED)
-                       return SBI_EFAIL;
+                       return SBI_ERR_DENIED;
        }
 
        if (!sbi_domain_check_addr(dom, resume_addr, prev_mode,
--

2.41.0