linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: ard.biesheuvel@linaro.org (Ard Biesheuvel)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] of/fdt: make memblock maximum physical address arch configurable
Date: Tue, 18 Aug 2015 11:34:41 +0200	[thread overview]
Message-ID: <1439890482-20798-2-git-send-email-ard.biesheuvel@linaro.org> (raw)
In-Reply-To: <1439890482-20798-1-git-send-email-ard.biesheuvel@linaro.org>

When parsing the memory nodes to populate the memblock memory
table, we check against high and low limits and clip any memory
that exceeds either one of them.

However, for arm64, the high limit of (phys_addr_t)~0 is not very
meaningful, since phys_addr_t is 64 bits (i.e., no limit) but there
may be other constraints that limit the memory ranges that we can
support.

So rename MAX_PHYS_ADDR to MAX_MEMBLOCK_ADDR (for clarity) and only
define it if the arch does not supply a definition of its own.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 drivers/of/fdt.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 07496560e5b9..6e82bc42373b 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -967,7 +967,9 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,
 }
 
 #ifdef CONFIG_HAVE_MEMBLOCK
-#define MAX_PHYS_ADDR	((phys_addr_t)~0)
+#ifndef MAX_MEMBLOCK_ADDR
+#define MAX_MEMBLOCK_ADDR	((phys_addr_t)~0)
+#endif
 
 void __init __weak early_init_dt_add_memory_arch(u64 base, u64 size)
 {
@@ -984,16 +986,16 @@ void __init __weak early_init_dt_add_memory_arch(u64 base, u64 size)
 	}
 	size &= PAGE_MASK;
 
-	if (base > MAX_PHYS_ADDR) {
+	if (base > MAX_MEMBLOCK_ADDR) {
 		pr_warning("Ignoring memory block 0x%llx - 0x%llx\n",
 				base, base + size);
 		return;
 	}
 
-	if (base + size - 1 > MAX_PHYS_ADDR) {
+	if (base + size - 1 > MAX_MEMBLOCK_ADDR) {
 		pr_warning("Ignoring memory range 0x%llx - 0x%llx\n",
-				((u64)MAX_PHYS_ADDR) + 1, base + size);
-		size = MAX_PHYS_ADDR - base + 1;
+				((u64)MAX_MEMBLOCK_ADDR) + 1, base + size);
+		size = MAX_MEMBLOCK_ADDR - base + 1;
 	}
 
 	if (base + size < phys_offset) {
-- 
1.9.1

  reply	other threads:[~2015-08-18  9:34 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-18  9:34 [PATCH 0/2] arm64: ignore memory outside of the linear range Ard Biesheuvel
2015-08-18  9:34 ` Ard Biesheuvel [this message]
2015-08-20  9:18   ` [PATCH 1/2] of/fdt: make memblock maximum physical address arch configurable Catalin Marinas
2015-08-23 22:01   ` Rob Herring
2015-08-18  9:34 ` [PATCH 2/2] arm64: set MAX_MEMBLOCK_ADDR according to linear region size Ard Biesheuvel
2015-08-18 10:00   ` Will Deacon
2015-08-18 10:04     ` Ard Biesheuvel
2015-08-18 17:39       ` Catalin Marinas
2015-08-18 17:44         ` Ard Biesheuvel
2015-08-19  9:15           ` Catalin Marinas
2015-08-20  5:09         ` Ard Biesheuvel
2015-08-20  9:17           ` Catalin Marinas
2015-08-18 14:24     ` Catalin Marinas
2015-08-18 14:31       ` Ard Biesheuvel
2015-08-18 14:38         ` Ard Biesheuvel
2015-08-18 14:51       ` Russell King - ARM Linux
2015-08-18 16:16         ` Catalin Marinas
2015-08-20  9:19   ` Catalin Marinas
2015-08-20 11:54     ` Ard Biesheuvel
2015-08-20 12:50       ` Catalin Marinas
2015-08-18 14:18 ` [PATCH 0/2] arm64: ignore memory outside of the linear range Stuart Yoder
2015-08-24  8:00   ` Ard Biesheuvel
2015-08-24  9:22     ` Will Deacon
2015-08-24 13:58       ` Stuart Yoder
2015-08-24 14:08         ` Will Deacon
2015-08-24 22:34           ` Stuart Yoder
2015-08-25  9:45             ` Ard Biesheuvel
2015-08-25  9:54               ` Russell King - ARM Linux
2015-08-25 10:02               ` Will Deacon
2015-08-25 10:10                 ` Ard Biesheuvel

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=1439890482-20798-2-git-send-email-ard.biesheuvel@linaro.org \
    --to=ard.biesheuvel@linaro.org \
    --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).