mmu.c (7249b79f6b4cc3c2aa9138dca52e535a4c789107) mmu.c (f6bc87c39d52b2b7aa83f16fcee46daefd26cd4d)
1/*
2 * Based on arch/arm/mm/mmu.c
3 *
4 * Copyright (C) 1995-2005 Russell King
5 * Copyright (C) 2012 ARM Ltd.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as

--- 283 unchanged lines hidden (view full) ---

292 return (void __iomem *)((virt & mask) + (phys & ~mask));
293}
294#endif
295
296static void __init map_mem(void)
297{
298 struct memblock_region *reg;
299
1/*
2 * Based on arch/arm/mm/mmu.c
3 *
4 * Copyright (C) 1995-2005 Russell King
5 * Copyright (C) 2012 ARM Ltd.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as

--- 283 unchanged lines hidden (view full) ---

292 return (void __iomem *)((virt & mask) + (phys & ~mask));
293}
294#endif
295
296static void __init map_mem(void)
297{
298 struct memblock_region *reg;
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 */
301 for_each_memblock(memory, reg) {
302 phys_addr_t start = reg->base;
303 phys_addr_t end = start + reg->size;
304
305 if (start >= end)
306 break;
307
308 create_mapping(start, __phys_to_virt(start), end - start);
309 }
310 /* map all the memory banks */
311 for_each_memblock(memory, reg) {
312 phys_addr_t start = reg->base;
313 phys_addr_t end = start + reg->size;
314
315 if (start >= end)
316 break;
317
318 create_mapping(start, __phys_to_virt(start), end - start);
319 }
320
321 /* Limit no longer required. */
322 memblock_set_current_limit(MEMBLOCK_ALLOC_ANYWHERE);
310}
311
312/*
313 * paging_init() sets up the page tables, initialises the zone memory
314 * maps and sets up the zero page.
315 */
316void __init paging_init(void)
317{
318 void *zero_page;
319
323}
324
325/*
326 * paging_init() sets up the page tables, initialises the zone memory
327 * maps and sets up the zero page.
328 */
329void __init paging_init(void)
330{
331 void *zero_page;
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();
327 map_mem();
328
329 /*
330 * Finally flush the caches and tlb to ensure that we're in a
331 * consistent state.
332 */
333 flush_cache_all();
334 flush_tlb_all();
335
336 /* allocate the zero page. */
337 zero_page = early_alloc(PAGE_SIZE);
338
339 bootmem_init();
340
341 empty_zero_page = virt_to_page(zero_page);
333 init_mem_pgprot();
334 map_mem();
335
336 /*
337 * Finally flush the caches and tlb to ensure that we're in a
338 * consistent state.
339 */
340 flush_cache_all();
341 flush_tlb_all();
342
343 /* allocate the zero page. */
344 zero_page = early_alloc(PAGE_SIZE);
345
346 bootmem_init();
347
348 empty_zero_page = virt_to_page(zero_page);
349 __flush_dcache_page(empty_zero_page);
342
343 /*
344 * TTBR0 is only used for the identity mapping at this stage. Make it
345 * point to zero page to avoid speculatively fetching new entries.
346 */
347 cpu_set_reserved_ttbr0();
348 flush_tlb_all();
349}

--- 87 unchanged lines hidden ---
350
351 /*
352 * TTBR0 is only used for the identity mapping at this stage. Make it
353 * point to zero page to avoid speculatively fetching new entries.
354 */
355 cpu_set_reserved_ttbr0();
356 flush_tlb_all();
357}

--- 87 unchanged lines hidden ---