diff options
author | Borislav Petkov <bp@suse.de> | 2015-12-07 04:39:41 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2015-12-19 05:49:55 -0500 |
commit | 362f924b64ba0f4be2ee0cb697690c33d40be721 (patch) | |
tree | dcfba0fc2301d1b81ad2c7220ad7edd8e6166db7 | |
parent | 39c06df4dc10a41de5fe706f4378ee5f09beba73 (diff) |
x86/cpufeature: Remove unused and seldomly used cpu_has_xx macros
Those are stupid and code should use static_cpu_has_safe() or
boot_cpu_has() instead. Kill the least used and unused ones.
The remaining ones need more careful inspection before a conversion can
happen. On the TODO.
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: http://lkml.kernel.org/r/1449481182-27541-4-git-send-email-bp@alien8.de
Cc: David Sterba <dsterba@suse.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Matt Mackall <mpm@selenic.com>
Cc: Chris Mason <clm@fb.com>
Cc: Josef Bacik <jbacik@fb.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
24 files changed, 48 insertions, 68 deletions
diff --git a/arch/x86/crypto/chacha20_glue.c b/arch/x86/crypto/chacha20_glue.c index 722bacea040e..8baaff5af0b5 100644 --- a/arch/x86/crypto/chacha20_glue.c +++ b/arch/x86/crypto/chacha20_glue.c | |||
@@ -125,7 +125,7 @@ static struct crypto_alg alg = { | |||
125 | 125 | ||
126 | static int __init chacha20_simd_mod_init(void) | 126 | static int __init chacha20_simd_mod_init(void) |
127 | { | 127 | { |
128 | if (!cpu_has_ssse3) | 128 | if (!boot_cpu_has(X86_FEATURE_SSSE3)) |
129 | return -ENODEV; | 129 | return -ENODEV; |
130 | 130 | ||
131 | #ifdef CONFIG_AS_AVX2 | 131 | #ifdef CONFIG_AS_AVX2 |
diff --git a/arch/x86/crypto/crc32c-intel_glue.c b/arch/x86/crypto/crc32c-intel_glue.c index 81a595d75cf5..0e9871693f24 100644 --- a/arch/x86/crypto/crc32c-intel_glue.c +++ b/arch/x86/crypto/crc32c-intel_glue.c | |||
@@ -257,7 +257,7 @@ static int __init crc32c_intel_mod_init(void) | |||
257 | if (!x86_match_cpu(crc32c_cpu_id)) | 257 | if (!x86_match_cpu(crc32c_cpu_id)) |
258 | return -ENODEV; | 258 | return -ENODEV; |
259 | #ifdef CONFIG_X86_64 | 259 | #ifdef CONFIG_X86_64 |
260 | if (cpu_has_pclmulqdq) { | 260 | if (boot_cpu_has(X86_FEATURE_PCLMULQDQ)) { |
261 | alg.update = crc32c_pcl_intel_update; | 261 | alg.update = crc32c_pcl_intel_update; |
262 | alg.finup = crc32c_pcl_intel_finup; | 262 | alg.finup = crc32c_pcl_intel_finup; |
263 | alg.digest = crc32c_pcl_intel_digest; | 263 | alg.digest = crc32c_pcl_intel_digest; |
diff --git a/arch/x86/include/asm/cmpxchg_32.h b/arch/x86/include/asm/cmpxchg_32.h index f7e142926481..e4959d023af8 100644 --- a/arch/x86/include/asm/cmpxchg_32.h +++ b/arch/x86/include/asm/cmpxchg_32.h | |||
@@ -109,6 +109,6 @@ static inline u64 __cmpxchg64_local(volatile u64 *ptr, u64 old, u64 new) | |||
109 | 109 | ||
110 | #endif | 110 | #endif |
111 | 111 | ||
112 | #define system_has_cmpxchg_double() cpu_has_cx8 | 112 | #define system_has_cmpxchg_double() boot_cpu_has(X86_FEATURE_CX8) |
113 | 113 | ||
114 | #endif /* _ASM_X86_CMPXCHG_32_H */ | 114 | #endif /* _ASM_X86_CMPXCHG_32_H */ |
diff --git a/arch/x86/include/asm/cmpxchg_64.h b/arch/x86/include/asm/cmpxchg_64.h index 1af94697aae5..caa23a34c963 100644 --- a/arch/x86/include/asm/cmpxchg_64.h +++ b/arch/x86/include/asm/cmpxchg_64.h | |||
@@ -18,6 +18,6 @@ static inline void set_64bit(volatile u64 *ptr, u64 val) | |||
18 | cmpxchg_local((ptr), (o), (n)); \ | 18 | cmpxchg_local((ptr), (o), (n)); \ |
19 | }) | 19 | }) |
20 | 20 | ||
21 | #define system_has_cmpxchg_double() cpu_has_cx16 | 21 | #define system_has_cmpxchg_double() boot_cpu_has(X86_FEATURE_CX16) |
22 | 22 | ||
23 | #endif /* _ASM_X86_CMPXCHG_64_H */ | 23 | #endif /* _ASM_X86_CMPXCHG_64_H */ |
diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h index 35401fef0d75..144b042c0872 100644 --- a/arch/x86/include/asm/cpufeature.h +++ b/arch/x86/include/asm/cpufeature.h | |||
@@ -385,58 +385,29 @@ extern const char * const x86_bug_flags[NBUGINTS*32]; | |||
385 | } while (0) | 385 | } while (0) |
386 | 386 | ||
387 | #define cpu_has_fpu boot_cpu_has(X86_FEATURE_FPU) | 387 | #define cpu_has_fpu boot_cpu_has(X86_FEATURE_FPU) |
388 | #define cpu_has_de boot_cpu_has(X86_FEATURE_DE) | ||
389 | #define cpu_has_pse boot_cpu_has(X86_FEATURE_PSE) | 388 | #define cpu_has_pse boot_cpu_has(X86_FEATURE_PSE) |
390 | #define cpu_has_tsc boot_cpu_has(X86_FEATURE_TSC) | 389 | #define cpu_has_tsc boot_cpu_has(X86_FEATURE_TSC) |
391 | #define cpu_has_pge boot_cpu_has(X86_FEATURE_PGE) | 390 | #define cpu_has_pge boot_cpu_has(X86_FEATURE_PGE) |
392 | #define cpu_has_apic boot_cpu_has(X86_FEATURE_APIC) | 391 | #define cpu_has_apic boot_cpu_has(X86_FEATURE_APIC) |
393 | #define cpu_has_sep boot_cpu_has(X86_FEATURE_SEP) | ||
394 | #define cpu_has_mtrr boot_cpu_has(X86_FEATURE_MTRR) | ||
395 | #define cpu_has_mmx boot_cpu_has(X86_FEATURE_MMX) | ||
396 | #define cpu_has_fxsr boot_cpu_has(X86_FEATURE_FXSR) | 392 | #define cpu_has_fxsr boot_cpu_has(X86_FEATURE_FXSR) |
397 | #define cpu_has_xmm boot_cpu_has(X86_FEATURE_XMM) | 393 | #define cpu_has_xmm boot_cpu_has(X86_FEATURE_XMM) |
398 | #define cpu_has_xmm2 boot_cpu_has(X86_FEATURE_XMM2) | 394 | #define cpu_has_xmm2 boot_cpu_has(X86_FEATURE_XMM2) |
399 | #define cpu_has_xmm3 boot_cpu_has(X86_FEATURE_XMM3) | ||
400 | #define cpu_has_ssse3 boot_cpu_has(X86_FEATURE_SSSE3) | ||
401 | #define cpu_has_aes boot_cpu_has(X86_FEATURE_AES) | 395 | #define cpu_has_aes boot_cpu_has(X86_FEATURE_AES) |
402 | #define cpu_has_avx boot_cpu_has(X86_FEATURE_AVX) | 396 | #define cpu_has_avx boot_cpu_has(X86_FEATURE_AVX) |
403 | #define cpu_has_avx2 boot_cpu_has(X86_FEATURE_AVX2) | 397 | #define cpu_has_avx2 boot_cpu_has(X86_FEATURE_AVX2) |
404 | #define cpu_has_ht boot_cpu_has(X86_FEATURE_HT) | ||
405 | #define cpu_has_nx boot_cpu_has(X86_FEATURE_NX) | ||
406 | #define cpu_has_xstore boot_cpu_has(X86_FEATURE_XSTORE) | ||
407 | #define cpu_has_xstore_enabled boot_cpu_has(X86_FEATURE_XSTORE_EN) | ||
408 | #define cpu_has_xcrypt boot_cpu_has(X86_FEATURE_XCRYPT) | ||
409 | #define cpu_has_xcrypt_enabled boot_cpu_has(X86_FEATURE_XCRYPT_EN) | ||
410 | #define cpu_has_ace2 boot_cpu_has(X86_FEATURE_ACE2) | ||
411 | #define cpu_has_ace2_enabled boot_cpu_has(X86_FEATURE_ACE2_EN) | ||
412 | #define cpu_has_phe boot_cpu_has(X86_FEATURE_PHE) | ||
413 | #define cpu_has_phe_enabled boot_cpu_has(X86_FEATURE_PHE_EN) | ||
414 | #define cpu_has_pmm boot_cpu_has(X86_FEATURE_PMM) | ||
415 | #define cpu_has_pmm_enabled boot_cpu_has(X86_FEATURE_PMM_EN) | ||
416 | #define cpu_has_ds boot_cpu_has(X86_FEATURE_DS) | ||
417 | #define cpu_has_pebs boot_cpu_has(X86_FEATURE_PEBS) | ||
418 | #define cpu_has_clflush boot_cpu_has(X86_FEATURE_CLFLUSH) | 398 | #define cpu_has_clflush boot_cpu_has(X86_FEATURE_CLFLUSH) |
419 | #define cpu_has_bts boot_cpu_has(X86_FEATURE_BTS) | ||
420 | #define cpu_has_gbpages boot_cpu_has(X86_FEATURE_GBPAGES) | 399 | #define cpu_has_gbpages boot_cpu_has(X86_FEATURE_GBPAGES) |
421 | #define cpu_has_arch_perfmon boot_cpu_has(X86_FEATURE_ARCH_PERFMON) | 400 | #define cpu_has_arch_perfmon boot_cpu_has(X86_FEATURE_ARCH_PERFMON) |
422 | #define cpu_has_pat boot_cpu_has(X86_FEATURE_PAT) | 401 | #define cpu_has_pat boot_cpu_has(X86_FEATURE_PAT) |
423 | #define cpu_has_xmm4_1 boot_cpu_has(X86_FEATURE_XMM4_1) | ||
424 | #define cpu_has_xmm4_2 boot_cpu_has(X86_FEATURE_XMM4_2) | ||
425 | #define cpu_has_x2apic boot_cpu_has(X86_FEATURE_X2APIC) | 402 | #define cpu_has_x2apic boot_cpu_has(X86_FEATURE_X2APIC) |
426 | #define cpu_has_xsave boot_cpu_has(X86_FEATURE_XSAVE) | 403 | #define cpu_has_xsave boot_cpu_has(X86_FEATURE_XSAVE) |
427 | #define cpu_has_xsaveopt boot_cpu_has(X86_FEATURE_XSAVEOPT) | ||
428 | #define cpu_has_xsaves boot_cpu_has(X86_FEATURE_XSAVES) | 404 | #define cpu_has_xsaves boot_cpu_has(X86_FEATURE_XSAVES) |
429 | #define cpu_has_osxsave boot_cpu_has(X86_FEATURE_OSXSAVE) | 405 | #define cpu_has_osxsave boot_cpu_has(X86_FEATURE_OSXSAVE) |
430 | #define cpu_has_hypervisor boot_cpu_has(X86_FEATURE_HYPERVISOR) | 406 | #define cpu_has_hypervisor boot_cpu_has(X86_FEATURE_HYPERVISOR) |
431 | #define cpu_has_pclmulqdq boot_cpu_has(X86_FEATURE_PCLMULQDQ) | 407 | /* |
432 | #define cpu_has_perfctr_core boot_cpu_has(X86_FEATURE_PERFCTR_CORE) | 408 | * Do not add any more of those clumsy macros - use static_cpu_has_safe() for |
433 | #define cpu_has_perfctr_nb boot_cpu_has(X86_FEATURE_PERFCTR_NB) | 409 | * fast paths and boot_cpu_has() otherwise! |
434 | #define cpu_has_perfctr_l2 boot_cpu_has(X86_FEATURE_PERFCTR_L2) | 410 | */ |
435 | #define cpu_has_cx8 boot_cpu_has(X86_FEATURE_CX8) | ||
436 | #define cpu_has_cx16 boot_cpu_has(X86_FEATURE_CX16) | ||
437 | #define cpu_has_eager_fpu boot_cpu_has(X86_FEATURE_EAGER_FPU) | ||
438 | #define cpu_has_topoext boot_cpu_has(X86_FEATURE_TOPOEXT) | ||
439 | #define cpu_has_bpext boot_cpu_has(X86_FEATURE_BPEXT) | ||
440 | 411 | ||
441 | #if __GNUC__ >= 4 | 412 | #if __GNUC__ >= 4 |
442 | extern void warn_pre_alternatives(void); | 413 | extern void warn_pre_alternatives(void); |
diff --git a/arch/x86/include/asm/xor_32.h b/arch/x86/include/asm/xor_32.h index 5a08bc8bff33..c54beb44c4c1 100644 --- a/arch/x86/include/asm/xor_32.h +++ b/arch/x86/include/asm/xor_32.h | |||
@@ -553,7 +553,7 @@ do { \ | |||
553 | if (cpu_has_xmm) { \ | 553 | if (cpu_has_xmm) { \ |
554 | xor_speed(&xor_block_pIII_sse); \ | 554 | xor_speed(&xor_block_pIII_sse); \ |
555 | xor_speed(&xor_block_sse_pf64); \ | 555 | xor_speed(&xor_block_sse_pf64); \ |
556 | } else if (cpu_has_mmx) { \ | 556 | } else if (boot_cpu_has(X86_FEATURE_MMX)) { \ |
557 | xor_speed(&xor_block_pII_mmx); \ | 557 | xor_speed(&xor_block_pII_mmx); \ |
558 | xor_speed(&xor_block_p5_mmx); \ | 558 | xor_speed(&xor_block_p5_mmx); \ |
559 | } else { \ | 559 | } else { \ |
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index a8816b325162..34c3ad608dd4 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c | |||
@@ -304,7 +304,7 @@ static void amd_get_topology(struct cpuinfo_x86 *c) | |||
304 | int cpu = smp_processor_id(); | 304 | int cpu = smp_processor_id(); |
305 | 305 | ||
306 | /* get information required for multi-node processors */ | 306 | /* get information required for multi-node processors */ |
307 | if (cpu_has_topoext) { | 307 | if (boot_cpu_has(X86_FEATURE_TOPOEXT)) { |
308 | u32 eax, ebx, ecx, edx; | 308 | u32 eax, ebx, ecx, edx; |
309 | 309 | ||
310 | cpuid(0x8000001e, &eax, &ebx, &ecx, &edx); | 310 | cpuid(0x8000001e, &eax, &ebx, &ecx, &edx); |
@@ -922,7 +922,7 @@ static bool cpu_has_amd_erratum(struct cpuinfo_x86 *cpu, const int *erratum) | |||
922 | 922 | ||
923 | void set_dr_addr_mask(unsigned long mask, int dr) | 923 | void set_dr_addr_mask(unsigned long mask, int dr) |
924 | { | 924 | { |
925 | if (!cpu_has_bpext) | 925 | if (!boot_cpu_has(X86_FEATURE_BPEXT)) |
926 | return; | 926 | return; |
927 | 927 | ||
928 | switch (dr) { | 928 | switch (dr) { |
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index e14d5bd8671f..4d5279c95d5f 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c | |||
@@ -1445,7 +1445,9 @@ void cpu_init(void) | |||
1445 | 1445 | ||
1446 | printk(KERN_INFO "Initializing CPU#%d\n", cpu); | 1446 | printk(KERN_INFO "Initializing CPU#%d\n", cpu); |
1447 | 1447 | ||
1448 | if (cpu_feature_enabled(X86_FEATURE_VME) || cpu_has_tsc || cpu_has_de) | 1448 | if (cpu_feature_enabled(X86_FEATURE_VME) || |
1449 | cpu_has_tsc || | ||
1450 | boot_cpu_has(X86_FEATURE_DE)) | ||
1449 | cr4_clear_bits(X86_CR4_VME|X86_CR4_PVI|X86_CR4_TSD|X86_CR4_DE); | 1451 | cr4_clear_bits(X86_CR4_VME|X86_CR4_PVI|X86_CR4_TSD|X86_CR4_DE); |
1450 | 1452 | ||
1451 | load_current_idt(); | 1453 | load_current_idt(); |
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c index 209ac1e7d1f0..565648bc1a0a 100644 --- a/arch/x86/kernel/cpu/intel.c +++ b/arch/x86/kernel/cpu/intel.c | |||
@@ -445,7 +445,8 @@ static void init_intel(struct cpuinfo_x86 *c) | |||
445 | 445 | ||
446 | if (cpu_has_xmm2) | 446 | if (cpu_has_xmm2) |
447 | set_cpu_cap(c, X86_FEATURE_LFENCE_RDTSC); | 447 | set_cpu_cap(c, X86_FEATURE_LFENCE_RDTSC); |
448 | if (cpu_has_ds) { | 448 | |
449 | if (boot_cpu_has(X86_FEATURE_DS)) { | ||
449 | unsigned int l1; | 450 | unsigned int l1; |
450 | rdmsr(MSR_IA32_MISC_ENABLE, l1, l2); | 451 | rdmsr(MSR_IA32_MISC_ENABLE, l1, l2); |
451 | if (!(l1 & (1<<11))) | 452 | if (!(l1 & (1<<11))) |
diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c index e38d338a6447..0b6c52388cf4 100644 --- a/arch/x86/kernel/cpu/intel_cacheinfo.c +++ b/arch/x86/kernel/cpu/intel_cacheinfo.c | |||
@@ -591,7 +591,7 @@ cpuid4_cache_lookup_regs(int index, struct _cpuid4_info_regs *this_leaf) | |||
591 | unsigned edx; | 591 | unsigned edx; |
592 | 592 | ||
593 | if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) { | 593 | if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) { |
594 | if (cpu_has_topoext) | 594 | if (boot_cpu_has(X86_FEATURE_TOPOEXT)) |
595 | cpuid_count(0x8000001d, index, &eax.full, | 595 | cpuid_count(0x8000001d, index, &eax.full, |
596 | &ebx.full, &ecx.full, &edx); | 596 | &ebx.full, &ecx.full, &edx); |
597 | else | 597 | else |
@@ -637,7 +637,7 @@ static int find_num_cache_leaves(struct cpuinfo_x86 *c) | |||
637 | void init_amd_cacheinfo(struct cpuinfo_x86 *c) | 637 | void init_amd_cacheinfo(struct cpuinfo_x86 *c) |
638 | { | 638 | { |
639 | 639 | ||
640 | if (cpu_has_topoext) { | 640 | if (boot_cpu_has(X86_FEATURE_TOPOEXT)) { |
641 | num_cache_leaves = find_num_cache_leaves(c); | 641 | num_cache_leaves = find_num_cache_leaves(c); |
642 | } else if (c->extended_cpuid_level >= 0x80000006) { | 642 | } else if (c->extended_cpuid_level >= 0x80000006) { |
643 | if (cpuid_edx(0x80000006) & 0xf000) | 643 | if (cpuid_edx(0x80000006) & 0xf000) |
@@ -809,7 +809,7 @@ static int __cache_amd_cpumap_setup(unsigned int cpu, int index, | |||
809 | struct cacheinfo *this_leaf; | 809 | struct cacheinfo *this_leaf; |
810 | int i, sibling; | 810 | int i, sibling; |
811 | 811 | ||
812 | if (cpu_has_topoext) { | 812 | if (boot_cpu_has(X86_FEATURE_TOPOEXT)) { |
813 | unsigned int apicid, nshared, first, last; | 813 | unsigned int apicid, nshared, first, last; |
814 | 814 | ||
815 | this_leaf = this_cpu_ci->info_list + index; | 815 | this_leaf = this_cpu_ci->info_list + index; |
diff --git a/arch/x86/kernel/cpu/mtrr/generic.c b/arch/x86/kernel/cpu/mtrr/generic.c index 3b533cf37c74..c870af161008 100644 --- a/arch/x86/kernel/cpu/mtrr/generic.c +++ b/arch/x86/kernel/cpu/mtrr/generic.c | |||
@@ -349,7 +349,7 @@ static void get_fixed_ranges(mtrr_type *frs) | |||
349 | 349 | ||
350 | void mtrr_save_fixed_ranges(void *info) | 350 | void mtrr_save_fixed_ranges(void *info) |
351 | { | 351 | { |
352 | if (cpu_has_mtrr) | 352 | if (boot_cpu_has(X86_FEATURE_MTRR)) |
353 | get_fixed_ranges(mtrr_state.fixed_ranges); | 353 | get_fixed_ranges(mtrr_state.fixed_ranges); |
354 | } | 354 | } |
355 | 355 | ||
diff --git a/arch/x86/kernel/cpu/mtrr/main.c b/arch/x86/kernel/cpu/mtrr/main.c index f891b4750f04..5c3d149ee91c 100644 --- a/arch/x86/kernel/cpu/mtrr/main.c +++ b/arch/x86/kernel/cpu/mtrr/main.c | |||
@@ -682,7 +682,7 @@ void __init mtrr_bp_init(void) | |||
682 | 682 | ||
683 | phys_addr = 32; | 683 | phys_addr = 32; |
684 | 684 | ||
685 | if (cpu_has_mtrr) { | 685 | if (boot_cpu_has(X86_FEATURE_MTRR)) { |
686 | mtrr_if = &generic_mtrr_ops; | 686 | mtrr_if = &generic_mtrr_ops; |
687 | size_or_mask = SIZE_OR_MASK_BITS(36); | 687 | size_or_mask = SIZE_OR_MASK_BITS(36); |
688 | size_and_mask = 0x00f00000; | 688 | size_and_mask = 0x00f00000; |
diff --git a/arch/x86/kernel/cpu/perf_event_amd.c b/arch/x86/kernel/cpu/perf_event_amd.c index 1cee5d2d7ece..3ea177cb7366 100644 --- a/arch/x86/kernel/cpu/perf_event_amd.c +++ b/arch/x86/kernel/cpu/perf_event_amd.c | |||
@@ -160,7 +160,7 @@ static inline int amd_pmu_addr_offset(int index, bool eventsel) | |||
160 | if (offset) | 160 | if (offset) |
161 | return offset; | 161 | return offset; |
162 | 162 | ||
163 | if (!cpu_has_perfctr_core) | 163 | if (!boot_cpu_has(X86_FEATURE_PERFCTR_CORE)) |
164 | offset = index; | 164 | offset = index; |
165 | else | 165 | else |
166 | offset = index << 1; | 166 | offset = index << 1; |
@@ -652,7 +652,7 @@ static __initconst const struct x86_pmu amd_pmu = { | |||
652 | 652 | ||
653 | static int __init amd_core_pmu_init(void) | 653 | static int __init amd_core_pmu_init(void) |
654 | { | 654 | { |
655 | if (!cpu_has_perfctr_core) | 655 | if (!boot_cpu_has(X86_FEATURE_PERFCTR_CORE)) |
656 | return 0; | 656 | return 0; |
657 | 657 | ||
658 | switch (boot_cpu_data.x86) { | 658 | switch (boot_cpu_data.x86) { |
diff --git a/arch/x86/kernel/cpu/perf_event_amd_uncore.c b/arch/x86/kernel/cpu/perf_event_amd_uncore.c index cc6cedb8f25d..49742746a6c9 100644 --- a/arch/x86/kernel/cpu/perf_event_amd_uncore.c +++ b/arch/x86/kernel/cpu/perf_event_amd_uncore.c | |||
@@ -523,10 +523,10 @@ static int __init amd_uncore_init(void) | |||
523 | if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD) | 523 | if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD) |
524 | goto fail_nodev; | 524 | goto fail_nodev; |
525 | 525 | ||
526 | if (!cpu_has_topoext) | 526 | if (!boot_cpu_has(X86_FEATURE_TOPOEXT)) |
527 | goto fail_nodev; | 527 | goto fail_nodev; |
528 | 528 | ||
529 | if (cpu_has_perfctr_nb) { | 529 | if (boot_cpu_has(X86_FEATURE_PERFCTR_NB)) { |
530 | amd_uncore_nb = alloc_percpu(struct amd_uncore *); | 530 | amd_uncore_nb = alloc_percpu(struct amd_uncore *); |
531 | if (!amd_uncore_nb) { | 531 | if (!amd_uncore_nb) { |
532 | ret = -ENOMEM; | 532 | ret = -ENOMEM; |
@@ -540,7 +540,7 @@ static int __init amd_uncore_init(void) | |||
540 | ret = 0; | 540 | ret = 0; |
541 | } | 541 | } |
542 | 542 | ||
543 | if (cpu_has_perfctr_l2) { | 543 | if (boot_cpu_has(X86_FEATURE_PERFCTR_L2)) { |
544 | amd_uncore_l2 = alloc_percpu(struct amd_uncore *); | 544 | amd_uncore_l2 = alloc_percpu(struct amd_uncore *); |
545 | if (!amd_uncore_l2) { | 545 | if (!amd_uncore_l2) { |
546 | ret = -ENOMEM; | 546 | ret = -ENOMEM; |
@@ -583,10 +583,11 @@ fail_online: | |||
583 | 583 | ||
584 | /* amd_uncore_nb/l2 should have been freed by cleanup_cpu_online */ | 584 | /* amd_uncore_nb/l2 should have been freed by cleanup_cpu_online */ |
585 | amd_uncore_nb = amd_uncore_l2 = NULL; | 585 | amd_uncore_nb = amd_uncore_l2 = NULL; |
586 | if (cpu_has_perfctr_l2) | 586 | |
587 | if (boot_cpu_has(X86_FEATURE_PERFCTR_L2)) | ||
587 | perf_pmu_unregister(&amd_l2_pmu); | 588 | perf_pmu_unregister(&amd_l2_pmu); |
588 | fail_l2: | 589 | fail_l2: |
589 | if (cpu_has_perfctr_nb) | 590 | if (boot_cpu_has(X86_FEATURE_PERFCTR_NB)) |
590 | perf_pmu_unregister(&amd_nb_pmu); | 591 | perf_pmu_unregister(&amd_nb_pmu); |
591 | if (amd_uncore_l2) | 592 | if (amd_uncore_l2) |
592 | free_percpu(amd_uncore_l2); | 593 | free_percpu(amd_uncore_l2); |
diff --git a/arch/x86/kernel/fpu/init.c b/arch/x86/kernel/fpu/init.c index be39b5fde4b9..22abea04731e 100644 --- a/arch/x86/kernel/fpu/init.c +++ b/arch/x86/kernel/fpu/init.c | |||
@@ -12,7 +12,7 @@ | |||
12 | */ | 12 | */ |
13 | static void fpu__init_cpu_ctx_switch(void) | 13 | static void fpu__init_cpu_ctx_switch(void) |
14 | { | 14 | { |
15 | if (!cpu_has_eager_fpu) | 15 | if (!boot_cpu_has(X86_FEATURE_EAGER_FPU)) |
16 | stts(); | 16 | stts(); |
17 | else | 17 | else |
18 | clts(); | 18 | clts(); |
@@ -287,7 +287,7 @@ static void __init fpu__init_system_ctx_switch(void) | |||
287 | current_thread_info()->status = 0; | 287 | current_thread_info()->status = 0; |
288 | 288 | ||
289 | /* Auto enable eagerfpu for xsaveopt */ | 289 | /* Auto enable eagerfpu for xsaveopt */ |
290 | if (cpu_has_xsaveopt && eagerfpu != DISABLE) | 290 | if (boot_cpu_has(X86_FEATURE_XSAVEOPT) && eagerfpu != DISABLE) |
291 | eagerfpu = ENABLE; | 291 | eagerfpu = ENABLE; |
292 | 292 | ||
293 | if (xfeatures_mask & XFEATURE_MASK_EAGER) { | 293 | if (xfeatures_mask & XFEATURE_MASK_EAGER) { |
diff --git a/arch/x86/kernel/hw_breakpoint.c b/arch/x86/kernel/hw_breakpoint.c index 50a3fad5b89f..2bcfb5f2bc44 100644 --- a/arch/x86/kernel/hw_breakpoint.c +++ b/arch/x86/kernel/hw_breakpoint.c | |||
@@ -300,6 +300,10 @@ static int arch_build_bp_info(struct perf_event *bp) | |||
300 | return -EINVAL; | 300 | return -EINVAL; |
301 | if (bp->attr.bp_addr & (bp->attr.bp_len - 1)) | 301 | if (bp->attr.bp_addr & (bp->attr.bp_len - 1)) |
302 | return -EINVAL; | 302 | return -EINVAL; |
303 | |||
304 | if (!boot_cpu_has(X86_FEATURE_BPEXT)) | ||
305 | return -EOPNOTSUPP; | ||
306 | |||
303 | /* | 307 | /* |
304 | * It's impossible to use a range breakpoint to fake out | 308 | * It's impossible to use a range breakpoint to fake out |
305 | * user vs kernel detection because bp_len - 1 can't | 309 | * user vs kernel detection because bp_len - 1 can't |
@@ -307,8 +311,6 @@ static int arch_build_bp_info(struct perf_event *bp) | |||
307 | * breakpoints, then we'll have to check for kprobe-blacklisted | 311 | * breakpoints, then we'll have to check for kprobe-blacklisted |
308 | * addresses anywhere in the range. | 312 | * addresses anywhere in the range. |
309 | */ | 313 | */ |
310 | if (!cpu_has_bpext) | ||
311 | return -EOPNOTSUPP; | ||
312 | info->mask = bp->attr.bp_len - 1; | 314 | info->mask = bp->attr.bp_len - 1; |
313 | info->len = X86_BREAKPOINT_LEN_1; | 315 | info->len = X86_BREAKPOINT_LEN_1; |
314 | } | 316 | } |
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index f2281e9cfdbe..24d57f77b3c1 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c | |||
@@ -304,7 +304,7 @@ do { \ | |||
304 | 304 | ||
305 | static bool match_smt(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o) | 305 | static bool match_smt(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o) |
306 | { | 306 | { |
307 | if (cpu_has_topoext) { | 307 | if (boot_cpu_has(X86_FEATURE_TOPOEXT)) { |
308 | int cpu1 = c->cpu_index, cpu2 = o->cpu_index; | 308 | int cpu1 = c->cpu_index, cpu2 = o->cpu_index; |
309 | 309 | ||
310 | if (c->phys_proc_id == o->phys_proc_id && | 310 | if (c->phys_proc_id == o->phys_proc_id && |
diff --git a/arch/x86/kernel/vm86_32.c b/arch/x86/kernel/vm86_32.c index 524619351961..483231ebbb0b 100644 --- a/arch/x86/kernel/vm86_32.c +++ b/arch/x86/kernel/vm86_32.c | |||
@@ -357,8 +357,10 @@ static long do_sys_vm86(struct vm86plus_struct __user *user_vm86, bool plus) | |||
357 | tss = &per_cpu(cpu_tss, get_cpu()); | 357 | tss = &per_cpu(cpu_tss, get_cpu()); |
358 | /* make room for real-mode segments */ | 358 | /* make room for real-mode segments */ |
359 | tsk->thread.sp0 += 16; | 359 | tsk->thread.sp0 += 16; |
360 | if (cpu_has_sep) | 360 | |
361 | if (static_cpu_has_safe(X86_FEATURE_SEP)) | ||
361 | tsk->thread.sysenter_cs = 0; | 362 | tsk->thread.sysenter_cs = 0; |
363 | |||
362 | load_sp0(tss, &tsk->thread); | 364 | load_sp0(tss, &tsk->thread); |
363 | put_cpu(); | 365 | put_cpu(); |
364 | 366 | ||
diff --git a/arch/x86/mm/setup_nx.c b/arch/x86/mm/setup_nx.c index 90555bf60aa4..92e2eacb3321 100644 --- a/arch/x86/mm/setup_nx.c +++ b/arch/x86/mm/setup_nx.c | |||
@@ -31,7 +31,7 @@ early_param("noexec", noexec_setup); | |||
31 | 31 | ||
32 | void x86_configure_nx(void) | 32 | void x86_configure_nx(void) |
33 | { | 33 | { |
34 | if (cpu_has_nx && !disable_nx) | 34 | if (boot_cpu_has(X86_FEATURE_NX) && !disable_nx) |
35 | __supported_pte_mask |= _PAGE_NX; | 35 | __supported_pte_mask |= _PAGE_NX; |
36 | else | 36 | else |
37 | __supported_pte_mask &= ~_PAGE_NX; | 37 | __supported_pte_mask &= ~_PAGE_NX; |
@@ -39,7 +39,7 @@ void x86_configure_nx(void) | |||
39 | 39 | ||
40 | void __init x86_report_nx(void) | 40 | void __init x86_report_nx(void) |
41 | { | 41 | { |
42 | if (!cpu_has_nx) { | 42 | if (!boot_cpu_has(X86_FEATURE_NX)) { |
43 | printk(KERN_NOTICE "Notice: NX (Execute Disable) protection " | 43 | printk(KERN_NOTICE "Notice: NX (Execute Disable) protection " |
44 | "missing in CPU!\n"); | 44 | "missing in CPU!\n"); |
45 | } else { | 45 | } else { |
diff --git a/drivers/char/hw_random/via-rng.c b/drivers/char/hw_random/via-rng.c index 0c98a9d51a24..44ce80606944 100644 --- a/drivers/char/hw_random/via-rng.c +++ b/drivers/char/hw_random/via-rng.c | |||
@@ -140,7 +140,7 @@ static int via_rng_init(struct hwrng *rng) | |||
140 | * RNG configuration like it used to be the case in this | 140 | * RNG configuration like it used to be the case in this |
141 | * register */ | 141 | * register */ |
142 | if ((c->x86 == 6) && (c->x86_model >= 0x0f)) { | 142 | if ((c->x86 == 6) && (c->x86_model >= 0x0f)) { |
143 | if (!cpu_has_xstore_enabled) { | 143 | if (!boot_cpu_has(X86_FEATURE_XSTORE_EN)) { |
144 | pr_err(PFX "can't enable hardware RNG " | 144 | pr_err(PFX "can't enable hardware RNG " |
145 | "if XSTORE is not enabled\n"); | 145 | "if XSTORE is not enabled\n"); |
146 | return -ENODEV; | 146 | return -ENODEV; |
@@ -200,8 +200,9 @@ static int __init mod_init(void) | |||
200 | { | 200 | { |
201 | int err; | 201 | int err; |
202 | 202 | ||
203 | if (!cpu_has_xstore) | 203 | if (!boot_cpu_has(X86_FEATURE_XSTORE)) |
204 | return -ENODEV; | 204 | return -ENODEV; |
205 | |||
205 | pr_info("VIA RNG detected\n"); | 206 | pr_info("VIA RNG detected\n"); |
206 | err = hwrng_register(&via_rng); | 207 | err = hwrng_register(&via_rng); |
207 | if (err) { | 208 | if (err) { |
diff --git a/drivers/crypto/padlock-aes.c b/drivers/crypto/padlock-aes.c index da2d6777bd09..97a364694bfc 100644 --- a/drivers/crypto/padlock-aes.c +++ b/drivers/crypto/padlock-aes.c | |||
@@ -515,7 +515,7 @@ static int __init padlock_init(void) | |||
515 | if (!x86_match_cpu(padlock_cpu_id)) | 515 | if (!x86_match_cpu(padlock_cpu_id)) |
516 | return -ENODEV; | 516 | return -ENODEV; |
517 | 517 | ||
518 | if (!cpu_has_xcrypt_enabled) { | 518 | if (!boot_cpu_has(X86_FEATURE_XCRYPT_EN)) { |
519 | printk(KERN_NOTICE PFX "VIA PadLock detected, but not enabled. Hmm, strange...\n"); | 519 | printk(KERN_NOTICE PFX "VIA PadLock detected, but not enabled. Hmm, strange...\n"); |
520 | return -ENODEV; | 520 | return -ENODEV; |
521 | } | 521 | } |
diff --git a/drivers/crypto/padlock-sha.c b/drivers/crypto/padlock-sha.c index 4e154c9b9206..8c5f90647b7a 100644 --- a/drivers/crypto/padlock-sha.c +++ b/drivers/crypto/padlock-sha.c | |||
@@ -540,7 +540,7 @@ static int __init padlock_init(void) | |||
540 | struct shash_alg *sha1; | 540 | struct shash_alg *sha1; |
541 | struct shash_alg *sha256; | 541 | struct shash_alg *sha256; |
542 | 542 | ||
543 | if (!x86_match_cpu(padlock_sha_ids) || !cpu_has_phe_enabled) | 543 | if (!x86_match_cpu(padlock_sha_ids) || !boot_cpu_has(X86_FEATURE_PHE_EN)) |
544 | return -ENODEV; | 544 | return -ENODEV; |
545 | 545 | ||
546 | /* Register the newly added algorithm module if on * | 546 | /* Register the newly added algorithm module if on * |
diff --git a/drivers/iommu/intel_irq_remapping.c b/drivers/iommu/intel_irq_remapping.c index 1fae1881648c..c12ba4516df2 100644 --- a/drivers/iommu/intel_irq_remapping.c +++ b/drivers/iommu/intel_irq_remapping.c | |||
@@ -753,7 +753,7 @@ static inline void set_irq_posting_cap(void) | |||
753 | * should have X86_FEATURE_CX16 support, this has been confirmed | 753 | * should have X86_FEATURE_CX16 support, this has been confirmed |
754 | * with Intel hardware guys. | 754 | * with Intel hardware guys. |
755 | */ | 755 | */ |
756 | if ( cpu_has_cx16 ) | 756 | if (boot_cpu_has(X86_FEATURE_CX16)) |
757 | intel_irq_remap_ops.capability |= 1 << IRQ_POSTING_CAP; | 757 | intel_irq_remap_ops.capability |= 1 << IRQ_POSTING_CAP; |
758 | 758 | ||
759 | for_each_iommu(iommu, drhd) | 759 | for_each_iommu(iommu, drhd) |
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 974be09e7556..42a378a4eefb 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -923,7 +923,7 @@ static int check_async_write(struct inode *inode, unsigned long bio_flags) | |||
923 | if (bio_flags & EXTENT_BIO_TREE_LOG) | 923 | if (bio_flags & EXTENT_BIO_TREE_LOG) |
924 | return 0; | 924 | return 0; |
925 | #ifdef CONFIG_X86 | 925 | #ifdef CONFIG_X86 |
926 | if (cpu_has_xmm4_2) | 926 | if (static_cpu_has_safe(X86_FEATURE_XMM4_2)) |
927 | return 0; | 927 | return 0; |
928 | #endif | 928 | #endif |
929 | return 1; | 929 | return 1; |