1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ALPHA_TLBFLUSH_H
3 #define _ALPHA_TLBFLUSH_H
6 #include <linux/sched.h>
7 #include <asm/compiler.h>
9 #ifndef __EXTERN_INLINE
10 #define __EXTERN_INLINE extern inline
11 #define __MMU_EXTERN_INLINE
14 extern void __load_new_mm_context(struct mm_struct *);
18 ev5_flush_tlb_current(struct mm_struct *mm)
20 __load_new_mm_context(mm);
23 /* Flush just one page in the current TLB set. We need to be very
24 careful about the icache here, there is no way to invalidate a
25 specific icache page. */
28 ev5_flush_tlb_current_page(struct mm_struct * mm,
29 struct vm_area_struct *vma,
32 if (vma->vm_flags & VM_EXEC)
33 __load_new_mm_context(mm);
39 #define flush_tlb_current ev5_flush_tlb_current
40 #define flush_tlb_current_page ev5_flush_tlb_current_page
42 #ifdef __MMU_EXTERN_INLINE
43 #undef __EXTERN_INLINE
44 #undef __MMU_EXTERN_INLINE
47 /* Flush current user mapping. */
51 flush_tlb_current(current->active_mm);
54 /* Flush someone else's user mapping. */
56 flush_tlb_other(struct mm_struct *mm)
58 unsigned long *mmc = &mm->context[smp_processor_id()];
59 /* Check it's not zero first to avoid cacheline ping pong
65 /* Flush everything (kernel mapping may also have changed
66 due to vmalloc/vfree). */
67 static inline void flush_tlb_all(void)
72 /* Flush a specified user mapping. */
74 flush_tlb_mm(struct mm_struct *mm)
76 if (mm == current->active_mm)
77 flush_tlb_current(mm);
82 /* Page-granular tlb flush. */
84 flush_tlb_page(struct vm_area_struct *vma, unsigned long addr)
86 struct mm_struct *mm = vma->vm_mm;
88 if (mm == current->active_mm)
89 flush_tlb_current_page(mm, vma, addr);
94 /* Flush a specified range of user mapping. On the Alpha we flush
95 the whole user tlb. */
97 flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
100 flush_tlb_mm(vma->vm_mm);
103 #else /* CONFIG_SMP */
105 extern void flush_tlb_all(void);
106 extern void flush_tlb_mm(struct mm_struct *);
107 extern void flush_tlb_page(struct vm_area_struct *, unsigned long);
108 extern void flush_tlb_range(struct vm_area_struct *, unsigned long,
111 #endif /* CONFIG_SMP */
113 static inline void flush_tlb_kernel_range(unsigned long start,
119 #endif /* _ALPHA_TLBFLUSH_H */