public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/2] microblaze: spl: Do not call mem_malloc_init and use early alloc
@ 2015-02-03 15:39 Michal Simek
  2015-02-03 15:39 ` [U-Boot] [PATCH 2/2] microblaze: spl: Add LISTS to linker script Michal Simek
  2015-12-14  3:47 ` [U-Boot] [PATCH 1/2] microblaze: spl: Do not call mem_malloc_init and use early alloc Simon Glass
  0 siblings, 2 replies; 5+ messages in thread
From: Michal Simek @ 2015-02-03 15:39 UTC (permalink / raw)
  To: u-boot

This patch has some parts connected together:
- Use _gd in bss section which is automatically cleared
  Location at SPL_MALLOC_END wasn't cleared at all
- Use MALLOC_F_LEN(early alloc) instead of FULL MALLOC
  (mem_malloc_init is not called at all)
- Simplify malloc and stack init.
  At the end of SPL addr is malloc area and below is stack

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

 arch/microblaze/cpu/start.S          |  6 +++++-
 include/configs/microblaze-generic.h | 32 +++++++++++---------------------
 2 files changed, 16 insertions(+), 22 deletions(-)

diff --git a/arch/microblaze/cpu/start.S b/arch/microblaze/cpu/start.S
index cf9ee7e3e6ad..953d3a15eef2 100644
--- a/arch/microblaze/cpu/start.S
+++ b/arch/microblaze/cpu/start.S
@@ -162,7 +162,11 @@ clear_bss:
 #endif
 	brai	board_init_f
 #else
-	addi	r31, r0, CONFIG_SYS_SPL_MALLOC_END
+	addi	r31, r0, _gd
+#if defined(CONFIG_SYS_MALLOC_F_LEN)
+	addi	r6, r0, CONFIG_SPL_STACK_ADDR
+	swi	r6, r31, GD_MALLOC_BASE
+#endif
 	brai	board_init_r
 #endif
 1:	bri	1b
diff --git a/include/configs/microblaze-generic.h b/include/configs/microblaze-generic.h
index 770acbea691b..166ab4f05654 100644
--- a/include/configs/microblaze-generic.h
+++ b/include/configs/microblaze-generic.h
@@ -113,7 +113,12 @@
 #endif
 
 #define CONFIG_SYS_MALLOC_LEN	0xC0000
-#define CONFIG_SYS_MALLOC_F_LEN	1024
+#ifndef CONFIG_SPL_BUILD
+# define CONFIG_SYS_MALLOC_F_LEN	1024
+#else
+# define CONFIG_SYS_MALLOC_SIMPLE
+# define CONFIG_SYS_MALLOC_F_LEN	0x150
+#endif
 
 /* Stack location before relocation */
 #define CONFIG_SYS_INIT_SP_OFFSET	CONFIG_SYS_TEXT_BASE
@@ -426,25 +431,11 @@
 /* BRAM start */
 #define CONFIG_SYS_INIT_RAM_ADDR	0x0
 /* BRAM size - will be generated */
-#define CONFIG_SYS_INIT_RAM_SIZE	0x10000
-/* Stack pointer prior relocation, must situated at on-chip RAM */
-#define CONFIG_SYS_SPL_MALLOC_END	(CONFIG_SYS_INIT_RAM_ADDR + \
-					 CONFIG_SYS_INIT_RAM_SIZE - \
-					 GENERATED_GBL_DATA_SIZE)
+#define CONFIG_SYS_INIT_RAM_SIZE	0x100000
 
-#define CONFIG_SYS_SPL_MALLOC_SIZE	0x100
-
-/*
- * The main reason to do it in this way is that MALLOC_START
- * can't be defined - common/spl/spl.c
- */
-#if (CONFIG_SYS_SPL_MALLOC_SIZE != 0)
-# define CONFIG_SYS_SPL_MALLOC_START	(CONFIG_SYS_SPL_MALLOC_END - \
-					 CONFIG_SYS_SPL_MALLOC_SIZE)
-# define CONFIG_SPL_STACK_ADDR		CONFIG_SYS_SPL_MALLOC_START
-#else
-# define CONFIG_SPL_STACK_ADDR		CONFIG_SYS_SPL_MALLOC_END
-#endif
+# define CONFIG_SPL_STACK_ADDR		(CONFIG_SYS_INIT_RAM_ADDR + \
+					 CONFIG_SYS_INIT_RAM_SIZE - \
+					 CONFIG_SYS_MALLOC_F_LEN)
 
 /* Just for sure that there is a space for stack */
 #define CONFIG_SPL_STACK_SIZE		0x100
@@ -453,8 +444,7 @@
 
 #define CONFIG_SPL_MAX_FOOTPRINT	(CONFIG_SYS_INIT_RAM_SIZE - \
 					 CONFIG_SYS_INIT_RAM_ADDR - \
-					 GENERATED_GBL_DATA_SIZE - \
-					 CONFIG_SYS_SPL_MALLOC_SIZE - \
+					 CONFIG_SYS_MALLOC_F_LEN - \
 					 CONFIG_SPL_STACK_SIZE)
 
 #endif	/* __CONFIG_H */
-- 
1.8.2.3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH 2/2] microblaze: spl: Add LISTS to linker script
  2015-02-03 15:39 [U-Boot] [PATCH 1/2] microblaze: spl: Do not call mem_malloc_init and use early alloc Michal Simek
@ 2015-02-03 15:39 ` Michal Simek
  2015-12-14  3:47 ` [U-Boot] [PATCH 1/2] microblaze: spl: Do not call mem_malloc_init and use early alloc Simon Glass
  1 sibling, 0 replies; 5+ messages in thread
From: Michal Simek @ 2015-02-03 15:39 UTC (permalink / raw)
  To: u-boot

This is required for driver model.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

 arch/microblaze/cpu/u-boot-spl.lds | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/microblaze/cpu/u-boot-spl.lds b/arch/microblaze/cpu/u-boot-spl.lds
index 96353cd96ca7..c60336ca5ca8 100644
--- a/arch/microblaze/cpu/u-boot-spl.lds
+++ b/arch/microblaze/cpu/u-boot-spl.lds
@@ -37,6 +37,12 @@ SECTIONS
 		__data_end = .;
 	}
 
