Some decompressors rely on wide unaligned loads, which get very expensive on strict alignment architectures such as ARM due to the need for the compiler to reassemble each wide load byte at a time.
On the other hand, some ARM platforms such as Rockchip enable the MMU and d-cache early, making plain unaligned loads work too. Current Makefiles force the compiler to work around the unaligned loads unconditionally, which in case of e.g. Zstd in SPL on Rockchip degrades its performance by a factor of 4+ compared to native unaligned loads. Add an option for arches to opt out of the strict alignment flags for decompressors, when they can guarantee that wide unaligned loads are safe. This improves the decompression performance and reduces the SPL size due to fewer instructions generated per each unaligned load. CI for this series: https://git.u-boot-project.org/u-boot/contributors/alchark/u-boot/-/pipelines/1431 --- Changes in v2: - More caution-forward messaging in the symbol name and help texts (thanks Tom) - Link to v1: https://patch.msgid.link/[email protected] To: [email protected] To: Simon Glass <[email protected]> Cc: Tom Rini <[email protected]> Cc: Ilias Apalodimas <[email protected]> Cc: Alexey Charkov <[email protected]> Cc: Johan Jonker <[email protected]> Cc: Casey Connolly <[email protected]> Cc: Vincent Jardin <[email protected]> Cc: Michael Srba <[email protected]> Cc: Cole Munz <[email protected]> Cc: Quentin Schulz <[email protected]> Cc: Kever Yang <[email protected]> --- Alexey Charkov (2): lib: Let the decompressors use unaligned loads if platform allows rockchip: Declare unaligned access safe in the ARM64 SPL arch/Kconfig | 35 +++++++++++++++++++++++++++++++++++ arch/arm/cpu/armv7/config.mk | 3 +++ arch/arm/cpu/armv8/config.mk | 3 +++ arch/arm/mach-rockchip/Kconfig | 5 +++++ lib/Makefile | 3 +++ lib/lzma/Makefile | 8 ++++++++ lib/lzo/Makefile | 8 ++++++++ lib/zlib/Makefile | 8 ++++++++ lib/zstd/Makefile | 8 ++++++++ 9 files changed, 81 insertions(+) --- base-commit: ed28577c31d895fa766ffb71ec1c35c4b39db2a7 change-id: 20260918-unaligned-decomp-0efee141e754 Best regards, -- Alexey Charkov <[email protected]>
