aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm64/mm
diff options
context:
space:
mode:
authorMark Rutland <mark.rutland@arm.com>2015-01-15 11:42:14 -0500
committerCatalin Marinas <catalin.marinas@arm.com>2015-01-16 11:21:58 -0500
commit6083fe74b7bfffc2c7be8c711596608bda0cda6e (patch)
tree2a7b9401b1d12ff52ee38645f8156a91a6c4cccf /arch/arm64/mm
parent7fe5d2b1daf6fd82857a8d0ee47547d7852ebe7b (diff)
arm64: respect mem= for EFI
When booting with EFI, we acquire the EFI memory map after parsing the early params. This unfortuantely renders the option useless as we call memblock_enforce_memory_limit (which uses memblock_remove_range behind the scenes) before we've added any memblocks. We end up removing nothing, then adding all of memory later when efi_init calls reserve_regions. Instead, we can log the limit and apply this later when we do the rest of the memblock work in memblock_init, which should work regardless of the presence of EFI. At the same time we may as well move the early parameter into arm64's mm/init.c, close to arm64_memblock_init. Any memory which must be mapped (e.g. for use by EFI runtime services) must be mapped explicitly reather than relying on the linear mapping, which may be truncated as a result of a mem= option passed on the kernel command line. Signed-off-by: Mark Rutland <mark.rutland@arm.com> Acked-by: Catalin Marinas <catalin.marinas@arm.com> Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Leif Lindholm <leif.lindholm@linaro.org> Cc: Will Deacon <will.deacon@arm.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'arch/arm64/mm')
-rw-r--r--arch/arm64/mm/init.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index bac492c12fcc..11c7b701b681 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -136,10 +136,29 @@ static void arm64_memory_present(void)
136} 136}
137#endif 137#endif
138 138
139static phys_addr_t memory_limit = (phys_addr_t)ULLONG_MAX;
140
141/*
142 * Limit the memory size that was specified via FDT.
143 */
144static int __init early_mem(char *p)
145{
146 if (!p)
147 return 1;
148
149 memory_limit = memparse(p, &p) & PAGE_MASK;
150 pr_notice("Memory limited to %lldMB\n", memory_limit >> 20);
151
152 return 0;
153}
154early_param("mem", early_mem);
155
139void __init arm64_memblock_init(void) 156void __init arm64_memblock_init(void)
140{ 157{
141 phys_addr_t dma_phys_limit = 0; 158 phys_addr_t dma_phys_limit = 0;
142 159
160 memblock_enforce_memory_limit(memory_limit);
161
143 /* 162 /*
144 * Register the kernel text, kernel data, initrd, and initial 163 * Register the kernel text, kernel data, initrd, and initial
145 * pagetables with memblock. 164 * pagetables with memblock.