Skip to content

Commit ae97b43

Browse files
mrutland-armAlex Shi
authored andcommitted
arm64: mm: allocate pagetables anywhere
Now that create_mapping uses fixmap slots to modify pte, pmd, and pud entries, we can access page tables anywhere in physical memory, regardless of the extent of the linear mapping. Given that, we no longer need to limit memblock allocations during page table creation, and can leave the limit as its default MEMBLOCK_ALLOC_ANYWHERE. We never add memory which will fall outside of the linear map range given phys_offset and MAX_MEMBLOCK_ADDR are configured appropriately, so any tables we create will fall in the linear map of the final tables. Signed-off-by: Mark Rutland <mark.rutland@arm.com> Reviewed-by: Catalin Marinas <catalin.marinas@arm.com> Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Tested-by: Jeremy Linton <jeremy.linton@arm.com> Cc: Laura Abbott <labbott@fedoraproject.org> Cc: Will Deacon <will.deacon@arm.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> (cherry picked from commit cdef5f6e9e0e5ee397759b664a9f875ff59ccf01) Signed-off-by: Alex Shi <alex.shi@linaro.org>
1 parent af72fa1 commit ae97b43

1 file changed

Lines changed: 0 additions & 35 deletions

File tree

arch/arm64/mm/mmu.c

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -376,20 +376,6 @@ static void __init __map_memblock(phys_addr_t start, phys_addr_t end)
376376
static void __init map_mem(void)
377377
{
378378
struct memblock_region *reg;
379-
phys_addr_t limit;
380-
381-
/*
382-
* Temporarily limit the memblock range. We need to do this as
383-
* create_mapping requires puds, pmds and ptes to be allocated from
384-
* memory addressable from the initial direct kernel mapping.
385-
*
386-
* The initial direct kernel mapping, located at swapper_pg_dir, gives
387-
* us PUD_SIZE (with SECTION maps) or PMD_SIZE (without SECTION maps,
388-
* memory starting from PHYS_OFFSET (which must be aligned to 2MB as
389-
* per Documentation/arm64/booting.txt).
390-
*/
391-
limit = PHYS_OFFSET + SWAPPER_INIT_MAP_SIZE;
392-
memblock_set_current_limit(limit);
393379

394380
/* map all the memory banks */
395381
for_each_memblock(memory, reg) {
@@ -399,29 +385,8 @@ static void __init map_mem(void)
399385
if (start >= end)
400386
break;
401387

402-
if (ARM64_SWAPPER_USES_SECTION_MAPS) {
403-
/*
404-
* For the first memory bank align the start address and
405-
* current memblock limit to prevent create_mapping() from
406-
* allocating pte page tables from unmapped memory. With
407-
* the section maps, if the first block doesn't end on section
408-
* size boundary, create_mapping() will try to allocate a pte
409-
* page, which may be returned from an unmapped area.
410-
* When section maps are not used, the pte page table for the
411-
* current limit is already present in swapper_pg_dir.
412-
*/
413-
if (start < limit)
414-
start = ALIGN(start, SECTION_SIZE);
415-
if (end < limit) {
416-
limit = end & SECTION_MASK;
417-
memblock_set_current_limit(limit);
418-
}
419-
}
420388
__map_memblock(start, end);
421389
}
422-
423-
/* Limit no longer required. */
424-
memblock_set_current_limit(MEMBLOCK_ALLOC_ANYWHERE);
425390
}
426391

427392
static void __init fixup_executable(void)

0 commit comments

Comments
 (0)