[U-Boot] [PATCH v4 2/3] spl: Remove overwrite of relocated malloc limit
André Przywara
andre.przywara at arm.com
Wed Feb 1 23:48:11 UTC 2017
On 27/01/17 16:39, Andrew F. Davis wrote:
Hi,
> spl_init on some boards is called after stack and heap relocation, on
> some platforms spl_relocate_stack_gd is called to handle setting the
> limit to its value CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN when simple
> SPL malloc is enabled during relocation. spl_init should then not
> re-assign the old pre-relocation limit when this is defined.
I am sorry to say this, but this very patch breaks SPL boot on sunxi
boards (tested on the Pine64, the Orangepi PC2 (with a similar ARMv8
SoC) and the OrangePi Zero (ARMv7 Allwinner H3 SoC).
U-Boot SPL 2017.03-rc1-00022-gf77309d (Feb 01 2017 - 23:27:19)
DRAM: 1024 MiB
Trying to boot from MMC1
MMC Device 0 not found
spl: could not find mmc device. error: -19
SPL: failed to boot from all boot devices
### ERROR ### Please RESET the board ###
sunxi boards both use the default CONFIG_SYS_MALLOC_F_LEN=0x400 and
CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x100000.
At the moment the code there is beyond me, so I can't really say how
this breaks, but it clearly does: reverting this patch makes U-Boot
happy again.
Any ideas?
Cheers,
Andre.
>
> Signed-off-by: Andrew F. Davis <afd at ti.com>
> ---
> common/spl/spl.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/common/spl/spl.c b/common/spl/spl.c
> index 462c3a2b97..a3808a988b 100644
> --- a/common/spl/spl.c
> +++ b/common/spl/spl.c
> @@ -183,7 +183,12 @@ int spl_init(void)
> int ret;
>
> debug("spl_init()\n");
> -#if defined(CONFIG_SYS_MALLOC_F_LEN)
> +/*
> + * with CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN we set malloc_base and
> + * malloc_limit in spl_relocate_stack_gd
> + */
> +#if defined(CONFIG_SYS_MALLOC_F_LEN) && \
> + !defined(CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN)
> #ifdef CONFIG_MALLOC_F_ADDR
> gd->malloc_base = CONFIG_MALLOC_F_ADDR;
> #endif
>
More information about the U-Boot
mailing list