xref: /linux/tools/arch/x86/include/asm/disabled-features.h (revision 3a07362fab1653d3aca31a9155c8cc776138fd02)
17d7d1bf1SArnaldo Carvalho de Melo #ifndef _ASM_X86_DISABLED_FEATURES_H
27d7d1bf1SArnaldo Carvalho de Melo #define _ASM_X86_DISABLED_FEATURES_H
37d7d1bf1SArnaldo Carvalho de Melo 
47d7d1bf1SArnaldo Carvalho de Melo /* These features, although they might be available in a CPU
57d7d1bf1SArnaldo Carvalho de Melo  * will not be used because the compile options to support
67d7d1bf1SArnaldo Carvalho de Melo  * them are not present.
77d7d1bf1SArnaldo Carvalho de Melo  *
87d7d1bf1SArnaldo Carvalho de Melo  * This code allows them to be checked and disabled at
97d7d1bf1SArnaldo Carvalho de Melo  * compile time without an explicit #ifdef.  Use
107d7d1bf1SArnaldo Carvalho de Melo  * cpu_feature_enabled().
117d7d1bf1SArnaldo Carvalho de Melo  */
127d7d1bf1SArnaldo Carvalho de Melo 
13b971880fSBabu Moger #ifdef CONFIG_X86_UMIP
140b44cfb8SIngo Molnar # define DISABLE_UMIP	0
150b44cfb8SIngo Molnar #else
160b44cfb8SIngo Molnar # define DISABLE_UMIP	(1<<(X86_FEATURE_UMIP & 31))
170b44cfb8SIngo Molnar #endif
180b44cfb8SIngo Molnar 
197d7d1bf1SArnaldo Carvalho de Melo #ifdef CONFIG_X86_64
207d7d1bf1SArnaldo Carvalho de Melo # define DISABLE_VME		(1<<(X86_FEATURE_VME & 31))
217d7d1bf1SArnaldo Carvalho de Melo # define DISABLE_K6_MTRR	(1<<(X86_FEATURE_K6_MTRR & 31))
227d7d1bf1SArnaldo Carvalho de Melo # define DISABLE_CYRIX_ARR	(1<<(X86_FEATURE_CYRIX_ARR & 31))
237d7d1bf1SArnaldo Carvalho de Melo # define DISABLE_CENTAUR_MCR	(1<<(X86_FEATURE_CENTAUR_MCR & 31))
24549a3976SIngo Molnar # define DISABLE_PCID		0
257d7d1bf1SArnaldo Carvalho de Melo #else
267d7d1bf1SArnaldo Carvalho de Melo # define DISABLE_VME		0
277d7d1bf1SArnaldo Carvalho de Melo # define DISABLE_K6_MTRR	0
287d7d1bf1SArnaldo Carvalho de Melo # define DISABLE_CYRIX_ARR	0
297d7d1bf1SArnaldo Carvalho de Melo # define DISABLE_CENTAUR_MCR	0
30549a3976SIngo Molnar # define DISABLE_PCID		(1<<(X86_FEATURE_PCID & 31))
317d7d1bf1SArnaldo Carvalho de Melo #endif /* CONFIG_X86_64 */
327d7d1bf1SArnaldo Carvalho de Melo 
337d7d1bf1SArnaldo Carvalho de Melo #ifdef CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS
347d7d1bf1SArnaldo Carvalho de Melo # define DISABLE_PKU		0
357d7d1bf1SArnaldo Carvalho de Melo # define DISABLE_OSPKE		0
367d7d1bf1SArnaldo Carvalho de Melo #else
377d7d1bf1SArnaldo Carvalho de Melo # define DISABLE_PKU		(1<<(X86_FEATURE_PKU & 31))
387d7d1bf1SArnaldo Carvalho de Melo # define DISABLE_OSPKE		(1<<(X86_FEATURE_OSPKE & 31))
397d7d1bf1SArnaldo Carvalho de Melo #endif /* CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS */
407d7d1bf1SArnaldo Carvalho de Melo 
416e30437bSIngo Molnar #ifdef CONFIG_X86_5LEVEL
426e30437bSIngo Molnar # define DISABLE_LA57	0
436e30437bSIngo Molnar #else
446e30437bSIngo Molnar # define DISABLE_LA57	(1<<(X86_FEATURE_LA57 & 31))
456e30437bSIngo Molnar #endif
466e30437bSIngo Molnar 
47ea4654e0SBreno Leitao #ifdef CONFIG_MITIGATION_PAGE_TABLE_ISOLATION
485d64db29SArnaldo Carvalho de Melo # define DISABLE_PTI		0
495d64db29SArnaldo Carvalho de Melo #else
505d64db29SArnaldo Carvalho de Melo # define DISABLE_PTI		(1 << (X86_FEATURE_PTI & 31))
515d64db29SArnaldo Carvalho de Melo #endif
525d64db29SArnaldo Carvalho de Melo 
53aefb2f2eSBreno Leitao #ifdef CONFIG_MITIGATION_RETPOLINE
54f098addbSArnaldo Carvalho de Melo # define DISABLE_RETPOLINE	0
55f098addbSArnaldo Carvalho de Melo #else
56f098addbSArnaldo Carvalho de Melo # define DISABLE_RETPOLINE	((1 << (X86_FEATURE_RETPOLINE & 31)) | \
57f098addbSArnaldo Carvalho de Melo 				 (1 << (X86_FEATURE_RETPOLINE_LFENCE & 31)))
58f098addbSArnaldo Carvalho de Melo #endif
59f098addbSArnaldo Carvalho de Melo 
600911b8c5SBreno Leitao #ifdef CONFIG_MITIGATION_RETHUNK
61f098addbSArnaldo Carvalho de Melo # define DISABLE_RETHUNK	0
62f098addbSArnaldo Carvalho de Melo #else
63f098addbSArnaldo Carvalho de Melo # define DISABLE_RETHUNK	(1 << (X86_FEATURE_RETHUNK & 31))
64f098addbSArnaldo Carvalho de Melo #endif
65f098addbSArnaldo Carvalho de Melo 
66ac61d439SBreno Leitao #ifdef CONFIG_MITIGATION_UNRET_ENTRY
67f098addbSArnaldo Carvalho de Melo # define DISABLE_UNRET		0
68f098addbSArnaldo Carvalho de Melo #else
69f098addbSArnaldo Carvalho de Melo # define DISABLE_UNRET		(1 << (X86_FEATURE_UNRET & 31))
70f098addbSArnaldo Carvalho de Melo #endif
71f098addbSArnaldo Carvalho de Melo 
725fa31af3SBreno Leitao #ifdef CONFIG_MITIGATION_CALL_DEPTH_TRACKING
730bc1d0e2SArnaldo Carvalho de Melo # define DISABLE_CALL_DEPTH_TRACKING	0
740bc1d0e2SArnaldo Carvalho de Melo #else
750bc1d0e2SArnaldo Carvalho de Melo # define DISABLE_CALL_DEPTH_TRACKING	(1 << (X86_FEATURE_CALL_DEPTH & 31))
760bc1d0e2SArnaldo Carvalho de Melo #endif
770bc1d0e2SArnaldo Carvalho de Melo 
781b5f159cSArnaldo Carvalho de Melo #ifdef CONFIG_ADDRESS_MASKING
791b5f159cSArnaldo Carvalho de Melo # define DISABLE_LAM		0
801b5f159cSArnaldo Carvalho de Melo #else
811b5f159cSArnaldo Carvalho de Melo # define DISABLE_LAM		(1 << (X86_FEATURE_LAM & 31))
821b5f159cSArnaldo Carvalho de Melo #endif
831b5f159cSArnaldo Carvalho de Melo 
841efe4cbdSArnaldo Carvalho de Melo #ifdef CONFIG_INTEL_IOMMU_SVM
851efe4cbdSArnaldo Carvalho de Melo # define DISABLE_ENQCMD		0
861efe4cbdSArnaldo Carvalho de Melo #else
8740a6bbf5SArnaldo Carvalho de Melo # define DISABLE_ENQCMD		(1 << (X86_FEATURE_ENQCMD & 31))
881efe4cbdSArnaldo Carvalho de Melo #endif
8940a6bbf5SArnaldo Carvalho de Melo 
90f93c789aSArnaldo Carvalho de Melo #ifdef CONFIG_X86_SGX
91f93c789aSArnaldo Carvalho de Melo # define DISABLE_SGX	0
92f93c789aSArnaldo Carvalho de Melo #else
93f93c789aSArnaldo Carvalho de Melo # define DISABLE_SGX	(1 << (X86_FEATURE_SGX & 31))
94f93c789aSArnaldo Carvalho de Melo #endif
95f93c789aSArnaldo Carvalho de Melo 
960bc1d0e2SArnaldo Carvalho de Melo #ifdef CONFIG_XEN_PV
970bc1d0e2SArnaldo Carvalho de Melo # define DISABLE_XENPV		0
980bc1d0e2SArnaldo Carvalho de Melo #else
990bc1d0e2SArnaldo Carvalho de Melo # define DISABLE_XENPV		(1 << (X86_FEATURE_XENPV & 31))
1000bc1d0e2SArnaldo Carvalho de Melo #endif
1010bc1d0e2SArnaldo Carvalho de Melo 
1024b3f7644SArnaldo Carvalho de Melo #ifdef CONFIG_INTEL_TDX_GUEST
1034b3f7644SArnaldo Carvalho de Melo # define DISABLE_TDX_GUEST	0
1044b3f7644SArnaldo Carvalho de Melo #else
1054b3f7644SArnaldo Carvalho de Melo # define DISABLE_TDX_GUEST	(1 << (X86_FEATURE_TDX_GUEST & 31))
1064b3f7644SArnaldo Carvalho de Melo #endif
1074b3f7644SArnaldo Carvalho de Melo 
108c23708f3SNamhyung Kim #ifdef CONFIG_X86_USER_SHADOW_STACK
109c23708f3SNamhyung Kim #define DISABLE_USER_SHSTK	0
110c23708f3SNamhyung Kim #else
111c23708f3SNamhyung Kim #define DISABLE_USER_SHSTK	(1 << (X86_FEATURE_USER_SHSTK & 31))
112c23708f3SNamhyung Kim #endif
113c23708f3SNamhyung Kim 
114c23708f3SNamhyung Kim #ifdef CONFIG_X86_KERNEL_IBT
115c23708f3SNamhyung Kim #define DISABLE_IBT	0
116c23708f3SNamhyung Kim #else
117c23708f3SNamhyung Kim #define DISABLE_IBT	(1 << (X86_FEATURE_IBT & 31))
118c23708f3SNamhyung Kim #endif
119c23708f3SNamhyung Kim 
120e554a8caSH. Peter Anvin (Intel) #ifdef CONFIG_X86_FRED
121e554a8caSH. Peter Anvin (Intel) # define DISABLE_FRED	0
122e554a8caSH. Peter Anvin (Intel) #else
123e554a8caSH. Peter Anvin (Intel) # define DISABLE_FRED	(1 << (X86_FEATURE_FRED & 31))
124e554a8caSH. Peter Anvin (Intel) #endif
125e554a8caSH. Peter Anvin (Intel) 
126*58e1b92dSNamhyung Kim #ifdef CONFIG_KVM_AMD_SEV
127*58e1b92dSNamhyung Kim #define DISABLE_SEV_SNP		0
128*58e1b92dSNamhyung Kim #else
129*58e1b92dSNamhyung Kim #define DISABLE_SEV_SNP		(1 << (X86_FEATURE_SEV_SNP & 31))
130*58e1b92dSNamhyung Kim #endif
131*58e1b92dSNamhyung Kim 
1327d7d1bf1SArnaldo Carvalho de Melo /*
1337d7d1bf1SArnaldo Carvalho de Melo  * Make sure to add features to the correct mask
1347d7d1bf1SArnaldo Carvalho de Melo  */
1357d7d1bf1SArnaldo Carvalho de Melo #define DISABLED_MASK0	(DISABLE_VME)
1367d7d1bf1SArnaldo Carvalho de Melo #define DISABLED_MASK1	0
1377d7d1bf1SArnaldo Carvalho de Melo #define DISABLED_MASK2	0
1387d7d1bf1SArnaldo Carvalho de Melo #define DISABLED_MASK3	(DISABLE_CYRIX_ARR|DISABLE_CENTAUR_MCR|DISABLE_K6_MTRR)
139549a3976SIngo Molnar #define DISABLED_MASK4	(DISABLE_PCID)
1407d7d1bf1SArnaldo Carvalho de Melo #define DISABLED_MASK5	0
1417d7d1bf1SArnaldo Carvalho de Melo #define DISABLED_MASK6	0
1425d64db29SArnaldo Carvalho de Melo #define DISABLED_MASK7	(DISABLE_PTI)
1430bc1d0e2SArnaldo Carvalho de Melo #define DISABLED_MASK8	(DISABLE_XENPV|DISABLE_TDX_GUEST)
144dbae0a93SBorislav Petkov #define DISABLED_MASK9	(DISABLE_SGX)
1457d7d1bf1SArnaldo Carvalho de Melo #define DISABLED_MASK10	0
1460bc1d0e2SArnaldo Carvalho de Melo #define DISABLED_MASK11	(DISABLE_RETPOLINE|DISABLE_RETHUNK|DISABLE_UNRET| \
147c23708f3SNamhyung Kim 			 DISABLE_CALL_DEPTH_TRACKING|DISABLE_USER_SHSTK)
148e554a8caSH. Peter Anvin (Intel) #define DISABLED_MASK12	(DISABLE_FRED|DISABLE_LAM)
1497d7d1bf1SArnaldo Carvalho de Melo #define DISABLED_MASK13	0
1507d7d1bf1SArnaldo Carvalho de Melo #define DISABLED_MASK14	0
1517d7d1bf1SArnaldo Carvalho de Melo #define DISABLED_MASK15	0
15240a6bbf5SArnaldo Carvalho de Melo #define DISABLED_MASK16	(DISABLE_PKU|DISABLE_OSPKE|DISABLE_LA57|DISABLE_UMIP| \
15340a6bbf5SArnaldo Carvalho de Melo 			 DISABLE_ENQCMD)
154840b49baSArnaldo Carvalho de Melo #define DISABLED_MASK17	0
155c23708f3SNamhyung Kim #define DISABLED_MASK18	(DISABLE_IBT)
156*58e1b92dSNamhyung Kim #define DISABLED_MASK19	(DISABLE_SEV_SNP)
1577d093064SArnaldo Carvalho de Melo #define DISABLED_MASK20	0
158*58e1b92dSNamhyung Kim #define DISABLED_MASK21	0
159*58e1b92dSNamhyung Kim #define DISABLED_MASK_CHECK BUILD_BUG_ON_ZERO(NCAPINTS != 22)
1607d7d1bf1SArnaldo Carvalho de Melo 
1617d7d1bf1SArnaldo Carvalho de Melo #endif /* _ASM_X86_DISABLED_FEATURES_H */
162