From: catalin.marinas@arm.com (Catalin Marinas)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/4] arm64: Ignore memory blocks below PHYS_OFFSET
Date: Tue, 16 Oct 2012 17:46:39 +0100 [thread overview]
Message-ID: <1350406000-30882-4-git-send-email-catalin.marinas@arm.com> (raw)
In-Reply-To: <1350406000-30882-1-git-send-email-catalin.marinas@arm.com>
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>
---
arch/arm64/kernel/setup.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index 48ffb9f..7665a9b 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);
}
next prev parent reply other threads:[~2012-10-16 16:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-16 16:46 [PATCH 0/4] arm64: Random fixes for 3.7 Catalin Marinas
2012-10-16 16:46 ` [PATCH 1/4] arm64: Select MODULES_USE_ELF_RELA Catalin Marinas
2012-10-16 16:53 ` Will Deacon
2012-10-16 16:46 ` [PATCH 2/4] arm64: Fix the update_vsyscall() prototype Catalin Marinas
2012-11-09 22:47 ` John Stultz
2012-10-16 16:46 ` Catalin Marinas [this message]
2012-10-16 16:46 ` [PATCH 4/4] arm64: No need to set the x0-x2 registers in start_thread() Catalin Marinas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1350406000-30882-4-git-send-email-catalin.marinas@arm.com \
--to=catalin.marinas@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).