]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
powerpc/mm/hugetlb: add support for 1G huge pages
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Thu, 6 Jul 2017 22:39:20 +0000 (15:39 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 6 Jul 2017 23:24:33 +0000 (16:24 -0700)
POWER9 supports hugepages of size 2M and 1G in radix MMU mode.  This
patch enables the usage of 1G page size for hugetlbfs.  This also update
the helper such we can do 1G page allocation at runtime.

We still don't enable 1G page size on DD1 version.  This is to avoid
doing workaround mentioned in commit 6d3a0379ebdc ("powerpc/mm: Add
radix__tlb_flush_pte_p9_dd1()").

Link: http://lkml.kernel.org/r/1494995292-4443-2-git-send-email-aneesh.kumar@linux.vnet.ibm.com
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au> (powerpc)
Cc: Anshuman Khandual <khandual@linux.vnet.ibm.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/powerpc/include/asm/book3s/64/hugetlb.h
arch/powerpc/mm/hugetlbpage.c
arch/powerpc/platforms/Kconfig.cputype

index 6666cd3665961656aaeff0dfc89d3aac43487151..5c28bd6f2ae13f52fbbf79da538ece1de6600d3d 100644 (file)
@@ -50,4 +50,14 @@ static inline pte_t arch_make_huge_pte(pte_t entry, struct vm_area_struct *vma,
        else
                return entry;
 }
+
+#ifdef CONFIG_ARCH_HAS_GIGANTIC_PAGE
+static inline bool gigantic_page_supported(void)
+{
+       if (radix_enabled())
+               return true;
+       return false;
+}
+#endif
+
 #endif
index f0b97d4f4387130e88dbe91eb736318657b02a94..1816b965a1429291de883c0d1ddb52ab88b17ef1 100644 (file)
@@ -742,8 +742,11 @@ static int __init add_huge_page_size(unsigned long long size)
         * Hash: 16M and 16G
         */
        if (radix_enabled()) {
-               if (mmu_psize != MMU_PAGE_2M)
-                       return -EINVAL;
+               if (mmu_psize != MMU_PAGE_2M) {
+                       if (cpu_has_feature(CPU_FTR_POWER9_DD1) ||
+                           (mmu_psize != MMU_PAGE_1G))
+                               return -EINVAL;
+               }
        } else {
                if (mmu_psize != MMU_PAGE_16M && mmu_psize != MMU_PAGE_16G)
                        return -EINVAL;
index d5ea976509d78046ec31868c312891ef71242925..2f629e0551e970f346a3ac89d3d5a993b524ce36 100644 (file)
@@ -344,6 +344,7 @@ config PPC_STD_MMU_64
 config PPC_RADIX_MMU
        bool "Radix MMU Support"
        depends on PPC_BOOK3S_64
+       select ARCH_HAS_GIGANTIC_PAGE if (MEMORY_ISOLATION && COMPACTION) || CMA
        default y
        help
          Enable support for the Power ISA 3.0 Radix style MMU. Currently this