Re: [PATCH v2 10/10] ARM: p2v: reduce p2v alignment requirement to 2 MiB
From: Linus Walleij <hidden>
Date: 2020-09-22 09:12:58
Also in:
linux-efi
On Mon, Sep 21, 2020 at 5:41 PM Ard Biesheuvel [off-list ref] wrote:
Update the p2v patching code so we can deal with displacements that are not a multiple of 16 MiB but of 2 MiB, to prevent wasting of up to 14 MiB of physical RAM when running on a platform where the start of memory is not correctly aligned. For the ARM code path, this simply comes down to using two add/sub instructions instead of one for the carryless version, and patching each of them with the correct immediate depending on the rotation field. For the LPAE calculation, it patches the MOVW instruction with up to 12 bits of offset. For the Thumb2 code path, patching more than 11 bits off displacement is somewhat cumbersome, and given that 11 bits produce a minimum alignment of 2 MiB, which is also the granularity for LPAE block mappings, it makes sense to stick to 2 MiB for the new p2v requirement. Suggested-by: Zhen Lei <redacted> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
My understanding of what is going on is limited to the high level of things, and being able to do this is just a great thing so FWIW: Acked-by: Linus Walleij <redacted> If you or Russell need more thorough review I can sit down and try to understand at the bit granularity what is going on but it requires a bunch of time. Just tell me if you need this. Yours, Linus Walleij _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel