powerpc/mm/hugetlb: add support for 1G huge pages
PATCH 75/108 powerpc/mm/hugetlb: add support for 1G huge pages
From: "Aneesh Kumar K.V" <[email protected]>
Subject: powerpc/mm/hugetlb: add support for 1G huge pages
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: 6d3a0379ebdc8 ("powerpc/mm: Add radix__tlb_flush_pte_p9_dd1()").
Signed-off-by Aneesh Kumar K.V <[email protected]>
Cc Michael Ellerman <[email protected]> (powerpc)
Cc Anshuman Khandual <[email protected]>
Cc Benjamin Herrenschmidt <[email protected]>
Signed-off-by Andrew Morton <[email protected]>
---
arch/powerpc/include/asm/book3s/64/hugetlb.h | 10 ++++++++++ arch/powerpc/mm/hugetlbpage.c | 7 +++++-- arch/powerpc/platforms/Kconfig.cputype | 1 + 3 files changed, 16 insertions(+), 2 deletions(-)
arch/powerpc/include/asm/book3s/64/hugetlb.h renamed from arch/powerpc/include/asm/book3s/64/hugetlb.h~powerpc-mm-hugetlb-add-support-for-1g-huge-pages +10 -0
@@ -50,4 +50,14 @@ static inline pte_t arch_make_huge_pte(p 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
arch/powerpc/mm/hugetlbpage.c renamed from arch/powerpc/mm/hugetlbpage.c~powerpc-mm-hugetlb-add-support-for-1g-huge-pages +5 -2
@@ -742,8 +742,11 @@ static int __init add_huge_page_size(uns* 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 ;
arch/powerpc/platforms/Kconfig.cputype renamed from arch/powerpc/platforms/Kconfig.cputype~powerpc-mm-hugetlb-add-support-for-1g-huge-pages +1 -0
@@ -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
_