All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v1] armv8: spl: Call spl_relocate_stack_gd for ARMv8
@ 2017-02-17 17:36 Philipp Tomsich
  2017-02-17 23:04 ` André Przywara
  0 siblings, 1 reply; 5+ messages in thread
From: Philipp Tomsich @ 2017-02-17 17:36 UTC (permalink / raw)
  To: u-boot

As part of the startup process for boards using the SPL, we need to
call spl_relocate_stack_gd. This is needed to set up malloc with its
DRAM buffer.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
---
 arch/arm/lib/crt0_64.S | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/arch/arm/lib/crt0_64.S b/arch/arm/lib/crt0_64.S
index 19c6a98..05a80ee 100644
--- a/arch/arm/lib/crt0_64.S
+++ b/arch/arm/lib/crt0_64.S
@@ -105,15 +105,21 @@ ENTRY(_main)
 relocation_return:
 
 /*
  * Set up final (full) environment
  */
 	bl	c_runtime_cpu_setup		/* still call old routine */
 #endif /* !CONFIG_SPL_BUILD */
-
+#if defined(CONFIG_SPL_BUILD)
+	bl	spl_relocate_stack_gd
+	mov	x1, sp
+	adds	x0, x0, xzr
+	csel	x0, x0, x1, ne
+	mov	sp, x0
+#endif
 /* TODO: For SPL, call spl_relocate_stack_gd() to alloc stack relocation */
 
 /*
  * Clear BSS section
  */
 	ldr	x0, =__bss_start		/* this is auto-relocated! */
 	ldr	x1, =__bss_end			/* this is auto-relocated! */
-- 
1.9.1

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

* [U-Boot] [PATCH v1] armv8: spl: Call spl_relocate_stack_gd for ARMv8
  2017-02-17 17:36 [U-Boot] [PATCH v1] armv8: spl: Call spl_relocate_stack_gd for ARMv8 Philipp Tomsich
@ 2017-02-17 23:04 ` André Przywara
  2017-02-17 23:37   ` [U-Boot] [PATCH v2] " Philipp Tomsich
  0 siblings, 1 reply; 5+ messages in thread
From: André Przywara @ 2017-02-17 23:04 UTC (permalink / raw)
  To: u-boot

On 17/02/17 17:36, Philipp Tomsich wrote:
> As part of the startup process for boards using the SPL, we need to
> call spl_relocate_stack_gd. This is needed to set up malloc with its
> DRAM buffer.
> 
> Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> ---
>  arch/arm/lib/crt0_64.S | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/lib/crt0_64.S b/arch/arm/lib/crt0_64.S
> index 19c6a98..05a80ee 100644
> --- a/arch/arm/lib/crt0_64.S
> +++ b/arch/arm/lib/crt0_64.S
> @@ -105,15 +105,21 @@ ENTRY(_main)
>  relocation_return:
>  
>  /*
>   * Set up final (full) environment
>   */
>  	bl	c_runtime_cpu_setup		/* still call old routine */
>  #endif /* !CONFIG_SPL_BUILD */
> -
> +#if defined(CONFIG_SPL_BUILD)
> +	bl	spl_relocate_stack_gd
> +	mov	x1, sp
> +	adds	x0, x0, xzr

Wouldn't that be clearer?
	tst	x0, x0

> +	csel	x0, x0, x1, ne
> +	mov	sp, x0
> +#endif
>  /* TODO: For SPL, call spl_relocate_stack_gd() to alloc stack relocation */

I guess this comment can go then, right?

Thanks,
Andre.

>  
>  /*
>   * Clear BSS section
>   */
>  	ldr	x0, =__bss_start		/* this is auto-relocated! */
>  	ldr	x1, =__bss_end			/* this is auto-relocated! */
> 

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

* [U-Boot] [PATCH v2] armv8: spl: Call spl_relocate_stack_gd for ARMv8
  2017-02-17 23:04 ` André Przywara
@ 2017-02-17 23:37   ` Philipp Tomsich
  2017-02-17 23:41     ` André Przywara
  0 siblings, 1 reply; 5+ messages in thread
From: Philipp Tomsich @ 2017-02-17 23:37 UTC (permalink / raw)
  To: u-boot

As part of the startup process for boards using the SPL, we need to
call spl_relocate_stack_gd. This is needed to set up malloc with its
DRAM buffer.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
---
 arch/arm/lib/crt0_64.S | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/arch/arm/lib/crt0_64.S b/arch/arm/lib/crt0_64.S
index 19c6a98..9f55d4f 100644
--- a/arch/arm/lib/crt0_64.S
+++ b/arch/arm/lib/crt0_64.S
@@ -109,8 +109,16 @@ relocation_return:
  */
 	bl	c_runtime_cpu_setup		/* still call old routine */
 #endif /* !CONFIG_SPL_BUILD */
