From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Sascha Hauer <s.hauer@pengutronix.de>,
Barebox List <barebox@lists.infradead.org>
Subject: Re: [PATCH v2 1/3] PBL: add common define for early malloc size
Date: Tue, 19 May 2026 07:23:05 +0200 [thread overview]
Message-ID: <b2a0d0a1-49ce-43d9-ae28-3d0c2bb59e43@pengutronix.de> (raw)
In-Reply-To: <20260518183250.240134-1-s.hauer@pengutronix.de>
On 5/18/26 20:32, Sascha Hauer wrote:
> Current all architectures using early malloc in the PBL use a pool size
> of 128KiB. Add a common define for it.
>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
> arch/arm/cpu/common.c | 3 ++-
> arch/arm/cpu/uncompress.c | 2 +-
> arch/arm/include/asm/barebox-arm.h | 2 --
> arch/mips/boot/uncompress.c | 4 ++--
> arch/riscv/include/asm/barebox-riscv.h | 2 +-
> include/pbl.h | 3 +++
> 6 files changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/arch/arm/cpu/common.c b/arch/arm/cpu/common.c
> index ccadb05ed9..6b82ee8b81 100644
> --- a/arch/arm/cpu/common.c
> +++ b/arch/arm/cpu/common.c
> @@ -4,6 +4,7 @@
> #include <common.h>
> #include <init.h>
> #include <elf.h>
> +#include <pbl.h>
> #include <linux/sizes.h>
> #include <asm/system_info.h>
> #include <asm/barebox-arm.h>
> @@ -114,7 +115,7 @@ void print_pbl_mem_layout(ulong membase, ulong endmem, ulong barebox_base)
> 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 - ARM_MEM_EARLY_MALLOC_SIZE, ARM_MEM_EARLY_MALLOC_SIZE);
> + barebox_base - PBL_MALLOC_SIZE, 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 38f7dbc113..4bade72ba4 100644
> --- a/arch/arm/cpu/uncompress.c
> +++ b/arch/arm/cpu/uncompress.c
> @@ -78,7 +78,7 @@ void __noreturn barebox_pbl_start(unsigned long membase, unsigned long memsize,
>
> handoff_data = (void *)barebox_base + uncompressed_len + MAX_BSS_SIZE;
>
> - free_mem_ptr = barebox_base - ARM_MEM_EARLY_MALLOC_SIZE;
> + free_mem_ptr = barebox_base - PBL_MALLOC_SIZE;
> free_mem_end_ptr = barebox_base;
>
> #ifdef DEBUG
> diff --git a/arch/arm/include/asm/barebox-arm.h b/arch/arm/include/asm/barebox-arm.h
> index 611b2bb2d6..9349e62fde 100644
> --- a/arch/arm/include/asm/barebox-arm.h
> +++ b/arch/arm/include/asm/barebox-arm.h
> @@ -140,8 +140,6 @@ static inline unsigned long arm_mem_ttb(unsigned long endmem)
> return endmem;
> }
>
> -#define ARM_MEM_EARLY_MALLOC_SIZE SZ_128K
> -
> static inline unsigned long arm_mem_ramoops(unsigned long endmem)
> {
> endmem = arm_mem_ttb(endmem);
> diff --git a/arch/mips/boot/uncompress.c b/arch/mips/boot/uncompress.c
> index 0630d03c6b..5c6ba39875 100644
> --- a/arch/mips/boot/uncompress.c
> +++ b/arch/mips/boot/uncompress.c
> @@ -34,8 +34,8 @@ void __section(.text_entry) barebox_pbl_start(void *fdt, void *fdt_end,
> memset(__bss_start, 0, __bss_stop - __bss_start);
>
> /* set 128 KiB at the end of the MALLOC_BASE for early malloc */
> - free_mem_ptr = TEXT_BASE - SZ_128K;
> - free_mem_end_ptr = free_mem_ptr + SZ_128K;
> + free_mem_ptr = TEXT_BASE - PBL_MALLOC_SIZE;
> + free_mem_end_ptr = free_mem_ptr + PBL_MALLOC_SIZE;
>
> piggy_len = (unsigned long)&input_data_end - (unsigned long)&input_data;
>
> diff --git a/arch/riscv/include/asm/barebox-riscv.h b/arch/riscv/include/asm/barebox-riscv.h
> index 083889817b..a3ae07277d 100644
> --- a/arch/riscv/include/asm/barebox-riscv.h
> +++ b/arch/riscv/include/asm/barebox-riscv.h
> @@ -54,7 +54,7 @@ static inline unsigned long riscv_mem_stack(unsigned long membase,
> static inline unsigned long riscv_mem_early_malloc(unsigned long membase,
> unsigned long endmem)
> {
> - return riscv_mem_stack(membase, endmem) - SZ_128K;
> + return riscv_mem_stack(membase, endmem) - PBL_MALLOC_SIZE;
> }
>
> static inline unsigned long riscv_mem_early_malloc_end(unsigned long membase,
> diff --git a/include/pbl.h b/include/pbl.h
> index 514f114370..5a444fb6fe 100644
> --- a/include/pbl.h
> +++ b/include/pbl.h
> @@ -10,6 +10,7 @@
>
> #include <linux/types.h>
> #include <linux/compiler.h>
> +#include <linux/sizes.h>
>
> extern unsigned long free_mem_ptr;
> extern unsigned long free_mem_end_ptr;
> @@ -33,6 +34,8 @@ int pbl_barebox_verify(const void *compressed_start, unsigned int len,
> const void *hash, unsigned int hash_len);
> int pbl_load_fdt(const void *fdt, void *dest, int destsize);
>
> +#define PBL_MALLOC_SIZE SZ_128K
> +
> #endif
>
> void __noreturn barebox_pbl_entry(ulong, ulong, void *);
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
next prev parent reply other threads:[~2026-05-19 5:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-18 18:32 Sascha Hauer
2026-05-18 18:32 ` [PATCH v2 2/3] pbl: cleanup early malloc Sascha Hauer
2026-05-18 18:32 ` [PATCH v2 3/3] ARM: rockchip: initialize PBL malloc Sascha Hauer
2026-05-19 5:23 ` Ahmad Fatoum [this message]
2026-05-19 6:15 ` [PATCH v2 1/3] PBL: add common define for early malloc size Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b2a0d0a1-49ce-43d9-ae28-3d0c2bb59e43@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=s.hauer@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox