powerpc/mm: Remove CONFIG_PPC_MM_SLICES
authorChristophe Leroy <christophe.leroy@csgroup.eu>
Sat, 9 Apr 2022 17:17:31 +0000 (19:17 +0200)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 5 May 2022 12:11:57 +0000 (22:11 +1000)
CONFIG_PPC_MM_SLICES is always selected by hash book3s/64.
CONFIG_PPC_MM_SLICES is never selected by other platforms.

Remove it.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/dc2cdc204de8978574bf7c02329b6cfc4db0bce7.1649523076.git.christophe.leroy@csgroup.eu
arch/powerpc/include/asm/hugetlb.h
arch/powerpc/include/asm/paca.h
arch/powerpc/kernel/paca.c
arch/powerpc/mm/book3s64/Makefile
arch/powerpc/mm/book3s64/hash_utils.c
arch/powerpc/mm/hugetlbpage.c
arch/powerpc/mm/mmap.c
arch/powerpc/platforms/Kconfig.cputype

index 6a1a1ac..ef86197 100644 (file)
@@ -24,7 +24,7 @@ static inline int is_hugepage_only_range(struct mm_struct *mm,
                                         unsigned long addr,
                                         unsigned long len)
 {
-       if (IS_ENABLED(CONFIG_PPC_MM_SLICES) && !radix_enabled())
+       if (IS_ENABLED(CONFIG_PPC_64S_HASH_MMU) && !radix_enabled())
                return slice_is_hugepage_only_range(mm, addr, len);
        return 0;
 }
index 8330968..03330b7 100644 (file)
@@ -152,16 +152,9 @@ struct paca_struct {
        struct tlb_core_data tcd;
 #endif /* CONFIG_PPC_BOOK3E */
 
-#ifdef CONFIG_PPC_BOOK3S
 #ifdef CONFIG_PPC_64S_HASH_MMU
-#ifdef CONFIG_PPC_MM_SLICES
        unsigned char mm_ctx_low_slices_psize[BITS_PER_LONG / BITS_PER_BYTE];
        unsigned char mm_ctx_high_slices_psize[SLICE_ARRAY_SIZE];
-#else
-       u16 mm_ctx_user_psize;
-       u16 mm_ctx_sllp;
-#endif
-#endif
 #endif
 
        /*
index 39da688..ba593fd 100644 (file)
@@ -344,15 +344,10 @@ void copy_mm_to_paca(struct mm_struct *mm)
 {
        mm_context_t *context = &mm->context;
 
-#ifdef CONFIG_PPC_MM_SLICES
        VM_BUG_ON(!mm_ctx_slb_addr_limit(context));
        memcpy(&get_paca()->mm_ctx_low_slices_psize, mm_ctx_low_slices(context),
               LOW_SLICE_ARRAY_SZ);
        memcpy(&get_paca()->mm_ctx_high_slices_psize, mm_ctx_high_slices(context),
               TASK_SLICE_ARRAY_SZ(context));
-#else /* CONFIG_PPC_MM_SLICES */
-       get_paca()->mm_ctx_user_psize = context->user_psize;
-       get_paca()->mm_ctx_sllp = context->sllp;
-#endif
 }
 #endif /* CONFIG_PPC_64S_HASH_MMU */
index af2f3e7..d527dc8 100644 (file)
@@ -5,7 +5,7 @@ ccflags-y       := $(NO_MINIMAL_TOC)
 obj-y                          += mmu_context.o pgtable.o trace.o
 ifdef CONFIG_PPC_64S_HASH_MMU
 CFLAGS_REMOVE_slb.o = $(CC_FLAGS_FTRACE)
-obj-y                          += hash_pgtable.o hash_utils.o hash_tlb.o slb.o
+obj-y                          += hash_pgtable.o hash_utils.o hash_tlb.o slb.o slice.o
 obj-$(CONFIG_PPC_HASH_MMU_NATIVE)      += hash_native.o
 obj-$(CONFIG_PPC_4K_PAGES)     += hash_4k.o
 obj-$(CONFIG_PPC_64K_PAGES)    += hash_64k.o
