diff options
Diffstat (limited to 'arch/arm64/mm/mmu.c')
-rw-r--r-- | arch/arm64/mm/mmu.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c index eeecc9c8ed68..a8d1059b91b2 100644 --- a/arch/arm64/mm/mmu.c +++ b/arch/arm64/mm/mmu.c | |||
@@ -297,6 +297,16 @@ static void __init map_mem(void) | |||
297 | { | 297 | { |
298 | struct memblock_region *reg; | 298 | struct memblock_region *reg; |
299 | 299 | ||
300 | /* | ||
301 | * Temporarily limit the memblock range. We need to do this as | ||
302 | * create_mapping requires puds, pmds and ptes to be allocated from | ||
303 | * memory addressable from the initial direct kernel mapping. | ||
304 | * | ||
305 | * The initial direct kernel mapping, located at swapper_pg_dir, | ||
306 | * gives us PGDIR_SIZE memory starting from PHYS_OFFSET (aligned). | ||
307 | */ | ||
308 | memblock_set_current_limit((PHYS_OFFSET & PGDIR_MASK) + PGDIR_SIZE); | ||
309 | |||
300 | /* map all the memory banks */ | 310 | /* map all the memory banks */ |
301 | for_each_memblock(memory, reg) { | 311 | for_each_memblock(memory, reg) { |
302 | phys_addr_t start = reg->base; | 312 | phys_addr_t start = reg->base; |
@@ -307,6 +317,9 @@ static void __init map_mem(void) | |||
307 | 317 | ||
308 | create_mapping(start, __phys_to_virt(start), end - start); | 318 | create_mapping(start, __phys_to_virt(start), end - start); |
309 | } | 319 | } |
320 | |||
321 | /* Limit no longer required. */ | ||
322 | memblock_set_current_limit(MEMBLOCK_ALLOC_ANYWHERE); | ||
310 | } | 323 | } |
311 | 324 | ||
312 | /* | 325 | /* |
@@ -317,12 +330,6 @@ void __init paging_init(void) | |||
317 | { | 330 | { |
318 | void *zero_page; | 331 | void *zero_page; |
319 | 332 | ||
320 | /* | ||
321 | * Maximum PGDIR_SIZE addressable via the initial direct kernel | ||
322 | * mapping in swapper_pg_dir. | ||
323 | */ | ||
324 | memblock_set_current_limit((PHYS_OFFSET & PGDIR_MASK) + PGDIR_SIZE); | ||
325 | |||
326 | init_mem_pgprot(); | 333 | init_mem_pgprot(); |
327 | map_mem(); | 334 | map_mem(); |
328 | 335 | ||
@@ -339,7 +346,6 @@ void __init paging_init(void) | |||
339 | bootmem_init(); | 346 | bootmem_init(); |
340 | 347 | ||
341 | empty_zero_page = virt_to_page(zero_page); | 348 | empty_zero_page = virt_to_page(zero_page); |
342 | __flush_dcache_page(empty_zero_page); | ||
343 | 349 | ||
344 | /* | 350 | /* |
345 | * TTBR0 is only used for the identity mapping at this stage. Make it | 351 | * TTBR0 is only used for the identity mapping at this stage. Make it |