diff options
author | Catalin Marinas <catalin.marinas@arm.com> | 2012-10-16 07:00:29 -0400 |
---|---|---|
committer | Catalin Marinas <catalin.marinas@arm.com> | 2012-10-18 15:14:00 -0400 |
commit | f71a1a42667f576ec736bb1200eba2118fee3a22 (patch) | |
tree | f1cfb7b52b8659443aa3a683ac44c8e7e9430657 | |
parent | c60b0c2817bd6a990b08a7651e9cf630414665f5 (diff) |
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.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c index 48ffb9fb3fe3..7665a9bfdb1e 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) | |||
170 | 170 | ||
171 | void __init early_init_dt_add_memory_arch(u64 base, u64 size) | 171 | void __init early_init_dt_add_memory_arch(u64 base, u64 size) |
172 | { | 172 | { |
173 | base &= PAGE_MASK; | ||
173 | size &= PAGE_MASK; | 174 | size &= PAGE_MASK; |
175 | if (base + size < PHYS_OFFSET) { | ||
176 | pr_warning("Ignoring memory block 0x%llx - 0x%llx\n", | ||
177 | base, base + size); | ||
178 | return; | ||
179 | } | ||
180 | if (base < PHYS_OFFSET) { | ||
181 | pr_warning("Ignoring memory range 0x%llx - 0x%llx\n", | ||
182 | base, PHYS_OFFSET); | ||
183 | size -= PHYS_OFFSET - base; | ||
184 | base = PHYS_OFFSET; | ||
185 | } | ||
174 | memblock_add(base, size); | 186 | memblock_add(base, size); |
175 | } | 187 | } |
176 | 188 | ||