[U-Boot] [PATCH v2] fdt: Fix alignment issue when reading 64-bits properties from fdt
Simon Glass
sjg at chromium.org
Sun Oct 27 16:32:05 UTC 2019
On Tue, 22 Oct 2019 at 02:05, Jean-Jacques Hiblot <jjhiblot at ti.com> wrote:
>
> The FDT specification [0] gives a requirement of aligning properties on
> 32-bits. Make sure that the compiler is aware of this constraint when
> accessing 64-bits properties.
>
> [0]: https://github.com/devicetree-org/devicetree-specification/blob/master/source/flattened-format.rst
>
> Signed-off-by: Jean-Jacques Hiblot <jjhiblot at ti.com>
> ---
>
> Here is a portion of the disassembly of ofnode_read_u64(). It show the effect
> of the patch on ARM64.
>
> with the classic fdt64_t type. GCC emits LDR (load register)
> 34: 54000109 b.ls 54 <ofnode_read_u64+0x54> // b.plast
> 38: f9400000 ldr x0, [x0]
> 3c: dac00c00 rev x0, x0
>
> with the unaligned_fdt64_t type. GCC emits LDP (Load Pair of registers)
> 34: 54000129 b.ls 58 <ofnode_read_u64+0x58> // b.plast
> 38: 29400001 ldp w1, w0, [x0]
> 3c: aa008020 orr x0, x1, x0, lsl #32
> 40: dac00c00 rev x0, x0
>
>
> common/fdt_support.c | 2 +-
> drivers/core/ofnode.c | 2 +-
> include/linux/libfdt_env.h | 1 +
> lib/fdtdec.c | 2 +-
> 4 files changed, 4 insertions(+), 3 deletions(-)
Reviewed-by: Simon Glass <sjg at chromium.org>
No change log?
More information about the U-Boot
mailing list