Skip to contentSkip to conversation

malloc_simple: Add support for switching to DRAM heap

PATCH Superseded Hans de Goede 3 participants 21 messages Sep 13, 2015 – Sep 22, 2015

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover malloc_simple: Add support for switching to DRAM heap

Hi Simon,

Here is a patch-set to add support to keep using simple-malloc after dram is available in the SPL, using the spl stack relocation function to switch to a new heap which uses a chunk of the now in DRAM stack.

I think you're the best candidate to review and merge the core patches (patches 1 - 4).

I'll merge the sunxi patches through my tree once the core patches are in place. Esp. the patch to make sunxi use CONFIG_SPL_STACK_R is likely to cause conflicts if not merged through the sunxi tree.

Regards,

Hans

p.s.

In case it is not clear, these patches are intended for the next devel cycle.

#1 lore raw

PATCH 1/7 spl: spl_relocate_stack_gd: Do not unnecessarily clear bss

spl_relocate_stack_gd only gets called from arch/arm/lib/crt0.S which clears the bss directly after calling it, so there is no need to clear it from spl_relocate_stack_gd.

---
 common/spl/spl.c | 3 ---
 1 file changed, 3 deletions(-)
common/spl/spl.c +0 -3
index a5892d7..b09a626 100644
@@ -347,9 +347,6 @@ ulong spl_relocate_stack_gd(void)
 	memcpy(new_gd, (void *)gd, sizeof(gd_t));
 	gd = new_gd;
 
-	/* Clear the BSS. */
-	memset(__bss_start, 0, __bss_end - __bss_start);
-
 	return ptr;
 #else
 	return 0;
Signature · 1 line
2.4.3
#2 lore raw

PATCH 1/7 spl: spl_relocate_stack_gd: Do not unnecessarily clear bss

Hi Hans,

Quoted 9 lines · Hans de Goede

spl_relocate_stack_gd only gets called from arch/arm/lib/crt0.S which clears the bss directly after calling it, so there is no need to clear it from spl_relocate_stack_gd.

---
 common/spl/spl.c | 3 ---
 1 file changed, 3 deletions(-)

I think it makes sense to move the BSS clear to C, but that would be separate from your patch. Yes we should remove this duplication.

See also this:

http://patchwork.ozlabs.org/patch/512030/

Quoted 16 lines
common/spl/spl.c +0 -4
index a5892d7..b09a626 100644
@@ -347,9 +347,6 @@ ulong spl_relocate_stack_gd(void)
        memcpy(new_gd, (void *)gd, sizeof(gd_t));
        gd = new_gd;
 
-       /* Clear the BSS. */
-       memset(__bss_start, 0, __bss_end - __bss_start);
-
        return ptr;
 #else
        return 0;
--
Quoted 2 lines

2.4.3

Regards,
Simon

#3 lore raw

PATCH 2/7 malloc_simple: Fix malloc_ptr calculation

In reply to Hans de Goede

From: Philipp Rosenberger <[email protected]>

The gd->malloc_ptr and the gd->malloc_limit are offsets to gd->malloc_base. But the addr variable contains the absolute address. The new_ptr must be:
addr + bytes - gd->malloc_base.

---
 common/malloc_simple.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/malloc_simple.c +1 -1
index 134e059..c745863 100644
@@ -32,7 +32,7 @@ void *memalign_simple(size_t align, size_t bytes)
 	void *ptr;
 
 	addr = ALIGN(gd->malloc_base + gd->malloc_ptr, align);
-	new_ptr = addr + bytes;
+	new_ptr = addr + bytes - gd->malloc_base;
 	if (new_ptr > gd->malloc_limit)
 		return NULL;
 	ptr = map_sysmem(addr, bytes);
Signature · 1 line
2.4.3
#4 lore raw

PATCH 2/7 malloc_simple: Fix malloc_ptr calculation

Quoted 6 lines · Hans de Goede

From: Philipp Rosenberger <[email protected]>

The gd->malloc_ptr and the gd->malloc_limit are offsets to gd->malloc_base. But the addr variable contains the absolute address. The new_ptr must be:
addr + bytes - gd->malloc_base.

Quoted 6 lines
---
 common/malloc_simple.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Eek! Nice to find this one.

Quoted 17 lines
common/malloc_simple.c +1 -2
index 134e059..c745863 100644
@@ -32,7 +32,7 @@ void *memalign_simple(size_t align, size_t bytes)
        void *ptr;
 
        addr = ALIGN(gd->malloc_base + gd->malloc_ptr, align);
-       new_ptr = addr + bytes;
+       new_ptr = addr + bytes - gd->malloc_base;
        if (new_ptr > gd->malloc_limit)
                return NULL;
        ptr = map_sysmem(addr, bytes);
--

2.4.3

#5 lore raw

PATCH 3/7 malloc_simple: Add Kconfig option for using only malloc_simple in the SPL

In reply to Hans de Goede

common/dlmalloc.c is quite big, both in .text and .data usage, therefor on some boards the SPL is build to use only malloc_simple.c and not the dlmalloc.c code. This is done in various include/configs/foo.h with the following construct:

This commit introduces a SPL_MALLOC_SIMPLE Kconfig bool which allows selecting this functionality through Kconfig instead.

---
 Kconfig                | 10 ++++++++++
 common/malloc_simple.c |  3 ++-
 include/_exports.h     |  3 ++-
 include/exports.h      |  3 ++-
 include/malloc.h       |  3 ++-
 5 files changed, 18 insertions(+), 4 deletions(-)
Kconfig +10 -0
index 05a34f7..0ae4fab 100644
@@ -114,6 +114,16 @@ config SPL
 	help
 	  If you want to build SPL as well as the normal image, say Y.
 
+config SPL_MALLOC_SIMPLE
+	bool
+	depends on SPL
+	prompt "Only use malloc_simple functions in the spl"
+	help
+	  Say Y here to only use the *_simple malloc functions from
+	  malloc_simple.c, rather then using the versions from dlmalloc.c
+	  this will make the SPL binary smaller at the cost of more heap
+	  usage as the *_simple malloc functions do not re-use free-ed mem.
+
 config SPL_STACK_R
 	depends on SPL
 	bool "Enable SDRAM location for SPL stack"
common/malloc_simple.c +2 -1
index c745863..e9c1eaa 100644
@@ -40,7 +40,8 @@ void *memalign_simple(size_t align, size_t bytes)
 	return ptr;
 }
 
-#ifdef CONFIG_SYS_MALLOC_SIMPLE
+#if (defined CONFIG_SPL_BUILD && defined CONFIG_SPL_MALLOC_SIMPLE) || \
+    (defined CONFIG_SYS_MALLOC_SIMPLE)
 void *calloc(size_t nmemb, size_t elem_size)
 {
 	size_t size = nmemb * elem_size;
include/_exports.h +2 -1
index 74a882a..f811c5d 100644
@@ -23,7 +23,8 @@
 	EXPORT_FUNC(dummy, void, free_hdlr, void)
 #endif
 	EXPORT_FUNC(malloc, void *, malloc, size_t)
-#ifndef CONFIG_SYS_MALLOC_SIMPLE
+#if !(defined CONFIG_SPL_BUILD && defined CONFIG_SPL_MALLOC_SIMPLE) && \
+    !(defined CONFIG_SYS_MALLOC_SIMPLE)
 	EXPORT_FUNC(free, void, free, void *)
 #endif
 	EXPORT_FUNC(udelay, void, udelay, unsigned long)
include/exports.h +2 -1
index a3e0469..8171b31 100644
@@ -19,7 +19,8 @@ int printf(const char* fmt, ...);
 void install_hdlr(int, interrupt_handler_t, void*);
 void free_hdlr(int);
 void *malloc(size_t);
-#ifndef CONFIG_SYS_MALLOC_SIMPLE
+#if !(defined CONFIG_SPL_BUILD && defined CONFIG_SPL_MALLOC_SIMPLE) && \
+    !(defined CONFIG_SYS_MALLOC_SIMPLE)
 void free(void*);
 #endif
 void __udelay(unsigned long);
include/malloc.h +2 -1
index f4da9e6..e5592fc 100644
@@ -872,7 +872,8 @@ extern Void_t*     sbrk();
 
 #else
 
-#ifdef CONFIG_SYS_MALLOC_SIMPLE
+#if (defined CONFIG_SPL_BUILD && defined CONFIG_SPL_MALLOC_SIMPLE) || \
+    (defined CONFIG_SYS_MALLOC_SIMPLE)
 #define malloc malloc_simple
 #define realloc realloc_simple
 #define memalign memalign_simple
Signature · 1 line
2.4.3
#6 lore raw

PATCH 3/7 malloc_simple: Add Kconfig option for using only malloc_simple in the SPL

Hi Hans,

Quoted 5 lines · Hans de Goede

common/dlmalloc.c is quite big, both in .text and .data usage, therefor on some boards the SPL is build to use only malloc_simple.c and not the dlmalloc.c code. This is done in various include/configs/foo.h with the following construct:

Was there a '#' at the start of this missing line?

Quoted 17 lines

This commit introduces a SPL_MALLOC_SIMPLE Kconfig bool which allows selecting this functionality through Kconfig instead.

---
 Kconfig                | 10 ++++++++++
 common/malloc_simple.c |  3 ++-
 include/_exports.h     |  3 ++-
 include/exports.h      |  3 ++-
 include/malloc.h       |  3 ++-
 5 files changed, 18 insertions(+), 4 deletions(-)
Kconfig +0 -0
index 05a34f7..0ae4fab 100644

Kconfig config SPL · line 117

Quoted 4 lines
Kconfig +1 -0
@@ -114,6 +114,16 @@ config SPL
        help
          If you want to build SPL as well as the normal image, say Y.
 
+config SPL_MALLOC_SIMPLE

If you made it SPL_SYS_MALLOC_SIMPLE...

Quoted 17 lines
Kconfig +9 -0
+       bool
+       depends on SPL
+       prompt "Only use malloc_simple functions in the spl"
+       help
+         Say Y here to only use the *_simple malloc functions from
+         malloc_simple.c, rather then using the versions from dlmalloc.c
+         this will make the SPL binary smaller at the cost of more heap
+         usage as the *_simple malloc functions do not re-use free-ed mem.
+
 config SPL_STACK_R
        depends on SPL
        bool "Enable SDRAM location for SPL stack"
common/malloc_simple.c +0 -0
index c745863..e9c1eaa 100644

common/malloc_simple.c void *memalign_simple(size_t align, size_t bytes) · line 44

Quoted 6 lines
common/malloc_simple.c +2 -1
@@ -40,7 +40,8 @@ void *memalign_simple(size_t align, size_t bytes)
        return ptr;
 }
 
-#ifdef CONFIG_SYS_MALLOC_SIMPLE
+#if (defined CONFIG_SPL_BUILD && defined CONFIG_SPL_MALLOC_SIMPLE) || \
+    (defined CONFIG_SYS_MALLOC_SIMPLE)

then I think this could become:

#if CONFIG_IS_ENABLED(SYS_MALLOC_SIMPLE)

Quoted 46 lines
common/malloc_simple.c +0 -0
 void *calloc(size_t nmemb, size_t elem_size)
 {
        size_t size = nmemb * elem_size;
include/_exports.h +2 -1
index 74a882a..f811c5d 100644
@@ -23,7 +23,8 @@
        EXPORT_FUNC(dummy, void, free_hdlr, void)
 #endif
        EXPORT_FUNC(malloc, void *, malloc, size_t)
-#ifndef CONFIG_SYS_MALLOC_SIMPLE
+#if !(defined CONFIG_SPL_BUILD && defined CONFIG_SPL_MALLOC_SIMPLE) && \
+    !(defined CONFIG_SYS_MALLOC_SIMPLE)
        EXPORT_FUNC(free, void, free, void *)
 #endif
        EXPORT_FUNC(udelay, void, udelay, unsigned long)
include/exports.h +2 -1
index a3e0469..8171b31 100644
@@ -19,7 +19,8 @@ int printf(const char* fmt, ...);
 void install_hdlr(int, interrupt_handler_t, void*);
 void free_hdlr(int);
 void *malloc(size_t);
-#ifndef CONFIG_SYS_MALLOC_SIMPLE
+#if !(defined CONFIG_SPL_BUILD && defined CONFIG_SPL_MALLOC_SIMPLE) && \
+    !(defined CONFIG_SYS_MALLOC_SIMPLE)
 void free(void*);
 #endif
 void __udelay(unsigned long);
include/malloc.h +2 -2
index f4da9e6..e5592fc 100644
@@ -872,7 +872,8 @@ extern Void_t*     sbrk();
 
 #else
 
-#ifdef CONFIG_SYS_MALLOC_SIMPLE
+#if (defined CONFIG_SPL_BUILD && defined CONFIG_SPL_MALLOC_SIMPLE) || \
+    (defined CONFIG_SYS_MALLOC_SIMPLE)
 #define malloc malloc_simple
 #define realloc realloc_simple
 #define memalign memalign_simple
--
Quoted 2 lines

2.4.3

Regards,
Simon

#7 lore raw

PATCH 3/7 malloc_simple: Add Kconfig option for using only malloc_simple in the SPL

Hi,

Quoted 10 lines · Simon Glass

Hi Hans,

Quoted 5 lines · Hans de Goede

common/dlmalloc.c is quite big, both in .text and .data usage, therefor on some boards the SPL is build to use only malloc_simple.c and not the dlmalloc.c code. This is done in various include/configs/foo.h with the following construct:

Was there a '#' at the start of this missing line?

Yep, I keep falling over git commit eating up any lines starting with a # when quoting code snippets in commit messages...

I will fix this and send a v2.

Quoted 44 lines
Quoted 17 lines

This commit introduces a SPL_MALLOC_SIMPLE Kconfig bool which allows selecting this functionality through Kconfig instead.

---
  Kconfig                | 10 ++++++++++
  common/malloc_simple.c |  3 ++-
  include/_exports.h     |  3 ++-
  include/exports.h      |  3 ++-
  include/malloc.h       |  3 ++-
  5 files changed, 18 insertions(+), 4 deletions(-)
Kconfig +0 -0
index 05a34f7..0ae4fab 100644

Kconfig config SPL · line 117

Quoted 4 lines
Kconfig +1 -0
@@ -114,6 +114,16 @@ config SPL
         help
           If you want to build SPL as well as the normal image, say Y.
 
+config SPL_MALLOC_SIMPLE

If you made it SPL_SYS_MALLOC_SIMPLE...

Quoted 20 lines
Kconfig +9 -0
+       bool
+       depends on SPL
+       prompt "Only use malloc_simple functions in the spl"
+       help
+         Say Y here to only use the *_simple malloc functions from
+         malloc_simple.c, rather then using the versions from dlmalloc.c
+         this will make the SPL binary smaller at the cost of more heap
+         usage as the *_simple malloc functions do not re-use free-ed mem.
+
  config SPL_STACK_R
         depends on SPL
         bool "Enable SDRAM location for SPL stack"
common/malloc_simple.c +0 -0
index c745863..e9c1eaa 100644
@@ -40,7 +40,8 @@ void *memalign_simple(size_t align, size_t bytes)
         return ptr;
  }
 
