Possiable memory conflict with fdt memory region

Fangsuo Wu tiger20081015 at gmail.com
Mon Dec 27 12:10:56 CET 2021

Hi,  in image_setup_linux(),
stage 1: Boot_fdt_add_mem_rsv_regions() is called first to add the mem
reserve regions which prevents u-boot from using them to store the
initrd or the fdt blob;
stage 2: Then boot_relocate_fdt() is called to reserve or alloc fdt
blob from the avaiable lmb region.

But it seems  at stage 1 it doesn't cover up all mem reserve regions.
For example, if CMD_PSTORE is configured,  fdt_fixup_pstore(blob) will
add pstore to reserved-memory node in fdt in image_setup_libfdt()
after stage 2 , which may conflict with fdt memory region and can't be
detected since fdt_fixup_pstore doesn't call lmb_reserve(lmb, pstrore
addr, pstore len).

In image_setup_libfdt, there are also other functions like
ft_board_setup which may change existing reserved memory node's size
and lead to the same issue.

Do you think  a common function is needed before
boot_fdt_add_mem_rsv_regions() in stage 1? The function can be used to
fix-up or add new reserved memory nodes. Thanks.

More information about the U-Boot mailing list