Skip to content

lib: Allow unaligned memory access from decompressors selectively

Alexey Charkov u-boot 2 versions – In review

Get series with b4
b4 am [email protected] change-id 20260918-unaligned-decomp-0efee141e754

Versions newest first

  1. v2 Latest2 patches 8 repliesIn review
  2. v12 patches 1 replySuperseded

Changes in v2 from the cover letter

- More caution-forward messaging in the symbol name and help texts (thanks Tom)
- Link to v1: https://patch.msgid.link/[email protected]

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2lib: Let the decompressors use unaligned loads if platform allowsarch/Kconfig arch/arm/cpu/armv7/config.mk arch/arm/cpu/armv8/config.mk +5 more+76 -06 replies
2/2rockchip: Declare unaligned access safe in the ARM64 SPLarch/arm/mach-rockchip/Kconfig+5 -02 replies

Reviews trailers per patch

1 of 2 patches has a Reviewed-by or Acked-by.

PatchTom Rini
1/2R-b
2/2

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/2] lib: Allow unaligned memory access from decompressors selectively

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,

Signature · 1 line
Alexey Charkov <[email protected]>