powerpc/mm/radix: Use the right page size for vmemmap mapping
authorAneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Mon, 1 Jul 2019 14:34:42 +0000 (20:04 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 4 Jul 2019 14:27:21 +0000 (00:27 +1000)
We use mmu_vmemmap_psize to find the page size for mapping the vmmemap area.
With radix translation, we are suboptimally setting this value to PAGE_SIZE.

We do check for 2M page size support and update mmu_vmemap_psize to use
hugepage size but we suboptimally reset the value to PAGE_SIZE in
radix__early_init_mmu(). This resulted in always mapping vmemmap area with
64K page size.

Fixes: 2bfd65e45e87 ("powerpc/mm/radix: Add radix callbacks for early init routines")
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/mm/book3s64/radix_pgtable.c

index 8904aa1243d8063a55db832ab52e6a963f289a1b..b573fa024b3291b2ce9a0184fdb5d6e980d7d1b0 100644 (file)
@@ -520,14 +520,6 @@ void __init radix__early_init_devtree(void)
        mmu_psize_defs[MMU_PAGE_64K].shift = 16;
        mmu_psize_defs[MMU_PAGE_64K].ap = 0x5;
 found:
-#ifdef CONFIG_SPARSEMEM_VMEMMAP
-       if (mmu_psize_defs[MMU_PAGE_2M].shift) {
-               /*
-                * map vmemmap using 2M if available
-                */
-               mmu_vmemmap_psize = MMU_PAGE_2M;
-       }
-#endif /* CONFIG_SPARSEMEM_VMEMMAP */
        return;
 }
 
@@ -592,7 +584,13 @@ void __init radix__early_init_mmu(void)
 
 #ifdef CONFIG_SPARSEMEM_VMEMMAP
        /* vmemmap mapping */
-       mmu_vmemmap_psize = mmu_virtual_psize;
+       if (mmu_psize_defs[MMU_PAGE_2M].shift) {
+               /*
+                * map vmemmap using 2M if available
+                */
+               mmu_vmemmap_psize = MMU_PAGE_2M;
+       } else
+               mmu_vmemmap_psize = mmu_virtual_psize;
 #endif
        /*
         * initialize page table size