arm64: allow kernel Image to be loaded anywhere in physical memory
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Tue, 16 Feb 2016 12:52:42 +0000 (13:52 +0100)
committerAlex Shi <alex.shi@linaro.org>
Wed, 11 May 2016 14:52:47 +0000 (22:52 +0800)
commit72b991537db5f4c361b540cbf0059c7268d848c4
tree2eadaab74eb7442c131f3fb5dc85c24d7b7d1a5b
parent368a063148f5d4e5b40e65b9954a9b98b1a7cc3c
arm64: allow kernel Image to be loaded anywhere in physical memory

This relaxes the kernel Image placement requirements, so that it
may be placed at any 2 MB aligned offset in physical memory.

This is accomplished by ignoring PHYS_OFFSET when installing
memblocks, and accounting for the apparent virtual offset of
the kernel Image. As a result, virtual address references
below PAGE_OFFSET are correctly mapped onto physical references
into the kernel Image regardless of where it sits in memory.

Special care needs to be taken for dealing with memory limits passed
via mem=, since the generic implementation clips memory top down, which
may clip the kernel image itself if it is loaded high up in memory. To
deal with this case, we simply add back the memory covering the kernel
image, which may result in more memory to be retained than was passed
as a mem= parameter.

Since mem= should not be considered a production feature, a panic notifier
handler is installed that dumps the memory limit at panic time if one was
set.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
(cherry picked from commit a7f8de168ace487fa7b88cb154e413cf40e87fc6)
Signed-off-by: Alex Shi <alex.shi@linaro.org>
Documentation/arm64/booting.txt
arch/arm64/include/asm/boot.h
arch/arm64/include/asm/kernel-pgtable.h
arch/arm64/include/asm/kvm_asm.h
arch/arm64/include/asm/memory.h
arch/arm64/kernel/head.S
arch/arm64/kernel/image.h
arch/arm64/mm/init.c
arch/arm64/mm/mmu.c