summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCatalin Marinas <catalin.marinas@arm.com>2012-10-16 12:00:29 +0100
committerCatalin Marinas <catalin.marinas@arm.com>2012-10-18 20:14:00 +0100
commitf71a1a42667f576ec736bb1200eba2118fee3a22 (patch)
treef1cfb7b52b8659443aa3a683ac44c8e7e9430657
parentc60b0c2817bd6a990b08a7651e9cf630414665f5 (diff)
downloadlinux-3.10-f71a1a42667f576ec736bb1200eba2118fee3a22.tar.gz
linux-3.10-f71a1a42667f576ec736bb1200eba2118fee3a22.tar.bz2
linux-3.10-f71a1a42667f576ec736bb1200eba2118fee3a22.zip
arm64: Ignore memory blocks below PHYS_OFFSET
According to Documentation/arm64/booting.txt, the kernel image must be loaded at a pre-defined offset from the start of RAM so that the kernel can calculate PHYS_OFFSET based on this address. If the DT contains memory blocks below this PHYS_OFFSET, report them and ignore the corresponding memory range. Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
-rw-r--r--arch/arm64/kernel/setup.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index 48ffb9fb3fe..7665a9bfdb1 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -170,7 +170,19 @@ static void __init setup_machine_fdt(phys_addr_t dt_phys)
void __init early_init_dt_add_memory_arch(u64 base, u64 size)
{
+ base &= PAGE_MASK;
size &= PAGE_MASK;
+ if (base + size < PHYS_OFFSET) {
+ pr_warning("Ignoring memory block 0x%llx - 0x%llx\n",
+ base, base + size);
+ return;
+ }
+ if (base < PHYS_OFFSET) {
+ pr_warning("Ignoring memory range 0x%llx - 0x%llx\n",
+ base, PHYS_OFFSET);
+ size -= PHYS_OFFSET - base;
+ base = PHYS_OFFSET;
+ }
memblock_add(base, size);
}