mm/ioremap: probe platform for p4d huge map support
authorAnshuman Khandual <anshuman.khandual@arm.com>
Tue, 16 Jul 2019 23:27:33 +0000 (16:27 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 17 Jul 2019 02:23:22 +0000 (19:23 -0700)
Finish up what commit c2febafc6773 ("mm: convert generic code to 5-level
paging") started while levelling up P4D huge mapping support at par with
PUD and PMD.  A new arch call back arch_ioremap_p4d_supported() is added
which just maintains status quo (P4D huge map not supported) on x86,
arm64 and powerpc.

When HAVE_ARCH_HUGE_VMAP is enabled its just a simple check from the
arch about the support, hence runtime effects are minimal.

Link: http://lkml.kernel.org/r/1561699231-20991-1-git-send-email-anshuman.khandual@arm.com
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/arm64/mm/mmu.c
arch/powerpc/mm/book3s64/radix_pgtable.c
arch/x86/mm/ioremap.c
include/linux/io.h
lib/ioremap.c

index 1b49c08dfa2b5582a920cf20daa20dd61b3d9a9c..e661469cabdd4e5e1235bf2e817198ebab25c244 100644 (file)
@@ -942,6 +942,11 @@ void *__init fixmap_remap_fdt(phys_addr_t dt_phys)
        return dt_virt;
 }
 
+int __init arch_ioremap_p4d_supported(void)
+{
+       return 0;
+}
+
 int __init arch_ioremap_pud_supported(void)
 {
        /*
index 65c2ba1e1783b63f46e11252888bb0d9557468f2..b4ca9e95e678110e7f0f07fd9a9d6688a1658d5a 100644 (file)
@@ -1237,3 +1237,8 @@ int radix__ioremap_range(unsigned long ea, phys_addr_t pa, unsigned long size,
                return 0;
        }
 }
+
+int __init arch_ioremap_p4d_supported(void)
+{
+       return 0;
+}
index e500f1df114025400258869081586dd97c01b7cd..63e99f15d7cf0eedc9b5b522b4d24e36a2708fde 100644 (file)
@@ -459,6 +459,11 @@ void iounmap(volatile void __iomem *addr)
 }
 EXPORT_SYMBOL(iounmap);
 
+int __init arch_ioremap_p4d_supported(void)
+{
+       return 0;
+}
+
 int __init arch_ioremap_pud_supported(void)
 {
 #ifdef CONFIG_X86_64
index 9876e5801a9d9dde9a3debd7e7ef04dd3feff7cd..accac822336aabfc5bce6c65eab939c19d20e22d 100644 (file)
@@ -33,6 +33,7 @@ static inline int ioremap_page_range(unsigned long addr, unsigned long end,
 
 #ifdef CONFIG_HAVE_ARCH_HUGE_VMAP
 void __init ioremap_huge_init(void);
+int arch_ioremap_p4d_supported(void);
 int arch_ioremap_pud_supported(void);
 int arch_ioremap_pmd_supported(void);
 #else
index a95161d9c883cc54c4971d6eb44ffa0e57fcf83b..0a2ffadc6d71e4f0444f63cd6f6900ad10ff02da 100644 (file)
@@ -30,6 +30,8 @@ early_param("nohugeiomap", set_nohugeiomap);
 void __init ioremap_huge_init(void)
 {
        if (!ioremap_huge_disabled) {
+               if (arch_ioremap_p4d_supported())
+                       ioremap_p4d_capable = 1;
                if (arch_ioremap_pud_supported())
                        ioremap_pud_capable = 1;
                if (arch_ioremap_pmd_supported())