diff mbox

[U-Boot,v3,4/7] malloc_f: add ARCH_MALLOC_F_LEN to specify SoC-default malloc_f_len

Message ID 1424409901-22755-5-git-send-email-yamada.m@jp.panasonic.com
State Rejected
Delegated to: Tom Rini
Headers show

Commit Message

Masahiro Yamada Feb. 20, 2015, 5:24 a.m. UTC
Now the default value of CONFIG_SYS_MALLOC_F_LEN can be overridden
by SoC Kconfig file, but we still have to add the same conditional
"if SYS_MALLOC_F" to every default.  Otherwise, a broken .config
file could be generated.  It is too painful.

This commit intends to solve it by introducing SoC-default
ARCH_MALLOC_F_LEN.  This works as follows:

 - If ARCH_MALLOC_F_LEN is defined, it overrides the default of
   SYS_MALLOC_F_LEN.  If you have the SoC-optimized value,
   you might wish to do this.

 - If ARCH_MALLOC_F_LEN is not defined, SYS_MALLOC_F_LEN is default
   to 0x400.  This is the global default and it should work well
   enough in most cases.

 - You can still change SYS_MALLOC_F_LEN per board, although you do
   not probably have to do so.  Per-board default should be saved
   into each defconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
---

Changes in v3:
  - Newly added

Changes in v2: None

 Kconfig                                 | 1 +
 arch/arm/cpu/armv7/tegra-common/Kconfig | 5 +++--
 arch/x86/Kconfig                        | 5 +++--
 3 files changed, 7 insertions(+), 4 deletions(-)

Comments

Simon Glass Feb. 20, 2015, 5:11 p.m. UTC | #1
Hi Masahiro,

On 19 February 2015 at 22:24, Masahiro Yamada <yamada.m@jp.panasonic.com> wrote:
> Now the default value of CONFIG_SYS_MALLOC_F_LEN can be overridden
> by SoC Kconfig file, but we still have to add the same conditional
> "if SYS_MALLOC_F" to every default.  Otherwise, a broken .config
> file could be generated.  It is too painful.
>
> This commit intends to solve it by introducing SoC-default
> ARCH_MALLOC_F_LEN.  This works as follows:
>
>  - If ARCH_MALLOC_F_LEN is defined, it overrides the default of
>    SYS_MALLOC_F_LEN.  If you have the SoC-optimized value,
>    you might wish to do this.
>
>  - If ARCH_MALLOC_F_LEN is not defined, SYS_MALLOC_F_LEN is default
>    to 0x400.  This is the global default and it should work well
>    enough in most cases.
>
>  - You can still change SYS_MALLOC_F_LEN per board, although you do
>    not probably have to do so.  Per-board default should be saved
>    into each defconfig.
>
> Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
> ---

Seems like a reasonable solution to me. I have to admit I prefer to
adding another option, but if that is the only way to avoid the broken
Kconfig (which I think works fine but could be quite confusing for
people) then so be it.

Reviewed-by: Simon Glass <sjg@chromium.org>
Masahiro Yamada Feb. 20, 2015, 5:11 p.m. UTC | #2
2015-02-20 14:24 GMT+09:00 Masahiro Yamada <yamada.m@jp.panasonic.com>:
> Now the default value of CONFIG_SYS_MALLOC_F_LEN can be overridden
> by SoC Kconfig file, but we still have to add the same conditional
> "if SYS_MALLOC_F" to every default.  Otherwise, a broken .config
> file could be generated.  It is too painful.
>
> This commit intends to solve it by introducing SoC-default
> ARCH_MALLOC_F_LEN.  This works as follows:
>
>  - If ARCH_MALLOC_F_LEN is defined, it overrides the default of
>    SYS_MALLOC_F_LEN.  If you have the SoC-optimized value,
>    you might wish to do this.
>
>  - If ARCH_MALLOC_F_LEN is not defined, SYS_MALLOC_F_LEN is default
>    to 0x400.  This is the global default and it should work well
>    enough in most cases.
>
>  - You can still change SYS_MALLOC_F_LEN per board, although you do
>    not probably have to do so.  Per-board default should be saved
>    into each defconfig.
>
> Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
> ---

Sorry, this patch does not work at all.
I was completely misunderstanding.

I take it back.
diff mbox

Patch

diff --git a/Kconfig b/Kconfig
index 351e5c9..cb5a6a8 100644
--- a/Kconfig
+++ b/Kconfig
@@ -70,6 +70,7 @@  config SYS_MALLOC_F
 config SYS_MALLOC_F_LEN
 	hex "Size of malloc() pool before relocation"
 	depends on SYS_MALLOC_F
+	default ARCH_MALLOC_F_LEN if ARCH_MALLOC_F_LEN
 	default 0x400
 	help
 	  Before relocation memory is very limited on many platforms. Still,
diff --git a/arch/arm/cpu/armv7/tegra-common/Kconfig b/arch/arm/cpu/armv7/tegra-common/Kconfig
index 8b51558..c326106 100644
--- a/arch/arm/cpu/armv7/tegra-common/Kconfig
+++ b/arch/arm/cpu/armv7/tegra-common/Kconfig
@@ -20,8 +20,9 @@  endchoice
 config SYS_MALLOC_F
 	default y
 
-config SYS_MALLOC_F_LEN
-	default 0x1800 if SYS_MALLOC_F
+config ARCH_MALLOC_F_LEN
+	hex
+	default 0x1800
 
 config USE_PRIVATE_LIBGCC
 	default y if SPL_BUILD
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 65909e7..0e49dd3 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -79,8 +79,9 @@  config DM_SERIAL
 config SYS_MALLOC_F
 	default y
 
-config SYS_MALLOC_F_LEN
-	default 0x800 if SYS_MALLOC_F
+config ARCH_MALLOC_F_LEN
+	hex
+	default 0x800
 
 config RAMBASE
 	hex