From 03b601aff130616e730ac81cc6f448f2bd2bc192 Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Thu, 10 Dec 2020 21:27:36 -0500 Subject: libfdt: Internally perform potentially unaligned loads Commits 6dcb8ba4 "libfdt: Add helpers for accessing unaligned words" introduced changes to support unaligned reads for ARM platforms and 11738cf01f15 "libfdt: Don't use memcpy to handle unaligned reads on ARM" improved the performance of these helpers. On further discussion, while there are potential cases where we could be used on platforms that do not fixup unaligned reads for us, making this choice the default is very expensive in terms of binary size and access time. To address this, introduce and use new fdt{32,64}_ld_ functions that call fdt{32,64}_to_cpu() as was done prior to the above mentioned commits. Leave the existing load functions as unaligned-safe and include comments in both cases. Reviewed-by: Rob Herring Signed-off-by: Tom Rini Message-Id: <20201211022736.31657-1-trini@konsulko.com> Tested-by: John Paul Adrian Glaubitz Signed-off-by: David Gibson --- cpukit/include/libfdt.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'cpukit/include/libfdt.h') diff --git a/cpukit/include/libfdt.h b/cpukit/include/libfdt.h index 89adee3cd7..2bc16a8b3f 100644 --- a/cpukit/include/libfdt.h +++ b/cpukit/include/libfdt.h @@ -126,12 +126,10 @@ static inline void *fdt_offset_ptr_w(void *fdt, int offset, int checklen) uint32_t fdt_next_tag(const void *fdt, int offset, int *nextoffset); /* - * Alignment helpers: - * These helpers access words from a device tree blob. They're - * built to work even with unaligned pointers on platforms (ike - * ARM) that don't like unaligned loads and stores + * External helpers to access words from a device tree blob. They're built + * to work even with unaligned pointers on platforms (such as ARMv5) that don't + * like unaligned loads and stores. */ - static inline uint32_t fdt32_ld(const fdt32_t *p) { const uint8_t *bp = (const uint8_t *)p; -- cgit v1.2.3