+	. = ALIGN(4);
+	.u_boot_list : {
+		KEEP(*(SORT(.u_boot_list*)));
+	}
+	__init_end = . ;
+
 	.bss ALIGN(0x4):
 	{
 		__bss_start = .;
-- 
1.8.2.3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH 1/2] microblaze: spl: Do not call mem_malloc_init and use early alloc
  2015-02-03 15:39 [U-Boot] [PATCH 1/2] microblaze: spl: Do not call mem_malloc_init and use early alloc Michal Simek
  2015-02-03 15:39 ` [U-Boot] [PATCH 2/2] microblaze: spl: Add LISTS to linker script Michal Simek
@ 2015-12-14  3:47 ` Simon Glass
  2015-12-14  7:33   ` Michal Simek
  1 sibling, 1 reply; 5+ messages in thread
From: Simon Glass @ 2015-12-14  3:47 UTC (permalink / raw)
  To: u-boot

Hi Michal,

On 3 February 2015 at 08:39, Michal Simek <michal.simek@xilinx.com> wrote:
>
> This patch has some parts connected together:
> - Use _gd in bss section which is automatically cleared
>   Location at SPL_MALLOC_END wasn't cleared at all
> - Use MALLOC_F_LEN(early alloc) instead of FULL MALLOC
>   (mem_malloc_init is not called at all)
> - Simplify malloc and stack init.
>   At the end of SPL addr is malloc area and below is stack
>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> ---
>
>  arch/microblaze/cpu/start.S          |  6 +++++-
>  include/configs/microblaze-generic.h | 32 +++++++++++---------------------
>  2 files changed, 16 insertions(+), 22 deletions(-)
>
> diff --git a/arch/microblaze/cpu/start.S b/arch/microblaze/cpu/start.S
> index cf9ee7e3e6ad..953d3a15eef2 100644
> --- a/arch/microblaze/cpu/start.S
> +++ b/arch/microblaze/cpu/start.S
> @@ -162,7 +162,11 @@ clear_bss:
>  #endif
>         brai    board_init_f
>  #else
> -       addi    r31, r0, CONFIG_SYS_SPL_MALLOC_END
> +       addi    r31, r0, _gd
> +#if defined(CONFIG_SYS_MALLOC_F_LEN)
> +       addi    r6, r0, CONFIG_SPL_STACK_ADDR
> +       swi     r6, r31, GD_MALLOC_BASE
> +#endif
>         brai    board_init_r
>  #endif
>  1:     bri     1b
> diff --git a/include/configs/microblaze-generic.h b/include/configs/microblaze-generic.h
> index 770acbea691b..166ab4f05654 100644
> --- a/include/configs/microblaze-generic.h
> +++ b/include/configs/microblaze-generic.h
> @@ -113,7 +113,12 @@
>  #endif
>
>  #define CONFIG_SYS_MALLOC_LEN  0xC0000
> -#define CONFIG_SYS_MALLOC_F_LEN        1024
> +#ifndef CONFIG_SPL_BUILD
> +# define CONFIG_SYS_MALLOC_F_LEN       1024
> +#else
> +# define CONFIG_SYS_MALLOC_SIMPLE
> +# define CONFIG_SYS_MALLOC_F_LEN       0x150
> +#endif

These should be set via Kconfig - e.g. default values for your arch,
or perhaps individual values in the defconfig files. At present this
breaks when driver model is enabled by default.

Can you please take a look?

>
>  /* Stack location before relocation */
>  #define CONFIG_SYS_INIT_SP_OFFSET      CONFIG_SYS_TEXT_BASE
> @@ -426,25 +431,11 @@
>  /* BRAM start */
>  #define CONFIG_SYS_INIT_RAM_ADDR       0x0
>  /* BRAM size - will be generated */
> -#define CONFIG_SYS_INIT_RAM_SIZE       0x10000
> -/* Stack pointer prior relocation, must situated at on-chip RAM */
> -#define CONFIG_SYS_SPL_MALLOC_END      (CONFIG_SYS_INIT_RAM_ADDR + \
> -                                        CONFIG_SYS_INIT_RAM_SIZE - \
> -                                        GENERATED_GBL_DATA_SIZE)
> +#define CONFIG_SYS_INIT_RAM_SIZE       0x100000
>
> -#define CONFIG_SYS_SPL_MALLOC_SIZE     0x100
> -
> -/*
> - * The main reason to do it in this way is that MALLOC_START
> - * can't be defined - common/spl/spl.c
> - */
> -#if (CONFIG_SYS_SPL_MALLOC_SIZE != 0)
> -# define CONFIG_SYS_SPL_MALLOC_START   (CONFIG_SYS_SPL_MALLOC_END - \
> -                                        CONFIG_SYS_SPL_MALLOC_SIZE)
> -# define CONFIG_SPL_STACK_ADDR         CONFIG_SYS_SPL_MALLOC_START
> -#else
> -# define CONFIG_SPL_STACK_ADDR         CONFIG_SYS_SPL_MALLOC_END
> -#endif
> +# define CONFIG_SPL_STACK_ADDR         (CONFIG_SYS_INIT_RAM_ADDR + \
> +                                        CONFIG_SYS_INIT_RAM_SIZE - \
> +                                        CONFIG_SYS_MALLOC_F_LEN)
>
>  /* Just for sure that there is a space for stack */
>  #define CONFIG_SPL_STACK_SIZE          0x100
> @@ -453,8 +444,7 @@
>
>  #define CONFIG_SPL_MAX_FOOTPRINT       (CONFIG_SYS_INIT_RAM_SIZE - \
>                                          CONFIG_SYS_INIT_RAM_ADDR - \
> -                                        GENERATED_GBL_DATA_SIZE - \
> -                                        CONFIG_SYS_SPL_MALLOC_SIZE - \
> +                                        CONFIG_SYS_MALLOC_F_LEN - \
>                                          CONFIG_SPL_STACK_SIZE)
>
>  #endif /* __CONFIG_H */
> --
> 1.8.2.3

Regards,
Simon

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH 1/2] microblaze: spl: Do not call mem_malloc_init and use early alloc
  2015-12-14  3:47 ` [U-Boot] [PATCH 1/2] microblaze: spl: Do not call mem_malloc_init and use early alloc Simon Glass
