[U-Boot] [PATCH] arm: enable unaligned access on ARMv7

Lucas Stach dev at lynxeye.de
Sun Jun 24 08:30:19 CEST 2012


Hi Albert,

Am Samstag, den 23.06.2012, 11:01 +0200 schrieb Albert ARIBAUD:
[snip]
> > >> But apart from this, we certainly have situations where we have
> > >> unaligned accesses that are justified and could not be removed.
> > >> [...]
> > >> I cannot see how enabling a hardware feature can be seen as
> > >> allowing of lax behaviour. As some of the USB structs are used to
> > >> access hardware registers, we can not align every struct there.
> 
> If the access is in true RAM, then we can always realign the data; and
> I don't know of memory-mapped registers which would be unaligned wrt
> their width. If some USB controller is designed so, then the fix should
> only and explicitly affect that controller, because we don't know it it
> will always be used with an ARM implementation that can do unaligned
> accesses.

My point is: on ARM platforms that can't do unaligned access in hardware
the toolchain will automaticly emit helper code to work around this. On
an ARMv7 platform hardware assisted unaligned access is mandatory, so
toolchains will not emit helper code and rather let the hardware do it's
job. 
Now the situation is as follows: hardware platforms without the ability
to do unaligned access in hardware will just work even though the code
is suboptimal, but users of an ARMv7 platform will encounter unexplained
system hangs, which is bad imho. This patch just makes behaviour
consistent across ARMv5 and ARMv7 platforms.

If we really want to disallow the use of unaligned memory operations in
U-Boot we should make all platforms fail at compile time, not make one
platform fail randomly at runtime. Do you think this is the way to go?
I'm fine either way, I'm just not okay with the current situation where
one platform fails while another just works.

Thanks,
Lucas




More information about the U-Boot mailing list