From: Nicolas Pitre <nico@fluxnic.net>
To: Ard Biesheuvel <ardb@kernel.org>
Cc: Russell King <rmk+kernel@armlinux.org.uk>,
linux-efi@vger.kernel.org,
Linus Walleij <linus.walleij@linaro.org>,
linux-arm-kernel@lists.infradead.org,
Zhen Lei <thunder.leizhen@huawei.com>
Subject: Re: [PATCH v2 00/10] ARM: p2v: reduce min alignment to 2 MiB
Date: Mon, 21 Sep 2020 14:33:14 -0400 (EDT) [thread overview]
Message-ID: <nycvar.YSQ.7.78.906.2009211431270.2680@knanqh.ubzr> (raw)
In-Reply-To: <20200921154117.757-1-ardb@kernel.org>
On Mon, 21 Sep 2020, Ard Biesheuvel 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.
>
> Patch #1 fixes a BE8 bug in the existing code.
>
> Patch #2 incorporates a patch from a different series [1] that introduces
> the adr_l and str_l macros, for use in subsequent patches.
>
> Patch #3 moves the p2v patching code into a separate assembler source file,
> as suggested by Nico.
>
> Patches #4 to #8 perform some preparatory clean up to make the real changes
> easier to review, and more maintainable going forward.
>
> Patch #9 switches the ARM/LPAE and Thumb2 p2v patchable sequences to MOVW,
> so that we can extend the size of the immediate field in a later patch.
>
> Patch #10 increases the size of the low order immediate to 11 bits, so that
> we can deal with any physical to virtual displacement that is a multiple of
> 2 MiB.
>
> Tested in QEMU using various permutations of the the following configuration
> options:
> - ARM mode vs Thumb2 mode
> - LE vs BE8
> - LPAE vs non-LPAE
> - 3/1 split, 2/2 split, 3/1 opt split
>
> with the following diff applied to decompress the kernel at an address which
> is not 16 MiB aligned:
>
> --- a/arch/arm/boot/compressed/head.S
> +++ b/arch/arm/boot/compressed/head.S
> @@ -275,6 +275,7 @@ not_angel:
> and r4, r4, #0xf8000000
> /* Determine final kernel image address. */
> add r4, r4, #TEXT_OFFSET
> + add r4, r4, #SZ_2M
> #else
> ldr r4, =zreladdr
> #endif
>
> Changes since RFC/RFT:
> - new patches #1 - #3 and #8
> - drop bogus patching of ADD/SUB instructions, which is unnecessary, and only
> happens to work when the p2v displacement is exactly 2 GiB like on QEMU when
> running a 3/1 split
> - use a copious amount of comments to make the code more understandable and
> maintainable
>
> Cc: Zhen Lei <thunder.leizhen@huawei.com>
> Cc: Russell King <rmk+kernel@armlinux.org.uk>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Nicolas Pitre <nico@fluxnic.net>
Acked-by: Nicolas Pitre <nico@fluxnic.net>
>
> [0] https://lore.kernel.org/linux-arm-kernel/20200915015204.2971-1-thunder.leizhen@huawei.com/
> [1] https://lore.kernel.org/linux-arm-kernel/20200914095706.3985-1-ardb@kernel.org/
>
> Ard Biesheuvel (10):
> ARM: p2v: fix handling of LPAE translation in BE mode
> ARM: assembler: introduce adr_l, ldr_l and str_l macros
> ARM: p2v: move patching code to separate assembler source file
> 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: simplify __fixup_pv_table()
> 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/assembler.h | 84 +++++++
> arch/arm/include/asm/memory.h | 57 +++--
> arch/arm/kernel/Makefile | 1 +
> arch/arm/kernel/head.S | 142 ------------
> arch/arm/kernel/phys2virt.S | 238 ++++++++++++++++++++
> 6 files changed, 364 insertions(+), 160 deletions(-)
> create mode 100644 arch/arm/kernel/phys2virt.S
>
> --
> 2.17.1
>
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2020-09-21 18:34 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-21 15:41 [PATCH v2 00/10] ARM: p2v: reduce min alignment to 2 MiB Ard Biesheuvel
2020-09-21 15:41 ` [PATCH v2 01/10] ARM: p2v: fix handling of LPAE translation in BE mode Ard Biesheuvel
2020-09-21 22:18 ` Russell King - ARM Linux admin
2020-09-22 6:54 ` Ard Biesheuvel
2020-09-22 8:23 ` Linus Walleij
2020-09-21 15:41 ` [PATCH v2 02/10] ARM: assembler: introduce adr_l, ldr_l and str_l macros Ard Biesheuvel
2020-09-22 8:32 ` Linus Walleij
2020-09-21 15:41 ` [PATCH v2 03/10] ARM: p2v: move patching code to separate assembler source file Ard Biesheuvel
2020-09-22 8:34 ` Linus Walleij
2020-09-21 15:41 ` [PATCH v2 04/10] ARM: p2v: factor out shared loop processing Ard Biesheuvel
2020-09-22 8:39 ` Linus Walleij
2020-09-22 9:58 ` Ard Biesheuvel
2020-09-21 15:41 ` [PATCH v2 05/10] ARM: p2v: factor out BE8 handling Ard Biesheuvel
2020-09-22 8:51 ` Linus Walleij
2020-09-22 10:00 ` Ard Biesheuvel
2020-09-21 15:41 ` [PATCH v2 06/10] ARM: p2v: drop redundant 'type' argument from __pv_stub Ard Biesheuvel
2020-09-22 9:02 ` Linus Walleij
2020-09-21 15:41 ` [PATCH v2 07/10] ARM: p2v: use relative references in patch site arrays Ard Biesheuvel
2020-09-22 9:04 ` Linus Walleij
2020-09-22 9:50 ` Ard Biesheuvel
2020-09-21 15:41 ` [PATCH v2 08/10] ARM: p2v: simplify __fixup_pv_table() Ard Biesheuvel
2020-09-22 9:06 ` Linus Walleij
2020-09-21 15:41 ` [PATCH v2 09/10] ARM: p2v: switch to MOVW for Thumb2 and ARM/LPAE Ard Biesheuvel
2020-09-21 18:29 ` Nicolas Pitre
2020-09-21 18:45 ` Ard Biesheuvel
2020-09-22 9:00 ` Linus Walleij
2020-09-21 15:41 ` [PATCH v2 10/10] ARM: p2v: reduce p2v alignment requirement to 2 MiB Ard Biesheuvel
2020-09-22 9:11 ` Linus Walleij
2020-09-22 10:23 ` Ard Biesheuvel
2020-09-22 15:12 ` Nicolas Pitre
2020-09-22 15:25 ` Ard Biesheuvel
2020-09-21 18:33 ` Nicolas Pitre [this message]
2020-09-22 9:12 ` [PATCH v2 00/10] ARM: p2v: reduce min alignment " Linus Walleij
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=nycvar.YSQ.7.78.906.2009211431270.2680@knanqh.ubzr \
--to=nico@fluxnic.net \
--cc=ardb@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-efi@vger.kernel.org \
--cc=rmk+kernel@armlinux.org.uk \
--cc=thunder.leizhen@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).