|
9 | 9 | #include <asm/cpufeature.h>
|
10 | 10 | #include <asm/special_insns.h>
|
11 | 11 | #include <asm/smp.h>
|
12 |
| - |
13 |
| -static inline void __invpcid(unsigned long pcid, unsigned long addr, |
14 |
| - unsigned long type) |
15 |
| -{ |
16 |
| - struct { u64 d[2]; } desc = { { pcid, addr } }; |
17 |
| - |
18 |
| - /* |
19 |
| - * The memory clobber is because the whole point is to invalidate |
20 |
| - * stale TLB entries and, especially if we're flushing global |
21 |
| - * mappings, we don't want the compiler to reorder any subsequent |
22 |
| - * memory accesses before the TLB flush. |
23 |
| - * |
24 |
| - * The hex opcode is invpcid (%ecx), %eax in 32-bit mode and |
25 |
| - * invpcid (%rcx), %rax in long mode. |
26 |
| - */ |
27 |
| - asm volatile (".byte 0x66, 0x0f, 0x38, 0x82, 0x01" |
28 |
| - : : "m" (desc), "a" (type), "c" (&desc) : "memory"); |
29 |
| -} |
30 |
| - |
31 |
| -#define INVPCID_TYPE_INDIV_ADDR 0 |
32 |
| -#define INVPCID_TYPE_SINGLE_CTXT 1 |
33 |
| -#define INVPCID_TYPE_ALL_INCL_GLOBAL 2 |
34 |
| -#define INVPCID_TYPE_ALL_NON_GLOBAL 3 |
35 |
| - |
36 |
| -/* Flush all mappings for a given pcid and addr, not including globals. */ |
37 |
| -static inline void invpcid_flush_one(unsigned long pcid, |
38 |
| - unsigned long addr) |
39 |
| -{ |
40 |
| - __invpcid(pcid, addr, INVPCID_TYPE_INDIV_ADDR); |
41 |
| -} |
42 |
| - |
43 |
| -/* Flush all mappings for a given PCID, not including globals. */ |
44 |
| -static inline void invpcid_flush_single_context(unsigned long pcid) |
45 |
| -{ |
46 |
| - __invpcid(pcid, 0, INVPCID_TYPE_SINGLE_CTXT); |
47 |
| -} |
48 |
| - |
49 |
| -/* Flush all mappings, including globals, for all PCIDs. */ |
50 |
| -static inline void invpcid_flush_all(void) |
51 |
| -{ |
52 |
| - __invpcid(0, 0, INVPCID_TYPE_ALL_INCL_GLOBAL); |
53 |
| -} |
54 |
| - |
55 |
| -/* Flush all mappings for all PCIDs except globals. */ |
56 |
| -static inline void invpcid_flush_all_nonglobals(void) |
57 |
| -{ |
58 |
| - __invpcid(0, 0, INVPCID_TYPE_ALL_NON_GLOBAL); |
59 |
| -} |
| 12 | +#include <asm/invpcid.h> |
60 | 13 |
|
61 | 14 | static inline u64 inc_mm_tlb_gen(struct mm_struct *mm)
|
62 | 15 | {
|
|
0 commit comments