Thread (14 messages) 14 messages, 3 authors, 2020-09-20

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

From: Ard Biesheuvel <ardb@kernel.org>
Date: 2020-09-18 17:26:58
Also in: linux-efi

On Fri, 18 Sep 2020 at 12:31, Ard Biesheuvel [off-list ref] 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 <redacted>
Cc: Russell King <redacted>
Cc: Santosh Shilimkar <redacted>
Cc: Linus Walleij <redacted>
Cc: Nicolas Pitre <nico@fluxnic.net>

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

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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help