diff mbox series

lib: sbi: skip wait_for_coldboot when coolboot done

Message ID 20231129135717.310197-1-wxjstz@126.com
State Changes Requested
Headers show
Series lib: sbi: skip wait_for_coldboot when coolboot done | expand

Commit Message

Xiang W Nov. 29, 2023, 1:57 p.m. UTC
When warmboot via HSM, coolboot has been completed and
wait_for_coldboot can be skipped to speed up.

Signed-off-by: Xiang W <wxjstz@126.com>
---
 lib/sbi/sbi_init.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Anup Patel Dec. 10, 2023, 6:19 a.m. UTC | #1
On Wed, Nov 29, 2023 at 7:27 PM Xiang W <wxjstz@126.com> wrote:
>
> When warmboot via HSM, coolboot has been completed and
> wait_for_coldboot can be skipped to speed up.
>
> Signed-off-by: Xiang W <wxjstz@126.com>
> ---
>  lib/sbi/sbi_init.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/lib/sbi/sbi_init.c b/lib/sbi/sbi_init.c
> index e723553..1f7f522 100644
> --- a/lib/sbi/sbi_init.c
> +++ b/lib/sbi/sbi_init.c
> @@ -492,7 +492,8 @@ static void __noreturn init_warmboot(struct sbi_scratch *scratch, u32 hartid)
>  {
>         int hstate;
>
> -       wait_for_coldboot(scratch, hartid);
> +       if (!__smp_load_acquire(&coldboot_done))
> +               wait_for_coldboot(scratch, hartid);

Better to have this check at the start of wait_for_coldboot()
implementation.

>
>         hstate = sbi_hsm_hart_get_state(sbi_domain_thishart_ptr(), hartid);
>         if (hstate < 0)
> --
> 2.42.0
>
>
> --
> opensbi mailing list
> opensbi@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/opensbi

Regards,
Anup
diff mbox series

Patch

diff --git a/lib/sbi/sbi_init.c b/lib/sbi/sbi_init.c
index e723553..1f7f522 100644
--- a/lib/sbi/sbi_init.c
+++ b/lib/sbi/sbi_init.c
@@ -492,7 +492,8 @@  static void __noreturn init_warmboot(struct sbi_scratch *scratch, u32 hartid)
 {
 	int hstate;
 
-	wait_for_coldboot(scratch, hartid);
+	if (!__smp_load_acquire(&coldboot_done))
+		wait_for_coldboot(scratch, hartid);
 
 	hstate = sbi_hsm_hart_get_state(sbi_domain_thishart_ptr(), hartid);
 	if (hstate < 0)