Merge tag 'at91-drivers-for-3.17' of git://git.kernel.org/pub/scm/linux/kernel/git...
[deliverable/linux.git] / arch / arm64 / mm / mmu.c
index c43f1dd194898d36e9ccb8ffe64d48cd4dadeca6..c55567283cded6e15f98e33a27bcd5695f67bfef 100644 (file)
@@ -32,6 +32,7 @@
 #include <asm/setup.h>
 #include <asm/sizes.h>
 #include <asm/tlb.h>
+#include <asm/memblock.h>
 #include <asm/mmu_context.h>
 
 #include "mm.h"
@@ -204,9 +205,16 @@ static void __init alloc_init_pud(pgd_t *pgd, unsigned long addr,
                                  unsigned long end, unsigned long phys,
                                  int map_io)
 {
-       pud_t *pud = pud_offset(pgd, addr);
+       pud_t *pud;
        unsigned long next;
 
+       if (pgd_none(*pgd)) {
+               pud = early_alloc(PTRS_PER_PUD * sizeof(pud_t));
+               pgd_populate(&init_mm, pgd, pud);
+       }
+       BUG_ON(pgd_bad(*pgd));
+
+       pud = pud_offset(pgd, addr);
        do {
                next = pud_addr_end(addr, end);
 
@@ -290,10 +298,10 @@ static void __init map_mem(void)
         * memory addressable from the initial direct kernel mapping.
         *
         * The initial direct kernel mapping, located at swapper_pg_dir,
-        * gives us PGDIR_SIZE memory starting from PHYS_OFFSET (which must be
+        * gives us PUD_SIZE memory starting from PHYS_OFFSET (which must be
         * aligned to 2MB as per Documentation/arm64/booting.txt).
         */
-       limit = PHYS_OFFSET + PGDIR_SIZE;
+       limit = PHYS_OFFSET + PUD_SIZE;
        memblock_set_current_limit(limit);
 
        /* map all the memory banks */
This page took 0.029314 seconds and 5 git commands to generate.