1 /* SPDX-License-Identifier: GPL-2.0 */
2 // Copyright (C) 2005-2017 Andes Technology Corporation
3 
4 #ifndef _ASMNDS32_TLBFLUSH_H
5 #define _ASMNDS32_TLBFLUSH_H
6 
7 #include <linux/spinlock.h>
8 #include <linux/mm.h>
9 #include <nds32_intrinsic.h>
10 
local_flush_tlb_all(void)11 static inline void local_flush_tlb_all(void)
12 {
13 	__nds32__tlbop_flua();
14 	__nds32__isb();
15 }
16 
local_flush_tlb_mm(struct mm_struct * mm)17 static inline void local_flush_tlb_mm(struct mm_struct *mm)
18 {
19 	__nds32__tlbop_flua();
20 	__nds32__isb();
21 }
22 
local_flush_tlb_kernel_range(unsigned long start,unsigned long end)23 static inline void local_flush_tlb_kernel_range(unsigned long start,
24 						unsigned long end)
25 {
26 	while (start < end) {
27 		__nds32__tlbop_inv(start);
28 		__nds32__isb();
29 		start += PAGE_SIZE;
30 	}
31 }
32 
33 void local_flush_tlb_range(struct vm_area_struct *vma,
34 			   unsigned long start, unsigned long end);
35 void local_flush_tlb_page(struct vm_area_struct *vma, unsigned long addr);
36 
37 #define flush_tlb_all		local_flush_tlb_all
38 #define flush_tlb_mm		local_flush_tlb_mm
39 #define flush_tlb_range		local_flush_tlb_range
40 #define flush_tlb_page		local_flush_tlb_page
41 #define flush_tlb_kernel_range	local_flush_tlb_kernel_range
42 
43 void update_mmu_cache(struct vm_area_struct *vma,
44 		      unsigned long address, pte_t * pte);
45 
46 #endif
47