[RFC/RFT PATCH 0/6] ARM: p2v: reduce min alignment to 2 MiB

Ard Biesheuvel ardb at kernel.org
Fri Sep 18 06:30:56 EDT 2020


This series is inspired by Zhei Len's series [0], which updates the
ARM p2v patching code to optionally support p2v relative alignments
of as little as 64 KiB.

Reducing this alignment is necessary for some specific Huawei boards,
but given that reducing this minimum alignment will make the boot
sequence more robust for all platforms, especially EFI boot, which
no longer relies on the 128 MB masking of the decompressor load address,
but uses firmware memory allocation routines to find a suitable spot
for the decompressed kernel.

This series is not based on Zhei Len's code, but addresses the same
problem, and takes some feedback given in the review into account:
- use of a MOVW instruction to avoid two adds/adcs sequences when dealing
  with the carry on LPAE
- add support for Thumb2 kernels as well
- make the change unconditional - it will bit rot otherwise, and has value
  for other platforms as well.

The first four patches are general cleanup and preparatory changes.
Patch #5 implements the switch to a MOVW instruction without changing
the minimum alignment.
Patch #6 reduces the minimum alignment to 2 MiB.

Tested on QEMU in ARM/!LPAE, ARM/LPAE, Thumb2/!LPAE and Thumb2/LPAE modes.

Cc: Zhen Lei <thunder.leizhen at huawei.com>
Cc: Russell King <rmk+kernel at armlinux.org.uk>
Cc: Santosh Shilimkar <santosh.shilimkar at ti.com>
Cc: Linus Walleij <linus.walleij at linaro.org>
Cc: Nicolas Pitre <nico at fluxnic.net>

[0] https://lore.kernel.org/linux-arm-kernel/20200915015204.2971-1-thunder.leizhen@huawei.com/

Ard Biesheuvel (6):
  ARM: p2v: factor out shared loop processing
  ARM: p2v: factor out BE8 handling
  ARM: p2v: drop redundant 'type' argument from __pv_stub
  ARM: p2v: use relative references in patch site arrays
  ARM: p2v: switch to MOVW for Thumb2 and ARM/LPAE
  ARM: p2v: reduce p2v alignment requirement to 2 MiB

 arch/arm/Kconfig              |   2 +-
 arch/arm/include/asm/memory.h |  58 ++++++---
 arch/arm/kernel/head.S        | 136 ++++++++++++--------
 3 files changed, 123 insertions(+), 73 deletions(-)

-- 
2.17.1




More information about the linux-arm-kernel mailing list