
Hi Fangsuo,
On Mon, 27 Dec 2021 at 09:31, Fangsuo Wu tiger20081015@gmail.com wrote:
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.
+Tom Rini
Possibly. I am not an expert on this, but perhaps send a patch?
Regards, Simon