xref: /linux/arch/sparc/include/asm/tlbflush_64.h (revision dacd24ec4965d92cd5ef338c2b86d5e7e3722bed)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _SPARC64_TLBFLUSH_H
3 #define _SPARC64_TLBFLUSH_H
4 
5 #include <asm/mmu_context.h>
6 
7 /* TSB flush operations. */
8 
9 #define TLB_BATCH_NR	192
10 
11 struct tlb_batch {
12 	unsigned int hugepage_shift;
13 	struct mm_struct *mm;
14 	unsigned long tlb_nr;
15 	unsigned long vaddrs[TLB_BATCH_NR];
16 };
17 
18 void flush_tsb_kernel_range(unsigned long start, unsigned long end);
19 void flush_tsb_user(struct tlb_batch *tb);
20 void flush_tsb_user_page(struct mm_struct *mm, unsigned long vaddr,
21 			 unsigned int hugepage_shift);
22 
23 /* TLB flush operations. */
24 
25 static inline void flush_tlb_mm(struct mm_struct *mm)
26 {
27 }
28 
29 static inline void flush_tlb_page(struct vm_area_struct *vma,
30 				  unsigned long vmaddr)
31 {
32 }
33 
34 static inline void flush_tlb_range(struct vm_area_struct *vma,
35 				   unsigned long start, unsigned long end)
36 {
37 }
38 
39 void flush_tlb_kernel_range(unsigned long start, unsigned long end);
40 
41 void flush_tlb_pending(void);
42 void arch_enter_lazy_mmu_mode(void);
43 void arch_flush_lazy_mmu_mode(void);
44 void arch_leave_lazy_mmu_mode(void);
45 
46 /* Local cpu only.  */
47 void __flush_tlb_all(void);
48 void __flush_tlb_page(unsigned long context, unsigned long vaddr);
49 void __flush_tlb_kernel_range(unsigned long start, unsigned long end);
50 
51 #ifndef CONFIG_SMP
52 
53 static inline void global_flush_tlb_page(struct mm_struct *mm, unsigned long vaddr)
54 {
55 	__flush_tlb_page(CTX_HWBITS(mm->context), vaddr);
56 }
57 
58 #else /* CONFIG_SMP */
59 
60 void smp_flush_tlb_kernel_range(unsigned long start, unsigned long end);
61 void smp_flush_tlb_page(struct mm_struct *mm, unsigned long vaddr);
62 
63 #define global_flush_tlb_page(mm, vaddr) \
64 	smp_flush_tlb_page(mm, vaddr)
65 
66 #endif /* ! CONFIG_SMP */
67 
68 #endif /* _SPARC64_TLBFLUSH_H */
69