-
-/* TODO: For SPL, call spl_relocate_stack_gd() to alloc stack relocation */
+#if defined(CONFIG_SPL_BUILD)
+	bl	spl_relocate_stack_gd           /* may return NULL */
+	/* Perform 'sp = (x0 != NULL) ? x0 : sp' while working
+	   around the constraint that conditional moves can not
+	   have 'sp' as an operand */
+	mov	x1, sp
+	cmp	x0, #0
+	csel	x0, x0, x1, ne
+	mov	sp, x0
+#endif
 
 /*
  * Clear BSS section
-- 
1.9.1

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

* [U-Boot] [PATCH v2] armv8: spl: Call spl_relocate_stack_gd for ARMv8
  2017-02-17 23:37   ` [U-Boot] [PATCH v2] " Philipp Tomsich
@ 2017-02-17 23:41     ` André Przywara
  2017-02-22  3:59       ` Simon Glass
  0 siblings, 1 reply; 5+ messages in thread
From: André Przywara @ 2017-02-17 23:41 UTC (permalink / raw)
  To: u-boot

On 17/02/17 23:37, Philipp Tomsich wrote:

Hi,

> As part of the startup process for boards using the SPL, we need to
> call spl_relocate_stack_gd. This is needed to set up malloc with its
> DRAM buffer.

I wonder how we could get away without this before?

> 
> Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

That looks good to me now, also thanks for adding the comment.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>

Cheers,
Andre.

> ---
>  arch/arm/lib/crt0_64.S | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/lib/crt0_64.S b/arch/arm/lib/crt0_64.S
> index 19c6a98..9f55d4f 100644
> --- a/arch/arm/lib/crt0_64.S
> +++ b/arch/arm/lib/crt0_64.S
> @@ -109,8 +109,16 @@ relocation_return:
>   */
>  	bl	c_runtime_cpu_setup		/* still call old routine */
>  #endif /* !CONFIG_SPL_BUILD */
> -
> -/* TODO: For SPL, call spl_relocate_stack_gd() to alloc stack relocation */
> +#if defined(CONFIG_SPL_BUILD)
> +	bl	spl_relocate_stack_gd           /* may return NULL */
> +	/* Perform 'sp = (x0 != NULL) ? x0 : sp' while working
> +	   around the constraint that conditional moves can not
> +	   have 'sp' as an operand */
> +	mov	x1, sp
> +	cmp	x0, #0
> +	csel	x0, x0, x1, ne
> +	mov	sp, x0
> +#endif
>  
>  /*
>   * Clear BSS section
> 

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

* [U-Boot] [PATCH v2] armv8: spl: Call spl_relocate_stack_gd for ARMv8
  2017-02-17 23:41     ` André Przywara
@ 2017-02-22  3:59       ` Simon Glass
  0 siblings, 0 replies; 5+ messages in thread
From: Simon Glass @ 2017-02-22  3:59 UTC (permalink / raw)
  To: u-boot

Hi,

On 17 February 2017 at 16:41, Andr? Przywara <andre.przywara@arm.com> wrote:
> On 17/02/17 23:37, Philipp Tomsich wrote:
>
> Hi,
>
>> As part of the startup process for boards using the SPL, we need to
>> call spl_relocate_stack_gd. This is needed to set up malloc with its
>> DRAM buffer.
>
> I wonder how we could get away without this before?
>
>>
>> Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
>
> That looks good to me now, also thanks for adding the comment.
>
> Reviewed-by: Andre Przywara <andre.przywara@arm.com>
>
> Cheers,
> Andre.
>
>> ---
>>  arch/arm/lib/crt0_64.S | 12 ++++++++++--
>>  1 file changed, 10 insertions(+), 2 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

But please see nit below.

>>
>> diff --git a/arch/arm/lib/crt0_64.S b/arch/arm/lib/crt0_64.S
>> index 19c6a98..9f55d4f 100644
>> --- a/arch/arm/lib/crt0_64.S
>> +++ b/arch/arm/lib/crt0_64.S
>> @@ -109,8 +109,16 @@ relocation_return:
>>   */
>>       bl      c_runtime_cpu_setup             /* still call old routine */
>>  #endif /* !CONFIG_SPL_BUILD */
>> -
>> -/* TODO: For SPL, call spl_relocate_stack_gd() to alloc stack relocation */
>> +#if defined(CONFIG_SPL_BUILD)
>> +     bl      spl_relocate_stack_gd           /* may return NULL */
>> +     /* Perform 'sp = (x0 != NULL) ? x0 : sp' while working
>> +        around the constraint that conditional moves can not
>> +        have 'sp' as an operand */

/*
 * Perform ...
 * ...
 */

>> +     mov     x1, sp
>> +     cmp     x0, #0
>> +     csel    x0, x0, x1, ne
>> +     mov     sp, x0
>> +#endif
>>
>>  /*
>>   * Clear BSS section
>>
>

Regards,
Simon

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

end of thread, other threads:[~2017-02-22  3:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-17 17:36 [U-Boot] [PATCH v1] armv8: spl: Call spl_relocate_stack_gd for ARMv8 Philipp Tomsich
2017-02-17 23:04 ` André Przywara
2017-02-17 23:37   ` [U-Boot] [PATCH v2] " Philipp Tomsich
2017-02-17 23:41     ` André Przywara
2017-02-22  3:59       ` Simon Glass

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.