Skip to content

Commit 3d37d93

Browse files
H. Peter Anvin (Intel)Ingo Molnar
authored andcommitted
x86/cpufeatures: Add {REQUIRED,DISABLED} feature configs
Required and disabled feature masks completely rely on build configs, i.e., once a build config is fixed, so are the feature masks. To prepare for auto-generating the <asm/cpufeaturemasks.h> header with required and disabled feature masks based on a build config, add feature Kconfig items: - X86_REQUIRED_FEATURE_x - X86_DISABLED_FEATURE_x each of which may be set to "y" if and only if its preconditions from current build config are met. Signed-off-by: H. Peter Anvin (Intel) <[email protected]> Signed-off-by: Xin Li (Intel) <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Cc: Linus Torvalds <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent f666c92 commit 3d37d93

File tree

2 files changed

+203
-0
lines changed

2 files changed

+203
-0
lines changed

arch/x86/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3130,4 +3130,6 @@ config HAVE_ATOMIC_IOMAP
31303130

31313131
source "arch/x86/kvm/Kconfig"
31323132

3133+
source "arch/x86/Kconfig.cpufeatures"
3134+
31333135
source "arch/x86/Kconfig.assembler"

arch/x86/Kconfig.cpufeatures

Lines changed: 201 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
1+
# SPDX-License-Identifier: GPL-2.0
2+
#
3+
# x86 feature bits (see arch/x86/include/asm/cpufeatures.h) that are
4+
# either REQUIRED to be enabled, or DISABLED (always ignored) for this
5+
# particular compile-time configuration. The tests for these features
6+
# are turned into compile-time constants via the generated
7+
# <asm/cpufeaturemasks.h>.
8+
#
9+
# The naming of these variables *must* match asm/cpufeatures.h, e.g.,
10+
# X86_FEATURE_ALWAYS <==> X86_REQUIRED_FEATURE_ALWAYS
11+
# X86_FEATURE_FRED <==> X86_DISABLED_FEATURE_FRED
12+
#
13+
# And these REQUIRED and DISABLED config options are manipulated in an
14+
# AWK script as the following example:
15+
#
16+
# +----------------------+
17+
# | X86_FRED = y ? |
18+
# +----------------------+
19+
# / \
20+
# Y / \ N
21+
# +-------------------------------------+ +-------------------------------+
22+
# | X86_DISABLED_FEATURE_FRED undefined | | X86_DISABLED_FEATURE_FRED = y |
23+
# +-------------------------------------+ +-------------------------------+
24+
# |
25+
# |
26+
# +-------------------------------------------+ |
27+
# | X86_FEATURE_FRED: feature word 12, bit 17 | ---->|
28+
# +-------------------------------------------+ |
29+
# |
30+
# |
31+
# +-------------------------------+
32+
# | set bit 17 of DISABLED_MASK12 |
33+
# +-------------------------------+
34+
#
35+
36+
config X86_REQUIRED_FEATURE_ALWAYS
37+
def_bool y
38+
39+
config X86_REQUIRED_FEATURE_NOPL
40+
def_bool y
41+
depends on X86_64 || X86_P6_NOP
42+
43+
config X86_REQUIRED_FEATURE_CX8
44+
def_bool y
45+
depends on X86_CX8
46+
47+
# this should be set for all -march=.. options where the compiler
48+
# generates cmov.
49+
config X86_REQUIRED_FEATURE_CMOV
50+
def_bool y
51+
depends on X86_CMOV
52+
53+
# this should be set for all -march= options where the compiler
54+
# generates movbe.
55+
config X86_REQUIRED_FEATURE_MOVBE
56+
def_bool y
57+
depends on MATOM
58+
59+
config X86_REQUIRED_FEATURE_CPUID
60+
def_bool y
61+
depends on X86_64
62+
63+
config X86_REQUIRED_FEATURE_UP
64+
def_bool y
65+
depends on !SMP
66+
67+
config X86_REQUIRED_FEATURE_FPU
68+
def_bool y
69+
depends on !MATH_EMULATION
70+
71+
config X86_REQUIRED_FEATURE_PAE
72+
def_bool y
73+
depends on X86_64 || X86_PAE
74+
75+
config X86_REQUIRED_FEATURE_PSE
76+
def_bool y
77+
depends on X86_64 && !PARAVIRT_XXL
78+
79+
config X86_REQUIRED_FEATURE_PGE
80+
def_bool y
81+
depends on X86_64 && !PARAVIRT_XXL
82+
83+
config X86_REQUIRED_FEATURE_MSR
84+
def_bool y
85+
depends on X86_64
86+
87+
config X86_REQUIRED_FEATURE_FXSR
88+
def_bool y
89+
depends on X86_64
90+
91+
config X86_REQUIRED_FEATURE_XMM
92+
def_bool y
93+
depends on X86_64
94+
95+
config X86_REQUIRED_FEATURE_XMM2
96+
def_bool y
97+
depends on X86_64
98+
99+
config X86_REQUIRED_FEATURE_LM
100+
def_bool y
101+
depends on X86_64
102+
103+
config X86_DISABLED_FEATURE_UMIP
104+
def_bool y
105+
depends on !X86_UMIP
106+
107+
config X86_DISABLED_FEATURE_VME
108+
def_bool y
109+
depends on X86_64
110+
111+
config X86_DISABLED_FEATURE_K6_MTRR
112+
def_bool y
113+
depends on X86_64
114+
115+
config X86_DISABLED_FEATURE_CYRIX_ARR
116+
def_bool y
117+
depends on X86_64
118+
119+
config X86_DISABLED_FEATURE_CENTAUR_MCR
120+
def_bool y
121+
depends on X86_64
122+
123+
config X86_DISABLED_FEATURE_PCID
124+
def_bool y
125+
depends on !X86_64
126+
127+
config X86_DISABLED_FEATURE_PKU
128+
def_bool y
129+
depends on !X86_INTEL_MEMORY_PROTECTION_KEYS
130+
131+
config X86_DISABLED_FEATURE_OSPKE
132+
def_bool y
133+
depends on !X86_INTEL_MEMORY_PROTECTION_KEYS
134+
135+
config X86_DISABLED_FEATURE_LA57
136+
def_bool y
137+
depends on !X86_5LEVEL
138+
139+
config X86_DISABLED_FEATURE_PTI
140+
def_bool y
141+
depends on !MITIGATION_PAGE_TABLE_ISOLATION
142+
143+
config X86_DISABLED_FEATURE_RETPOLINE
144+
def_bool y
145+
depends on !MITIGATION_RETPOLINE
146+
147+
config X86_DISABLED_FEATURE_RETPOLINE_LFENCE
148+
def_bool y
149+
depends on !MITIGATION_RETPOLINE
150+
151+
config X86_DISABLED_FEATURE_RETHUNK
152+
def_bool y
153+
depends on !MITIGATION_RETHUNK
154+
155+
config X86_DISABLED_FEATURE_UNRET
156+
def_bool y
157+
depends on !MITIGATION_UNRET_ENTRY
158+
159+
config X86_DISABLED_FEATURE_CALL_DEPTH
160+
def_bool y
161+
depends on !MITIGATION_CALL_DEPTH_TRACKING
162+
163+
config X86_DISABLED_FEATURE_LAM
164+
def_bool y
165+
depends on !ADDRESS_MASKING
166+
167+
config X86_DISABLED_FEATURE_ENQCMD
168+
def_bool y
169+
depends on !INTEL_IOMMU_SVM
170+
171+
config X86_DISABLED_FEATURE_SGX
172+
def_bool y
173+
depends on !X86_SGX
174+
175+
config X86_DISABLED_FEATURE_XENPV
176+
def_bool y
177+
depends on !XEN_PV
178+
179+
config X86_DISABLED_FEATURE_TDX_GUEST
180+
def_bool y
181+
depends on !INTEL_TDX_GUEST
182+
183+
config X86_DISABLED_FEATURE_USER_SHSTK
184+
def_bool y
185+
depends on !X86_USER_SHADOW_STACK
186+
187+
config X86_DISABLED_FEATURE_IBT
188+
def_bool y
189+
depends on !X86_KERNEL_IBT
190+
191+
config X86_DISABLED_FEATURE_FRED
192+
def_bool y
193+
depends on !X86_FRED
194+
195+
config X86_DISABLED_FEATURE_SEV_SNP
196+
def_bool y
197+
depends on !KVM_AMD_SEV
198+
199+
config X86_DISABLED_FEATURE_INVLPGB
200+
def_bool y
201+
depends on !BROADCAST_TLB_FLUSH

0 commit comments

Comments
 (0)