[PATCH] Revert "spl: Drop bd_info in the data section"

Simon Glass sjg at chromium.org
Fri Apr 9 01:55:48 CEST 2021


Hi Alexandru,

On Fri, 9 Apr 2021 at 04:56, Alexandru Gagniuc <mr.nuke.me at gmail.com> wrote:
>
> This reverts commit 38d6b7ebdaee3e0e8426ef1b9df88bdce8ae2e75.
>
> struct global_data contains a pointer to the bd_info structure. This
> pointer was populated spl_set_bd() to a pre-allocated bd_info in the
> ".data" section. The referenced commit replaced this mechanism to one
> that uses malloc(). That new mechanism is only used if SPL_ALLOC_BD=y.
> which very few boards do.
>
> The result is that (struct global_data)->bd is NULL in SPL on most
> platforms. This breaks falcon mode, since arch_fixup_fdt() tries to
> access (struct global_data)->bd and set the "/memory" node in the
> devicetree. The result is that the "/memory" node contains garbage
> values, causing linux to panic() as it sets up the page table.
>
> Instead of trying to fix the mess, potentially causing other issues,
> revert to the code that worked, while this change is reworked.

The goal here is to drop a feature that few boards use and reduce
memory usage in SPL. It has been in place for two releases now.

If Falcon mode needs it, perhaps you could add an 'imply' in the
Kconfig for that feature? Is there one? Or perhaps
CONFIG_ARCH_FIXUP_FDT_MEMORY ?

One option would be to return an error in arch_fixup_fdt(). In
general, fixups make things tricky because there is no way to
determine when they are used but at least this one has a CONFIG.

Regards,
Simon


>
> Signed-off-by: Alexandru Gagniuc <mr.nuke.me at gmail.com>
> ---
>  arch/arm/cpu/armv8/fsl-layerscape/spl.c |  5 +----
>  common/spl/Kconfig                      |  9 ---------
>  common/spl/spl.c                        | 20 ++++++++------------
>  include/spl.h                           | 10 +---------
>  4 files changed, 10 insertions(+), 34 deletions(-)
>


More information about the U-Boot mailing list