|
13 | 13 | #include <asm/pti.h>
|
14 | 14 | #include <asm/processor-flags.h>
|
15 | 15 |
|
16 |
| -struct flush_tlb_info; |
17 |
| - |
18 | 16 | void __flush_tlb_all(void);
|
19 |
| -void flush_tlb_local(void); |
20 |
| -void flush_tlb_one_user(unsigned long addr); |
21 |
| -void flush_tlb_one_kernel(unsigned long addr); |
22 |
| -void flush_tlb_others(const struct cpumask *cpumask, |
23 |
| - const struct flush_tlb_info *info); |
24 | 17 |
|
25 |
| -#ifdef CONFIG_PARAVIRT |
26 |
| -#include <asm/paravirt.h> |
27 |
| -#endif |
| 18 | +#define TLB_FLUSH_ALL -1UL |
| 19 | + |
| 20 | +void cr4_update_irqsoff(unsigned long set, unsigned long clear); |
| 21 | +unsigned long cr4_read_shadow(void); |
| 22 | + |
| 23 | +/* Set in this cpu's CR4. */ |
| 24 | +static inline void cr4_set_bits_irqsoff(unsigned long mask) |
| 25 | +{ |
| 26 | + cr4_update_irqsoff(mask, 0); |
| 27 | +} |
28 | 28 |
|
| 29 | +/* Clear in this cpu's CR4. */ |
| 30 | +static inline void cr4_clear_bits_irqsoff(unsigned long mask) |
| 31 | +{ |
| 32 | + cr4_update_irqsoff(0, mask); |
| 33 | +} |
| 34 | + |
| 35 | +/* Set in this cpu's CR4. */ |
| 36 | +static inline void cr4_set_bits(unsigned long mask) |
| 37 | +{ |
| 38 | + unsigned long flags; |
| 39 | + |
| 40 | + local_irq_save(flags); |
| 41 | + cr4_set_bits_irqsoff(mask); |
| 42 | + local_irq_restore(flags); |
| 43 | +} |
| 44 | + |
| 45 | +/* Clear in this cpu's CR4. */ |
| 46 | +static inline void cr4_clear_bits(unsigned long mask) |
| 47 | +{ |
| 48 | + unsigned long flags; |
| 49 | + |
| 50 | + local_irq_save(flags); |
| 51 | + cr4_clear_bits_irqsoff(mask); |
| 52 | + local_irq_restore(flags); |
| 53 | +} |
| 54 | + |
| 55 | +#ifndef MODULE |
29 | 56 | /*
|
30 | 57 | * 6 because 6 should be plenty and struct tlb_state will fit in two cache
|
31 | 58 | * lines.
|
@@ -129,54 +156,17 @@ DECLARE_PER_CPU_SHARED_ALIGNED(struct tlb_state, cpu_tlbstate);
|
129 | 156 | bool nmi_uaccess_okay(void);
|
130 | 157 | #define nmi_uaccess_okay nmi_uaccess_okay
|
131 | 158 |
|
132 |
| -void cr4_update_irqsoff(unsigned long set, unsigned long clear); |
133 |
| -unsigned long cr4_read_shadow(void); |
134 |
| - |
135 | 159 | /* Initialize cr4 shadow for this CPU. */
|
136 | 160 | static inline void cr4_init_shadow(void)
|
137 | 161 | {
|
138 | 162 | this_cpu_write(cpu_tlbstate.cr4, __read_cr4());
|
139 | 163 | }
|
140 | 164 |
|
141 |
| -/* Set in this cpu's CR4. */ |
142 |
| -static inline void cr4_set_bits_irqsoff(unsigned long mask) |
143 |
| -{ |
144 |
| - cr4_update_irqsoff(mask, 0); |
145 |
| -} |
146 |
| - |
147 |
| -/* Clear in this cpu's CR4. */ |
148 |
| -static inline void cr4_clear_bits_irqsoff(unsigned long mask) |
149 |
| -{ |
150 |
| - cr4_update_irqsoff(0, mask); |
151 |
| -} |
152 |
| - |
153 |
| -/* Set in this cpu's CR4. */ |
154 |
| -static inline void cr4_set_bits(unsigned long mask) |
155 |
| -{ |
156 |
| - unsigned long flags; |
157 |
| - |
158 |
| - local_irq_save(flags); |
159 |
| - cr4_set_bits_irqsoff(mask); |
160 |
| - local_irq_restore(flags); |
161 |
| -} |
162 |
| - |
163 |
| -/* Clear in this cpu's CR4. */ |
164 |
| -static inline void cr4_clear_bits(unsigned long mask) |
165 |
| -{ |
166 |
| - unsigned long flags; |
167 |
| - |
168 |
| - local_irq_save(flags); |
169 |
| - cr4_clear_bits_irqsoff(mask); |
170 |
| - local_irq_restore(flags); |
171 |
| -} |
172 |
| - |
173 | 165 | extern unsigned long mmu_cr4_features;
|
174 | 166 | extern u32 *trampoline_cr4_features;
|
175 | 167 |
|
176 | 168 | extern void initialize_tlbstate_and_flush(void);
|
177 | 169 |
|
178 |
| -#define TLB_FLUSH_ALL -1UL |
179 |
| - |
180 | 170 | /*
|
181 | 171 | * TLB flushing:
|
182 | 172 | *
|
@@ -215,6 +205,16 @@ struct flush_tlb_info {
|
215 | 205 | bool freed_tables;
|
216 | 206 | };
|
217 | 207 |
|
| 208 | +void flush_tlb_local(void); |
| 209 | +void flush_tlb_one_user(unsigned long addr); |
| 210 | +void flush_tlb_one_kernel(unsigned long addr); |
| 211 | +void flush_tlb_others(const struct cpumask *cpumask, |
| 212 | + const struct flush_tlb_info *info); |
| 213 | + |
| 214 | +#ifdef CONFIG_PARAVIRT |
| 215 | +#include <asm/paravirt.h> |
| 216 | +#endif |
| 217 | + |
218 | 218 | #define flush_tlb_mm(mm) \
|
219 | 219 | flush_tlb_mm_range(mm, 0UL, TLB_FLUSH_ALL, 0UL, true)
|
220 | 220 |
|
@@ -255,4 +255,6 @@ static inline void arch_tlbbatch_add_mm(struct arch_tlbflush_unmap_batch *batch,
|
255 | 255 |
|
256 | 256 | extern void arch_tlbbatch_flush(struct arch_tlbflush_unmap_batch *batch);
|
257 | 257 |
|
| 258 | +#endif /* !MODULE */ |
| 259 | + |
258 | 260 | #endif /* _ASM_X86_TLBFLUSH_H */
|
0 commit comments