[PATCH v2] ARM: Fix Keystone 2 kernel mapping regression

Nishanth Menon nm at ti.com
Wed Aug 4 15:19:58 PDT 2021


On 21:27-20210804, Linus Walleij wrote:
> This fixes a Keystone 2 regression discovered as a side effect of
> defining an passing the physical start/end sections of the kernel
> to the MMU remapping code.
> 
> As the Keystone applies an offset to all physical addresses,
> including those identified and patches by phys2virt, we fail to
> account for this offset in the kernel_sec_start and kernel_sec_end
> variables.
> 
> Further these offsets can extend into the 64bit range on LPAE
> systems such as the Keystone 2.
> 
> Fix it like this:
> - Extend kernel_sec_start and kernel_sec_end to be 64bit
> - Add the offset also to kernel_sec_start and kernel_sec_end
> 
> As passing kernel_sec_start and kernel_sec_end as 64bit invariably
> incurs BE8 endianness issues I have attempted to dry-code around
> these.
> 
> Tested on the Vexpress QEMU model both with and without LPAE
> enabled.
> 
> Fixes: 6e121df14ccd ("ARM: 9090/1: Map the lowmem and kernel separately")
> Reported-by: Nishanth Menon <nmenon at kernel.org>
> Suggested-by: Russell King <linux at armlinux.org.uk>
> Tested-by: Grygorii Strashko <grygorii.strashko at ti.com>
> Tested-by: Nishanth Menon <nmenon at kernel.org>
> Signed-off-by: Linus Walleij <linus.walleij at linaro.org>
> Signed-off-by: Nishanth Menon <nm at ti.com>
> Link: https://lore.kernel.org/r/20210804192759.750112-1-linus.walleij@linaro.org
> ---
> ChangeLog v1->v2:
> - Better assembly, pass the #4 addition along in the str instruction
>   str r8, [r5, #4]
> - Collect Tested-by tags from successful boot tests on Keystone 2.
> - I will put this into Russell's patch tracker immediately.
> ---

Recheck still looks good:
k2g-ice: https://pastebin.ubuntu.com/p/xchg8F6T8z/
k2g-evm: https://pastebin.ubuntu.com/p/zrJCQhVdrk/
k2hk-evm: https://pastebin.ubuntu.com/p/zj5qwkNppv/


Thanks.
-- 
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 849D 1736 249D



More information about the linux-arm-kernel mailing list