ARM: 9419/1: mm: Fix kernel memory mapping for xip kernels
authorHarith G <harith.g@alifsemi.com>
Wed, 18 Sep 2024 05:57:11 +0000 (06:57 +0100)
committerRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Tue, 12 Nov 2024 16:38:46 +0000 (16:38 +0000)
commited6cbe6e5563452f305e89c15846820f2874e431
tree38f56a096f9e166338a517a969086a5e3d6188d4
parent9852d85ec9d492ebef56dc5f229416c925758edc
ARM: 9419/1: mm: Fix kernel memory mapping for xip kernels

The patchset introducing kernel_sec_start/end variables to separate the
kernel/lowmem memory mappings, broke the mapping of the kernel memory
for xipkernels.

kernel_sec_start/end variables are in RO area before the MMU is switched
on for xipkernels.
So these cannot be set early in boot in head.S. Fix this by setting these
after MMU is switched on.
xipkernels need two different mappings for kernel text (starting at
CONFIG_XIP_PHYS_ADDR) and data (starting at CONFIG_PHYS_OFFSET).
Also, move the kernel code mapping from devicemaps_init() to map_kernel().

Fixes: a91da5457085 ("ARM: 9089/1: Define kernel physical section start and end")
Signed-off-by: Harith George <harith.g@alifsemi.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
arch/arm/kernel/head.S
arch/arm/mm/mmu.c