Re: [U-Boot] [PATCH] armv7: do not relocate _start twice

2013-03-28 Thread Albert ARIBAUD
Hi Vincent,

On Fri, 15 Mar 2013 17:54:00 +0100, Vincent Stehlé 
wrote:

> The _start symbol is already relocated, so do not add the relocation the 
> second
> time in c_runtime_cpu_setup.
> 
> This fixes e.g. the abort exception handling path, which ended in double fault
> due to bad address in VBAR.
> 
> Signed-off-by: Vincent Stehlé 
> Reported-by: Lubomir Popov 
> ---
> 
> 
> Hello,
> 
> Here is a fix for a bug reported by Lubomir. He noticed that exceptions were
> not handled correctly anymore. This can be seen with e.g. the 'dhcp' command 
> on
> some OMAP platforms.
> 
> Looking at the code, I would says the fix applies to all armv7 platforms 
> except
> Tegra but I did only test on OMAP5. On this platform at least the abort is now
> handled:
> 
>   OMAP5430 EVM # dhcp
>   data abort
> 
>   MAYBE you should read doc/README.arm-unaligned-accesses
> 
>   pc : []  lr : []
>   sp : feef9dc4  ip : fefed0f8 fp : 
>   r10: 0001  r9 : 0001 r8 : feef9f48
>   r7 : feef9fe0  r6 :  r5 :   r4 : 0014
>   r3 :   r2 : 0002 r1 : 0014  r0 : fefed0f4
>   Flags: Nzcv  IRQs off  FIQs off  Mode SVC_32
>   Resetting CPU ...
> 
>   resetting ...
> 
> It would be appreciated if folks could verify on other ARMv7 platforms, when
> running from flash for example (where relocation may differ?)
> 
> 
>  arch/arm/cpu/armv7/start.S |1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/arch/arm/cpu/armv7/start.S b/arch/arm/cpu/armv7/start.S
> index 6b59529d..d06b35f 100644
> --- a/arch/arm/cpu/armv7/start.S
> +++ b/arch/arm/cpu/armv7/start.S
> @@ -254,7 +254,6 @@ ENTRY(c_runtime_cpu_setup)
>  #if !defined(CONFIG_TEGRA)
>   /* Set vector address in CP15 VBAR register */
>   ldr r0, =_start
> - add r0, r0, r9
>   mcr p15, 0, r0, c12, c0, 0  @Set VBAR
>  #endif /* !Tegra */

That's a very good catch!

For the record, the issue crept in when I applied the patch set to
remove all R_ARM_ABS32 relocation record types; after that, the only
manual relocations that should have remained were the three ones in each
relocate_code() routine, yet in armv7 there was this fourth one which
had totally escaped my attention.

I have verified in the ELF dump of omap5_evm that the "=_start"
reference is indeed relocated as part of relocate_code() execution.

As this is a bugfix, applied to u-boot-arm/master,

thanks!

Amicalement,
-- 
Albert.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] armv7: do not relocate _start twice

2013-03-15 Thread Vincent Stehlé
The _start symbol is already relocated, so do not add the relocation the second
time in c_runtime_cpu_setup.

This fixes e.g. the abort exception handling path, which ended in double fault
due to bad address in VBAR.

Signed-off-by: Vincent Stehlé 
Reported-by: Lubomir Popov 
---


Hello,

Here is a fix for a bug reported by Lubomir. He noticed that exceptions were
not handled correctly anymore. This can be seen with e.g. the 'dhcp' command on
some OMAP platforms.

Looking at the code, I would says the fix applies to all armv7 platforms except
Tegra but I did only test on OMAP5. On this platform at least the abort is now
handled:

  OMAP5430 EVM # dhcp
  data abort

  MAYBE you should read doc/README.arm-unaligned-accesses

  pc : []  lr : []
  sp : feef9dc4  ip : fefed0f8 fp : 
  r10: 0001  r9 : 0001 r8 : feef9f48
  r7 : feef9fe0  r6 :  r5 :   r4 : 0014
  r3 :   r2 : 0002 r1 : 0014  r0 : fefed0f4
  Flags: Nzcv  IRQs off  FIQs off  Mode SVC_32
  Resetting CPU ...

  resetting ...

It would be appreciated if folks could verify on other ARMv7 platforms, when
running from flash for example (where relocation may differ?)


 arch/arm/cpu/armv7/start.S |1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm/cpu/armv7/start.S b/arch/arm/cpu/armv7/start.S
index 6b59529d..d06b35f 100644
--- a/arch/arm/cpu/armv7/start.S
+++ b/arch/arm/cpu/armv7/start.S
@@ -254,7 +254,6 @@ ENTRY(c_runtime_cpu_setup)
 #if !defined(CONFIG_TEGRA)
/* Set vector address in CP15 VBAR register */
ldr r0, =_start
-   add r0, r0, r9
mcr p15, 0, r0, c12, c0, 0  @Set VBAR
 #endif /* !Tegra */
 
-- 
1.7.10.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot