Commit 3dea7332 authored by Christophe Leroy's avatar Christophe Leroy Committed by Michael Ellerman

powerpc/book3e: hugetlbpage is only for CONFIG_PPC_FSL_BOOK3E

As per Kconfig.cputype, only CONFIG_PPC_FSL_BOOK3E gets to
select SYS_SUPPORTS_HUGETLBFS so simplify accordingly.
Signed-off-by: default avatarChristophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent 5874cabe
...@@ -9,7 +9,7 @@ obj-$(CONFIG_44x) += 44x.o ...@@ -9,7 +9,7 @@ obj-$(CONFIG_44x) += 44x.o
obj-$(CONFIG_PPC_8xx) += 8xx.o obj-$(CONFIG_PPC_8xx) += 8xx.o
obj-$(CONFIG_PPC_FSL_BOOK3E) += fsl_booke.o obj-$(CONFIG_PPC_FSL_BOOK3E) += fsl_booke.o
ifdef CONFIG_HUGETLB_PAGE ifdef CONFIG_HUGETLB_PAGE
obj-$(CONFIG_PPC_BOOK3E_MMU) += book3e_hugetlbpage.o obj-$(CONFIG_PPC_FSL_BOOK3E) += book3e_hugetlbpage.o
endif endif
# Disable kcov instrumentation on sensitive code # Disable kcov instrumentation on sensitive code
......
...@@ -11,8 +11,9 @@ ...@@ -11,8 +11,9 @@
#include <asm/mmu.h> #include <asm/mmu.h>
#ifdef CONFIG_PPC_FSL_BOOK3E
#ifdef CONFIG_PPC64 #ifdef CONFIG_PPC64
#include <asm/paca.h>
static inline int tlb1_next(void) static inline int tlb1_next(void)
{ {
struct paca_struct *paca = get_paca(); struct paca_struct *paca = get_paca();
...@@ -29,28 +30,6 @@ static inline int tlb1_next(void) ...@@ -29,28 +30,6 @@ static inline int tlb1_next(void)
tcd->esel_next = next; tcd->esel_next = next;
return this; 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) static inline void book3e_tlb_lock(void)
{ {
...@@ -93,6 +72,23 @@ static inline void book3e_tlb_unlock(void) ...@@ -93,6 +72,23 @@ static inline void book3e_tlb_unlock(void)
paca->tcd_ptr->lock = 0; paca->tcd_ptr->lock = 0;
} }
#else #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) static inline void book3e_tlb_lock(void)
{ {
} }
...@@ -134,10 +130,7 @@ void book3e_hugetlb_preload(struct vm_area_struct *vma, unsigned long ea, ...@@ -134,10 +130,7 @@ void book3e_hugetlb_preload(struct vm_area_struct *vma, unsigned long ea,
unsigned long psize, tsize, shift; unsigned long psize, tsize, shift;
unsigned long flags; unsigned long flags;
struct mm_struct *mm; struct mm_struct *mm;
#ifdef CONFIG_PPC_FSL_BOOK3E
int index; int index;
#endif
if (unlikely(is_kernel_addr(ea))) if (unlikely(is_kernel_addr(ea)))
return; return;
...@@ -161,11 +154,9 @@ void book3e_hugetlb_preload(struct vm_area_struct *vma, unsigned long ea, ...@@ -161,11 +154,9 @@ void book3e_hugetlb_preload(struct vm_area_struct *vma, unsigned long ea,
return; return;
} }
#ifdef CONFIG_PPC_FSL_BOOK3E
/* We have to use the CAM(TLB1) on FSL parts for hugepages */ /* We have to use the CAM(TLB1) on FSL parts for hugepages */
index = tlb1_next(); index = tlb1_next();
mtspr(SPRN_MAS0, MAS0_ESEL(index) | MAS0_TLBSEL(1)); mtspr(SPRN_MAS0, MAS0_ESEL(index) | MAS0_TLBSEL(1));
#endif
mas1 = MAS1_VALID | MAS1_TID(mm->context.id) | MAS1_TSIZE(tsize); mas1 = MAS1_VALID | MAS1_TID(mm->context.id) | MAS1_TSIZE(tsize);
mas2 = ea & ~((1UL << shift) - 1); mas2 = ea & ~((1UL << shift) - 1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment