summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Jones <[email protected]>2023-02-27 11:30:59 +0100
committerAnup Patel <[email protected]>2023-02-27 19:38:00 +0530
commitb1ae6ef33ba92fe7d85edd87656998330637ed7e (patch)
tree9675d2a5085dd5e9aada41d60f4d355086a7b98b
parentc88e039ec23c41ad0769c6714f60904f89fa3a5d (diff)
lib: sbi_hsm: Move misplaced comment
While non-retentive suspend is not allowed for M-mode, the comment at the top of sbi_hsm_hart_suspend() implied suspend wasn't allowed for M-mode at all. Move the comment above the mode check which is inside a suspend type is non-retentive check. Signed-off-by: Andrew Jones <[email protected]> Reviewed-by: Anup Patel <[email protected]>
-rw-r--r--lib/sbi/sbi_hsm.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/sbi/sbi_hsm.c b/lib/sbi/sbi_hsm.c
index 3455520b..294156a9 100644
--- a/lib/sbi/sbi_hsm.c
+++ b/lib/sbi/sbi_hsm.c
@@ -398,8 +398,6 @@ int sbi_hsm_hart_suspend(struct sbi_scratch *scratch, u32 suspend_type,
struct sbi_hsm_data *hdata = sbi_scratch_offset_ptr(scratch,
hart_data_offset);
- /* For now, we only allow suspend from S-mode or U-mode. */
-
/* Sanity check on domain assigned to current HART */
if (!dom)
return SBI_EFAIL;
@@ -414,6 +412,10 @@ int sbi_hsm_hart_suspend(struct sbi_scratch *scratch, u32 suspend_type,
/* Additional sanity check for non-retentive suspend */
if (suspend_type & SBI_HSM_SUSP_NON_RET_BIT) {
+ /*
+ * For now, we only allow non-retentive suspend from
+ * S-mode or U-mode.
+ */
if (rmode != PRV_S && rmode != PRV_U)
return SBI_EFAIL;
if (dom && !sbi_domain_check_addr(dom, raddr, rmode,