* [PATCH v3 09/20] mips: add a option to support not reserving malloc space on initial stack
@ 2020-01-21 8:18 Weijie Gao
2020-01-21 8:38 ` Stefan Roese
2020-02-10 16:17 ` Daniel Schwierzeck
0 siblings, 2 replies; 3+ messages in thread
From: Weijie Gao @ 2020-01-21 8:18 UTC (permalink / raw)
To: u-boot
The initial stack on some platforms is too small to hold a large malloc
space. This patch adds a option to allow these platforms not reserving the
malloc space on initial stack. These platforms should set the malloc base
after DRAM is usable.
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
---
Changes since v2: none
---
arch/mips/Kconfig | 18 ++++++++++++++++++
arch/mips/cpu/start.S | 6 ++++--
2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index bf30a56101..5f82caf8be 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -317,6 +317,24 @@ config NEW_EXCEPTION_VECTOR_BASE
help
The exception vector base to be restored before booting linux kernel
+config INIT_STACK_WITHOUT_MALLOC_F
+ bool "Do not reserve malloc space on initial stack"
+ default n
+ help
+ Enable this option if you don't want to reserve malloc space on
+ initial stack. This is useful if the initial stack can't hold large
+ malloc space. Platform should set the malloc_base later when DRAM is
+ ready to use.
+
+config SPL_INIT_STACK_WITHOUT_MALLOC_F
+ bool "Do not reserve malloc space on initial stack in SPL"
+ default n
+ help
+ Enable this option if you don't want to reserve malloc space on
+ initial stack. This is useful if the initial stack can't hold large
+ malloc space. Platform should set the malloc_base later when DRAM is
+ ready to use.
+
endmenu
menu "OS boot interface"
diff --git a/arch/mips/cpu/start.S b/arch/mips/cpu/start.S
index dd93df9e4a..6de9a2f362 100644
--- a/arch/mips/cpu/start.S
+++ b/arch/mips/cpu/start.S
@@ -59,7 +59,8 @@
sp, sp, GD_SIZE # reserve space for gd
and sp, sp, t0 # force 16 byte alignment
move k0, sp # save gd pointer
-#if CONFIG_VAL(SYS_MALLOC_F_LEN)
+#if CONFIG_VAL(SYS_MALLOC_F_LEN) && \
+ !CONFIG_IS_ENABLED(INIT_STACK_WITHOUT_MALLOC_F)
li t2, CONFIG_VAL(SYS_MALLOC_F_LEN)
PTR_SUBU \
sp, sp, t2 # reserve space for early malloc
@@ -75,7 +76,8 @@
blt t0, t1, 1b
nop
-#if CONFIG_VAL(SYS_MALLOC_F_LEN)
+#if CONFIG_VAL(SYS_MALLOC_F_LEN) && \
+ !CONFIG_IS_ENABLED(INIT_STACK_WITHOUT_MALLOC_F)
PTR_S sp, GD_MALLOC_BASE(k0) # gd->malloc_base offset
#endif
.endm
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH v3 09/20] mips: add a option to support not reserving malloc space on initial stack
2020-01-21 8:18 [PATCH v3 09/20] mips: add a option to support not reserving malloc space on initial stack Weijie Gao
@ 2020-01-21 8:38 ` Stefan Roese
2020-02-10 16:17 ` Daniel Schwierzeck
1 sibling, 0 replies; 3+ messages in thread
From: Stefan Roese @ 2020-01-21 8:38 UTC (permalink / raw)
To: u-boot
On 21.01.20 09:18, Weijie Gao wrote:
> The initial stack on some platforms is too small to hold a large malloc
> space. This patch adds a option to allow these platforms not reserving the
> malloc space on initial stack. These platforms should set the malloc base
> after DRAM is usable.
>
> Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
> ---
> Changes since v2: none
Reviewed-by: Stefan Roese <sr@denx.de>
Thanks,
Stefan
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v3 09/20] mips: add a option to support not reserving malloc space on initial stack
2020-01-21 8:18 [PATCH v3 09/20] mips: add a option to support not reserving malloc space on initial stack Weijie Gao
2020-01-21 8:38 ` Stefan Roese
@ 2020-02-10 16:17 ` Daniel Schwierzeck
1 sibling, 0 replies; 3+ messages in thread
From: Daniel Schwierzeck @ 2020-02-10 16:17 UTC (permalink / raw)
To: u-boot
Am 21.01.20 um 09:18 schrieb Weijie Gao:
> The initial stack on some platforms is too small to hold a large malloc
> space. This patch adds a option to allow these platforms not reserving the
> malloc space on initial stack. These platforms should set the malloc base
> after DRAM is usable.
>
> Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
> ---
> Changes since v2: none
> ---
> arch/mips/Kconfig | 18 ++++++++++++++++++
> arch/mips/cpu/start.S | 6 ++++--
> 2 files changed, 22 insertions(+), 2 deletions(-)
>
applied to u-boot-mips, thanks.
--
- Daniel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-02-10 16:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-21 8:18 [PATCH v3 09/20] mips: add a option to support not reserving malloc space on initial stack Weijie Gao
2020-01-21 8:38 ` Stefan Roese
2020-02-10 16:17 ` Daniel Schwierzeck
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.