powerpc/book3e: hugetlbpage is only for CONFIG_PPC_FSL_BOOK3E
authorChristophe Leroy <christophe.leroy@c-s.fr>
Fri, 26 Apr 2019 05:59:40 +0000 (05:59 +0000)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 2 May 2019 15:20:23 +0000 (01:20 +1000)
As per Kconfig.cputype, only CONFIG_PPC_FSL_BOOK3E gets to
select SYS_SUPPORTS_HUGETLBFS so simplify accordingly.

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/mm/nohash/Makefile
arch/powerpc/mm/nohash/book3e_hugetlbpage.c

index b2228ff..33b6f6f 100644 (file)
@@ -9,7 +9,7 @@ obj-$(CONFIG_44x)               += 44x.o
 obj-$(CONFIG_PPC_8xx)          += 8xx.o
 obj-$(CONFIG_PPC_FSL_BOOK3E)   += fsl_booke.o
 ifdef CONFIG_HUGETLB_PAGE
-obj-$(CONFIG_PPC_BOOK3E_MMU)   += book3e_hugetlbpage.o
+obj-$(CONFIG_PPC_FSL_BOOK3E)   += book3e_hugetlbpage.o
 endif
 
 # Disable kcov instrumentation on sensitive code
index c911fe9..61915f4 100644 (file)
@@ -11,8 +11,9 @@
 
 #include <asm/mmu.h>
 
-#ifdef CONFIG_PPC_FSL_BOOK3E
 #ifdef CONFIG_PPC64
+#include <asm/paca.h>
+
 static inline int tlb1_next(void)
 {
        struct paca_struct *paca = get_paca();
@@ -29,28 +30,6 @@ static inline int tlb1_next(void)
        tcd->esel_next = next;
        return this;
 }
-#else
-static inline int tlb1_next(void)
-{
-       int index, ncams;
-
-       ncams = mfspr(SPRN_TLB1CFG) & TLBnCFG_N_ENTRY;
-
-       index = this_cpu_read(next_tlbcam_idx);
-
-       /* Just round-robin the entries and wrap when we hit the end */
-       if (unlikely(index == ncams - 1))
-               __this_cpu_write(next_tlbcam_idx, tlbcam_index);
-       else
-               __this_cpu_inc(next_tlbcam_idx);
-
-       return index;
-}
-#endif /* !PPC64 */
-#endif /* FSL */
-
-#if defined(CONFIG_PPC_FSL_BOOK3E) && defined(CONFIG_PPC64)
-#include <asm/paca.h>
 
 static inline void book3e_tlb_lock(void)
 {
@@ -93,6 +72,23 @@ static inline void book3e_tlb_unlock(void)
        paca->tcd_ptr->lock = 0;
 }
 #else
+static inline int tlb1_next(void)
+{
+       int index, ncams;
+
+       ncams = mfspr(SPRN_TLB1CFG) & TLBnCFG_N_ENTRY;
+
+       index = this_cpu_read(next_tlbcam_idx);
+
+       /* Just round-robin the entries and wrap when we hit the end */
+       if (unlikely(index == ncams - 1))
+               __this_cpu_write(next_tlbcam_idx, tlbcam_index);
+       else
+               __this_cpu_inc(next_tlbcam_idx);
+
+       return index;
+}
+
 static inline void book3e_tlb_lock(void)
 {
 }
@@ -134,10 +130,7 @@ void book3e_hugetlb_preload(struct vm_area_struct *vma, unsigned long ea,
        unsigned long psize, tsize, shift;
        unsigned long flags;
        struct mm_struct *mm;
-
-#ifdef CONFIG_PPC_FSL_BOOK3E
        int index;
-#endif
 
        if (unlikely(is_kernel_addr(ea)))
                return;
@@ -161,11 +154,9 @@ void book3e_hugetlb_preload(struct vm_area_struct *vma, unsigned long ea,
                return;
        }
 
-#ifdef CONFIG_PPC_FSL_BOOK3E
        /* We have to use the CAM(TLB1) on FSL parts for hugepages */
        index = tlb1_next();
        mtspr(SPRN_MAS0, MAS0_ESEL(index) | MAS0_TLBSEL(1));
-#endif
 
        mas1 = MAS1_VALID | MAS1_TID(mm->context.id) | MAS1_TSIZE(tsize);
        mas2 = ea & ~((1UL << shift) - 1);