@ 2015-12-14  7:33   ` Michal Simek
  2015-12-14 22:14     ` Simon Glass
  0 siblings, 1 reply; 5+ messages in thread
From: Michal Simek @ 2015-12-14  7:33 UTC (permalink / raw)
  To: u-boot

On 14.12.2015 04:47, Simon Glass wrote:
> Hi Michal,
> 
> On 3 February 2015 at 08:39, Michal Simek <michal.simek@xilinx.com> wrote:
>>
>> This patch has some parts connected together:
>> - Use _gd in bss section which is automatically cleared
>>   Location at SPL_MALLOC_END wasn't cleared at all
>> - Use MALLOC_F_LEN(early alloc) instead of FULL MALLOC
>>   (mem_malloc_init is not called at all)
>> - Simplify malloc and stack init.
>>   At the end of SPL addr is malloc area and below is stack
>>
>> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
>> ---
>>
>>  arch/microblaze/cpu/start.S          |  6 +++++-
>>  include/configs/microblaze-generic.h | 32 +++++++++++---------------------
>>  2 files changed, 16 insertions(+), 22 deletions(-)
>>
>> diff --git a/arch/microblaze/cpu/start.S b/arch/microblaze/cpu/start.S
>> index cf9ee7e3e6ad..953d3a15eef2 100644
>> --- a/arch/microblaze/cpu/start.S
>> +++ b/arch/microblaze/cpu/start.S
>> @@ -162,7 +162,11 @@ clear_bss:
>>  #endif
>>         brai    board_init_f
>>  #else
>> -       addi    r31, r0, CONFIG_SYS_SPL_MALLOC_END
>> +       addi    r31, r0, _gd
>> +#if defined(CONFIG_SYS_MALLOC_F_LEN)
>> +       addi    r6, r0, CONFIG_SPL_STACK_ADDR
>> +       swi     r6, r31, GD_MALLOC_BASE
>> +#endif
>>         brai    board_init_r
>>  #endif
>>  1:     bri     1b
>> diff --git a/include/configs/microblaze-generic.h b/include/configs/microblaze-generic.h
>> index 770acbea691b..166ab4f05654 100644
>> --- a/include/configs/microblaze-generic.h
>> +++ b/include/configs/microblaze-generic.h
>> @@ -113,7 +113,12 @@
>>  #endif
>>
>>  #define CONFIG_SYS_MALLOC_LEN  0xC0000
>> -#define CONFIG_SYS_MALLOC_F_LEN        1024
>> +#ifndef CONFIG_SPL_BUILD
>> +# define CONFIG_SYS_MALLOC_F_LEN       1024
>> +#else
>> +# define CONFIG_SYS_MALLOC_SIMPLE
>> +# define CONFIG_SYS_MALLOC_F_LEN       0x150
>> +#endif
> 
> These should be set via Kconfig - e.g. default values for your arch,
> or perhaps individual values in the defconfig files. At present this
> breaks when driver model is enabled by default.
> 
> Can you please take a look?
> 

Already did. Here is follow up patch.

http://lists.denx.de/pipermail/u-boot/2015-December/237468.html

