diff mbox series

[U-Boot,2/2] imx: bootaux: fix stack and pc assignment on 64-bit platforms

Message ID 20181114165529.6563-3-gary.bisson@boundarydevices.com
State Accepted
Commit 68e7410fa22eabaa98efc03f7745b1adf86e7b28
Delegated to: Stefano Babic
Headers show
Series imx: fix M4 boot on i.MX8MQ processors | expand

Commit Message

Gary Bisson Nov. 14, 2018, 4:55 p.m. UTC
Using ulong is wrong as its size depends on the Host CPU architecture
(32-bit vs. 64-bit) although the Cortex-M4 is always 32-bit.

Without this patch, the stack and PC are obviously wrong and it
generates an abort when used on 64-bit processors such as the i.MX8MQ.

Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
---
 arch/arm/mach-imx/imx_bootaux.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Peng Fan Nov. 17, 2018, 10:02 a.m. UTC | #1
> -----Original Message-----
> From: Gary Bisson [mailto:gary.bisson@boundarydevices.com]
> Sent: 2018年11月15日 0:55
> To: u-boot@lists.denx.de
> Cc: sbabic@denx.de; Fabio Estevam <fabio.estevam@nxp.com>; Peng Fan
> <peng.fan@nxp.com>; dl-linux-imx <linux-imx@nxp.com>; Gary Bisson
> <gary.bisson@boundarydevices.com>
> Subject: [PATCH 2/2] imx: bootaux: fix stack and pc assignment on 64-bit
> platforms
> 
> Using ulong is wrong as its size depends on the Host CPU architecture (32-bit
> vs. 64-bit) although the Cortex-M4 is always 32-bit.
> 
> Without this patch, the stack and PC are obviously wrong and it generates an
> abort when used on 64-bit processors such as the i.MX8MQ.
> 
> Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
> ---
>  arch/arm/mach-imx/imx_bootaux.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/mach-imx/imx_bootaux.c
> b/arch/arm/mach-imx/imx_bootaux.c index a1ea5c13f1..3103001b7c
> 100644
> --- a/arch/arm/mach-imx/imx_bootaux.c
> +++ b/arch/arm/mach-imx/imx_bootaux.c
> @@ -17,8 +17,8 @@ int arch_auxiliary_core_up(u32 core_id, ulong
> boot_private_data)
>  	if (!boot_private_data)
>  		return -EINVAL;
> 
> -	stack = *(ulong *)boot_private_data;
> -	pc = *(ulong *)(boot_private_data + 4);
> +	stack = *(u32 *)boot_private_data;
> +	pc = *(u32 *)(boot_private_data + 4);
> 
>  	/* Set the stack and pc to M4 bootROM */
>  	writel(stack, M4_BOOTROM_BASE_ADDR);

Reviewed-by: Peng Fan <peng.fan@nxp.com>

> --
> 2.19.1
Stefano Babic Dec. 8, 2018, 5:38 p.m. UTC | #2
On 14/11/18 17:55, Gary Bisson wrote:
> Using ulong is wrong as its size depends on the Host CPU architecture
> (32-bit vs. 64-bit) although the Cortex-M4 is always 32-bit.
> 
> Without this patch, the stack and PC are obviously wrong and it
> generates an abort when used on 64-bit processors such as the i.MX8MQ.
> 
> Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
> ---
>  arch/arm/mach-imx/imx_bootaux.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/mach-imx/imx_bootaux.c b/arch/arm/mach-imx/imx_bootaux.c
> index a1ea5c13f1..3103001b7c 100644
> --- a/arch/arm/mach-imx/imx_bootaux.c
> +++ b/arch/arm/mach-imx/imx_bootaux.c
> @@ -17,8 +17,8 @@ int arch_auxiliary_core_up(u32 core_id, ulong boot_private_data)
>  	if (!boot_private_data)
>  		return -EINVAL;
>  
> -	stack = *(ulong *)boot_private_data;
> -	pc = *(ulong *)(boot_private_data + 4);
> +	stack = *(u32 *)boot_private_data;
> +	pc = *(u32 *)(boot_private_data + 4);
>  
>  	/* Set the stack and pc to M4 bootROM */
>  	writel(stack, M4_BOOTROM_BASE_ADDR);
> 


Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic
diff mbox series

Patch

diff --git a/arch/arm/mach-imx/imx_bootaux.c b/arch/arm/mach-imx/imx_bootaux.c
index a1ea5c13f1..3103001b7c 100644
--- a/arch/arm/mach-imx/imx_bootaux.c
+++ b/arch/arm/mach-imx/imx_bootaux.c
@@ -17,8 +17,8 @@  int arch_auxiliary_core_up(u32 core_id, ulong boot_private_data)
 	if (!boot_private_data)
 		return -EINVAL;
 
-	stack = *(ulong *)boot_private_data;
-	pc = *(ulong *)(boot_private_data + 4);
+	stack = *(u32 *)boot_private_data;
+	pc = *(u32 *)(boot_private_data + 4);
 
 	/* Set the stack and pc to M4 bootROM */
 	writel(stack, M4_BOOTROM_BASE_ADDR);