Kyösti Mälkki has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/32392 )
Change subject: src/Kconfig: increase heap size if using flattened image tree ......................................................................
Patch Set 3:
Patch Set 3:
Patch Set 3:
So it sounds like we need a way to tie in the Kconfig to this allocation (if possible). Have you looked into various options?
In the old days of bounce buffers and non-relocatable ramstage on x86, it would have been fragile for payload to access back to ramstage program. If I read the source correctly, ramstage heap became part of the hand-of-buffer with FIT payloads. Do we really want to allow that?
I think lib/device_tree.c and lib/fit_payload.c should malloc() from a completely separate heap.
I'm not up on the details of this sharing. Is the region just referenced or is it reused for its own malloc implementation?
NVM. After a second read, it appears the flattened devicetree is the handoff buffer, and it is located outside ramstage heap. So FIT payload does not reference back to ramstage heap.
Instead of attempting to adjust ARM memlayouts, might still be easier to have (unpacked) devicetree carved from any BM_MEM_RAM, it only has lifetime of fit_payload() and memory could be freed right after pack_fdt(), even before loading kernel and initrd.