On Fri, 18 Sep 2020 at 12:31, Ard Biesheuvel <ardb@xxxxxxxxxx> wrote: > > 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@xxxxxxxxxx> > Cc: Russell King <rmk+kernel@xxxxxxxxxxxxxxx> > Cc: Santosh Shilimkar <santosh.shilimkar@xxxxxx> > Cc: Linus Walleij <linus.walleij@xxxxxxxxxx> > Cc: Nicolas Pitre <nico@xxxxxxxxxxx> > > [0] https://lore.kernel.org/linux-arm-kernel/20200915015204.2971-1-thunder.leizhen@xxxxxxxxxx/ > > 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 > Note: there is a thinko in this version of the patches, as it unnecessarily patches ADD instructions into SUB and vice versa. Since QEMU has its DRAM at 0x4000_0000, the translation for a 3g/1g split is 0x8000_0000, which why it worked in my testing, but will fail on other platforms (or with other splits, for that matter) For the general discussion of the approach taken here, that does not really matter, so I won't send a v2 until people have had some time to have a look. However, if you want to test this code on other hardware, please use the code at the following link instead: https://git.kernel.org/pub/scm/linux/kernel/git/ardb/linux.git/log/?h=arm-p2v-v2