Path: blob/master/arch/powerpc/include/asm/book3s/32/tlbflush.h
52454 views
/* SPDX-License-Identifier: GPL-2.0 */1#ifndef _ASM_POWERPC_BOOK3S_32_TLBFLUSH_H2#define _ASM_POWERPC_BOOK3S_32_TLBFLUSH_H34#include <linux/build_bug.h>56#define MMU_NO_CONTEXT (0)7/*8* TLB flushing for "classic" hash-MMU 32-bit CPUs, 6xx, 7xx, 7xxx9*/10void hash__flush_tlb_mm(struct mm_struct *mm);11void hash__flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr);12void hash__flush_range(struct mm_struct *mm, unsigned long start, unsigned long end);13void hash__flush_gather(struct mmu_gather *tlb);1415#ifdef CONFIG_SMP16void _tlbie(unsigned long address);17#else18static inline void _tlbie(unsigned long address)19{20asm volatile ("tlbie %0; sync" : : "r" (address) : "memory");21}22#endif23void _tlbia(void);2425/*26* Called at the end of a mmu_gather operation to make sure the27* TLB flush is completely done.28*/29static inline void tlb_flush(struct mmu_gather *tlb)30{31/* 603 needs to flush the whole TLB here since it doesn't use a hash table. */32if (mmu_has_feature(MMU_FTR_HPTE_TABLE))33hash__flush_gather(tlb);34else35_tlbia();36}3738static inline void flush_range(struct mm_struct *mm, unsigned long start, unsigned long end)39{40start &= PAGE_MASK;41if (mmu_has_feature(MMU_FTR_HPTE_TABLE))42hash__flush_range(mm, start, end);43else if (end - start <= PAGE_SIZE)44_tlbie(start);45else46_tlbia();47}4849static inline void flush_tlb_mm(struct mm_struct *mm)50{51if (mmu_has_feature(MMU_FTR_HPTE_TABLE))52hash__flush_tlb_mm(mm);53else54_tlbia();55}5657static inline void flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr)58{59if (mmu_has_feature(MMU_FTR_HPTE_TABLE))60hash__flush_tlb_page(vma, vmaddr);61else62_tlbie(vmaddr);63}6465static inline void66flush_tlb_range(struct vm_area_struct *vma, unsigned long start, unsigned long end)67{68flush_range(vma->vm_mm, start, end);69}7071static inline void flush_tlb_kernel_range(unsigned long start, unsigned long end)72{73flush_range(&init_mm, start, end);74}7576static inline void local_flush_tlb_page(struct vm_area_struct *vma,77unsigned long vmaddr)78{79flush_tlb_page(vma, vmaddr);80}8182static inline void local_flush_tlb_page_psize(struct mm_struct *mm,83unsigned long vmaddr, int psize)84{85flush_range(mm, vmaddr, vmaddr);86}8788static inline void local_flush_tlb_mm(struct mm_struct *mm)89{90flush_tlb_mm(mm);91}9293#endif /* _ASM_POWERPC_BOOK3S_32_TLBFLUSH_H */949596