Skip to content

Commit

Permalink
ARM: ignore memory below PHYS_OFFSET
Browse files Browse the repository at this point in the history
commit 571b143 upstream.

If the kernel is loaded higher in physical memory than normal, and we
calculate PHYS_OFFSET higher than the start of RAM, this leads to
boot problems as we attempt to map part of this RAM into userspace.
Rather than struggle with this, just truncate the mapping.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Cc: Wang Nan <wangnan0@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Russell King authored and Greg Kroah-Hartman committed Mar 24, 2014
1 parent 307af15 commit 22fc722
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions arch/arm/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,20 @@ int __init arm_add_memory(phys_addr_t start, phys_addr_t size)
}
#endif

if (aligned_start < PHYS_OFFSET) {
if (aligned_start + size <= PHYS_OFFSET) {
pr_info("Ignoring memory below PHYS_OFFSET: 0x%08llx-0x%08llx\n",
aligned_start, aligned_start + size);
return -EINVAL;
}

pr_info("Ignoring memory below PHYS_OFFSET: 0x%08llx-0x%08llx\n",
aligned_start, (u64)PHYS_OFFSET);

size -= PHYS_OFFSET - aligned_start;
aligned_start = PHYS_OFFSET;
}

bank->start = aligned_start;
bank->size = size & ~(phys_addr_t)(PAGE_SIZE - 1);

Expand Down

0 comments on commit 22fc722

Please sign in to comment.