Add the rt linux 4.1.3-rt3 as base
[kvmfornfv.git] / kernel / arch / metag / include / asm / tlbflush.h
1 #ifndef __ASM_METAG_TLBFLUSH_H
2 #define __ASM_METAG_TLBFLUSH_H
3
4 #include <linux/io.h>
5 #include <linux/sched.h>
6 #include <asm/metag_mem.h>
7 #include <asm/pgalloc.h>
8
9 /*
10  * TLB flushing:
11  *
12  *  - flush_tlb() flushes the current mm struct TLBs
13  *  - flush_tlb_all() flushes all processes TLBs
14  *  - flush_tlb_mm(mm) flushes the specified mm context TLB's
15  *  - flush_tlb_page(vma, vmaddr) flushes one page
16  *  - flush_tlb_range(mm, start, end) flushes a range of pages
17  *  - flush_tlb_kernel_range(start, end) flushes a range of kernel pages
18  *  - flush_tlb_pgtables(mm, start, end) flushes a range of page tables
19  *
20  * FIXME: Meta 2 can flush single TLB entries.
21  *
22  */
23
24 #if defined(CONFIG_METAG_META21) && !defined(CONFIG_SMP)
25 static inline void __flush_tlb(void)
26 {
27         /* flush TLB entries for just the current hardware thread */
28         int thread = hard_processor_id();
29         metag_out32(0, (LINSYSCFLUSH_TxMMCU_BASE +
30                         LINSYSCFLUSH_TxMMCU_STRIDE * thread));
31 }
32 #else
33 static inline void __flush_tlb(void)
34 {
35         /* flush TLB entries for all hardware threads */
36         metag_out32(0, LINSYSCFLUSH_MMCU);
37 }
38 #endif /* defined(CONFIG_METAG_META21) && !defined(CONFIG_SMP) */
39
40 #define flush_tlb() __flush_tlb()
41
42 #define flush_tlb_all() __flush_tlb()
43
44 #define local_flush_tlb_all() __flush_tlb()
45
46 static inline void flush_tlb_mm(struct mm_struct *mm)
47 {
48         if (mm == current->active_mm)
49                 __flush_tlb();
50 }
51
52 static inline void flush_tlb_page(struct vm_area_struct *vma,
53                                   unsigned long addr)
54 {
55         flush_tlb_mm(vma->vm_mm);
56 }
57
58 static inline void flush_tlb_range(struct vm_area_struct *vma,
59                                    unsigned long start, unsigned long end)
60 {
61         flush_tlb_mm(vma->vm_mm);
62 }
63
64 static inline void flush_tlb_pgtables(struct mm_struct *mm,
65                                       unsigned long start, unsigned long end)
66 {
67         flush_tlb_mm(mm);
68 }
69
70 static inline void flush_tlb_kernel_range(unsigned long start,
71                                           unsigned long end)
72 {
73         flush_tlb_all();
74 }
75
76 #endif /* __ASM_METAG_TLBFLUSH_H */
77