1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_POWERPC_TLBFLUSH_RADIX_H
3 #define _ASM_POWERPC_TLBFLUSH_RADIX_H
4 
5 struct vm_area_struct;
6 struct mm_struct;
7 struct mmu_gather;
8 
9 static inline int mmu_get_ap(int psize)
10 {
11 	return mmu_psize_defs[psize].ap;
12 }
13 
14 #ifdef CONFIG_PPC_RADIX_MMU
15 extern void radix__tlbiel_all(unsigned int action);
16 extern void radix__flush_tlb_lpid_page(unsigned int lpid,
17 					unsigned long addr,
18 					unsigned long page_size);
19 extern void radix__flush_pwc_lpid(unsigned int lpid);
20 extern void radix__flush_tlb_lpid(unsigned int lpid);
21 extern void radix__local_flush_tlb_lpid_guest(unsigned int lpid);
22 #else
23 static inline void radix__tlbiel_all(unsigned int action) { WARN_ON(1); };
24 static inline void radix__flush_tlb_lpid_page(unsigned int lpid,
25 					unsigned long addr,
26 					unsigned long page_size)
27 {
28 	WARN_ON(1);
29 }
30 static inline void radix__flush_pwc_lpid(unsigned int lpid)
31 {
32 	WARN_ON(1);
33 }
34 static inline void radix__flush_tlb_lpid(unsigned int lpid)
35 {
36 	WARN_ON(1);
37 }
38 static inline void radix__local_flush_tlb_lpid_guest(unsigned int lpid)
39 {
40 	WARN_ON(1);
41 }
42 #endif
43 
44 extern void radix__flush_hugetlb_tlb_range(struct vm_area_struct *vma,
45 					   unsigned long start, unsigned long end);
46 extern void radix__flush_tlb_range_psize(struct mm_struct *mm, unsigned long start,
47 					 unsigned long end, int psize);
48 extern void radix__flush_pmd_tlb_range(struct vm_area_struct *vma,
49 				       unsigned long start, unsigned long end);
50 extern void radix__flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
51 			    unsigned long end);
52 extern void radix__flush_tlb_kernel_range(unsigned long start, unsigned long end);
53 
54 extern void radix__local_flush_tlb_mm(struct mm_struct *mm);
55 extern void radix__local_flush_all_mm(struct mm_struct *mm);
56 extern void radix__local_flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr);
57 extern void radix__local_flush_tlb_page_psize(struct mm_struct *mm, unsigned long vmaddr,
58 					      int psize);
59 extern void radix__tlb_flush(struct mmu_gather *tlb);
60 #ifdef CONFIG_SMP
61 extern void radix__flush_tlb_mm(struct mm_struct *mm);
62 extern void radix__flush_all_mm(struct mm_struct *mm);
63 extern void radix__flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr);
64 extern void radix__flush_tlb_page_psize(struct mm_struct *mm, unsigned long vmaddr,
65 					int psize);
66 #else
67 #define radix__flush_tlb_mm(mm)		radix__local_flush_tlb_mm(mm)
68 #define radix__flush_all_mm(mm)		radix__local_flush_all_mm(mm)
69 #define radix__flush_tlb_page(vma,addr)	radix__local_flush_tlb_page(vma,addr)
70 #define radix__flush_tlb_page_psize(mm,addr,p) radix__local_flush_tlb_page_psize(mm,addr,p)
71 #endif
72 extern void radix__flush_tlb_pwc(struct mmu_gather *tlb, unsigned long addr);
73 extern void radix__flush_tlb_collapsed_pmd(struct mm_struct *mm, unsigned long addr);
74 extern void radix__flush_tlb_all(void);
75 
76 extern void radix__local_flush_tlb_lpid(unsigned int lpid);
77 
78 #endif
79