Quoted 7 lines

common/malloc_simple.c void *memalign_simple(size_t align, size_t bytes) · line 44

Quoted 3 lines
common/malloc_simple.c +2 -1
-#ifdef CONFIG_SYS_MALLOC_SIMPLE
+#if (defined CONFIG_SPL_BUILD && defined CONFIG_SPL_MALLOC_SIMPLE) || \
+    (defined CONFIG_SYS_MALLOC_SIMPLE)

then I think this could become:

#if CONFIG_IS_ENABLED(SYS_MALLOC_SIMPLE)

I think you're right, good one. I'll give this a spin and if it works include the change in V2.

Quoted 39 lines
Quoted 39 lines
common/malloc_simple.c +0 -0
  void *calloc(size_t nmemb, size_t elem_size)
  {
         size_t size = nmemb * elem_size;
include/_exports.h +2 -1
index 74a882a..f811c5d 100644
@@ -23,7 +23,8 @@
         EXPORT_FUNC(dummy, void, free_hdlr, void)
  #endif
         EXPORT_FUNC(malloc, void *, malloc, size_t)
-#ifndef CONFIG_SYS_MALLOC_SIMPLE
+#if !(defined CONFIG_SPL_BUILD && defined CONFIG_SPL_MALLOC_SIMPLE) && \
+    !(defined CONFIG_SYS_MALLOC_SIMPLE)
         EXPORT_FUNC(free, void, free, void *)
  #endif
         EXPORT_FUNC(udelay, void, udelay, unsigned long)
include/exports.h +2 -1
index a3e0469..8171b31 100644
@@ -19,7 +19,8 @@ int printf(const char* fmt, ...);
  void install_hdlr(int, interrupt_handler_t, void*);
  void free_hdlr(int);
  void *malloc(size_t);
-#ifndef CONFIG_SYS_MALLOC_SIMPLE
+#if !(defined CONFIG_SPL_BUILD && defined CONFIG_SPL_MALLOC_SIMPLE) && \
+    !(defined CONFIG_SYS_MALLOC_SIMPLE)
  void free(void*);
  #endif
  void __udelay(unsigned long);
include/malloc.h +0 -0
index f4da9e6..e5592fc 100644
@@ -872,7 +872,8 @@ extern Void_t*     sbrk();
 
  #else
 
Quoted 13 lines
Quoted 9 lines
include/malloc.h +2 -2
-#ifdef CONFIG_SYS_MALLOC_SIMPLE
+#if (defined CONFIG_SPL_BUILD && defined CONFIG_SPL_MALLOC_SIMPLE) || \
+    (defined CONFIG_SYS_MALLOC_SIMPLE)
  #define malloc malloc_simple
  #define realloc realloc_simple
  #define memalign memalign_simple
--

2.4.3

Regards,
Simon

Regards,

Hans

#8 lore raw

PATCH 4/7 malloc_simple: Add support for switching to DRAM heap

In reply to Hans de Goede

malloc_simple uses a part of the stack as heap, initially it uses SYS_MALLOC_F_LEN bytes which typically is quite small as the initial stacks sits in SRAM and we do not have that much SRAM to work with.

When DRAM becomes available we may switch the stack from SRAM to DRAM to give use more room. This commit adds support for also switching to a new bigger malloc_simple heap located in the new stack.

---
 Kconfig          | 10 ++++++++++
 common/spl/spl.c |  9 +++++++++
 2 files changed, 19 insertions(+)
Kconfig +10 -0
index 0ae4fab..86088bc 100644
@@ -142,6 +142,16 @@ config SPL_STACK_R_ADDR
 	  Specify the address in SDRAM for the SPL stack. This will be set up
 	  before board_init_r() is called.
 
+config SPL_STACK_R_MALLOC_SIMPLE_LEN
+	depends on SPL_STACK_R && SPL_MALLOC_SIMPLE
+	hex "Size of malloc_simple heap after switching to DRAM SPL stack"
+	default 0x100000
+	help
+	  Specify the amount of the stack to use as memory pool for
+	  malloc_simple after switching the stack to DRAM. This may be set
+	  to give board_init_r() a larger heap then the initial heap in
+	  SRAM which is limited to SYS_MALLOC_F_LEN bytes.
+
 config TPL
 	bool
 	depends on SPL && SUPPORT_TPL
common/spl/spl.c +9 -0
index b09a626..8c2d109 100644
@@ -347,6 +347,15 @@ ulong spl_relocate_stack_gd(void)
 	memcpy(new_gd, (void *)gd, sizeof(gd_t));
 	gd = new_gd;
 
+#ifdef CONFIG_SPL_MALLOC_SIMPLE
+	if (CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN) {
+		ptr -= CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN;
+		gd->malloc_base = ptr;
+		gd->malloc_limit = CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN;
+		gd->malloc_ptr = 0;
+	}
+#endif
+
 	return ptr;
 #else
 	return 0;
Signature · 1 line
2.4.3
#9 lore raw

PATCH 4/7 malloc_simple: Add support for switching to DRAM heap

Hi Hans,

Quoted 40 lines · Hans de Goede

malloc_simple uses a part of the stack as heap, initially it uses SYS_MALLOC_F_LEN bytes which typically is quite small as the initial stacks sits in SRAM and we do not have that much SRAM to work with.

When DRAM becomes available we may switch the stack from SRAM to DRAM to give use more room. This commit adds support for also switching to a new bigger malloc_simple heap located in the new stack.

---
 Kconfig          | 10 ++++++++++
 common/spl/spl.c |  9 +++++++++
 2 files changed, 19 insertions(+)
Kconfig +10 -0
index 0ae4fab..86088bc 100644
@@ -142,6 +142,16 @@ config SPL_STACK_R_ADDR
          Specify the address in SDRAM for the SPL stack. This will be set up
          before board_init_r() is called.
 
+config SPL_STACK_R_MALLOC_SIMPLE_LEN
+       depends on SPL_STACK_R && SPL_MALLOC_SIMPLE
+       hex "Size of malloc_simple heap after switching to DRAM SPL stack"
+       default 0x100000
+       help
+         Specify the amount of the stack to use as memory pool for
+         malloc_simple after switching the stack to DRAM. This may be set
+         to give board_init_r() a larger heap then the initial heap in
+         SRAM which is limited to SYS_MALLOC_F_LEN bytes.
+
 config TPL
        bool
        depends on SPL && SUPPORT_TPL
common/spl/spl.c +0 -0
index b09a626..8c2d109 100644

common/spl/spl.c ulong spl_relocate_stack_gd(void) · line 351

Quoted 5 lines
common/spl/spl.c +2 -0
@@ -347,6 +347,15 @@ ulong spl_relocate_stack_gd(void)
        memcpy(new_gd, (void *)gd, sizeof(gd_t));
        gd = new_gd;
 
+#ifdef CONFIG_SPL_MALLOC_SIMPLE
+       if (CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN) {

Do you think we could do:

if (IS_ENABLED(CONFIG_SPL_MALLOC_SIMPLE) &&
CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN)

to avoid the #ifdef?

Quoted 11 lines
common/spl/spl.c +7 -1
+               ptr -= CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN;
+               gd->malloc_base = ptr;
+               gd->malloc_limit = CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN;
+               gd->malloc_ptr = 0;
+       }
+#endif
+
        return ptr;
 #else
        return 0;
--
Quoted 2 lines

2.4.3

I have to say I worry a little bit about combinatoric explosion with this series. But I can't immediately see a better way.

Regards,
Simon

#10 lore raw

PATCH 4/7 malloc_simple: Add support for switching to DRAM heap

Hi,

Thanks for all the reviews.

Quoted 51 lines · Simon Glass

Hi Hans,

Quoted 40 lines · Hans de Goede

malloc_simple uses a part of the stack as heap, initially it uses SYS_MALLOC_F_LEN bytes which typically is quite small as the initial stacks sits in SRAM and we do not have that much SRAM to work with.

When DRAM becomes available we may switch the stack from SRAM to DRAM to give use more room. This commit adds support for also switching to a new bigger malloc_simple heap located in the new stack.

---
  Kconfig          | 10 ++++++++++
  common/spl/spl.c |  9 +++++++++
  2 files changed, 19 insertions(+)
Kconfig +10 -0
index 0ae4fab..86088bc 100644
@@ -142,6 +142,16 @@ config SPL_STACK_R_ADDR
           Specify the address in SDRAM for the SPL stack. This will be set up
           before board_init_r() is called.
 
+config SPL_STACK_R_MALLOC_SIMPLE_LEN
+       depends on SPL_STACK_R && SPL_MALLOC_SIMPLE
+       hex "Size of malloc_simple heap after switching to DRAM SPL stack"
+       default 0x100000
+       help
+         Specify the amount of the stack to use as memory pool for
+         malloc_simple after switching the stack to DRAM. This may be set
+         to give board_init_r() a larger heap then the initial heap in
+         SRAM which is limited to SYS_MALLOC_F_LEN bytes.
+
  config TPL
         bool
         depends on SPL && SUPPORT_TPL
common/spl/spl.c +0 -0
index b09a626..8c2d109 100644

common/spl/spl.c ulong spl_relocate_stack_gd(void) · line 351

Quoted 5 lines
common/spl/spl.c +2 -0
@@ -347,6 +347,15 @@ ulong spl_relocate_stack_gd(void)
         memcpy(new_gd, (void *)gd, sizeof(gd_t));
         gd = new_gd;
 
+#ifdef CONFIG_SPL_MALLOC_SIMPLE
+       if (CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN) {

Do you think we could do:

Quoted 4 lines

if (IS_ENABLED(CONFIG_SPL_MALLOC_SIMPLE) &&
CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN)

to avoid the #ifdef?

AFAIK we cannot do that because CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN will not be defined if CONFIG_SPL_MALLOC_SIMPLE is not set, so then the c compiler will end up looking for a symbol called CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN and will not find it.

Quoted 8 lines
Quoted 8 lines
common/spl/spl.c +7 -0
+               ptr -= CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN;
+               gd->malloc_base = ptr;
+               gd->malloc_limit = CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN;
+               gd->malloc_ptr = 0;
+       }
+#endif
+
         return ptr;
Quoted 8 lines
Quoted 5 lines
common/spl/spl.c +0 -1
  #else
         return 0;
--

2.4.3

I have to say I worry a little bit about combinatoric explosion with this series. But I can't immediately see a better way.

We could simply always relocate the heap when using malloc_simple and CONFIG_SPL_STACK_R is set, code wise this would mean dropping the CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN != 0 check, simplifying the code somewhat (and allowing us to switch to using if (IS_ENABLED(CONFIG_SPL_MALLOC_SIMPLE) instead #ifdef.

This will also half the number of memory layout variants we have in the SPL, thus reducing the combinatoric explosion.

Downsides are:

1) If someone sets CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN to 0 things will break. We can add text to the Kconfig help saying not to do that, which IMHO is a good enough fix for this

2) This forces all users who use both SPL_STACK_R and SPL_SYS_MALLOC_SIMPLE to also get their malloc_simple heap relocated, and I guess this may be undesirable in some cases, although I cannot think of one.

2. is the reason why I wrote this patch as it is written, I have already considered going the suggested route while writing the patch. I'm fine either way though, if you think that making heap reloc mandatory when using both SPL_STACK_R and SPL_SYS_MALLOC_SIMPLE that is fine with me.

Regards,

Hans

#11 lore raw

PATCH 5/7 sunxi: Simplify spl board_init_f function

In reply to Hans de Goede

crt0.S will both memset the bss sectioan and call board_init_r for us, so there is no need to do either ourselves.

---
 arch/arm/cpu/armv7/sunxi/board.c | 5 -----
 1 file changed, 5 deletions(-)
arch/arm/cpu/armv7/sunxi/board.c +0 -5
index b40198b..8883cf5 100644
@@ -198,11 +198,6 @@ void board_init_f(ulong dummy)
 	i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
 #endif
 	sunxi_board_init();
-
-	/* Clear the BSS. */
-	memset(__bss_start, 0, __bss_end - __bss_start);
-
-	board_init_r(NULL, 0);
 }
 #endif
 
