Re: [U-Boot] [PATCH v2] fdt: Fix alignment issue when reading 64-bits properties from fdt
On Tue, 22 Oct 2019 at 02:05, Jean-Jacques Hiblot 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 > --- > > 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: 54000109b.ls54 // b.plast > 38: f940ldr x0, [x0] > 3c: dac00c00rev x0, x0 > > with the unaligned_fdt64_t type. GCC emits LDP (Load Pair of registers) > 34: 54000129b.ls58 // b.plast > 38: 2941ldp w1, w0, [x0] > 3c: aa008020orr x0, x1, x0, lsl #32 > 40: dac00c00rev 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 No change log? Applied to u-boot-dm, thanks! ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2] fdt: Fix alignment issue when reading 64-bits properties from fdt
On Tue, 22 Oct 2019 at 02:05, Jean-Jacques Hiblot 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 > --- > > 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: 54000109b.ls54 // b.plast > 38: f940ldr x0, [x0] > 3c: dac00c00rev x0, x0 > > with the unaligned_fdt64_t type. GCC emits LDP (Load Pair of registers) > 34: 54000129b.ls58 // b.plast > 38: 2941ldp w1, w0, [x0] > 3c: aa008020orr x0, x1, x0, lsl #32 > 40: dac00c00rev 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 No change log? ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot