summaryrefslogtreecommitdiff
path: root/common/init
diff options
context:
space:
mode:
authorMarek Vasut <[email protected]>2022-06-25 19:58:24 +0200
committerTom Rini <[email protected]>2022-07-08 12:20:28 -0400
commit5004901efb3b47f7fb22b29cdd127245d3814fd2 (patch)
tree33251d05271c64614671b46ab1bb5522535a4594 /common/init
parentcc5dfdee6b8a2c558f5c52f11004e26eb55fd830 (diff)
board_init: Do not reserve MALLOC_F area on stack if non-zero MALLOC_F_ADDR
In case the MALLOC_F_ADDR is set to non-zero value, the early malloc area is not going to be placed just below stack top, but elsewhere. Do not reserve MALLOC_F bytes in this case, as that wastes stack space and may even cause insufficient stack space in SPL. This functionality is particularly useful on i.MX8M, where the insufficient stack space can be triggered. Signed-off-by: Marek Vasut <[email protected]> Cc: Albert ARIBAUD <[email protected]> Cc: Fabio Estevam <[email protected]> Cc: Peng Fan <[email protected]> Cc: Simon Glass <[email protected]> Cc: Stefano Babic <[email protected]> Cc: Thomas Chou <[email protected]> Cc: Tom Rini <[email protected]>
Diffstat (limited to 'common/init')
-rw-r--r--common/init/board_init.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/common/init/board_init.c b/common/init/board_init.c
index eab5ee13953..6a550261778 100644
--- a/common/init/board_init.c
+++ b/common/init/board_init.c
@@ -78,9 +78,11 @@ __weak void board_init_f_init_stack_protection(void)
ulong board_init_f_alloc_reserve(ulong top)
{
/* Reserve early malloc arena */
+#ifndef CONFIG_MALLOC_F_ADDR
#if CONFIG_VAL(SYS_MALLOC_F_LEN)
top -= CONFIG_VAL(SYS_MALLOC_F_LEN);
#endif
+#endif
/* LAST : reserve GD (rounded up to a multiple of 16 bytes) */
top = rounddown(top-sizeof(struct global_data), 16);