Signature · 1 line
2.4.3
#13 lore raw

PATCH 6/7 sunxi: Enable CONFIG_SPL_STACK_R

In reply to Hans de Goede

Select CONFIG_SPL_STACK_R for sunxi boards, this gives us much more room on the stack once we've the DRAM running.

Besides being a good change to have on itself, this also paves the way for switching to using malloc_simple in the SPL which cuts of close to 4KiB of the SPL size.

---
 arch/arm/Kconfig                             | 1 +
 configs/A10-OLinuXino-Lime_defconfig         | 1 +
 configs/A10s-OLinuXino-M_defconfig           | 1 +
 configs/A13-OLinuXinoM_defconfig             | 1 +
 configs/A13-OLinuXino_defconfig              | 1 +
 configs/A20-OLinuXino-Lime2_defconfig        | 1 +
 configs/A20-OLinuXino-Lime_defconfig         | 1 +
 configs/A20-OLinuXino_MICRO_defconfig        | 1 +
 configs/A20-Olimex-SOM-EVB_defconfig         | 1 +
 configs/Ainol_AW1_defconfig                  | 1 +
 configs/Ampe_A76_defconfig                   | 1 +
 configs/Auxtek-T003_defconfig                | 1 +
 configs/Auxtek-T004_defconfig                | 1 +
 configs/Bananapi_defconfig                   | 1 +
 configs/Bananapro_defconfig                  | 1 +
 configs/CSQ_CS908_defconfig                  | 1 +
 configs/Chuwi_V7_CW0825_defconfig            | 1 +
 configs/Colombus_defconfig                   | 1 +
 configs/Cubieboard2_defconfig                | 1 +
 configs/Cubieboard_defconfig                 | 1 +
 configs/Cubietruck_defconfig                 | 1 +
 configs/Et_q8_v1_6_defconfig                 | 1 +
 configs/Hummingbird_A31_defconfig            | 1 +
 configs/Hyundai_A7HD_defconfig               | 1 +
 configs/Ippo_q8h_v1_2_a33_1024x600_defconfig | 1 +
 configs/Ippo_q8h_v1_2_defconfig              | 1 +
 configs/Ippo_q8h_v5_defconfig                | 1 +
 configs/Linksprite_pcDuino3_Nano_defconfig   | 1 +
 configs/Linksprite_pcDuino3_defconfig        | 1 +
 configs/Linksprite_pcDuino_defconfig         | 1 +
 configs/MK808C_defconfig                     | 1 +
 configs/MSI_Primo73_defconfig                | 1 +
 configs/MSI_Primo81_defconfig                | 1 +
 configs/Marsboard_A10_defconfig              | 1 +
 configs/Mele_A1000G_quad_defconfig           | 1 +
 configs/Mele_A1000_defconfig                 | 1 +
 configs/Mele_I7_defconfig                    | 1 +
 configs/Mele_M3_defconfig                    | 1 +
 configs/Mele_M5_defconfig                    | 1 +
 configs/Mele_M9_defconfig                    | 1 +
 configs/Merrii_A80_Optimus_defconfig         | 1 +
 configs/Mini-X_defconfig                     | 1 +
 configs/Orangepi_defconfig                   | 1 +
 configs/Orangepi_mini_defconfig              | 1 +
 configs/Sinlinx_SinA33_defconfig             | 1 +
 configs/TZX-Q8-713B7_defconfig               | 1 +
 configs/UTOO_P66_defconfig                   | 1 +
 configs/Wexler_TAB7200_defconfig             | 1 +
 configs/Wits_Pro_A20_DKT_defconfig           | 1 +
 configs/Wobo_i5_defconfig                    | 1 +
 configs/Yones_Toptech_BD1078_defconfig       | 1 +
 configs/ba10_tv_box_defconfig                | 1 +
 configs/forfun_q88db_defconfig               | 1 +
 configs/ga10h_v1_1_defconfig                 | 1 +
 configs/gt90h_v4_defconfig                   | 1 +
 configs/i12-tvbox_defconfig                  | 1 +
 configs/iNet_3F_defconfig                    | 1 +
 configs/iNet_3W_defconfig                    | 1 +
 configs/iNet_86VS_defconfig                  | 1 +
 configs/inet1_defconfig                      | 1 +
 configs/inet97fv2_defconfig                  | 1 +
 configs/inet98v_rev2_defconfig               | 1 +
 configs/inet9f_rev03_defconfig               | 1 +
 configs/jesurun_q5_defconfig                 | 1 +
 configs/mixtile_loftq_defconfig              | 1 +
 configs/mk802_a10s_defconfig                 | 1 +
 configs/mk802_defconfig                      | 1 +
 configs/mk802ii_defconfig                    | 1 +
 configs/pov_protab2_ips9_defconfig           | 1 +
 configs/q8_a13_tablet_defconfig              | 1 +
 configs/r7-tv-dongle_defconfig               | 1 +
 configs/sunxi_Gemei_G9_defconfig             | 1 +
 include/configs/sunxi-common.h               | 6 ++++++
 73 files changed, 78 insertions(+)
