diff mbox

[U-Boot] arm: initialize gd for AArch64

Message ID 1452805391-7120-1-git-send-email-swarren@wwwdotorg.org
State Accepted
Commit a737028e80603f49a4757adec10b5842d0689dbb
Delegated to: Tom Rini
Headers show

Commit Message

Stephen Warren Jan. 14, 2016, 9:03 p.m. UTC
From: Stephen Warren <swarren@nvidia.com>

Commit adc421e4cee8 "arm: move gd handling outside of C code" removed
the call to arch_setup_gd() on ARM and replaced it with assembly code
in crt0.S. However, AArch64 uses a different startup file, and the same
change was not made to it. This leaves gd uninitialized on AArch64, which
typically leads to hangs or crashes. This change fixes that.

Fixes: adc421e4cee8 ("arm: move gd handling outside of C code")
Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
 arch/arm/lib/crt0_64.S | 2 ++
 1 file changed, 2 insertions(+)

Comments

Tom Rini Jan. 14, 2016, 9:27 p.m. UTC | #1
On Thu, Jan 14, 2016 at 02:03:11PM -0700, Stephen Warren wrote:

> From: Stephen Warren <swarren@nvidia.com>
> 
> Commit adc421e4cee8 "arm: move gd handling outside of C code" removed
> the call to arch_setup_gd() on ARM and replaced it with assembly code
> in crt0.S. However, AArch64 uses a different startup file, and the same
> change was not made to it. This leaves gd uninitialized on AArch64, which
> typically leads to hangs or crashes. This change fixes that.
> 
> Fixes: adc421e4cee8 ("arm: move gd handling outside of C code")
> Signed-off-by: Stephen Warren <swarren@nvidia.com>

Applied to u-boot/master, thanks!
Simon Glass Jan. 14, 2016, 11:11 p.m. UTC | #2
On 14 January 2016 at 14:03, Stephen Warren <swarren@wwwdotorg.org> wrote:
> From: Stephen Warren <swarren@nvidia.com>
>
> Commit adc421e4cee8 "arm: move gd handling outside of C code" removed
> the call to arch_setup_gd() on ARM and replaced it with assembly code
> in crt0.S. However, AArch64 uses a different startup file, and the same
> change was not made to it. This leaves gd uninitialized on AArch64, which
> typically leads to hangs or crashes. This change fixes that.
>
> Fixes: adc421e4cee8 ("arm: move gd handling outside of C code")
> Signed-off-by: Stephen Warren <swarren@nvidia.com>
> ---
>  arch/arm/lib/crt0_64.S | 2 ++
>  1 file changed, 2 insertions(+)

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

Patch

diff --git a/arch/arm/lib/crt0_64.S b/arch/arm/lib/crt0_64.S
index b4fc76060970..cad22c7b41fe 100644
--- a/arch/arm/lib/crt0_64.S
+++ b/arch/arm/lib/crt0_64.S
@@ -78,6 +78,8 @@  ENTRY(_main)
 	mov	x0, sp
 	bl	board_init_f_alloc_reserve
 	mov	sp, x0
+	/* set up gd here, outside any C code */
+	mov	x18, x0
 	bl	board_init_f_init_reserve
 
 	mov	x0, #0