Path: blob/master/arch/powerpc/include/asm/book3s/32/tlbflush.h
26519 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);1314#ifdef CONFIG_SMP15void _tlbie(unsigned long address);16#else17static inline void _tlbie(unsigned long address)18{19asm volatile ("tlbie %0; sync" : : "r" (address) : "memory");20}21#endif22void _tlbia(void);2324/*25* Called at the end of a mmu_gather operation to make sure the26* TLB flush is completely done.27*/28static inline void tlb_flush(struct mmu_gather *tlb)29{30/* 603 needs to flush the whole TLB here since it doesn't use a hash table. */31if (!mmu_has_feature(MMU_FTR_HPTE_TABLE))32_tlbia();33}3435static inline void flush_range(struct mm_struct *mm, unsigned long start, unsigned long end)36{37start &= PAGE_MASK;38if (mmu_has_feature(MMU_FTR_HPTE_TABLE))39hash__flush_range(mm, start, end);40else if (end - start <= PAGE_SIZE)41_tlbie(start);42else43_tlbia();44}4546static inline void flush_tlb_mm(struct mm_struct *mm)47{48if (mmu_has_feature(MMU_FTR_HPTE_TABLE))49hash__flush_tlb_mm(mm);50else51_tlbia();52}5354static inline void flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr)55{56if (mmu_has_feature(MMU_FTR_HPTE_TABLE))57hash__flush_tlb_page(vma, vmaddr);58else59_tlbie(vmaddr);60}6162static inline void63flush_tlb_range(struct vm_area_struct *vma, unsigned long start, unsigned long end)64{65flush_range(vma->vm_mm, start, end);66}6768static inline void flush_tlb_kernel_range(unsigned long start, unsigned long end)69{70flush_range(&init_mm, start, end);71}7273static inline void local_flush_tlb_page(struct vm_area_struct *vma,74unsigned long vmaddr)75{76flush_tlb_page(vma, vmaddr);77}7879static inline void local_flush_tlb_page_psize(struct mm_struct *mm,80unsigned long vmaddr, int psize)81{82flush_range(mm, vmaddr, vmaddr);83}8485static inline void local_flush_tlb_mm(struct mm_struct *mm)86{87flush_tlb_mm(mm);88}8990#endif /* _ASM_POWERPC_BOOK3S_32_TLBFLUSH_H */919293