diff options
author | Mihai Caraman <mihai.caraman@freescale.com> | 2014-04-17 09:41:09 (GMT) |
---|---|---|
committer | Jose Rivera <German.Rivera@freescale.com> | 2014-04-30 01:25:38 (GMT) |
commit | 5f3005e9f6cbd4d01597407aa8a7aa5a2f5a381c (patch) | |
tree | 0029236c8f95f4101b4b1ad40a72dc54800c0dcd /arch | |
parent | 993d07a27f10ad4a5d4847d964a6634674c4e2ee (diff) | |
download | linux-fsl-qoriq-5f3005e9f6cbd4d01597407aa8a7aa5a2f5a381c.tar.xz |
powerpc/booke3e: Move tlb lock/unlock functions
Move book3e_tlb_lock/unlock functions from hugetlbpages to mm to be
used from other kernel places.
Signed-off-by: Mihai Caraman <mihai.caraman@freescale.com>
(cherry picked and merged from sdk1.5 commit c84bbd80aebb40de4fcc7894759dfff8857d405c)
Change-Id: I89239824880e81c8257fe612cad903eebbb5adbe
Reviewed-on: http://git.am.freescale.net:8181/11559
Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com>
Reviewed-by: Stuart Yoder <stuart.yoder@freescale.com>
Reviewed-by: Jose Rivera <German.Rivera@freescale.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/include/asm/mmu-book3e.h | 9 | ||||
-rw-r--r-- | arch/powerpc/mm/fsl_booke_mmu.c | 41 | ||||
-rw-r--r-- | arch/powerpc/mm/hugetlbpage-book3e.c | 51 |
3 files changed, 50 insertions, 51 deletions
diff --git a/arch/powerpc/include/asm/mmu-book3e.h b/arch/powerpc/include/asm/mmu-book3e.h index 95c5865..5b57d1c 100644 --- a/arch/powerpc/include/asm/mmu-book3e.h +++ b/arch/powerpc/include/asm/mmu-book3e.h @@ -306,6 +306,15 @@ extern unsigned long linear_map_top; * return 1, indicating that the tlb requires preloading. */ #define HUGETLB_NEED_PRELOAD + +void book3e_tlb_lock(void); +void book3e_tlb_unlock(void); +#else +static inline void book3e_tlb_lock(void) +{} + +static inline void book3e_tlb_unlock(void) +{} #endif #endif /* !__ASSEMBLY__ */ diff --git a/arch/powerpc/mm/fsl_booke_mmu.c b/arch/powerpc/mm/fsl_booke_mmu.c index 136871d..37cb697 100644 --- a/arch/powerpc/mm/fsl_booke_mmu.c +++ b/arch/powerpc/mm/fsl_booke_mmu.c @@ -259,3 +259,44 @@ void setup_initial_memory_limit(phys_addr_t first_memblock_base, memblock_set_current_limit(min_t(u64, limit, 0x04000000)); } #endif + +#if defined(CONFIG_PPC64) +void book3e_tlb_lock(void) +{ + struct paca_struct *paca = get_paca(); + struct tlb_per_core *percore; + unsigned long tmp; + + if (!(paca->tlb_per_core_ptr & 1)) + return; + + percore = (struct tlb_per_core *)(paca->tlb_per_core_ptr & ~1UL); + + asm volatile("1: lbarx %0, 0, %1;\n" + "cmpdi %0, 0;\n" + "bne 2f;\n" + "li %0, 1;\n" + "stbcx. %0, 0, %1;\n" + "bne 1b;\n" + "b 3f;\n" + "2: lbzx %0, 0, %1;\n" + "cmpdi %0, 0;\n" + "bne 2b;\n" + "b 1b;\n" + "3:" : "=&r" (tmp) : "r" (&percore->lock) : "memory"); +} + +void book3e_tlb_unlock(void) +{ + struct paca_struct *paca = get_paca(); + struct tlb_per_core *percore; + + if (!(paca->tlb_per_core_ptr & 1)) + return; + + percore = (struct tlb_per_core *)(paca->tlb_per_core_ptr & ~1UL); + + isync(); + percore->lock = 0; +} +#endif diff --git a/arch/powerpc/mm/hugetlbpage-book3e.c b/arch/powerpc/mm/hugetlbpage-book3e.c index 603ea93..dbe06fe 100644 --- a/arch/powerpc/mm/hugetlbpage-book3e.c +++ b/arch/powerpc/mm/hugetlbpage-book3e.c @@ -13,57 +13,6 @@ static inline int mmu_get_tsize(int psize) return mmu_psize_defs[psize].enc; } -#if defined(CONFIG_PPC_FSL_BOOK3E) && defined(CONFIG_PPC64) -#include <asm/paca.h> - -static inline void book3e_tlb_lock(void) -{ - struct paca_struct *paca = get_paca(); - struct tlb_per_core *percore; - unsigned long tmp; - - if (!(paca->tlb_per_core_ptr & 1)) - return; - - percore = (struct tlb_per_core *)(paca->tlb_per_core_ptr & ~1UL); - - asm volatile("1: lbarx %0, 0, %1;" - "cmpdi %0, 0;" - "bne 2f;" - "li %0, 1;" - "stbcx. %0, 0, %1;" - "bne 1b;" - "b 3f;" - "2: lbzx %0, 0, %1;" - "cmpdi %0, 0;" - "bne 2b;" - "b 1b;" - "3:" : "=&r" (tmp) : "r" (&percore->lock) : "memory"); -} - -static inline void book3e_tlb_unlock(void) -{ - struct paca_struct *paca = get_paca(); - struct tlb_per_core *percore; - - if (!(paca->tlb_per_core_ptr & 1)) - return; - - percore = (struct tlb_per_core *)(paca->tlb_per_core_ptr & ~1UL); - - isync(); - percore->lock = 0; -} -#else -static inline void book3e_tlb_lock(void) -{ -} - -static inline void book3e_tlb_unlock(void) -{ -} -#endif - #ifdef CONFIG_PPC_FSL_BOOK3E #ifdef CONFIG_PPC64 static inline int tlb1_next(void) |