* [PATCH master 0/6] ARM: unify pbl and proper malloc area start
@ 2026-05-22 10:53 Ahmad Fatoum
2026-05-22 10:53 ` [PATCH master 1/6] arch: introduce new CONFIG_ARCH_HAS_MALLOC_SIZE Ahmad Fatoum
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: Ahmad Fatoum @ 2026-05-22 10:53 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
With the most recent changes to the PBL rockchip code, barebox gained an
additional very early malloc pool:
- very early on, it reserves some space at the end of RAM for extracting
compressed TF-A/OP-TEE blobs.
- a bit later, but still in PBL, it reserve some space directly under
the start of the barebox area at end of RAM as before.
- In barebox proper, it reserves a large malloc area that ends also
at the start of the barebox area at end of RAM.
Nothing allocated in these different pools needs to survive after the
next pool is instantiated, so reusing the memory is fine.
The new pool at the start causes a regression for Rockchip boards with
OP-TEE as the OP-TEE region overlapped that very early malloc area.
The clean resolution of this is if we could just use the same malloc
area used later in barebox proper in PBL, whether very early or just
before barebox proper decompression.
There's a problem though:
- The end of the malloc region is relative to barebox area, which means
we must know how big barebox is, which we can't very early on as it
contains handoff data not yet allocated and may not even be possible
at all if we have separate first and second stages
- The start of the malloc region is relative to the end of the malloc
region
This mess has been a fertile ground for bugs, so in interest of avoiding
more bugs in future, this series changes the calculation of the malloc
area on ARM:
- The end continues to be relative to the barebox area
- The start of the malloc area is relative to the end of the initial
memory without regard to the barebox area
For the common case of the malloc area being dynamic anyway, the malloc
area will change in size by few megabytes, which doesn't matter much.
For the uncommon case, CONFIG_MALLOC_OFFSET would need to be set
appropriately. The migration notes are extended to describe how to
determine the value.
An extra benefit is that CONFIG_MALLOC_OFFSET=0 becomes the default now
instead of CONFIG_MALLOC_SIZE=4M, which most boards were overriding
anyway.
A future change that can be built on top of this is saving handoff
_before_ the barebox executable on memory, not before it.
This could further simplify the code. This is not implemented here as
this is meant for master to fix the regression for Rockchip.
This passes the DistroKit pre-release tests and the Github Actions CI.
@Alexander, could you test on your OP-TEE enabled RK35xx?
Ahmad Fatoum (6):
arch: introduce new CONFIG_ARCH_HAS_MALLOC_SIZE
ARM: explicitly state CONFIG_MALLOC_SIZE in defconfigs
arch: introduce CONFIG_MALLOC_OFFSET
ARM: switch to CONFIG_MALLOC_OFFSET
ARM: configs: drop CONFIG_MALLOC_SIZE=0x0 as it's now the default
ARM: place PBL malloc area at start of barebox proper malloc area
arch/Kconfig | 20 +++++++++
arch/arm/Kconfig | 1 +
arch/arm/configs/am335x_mlo_defconfig | 1 -
.../arm/configs/am35xx_pfc200_xload_defconfig | 1 -
arch/arm/configs/animeo_ip_defconfig | 1 +
arch/arm/configs/at91_multi_defconfig | 1 -
arch/arm/configs/at91rm9200ek_defconfig | 1 +
arch/arm/configs/at91sam9260ek_defconfig | 1 +
.../configs/at91sam9261ek_bootstrap_defconfig | 1 +
arch/arm/configs/at91sam9261ek_defconfig | 1 +
arch/arm/configs/at91sam9g10ek_defconfig | 1 +
arch/arm/configs/at91sam9g20ek_defconfig | 1 +
arch/arm/configs/at91sam9m10g45ek_defconfig | 2 +-
arch/arm/configs/at91sam9m10ihd_defconfig | 2 +-
arch/arm/configs/at91sam9n12ek_defconfig | 2 +-
arch/arm/configs/clps711x_defconfig | 1 +
arch/arm/configs/dss11_defconfig | 1 +
arch/arm/configs/efi_v8_defconfig | 1 -
arch/arm/configs/haba_knx_lite_defconfig | 1 +
arch/arm/configs/imx23_defconfig | 1 -
arch/arm/configs/imx28_defconfig | 1 -
arch/arm/configs/imx_v7_defconfig | 1 -
arch/arm/configs/imx_v8_defconfig | 1 -
arch/arm/configs/k3-r5_defconfig | 1 -
arch/arm/configs/kindle-gen-6-7_defconfig | 1 -
arch/arm/configs/kindle-mx50_defconfig | 1 -
arch/arm/configs/layerscape_defconfig | 1 -
arch/arm/configs/layerscape_v7_defconfig | 1 -
arch/arm/configs/modules32_defconfig | 1 -
arch/arm/configs/multi_v5_v6_defconfig | 1 -
arch/arm/configs/multi_v7_defconfig | 1 -
arch/arm/configs/multi_v8_defconfig | 1 -
arch/arm/configs/mvebu_defconfig | 1 -
arch/arm/configs/omap_defconfig | 1 -
arch/arm/configs/pm9261_defconfig | 1 +
arch/arm/configs/pm9263_defconfig | 1 +
arch/arm/configs/pm9g45_defconfig | 1 +
arch/arm/configs/qil_a9260_defconfig | 1 +
arch/arm/configs/qil_a9g20_defconfig | 1 +
arch/arm/configs/rockchip_v7a_defconfig | 1 -
arch/arm/configs/rockchip_v8_defconfig | 1 -
arch/arm/configs/rpi_defconfig | 1 -
arch/arm/configs/rpi_v8a_defconfig | 3 +-
arch/arm/configs/socfpga-agilex5_defconfig | 1 -
arch/arm/configs/socfpga-arria10_defconfig | 1 -
arch/arm/configs/socfpga-xload_defconfig | 1 -
arch/arm/configs/socfpga_defconfig | 1 -
arch/arm/configs/stm32mp_defconfig | 1 -
arch/arm/configs/tegra_v7_defconfig | 1 -
arch/arm/configs/telit_evk_pro3_defconfig | 1 +
arch/arm/configs/tny_a9260_defconfig | 1 +
.../arm/configs/tny_a9263_bootstrap_defconfig | 1 +
arch/arm/configs/tny_a9263_defconfig | 1 +
arch/arm/configs/tny_a9g20_defconfig | 1 +
arch/arm/configs/usb_a9260_defconfig | 1 +
.../arm/configs/usb_a9263_bootstrap_defconfig | 1 +
arch/arm/configs/usb_a9263_defconfig | 1 +
arch/arm/configs/usb_a9g20_defconfig | 2 +-
arch/arm/configs/virt32_secure_defconfig | 1 -
arch/arm/configs/zii_vf610_dev_defconfig | 1 -
arch/arm/configs/zynq_defconfig | 2 +-
arch/arm/configs/zynqmp_defconfig | 1 -
arch/arm/cpu/common.c | 4 +-
arch/arm/cpu/start.c | 14 +------
arch/arm/cpu/uncompress.c | 2 +-
arch/arm/include/asm/barebox-arm.h | 6 ++-
arch/arm/mach-rockchip/atf.c | 2 +-
arch/mips/Kconfig | 1 +
arch/openrisc/Kconfig | 1 +
arch/powerpc/Kconfig | 1 +
arch/riscv/Kconfig | 1 +
arch/sandbox/Kconfig | 1 +
common/Kconfig | 41 ++++++++++++++++++-
include/asm-generic/memory_layout.h | 20 +++++++++
74 files changed, 123 insertions(+), 59 deletions(-)
--
2.47.3
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH master 1/6] arch: introduce new CONFIG_ARCH_HAS_MALLOC_SIZE
2026-05-22 10:53 [PATCH master 0/6] ARM: unify pbl and proper malloc area start Ahmad Fatoum
@ 2026-05-22 10:53 ` Ahmad Fatoum
2026-05-22 10:53 ` [PATCH master 2/6] ARM: explicitly state CONFIG_MALLOC_SIZE in defconfigs Ahmad Fatoum
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Ahmad Fatoum @ 2026-05-22 10:53 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
The new option is selected for all platforms, except for x86 and kvx as
these two platforms are the only ones that do not use MALLOC_SIZE:
- x86 (EFI payload): always allocates 16M as all bigger allocations
are serviced via calling into the UEFI firmware.
- kvx always initializes memory area from barebox_text_end to end of
memory described in DT
Note that CONFIG_MALLOC_SIZE is not hidden when ARCH_HAS_MALLOC_SIZE
is not selected. The reason for that is that CONFIG_MALLOC_SIZE is most
often 0 (malloc area is dynamically determined), but the Kconfig default
is 4M. This would lead to a breakage when bisecting for most boards:
- Board has CONFIG_MALLOC_SIZE=0
- Bisect jumps over commit removing ARCH_HAS_MALLOC_SIZE for an arch
- CONFIG_MALLOC_SIZE is set to default SZ_4M
This can easily happen, so we keep CONFIG_MALLOC_SIZE around even when
the symbol is unset at a value of 0 to cover the most common case.
For boards that actually set a non-zero value, special consideration
may need to be taken on bisect if the dynamic determination is not
sufficient.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
arch/Kconfig | 6 ++++++
arch/arm/Kconfig | 1 +
arch/mips/Kconfig | 1 +
arch/openrisc/Kconfig | 1 +
arch/powerpc/Kconfig | 1 +
arch/riscv/Kconfig | 1 +
arch/sandbox/Kconfig | 1 +
common/Kconfig | 5 +++--
8 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/arch/Kconfig b/arch/Kconfig
index 9f5673b5da31..23e65d58d52b 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -92,6 +92,12 @@ config ARCH_HAS_DATA_ABORT_MASK_PBL
config ARCH_HAS_ZERO_PAGE
bool
+config ARCH_HAS_MALLOC_SIZE
+ bool
+ help
+ This is selected by architectures, where CONFIG_MALLOC_SIZE
+ can be used to specify an exact size of the malloc area.
+
config HAVE_EFFICIENT_UNALIGNED_ACCESS
bool
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index c735a0dbfd5b..53bddd55e179 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -20,6 +20,7 @@ config ARM
select ARCH_HAS_DMA_WRITE_COMBINE
select HAVE_EFI_LOADER if MMU # for payload unaligned accesses
select PBL_IMAGE_ELF
+ select ARCH_HAS_MALLOC_SIZE
default y
config ARCH_LINUX_NAME
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index d34377a33d47..264815f34d06 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -14,6 +14,7 @@ config MIPS
select ARCH_HAS_SJLJ
select ELF
select HAVE_ARCH_BOOTM_OFTREE
+ select ARCH_HAS_MALLOC_SIZE
default y
config ARCH_LINUX_NAME
diff --git a/arch/openrisc/Kconfig b/arch/openrisc/Kconfig
index f82d160a3a15..c81be0aa8019 100644
--- a/arch/openrisc/Kconfig
+++ b/arch/openrisc/Kconfig
@@ -8,6 +8,7 @@ config OPENRISC
select GENERIC_FIND_NEXT_BIT
select ARCH_HAS_SJLJ
select HAS_DEBUG_LL
+ select ARCH_HAS_MALLOC_SIZE
default y
config ARCH_MKIMAGE_NAME
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 49050a26d524..d9c9f3583463 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -9,6 +9,7 @@ config PPC
select OFTREE
select HAVE_ARCH_BOOTM_OFTREE
select ARCH_HAS_SJLJ
+ select ARCH_HAS_MALLOC_SIZE
default y
config ARCH_LINUX_NAME
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index f1d98d1b33a5..3e5de8e0ec63 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -21,6 +21,7 @@ config RISCV
select PBL_IMAGE_ELF
select HAVE_ARCH_BOARD_GENERIC_DT
select HAVE_ARCH_BOOTM_OFTREE
+ select ARCH_HAS_MALLOC_SIZE
config ARCH_LINUX_NAME
string
diff --git a/arch/sandbox/Kconfig b/arch/sandbox/Kconfig
index 504171809193..07821738f27a 100644
--- a/arch/sandbox/Kconfig
+++ b/arch/sandbox/Kconfig
@@ -27,6 +27,7 @@ config SANDBOX
select HAVE_PBL_MULTI_IMAGES
select PBL_IMAGE_NO_PIGGY
select PBL_CLOCKSOURCE if COMPILE_TEST
+ select ARCH_HAS_MALLOC_SIZE
default y
config ARCH_LINUX_NAME
diff --git a/common/Kconfig b/common/Kconfig
index a91fc86929f2..5ba4530d3f9b 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -291,8 +291,9 @@ config STACK_SIZE
config MALLOC_SIZE
hex
- default 0x400000
- prompt "malloc area size"
+ default 0x400000 if ARCH_HAS_MALLOC_SIZE
+ default 0
+ prompt "malloc area size" if ARCH_HAS_MALLOC_SIZE
config SCRATCH_SIZE
hex
--
2.47.3
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH master 2/6] ARM: explicitly state CONFIG_MALLOC_SIZE in defconfigs
2026-05-22 10:53 [PATCH master 0/6] ARM: unify pbl and proper malloc area start Ahmad Fatoum
2026-05-22 10:53 ` [PATCH master 1/6] arch: introduce new CONFIG_ARCH_HAS_MALLOC_SIZE Ahmad Fatoum
@ 2026-05-22 10:53 ` Ahmad Fatoum
2026-05-22 10:53 ` [PATCH master 3/6] arch: introduce CONFIG_MALLOC_OFFSET Ahmad Fatoum
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Ahmad Fatoum @ 2026-05-22 10:53 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
CONFIG_MALLOC_SIZE is by default 4M, which works out for some older
boards (AT91 mostly), but is not a useful default nowadays, where we
have moved to make the CONFIG_MALLOC_SIZE=0x0 in most configs.
In preparation for switching to a new CONFIG_MALLOC_OFFSET, which makes
the malloc area dynamic by default, add CONFIG_MALLOC_OFFSET to all
configs that miss it, so we can migrate them in a later commit.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
arch/arm/configs/animeo_ip_defconfig | 1 +
arch/arm/configs/at91rm9200ek_defconfig | 1 +
arch/arm/configs/at91sam9260ek_defconfig | 1 +
arch/arm/configs/at91sam9261ek_bootstrap_defconfig | 1 +
arch/arm/configs/at91sam9261ek_defconfig | 1 +
arch/arm/configs/at91sam9g10ek_defconfig | 1 +
arch/arm/configs/at91sam9g20ek_defconfig | 1 +
arch/arm/configs/clps711x_defconfig | 1 +
arch/arm/configs/dss11_defconfig | 1 +
arch/arm/configs/haba_knx_lite_defconfig | 1 +
arch/arm/configs/pm9261_defconfig | 1 +
arch/arm/configs/pm9263_defconfig | 1 +
arch/arm/configs/pm9g45_defconfig | 1 +
arch/arm/configs/qil_a9260_defconfig | 1 +
arch/arm/configs/qil_a9g20_defconfig | 1 +
arch/arm/configs/telit_evk_pro3_defconfig | 1 +
arch/arm/configs/tny_a9260_defconfig | 1 +
arch/arm/configs/tny_a9263_bootstrap_defconfig | 1 +
arch/arm/configs/tny_a9263_defconfig | 1 +
arch/arm/configs/tny_a9g20_defconfig | 1 +
arch/arm/configs/usb_a9260_defconfig | 1 +
arch/arm/configs/usb_a9263_bootstrap_defconfig | 1 +
arch/arm/configs/usb_a9263_defconfig | 1 +
23 files changed, 23 insertions(+)
diff --git a/arch/arm/configs/animeo_ip_defconfig b/arch/arm/configs/animeo_ip_defconfig
index ed3540c20d5b..869e3912500f 100644
--- a/arch/arm/configs/animeo_ip_defconfig
+++ b/arch/arm/configs/animeo_ip_defconfig
@@ -8,6 +8,7 @@ CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
CONFIG_EXPERIMENTAL=y
CONFIG_MALLOC_TLSF=y
+CONFIG_MALLOC_SIZE=0x400000
CONFIG_PROMPT="Animeo-IP:"
CONFIG_BAUDRATE=38400
CONFIG_PROMPT_HUSH_PS2="y"
diff --git a/arch/arm/configs/at91rm9200ek_defconfig b/arch/arm/configs/at91rm9200ek_defconfig
index 8d7f38fe9111..03e98458a149 100644
--- a/arch/arm/configs/at91rm9200ek_defconfig
+++ b/arch/arm/configs/at91rm9200ek_defconfig
@@ -6,6 +6,7 @@ CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
CONFIG_EXPERIMENTAL=y
CONFIG_MALLOC_TLSF=y
+CONFIG_MALLOC_SIZE=0x400000
CONFIG_PROMPT="9200-EK:"
CONFIG_HUSH_FANCY_PROMPT=y
CONFIG_CMDLINE_EDITING=y
diff --git a/arch/arm/configs/at91sam9260ek_defconfig b/arch/arm/configs/at91sam9260ek_defconfig
index ad9d73d518fc..1b05225d9713 100644
--- a/arch/arm/configs/at91sam9260ek_defconfig
+++ b/arch/arm/configs/at91sam9260ek_defconfig
@@ -8,6 +8,7 @@ CONFIG_NAME="at91sam9260ek_defconfig"
CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
CONFIG_EXPERIMENTAL=y
+CONFIG_MALLOC_SIZE=0x400000
CONFIG_PROMPT="9260-EK:"
CONFIG_PROMPT_HUSH_PS2="y"
CONFIG_HUSH_FANCY_PROMPT=y
diff --git a/arch/arm/configs/at91sam9261ek_bootstrap_defconfig b/arch/arm/configs/at91sam9261ek_bootstrap_defconfig
index bf6fe8075c71..118021678a13 100644
--- a/arch/arm/configs/at91sam9261ek_bootstrap_defconfig
+++ b/arch/arm/configs/at91sam9261ek_bootstrap_defconfig
@@ -8,6 +8,7 @@ CONFIG_NAME="at91sam9261ek_bootstrap_defconfig"
CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x27000
CONFIG_MALLOC_DUMMY=y
+CONFIG_MALLOC_SIZE=0x400000
CONFIG_PROMPT="9261-EK:"
CONFIG_SHELL_NONE=y
# CONFIG_TIMESTAMP is not set
diff --git a/arch/arm/configs/at91sam9261ek_defconfig b/arch/arm/configs/at91sam9261ek_defconfig
index 66542e943003..560e4ae49e17 100644
--- a/arch/arm/configs/at91sam9261ek_defconfig
+++ b/arch/arm/configs/at91sam9261ek_defconfig
@@ -8,6 +8,7 @@ CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
CONFIG_EXPERIMENTAL=y
CONFIG_MALLOC_TLSF=y
+CONFIG_MALLOC_SIZE=0x400000
CONFIG_PROMPT="9261-EK:"
CONFIG_HUSH_FANCY_PROMPT=y
CONFIG_CMDLINE_EDITING=y
diff --git a/arch/arm/configs/at91sam9g10ek_defconfig b/arch/arm/configs/at91sam9g10ek_defconfig
index 6f66545885ca..a347f8704ae5 100644
--- a/arch/arm/configs/at91sam9g10ek_defconfig
+++ b/arch/arm/configs/at91sam9g10ek_defconfig
@@ -8,6 +8,7 @@ CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
CONFIG_EXPERIMENTAL=y
CONFIG_MALLOC_TLSF=y
+CONFIG_MALLOC_SIZE=0x400000
CONFIG_PROMPT="9G10-EK:"
CONFIG_HUSH_FANCY_PROMPT=y
CONFIG_CMDLINE_EDITING=y
diff --git a/arch/arm/configs/at91sam9g20ek_defconfig b/arch/arm/configs/at91sam9g20ek_defconfig
index 811326459bcd..c333cecfb482 100644
--- a/arch/arm/configs/at91sam9g20ek_defconfig
+++ b/arch/arm/configs/at91sam9g20ek_defconfig
@@ -8,6 +8,7 @@ CONFIG_NAME="at91sam9g20ek_defconfig"
CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
CONFIG_EXPERIMENTAL=y
+CONFIG_MALLOC_SIZE=0x400000
CONFIG_PROMPT="9G20-EK:"
CONFIG_PROMPT_HUSH_PS2="y"
CONFIG_HUSH_FANCY_PROMPT=y
diff --git a/arch/arm/configs/clps711x_defconfig b/arch/arm/configs/clps711x_defconfig
index 0fa34b5fc5d4..bfebf1cea65e 100644
--- a/arch/arm/configs/clps711x_defconfig
+++ b/arch/arm/configs/clps711x_defconfig
@@ -6,6 +6,7 @@ CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_NAME="clps711x_defconfig"
CONFIG_MMU=y
CONFIG_EXPERIMENTAL=y
+CONFIG_MALLOC_SIZE=0x400000
CONFIG_BAUDRATE=57600
CONFIG_CMDLINE_EDITING=y
CONFIG_AUTO_COMPLETE=y
diff --git a/arch/arm/configs/dss11_defconfig b/arch/arm/configs/dss11_defconfig
index c06a73414a67..6cef088e2422 100644
--- a/arch/arm/configs/dss11_defconfig
+++ b/arch/arm/configs/dss11_defconfig
@@ -4,6 +4,7 @@ CONFIG_MACH_DSS11=y
CONFIG_NAME="dss11_defconfig"
CONFIG_BOOT_ATAGS=y
CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16=y
+CONFIG_MALLOC_SIZE=0x400000
CONFIG_CMDLINE_EDITING=y
CONFIG_AUTO_COMPLETE=y
CONFIG_DEFAULT_ENVIRONMENT_GENERIC=y
diff --git a/arch/arm/configs/haba_knx_lite_defconfig b/arch/arm/configs/haba_knx_lite_defconfig
index 5d03c1ee6f33..e3f99d593278 100644
--- a/arch/arm/configs/haba_knx_lite_defconfig
+++ b/arch/arm/configs/haba_knx_lite_defconfig
@@ -10,6 +10,7 @@ CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
CONFIG_EXPERIMENTAL=y
CONFIG_MALLOC_TLSF=y
+CONFIG_MALLOC_SIZE=0x400000
CONFIG_PROMPT="HABA-KNX-LITE:"
CONFIG_PROMPT_HUSH_PS2="y"
CONFIG_HUSH_FANCY_PROMPT=y
diff --git a/arch/arm/configs/pm9261_defconfig b/arch/arm/configs/pm9261_defconfig
index eb86463f8288..d7c0e84298b2 100644
--- a/arch/arm/configs/pm9261_defconfig
+++ b/arch/arm/configs/pm9261_defconfig
@@ -4,6 +4,7 @@ CONFIG_MACH_PM9261=y
CONFIG_BOOT_ATAGS=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_NAME="pm9261_defconfig"
+CONFIG_MALLOC_SIZE=0x400000
CONFIG_PROMPT="PM9261:"
CONFIG_HUSH_FANCY_PROMPT=y
CONFIG_CMDLINE_EDITING=y
diff --git a/arch/arm/configs/pm9263_defconfig b/arch/arm/configs/pm9263_defconfig
index 776ef3d245fa..03365e84959c 100644
--- a/arch/arm/configs/pm9263_defconfig
+++ b/arch/arm/configs/pm9263_defconfig
@@ -3,6 +3,7 @@ CONFIG_ARCH_AT91SAM9263=y
CONFIG_BOOT_ATAGS=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_NAME="pm9263_defconfig"
+CONFIG_MALLOC_SIZE=0x400000
CONFIG_PROMPT_HUSH_PS2="y"
CONFIG_CMDLINE_EDITING=y
CONFIG_AUTO_COMPLETE=y
diff --git a/arch/arm/configs/pm9g45_defconfig b/arch/arm/configs/pm9g45_defconfig
index f7cdb8f1f693..30ac5da05f01 100644
--- a/arch/arm/configs/pm9g45_defconfig
+++ b/arch/arm/configs/pm9g45_defconfig
@@ -8,6 +8,7 @@ CONFIG_NAME="pm9g45_defconfig"
CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
CONFIG_MALLOC_TLSF=y
+CONFIG_MALLOC_SIZE=0x400000
CONFIG_GLOB_SORT=y
CONFIG_HUSH_FANCY_PROMPT=y
CONFIG_CMDLINE_EDITING=y
diff --git a/arch/arm/configs/qil_a9260_defconfig b/arch/arm/configs/qil_a9260_defconfig
index e58b168c4b35..0f2dfe247155 100644
--- a/arch/arm/configs/qil_a9260_defconfig
+++ b/arch/arm/configs/qil_a9260_defconfig
@@ -8,6 +8,7 @@ CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_NAME="qil_a9260_defconfig"
CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
+CONFIG_MALLOC_SIZE=0x400000
CONFIG_EXPERIMENTAL=y
CONFIG_PROMPT="USB-9G20:"
CONFIG_PROMPT_HUSH_PS2="y"
diff --git a/arch/arm/configs/qil_a9g20_defconfig b/arch/arm/configs/qil_a9g20_defconfig
index de8d21442446..32cbbad26ce4 100644
--- a/arch/arm/configs/qil_a9g20_defconfig
+++ b/arch/arm/configs/qil_a9g20_defconfig
@@ -8,6 +8,7 @@ CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_NAME="qil_a9g20_defconfig"
CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
+CONFIG_MALLOC_SIZE=0x400000
CONFIG_EXPERIMENTAL=y
CONFIG_PROMPT="USB-9G20:"
CONFIG_PROMPT_HUSH_PS2="y"
diff --git a/arch/arm/configs/telit_evk_pro3_defconfig b/arch/arm/configs/telit_evk_pro3_defconfig
index 07868c47ffa1..f5b7c488370c 100644
--- a/arch/arm/configs/telit_evk_pro3_defconfig
+++ b/arch/arm/configs/telit_evk_pro3_defconfig
@@ -8,6 +8,7 @@ CONFIG_NAME="telit_evk_pro3_defconfig"
CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
CONFIG_EXPERIMENTAL=y
+CONFIG_MALLOC_SIZE=0x400000
CONFIG_PROMPT="EVK-PRO3:"
CONFIG_PROMPT_HUSH_PS2="y"
CONFIG_HUSH_FANCY_PROMPT=y
diff --git a/arch/arm/configs/tny_a9260_defconfig b/arch/arm/configs/tny_a9260_defconfig
index adf200f256af..6335871c2cda 100644
--- a/arch/arm/configs/tny_a9260_defconfig
+++ b/arch/arm/configs/tny_a9260_defconfig
@@ -10,6 +10,7 @@ CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
CONFIG_EXPERIMENTAL=y
CONFIG_MALLOC_TLSF=y
+CONFIG_MALLOC_SIZE=0x400000
CONFIG_PROMPT="TNY-9260:"
CONFIG_PROMPT_HUSH_PS2="y"
CONFIG_HUSH_FANCY_PROMPT=y
diff --git a/arch/arm/configs/tny_a9263_bootstrap_defconfig b/arch/arm/configs/tny_a9263_bootstrap_defconfig
index 9c5f656ffa41..08d289927fc1 100644
--- a/arch/arm/configs/tny_a9263_bootstrap_defconfig
+++ b/arch/arm/configs/tny_a9263_bootstrap_defconfig
@@ -9,6 +9,7 @@ CONFIG_NAME="tny_a9263_bootstrap_defconfig"
CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x12000
CONFIG_MALLOC_DUMMY=y
+CONFIG_MALLOC_SIZE=0x400000
CONFIG_PROMPT="USB-9263:"
CONFIG_SHELL_NONE=y
CONFIG_CONSOLE_SIMPLE=y
diff --git a/arch/arm/configs/tny_a9263_defconfig b/arch/arm/configs/tny_a9263_defconfig
index 218f128f67b0..a4ab927ce2a3 100644
--- a/arch/arm/configs/tny_a9263_defconfig
+++ b/arch/arm/configs/tny_a9263_defconfig
@@ -10,6 +10,7 @@ CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
CONFIG_EXPERIMENTAL=y
CONFIG_MALLOC_TLSF=y
+CONFIG_MALLOC_SIZE=0x400000
CONFIG_PROMPT="TNY-9263:"
CONFIG_PROMPT_HUSH_PS2="y"
CONFIG_HUSH_FANCY_PROMPT=y
diff --git a/arch/arm/configs/tny_a9g20_defconfig b/arch/arm/configs/tny_a9g20_defconfig
index 0549b54731da..c470cb9ec946 100644
--- a/arch/arm/configs/tny_a9g20_defconfig
+++ b/arch/arm/configs/tny_a9g20_defconfig
@@ -10,6 +10,7 @@ CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
CONFIG_EXPERIMENTAL=y
CONFIG_MALLOC_TLSF=y
+CONFIG_MALLOC_SIZE=0x400000
CONFIG_PROMPT="TNY-9G20:"
CONFIG_PROMPT_HUSH_PS2="y"
CONFIG_HUSH_FANCY_PROMPT=y
diff --git a/arch/arm/configs/usb_a9260_defconfig b/arch/arm/configs/usb_a9260_defconfig
index c797b080554b..85f76f44ab48 100644
--- a/arch/arm/configs/usb_a9260_defconfig
+++ b/arch/arm/configs/usb_a9260_defconfig
@@ -9,6 +9,7 @@ CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
CONFIG_EXPERIMENTAL=y
CONFIG_MALLOC_TLSF=y
+CONFIG_MALLOC_SIZE=0x400000
CONFIG_PROMPT="USB-9G20:"
CONFIG_PROMPT_HUSH_PS2="y"
CONFIG_HUSH_FANCY_PROMPT=y
diff --git a/arch/arm/configs/usb_a9263_bootstrap_defconfig b/arch/arm/configs/usb_a9263_bootstrap_defconfig
index 007c7261d201..2b204e0ee4ff 100644
--- a/arch/arm/configs/usb_a9263_bootstrap_defconfig
+++ b/arch/arm/configs/usb_a9263_bootstrap_defconfig
@@ -10,6 +10,7 @@ CONFIG_NAME="usb_a9263_bootstrap_defconfig"
CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x12000
CONFIG_MALLOC_DUMMY=y
+CONFIG_MALLOC_SIZE=0x400000
CONFIG_PROMPT="USB-9263:"
CONFIG_SHELL_NONE=y
# CONFIG_SPI is not set
diff --git a/arch/arm/configs/usb_a9263_defconfig b/arch/arm/configs/usb_a9263_defconfig
index 1c228c61932d..287d590d066a 100644
--- a/arch/arm/configs/usb_a9263_defconfig
+++ b/arch/arm/configs/usb_a9263_defconfig
@@ -9,6 +9,7 @@ CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
CONFIG_EXPERIMENTAL=y
CONFIG_MALLOC_TLSF=y
+CONFIG_MALLOC_SIZE=0x400000
CONFIG_PROMPT="USB-9263:"
CONFIG_PROMPT_HUSH_PS2="y"
CONFIG_HUSH_FANCY_PROMPT=y
--
2.47.3
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH master 3/6] arch: introduce CONFIG_MALLOC_OFFSET
2026-05-22 10:53 [PATCH master 0/6] ARM: unify pbl and proper malloc area start Ahmad Fatoum
2026-05-22 10:53 ` [PATCH master 1/6] arch: introduce new CONFIG_ARCH_HAS_MALLOC_SIZE Ahmad Fatoum
2026-05-22 10:53 ` [PATCH master 2/6] ARM: explicitly state CONFIG_MALLOC_SIZE in defconfigs Ahmad Fatoum
@ 2026-05-22 10:53 ` Ahmad Fatoum
2026-05-22 10:53 ` [PATCH master 4/6] ARM: switch to CONFIG_MALLOC_OFFSET Ahmad Fatoum
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Ahmad Fatoum @ 2026-05-22 10:53 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
With barebox proper placed at end of RAM, the current CONFIG_MALLOC_SIZE
puts us into a tight spot: We must determine the size barebox proper
will occupy to subtract CONFIG_MALLOC_SIZE from it, but we may not know
the size yet in early stages of PBL, especially when we have separate
first and second stages.
This complexity in calculation is imposed onto all users, even though
most users probably don't make use of CONFIG_MALLOC_SIZE and set it to
zero anyway to let barebox compute a suitable malloc area size.
CONFIG_MALLOC_OFFSET simplifies calculation by starting the malloc area
at the specified offset from end of RAM.
Boards that used to set CONFIG_MALLOC_SIZE will need to set the new
CONFIG_MALLOC_OFFSET to their value of CONFIG_MALLOC_SIZE + the area
barebox occupies at end of initial memory.
For all other boards, they can just keep the default of
CONFIG_MALLOC_OFFSET=0 and barebox will start the malloc area at half of
RAM or 1G before end, which ever is smaller.
This computation is independent of barebox size and can thus be used in
early PBL as well in a later commit.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
arch/Kconfig | 14 +++++++++++
common/Kconfig | 36 +++++++++++++++++++++++++++++
include/asm-generic/memory_layout.h | 20 ++++++++++++++++
3 files changed, 70 insertions(+)
diff --git a/arch/Kconfig b/arch/Kconfig
index 23e65d58d52b..bb46839a2938 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -98,6 +98,20 @@ config ARCH_HAS_MALLOC_SIZE
This is selected by architectures, where CONFIG_MALLOC_SIZE
can be used to specify an exact size of the malloc area.
+ Eventually, this should only be selected by sandbox, with
+ everyone else switched over to ARCH_HAS_MALLOC_OFFSET.
+
+config ARCH_HAS_MALLOC_OFFSET
+ bool
+ help
+ This is selected by architectures, where CONFIG_MALLOC_OFFSET
+ can be used to specify the start offset of the malloc region
+ with respect to the end of the initial memory.
+
+ As this offset contains also the region reserved for barebox,
+ it greatly simplifies memory layout calculation and allows
+ to reserve the malloc region very early on.
+
config HAVE_EFFICIENT_UNALIGNED_ACCESS
bool
diff --git a/common/Kconfig b/common/Kconfig
index 5ba4530d3f9b..b957965125ae 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -295,6 +295,42 @@ config MALLOC_SIZE
default 0
prompt "malloc area size" if ARCH_HAS_MALLOC_SIZE
+config MALLOC_OFFSET
+ hex
+ default 0
+ prompt "relative malloc base offset (optional)"
+ depends on ARCH_HAS_MALLOC_OFFSET
+ help
+ Most boards should just leave this at the default zero and barebox
+ will dynamically determine the start of its eventual malloc area.
+ The currently employed heuristic is:
+
+ - if the prebootloader reports 2GiB of initial memory or more,
+ start the malloc area at offset 1GiB from initial memory end.
+
+ - otherwise, start the malloc area at middle of initial memory
+
+ The malloc area is used for dynamic allocations by barebox, e.g.
+ to uncompress a kernel. The placement of final boot artifacts happens
+ outside of the malloc area and is not restricted to the initial
+ memory reported by the prebootloader.
+
+ As this heuristic may not be suitable for devices with tight memory
+ constraints, setting a non-zero value here allows customizing the
+ offset used to start the malloc area.
+
+ The MALLOC_OFFSET is calculated from end of initial memory to start
+ of the malloc area and as such, it also contains the region allocated
+ for barebox itself. This inclusion of the barebox area differentiates
+ this option from non-zero CONFIG_MALLOC_SIZE, but in return allows
+ barebox to compute the start of the malloc area very early before it
+ can know how much space barebox proper will eventually occupy.
+
+ The iomem command can be used to determine at runtime how much space
+ barebox requires for itself.
+
+ If unsure, keep the default of 0x0.
+
config SCRATCH_SIZE
hex
default 0x8000
diff --git a/include/asm-generic/memory_layout.h b/include/asm-generic/memory_layout.h
index b5a0306975be..2c6daf9cb2c7 100644
--- a/include/asm-generic/memory_layout.h
+++ b/include/asm-generic/memory_layout.h
@@ -33,6 +33,11 @@
#define STACK_SIZE CONFIG_STACK_SIZE
#define SCRATCH_SIZE CONFIG_SCRATCH_SIZE
+#ifndef __ASSEMBLY__
+
+#include <linux/minmax.h>
+#include <linux/sizes.h>
+
/*
* This generates a useless load from the specified symbol
* to ensure linker garbage collection doesn't delete it
@@ -40,4 +45,19 @@
#define __keep_symbolref(sym) \
__asm__ __volatile__("": :"r"(&sym) :)
+#ifdef CONFIG_MALLOC_OFFSET
+static inline unsigned long barebox_malloc_base(unsigned long membase,
+ unsigned long memsize)
+ {
+ unsigned long offset = CONFIG_MALLOC_OFFSET;
+
+ if (!offset)
+ offset = min_t(unsigned long, memsize / 2, SZ_1G);
+
+ return max_t(unsigned long, membase + memsize - offset, membase);
+}
+#endif
+
+#endif /* __ASSEMBLY__ */
+
#endif /* __ASM_GENERIC_MEMORY_LAYOUT_H */
--
2.47.3
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH master 4/6] ARM: switch to CONFIG_MALLOC_OFFSET
2026-05-22 10:53 [PATCH master 0/6] ARM: unify pbl and proper malloc area start Ahmad Fatoum
` (2 preceding siblings ...)
2026-05-22 10:53 ` [PATCH master 3/6] arch: introduce CONFIG_MALLOC_OFFSET Ahmad Fatoum
@ 2026-05-22 10:53 ` Ahmad Fatoum
2026-05-22 10:53 ` [PATCH master 5/6] ARM: configs: drop CONFIG_MALLOC_SIZE=0x0 as it's now the default Ahmad Fatoum
2026-05-22 10:53 ` [PATCH master 6/6] ARM: place PBL malloc area at start of barebox proper malloc area Ahmad Fatoum
5 siblings, 0 replies; 7+ messages in thread
From: Ahmad Fatoum @ 2026-05-22 10:53 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
In preparation for using the barebox proper malloc area in PBL too,
switch over to CONFIG_MALLOC_OFFSET as this allows calculating the
malloc area start without needing to know the eventual size of
barebox proper itself.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
arch/arm/Kconfig | 2 +-
arch/arm/configs/animeo_ip_defconfig | 2 +-
arch/arm/configs/at91rm9200ek_defconfig | 2 +-
arch/arm/configs/at91sam9260ek_defconfig | 2 +-
arch/arm/configs/at91sam9261ek_bootstrap_defconfig | 2 +-
arch/arm/configs/at91sam9261ek_defconfig | 2 +-
arch/arm/configs/at91sam9g10ek_defconfig | 2 +-
arch/arm/configs/at91sam9g20ek_defconfig | 2 +-
arch/arm/configs/at91sam9m10g45ek_defconfig | 2 +-
arch/arm/configs/at91sam9m10ihd_defconfig | 2 +-
arch/arm/configs/at91sam9n12ek_defconfig | 2 +-
arch/arm/configs/clps711x_defconfig | 2 +-
arch/arm/configs/dss11_defconfig | 2 +-
arch/arm/configs/haba_knx_lite_defconfig | 2 +-
arch/arm/configs/pm9261_defconfig | 2 +-
arch/arm/configs/pm9263_defconfig | 2 +-
arch/arm/configs/pm9g45_defconfig | 2 +-
arch/arm/configs/qil_a9260_defconfig | 2 +-
arch/arm/configs/qil_a9g20_defconfig | 2 +-
arch/arm/configs/telit_evk_pro3_defconfig | 2 +-
arch/arm/configs/tny_a9260_defconfig | 2 +-
arch/arm/configs/tny_a9263_bootstrap_defconfig | 2 +-
arch/arm/configs/tny_a9263_defconfig | 2 +-
arch/arm/configs/tny_a9g20_defconfig | 2 +-
arch/arm/configs/usb_a9260_defconfig | 2 +-
arch/arm/configs/usb_a9263_bootstrap_defconfig | 2 +-
arch/arm/configs/usb_a9263_defconfig | 2 +-
arch/arm/configs/usb_a9g20_defconfig | 2 +-
arch/arm/configs/zynq_defconfig | 2 +-
arch/arm/cpu/start.c | 14 +-------------
30 files changed, 30 insertions(+), 42 deletions(-)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 53bddd55e179..593d7af135de 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -20,7 +20,7 @@ config ARM
select ARCH_HAS_DMA_WRITE_COMBINE
select HAVE_EFI_LOADER if MMU # for payload unaligned accesses
select PBL_IMAGE_ELF
- select ARCH_HAS_MALLOC_SIZE
+ select ARCH_HAS_MALLOC_OFFSET
default y
config ARCH_LINUX_NAME
diff --git a/arch/arm/configs/animeo_ip_defconfig b/arch/arm/configs/animeo_ip_defconfig
index 869e3912500f..b2942931d06e 100644
--- a/arch/arm/configs/animeo_ip_defconfig
+++ b/arch/arm/configs/animeo_ip_defconfig
@@ -8,7 +8,7 @@ CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
CONFIG_EXPERIMENTAL=y
CONFIG_MALLOC_TLSF=y
-CONFIG_MALLOC_SIZE=0x400000
+CONFIG_MALLOC_OFFSET=0x600000
CONFIG_PROMPT="Animeo-IP:"
CONFIG_BAUDRATE=38400
CONFIG_PROMPT_HUSH_PS2="y"
diff --git a/arch/arm/configs/at91rm9200ek_defconfig b/arch/arm/configs/at91rm9200ek_defconfig
index 03e98458a149..8cfdf47408bf 100644
--- a/arch/arm/configs/at91rm9200ek_defconfig
+++ b/arch/arm/configs/at91rm9200ek_defconfig
@@ -6,7 +6,7 @@ CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
CONFIG_EXPERIMENTAL=y
CONFIG_MALLOC_TLSF=y
-CONFIG_MALLOC_SIZE=0x400000
+CONFIG_MALLOC_OFFSET=0x600000
CONFIG_PROMPT="9200-EK:"
CONFIG_HUSH_FANCY_PROMPT=y
CONFIG_CMDLINE_EDITING=y
diff --git a/arch/arm/configs/at91sam9260ek_defconfig b/arch/arm/configs/at91sam9260ek_defconfig
index 1b05225d9713..d04af99da0ed 100644
--- a/arch/arm/configs/at91sam9260ek_defconfig
+++ b/arch/arm/configs/at91sam9260ek_defconfig
@@ -8,7 +8,7 @@ CONFIG_NAME="at91sam9260ek_defconfig"
CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
CONFIG_EXPERIMENTAL=y
-CONFIG_MALLOC_SIZE=0x400000
+CONFIG_MALLOC_OFFSET=0x600000
CONFIG_PROMPT="9260-EK:"
CONFIG_PROMPT_HUSH_PS2="y"
CONFIG_HUSH_FANCY_PROMPT=y
diff --git a/arch/arm/configs/at91sam9261ek_bootstrap_defconfig b/arch/arm/configs/at91sam9261ek_bootstrap_defconfig
index 118021678a13..a61a35aa75e6 100644
--- a/arch/arm/configs/at91sam9261ek_bootstrap_defconfig
+++ b/arch/arm/configs/at91sam9261ek_bootstrap_defconfig
@@ -8,7 +8,7 @@ CONFIG_NAME="at91sam9261ek_bootstrap_defconfig"
CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x27000
CONFIG_MALLOC_DUMMY=y
-CONFIG_MALLOC_SIZE=0x400000
+CONFIG_MALLOC_OFFSET=0x600000
CONFIG_PROMPT="9261-EK:"
CONFIG_SHELL_NONE=y
# CONFIG_TIMESTAMP is not set
diff --git a/arch/arm/configs/at91sam9261ek_defconfig b/arch/arm/configs/at91sam9261ek_defconfig
index 560e4ae49e17..417665ef9680 100644
--- a/arch/arm/configs/at91sam9261ek_defconfig
+++ b/arch/arm/configs/at91sam9261ek_defconfig
@@ -8,7 +8,7 @@ CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
CONFIG_EXPERIMENTAL=y
CONFIG_MALLOC_TLSF=y
-CONFIG_MALLOC_SIZE=0x400000
+CONFIG_MALLOC_OFFSET=0x600000
CONFIG_PROMPT="9261-EK:"
CONFIG_HUSH_FANCY_PROMPT=y
CONFIG_CMDLINE_EDITING=y
diff --git a/arch/arm/configs/at91sam9g10ek_defconfig b/arch/arm/configs/at91sam9g10ek_defconfig
index a347f8704ae5..9b99e1da5a10 100644
--- a/arch/arm/configs/at91sam9g10ek_defconfig
+++ b/arch/arm/configs/at91sam9g10ek_defconfig
@@ -8,7 +8,7 @@ CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
CONFIG_EXPERIMENTAL=y
CONFIG_MALLOC_TLSF=y
-CONFIG_MALLOC_SIZE=0x400000
+CONFIG_MALLOC_OFFSET=0x600000
CONFIG_PROMPT="9G10-EK:"
CONFIG_HUSH_FANCY_PROMPT=y
CONFIG_CMDLINE_EDITING=y
diff --git a/arch/arm/configs/at91sam9g20ek_defconfig b/arch/arm/configs/at91sam9g20ek_defconfig
index c333cecfb482..fac5270d04c3 100644
--- a/arch/arm/configs/at91sam9g20ek_defconfig
+++ b/arch/arm/configs/at91sam9g20ek_defconfig
@@ -8,7 +8,7 @@ CONFIG_NAME="at91sam9g20ek_defconfig"
CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
CONFIG_EXPERIMENTAL=y
-CONFIG_MALLOC_SIZE=0x400000
+CONFIG_MALLOC_OFFSET=0x600000
CONFIG_PROMPT="9G20-EK:"
CONFIG_PROMPT_HUSH_PS2="y"
CONFIG_HUSH_FANCY_PROMPT=y
diff --git a/arch/arm/configs/at91sam9m10g45ek_defconfig b/arch/arm/configs/at91sam9m10g45ek_defconfig
index 3163602331f3..15bebbccc2c1 100644
--- a/arch/arm/configs/at91sam9m10g45ek_defconfig
+++ b/arch/arm/configs/at91sam9m10g45ek_defconfig
@@ -7,7 +7,7 @@ CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_NAME="at91sam9m10g45ek_defconfig"
CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
-CONFIG_MALLOC_SIZE=0x800000
+CONFIG_MALLOC_OFFSET=0xa00000
CONFIG_MALLOC_TLSF=y
CONFIG_PROMPT="9M10G45-EK:"
CONFIG_PROMPT_HUSH_PS2=">"
diff --git a/arch/arm/configs/at91sam9m10ihd_defconfig b/arch/arm/configs/at91sam9m10ihd_defconfig
index 02516ee96000..94e8b9532c3f 100644
--- a/arch/arm/configs/at91sam9m10ihd_defconfig
+++ b/arch/arm/configs/at91sam9m10ihd_defconfig
@@ -6,7 +6,7 @@ CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_NAME="at91sam9m10ihd_defconfig"
CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
-CONFIG_MALLOC_SIZE=0xa00000
+CONFIG_MALLOC_OFFSET=0xc00000
CONFIG_MALLOC_TLSF=y
CONFIG_PROMPT="9M10IHD:"
CONFIG_PROMPT_HUSH_PS2=">"
diff --git a/arch/arm/configs/at91sam9n12ek_defconfig b/arch/arm/configs/at91sam9n12ek_defconfig
index 75e0bfb35458..c1755b3fbfdf 100644
--- a/arch/arm/configs/at91sam9n12ek_defconfig
+++ b/arch/arm/configs/at91sam9n12ek_defconfig
@@ -8,7 +8,7 @@ CONFIG_IMAGE_COMPRESSION_XZKERN=y
CONFIG_NAME="at91sam9n12ek_defconfig"
CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
-CONFIG_MALLOC_SIZE=0xa00000
+CONFIG_MALLOC_OFFSET=0xc00000
CONFIG_EXPERIMENTAL=y
CONFIG_MALLOC_TLSF=y
CONFIG_PROMPT="9G20-EK:"
diff --git a/arch/arm/configs/clps711x_defconfig b/arch/arm/configs/clps711x_defconfig
index bfebf1cea65e..26b9485e5d22 100644
--- a/arch/arm/configs/clps711x_defconfig
+++ b/arch/arm/configs/clps711x_defconfig
@@ -6,7 +6,7 @@ CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_NAME="clps711x_defconfig"
CONFIG_MMU=y
CONFIG_EXPERIMENTAL=y
-CONFIG_MALLOC_SIZE=0x400000
+CONFIG_MALLOC_OFFSET=0x600000
CONFIG_BAUDRATE=57600
CONFIG_CMDLINE_EDITING=y
CONFIG_AUTO_COMPLETE=y
diff --git a/arch/arm/configs/dss11_defconfig b/arch/arm/configs/dss11_defconfig
index 6cef088e2422..2b95706d568f 100644
--- a/arch/arm/configs/dss11_defconfig
+++ b/arch/arm/configs/dss11_defconfig
@@ -4,7 +4,7 @@ CONFIG_MACH_DSS11=y
CONFIG_NAME="dss11_defconfig"
CONFIG_BOOT_ATAGS=y
CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16=y
-CONFIG_MALLOC_SIZE=0x400000
+CONFIG_MALLOC_OFFSET=0x600000
CONFIG_CMDLINE_EDITING=y
CONFIG_AUTO_COMPLETE=y
CONFIG_DEFAULT_ENVIRONMENT_GENERIC=y
diff --git a/arch/arm/configs/haba_knx_lite_defconfig b/arch/arm/configs/haba_knx_lite_defconfig
index e3f99d593278..b47a29beee0d 100644
--- a/arch/arm/configs/haba_knx_lite_defconfig
+++ b/arch/arm/configs/haba_knx_lite_defconfig
@@ -10,7 +10,7 @@ CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
CONFIG_EXPERIMENTAL=y
CONFIG_MALLOC_TLSF=y
-CONFIG_MALLOC_SIZE=0x400000
+CONFIG_MALLOC_OFFSET=0x600000
CONFIG_PROMPT="HABA-KNX-LITE:"
CONFIG_PROMPT_HUSH_PS2="y"
CONFIG_HUSH_FANCY_PROMPT=y
diff --git a/arch/arm/configs/pm9261_defconfig b/arch/arm/configs/pm9261_defconfig
index d7c0e84298b2..b078a368886f 100644
--- a/arch/arm/configs/pm9261_defconfig
+++ b/arch/arm/configs/pm9261_defconfig
@@ -4,7 +4,7 @@ CONFIG_MACH_PM9261=y
CONFIG_BOOT_ATAGS=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_NAME="pm9261_defconfig"
-CONFIG_MALLOC_SIZE=0x400000
+CONFIG_MALLOC_OFFSET=0x600000
CONFIG_PROMPT="PM9261:"
CONFIG_HUSH_FANCY_PROMPT=y
CONFIG_CMDLINE_EDITING=y
diff --git a/arch/arm/configs/pm9263_defconfig b/arch/arm/configs/pm9263_defconfig
index 03365e84959c..7721510140af 100644
--- a/arch/arm/configs/pm9263_defconfig
+++ b/arch/arm/configs/pm9263_defconfig
@@ -3,7 +3,7 @@ CONFIG_ARCH_AT91SAM9263=y
CONFIG_BOOT_ATAGS=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_NAME="pm9263_defconfig"
-CONFIG_MALLOC_SIZE=0x400000
+CONFIG_MALLOC_OFFSET=0x600000
CONFIG_PROMPT_HUSH_PS2="y"
CONFIG_CMDLINE_EDITING=y
CONFIG_AUTO_COMPLETE=y
diff --git a/arch/arm/configs/pm9g45_defconfig b/arch/arm/configs/pm9g45_defconfig
index 30ac5da05f01..78f1e14b7b0a 100644
--- a/arch/arm/configs/pm9g45_defconfig
+++ b/arch/arm/configs/pm9g45_defconfig
@@ -8,7 +8,7 @@ CONFIG_NAME="pm9g45_defconfig"
CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
CONFIG_MALLOC_TLSF=y
-CONFIG_MALLOC_SIZE=0x400000
+CONFIG_MALLOC_OFFSET=0x600000
CONFIG_GLOB_SORT=y
CONFIG_HUSH_FANCY_PROMPT=y
CONFIG_CMDLINE_EDITING=y
diff --git a/arch/arm/configs/qil_a9260_defconfig b/arch/arm/configs/qil_a9260_defconfig
index 0f2dfe247155..4faaed381762 100644
--- a/arch/arm/configs/qil_a9260_defconfig
+++ b/arch/arm/configs/qil_a9260_defconfig
@@ -8,7 +8,7 @@ CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_NAME="qil_a9260_defconfig"
CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
-CONFIG_MALLOC_SIZE=0x400000
+CONFIG_MALLOC_OFFSET=0x600000
CONFIG_EXPERIMENTAL=y
CONFIG_PROMPT="USB-9G20:"
CONFIG_PROMPT_HUSH_PS2="y"
diff --git a/arch/arm/configs/qil_a9g20_defconfig b/arch/arm/configs/qil_a9g20_defconfig
index 32cbbad26ce4..281dddcfdbca 100644
--- a/arch/arm/configs/qil_a9g20_defconfig
+++ b/arch/arm/configs/qil_a9g20_defconfig
@@ -8,7 +8,7 @@ CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_NAME="qil_a9g20_defconfig"
CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
-CONFIG_MALLOC_SIZE=0x400000
+CONFIG_MALLOC_OFFSET=0x600000
CONFIG_EXPERIMENTAL=y
CONFIG_PROMPT="USB-9G20:"
CONFIG_PROMPT_HUSH_PS2="y"
diff --git a/arch/arm/configs/telit_evk_pro3_defconfig b/arch/arm/configs/telit_evk_pro3_defconfig
index f5b7c488370c..8ad63a6ee753 100644
--- a/arch/arm/configs/telit_evk_pro3_defconfig
+++ b/arch/arm/configs/telit_evk_pro3_defconfig
@@ -8,7 +8,7 @@ CONFIG_NAME="telit_evk_pro3_defconfig"
CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
CONFIG_EXPERIMENTAL=y
-CONFIG_MALLOC_SIZE=0x400000
+CONFIG_MALLOC_OFFSET=0x600000
CONFIG_PROMPT="EVK-PRO3:"
CONFIG_PROMPT_HUSH_PS2="y"
CONFIG_HUSH_FANCY_PROMPT=y
diff --git a/arch/arm/configs/tny_a9260_defconfig b/arch/arm/configs/tny_a9260_defconfig
index 6335871c2cda..c3a578a1696f 100644
--- a/arch/arm/configs/tny_a9260_defconfig
+++ b/arch/arm/configs/tny_a9260_defconfig
@@ -10,7 +10,7 @@ CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
CONFIG_EXPERIMENTAL=y
CONFIG_MALLOC_TLSF=y
-CONFIG_MALLOC_SIZE=0x400000
+CONFIG_MALLOC_OFFSET=0x600000
CONFIG_PROMPT="TNY-9260:"
CONFIG_PROMPT_HUSH_PS2="y"
CONFIG_HUSH_FANCY_PROMPT=y
diff --git a/arch/arm/configs/tny_a9263_bootstrap_defconfig b/arch/arm/configs/tny_a9263_bootstrap_defconfig
index 08d289927fc1..a7fb2c8828fa 100644
--- a/arch/arm/configs/tny_a9263_bootstrap_defconfig
+++ b/arch/arm/configs/tny_a9263_bootstrap_defconfig
@@ -9,7 +9,7 @@ CONFIG_NAME="tny_a9263_bootstrap_defconfig"
CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x12000
CONFIG_MALLOC_DUMMY=y
-CONFIG_MALLOC_SIZE=0x400000
+CONFIG_MALLOC_OFFSET=0x600000
CONFIG_PROMPT="USB-9263:"
CONFIG_SHELL_NONE=y
CONFIG_CONSOLE_SIMPLE=y
diff --git a/arch/arm/configs/tny_a9263_defconfig b/arch/arm/configs/tny_a9263_defconfig
index a4ab927ce2a3..3d7daee61f95 100644
--- a/arch/arm/configs/tny_a9263_defconfig
+++ b/arch/arm/configs/tny_a9263_defconfig
@@ -10,7 +10,7 @@ CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
CONFIG_EXPERIMENTAL=y
CONFIG_MALLOC_TLSF=y
-CONFIG_MALLOC_SIZE=0x400000
+CONFIG_MALLOC_OFFSET=0x600000
CONFIG_PROMPT="TNY-9263:"
CONFIG_PROMPT_HUSH_PS2="y"
CONFIG_HUSH_FANCY_PROMPT=y
diff --git a/arch/arm/configs/tny_a9g20_defconfig b/arch/arm/configs/tny_a9g20_defconfig
index c470cb9ec946..a123aa0b11b3 100644
--- a/arch/arm/configs/tny_a9g20_defconfig
+++ b/arch/arm/configs/tny_a9g20_defconfig
@@ -10,7 +10,7 @@ CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
CONFIG_EXPERIMENTAL=y
CONFIG_MALLOC_TLSF=y
-CONFIG_MALLOC_SIZE=0x400000
+CONFIG_MALLOC_OFFSET=0x600000
CONFIG_PROMPT="TNY-9G20:"
CONFIG_PROMPT_HUSH_PS2="y"
CONFIG_HUSH_FANCY_PROMPT=y
diff --git a/arch/arm/configs/usb_a9260_defconfig b/arch/arm/configs/usb_a9260_defconfig
index 85f76f44ab48..9fed08b9b944 100644
--- a/arch/arm/configs/usb_a9260_defconfig
+++ b/arch/arm/configs/usb_a9260_defconfig
@@ -9,7 +9,7 @@ CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
CONFIG_EXPERIMENTAL=y
CONFIG_MALLOC_TLSF=y
-CONFIG_MALLOC_SIZE=0x400000
+CONFIG_MALLOC_OFFSET=0x600000
CONFIG_PROMPT="USB-9G20:"
CONFIG_PROMPT_HUSH_PS2="y"
CONFIG_HUSH_FANCY_PROMPT=y
diff --git a/arch/arm/configs/usb_a9263_bootstrap_defconfig b/arch/arm/configs/usb_a9263_bootstrap_defconfig
index 2b204e0ee4ff..e4cdf4df1fa7 100644
--- a/arch/arm/configs/usb_a9263_bootstrap_defconfig
+++ b/arch/arm/configs/usb_a9263_bootstrap_defconfig
@@ -10,7 +10,7 @@ CONFIG_NAME="usb_a9263_bootstrap_defconfig"
CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x12000
CONFIG_MALLOC_DUMMY=y
-CONFIG_MALLOC_SIZE=0x400000
+CONFIG_MALLOC_OFFSET=0x600000
CONFIG_PROMPT="USB-9263:"
CONFIG_SHELL_NONE=y
# CONFIG_SPI is not set
diff --git a/arch/arm/configs/usb_a9263_defconfig b/arch/arm/configs/usb_a9263_defconfig
index 287d590d066a..f671c82a0de7 100644
--- a/arch/arm/configs/usb_a9263_defconfig
+++ b/arch/arm/configs/usb_a9263_defconfig
@@ -9,7 +9,7 @@ CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
CONFIG_EXPERIMENTAL=y
CONFIG_MALLOC_TLSF=y
-CONFIG_MALLOC_SIZE=0x400000
+CONFIG_MALLOC_OFFSET=0x600000
CONFIG_PROMPT="USB-9263:"
CONFIG_PROMPT_HUSH_PS2="y"
CONFIG_HUSH_FANCY_PROMPT=y
diff --git a/arch/arm/configs/usb_a9g20_defconfig b/arch/arm/configs/usb_a9g20_defconfig
index bea0e00455d6..17d2b9bd043b 100644
--- a/arch/arm/configs/usb_a9g20_defconfig
+++ b/arch/arm/configs/usb_a9g20_defconfig
@@ -7,7 +7,7 @@ CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_NAME="usb_a9g20_defconfig"
CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
-CONFIG_MALLOC_SIZE=0x800000
+CONFIG_MALLOC_OFFSET=0xa00000
CONFIG_EXPERIMENTAL=y
CONFIG_MALLOC_TLSF=y
CONFIG_RELOCATABLE=y
diff --git a/arch/arm/configs/zynq_defconfig b/arch/arm/configs/zynq_defconfig
index 76c73639d6a0..222b031b634a 100644
--- a/arch/arm/configs/zynq_defconfig
+++ b/arch/arm/configs/zynq_defconfig
@@ -7,7 +7,7 @@ CONFIG_IMAGE_COMPRESSION_XZKERN=y
CONFIG_NAME="zynq_defconfig"
CONFIG_MMU=y
CONFIG_STACK_SIZE=0xf000
-CONFIG_MALLOC_SIZE=0x8000000
+CONFIG_MALLOC_OFFSET=0x8200000
CONFIG_MALLOC_TLSF=y
CONFIG_KALLSYMS=y
CONFIG_HUSH_FANCY_PROMPT=y
diff --git a/arch/arm/cpu/start.c b/arch/arm/cpu/start.c
index bbcf465be4db..3b8411b01d63 100644
--- a/arch/arm/cpu/start.c
+++ b/arch/arm/cpu/start.c
@@ -156,19 +156,7 @@ __noreturn void barebox_non_pbl_start(unsigned long membase,
armv7r_mpu_init_coherent(malloc_end, REGION_8MB);
}
- /*
- * Maximum malloc space is the Kconfig value if given
- * or 1GB.
- */
- if (MALLOC_SIZE > 0) {
- malloc_start = malloc_end - MALLOC_SIZE;
- if (malloc_start < membase)
- malloc_start = membase;
- } else {
- malloc_start = malloc_end - (malloc_end - membase) / 2;
- if (malloc_end - malloc_start > SZ_1G)
- malloc_start = malloc_end - SZ_1G;
- }
+ malloc_start = barebox_malloc_base(membase, memsize);
pr_debug("initializing malloc pool at 0x%08lx (size 0x%08lx)\n",
malloc_start, malloc_end - malloc_start);
--
2.47.3
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH master 5/6] ARM: configs: drop CONFIG_MALLOC_SIZE=0x0 as it's now the default
2026-05-22 10:53 [PATCH master 0/6] ARM: unify pbl and proper malloc area start Ahmad Fatoum
` (3 preceding siblings ...)
2026-05-22 10:53 ` [PATCH master 4/6] ARM: switch to CONFIG_MALLOC_OFFSET Ahmad Fatoum
@ 2026-05-22 10:53 ` Ahmad Fatoum
2026-05-22 10:53 ` [PATCH master 6/6] ARM: place PBL malloc area at start of barebox proper malloc area Ahmad Fatoum
5 siblings, 0 replies; 7+ messages in thread
From: Ahmad Fatoum @ 2026-05-22 10:53 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
CONFIG_MALLOC_SIZE=0x0 is not the default value, although it's the most
commonly used. We couldn't turn around and change this now without
breakage.
CONFIG_MALLOC_OFFSET=0x0 behaves the same as CONFIG_MALLOC_SIZE=0x0 and
is the default, so we can drop CONFIG_MALLOC_SIZE=0x0 now.
No functional change.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
arch/arm/configs/am335x_mlo_defconfig | 1 -
arch/arm/configs/am35xx_pfc200_xload_defconfig | 1 -
arch/arm/configs/at91_multi_defconfig | 1 -
arch/arm/configs/efi_v8_defconfig | 1 -
arch/arm/configs/imx23_defconfig | 1 -
arch/arm/configs/imx28_defconfig | 1 -
arch/arm/configs/imx_v7_defconfig | 1 -
arch/arm/configs/imx_v8_defconfig | 1 -
arch/arm/configs/k3-r5_defconfig | 1 -
arch/arm/configs/kindle-gen-6-7_defconfig | 1 -
arch/arm/configs/kindle-mx50_defconfig | 1 -
arch/arm/configs/layerscape_defconfig | 1 -
arch/arm/configs/layerscape_v7_defconfig | 1 -
arch/arm/configs/modules32_defconfig | 1 -
arch/arm/configs/multi_v5_v6_defconfig | 1 -
arch/arm/configs/multi_v7_defconfig | 1 -
arch/arm/configs/multi_v8_defconfig | 1 -
arch/arm/configs/mvebu_defconfig | 1 -
arch/arm/configs/omap_defconfig | 1 -
arch/arm/configs/rockchip_v7a_defconfig | 1 -
arch/arm/configs/rockchip_v8_defconfig | 1 -
arch/arm/configs/rpi_defconfig | 1 -
arch/arm/configs/rpi_v8a_defconfig | 3 +--
arch/arm/configs/socfpga-agilex5_defconfig | 1 -
arch/arm/configs/socfpga-arria10_defconfig | 1 -
arch/arm/configs/socfpga-xload_defconfig | 1 -
arch/arm/configs/socfpga_defconfig | 1 -
arch/arm/configs/stm32mp_defconfig | 1 -
arch/arm/configs/tegra_v7_defconfig | 1 -
arch/arm/configs/virt32_secure_defconfig | 1 -
arch/arm/configs/zii_vf610_dev_defconfig | 1 -
arch/arm/configs/zynqmp_defconfig | 1 -
32 files changed, 1 insertion(+), 33 deletions(-)
diff --git a/arch/arm/configs/am335x_mlo_defconfig b/arch/arm/configs/am335x_mlo_defconfig
index 89cadeda2f6f..719d52d69e49 100644
--- a/arch/arm/configs/am335x_mlo_defconfig
+++ b/arch/arm/configs/am335x_mlo_defconfig
@@ -13,7 +13,6 @@ CONFIG_NAME="am335x_mlo_defconfig"
CONFIG_IMAGE_COMPRESSION_XZKERN=y
CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x1b400
-CONFIG_MALLOC_SIZE=0x0
CONFIG_MALLOC_TLSF=y
CONFIG_PROMPT="MLO>"
CONFIG_SHELL_NONE=y
diff --git a/arch/arm/configs/am35xx_pfc200_xload_defconfig b/arch/arm/configs/am35xx_pfc200_xload_defconfig
index 26fc4296f870..7b25e22adb25 100644
--- a/arch/arm/configs/am35xx_pfc200_xload_defconfig
+++ b/arch/arm/configs/am35xx_pfc200_xload_defconfig
@@ -7,7 +7,6 @@ CONFIG_THUMB2_BAREBOX=y
CONFIG_NAME="am35xx_pfc200_xload_defconfig"
CONFIG_MMU=y
CONFIG_STACK_SIZE=0xc00
-CONFIG_MALLOC_SIZE=0x0
CONFIG_MALLOC_DUMMY=y
CONFIG_RELOCATABLE=y
CONFIG_PROMPT="X-load pfc200>"
diff --git a/arch/arm/configs/at91_multi_defconfig b/arch/arm/configs/at91_multi_defconfig
index 60452f802feb..1a1afd95c6ca 100644
--- a/arch/arm/configs/at91_multi_defconfig
+++ b/arch/arm/configs/at91_multi_defconfig
@@ -15,7 +15,6 @@ CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_ARM_UNWIND=y
CONFIG_NAME="at91_multi_defconfig"
CONFIG_MMU=y
-CONFIG_MALLOC_SIZE=0x0
CONFIG_MALLOC_TLSF=y
CONFIG_KALLSYMS=y
CONFIG_RELOCATABLE=y
diff --git a/arch/arm/configs/efi_v8_defconfig b/arch/arm/configs/efi_v8_defconfig
index 5f946dd51d4a..51eaad78a11e 100644
--- a/arch/arm/configs/efi_v8_defconfig
+++ b/arch/arm/configs/efi_v8_defconfig
@@ -3,7 +3,6 @@ CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_ARM_PSCI_CLIENT=y
CONFIG_NAME="efi_v8_defconfig"
CONFIG_MMU=y
-CONFIG_MALLOC_SIZE=0x0
CONFIG_KALLSYMS=y
CONFIG_PROMPT="barebox> "
CONFIG_PROMPT_HUSH_PS2="y"
diff --git a/arch/arm/configs/imx23_defconfig b/arch/arm/configs/imx23_defconfig
index 3df9dcbd97f7..de41f691dca5 100644
--- a/arch/arm/configs/imx23_defconfig
+++ b/arch/arm/configs/imx23_defconfig
@@ -9,7 +9,6 @@ CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_ARM_UNWIND=y
CONFIG_NAME="imx23_defconfig"
CONFIG_MMU=y
-CONFIG_MALLOC_SIZE=0x0
CONFIG_MALLOC_TLSF=y
CONFIG_KALLSYMS=y
CONFIG_RELOCATABLE=y
diff --git a/arch/arm/configs/imx28_defconfig b/arch/arm/configs/imx28_defconfig
index 0586cfe93e96..c1859a38def7 100644
--- a/arch/arm/configs/imx28_defconfig
+++ b/arch/arm/configs/imx28_defconfig
@@ -10,7 +10,6 @@ CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_ARM_UNWIND=y
CONFIG_NAME="imx28_defconfig"
CONFIG_MMU=y
-CONFIG_MALLOC_SIZE=0x0
CONFIG_MALLOC_TLSF=y
CONFIG_KALLSYMS=y
CONFIG_RELOCATABLE=y
diff --git a/arch/arm/configs/imx_v7_defconfig b/arch/arm/configs/imx_v7_defconfig
index 310c0b8dc391..f66a958d9ccf 100644
--- a/arch/arm/configs/imx_v7_defconfig
+++ b/arch/arm/configs/imx_v7_defconfig
@@ -61,7 +61,6 @@ CONFIG_ARM_UNWIND=y
CONFIG_ARM_PSCI=y
CONFIG_NAME="imx_v7_defconfig"
CONFIG_MMU=y
-CONFIG_MALLOC_SIZE=0x0
CONFIG_MALLOC_TLSF=y
CONFIG_KALLSYMS=y
CONFIG_HUSH_FANCY_PROMPT=y
diff --git a/arch/arm/configs/imx_v8_defconfig b/arch/arm/configs/imx_v8_defconfig
index cbdb3a65c745..c8dd3e227929 100644
--- a/arch/arm/configs/imx_v8_defconfig
+++ b/arch/arm/configs/imx_v8_defconfig
@@ -23,7 +23,6 @@ CONFIG_64BIT=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_NAME="imx_v8_defconfig"
CONFIG_MMU=y
-CONFIG_MALLOC_SIZE=0x0
CONFIG_KALLSYMS=y
CONFIG_HUSH_FANCY_PROMPT=y
CONFIG_AUTO_COMPLETE=y
diff --git a/arch/arm/configs/k3-r5_defconfig b/arch/arm/configs/k3-r5_defconfig
index 6d8391c55e7c..93401e1792b1 100644
--- a/arch/arm/configs/k3-r5_defconfig
+++ b/arch/arm/configs/k3-r5_defconfig
@@ -9,7 +9,6 @@ CONFIG_NAME="k3-r5_defconfig"
CONFIG_ENVIRONMENT_VARIABLES=y
CONFIG_IMAGE_COMPRESSION_XZKERN=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x3d000
-CONFIG_MALLOC_SIZE=0x0
CONFIG_MALLOC_TLSF=y
CONFIG_KALLSYMS=y
CONFIG_PROMPT="MLO>"
diff --git a/arch/arm/configs/kindle-gen-6-7_defconfig b/arch/arm/configs/kindle-gen-6-7_defconfig
index 9155fb45a3de..aca4fd00ab61 100644
--- a/arch/arm/configs/kindle-gen-6-7_defconfig
+++ b/arch/arm/configs/kindle-gen-6-7_defconfig
@@ -10,7 +10,6 @@ CONFIG_IMAGE_COMPRESSION_XZKERN=y
CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x5dc00
CONFIG_STACK_SIZE=0x10000
-CONFIG_MALLOC_SIZE=0x0
CONFIG_KALLSYMS=y
CONFIG_HUSH_FANCY_PROMPT=y
CONFIG_CMDLINE_EDITING=y
diff --git a/arch/arm/configs/kindle-mx50_defconfig b/arch/arm/configs/kindle-mx50_defconfig
index 331e0eae6d12..8e2b121f6327 100644
--- a/arch/arm/configs/kindle-mx50_defconfig
+++ b/arch/arm/configs/kindle-mx50_defconfig
@@ -7,7 +7,6 @@ CONFIG_ARM_UNWIND=y
CONFIG_IMAGE_COMPRESSION_XZKERN=y
CONFIG_NAME="kindle-mx50_defconfig"
CONFIG_MMU=y
-CONFIG_MALLOC_SIZE=0x0
CONFIG_MALLOC_TLSF=y
CONFIG_KALLSYMS=y
CONFIG_HUSH_FANCY_PROMPT=y
diff --git a/arch/arm/configs/layerscape_defconfig b/arch/arm/configs/layerscape_defconfig
index 272dff90d7c8..7d2a2e2322a2 100644
--- a/arch/arm/configs/layerscape_defconfig
+++ b/arch/arm/configs/layerscape_defconfig
@@ -6,7 +6,6 @@ CONFIG_64BIT=y
CONFIG_ARM_PSCI_CLIENT=y
CONFIG_NAME="layerscape_defconfig"
CONFIG_MMU=y
-CONFIG_MALLOC_SIZE=0x0
CONFIG_KALLSYMS=y
CONFIG_HUSH_FANCY_PROMPT=y
CONFIG_CMDLINE_EDITING=y
diff --git a/arch/arm/configs/layerscape_v7_defconfig b/arch/arm/configs/layerscape_v7_defconfig
index 99570a889052..337009526292 100644
--- a/arch/arm/configs/layerscape_v7_defconfig
+++ b/arch/arm/configs/layerscape_v7_defconfig
@@ -2,7 +2,6 @@ CONFIG_ARCH_LAYERSCAPE=y
CONFIG_MACH_LS1021AIOT=y
CONFIG_NAME="layerscape_v7_defconfig"
CONFIG_MMU=y
-CONFIG_MALLOC_SIZE=0x0
CONFIG_MALLOC_TLSF=y
CONFIG_KALLSYMS=y
CONFIG_RELOCATABLE=y
diff --git a/arch/arm/configs/modules32_defconfig b/arch/arm/configs/modules32_defconfig
index 0e32a4dd9c3e..680b78c2a116 100644
--- a/arch/arm/configs/modules32_defconfig
+++ b/arch/arm/configs/modules32_defconfig
@@ -14,7 +14,6 @@ CONFIG_BOOT_ATAGS=y
CONFIG_ARM_BOOTM_FIP=y
CONFIG_NAME="modules32_defconfig"
CONFIG_MMU=y
-CONFIG_MALLOC_SIZE=0x0
CONFIG_EXPERIMENTAL=y
CONFIG_MODULES=y
CONFIG_MODULES_ENVIRONMENT=y
diff --git a/arch/arm/configs/multi_v5_v6_defconfig b/arch/arm/configs/multi_v5_v6_defconfig
index bc6645b3ce27..3a03803eb2f4 100644
--- a/arch/arm/configs/multi_v5_v6_defconfig
+++ b/arch/arm/configs/multi_v5_v6_defconfig
@@ -15,7 +15,6 @@ CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_ARM_UNWIND=y
CONFIG_NAME="multi_v5_v6_defconfig"
CONFIG_MMU=y
-CONFIG_MALLOC_SIZE=0x0
CONFIG_MALLOC_TLSF=y
CONFIG_KALLSYMS=y
CONFIG_PANIC_HANG=y
diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig
index 5db25fd1a74b..1354e7775bdd 100644
--- a/arch/arm/configs/multi_v7_defconfig
+++ b/arch/arm/configs/multi_v7_defconfig
@@ -95,7 +95,6 @@ CONFIG_ARM_UNWIND=y
CONFIG_ARM_PSCI=y
CONFIG_NAME="multi_v7_defconfig"
CONFIG_MMU=y
-CONFIG_MALLOC_SIZE=0x0
CONFIG_MALLOC_TLSF=y
CONFIG_KALLSYMS=y
CONFIG_PROMPT="barebox> "
diff --git a/arch/arm/configs/multi_v8_defconfig b/arch/arm/configs/multi_v8_defconfig
index 233aebbe2d95..e62dbc96fd03 100644
--- a/arch/arm/configs/multi_v8_defconfig
+++ b/arch/arm/configs/multi_v8_defconfig
@@ -52,7 +52,6 @@ CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_ARM_PSCI_CLIENT=y
CONFIG_NAME="multi_v8_defconfig"
CONFIG_MMU=y
-CONFIG_MALLOC_SIZE=0x0
CONFIG_KALLSYMS=y
CONFIG_PROMPT="barebox> "
CONFIG_HUSH_FANCY_PROMPT=y
diff --git a/arch/arm/configs/mvebu_defconfig b/arch/arm/configs/mvebu_defconfig
index 91dd23e1c8b9..8f523060a4ca 100644
--- a/arch/arm/configs/mvebu_defconfig
+++ b/arch/arm/configs/mvebu_defconfig
@@ -16,7 +16,6 @@ CONFIG_BOOT_ATAGS=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_NAME="mvebu_defconfig"
CONFIG_MMU=y
-CONFIG_MALLOC_SIZE=0x0
CONFIG_MALLOC_TLSF=y
CONFIG_KALLSYMS=y
CONFIG_RELOCATABLE=y
diff --git a/arch/arm/configs/omap_defconfig b/arch/arm/configs/omap_defconfig
index 007986e02eb9..c4e584dc8440 100644
--- a/arch/arm/configs/omap_defconfig
+++ b/arch/arm/configs/omap_defconfig
@@ -16,7 +16,6 @@ CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_ARM_UNWIND=y
CONFIG_NAME="omap_defconfig"
CONFIG_MMU=y
-CONFIG_MALLOC_SIZE=0x0
CONFIG_MALLOC_TLSF=y
CONFIG_KALLSYMS=y
CONFIG_PROMPT="barebox> "
diff --git a/arch/arm/configs/rockchip_v7a_defconfig b/arch/arm/configs/rockchip_v7a_defconfig
index 96b575de55a2..bcabb541ec60 100644
--- a/arch/arm/configs/rockchip_v7a_defconfig
+++ b/arch/arm/configs/rockchip_v7a_defconfig
@@ -10,7 +10,6 @@ CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_ARM_UNWIND=y
CONFIG_NAME="rockchip_v7a_defconfig"
CONFIG_MMU=y
-CONFIG_MALLOC_SIZE=0x0
CONFIG_MALLOC_TLSF=y
CONFIG_KALLSYMS=y
CONFIG_RELOCATABLE=y
diff --git a/arch/arm/configs/rockchip_v8_defconfig b/arch/arm/configs/rockchip_v8_defconfig
index e0df655ea046..ef2951d133d6 100644
--- a/arch/arm/configs/rockchip_v8_defconfig
+++ b/arch/arm/configs/rockchip_v8_defconfig
@@ -16,7 +16,6 @@ CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_ARM_PSCI_CLIENT=y
CONFIG_NAME="rockchip_v8_defconfig"
CONFIG_MMU=y
-CONFIG_MALLOC_SIZE=0x0
CONFIG_MALLOC_TLSF=y
CONFIG_KALLSYMS=y
CONFIG_PROMPT="barebox> "
diff --git a/arch/arm/configs/rpi_defconfig b/arch/arm/configs/rpi_defconfig
index ab146d755133..4da5388fb710 100644
--- a/arch/arm/configs/rpi_defconfig
+++ b/arch/arm/configs/rpi_defconfig
@@ -10,7 +10,6 @@ CONFIG_ARM_UNWIND=y
CONFIG_IMAGE_COMPRESSION_NONE=y
CONFIG_NAME="rpi_defconfig"
CONFIG_MMU=y
-CONFIG_MALLOC_SIZE=0x0
CONFIG_MALLOC_TLSF=y
CONFIG_KALLSYMS=y
CONFIG_PROMPT="R-Pi> "
diff --git a/arch/arm/configs/rpi_v8a_defconfig b/arch/arm/configs/rpi_v8a_defconfig
index 6c85209546e4..c29fe30701e8 100644
--- a/arch/arm/configs/rpi_v8a_defconfig
+++ b/arch/arm/configs/rpi_v8a_defconfig
@@ -6,7 +6,6 @@ CONFIG_64BIT=y
CONFIG_IMAGE_COMPRESSION_NONE=y
CONFIG_NAME="rpi_v8a_defconfig"
CONFIG_MMU=y
-CONFIG_MALLOC_SIZE=0x0
CONFIG_MALLOC_TLSF=y
CONFIG_KALLSYMS=y
CONFIG_PROMPT="R-Pi> "
@@ -111,4 +110,4 @@ CONFIG_FS_NFS=y
CONFIG_FS_FAT=y
CONFIG_FS_FAT_WRITE=y
CONFIG_FS_FAT_LFN=y
-CONFIG_ZLIB=y
\ No newline at end of file
+CONFIG_ZLIB=y
diff --git a/arch/arm/configs/socfpga-agilex5_defconfig b/arch/arm/configs/socfpga-agilex5_defconfig
index 5711cb89ed27..cad8eeb862fe 100644
--- a/arch/arm/configs/socfpga-agilex5_defconfig
+++ b/arch/arm/configs/socfpga-agilex5_defconfig
@@ -3,7 +3,6 @@ CONFIG_64BIT=y
CONFIG_MACH_SOCFPGA_ARROW_AXE5_EAGLE=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_MMU=y
-CONFIG_MALLOC_SIZE=0x0
CONFIG_PROMPT="barebox> "
CONFIG_HUSH_FANCY_PROMPT=y
CONFIG_CMDLINE_EDITING=y
diff --git a/arch/arm/configs/socfpga-arria10_defconfig b/arch/arm/configs/socfpga-arria10_defconfig
index 46cd25a8254f..d0cf135420d6 100644
--- a/arch/arm/configs/socfpga-arria10_defconfig
+++ b/arch/arm/configs/socfpga-arria10_defconfig
@@ -5,7 +5,6 @@ CONFIG_AEABI=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_ARM_UNWIND=y
CONFIG_NAME="socfpga-arria10_defconfig"
-CONFIG_MALLOC_SIZE=0x0
CONFIG_KALLSYMS=y
CONFIG_HUSH_FANCY_PROMPT=y
CONFIG_CMDLINE_EDITING=y
diff --git a/arch/arm/configs/socfpga-xload_defconfig b/arch/arm/configs/socfpga-xload_defconfig
index 31050cde6683..084f3a3188c7 100644
--- a/arch/arm/configs/socfpga-xload_defconfig
+++ b/arch/arm/configs/socfpga-xload_defconfig
@@ -14,7 +14,6 @@ CONFIG_NAME="socfpga-xload_defconfig"
# CONFIG_MEMINFO is not set
CONFIG_IMAGE_COMPRESSION_XZKERN=y
CONFIG_MMU=y
-CONFIG_MALLOC_SIZE=0x0
CONFIG_MALLOC_DUMMY=y
CONFIG_SHELL_NONE=y
# CONFIG_ERRNO_MESSAGES is not set
diff --git a/arch/arm/configs/socfpga_defconfig b/arch/arm/configs/socfpga_defconfig
index 4f879cd45f0f..80731b196d3d 100644
--- a/arch/arm/configs/socfpga_defconfig
+++ b/arch/arm/configs/socfpga_defconfig
@@ -10,7 +10,6 @@ CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_ARM_UNWIND=y
CONFIG_NAME="socfpga_defconfig"
CONFIG_MMU=y
-CONFIG_MALLOC_SIZE=0x0
CONFIG_KALLSYMS=y
CONFIG_HUSH_FANCY_PROMPT=y
CONFIG_CMDLINE_EDITING=y
diff --git a/arch/arm/configs/stm32mp_defconfig b/arch/arm/configs/stm32mp_defconfig
index 1d1b75fbb0a8..dcbac40bf42e 100644
--- a/arch/arm/configs/stm32mp_defconfig
+++ b/arch/arm/configs/stm32mp_defconfig
@@ -16,7 +16,6 @@ CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_ARM_UNWIND=y
CONFIG_NAME="stm32mp_defconfig"
CONFIG_MMU=y
-CONFIG_MALLOC_SIZE=0x0
CONFIG_KALLSYMS=y
CONFIG_HUSH_FANCY_PROMPT=y
CONFIG_AUTO_COMPLETE=y
diff --git a/arch/arm/configs/tegra_v7_defconfig b/arch/arm/configs/tegra_v7_defconfig
index 0d980009b030..af63a1aeb75b 100644
--- a/arch/arm/configs/tegra_v7_defconfig
+++ b/arch/arm/configs/tegra_v7_defconfig
@@ -9,7 +9,6 @@ CONFIG_ARM_UNWIND=y
CONFIG_NAME="tegra_v7_defconfig"
CONFIG_MMU=y
CONFIG_STACK_SIZE=0x10000
-CONFIG_MALLOC_SIZE=0x0
CONFIG_KALLSYMS=y
CONFIG_HUSH_FANCY_PROMPT=y
CONFIG_CMDLINE_EDITING=y
diff --git a/arch/arm/configs/virt32_secure_defconfig b/arch/arm/configs/virt32_secure_defconfig
index 09c98e5e4dc8..12e400ae25e4 100644
--- a/arch/arm/configs/virt32_secure_defconfig
+++ b/arch/arm/configs/virt32_secure_defconfig
@@ -12,7 +12,6 @@ CONFIG_ARM_BOOTM_ELF=y
CONFIG_ARM_BOOTM_FIP=y
CONFIG_NAME="virt32_secure_defconfig"
CONFIG_MMU=y
-CONFIG_MALLOC_SIZE=0x0
CONFIG_KALLSYMS=y
CONFIG_PROMPT="barebox> "
CONFIG_HUSH_FANCY_PROMPT=y
diff --git a/arch/arm/configs/zii_vf610_dev_defconfig b/arch/arm/configs/zii_vf610_dev_defconfig
index 24fa40ade974..84a2530d0991 100644
--- a/arch/arm/configs/zii_vf610_dev_defconfig
+++ b/arch/arm/configs/zii_vf610_dev_defconfig
@@ -5,7 +5,6 @@ CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_ARM_UNWIND=y
CONFIG_NAME="zii_vf610_dev_defconfig"
CONFIG_MMU=y
-CONFIG_MALLOC_SIZE=0x0
CONFIG_MALLOC_TLSF=y
CONFIG_KALLSYMS=y
CONFIG_HUSH_FANCY_PROMPT=y
diff --git a/arch/arm/configs/zynqmp_defconfig b/arch/arm/configs/zynqmp_defconfig
index 5a71536ba69e..39c1b42619cc 100644
--- a/arch/arm/configs/zynqmp_defconfig
+++ b/arch/arm/configs/zynqmp_defconfig
@@ -6,7 +6,6 @@ CONFIG_64BIT=y
CONFIG_ARM_PSCI_CLIENT=y
CONFIG_NAME="zynqmp_defconfig"
CONFIG_MMU=y
-CONFIG_MALLOC_SIZE=0x0
CONFIG_MALLOC_TLSF=y
CONFIG_KALLSYMS=y
CONFIG_HUSH_FANCY_PROMPT=y
--
2.47.3
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH master 6/6] ARM: place PBL malloc area at start of barebox proper malloc area
2026-05-22 10:53 [PATCH master 0/6] ARM: unify pbl and proper malloc area start Ahmad Fatoum
` (4 preceding siblings ...)
2026-05-22 10:53 ` [PATCH master 5/6] ARM: configs: drop CONFIG_MALLOC_SIZE=0x0 as it's now the default Ahmad Fatoum
@ 2026-05-22 10:53 ` Ahmad Fatoum
5 siblings, 0 replies; 7+ messages in thread
From: Ahmad Fatoum @ 2026-05-22 10:53 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum, Alexander Shiyan
The early PBL malloc area used by the Rockchip code overlaps the region
used for OP-TEE. Moving it a bit lower would overlap the region occupied
by the scratch area.
With the switch to CONFIG_MALLOC_OFFSET, we can compute the start of the
malloc area in barebox proper without knowing how big barebox will
eventually be, so make use of that and always place the PBL malloc area
exactly at the start of the eventual barebox proper memory area.
The memory will automatically be reclaimed when the TLSF allocator is
instantiated and we will be sure not to overwrite anything by allocating
in PBL.
Reported-by: Alexander Shiyan <eagle.alexander923@gmail.com>
Fixes: 76b1f31275fe ("ARM: rockchip: initialize PBL malloc")
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
arch/arm/cpu/common.c | 4 ++--
arch/arm/cpu/uncompress.c | 2 +-
arch/arm/include/asm/barebox-arm.h | 6 ++++--
arch/arm/mach-rockchip/atf.c | 2 +-
4 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/arch/arm/cpu/common.c b/arch/arm/cpu/common.c
index 6b82ee8b810c..f03a39cc193a 100644
--- a/arch/arm/cpu/common.c
+++ b/arch/arm/cpu/common.c
@@ -114,8 +114,8 @@ void print_pbl_mem_layout(ulong membase, ulong endmem, ulong barebox_base)
#endif
printf("arm_mem_barebox_image = 0x%08lx+0x%08lx\n",
barebox_base, arm_mem_barebox_image_end(endmem) - barebox_base);
- printf("arm_mem_early_malloc = 0x%08lx+0x%08x\n",
- barebox_base - PBL_MALLOC_SIZE, PBL_MALLOC_SIZE);
+ printf("pbl_malloc area = 0x%08lx+0x%08x\n",
+ barebox_malloc_base(membase, endmem - membase), PBL_MALLOC_SIZE);
printf("membase = 0x%08lx+0x%08lx\n",
membase, endmem - membase);
}
diff --git a/arch/arm/cpu/uncompress.c b/arch/arm/cpu/uncompress.c
index 61bcba6e8549..2e5d60f6a39d 100644
--- a/arch/arm/cpu/uncompress.c
+++ b/arch/arm/cpu/uncompress.c
@@ -75,7 +75,7 @@ void __noreturn barebox_pbl_start(unsigned long membase, unsigned long memsize,
handoff_data = (void *)barebox_base + ALIGN(uncompressed_len, 8) + MAX_BSS_SIZE;
- pbl_malloc_init(barebox_base - PBL_MALLOC_SIZE, PBL_MALLOC_SIZE);
+ pbl_malloc_init(barebox_malloc_base(membase, memsize), PBL_MALLOC_SIZE);
#ifdef DEBUG
print_pbl_mem_layout(membase, endmem, barebox_base);
diff --git a/arch/arm/include/asm/barebox-arm.h b/arch/arm/include/asm/barebox-arm.h
index 38cceba010ed..f8fe377284f0 100644
--- a/arch/arm/include/asm/barebox-arm.h
+++ b/arch/arm/include/asm/barebox-arm.h
@@ -95,10 +95,12 @@ void *barebox_arm_boot_dtb(void);
* + BSS) rounded to SZ_1M
* ↓
* ---------------------- arm_mem_barebox_image() ---------------------
+ * ↕
+ * ----------------------- pbl_malloc area end ------------------------
* ↑
- * SZ_128K
+ * PBL_MALLOC_SIZE
* ↓
- * ------------------------ arm_mem_early_malloc ----------------------
+ * ----------------------- pbl_malloc area start ----------------------
*/
void print_pbl_mem_layout(ulong membase, ulong endmem, ulong barebox_base);
diff --git a/arch/arm/mach-rockchip/atf.c b/arch/arm/mach-rockchip/atf.c
index 14797a1e0601..f9dbc8b20c5a 100644
--- a/arch/arm/mach-rockchip/atf.c
+++ b/arch/arm/mach-rockchip/atf.c
@@ -173,7 +173,7 @@ static void rockchip_atf_load_bl31(void *fdt)
unsigned long bl31_ep;
mmu_early_enable(membase[0], memsize[0]);
- pbl_malloc_init(membase[0] + memsize[0] - PBL_MALLOC_SIZE, PBL_MALLOC_SIZE);
+ pbl_malloc_init(membase[0], memsize[0]);
bl31_ep = load_elf64_image_phdr(&bl31);
--
2.47.3
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-05-22 11:53 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-05-22 10:53 [PATCH master 0/6] ARM: unify pbl and proper malloc area start Ahmad Fatoum
2026-05-22 10:53 ` [PATCH master 1/6] arch: introduce new CONFIG_ARCH_HAS_MALLOC_SIZE Ahmad Fatoum
2026-05-22 10:53 ` [PATCH master 2/6] ARM: explicitly state CONFIG_MALLOC_SIZE in defconfigs Ahmad Fatoum
2026-05-22 10:53 ` [PATCH master 3/6] arch: introduce CONFIG_MALLOC_OFFSET Ahmad Fatoum
2026-05-22 10:53 ` [PATCH master 4/6] ARM: switch to CONFIG_MALLOC_OFFSET Ahmad Fatoum
2026-05-22 10:53 ` [PATCH master 5/6] ARM: configs: drop CONFIG_MALLOC_SIZE=0x0 as it's now the default Ahmad Fatoum
2026-05-22 10:53 ` [PATCH master 6/6] ARM: place PBL malloc area at start of barebox proper malloc area Ahmad Fatoum
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox