1
2
3
4
5
6
7
8
9
10
11
12
13
14
15#ifndef _ASM_TILE_TLBFLUSH_H
16#define _ASM_TILE_TLBFLUSH_H
17
18#include <linux/mm.h>
19#include <linux/sched.h>
20#include <linux/smp.h>
21#include <asm/cacheflush.h>
22#include <asm/page.h>
23#include <hv/hypervisor.h>
24
25
26
27
28
29
30
31
32
33
34
35
36DECLARE_PER_CPU(int, current_asid);
37
38
39extern int min_asid, max_asid;
40
41
42#define FLUSH_NONEXEC ((struct vm_area_struct *)-1UL)
43
44
45static inline void local_flush_tlb_page(struct vm_area_struct *vma,
46 unsigned long addr,
47 unsigned long page_size)
48{
49 int rc = hv_flush_page(addr, page_size);
50 if (rc < 0)
51 panic("hv_flush_page(%#lx,%#lx) failed: %d",
52 addr, page_size, rc);
53 if (!vma || (vma != FLUSH_NONEXEC && (vma->vm_flags & VM_EXEC)))
54 __flush_icache();
55}
56
57
58static inline void local_flush_tlb_pages(struct vm_area_struct *vma,
59 unsigned long addr,
60 unsigned long page_size,
61 unsigned long len)
62{
63 int rc = hv_flush_pages(addr, page_size, len);
64 if (rc < 0)
65 panic("hv_flush_pages(%#lx,%#lx,%#lx) failed: %d",
66 addr, page_size, len, rc);
67 if (!vma || (vma != FLUSH_NONEXEC && (vma->vm_flags & VM_EXEC)))
68 __flush_icache();
69}
70
71
72static inline void local_flush_tlb(void)
73{
74 int rc = hv_flush_all(1);
75 if (rc < 0)
76 panic("hv_flush_all(1) failed: %d", rc);
77 __flush_icache();
78}
79
80
81
82
83
84static inline void local_flush_tlb_all(void)
85{
86 int i;
87 for (i = 0; ; ++i) {
88 HV_VirtAddrRange r = hv_inquire_virtual(i);
89 if (r.size == 0)
90 break;
91 local_flush_tlb_pages(NULL, r.start, PAGE_SIZE, r.size);
92 local_flush_tlb_pages(NULL, r.start, HPAGE_SIZE, r.size);
93 }
94}
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111extern void flush_tlb_all(void);
112extern void flush_tlb_kernel_range(unsigned long start, unsigned long end);
113extern void flush_tlb_current_task(void);
114extern void flush_tlb_mm(struct mm_struct *);
115extern void flush_tlb_page(struct vm_area_struct *, unsigned long);
116extern void flush_tlb_page_mm(struct vm_area_struct *,
117 struct mm_struct *, unsigned long);
118extern void flush_tlb_range(struct vm_area_struct *,
119 unsigned long start, unsigned long end);
120
121#define flush_tlb() flush_tlb_current_task()
122
123#endif
124