[PATCH 0/6] memory: fuse overlapping memory banks

Ahmad Fatoum a.fatoum at pengutronix.de
Mon May 31 00:12:33 PDT 2021


The request region code makes sense to ensure drivers don't try to claim
(I/O) memory region claimed by another driver or by the memory
allocator. It doesn't make as much sense for registering available
memory banks, because there is often overlap:

 - device tree often defines the (minimally) available /memory across
   variants
 - subarchitectures like i.MX, STM32MP, OMAP or SAMA5 query the main
   RAM size from controller registers

So far, overlap went mostly unnoticed, because the RAM controller
drivers didn't check for errors. However, if barebox is already running
from RAM outside that described by the device tree, there will be errors
and /delete-node/ annotations that need to be added into device trees.

Upstream device tree can be extended later on with a /memory node, which
in turn will break barebox. This series fixes all of that. Overlapping
memory banks are combined into one. Errors are propagated everywhere.
/delete-node/ memory at X shouldn't be needed for new boards.

Ahmad Fatoum (6):
  common: memory: allocate all memory devices at once
  memory: fuse overlapping memory banks
  of: propagate errors inside barebox_register_{of,fdt} into initcalls
  of: warn about of_add_memory_bank errors
  ARM: <asm/memory.h>: propagate error codes from arm_add_mem_device()
  ARM: report probe error at arm_add_mem_device() callsites on failure

 arch/arm/boards/qemu-virt/board.c |  3 +-
 arch/arm/cpu/dtb.c                |  4 +-
 arch/arm/include/asm/memory.h     |  6 +--
 arch/arm/mach-at91/ddramc.c       |  4 +-
 arch/arm/mach-imx/esdctl.c        | 56 +++++++++++++--------------
 arch/arm/mach-omap/am33xx_scrm.c  |  4 +-
 arch/arm/mach-stm32mp/ddrctrl.c   |  4 +-
 arch/kvx/lib/dtb.c                |  4 +-
 arch/mips/boot/dtb.c              | 13 ++++---
 arch/openrisc/lib/dtb.c           |  4 +-
 arch/riscv/lib/dtb.c              |  5 ++-
 arch/sandbox/board/dtb.c          |  4 +-
 common/memory.c                   | 64 +++++++++++++++++++++++++++----
 common/resource.c                 | 22 +++++++++++
 drivers/of/base.c                 | 40 ++++++++++++-------
 drivers/of/mem_generic.c          |  5 ++-
 include/linux/ioport.h            | 20 ++++++++++
 include/memory.h                  |  1 -
 include/of.h                      |  6 +--
 19 files changed, 181 insertions(+), 88 deletions(-)

-- 
2.29.2




More information about the barebox mailing list