]> git.karo-electronics.de Git - linux-beck.git/commitdiff
arm64: set MAX_MEMBLOCK_ADDR according to linear region size
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Tue, 18 Aug 2015 09:34:42 +0000 (10:34 +0100)
committerWill Deacon <will.deacon@arm.com>
Mon, 24 Aug 2015 09:23:19 +0000 (10:23 +0100)
The linear region size of a 39-bit VA kernel is only 256 GB, which
may be insufficient to cover all of system RAM, even on platforms
that have much less than 256 GB of memory but which is laid out
very sparsely.

So make sure we clip the memory we will not be able to map before
installing it into the memblock memory table, by setting
MAX_MEMBLOCK_ADDR accordingly.

Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Tested-by: Stuart Yoder <stuart.yoder@freescale.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
arch/arm64/include/asm/memory.h

index f800d45ea2265b2805668a0681bf9f300c7c1faf..44a59c20e77358f98c7ad22c8ace5a1dd07bc7fd 100644 (file)
@@ -113,6 +113,14 @@ extern phys_addr_t         memstart_addr;
 /* PHYS_OFFSET - the physical address of the start of memory. */
 #define PHYS_OFFSET            ({ memstart_addr; })
 
+/*
+ * The maximum physical address that the linear direct mapping
+ * of system RAM can cover. (PAGE_OFFSET can be interpreted as
+ * a 2's complement signed quantity and negated to derive the
+ * maximum size of the linear mapping.)
+ */
+#define MAX_MEMBLOCK_ADDR      ({ memstart_addr - PAGE_OFFSET - 1; })
+
 /*
  * PFNs are used to describe any physical page; this means
  * PFN 0 == physical address 0.