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/1322

Signed-off-by: Alexey Charkov <[email protected]>
---
Alexey Charkov (2):
      lib: Let the decompressors use unaligned loads where they are safe
      rockchip: Declare unaligned access safe in the ARM64 SPL

 arch/Kconfig                   | 27 +++++++++++++++++++++++++++
 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, 73 insertions(+)
---
base-commit: b8e0086b585791a771416ce51b58ce0097bc0b28
change-id: 20260918-unaligned-decomp-0efee141e754

Best regards,
--  
Alexey Charkov <[email protected]>

Reply via email to