--- v13
+++ v11
@@ -1,22 +1,29 @@
This allows unsupported levels to be constant folded away, and so
p4d_free_pud_page can be removed because it's no longer linked to.
-Cc: Catalin Marinas <catalin.marinas@arm.com>
-Cc: Will Deacon <will@kernel.org>
-Cc: linux-arm-kernel@lists.infradead.org
-Acked-by: Catalin Marinas <catalin.marinas@arm.com>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: Ingo Molnar <mingo@redhat.com>
+Cc: Borislav Petkov <bp@alien8.de>
+Cc: x86@kernel.org
+Cc: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
- arch/arm64/include/asm/vmalloc.h | 23 ++++++++++++++++++++---
- arch/arm64/mm/mmu.c | 26 --------------------------
- 2 files changed, 20 insertions(+), 29 deletions(-)
+ arch/x86/include/asm/vmalloc.h | 22 +++++++++++++++++++---
+ arch/x86/mm/ioremap.c | 21 ---------------------
+ arch/x86/mm/pgtable.c | 13 -------------
+ 3 files changed, 19 insertions(+), 37 deletions(-)
-diff --git a/arch/arm64/include/asm/vmalloc.h b/arch/arm64/include/asm/vmalloc.h
-index 597b40405319..fc9a12d6cc1a 100644
---- a/arch/arm64/include/asm/vmalloc.h
-+++ b/arch/arm64/include/asm/vmalloc.h
-@@ -4,9 +4,26 @@
+diff --git a/arch/x86/include/asm/vmalloc.h b/arch/x86/include/asm/vmalloc.h
+index 094ea2b565f3..e714b00fc0ca 100644
+--- a/arch/x86/include/asm/vmalloc.h
++++ b/arch/x86/include/asm/vmalloc.h
+@@ -1,13 +1,29 @@
+ #ifndef _ASM_X86_VMALLOC_H
+ #define _ASM_X86_VMALLOC_H
+
++#include <asm/cpufeature.h>
#include <asm/page.h>
+ #include <asm/pgtable_areas.h>
#ifdef CONFIG_HAVE_ARCH_HUGE_VMAP
-bool arch_vmap_p4d_supported(pgprot_t prot);
@@ -29,30 +36,29 @@
+
+static inline bool arch_vmap_pud_supported(pgprot_t prot)
+{
-+ /*
-+ * Only 4k granule supports level 1 block mappings.
-+ * SW table walks can't handle removal of intermediate entries.
-+ */
-+ return IS_ENABLED(CONFIG_ARM64_4K_PAGES) &&
-+ !IS_ENABLED(CONFIG_PTDUMP_DEBUGFS);
++#ifdef CONFIG_X86_64
++ return boot_cpu_has(X86_FEATURE_GBPAGES);
++#else
++ return false;
++#endif
+}
+
+static inline bool arch_vmap_pmd_supported(pgprot_t prot)
+{
-+ /* See arch_vmap_pud_supported() */
-+ return !IS_ENABLED(CONFIG_PTDUMP_DEBUGFS);
++ return boot_cpu_has(X86_FEATURE_PSE);
+}
#endif
- #endif /* _ASM_ARM64_VMALLOC_H */
-diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
-index 639b9de61b1d..1fb0035b0777 100644
---- a/arch/arm64/mm/mmu.c
-+++ b/arch/arm64/mm/mmu.c
-@@ -1316,27 +1316,6 @@ void *__init fixmap_remap_fdt(phys_addr_t dt_phys, int *size, pgprot_t prot)
- return dt_virt;
+ #endif /* _ASM_X86_VMALLOC_H */
+diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
+index fbaf0c447986..12c686c65ea9 100644
+--- a/arch/x86/mm/ioremap.c
++++ b/arch/x86/mm/ioremap.c
+@@ -481,27 +481,6 @@ void iounmap(volatile void __iomem *addr)
}
+ EXPORT_SYMBOL(iounmap);
+-#ifdef CONFIG_HAVE_ARCH_HUGE_VMAP
-bool arch_vmap_p4d_supported(pgprot_t prot)
-{
- return false;
@@ -60,35 +66,53 @@
-
-bool arch_vmap_pud_supported(pgprot_t prot)
-{
-- /*
-- * Only 4k granule supports level 1 block mappings.
-- * SW table walks can't handle removal of intermediate entries.
-- */
-- return IS_ENABLED(CONFIG_ARM64_4K_PAGES) &&
-- !IS_ENABLED(CONFIG_PTDUMP_DEBUGFS);
+-#ifdef CONFIG_X86_64
+- return boot_cpu_has(X86_FEATURE_GBPAGES);
+-#else
+- return false;
+-#endif
-}
-
-bool arch_vmap_pmd_supported(pgprot_t prot)
-{
-- /* See arch_vmap_pud_supported() */
-- return !IS_ENABLED(CONFIG_PTDUMP_DEBUGFS);
+- return boot_cpu_has(X86_FEATURE_PSE);
+-}
+-#endif
+-
+ /*
+ * Convert a physical pointer to a virtual kernel pointer for /dev/mem
+ * access
+diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c
+index f6a9e2e36642..d27cf69e811d 100644
+--- a/arch/x86/mm/pgtable.c
++++ b/arch/x86/mm/pgtable.c
+@@ -780,14 +780,6 @@ int pmd_clear_huge(pmd_t *pmd)
+ return 0;
+ }
+
+-/*
+- * Until we support 512GB pages, skip them in the vmap area.
+- */
+-int p4d_free_pud_page(p4d_t *p4d, unsigned long addr)
+-{
+- return 0;
-}
-
- int pud_set_huge(pud_t *pudp, phys_addr_t phys, pgprot_t prot)
- {
- pud_t new_pud = pfn_pud(__phys_to_pfn(phys), mk_pud_sect_prot(prot));
-@@ -1428,11 +1407,6 @@ int pud_free_pmd_page(pud_t *pudp, unsigned long addr)
- return 1;
- }
+ #ifdef CONFIG_X86_64
+ /**
+ * pud_free_pmd_page - Clear pud entry and free pmd page.
+@@ -861,11 +853,6 @@ int pmd_free_pte_page(pmd_t *pmd, unsigned long addr)
--int p4d_free_pud_page(p4d_t *p4d, unsigned long addr)
+ #else /* !CONFIG_X86_64 */
+
+-int pud_free_pmd_page(pud_t *pud, unsigned long addr)
-{
-- return 0; /* Don't attempt a block mapping */
+- return pud_none(*pud);
-}
-
- #ifdef CONFIG_MEMORY_HOTPLUG
- static void __remove_pgd_mapping(pgd_t *pgdir, unsigned long start, u64 size)
- {
+ /*
+ * Disable free page handling on x86-PAE. This assures that ioremap()
+ * does not update sync'd pmd entries. See vmalloc_sync_one().
--
2.23.0