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>
8 #include <asm/pgalloc.h>
10 #ifndef __EXTERN_INLINE
11 #define __EXTERN_INLINE extern inline
12 #define __MMU_EXTERN_INLINE
15 extern void __load_new_mm_context(struct mm_struct
*);
18 /* Use a few helper functions to hide the ugly broken ASN
19 numbers on early Alphas (ev4 and ev45). */
22 ev4_flush_tlb_current(struct mm_struct
*mm
)
24 __load_new_mm_context(mm
);
29 ev5_flush_tlb_current(struct mm_struct
*mm
)
31 __load_new_mm_context(mm
);
34 /* Flush just one page in the current TLB set. We need to be very
35 careful about the icache here, there is no way to invalidate a
36 specific icache page. */
39 ev4_flush_tlb_current_page(struct mm_struct
* mm
,
40 struct vm_area_struct
*vma
,
44 if (vma
->vm_flags
& VM_EXEC
) {
45 __load_new_mm_context(mm
);
52 ev5_flush_tlb_current_page(struct mm_struct
* mm
,
53 struct vm_area_struct
*vma
,
56 if (vma
->vm_flags
& VM_EXEC
)
57 __load_new_mm_context(mm
);
63 #ifdef CONFIG_ALPHA_GENERIC
64 # define flush_tlb_current alpha_mv.mv_flush_tlb_current
65 # define flush_tlb_current_page alpha_mv.mv_flush_tlb_current_page
67 # ifdef CONFIG_ALPHA_EV4
68 # define flush_tlb_current ev4_flush_tlb_current
69 # define flush_tlb_current_page ev4_flush_tlb_current_page
71 # define flush_tlb_current ev5_flush_tlb_current
72 # define flush_tlb_current_page ev5_flush_tlb_current_page
76 #ifdef __MMU_EXTERN_INLINE
77 #undef __EXTERN_INLINE
78 #undef __MMU_EXTERN_INLINE
81 /* Flush current user mapping. */
85 flush_tlb_current(current
->active_mm
);
88 /* Flush someone else's user mapping. */
90 flush_tlb_other(struct mm_struct
*mm
)
92 unsigned long *mmc
= &mm
->context
[smp_processor_id()];
93 /* Check it's not zero first to avoid cacheline ping pong
99 /* Flush everything (kernel mapping may also have changed
100 due to vmalloc/vfree). */
101 static inline void flush_tlb_all(void)
106 /* Flush a specified user mapping. */
108 flush_tlb_mm(struct mm_struct
*mm
)
110 if (mm
== current
->active_mm
)
111 flush_tlb_current(mm
);
116 /* Page-granular tlb flush. */
118 flush_tlb_page(struct vm_area_struct
*vma
, unsigned long addr
)
120 struct mm_struct
*mm
= vma
->vm_mm
;
122 if (mm
== current
->active_mm
)
123 flush_tlb_current_page(mm
, vma
, addr
);
128 /* Flush a specified range of user mapping. On the Alpha we flush
129 the whole user tlb. */
131 flush_tlb_range(struct vm_area_struct
*vma
, unsigned long start
,
134 flush_tlb_mm(vma
->vm_mm
);
137 #else /* CONFIG_SMP */
139 extern void flush_tlb_all(void);
140 extern void flush_tlb_mm(struct mm_struct
*);
141 extern void flush_tlb_page(struct vm_area_struct
*, unsigned long);
142 extern void flush_tlb_range(struct vm_area_struct
*, unsigned long,
145 #endif /* CONFIG_SMP */
147 static inline void flush_tlb_kernel_range(unsigned long start
,
153 #endif /* _ALPHA_TLBFLUSH_H */