[PATCH v3] board_f.c: Insure gd->new_bootstage alignment

Simon Glass sjg at chromium.org
Tue Dec 17 16:46:29 CET 2019


Hi Patrice,

On Wed, 27 Nov 2019 at 02:11, Patrice Chotard <patrice.chotard at st.com> wrote:
>
> In reserve_bootstage(), in case size is odd, gd->new_bootstage
> is not aligned. In bootstage_relocate(), the platform hangs when
> getting access to data->record[i].name.
> To avoid this issue, make gd->new_bootstage 16 byte aligned.
>
> To insure that new_bootstage is 16 byte aligned (at least needed for
> x86_64 and ARMv8) and new_bootstage starts down to get enough space,
> ALIGN_DOWN macro is used.
>
> Fixes: ac9cd4805c8b ("bootstage: Correct relocation algorithm")
>
> Signed-off-by: Patrice Chotard <patrice.chotard at st.com>
> Reviewed-by: Vikas MANOCHA <vikas.manocha at st.com>
> Reviewed-by: Patrick Delaunay <patrick.delaunay at st.com>
> Tested-by: Patrick Delaunay <patrick.delaunay at st.com>

For this patch I think it would be better to update reserve_fdt() to
keep things aligned, assuming that is the problem.

At some point we should also document that reservations must keep
things aligned.

Perhaps this should be handled by a separate function called from all
these places, which subtracts gd->start_addr_sp and ensures 16-byte
alignment.

Regards,
Simon


More information about the U-Boot mailing list