Thanks,
Michal

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH 1/2] microblaze: spl: Do not call mem_malloc_init and use early alloc
  2015-12-14  7:33   ` Michal Simek
@ 2015-12-14 22:14     ` Simon Glass
  0 siblings, 0 replies; 5+ messages in thread
From: Simon Glass @ 2015-12-14 22:14 UTC (permalink / raw)
  To: u-boot

On 14 December 2015 at 00:33, Michal Simek <michal.simek@xilinx.com> wrote:
> On 14.12.2015 04:47, Simon Glass wrote:
>> Hi Michal,
>>
>> On 3 February 2015 at 08:39, Michal Simek <michal.simek@xilinx.com> wrote:
>>>
>>> This patch has some parts connected together:
>>> - Use _gd in bss section which is automatically cleared
>>>   Location at SPL_MALLOC_END wasn't cleared at all
>>> - Use MALLOC_F_LEN(early alloc) instead of FULL MALLOC
>>>   (mem_malloc_init is not called at all)
>>> - Simplify malloc and stack init.
>>>   At the end of SPL addr is malloc area and below is stack
>>>
>>> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
>>> ---
>>>
>>>  arch/microblaze/cpu/start.S          |  6 +++++-
>>>  include/configs/microblaze-generic.h | 32 +++++++++++---------------------
>>>  2 files changed, 16 insertions(+), 22 deletions(-)
>>>
>>> diff --git a/arch/microblaze/cpu/start.S b/arch/microblaze/cpu/start.S
>>> index cf9ee7e3e6ad..953d3a15eef2 100644
>>> --- a/arch/microblaze/cpu/start.S
>>> +++ b/arch/microblaze/cpu/start.S
>>> @@ -162,7 +162,11 @@ clear_bss:
>>>  #endif
>>>         brai    board_init_f
>>>  #else
>>> -       addi    r31, r0, CONFIG_SYS_SPL_MALLOC_END
>>> +       addi    r31, r0, _gd
>>> +#if defined(CONFIG_SYS_MALLOC_F_LEN)
>>> +       addi    r6, r0, CONFIG_SPL_STACK_ADDR
>>> +       swi     r6, r31, GD_MALLOC_BASE
>>> +#endif
>>>         brai    board_init_r
>>>  #endif
>>>  1:     bri     1b
>>> diff --git a/include/configs/microblaze-generic.h b/include/configs/microblaze-generic.h
>>> index 770acbea691b..166ab4f05654 100644
>>> --- a/include/configs/microblaze-generic.h
>>> +++ b/include/configs/microblaze-generic.h
>>> @@ -113,7 +113,12 @@
>>>  #endif
>>>
>>>  #define CONFIG_SYS_MALLOC_LEN  0xC0000
>>> -#define CONFIG_SYS_MALLOC_F_LEN        1024
>>> +#ifndef CONFIG_SPL_BUILD
>>> +# define CONFIG_SYS_MALLOC_F_LEN       1024
>>> +#else
>>> +# define CONFIG_SYS_MALLOC_SIMPLE
>>> +# define CONFIG_SYS_MALLOC_F_LEN       0x150
>>> +#endif
>>
>> These should be set via Kconfig - e.g. default values for your arch,
>> or perhaps individual values in the defconfig files. At present this
>> breaks when driver model is enabled by default.
>>
>> Can you please take a look?
>>
>
> Already did. Here is follow up patch.
>
> http://lists.denx.de/pipermail/u-boot/2015-December/237468.html

Great, found it, thanks.

- Simon

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-12-14 22:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-03 15:39 [U-Boot] [PATCH 1/2] microblaze: spl: Do not call mem_malloc_init and use early alloc Michal Simek
2015-02-03 15:39 ` [U-Boot] [PATCH 2/2] microblaze: spl: Add LISTS to linker script Michal Simek
2015-12-14  3:47 ` [U-Boot] [PATCH 1/2] microblaze: spl: Do not call mem_malloc_init and use early alloc Simon Glass
2015-12-14  7:33   ` Michal Simek
2015-12-14 22:14     ` Simon Glass

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox