With LMB_LIMIT_DMA_BELOW_RAM_TOP, LMB reserves the memory above ram_top
itself, so reserving a reserved-memory region there fails with -EEXIST
and prints an error on every boot. A region that crosses ram_top fails
the same way and leaves its lower part unreserved.

For example, on the MediaTek Genio 520 EVK, ram_top is limited to 4 GiB
(MMC_MTK implies LMB_LIMIT_DMA_BELOW_RAM_TOP) and DRAM initialization
reserves a page at the top of the second rank, which is above 4 GiB:

  ERROR: reserving fdt memory region failed (addr=13ffff000 size=1000 flags=2): 
-17

Patch 1 skips the part above ram_top. Patch 2 adds a sandbox test, which
needs LMB_LIMIT_DMA_BELOW_RAM_TOP enabled on sandbox.

Signed-off-by: David Lechner <[email protected]>
---
David Lechner (2):
      boot: image-fdt: skip reserved memory above ram_top
      test: boot: image_fdt: test reservations above ram_top

 boot/image-fdt.c      | 21 +++++++++++++++
 lib/Kconfig           |  1 +
 test/boot/image_fdt.c | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 97 insertions(+)
---
base-commit: 03e0ee96b1cf21a20def03c079ca05427ebff208
base-tree: https://git.u-boot-project.org/u-boot/u-boot.git main
change-id: 20261013-image-fdt-above-ram-top-1ebc77f852df

Best regards,
--  
David Lechner <[email protected]>

Reply via email to