@@ -21,7 +21,6 @@ obj-$(CONFIG_PPC_RADIX_MMU)   += radix_hugetlbpage.o
 endif
 obj-$(CONFIG_SPAPR_TCE_IOMMU)  += iommu_api.o
 obj-$(CONFIG_PPC_PKEY) += pkeys.o
-obj-$(CONFIG_PPC_MM_SLICES)    += slice.o
 
 # Instrumenting the SLB fault path can lead to duplicate SLB entries
 KCOV_INSTRUMENT_slb.o := n
index 985cabd..43ecad8 100644 (file)
@@ -1264,7 +1264,6 @@ unsigned int hash_page_do_lazy_icache(unsigned int pp, pte_t pte, int trap)
        return pp;
 }
 
-#ifdef CONFIG_PPC_MM_SLICES
 static unsigned int get_paca_psize(unsigned long addr)
 {
        unsigned char *psizes;
@@ -1281,12 +1280,6 @@ static unsigned int get_paca_psize(unsigned long addr)
        return (psizes[index >> 1] >> (mask_index * 4)) & 0xF;
 }
 
-#else
-unsigned int get_paca_psize(unsigned long addr)
-{
-       return get_paca()->mm_ctx_user_psize;
-}
-#endif
 
 /*
  * Demote a segment to using 4k pages.
@@ -1680,7 +1673,6 @@ DEFINE_INTERRUPT_HANDLER(do_hash_fault)
        }
 }
 
-#ifdef CONFIG_PPC_MM_SLICES
 static bool should_hash_preload(struct mm_struct *mm, unsigned long ea)
 {
        int psize = get_slice_psize(mm, ea);
@@ -1697,12 +1689,6 @@ static bool should_hash_preload(struct mm_struct *mm, unsigned long ea)
 
        return true;
 }
-#else
-static bool should_hash_preload(struct mm_struct *mm, unsigned long ea)
-{
-       return true;
-}
-#endif
 
 static void hash_preload(struct mm_struct *mm, pte_t *ptep, unsigned long ea,
                         bool is_exec, unsigned long trap)
index 7b89f07..f71ac14 100644 (file)
@@ -558,7 +558,7 @@ unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
                return radix__hugetlb_get_unmapped_area(file, addr, len,
                                                       pgoff, flags);
 #endif
-#ifdef CONFIG_PPC_MM_SLICES
+#ifdef CONFIG_PPC_64S_HASH_MMU
        return slice_get_unmapped_area(addr, len, flags, file_to_psize(file), 1);
 #endif
        BUG();
index c475cf8..9b0d6e3 100644 (file)
@@ -190,7 +190,7 @@ unsigned long arch_get_unmapped_area(struct file *filp,
                                     unsigned long pgoff,
                                     unsigned long flags)
 {
-#ifdef CONFIG_PPC_MM_SLICES
+#ifdef CONFIG_PPC_64S_HASH_MMU
        return slice_get_unmapped_area(addr, len, flags,
                                       mm_ctx_user_psize(&current->mm->context), 0);
 #else
@@ -204,7 +204,7 @@ unsigned long arch_get_unmapped_area_topdown(struct file *filp,
                                             const unsigned long pgoff,
                                             const unsigned long flags)
 {
-#ifdef CONFIG_PPC_MM_SLICES
+#ifdef CONFIG_PPC_64S_HASH_MMU
        return slice_get_unmapped_area(addr0, len, flags,
                                       mm_ctx_user_psize(&current->mm->context), 1);
 #else
index e2e1fec..9d099dc 100644 (file)
@@ -377,7 +377,6 @@ config SPE
 config PPC_64S_HASH_MMU
        bool "Hash MMU Support"
        depends on PPC_BOOK3S_64
-       select PPC_MM_SLICES
        default y
        help
          Enable support for the Power ISA Hash style MMU. This is implemented
@@ -451,9 +450,6 @@ config PPC_BOOK3E_MMU
        def_bool y
        depends on FSL_BOOKE || PPC_BOOK3E
 
-config PPC_MM_SLICES
-       bool
-
 config PPC_HAVE_PMU_SUPPORT
        bool