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/powerpc/mm/fsl_booke_mmu.c | |
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/powerpc/mm/fsl_booke_mmu.c')
-rw-r--r-- | arch/powerpc/mm/fsl_booke_mmu.c | 41 |
1 files changed, 41 insertions, 0 deletions
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 |