aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/include/asm/cpufeature.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/include/asm/cpufeature.h')
-rw-r--r--arch/x86/include/asm/cpufeature.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
index 7f2f7b123293..30afb465d486 100644
--- a/arch/x86/include/asm/cpufeature.h
+++ b/arch/x86/include/asm/cpufeature.h
@@ -208,8 +208,7 @@ extern const char * const x86_power_flags[32];
208#define test_cpu_cap(c, bit) \ 208#define test_cpu_cap(c, bit) \
209 test_bit(bit, (unsigned long *)((c)->x86_capability)) 209 test_bit(bit, (unsigned long *)((c)->x86_capability))
210 210
211#define cpu_has(c, bit) \ 211#define REQUIRED_MASK_BIT_SET(bit) \
212 (__builtin_constant_p(bit) && \
213 ( (((bit)>>5)==0 && (1UL<<((bit)&31) & REQUIRED_MASK0)) || \ 212 ( (((bit)>>5)==0 && (1UL<<((bit)&31) & REQUIRED_MASK0)) || \
214 (((bit)>>5)==1 && (1UL<<((bit)&31) & REQUIRED_MASK1)) || \ 213 (((bit)>>5)==1 && (1UL<<((bit)&31) & REQUIRED_MASK1)) || \
215 (((bit)>>5)==2 && (1UL<<((bit)&31) & REQUIRED_MASK2)) || \ 214 (((bit)>>5)==2 && (1UL<<((bit)&31) & REQUIRED_MASK2)) || \
@@ -219,10 +218,16 @@ extern const char * const x86_power_flags[32];
219 (((bit)>>5)==6 && (1UL<<((bit)&31) & REQUIRED_MASK6)) || \ 218 (((bit)>>5)==6 && (1UL<<((bit)&31) & REQUIRED_MASK6)) || \
220 (((bit)>>5)==7 && (1UL<<((bit)&31) & REQUIRED_MASK7)) || \ 219 (((bit)>>5)==7 && (1UL<<((bit)&31) & REQUIRED_MASK7)) || \
221 (((bit)>>5)==8 && (1UL<<((bit)&31) & REQUIRED_MASK8)) || \ 220 (((bit)>>5)==8 && (1UL<<((bit)&31) & REQUIRED_MASK8)) || \
222 (((bit)>>5)==9 && (1UL<<((bit)&31) & REQUIRED_MASK9)) ) \ 221 (((bit)>>5)==9 && (1UL<<((bit)&31) & REQUIRED_MASK9)) )
223 ? 1 : \ 222
223#define cpu_has(c, bit) \
224 (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
224 test_cpu_cap(c, bit)) 225 test_cpu_cap(c, bit))
225 226
227#define this_cpu_has(bit) \
228 (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
229 x86_this_cpu_test_bit(bit, (unsigned long *)&cpu_info.x86_capability))
230
226#define boot_cpu_has(bit) cpu_has(&boot_cpu_data, bit) 231#define boot_cpu_has(bit) cpu_has(&boot_cpu_data, bit)
227 232
228#define set_cpu_cap(c, bit) set_bit(bit, (unsigned long *)((c)->x86_capability)) 233#define set_cpu_cap(c, bit) set_bit(bit, (unsigned long *)((c)->x86_capability))