arch/arm/Kconfig +1 -0
index 57c48d5..a862a7a 100644
@@ -518,6 +518,7 @@ config ARCH_SUNXI
 	select DM_USB
 	select OF_CONTROL
 	select OF_SEPARATE
+	select SPL_STACK_R
 	select USB
 	select USB_STORAGE
 	select USB_KEYBOARD
configs/A10-OLinuXino-Lime_defconfig +1 -0
index ee219f8..08f69d6 100644
@@ -13,3 +13,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_EMAC,AHCI,SATAPWR=SUNXI_GPC(3)"
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_USB_EHCI_HCD=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/A10s-OLinuXino-M_defconfig +1 -0
index 7783c7d..fea71a0 100644
@@ -14,3 +14,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP152_POWER,SUNXI_EMAC"
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_USB_EHCI_HCD=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/A13-OLinuXinoM_defconfig +1 -0
index ccf35c7..8445143 100644
@@ -18,3 +18,4 @@ CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=2"
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_USB_EHCI_HCD=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/A13-OLinuXino_defconfig +1 -0
index 1f68d98..fcaa822 100644
@@ -19,3 +19,4 @@ CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=2,AXP209_POWER"
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_USB_EHCI_HCD=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/A20-OLinuXino-Lime2_defconfig +1 -0
index c9d0f47..ed56de8 100644
@@ -14,3 +14,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,RGMII,AHCI,SATAPWR=SUNXI_GPC(3
 # CONFIG_CMD_FPGA is not set
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_USB_EHCI_HCD=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/A20-OLinuXino-Lime_defconfig +1 -0
index 4a257b3..cc0a47c 100644
@@ -12,3 +12,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,AHCI,SATAPWR=SUNXI_GPC(3)"
 # CONFIG_CMD_FPGA is not set
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_USB_EHCI_HCD=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/A20-OLinuXino_MICRO_defconfig +1 -0
index a7f1395..5feee69 100644
@@ -15,3 +15,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,AHCI,SATAPWR=SUNXI_GPB(8)"
 # CONFIG_CMD_FPGA is not set
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_USB_EHCI_HCD=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/A20-Olimex-SOM-EVB_defconfig +1 -0
index e8c3d18..ec0d1e5 100644
@@ -14,3 +14,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,RGMII,AHCI,SATAPWR=SUNXI_GPC(3
 # CONFIG_CMD_FPGA is not set
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_USB_EHCI_HCD=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Ainol_AW1_defconfig +1 -0
index 7c41aa8..70552e8 100644
@@ -19,3 +19,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER"
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_USB_MUSB_HOST=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Ampe_A76_defconfig +1 -0
index 57ff52d..a02c8a35 100644
@@ -20,3 +20,4 @@ CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=2,AXP209_POWER"
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_USB_MUSB_HOST=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Auxtek-T003_defconfig +1 -0
index b9692dc..769f66d 100644
@@ -13,3 +13,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP152_POWER"
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_USB_EHCI_HCD=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Auxtek-T004_defconfig +1 -0
index c019176..1892f02 100644
@@ -11,3 +11,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP152_POWER"
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_USB_EHCI_HCD=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Bananapi_defconfig +1 -0
index 560295f..13d0377 100644
@@ -13,3 +13,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,RGMII,MACPWR=SUNXI_GPH(23),AHC
 # CONFIG_CMD_FPGA is not set
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_USB_EHCI_HCD=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Bananapro_defconfig +1 -0
index 346db34..b2a3261 100644
@@ -15,3 +15,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,RGMII,MACPWR=SUNXI_GPH(23),AHC
 # CONFIG_CMD_FPGA is not set
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_USB_EHCI_HCD=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/CSQ_CS908_defconfig +1 -0
index 7c8eca8..a1453b4 100644
@@ -16,3 +16,4 @@ CONFIG_AXP221_DLDO1_VOLT=3300
 CONFIG_AXP221_ALDO1_VOLT=3300
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_MUSB_HOST=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Chuwi_V7_CW0825_defconfig +1 -0
index 7f1c4eb..5f4c87b 100644
@@ -22,3 +22,4 @@ CONFIG_VIDEO_LCD_SPI_CS="PA0"
 CONFIG_VIDEO_LCD_SPI_SCLK="PA1"
 CONFIG_VIDEO_LCD_SPI_MOSI="PA2"
 CONFIG_USB_MUSB_HOST=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Colombus_defconfig +1 -0
index 35f644a..61d98a2 100644
@@ -25,3 +25,4 @@ CONFIG_ETH_DESIGNWARE=y
 CONFIG_AXP221_ALDO1_VOLT=3300
 CONFIG_AXP221_ELDO3_VOLT=1800
 CONFIG_USB_EHCI_HCD=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Cubieboard2_defconfig +1 -0
index 9bcaed1..50fe24e 100644
@@ -12,3 +12,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,AHCI,SATAPWR=SUNXI_GPB(8)"
 # CONFIG_CMD_FPGA is not set
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_USB_EHCI_HCD=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Cubieboard_defconfig +1 -0
index bbda5bf..eec0863 100644
@@ -11,3 +11,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_EMAC,AHCI,SATAPWR=SUNXI_GPB(8)"
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_USB_EHCI_HCD=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Cubietruck_defconfig +1 -0
index e1b76ce..fdb78c1 100644
@@ -14,3 +14,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,RGMII,AHCI,SATAPWR=SUNXI_GPH(1
 # CONFIG_CMD_FPGA is not set
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_USB_EHCI_HCD=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Et_q8_v1_6_defconfig +1 -0
index 65b8e1a..055b495 100644
@@ -21,3 +21,4 @@ CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=5"
 CONFIG_AXP221_DLDO1_VOLT=3300
 CONFIG_AXP221_ALDO1_VOLT=3000
 CONFIG_USB_MUSB_HOST=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Hummingbird_A31_defconfig +1 -0
index 35c746c..2695eb8 100644
@@ -16,3 +16,4 @@ CONFIG_SYS_EXTRA_OPTIONS="SUNXI_GMAC,RGMII,MACPWR=SUNXI_GPA(21)"
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_AXP221_ALDO1_VOLT=3300
 CONFIG_USB_EHCI_HCD=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Hyundai_A7HD_defconfig +1 -0
index 9ef06a7..a571261 100644
@@ -20,3 +20,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER"
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_USB_MUSB_HOST=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Ippo_q8h_v1_2_a33_1024x600_defconfig +1 -0
index 40ccf8f..4d607d6 100644
@@ -22,3 +22,4 @@ CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=5"
 CONFIG_AXP221_DLDO1_VOLT=3300
 CONFIG_AXP221_ALDO1_VOLT=3000
 CONFIG_USB_MUSB_HOST=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Ippo_q8h_v1_2_defconfig +1 -0
index 5b49c44..7d79bcb 100644
@@ -22,3 +22,4 @@ CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=5"
 CONFIG_AXP221_DLDO1_VOLT=3300
 CONFIG_AXP221_ALDO1_VOLT=3000
 CONFIG_USB_MUSB_HOST=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Ippo_q8h_v5_defconfig +1 -0
index 5316860..80ed134 100644
@@ -22,3 +22,4 @@ CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=5"
 CONFIG_AXP221_DLDO1_VOLT=3300
 CONFIG_AXP221_ALDO1_VOLT=3000
 CONFIG_USB_MUSB_HOST=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Linksprite_pcDuino3_Nano_defconfig +1 -0
index 0b64b60..3259020 100644
@@ -14,3 +14,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,RGMII,AHCI,SATAPWR=SUNXI_GPH(2
 # CONFIG_CMD_FPGA is not set
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_USB_EHCI_HCD=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Linksprite_pcDuino3_defconfig +1 -0
index cced032..24c6bd6 100644
@@ -12,3 +12,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,AHCI,SATAPWR=SUNXI_GPH(2)"
 # CONFIG_CMD_FPGA is not set
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_USB_EHCI_HCD=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Linksprite_pcDuino_defconfig +1 -0
index de44890..1ff3bfe 100644
@@ -10,3 +10,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_EMAC"
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_USB_EHCI_HCD=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/MK808C_defconfig +1 -0
index 5e37485..49c5625 100644
@@ -10,3 +10,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER"
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_USB_EHCI_HCD=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/MSI_Primo73_defconfig +1 -0
index a60ce34..9dd1f55 100644
@@ -14,3 +14,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/MSI_Primo81_defconfig +1 -0
index 3b8e043..6969b3f 100644
@@ -24,3 +24,4 @@ CONFIG_VIDEO_LCD_SPI_SCLK="PH10"
 CONFIG_VIDEO_LCD_SPI_MOSI="PH11"
 CONFIG_VIDEO_LCD_SPI_MISO="PH12"
 CONFIG_USB_MUSB_HOST=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Marsboard_A10_defconfig +1 -0
index 4933659..9f98ccc 100644
@@ -9,3 +9,4 @@ CONFIG_SYS_EXTRA_OPTIONS="SUNXI_EMAC,AHCI"
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_USB_EHCI_HCD=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Mele_A1000G_quad_defconfig +1 -0
index 5e31ef6..b02febb 100644
@@ -18,3 +18,4 @@ CONFIG_AXP221_DLDO4_VOLT=3300
 CONFIG_AXP221_ALDO1_VOLT=3300
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_MUSB_HOST=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Mele_A1000_defconfig +1 -0
index b983c8c..5905e4f 100644
@@ -11,3 +11,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_EMAC,MACPWR=SUNXI_GPH(15),AHCI"
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_USB_EHCI_HCD=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Mele_I7_defconfig +1 -0
index 774a92f..23ea80b 100644
@@ -17,3 +17,4 @@ CONFIG_AXP221_DLDO1_VOLT=3300
 CONFIG_AXP221_DLDO4_VOLT=3300
 CONFIG_AXP221_ALDO1_VOLT=3300
 CONFIG_USB_EHCI_HCD=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Mele_M3_defconfig +1 -0
index 5c9796a..498e8b7 100644
@@ -15,3 +15,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC"
 # CONFIG_CMD_FPGA is not set
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_USB_EHCI_HCD=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Mele_M5_defconfig +1 -0
index 0d1ba15..aa6070d 100644
@@ -14,3 +14,4 @@ CONFIG_SYS_EXTRA_OPTIONS="SUNXI_GMAC,AHCI,STATUSLED=234"
 # CONFIG_CMD_FPGA is not set
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_USB_EHCI_HCD=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Mele_M9_defconfig +1 -0
index b52e3c2..716a9e4 100644
@@ -17,3 +17,4 @@ CONFIG_AXP221_DLDO1_VOLT=3300
 CONFIG_AXP221_DLDO4_VOLT=3300
 CONFIG_AXP221_ALDO1_VOLT=3300
 CONFIG_USB_EHCI_HCD=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Merrii_A80_Optimus_defconfig +1 -0
index 53e023a..acfbd21 100644
@@ -11,3 +11,4 @@ CONFIG_DEFAULT_DEVICE_TREE="sun9i-a80-optimus"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
+CONFIG_SPL_STACK_R_ADDR=0x2fe00000
configs/Mini-X_defconfig +1 -0
index 31d6217..755b2ec 100644
@@ -12,3 +12,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER"
 # CONFIG_CMD_FPGA is not set
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_MUSB_HOST=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Orangepi_defconfig +1 -0
index d67bb90..4966aff 100644
@@ -16,3 +16,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,RGMII,MACPWR=SUNXI_GPH(23),AHC
 # CONFIG_CMD_FPGA is not set
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_USB_EHCI_HCD=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Orangepi_mini_defconfig +1 -0
index 71d236b..af45541 100644
@@ -18,3 +18,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,RGMII,MACPWR=SUNXI_GPH(23),AHC
 # CONFIG_CMD_FPGA is not set
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_USB_EHCI_HCD=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Sinlinx_SinA33_defconfig +1 -0
index 720f3dc..2167665 100644
@@ -10,3 +10,4 @@ CONFIG_SPL=y
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_AXP221_ALDO1_VOLT=3000
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/TZX-Q8-713B7_defconfig +1 -0
index f5e3574..a9e6257 100644
@@ -19,3 +19,4 @@ CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=2,AXP209_POWER"
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_USB_MUSB_HOST=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/UTOO_P66_defconfig +1 -0
index 5417814..8cad8bb 100644
@@ -26,3 +26,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER"
 # CONFIG_CMD_FPGA is not set
 # CONFIG_REQUIRE_SERIAL_CONSOLE is not set
 CONFIG_USB_MUSB_HOST=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Wexler_TAB7200_defconfig +1 -0
index 02504f9..2db35bb 100644
@@ -19,3 +19,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER"
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_USB_EHCI_HCD=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Wits_Pro_A20_DKT_defconfig +1 -0
index 66b51bc..81bbfda 100644
@@ -17,3 +17,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,RGMII,AHCI"
 # CONFIG_CMD_FPGA is not set
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_USB_EHCI_HCD=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Wobo_i5_defconfig +1 -0
index 206fd48..7e988a5 100644
@@ -12,3 +12,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER"
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_USB_EHCI_HCD=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/Yones_Toptech_BD1078_defconfig +1 -0
index e26816c..ae50556 100644
@@ -24,3 +24,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER"
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_USB_MUSB_HOST=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/ba10_tv_box_defconfig +1 -0
index 104d53d..d85b891 100644
@@ -15,3 +15,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_EMAC"
 # CONFIG_CMD_FPGA is not set
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_MUSB_HOST=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/forfun_q88db_defconfig +1 -0
index 30e0937..de5037e 100644
@@ -18,3 +18,4 @@ CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=2,AXP209_POWER"
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_USB_MUSB_HOST=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/ga10h_v1_1_defconfig +1 -0
index 417a89c..aa1e747 100644
@@ -25,3 +25,4 @@ CONFIG_AXP221_DLDO1_VOLT=3300
 CONFIG_AXP221_ALDO1_VOLT=3000
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_MUSB_HOST=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/gt90h_v4_defconfig +1 -0
index 3b72dc2..e6bd733 100644
@@ -24,3 +24,4 @@ CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=5"
 CONFIG_AXP221_DCDC2_VOLT=1100
 CONFIG_AXP221_DLDO1_VOLT=3300
 CONFIG_AXP221_ALDO1_VOLT=3000
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/i12-tvbox_defconfig +1 -0
index d4d9524..3646bd6 100644
@@ -12,3 +12,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,MACPWR=SUNXI_GPH(21)"
 # CONFIG_CMD_FPGA is not set
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_USB_EHCI_HCD=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/iNet_3F_defconfig +1 -0
index 211cb86..f792eb3 100644
@@ -19,3 +19,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER"
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_USB_MUSB_HOST=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/iNet_3W_defconfig +1 -0
index 35f08e5..2447fdb 100644
@@ -19,3 +19,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER"
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_USB_MUSB_HOST=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/iNet_86VS_defconfig +1 -0
index bb8d080..c34b1cd 100644
@@ -18,3 +18,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER"
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_USB_MUSB_HOST=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/inet1_defconfig +1 -0
index b2ba497..399a976 100644
@@ -20,3 +20,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER"
 # CONFIG_CMD_FPGA is not set
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_MUSB_HOST=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/inet97fv2_defconfig +1 -0
index d7ddee1..5aeddbe 100644
@@ -18,3 +18,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/inet98v_rev2_defconfig +1 -0
index c23245a..6b2284c 100644
@@ -20,3 +20,4 @@ CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=2,AXP209_POWER"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/inet9f_rev03_defconfig +1 -0
index fdfb02a..fe2b350 100644
@@ -18,3 +18,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/jesurun_q5_defconfig +1 -0
index 46c38e5..889696a 100644
@@ -13,3 +13,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_EMAC,MACPWR=SUNXI_GPH(19)"
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_MUSB_HOST=y
 CONFIG_USB0_VBUS_PIN="PB9"
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/mixtile_loftq_defconfig +1 -0
index 26fc4ce..cc8a024 100644
@@ -15,3 +15,4 @@ CONFIG_SYS_EXTRA_OPTIONS="SUNXI_GMAC,RGMII,MACPWR=SUNXI_GPA(21)"
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_AXP221_ALDO1_VOLT=3300
 CONFIG_USB_EHCI_HCD=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/mk802_a10s_defconfig +1 -0
index db437f0..b0584b5 100644
@@ -12,3 +12,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP152_POWER"
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_USB_EHCI_HCD=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/mk802_defconfig +1 -0
index 68b2c5e..c2136b7 100644
@@ -10,3 +10,4 @@ CONFIG_SYS_EXTRA_OPTIONS="USB_EHCI"
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_USB_EHCI_HCD=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/mk802ii_defconfig +1 -0
index d3cb664..5cf742c 100644
@@ -9,3 +9,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER"
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_USB_EHCI_HCD=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/pov_protab2_ips9_defconfig +1 -0
index 3107f31..b28eb4d 100644
@@ -19,3 +19,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER"
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_USB_MUSB_HOST=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/q8_a13_tablet_defconfig +1 -0
index 2c61f51..16b2d51 100644
@@ -20,3 +20,4 @@ CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=2,AXP209_POWER"
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_USB_MUSB_HOST=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/r7-tv-dongle_defconfig +1 -0
index 62c58fc..77c9170 100644
@@ -11,3 +11,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP152_POWER"
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_USB_EHCI_HCD=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
configs/sunxi_Gemei_G9_defconfig +1 -0
index d0f987c..66c763e 100644
@@ -16,3 +16,4 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER"
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_USB_EHCI_HCD=y
+CONFIG_SPL_STACK_R_ADDR=0x4fe00000
include/configs/sunxi-common.h +6 -0
index 7c1507b..6aa1bf2 100644
@@ -73,6 +73,9 @@
 #define CONFIG_SYS_LOAD_ADDR		0x22000000 /* default load address */
 #define CONFIG_SYS_TEXT_BASE		0x2a000000
 #define CONFIG_PRE_CON_BUF_ADDR		0x2f000000
+/* Note this is primarily set through Kconfig, we redefine it here so that
+ * we get warnings if the Kconfig value mismatches. */
+#define CONFIG_SPL_STACK_R_ADDR		0x2fe00000
 #define CONFIG_SYS_SPL_MALLOC_START	0x2ff00000
 #define CONFIG_SPL_BSS_START_ADDR	0x2ff80000
 #else
@@ -81,6 +84,9 @@
 #define CONFIG_SYS_LOAD_ADDR		0x42000000 /* default load address */
 #define CONFIG_SYS_TEXT_BASE		0x4a000000
 #define CONFIG_PRE_CON_BUF_ADDR		0x4f000000
+/* Note this is primarily set through Kconfig, we redefine it here so that
+ * we get warnings if the Kconfig value mismatches. */
+#define CONFIG_SPL_STACK_R_ADDR		0x4fe00000
 #define CONFIG_SYS_SPL_MALLOC_START	0x4ff00000
 #define CONFIG_SPL_BSS_START_ADDR	0x4ff80000
 #endif
Signature · 1 line
2.4.3
#14 lore raw

PATCH 6/7 sunxi: Enable CONFIG_SPL_STACK_R

Quoted 10 lines · Hans de Goede

index 7c1507b..6aa1bf2 100644

include/configs/sunxi-common.h +0 -0
@@ -73,6 +73,9 @@
 #define CONFIG_SYS_LOAD_ADDR		0x22000000 /* default

load address */
#define CONFIG_SYS_TEXT_BASE 0x2a000000
#define CONFIG_PRE_CON_BUF_ADDR 0x2f000000
+/* Note this is primarily set through Kconfig, we redefine it here so that
+ * we get warnings if the Kconfig value mismatches. */

Mismatches with what? Why can't we just use the Kconfig supplied value throughout?

If there is a piece of code somewhere which cannot use the Kconfig value for some reason and is therefore hardcoded then using BUILD_BUG_ON would be best IMHO. There should also be a comment next to the B_B_ON explaining why that code cannot use the Kconfig value.

Quoted 1 line

+#define CONFIG_SPL_STACK_R_ADDR 0x2fe00000

Ian.

#15 lore raw

PATCH 6/7 sunxi: Enable CONFIG_SPL_STACK_R

Hi,

Quoted 14 lines · Ian Campbell
Quoted 10 lines · Hans de Goede

index 7c1507b..6aa1bf2 100644

include/configs/sunxi-common.h +0 -0
@@ -73,6 +73,9 @@
  #define CONFIG_SYS_LOAD_ADDR		0x22000000 /* default

load address */
#define CONFIG_SYS_TEXT_BASE 0x2a000000
#define CONFIG_PRE_CON_BUF_ADDR 0x2f000000
+/* Note this is primarily set through Kconfig, we redefine it here so that
+ * we get warnings if the Kconfig value mismatches. */

Mismatches with what? Why can't we just use the Kconfig supplied value throughout?

Mismatches with the value defined here in sunxi-common.h, sunxi-common.h lists all other spl memory addresses right in this block, making it possible to quickly see what goes there. If someone ever decides to tweak the layout, then they will likely forget the single value which is set in the defconfig-s, but they will (presumably) update the copy in sunxi-common.h, as that is sitting there right next to the others.

If this happens then the compiler will give a warning (for each C-file) that CONFIG_SPL_STACK_R_ADDR is being redefined.

So functionality wise this does nothing, leaving it out will result in an identical build. It is just there to help us poor humans to not forger to update the value in the defconfig files if we ever decide to tweak the SPL memory layout.

Regards,

Hans

#16 lore raw

PATCH 6/7 sunxi: Enable CONFIG_SPL_STACK_R

Quoted 31 lines · Hans de Goede

Hi,

Quoted 6 lines · Ian Campbell

include/configs/sunxi-common.h line 73

Quoted 5 lines · Hans de Goede

index 7c1507b..6aa1bf2 100644

include/configs/sunxi-common.h +0 -0
@@ -73,6 +73,9 @@
  #define CONFIG_SYS_LOAD_ADDR		0x22000000 /*

default

Quoted 4 lines
Quoted 4 lines

load address */
#define CONFIG_SYS_TEXT_BASE 0x2a000000
#define CONFIG_PRE_CON_BUF_ADDR 0x2f000000
+/* Note this is primarily set through Kconfig, we redefine it

here so that

Quoted 3 lines
Quoted 1 line

+ * we get warnings if the Kconfig value mismatches. */

Mismatches with what? Why can't we just use the Kconfig supplied

value

Quoted 1 line

throughout?

Mismatches with the value defined here in sunxi-common.h, sunxi -common.h
lists all other spl memory addresses right in this block, making it possible to quickly see what goes there. If someone ever decides to tweak
the layout, then they will likely forget the single value which is set
in the defconfig-s, but they will (presumably) update the copy in sunxi-common.h, as that is sitting there right next to the others.

Quoted 8 lines

If this happens then the compiler will give a warning (for each C -file)
that CONFIG_SPL_STACK_R_ADDR is being redefined.

So functionality wise this does nothing, leaving it out will result in an identical build. It is just there to help us poor humans to not forger to update the value in the defconfig files if we ever decide to tweak the SPL memory layout.

Got it, in which case I would drop the "primarily" from the comment, since that suggests it is defined "secondarily" here, when really it is just for documentation (with a clever trick to stop the docs getting out of date).

Maybe even:

/* Note SPL_STACK_R_ADDR is set through Kconfig, we include it here
* since it needs to fit in with the other values. By also #defining it
* we get warnings if the Kconfig value mismatches. */

???

(And presumably this all gets less mad as more and more stuff moves to Kconfig...)

Ian.

#17 lore raw

PATCH 6/7 sunxi: Enable CONFIG_SPL_STACK_R

Hi,

Quoted 46 lines · Ian Campbell
Quoted 31 lines · Hans de Goede

Hi,

Quoted 6 lines · Ian Campbell

include/configs/sunxi-common.h line 73

Quoted 5 lines · Hans de Goede

index 7c1507b..6aa1bf2 100644

include/configs/sunxi-common.h +0 -0
@@ -73,6 +73,9 @@
   #define CONFIG_SYS_LOAD_ADDR		0x22000000 /*

default

Quoted 4 lines
Quoted 4 lines

load address */

   #define CONFIG_SYS_TEXT_BASE		0x2a000000
   #define CONFIG_PRE_CON_BUF_ADDR		0x2f000000

+/* Note this is primarily set through Kconfig, we redefine it

here so that

Quoted 3 lines
Quoted 1 line

+ * we get warnings if the Kconfig value mismatches. */

Mismatches with what? Why can't we just use the Kconfig supplied

value

Quoted 1 line

throughout?

Mismatches with the value defined here in sunxi-common.h, sunxi -common.h
lists all other spl memory addresses right in this block, making it possible to quickly see what goes there. If someone ever decides to tweak
the layout, then they will likely forget the single value which is set
in the defconfig-s, but they will (presumably) update the copy in sunxi-common.h, as that is sitting there right next to the others.

Quoted 8 lines

If this happens then the compiler will give a warning (for each C -file)
that CONFIG_SPL_STACK_R_ADDR is being redefined.

So functionality wise this does nothing, leaving it out will result in an identical build. It is just there to help us poor humans to not forger to update the value in the defconfig files if we ever decide to tweak the SPL memory layout.

Got it, in which case I would drop the "primarily" from the comment, since that suggests it is defined "secondarily" here, when really it is just for documentation (with a clever trick to stop the docs getting out of date).

Quoted 5 lines

Maybe even:

/* Note SPL_STACK_R_ADDR is set through Kconfig, we include it here
* since it needs to fit in with the other values. By also #defining it
* we get warnings if the Kconfig value mismatches. */

That works for me, I'll replace my comment with the one you've suggested.

Regards,

Hans

#18 lore raw

PATCH 6/7 sunxi: Enable CONFIG_SPL_STACK_R

Quoted 11 lines · Hans de Goede

Hi,

Quoted 5 lines · Ian Campbell

Maybe even:

/* Note SPL_STACK_R_ADDR is set through Kconfig, we include it here
* since it needs to fit in with the other values. By also #defining it
* we get warnings if the Kconfig value mismatches. */

That works for me, I'll replace my comment with the one you've suggested.

That version: Acked-by: Ian Campbell <[email protected]>

#19 lore raw

PATCH 7/7 sunxi: Switch to using malloc_simple for the spl

In reply to Hans de Goede

common/dlmalloc.c is quite big, both in .text and .data usage. E.g. for a Mele_M9 sun6i board build this reduces .text from 0x4214 to 0x3b94 bytes, and .data from 0x54c to 0x144 bytes.

---
 arch/arm/Kconfig               | 1 +
 include/configs/sunxi-common.h | 3 ---
 2 files changed, 1 insertion(+), 3 deletions(-)
arch/arm/Kconfig +1 -0
index a862a7a..f53c41f 100644
@@ -518,6 +518,7 @@ config ARCH_SUNXI
 	select DM_USB
 	select OF_CONTROL
 	select OF_SEPARATE
+	select SPL_MALLOC_SIMPLE
 	select SPL_STACK_R
 	select USB
 	select USB_STORAGE
include/configs/sunxi-common.h +0 -3
index 6aa1bf2..9ca642a 100644
@@ -76,7 +76,6 @@
 /* Note this is primarily set through Kconfig, we redefine it here so that
  * we get warnings if the Kconfig value mismatches. */
 #define CONFIG_SPL_STACK_R_ADDR		0x2fe00000
-#define CONFIG_SYS_SPL_MALLOC_START	0x2ff00000
 #define CONFIG_SPL_BSS_START_ADDR	0x2ff80000
 #else
 #define SDRAM_OFFSET(x) 0x4##x
@@ -87,12 +86,10 @@
 /* Note this is primarily set through Kconfig, we redefine it here so that
  * we get warnings if the Kconfig value mismatches. */
 #define CONFIG_SPL_STACK_R_ADDR		0x4fe00000
-#define CONFIG_SYS_SPL_MALLOC_START	0x4ff00000
 #define CONFIG_SPL_BSS_START_ADDR	0x4ff80000
 #endif
 
 #define CONFIG_SPL_BSS_MAX_SIZE		0x00080000 /* 512 KiB */
-#define CONFIG_SYS_SPL_MALLOC_SIZE	0x00080000 /* 512 KiB */
 
 #ifdef CONFIG_MACH_SUN9I
 /*
Signature · 1 line
2.4.3