[PATCH] spl: bootstage: move bootstage_stash before jumping to image

Simon Glass sjg at chromium.org
Mon Aug 28 19:54:47 CEST 2023


Hi Chanho,

On Mon, 28 Aug 2023 at 03:46, Chanho Park <chanho61.park at samsung.com> wrote:
>
> For IH_OS_OPENSBI and IH_OS_LINUX, there is no chance to stash
> bootstare record because it will not return after jumping to the image.
> Hence, this patch moves the location of bootstage_stash before jumping
> to image.
>

Please fix your implementation instead. You must jump to the OS at the
end of this function and not before.

In fact I have a patch to move bootstage later in this function!

> Signed-off-by: Chanho Park <chanho61.park at samsung.com>
> ---
>  common/spl/spl.c | 15 ++++++++-------
>  1 file changed, 8 insertions(+), 7 deletions(-)
>
> diff --git a/common/spl/spl.c b/common/spl/spl.c
> index 0062f3f45d9a..364d439f65e2 100644
> --- a/common/spl/spl.c
> +++ b/common/spl/spl.c
> @@ -850,6 +850,14 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
>                                ret);
>         }
>
> +       bootstage_mark_name(get_bootstage_id(false), "end phase");
> +#ifdef CONFIG_BOOTSTAGE_STASH
> +       ret = bootstage_stash((void *)CONFIG_BOOTSTAGE_STASH_ADDR,
> +                             CONFIG_BOOTSTAGE_STASH_SIZE);
> +       if (ret)
> +               debug("Failed to stash bootstage: err=%d\n", ret);
> +#endif
> +
>         switch (spl_image.os) {
>         case IH_OS_U_BOOT:
>                 debug("Jumping to %s...\n", spl_phase_name(spl_next_phase()));
> @@ -890,13 +898,6 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
>         debug("SPL malloc() used 0x%lx bytes (%ld KB)\n", gd->malloc_ptr,
>               gd->malloc_ptr / 1024);
>  #endif
> -       bootstage_mark_name(get_bootstage_id(false), "end phase");
> -#ifdef CONFIG_BOOTSTAGE_STASH
> -       ret = bootstage_stash((void *)CONFIG_BOOTSTAGE_STASH_ADDR,
> -                             CONFIG_BOOTSTAGE_STASH_SIZE);
> -       if (ret)
> -               debug("Failed to stash bootstage: err=%d\n", ret);
> -#endif
>
>         if (IS_ENABLED(CONFIG_SPL_VIDEO_REMOVE)) {
>                 struct udevice *dev;
> --
> 2.39.2
>

Regards,
Simon


More information about the U-Boot mailing list