0001
0002 #ifndef _ASM_X86_INVPCID
0003 #define _ASM_X86_INVPCID
0004
0005 static inline void __invpcid(unsigned long pcid, unsigned long addr,
0006 unsigned long type)
0007 {
0008 struct { u64 d[2]; } desc = { { pcid, addr } };
0009
0010
0011
0012
0013
0014
0015
0016 asm volatile("invpcid %[desc], %[type]"
0017 :: [desc] "m" (desc), [type] "r" (type) : "memory");
0018 }
0019
0020 #define INVPCID_TYPE_INDIV_ADDR 0
0021 #define INVPCID_TYPE_SINGLE_CTXT 1
0022 #define INVPCID_TYPE_ALL_INCL_GLOBAL 2
0023 #define INVPCID_TYPE_ALL_NON_GLOBAL 3
0024
0025
0026 static inline void invpcid_flush_one(unsigned long pcid,
0027 unsigned long addr)
0028 {
0029 __invpcid(pcid, addr, INVPCID_TYPE_INDIV_ADDR);
0030 }
0031
0032
0033 static inline void invpcid_flush_single_context(unsigned long pcid)
0034 {
0035 __invpcid(pcid, 0, INVPCID_TYPE_SINGLE_CTXT);
0036 }
0037
0038
0039 static inline void invpcid_flush_all(void)
0040 {
0041 __invpcid(0, 0, INVPCID_TYPE_ALL_INCL_GLOBAL);
0042 }
0043
0044
0045 static inline void invpcid_flush_all_nonglobals(void)
0046 {
0047 __invpcid(0, 0, INVPCID_TYPE_ALL_NON_GLOBAL);
0048 }
0049
0050 #endif