Skip to content

Commit fe6b3ca

Browse files
Ard Biesheuvelgregkh
authored andcommitted
arm64: set MAX_MEMBLOCK_ADDR according to linear region size
commit 34ba2c4247e5c4b1542b1106e156af324660c4f0 upstream. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 01cb08b commit fe6b3ca

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

‎arch/arm64/include/asm/memory.h‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,14 @@ extern phys_addr_t memstart_addr;
113113
/* PHYS_OFFSET - the physical address of the start of memory. */
114114
#define PHYS_OFFSET ({ memstart_addr; })
115115

116+
/*
117+
* The maximum physical address that the linear direct mapping
118+
* of system RAM can cover. (PAGE_OFFSET can be interpreted as
119+
* a 2's complement signed quantity and negated to derive the
120+
* maximum size of the linear mapping.)
121+
*/
122+
#define MAX_MEMBLOCK_ADDR ({ memstart_addr - PAGE_OFFSET - 1; })
123+
116124
/*
117125
* PFNs are used to describe any physical page; this means
118126
* PFN 0 == physical address 0.

0 commit comments

Comments
 (0)