x86/cpufeature: Bye bye cpu_has_YYY
Subsystems (12)
Borislav Petkov
maintainercover x86/cpufeature: Bye bye cpu_has_YYY
From: Borislav Petkov <[email protected]>
Here are the final 10. cpu_has_YYY is gone now. Good riddance.
I have a bunch of misc cleanups on top, will send them tomorrow.
Thanks.
Borislav Petkov (10):
x86/cpufeature: Remove cpu_has_avx2
x86/cpufeature: Remove cpu_has_aes
x86/cpufeature: Remove cpu_has_avx
x86/cpufeature: Remove cpu_has_xmm
x86/cpufeature: Remove cpu_has_fpu
x86/cpufeature: Remove cpu_has_tsc
x86/cpufeature: Remove cpu_has_apic
x86/cpufeature: Remove cpu_has_fxsr
x86/cpufeature: Remove cpu_has_xsave
x86/cpufeature: Remove cpu_has_xsaves
arch/x86/crypto/aesni-intel_glue.c | 2 +- arch/x86/crypto/camellia_aesni_avx2_glue.c | 4 +++- arch/x86/crypto/camellia_aesni_avx_glue.c | 4 +++- arch/x86/crypto/chacha20_glue.c | 3 ++- arch/x86/crypto/poly1305_glue.c | 3 ++- arch/x86/crypto/serpent_avx2_glue.c | 2 +- arch/x86/crypto/sha1_ssse3_glue.c | 2 +- arch/x86/crypto/sha256_ssse3_glue.c | 2 +- arch/x86/crypto/sha512_ssse3_glue.c | 2 +- arch/x86/events/core.c | 2 +- arch/x86/ia32/ia32_signal.c | 2 +- arch/x86/include/asm/cpufeature.h | 15 --------------- arch/x86/include/asm/irq_work.h | 2 +- arch/x86/include/asm/tsc.h | 2 +- arch/x86/include/asm/xor_32.h | 2 +- arch/x86/include/asm/xor_avx.h | 4 ++-- arch/x86/kernel/acpi/boot.c | 8 ++++---- arch/x86/kernel/apic/apic.c | 30 +++++++++++++++--------------- arch/x86/kernel/apic/apic_noop.c | 4 ++-- arch/x86/kernel/apic/io_apic.c | 2 +- arch/x86/kernel/apic/ipi.c | 2 +- arch/x86/kernel/apic/vector.c | 2 +- arch/x86/kernel/cpu/amd.c | 4 ++-- arch/x86/kernel/cpu/common.c | 2 +- arch/x86/kernel/cpu/cyrix.c | 2 +- arch/x86/kernel/cpu/intel.c | 2 +- arch/x86/kernel/cpu/mcheck/mce_intel.c | 2 +- arch/x86/kernel/cpu/mcheck/therm_throt.c | 2 +- arch/x86/kernel/devicetree.c | 2 +- arch/x86/kernel/fpu/bugs.c | 2 +- arch/x86/kernel/fpu/core.c | 12 ++++++------ arch/x86/kernel/fpu/init.c | 16 ++++++++-------- arch/x86/kernel/fpu/regset.c | 21 ++++++++++++--------- arch/x86/kernel/fpu/xstate.c | 18 +++++++++--------- arch/x86/kernel/signal.c | 4 ++-- arch/x86/kernel/smpboot.c | 2 +- arch/x86/kernel/tsc.c | 12 ++++++------ arch/x86/kvm/cpuid.c | 2 +- arch/x86/kvm/vmx.c | 2 +- arch/x86/kvm/x86.c | 16 ++++++++-------- arch/x86/oprofile/nmi_int.c | 2 +- arch/x86/pci/xen.c | 2 +- drivers/cpufreq/longhaul.c | 2 +- drivers/input/joystick/analog.c | 6 +++--- drivers/iommu/irq_remapping.c | 2 +- drivers/net/hamradio/baycom_epp.c | 8 ++++---- 46 files changed, 120 insertions(+), 126 deletions(-)
Signature · 1 line
2.7.3
Borislav Petkov
maintainerPATCH 1/10 x86/cpufeature: Remove cpu_has_avx2
From: Borislav Petkov <[email protected]>
--- arch/x86/crypto/camellia_aesni_avx2_glue.c | 2 +- arch/x86/crypto/chacha20_glue.c | 2 +- arch/x86/crypto/poly1305_glue.c | 2 +- arch/x86/crypto/serpent_avx2_glue.c | 2 +- arch/x86/include/asm/cpufeature.h | 1 - 5 files changed, 4 insertions(+), 5 deletions(-)
arch/x86/crypto/camellia_aesni_avx2_glue.c +1 -1
@@ -562,7 +562,7 @@ static int __init camellia_aesni_init(void) {const char *feature_name; -if (!cpu_has_avx2 || !cpu_has_avx || !cpu_has_aes || +if (!boot_cpu_has (X86_FEATURE_AVX2 ) || !cpu_has_avx || !cpu_has_aes || !boot_cpu_has (X86_FEATURE_OSXSAVE )) {pr_info ("AVX2 or AES-NI instructions are not detected.\n" );return -ENODEV ;
arch/x86/crypto/chacha20_glue.c +1 -1
@@ -129,7 +129,7 @@ static int __init chacha20_simd_mod_init(void)return -ENODEV ;#ifdef CONFIG_AS_AVX2 - chacha20_use_avx2 = cpu_has_avx && cpu_has_avx2 && + chacha20_use_avx2 = cpu_has_avx &&boot_cpu_has (X86_FEATURE_AVX2 ) &&cpu_has_xfeatures (XFEATURE_MASK_SSE |XFEATURE_MASK_YMM ,NULL );#endif return crypto_register_alg (&alg);
arch/x86/crypto/poly1305_glue.c +1 -1
@@ -183,7 +183,7 @@ static int __init poly1305_simd_mod_init(void)return -ENODEV ;#ifdef CONFIG_AS_AVX2 - poly1305_use_avx2 = cpu_has_avx && cpu_has_avx2 && + poly1305_use_avx2 = cpu_has_avx &&boot_cpu_has (X86_FEATURE_AVX2 ) &&cpu_has_xfeatures (XFEATURE_MASK_SSE |XFEATURE_MASK_YMM ,NULL ); alg.descsize =sizeof (struct poly1305_simd_desc_ctx );if (poly1305_use_avx2)
arch/x86/crypto/serpent_avx2_glue.c +1 -1
@@ -538,7 +538,7 @@ static int __init init(void) {const char *feature_name; -if (!cpu_has_avx2 || !boot_cpu_has (X86_FEATURE_OSXSAVE )) { +if (!boot_cpu_has (X86_FEATURE_AVX2 ) || !boot_cpu_has (X86_FEATURE_OSXSAVE )) {pr_info ("AVX2 instructions are not detected.\n" );return -ENODEV ; }
arch/x86/include/asm/cpufeature.h +0 -1
@@ -125,7 +125,6 @@ extern const char * const x86_bug_flags[NBUGINTS*32];#define cpu_has_xmm boot_cpu_has(X86_FEATURE_XMM)#define cpu_has_aes boot_cpu_has(X86_FEATURE_AES)#define cpu_has_avx boot_cpu_has(X86_FEATURE_AVX) -#define cpu_has_avx2 boot_cpu_has(X86_FEATURE_AVX2)#define cpu_has_xsave boot_cpu_has(X86_FEATURE_XSAVE)#define cpu_has_xsaves boot_cpu_has(X86_FEATURE_XSAVES)/*
Signature · 1 line
2.7.3
tip-bot for Borislav Petkov
merge bot[tip:x86/asm] x86/cpufeature: Replace cpu_has_avx2 with boot_cpu_has() usage
x86/cpufeature: Replace cpu_has_avx2 with boot_cpu_has() usage
Commit-ID: abcfdfe07de75f830cbec1aa3eb17833a0166697 Gitweb: http://git.kernel.org/tip/abcfdfe07de75f830cbec1aa3eb17833a0166697 Author: Borislav Petkov <[email protected]> AuthorDate: Mon, 4 Apr 2016 22:24:54 +0200 Committer: Ingo Molnar <[email protected]> CommitDate: Wed, 13 Apr 2016 11:37:39 +0200
x86/cpufeature: Replace cpu_has_avx2 with boot_cpu_has() usage
--- arch/x86/crypto/camellia_aesni_avx2_glue.c | 2 +- arch/x86/crypto/chacha20_glue.c | 2 +- arch/x86/crypto/poly1305_glue.c | 2 +- arch/x86/crypto/serpent_avx2_glue.c | 2 +- arch/x86/include/asm/cpufeature.h | 1 - 5 files changed, 4 insertions(+), 5 deletions(-)
arch/x86/crypto/camellia_aesni_avx2_glue.c +1 -1
@@ -562,7 +562,7 @@ static int __init camellia_aesni_init(void) {const char *feature_name; -if (!cpu_has_avx2 || !cpu_has_avx || !cpu_has_aes || +if (!boot_cpu_has (X86_FEATURE_AVX2 ) || !cpu_has_avx || !cpu_has_aes || !boot_cpu_has (X86_FEATURE_OSXSAVE )) {pr_info ("AVX2 or AES-NI instructions are not detected.\n" );return -ENODEV ;
arch/x86/crypto/chacha20_glue.c +1 -1
@@ -129,7 +129,7 @@ static int __init chacha20_simd_mod_init(void)return -ENODEV ;#ifdef CONFIG_AS_AVX2 - chacha20_use_avx2 = cpu_has_avx && cpu_has_avx2 && + chacha20_use_avx2 = cpu_has_avx &&boot_cpu_has (X86_FEATURE_AVX2 ) &&cpu_has_xfeatures (XFEATURE_MASK_SSE |XFEATURE_MASK_YMM ,NULL );#endif return crypto_register_alg (&alg);
arch/x86/crypto/poly1305_glue.c +1 -1
@@ -183,7 +183,7 @@ static int __init poly1305_simd_mod_init(void)return -ENODEV ;#ifdef CONFIG_AS_AVX2 - poly1305_use_avx2 = cpu_has_avx && cpu_has_avx2 && + poly1305_use_avx2 = cpu_has_avx &&boot_cpu_has (X86_FEATURE_AVX2 ) &&cpu_has_xfeatures (XFEATURE_MASK_SSE |XFEATURE_MASK_YMM ,NULL ); alg.descsize =sizeof (struct poly1305_simd_desc_ctx );if (poly1305_use_avx2)
arch/x86/crypto/serpent_avx2_glue.c +1 -1
@@ -538,7 +538,7 @@ static int __init init(void) {const char *feature_name; -if (!cpu_has_avx2 || !boot_cpu_has (X86_FEATURE_OSXSAVE )) { +if (!boot_cpu_has (X86_FEATURE_AVX2 ) || !boot_cpu_has (X86_FEATURE_OSXSAVE )) {pr_info ("AVX2 instructions are not detected.\n" );return -ENODEV ; }
arch/x86/include/asm/cpufeature.h +0 -1
@@ -125,7 +125,6 @@ extern const char * const x86_bug_flags[NBUGINTS*32];#define cpu_has_xmm boot_cpu_has(X86_FEATURE_XMM)#define cpu_has_aes boot_cpu_has(X86_FEATURE_AES)#define cpu_has_avx boot_cpu_has(X86_FEATURE_AVX) -#define cpu_has_avx2 boot_cpu_has(X86_FEATURE_AVX2)#define cpu_has_xsave boot_cpu_has(X86_FEATURE_XSAVE)#define cpu_has_xsaves boot_cpu_has(X86_FEATURE_XSAVES)/*
Borislav Petkov
maintainerPATCH 2/10 x86/cpufeature: Remove cpu_has_aes
In reply to Borislav PetkovFrom: Borislav Petkov <[email protected]>
--- arch/x86/crypto/camellia_aesni_avx2_glue.c | 3 ++- arch/x86/crypto/camellia_aesni_avx_glue.c | 4 +++- arch/x86/include/asm/cpufeature.h | 1 - 3 files changed, 5 insertions(+), 3 deletions(-)
arch/x86/crypto/camellia_aesni_avx2_glue.c +2 -1
@@ -562,7 +562,8 @@ static int __init camellia_aesni_init(void) {const char *feature_name; -if (!boot_cpu_has (X86_FEATURE_AVX2 ) || !cpu_has_avx || !cpu_has_aes || +if (!boot_cpu_has (X86_FEATURE_AVX2 ) || !cpu_has_avx || + !boot_cpu_has (X86_FEATURE_AES ) || !boot_cpu_has (X86_FEATURE_OSXSAVE )) {pr_info ("AVX2 or AES-NI instructions are not detected.\n" );return -ENODEV ;
arch/x86/crypto/camellia_aesni_avx_glue.c +3 -1
@@ -554,7 +554,9 @@ static int __init camellia_aesni_init(void) {const char *feature_name; -if (!cpu_has_avx || !cpu_has_aes || !boot_cpu_has (X86_FEATURE_OSXSAVE )) { +if (!cpu_has_avx || + !boot_cpu_has (X86_FEATURE_AES ) || + !boot_cpu_has (X86_FEATURE_OSXSAVE )) {pr_info ("AVX or AES-NI instructions are not detected.\n" );return -ENODEV ; }
arch/x86/include/asm/cpufeature.h +0 -1
@@ -123,7 +123,6 @@ extern const char * const x86_bug_flags[NBUGINTS*32];#define cpu_has_apic boot_cpu_has(X86_FEATURE_APIC)#define cpu_has_fxsr boot_cpu_has(X86_FEATURE_FXSR)#define cpu_has_xmm boot_cpu_has(X86_FEATURE_XMM) -#define cpu_has_aes boot_cpu_has(X86_FEATURE_AES)#define cpu_has_avx boot_cpu_has(X86_FEATURE_AVX)#define cpu_has_xsave boot_cpu_has(X86_FEATURE_XSAVE)#define cpu_has_xsaves boot_cpu_has(X86_FEATURE_XSAVES)
Signature · 1 line
2.7.3
tip-bot for Borislav Petkov
merge bot[tip:x86/asm] x86/cpufeature: Replace cpu_has_aes with boot_cpu_has() usage
x86/cpufeature: Replace cpu_has_aes with boot_cpu_has() usage
Commit-ID: 1f4dd7938ea575a2d1972e180eaef31e6edb1808 Gitweb: http://git.kernel.org/tip/1f4dd7938ea575a2d1972e180eaef31e6edb1808 Author: Borislav Petkov <[email protected]> AuthorDate: Mon, 4 Apr 2016 22:24:55 +0200 Committer: Ingo Molnar <[email protected]> CommitDate: Wed, 13 Apr 2016 11:37:39 +0200
x86/cpufeature: Replace cpu_has_aes with boot_cpu_has() usage
--- arch/x86/crypto/camellia_aesni_avx2_glue.c | 3 ++- arch/x86/crypto/camellia_aesni_avx_glue.c | 4 +++- arch/x86/include/asm/cpufeature.h | 1 - 3 files changed, 5 insertions(+), 3 deletions(-)
arch/x86/crypto/camellia_aesni_avx2_glue.c +2 -1
@@ -562,7 +562,8 @@ static int __init camellia_aesni_init(void) {const char *feature_name; -if (!boot_cpu_has (X86_FEATURE_AVX2 ) || !cpu_has_avx || !cpu_has_aes || +if (!boot_cpu_has (X86_FEATURE_AVX2 ) || !cpu_has_avx || + !boot_cpu_has (X86_FEATURE_AES ) || !boot_cpu_has (X86_FEATURE_OSXSAVE )) {pr_info ("AVX2 or AES-NI instructions are not detected.\n" );return -ENODEV ;
arch/x86/crypto/camellia_aesni_avx_glue.c +3 -1
@@ -554,7 +554,9 @@ static int __init camellia_aesni_init(void) {const char *feature_name; -if (!cpu_has_avx || !cpu_has_aes || !boot_cpu_has (X86_FEATURE_OSXSAVE )) { +if (!cpu_has_avx || + !boot_cpu_has (X86_FEATURE_AES ) || + !boot_cpu_has (X86_FEATURE_OSXSAVE )) {pr_info ("AVX or AES-NI instructions are not detected.\n" );return -ENODEV ; }
arch/x86/include/asm/cpufeature.h +0 -1
@@ -123,7 +123,6 @@ extern const char * const x86_bug_flags[NBUGINTS*32];#define cpu_has_apic boot_cpu_has(X86_FEATURE_APIC)#define cpu_has_fxsr boot_cpu_has(X86_FEATURE_FXSR)#define cpu_has_xmm boot_cpu_has(X86_FEATURE_XMM) -#define cpu_has_aes boot_cpu_has(X86_FEATURE_AES)#define cpu_has_avx boot_cpu_has(X86_FEATURE_AVX)#define cpu_has_xsave boot_cpu_has(X86_FEATURE_XSAVE)#define cpu_has_xsaves boot_cpu_has(X86_FEATURE_XSAVES)
Borislav Petkov
maintainerPATCH 3/10 x86/cpufeature: Remove cpu_has_avx
In reply to Borislav PetkovFrom: Borislav Petkov <[email protected]>
--- arch/x86/crypto/aesni-intel_glue.c | 2 +- arch/x86/crypto/camellia_aesni_avx2_glue.c | 3 ++- arch/x86/crypto/camellia_aesni_avx_glue.c | 2 +- arch/x86/crypto/chacha20_glue.c | 3 ++- arch/x86/crypto/poly1305_glue.c | 3 ++- arch/x86/crypto/sha1_ssse3_glue.c | 2 +- arch/x86/crypto/sha256_ssse3_glue.c | 2 +- arch/x86/crypto/sha512_ssse3_glue.c | 2 +- arch/x86/include/asm/cpufeature.h | 1 - arch/x86/include/asm/xor_avx.h | 4 ++-- 10 files changed, 13 insertions(+), 11 deletions(-)
arch/x86/crypto/aesni-intel_glue.c +1 -1
@@ -1477,7 +1477,7 @@ static int __init aesni_init(void) } aesni_ctr_enc_tfm = aesni_ctr_enc;#ifdef CONFIG_AS_AVX -if (cpu_has_avx) { +if (boot_cpu_has (X86_FEATURE_AVX )) {/* optimize performance of ctr mode encryption transform */ aesni_ctr_enc_tfm = aesni_ctr_enc_avx_tfm;pr_info ("AES CTR mode by8 optimization enabled\n" );
arch/x86/crypto/camellia_aesni_avx2_glue.c +2 -1
@@ -562,7 +562,8 @@ static int __init camellia_aesni_init(void) {const char *feature_name; -if (!boot_cpu_has (X86_FEATURE_AVX2 ) || !cpu_has_avx || +if (!boot_cpu_has (X86_FEATURE_AVX ) || + !boot_cpu_has (X86_FEATURE_AVX2 ) || !boot_cpu_has (X86_FEATURE_AES ) || !boot_cpu_has (X86_FEATURE_OSXSAVE )) {pr_info ("AVX2 or AES-NI instructions are not detected.\n" );
arch/x86/crypto/camellia_aesni_avx_glue.c +1 -1
@@ -554,7 +554,7 @@ static int __init camellia_aesni_init(void) {const char *feature_name; -if (!cpu_has_avx || +if (!boot_cpu_has (X86_FEATURE_AVX ) || !boot_cpu_has (X86_FEATURE_AES ) || !boot_cpu_has (X86_FEATURE_OSXSAVE )) {pr_info ("AVX or AES-NI instructions are not detected.\n" );
arch/x86/crypto/chacha20_glue.c +2 -1
@@ -129,7 +129,8 @@ static int __init chacha20_simd_mod_init(void)return -ENODEV ;#ifdef CONFIG_AS_AVX2 - chacha20_use_avx2 = cpu_has_avx &&boot_cpu_has (X86_FEATURE_AVX2 ) && + chacha20_use_avx2 =boot_cpu_has (X86_FEATURE_AVX ) && +boot_cpu_has (X86_FEATURE_AVX2 ) &&cpu_has_xfeatures (XFEATURE_MASK_SSE |XFEATURE_MASK_YMM ,NULL );#endif return crypto_register_alg (&alg);
arch/x86/crypto/poly1305_glue.c +2 -1
@@ -183,7 +183,8 @@ static int __init poly1305_simd_mod_init(void)return -ENODEV ;#ifdef CONFIG_AS_AVX2 - poly1305_use_avx2 = cpu_has_avx &&boot_cpu_has (X86_FEATURE_AVX2 ) && + poly1305_use_avx2 =boot_cpu_has (X86_FEATURE_AVX ) && +boot_cpu_has (X86_FEATURE_AVX2 ) &&cpu_has_xfeatures (XFEATURE_MASK_SSE |XFEATURE_MASK_YMM ,NULL ); alg.descsize =sizeof (struct poly1305_simd_desc_ctx );if (poly1305_use_avx2)
arch/x86/crypto/sha1_ssse3_glue.c +1 -1
@@ -166,7 +166,7 @@ static struct shash_alg sha1_avx_alg = {static bool avx_usable (void ) {if (!cpu_has_xfeatures (XFEATURE_MASK_SSE |XFEATURE_MASK_YMM ,NULL )) { -if (cpu_has_avx) +if (boot_cpu_has (X86_FEATURE_AVX ))pr_info ("AVX detected but unusable.\n" );return false; }
arch/x86/crypto/sha256_ssse3_glue.c +1 -1
@@ -201,7 +201,7 @@ static struct shash_alg sha256_avx_algs[] = { {static bool avx_usable (void ) {if (!cpu_has_xfeatures (XFEATURE_MASK_SSE |XFEATURE_MASK_YMM ,NULL )) { -if (cpu_has_avx) +if (boot_cpu_has (X86_FEATURE_AVX ))pr_info ("AVX detected but unusable.\n" );return false; }
arch/x86/crypto/sha512_ssse3_glue.c +1 -1
@@ -151,7 +151,7 @@ asmlinkage void sha512_transform_avx(u64 *digest, const char *data,static bool avx_usable (void ) {if (!cpu_has_xfeatures (XFEATURE_MASK_SSE |XFEATURE_MASK_YMM ,NULL )) { -if (cpu_has_avx) +if (boot_cpu_has (X86_FEATURE_AVX ))pr_info ("AVX detected but unusable.\n" );return false; }
arch/x86/include/asm/cpufeature.h +0 -1
@@ -123,7 +123,6 @@ extern const char * const x86_bug_flags[NBUGINTS*32];#define cpu_has_apic boot_cpu_has(X86_FEATURE_APIC)#define cpu_has_fxsr boot_cpu_has(X86_FEATURE_FXSR)#define cpu_has_xmm boot_cpu_has(X86_FEATURE_XMM) -#define cpu_has_avx boot_cpu_has(X86_FEATURE_AVX)#define cpu_has_xsave boot_cpu_has(X86_FEATURE_XSAVE)#define cpu_has_xsaves boot_cpu_has(X86_FEATURE_XSAVES)/*
arch/x86/include/asm/xor_avx.h +2 -2
@@ -167,12 +167,12 @@ static struct xor_block_template xor_block_avx = {#define AVX_XOR_SPEED \ do { \ - if (cpu_has_avx && boot_cpu_has(X86_FEATURE_OSXSAVE)) \ + if (boot_cpu_has(X86_FEATURE_AVX) && boot_cpu_has(X86_FEATURE_OSXSAVE)) \ xor_speed(&xor_block_avx); \ } while (0)#define AVX_SELECT (FASTEST ) \ - (cpu_has_avx && boot_cpu_has(X86_FEATURE_OSXSAVE) ? &xor_block_avx : FASTEST) + (boot_cpu_has(X86_FEATURE_AVX) && boot_cpu_has(X86_FEATURE_OSXSAVE) ? &xor_block_avx : FASTEST)#else
Signature · 1 line
2.7.3
tip-bot for Borislav Petkov
merge bot[tip:x86/asm] x86/cpufeature: Replace cpu_has_avx with boot_cpu_has() usage
x86/cpufeature: Replace cpu_has_avx with boot_cpu_has() usage
Commit-ID: da154e82af4d0c63e2334d5b3822426600b0490f Gitweb: http://git.kernel.org/tip/da154e82af4d0c63e2334d5b3822426600b0490f Author: Borislav Petkov <[email protected]> AuthorDate: Mon, 4 Apr 2016 22:24:56 +0200 Committer: Ingo Molnar <[email protected]> CommitDate: Wed, 13 Apr 2016 11:37:40 +0200
x86/cpufeature: Replace cpu_has_avx with boot_cpu_has() usage
--- arch/x86/crypto/aesni-intel_glue.c | 2 +- arch/x86/crypto/camellia_aesni_avx2_glue.c | 3 ++- arch/x86/crypto/camellia_aesni_avx_glue.c | 2 +- arch/x86/crypto/chacha20_glue.c | 3 ++- arch/x86/crypto/poly1305_glue.c | 3 ++- arch/x86/crypto/sha1_ssse3_glue.c | 2 +- arch/x86/crypto/sha256_ssse3_glue.c | 2 +- arch/x86/crypto/sha512_ssse3_glue.c | 2 +- arch/x86/include/asm/cpufeature.h | 1 - arch/x86/include/asm/xor_avx.h | 4 ++-- 10 files changed, 13 insertions(+), 11 deletions(-)
arch/x86/crypto/aesni-intel_glue.c +1 -1
@@ -1477,7 +1477,7 @@ static int __init aesni_init(void) } aesni_ctr_enc_tfm = aesni_ctr_enc;#ifdef CONFIG_AS_AVX -if (cpu_has_avx) { +if (boot_cpu_has (X86_FEATURE_AVX )) {/* optimize performance of ctr mode encryption transform */ aesni_ctr_enc_tfm = aesni_ctr_enc_avx_tfm;pr_info ("AES CTR mode by8 optimization enabled\n" );
arch/x86/crypto/camellia_aesni_avx2_glue.c +2 -1
@@ -562,7 +562,8 @@ static int __init camellia_aesni_init(void) {const char *feature_name; -if (!boot_cpu_has (X86_FEATURE_AVX2 ) || !cpu_has_avx || +if (!boot_cpu_has (X86_FEATURE_AVX ) || + !boot_cpu_has (X86_FEATURE_AVX2 ) || !boot_cpu_has (X86_FEATURE_AES ) || !boot_cpu_has (X86_FEATURE_OSXSAVE )) {pr_info ("AVX2 or AES-NI instructions are not detected.\n" );
arch/x86/crypto/camellia_aesni_avx_glue.c +1 -1
@@ -554,7 +554,7 @@ static int __init camellia_aesni_init(void) {const char *feature_name; -if (!cpu_has_avx || +if (!boot_cpu_has (X86_FEATURE_AVX ) || !boot_cpu_has (X86_FEATURE_AES ) || !boot_cpu_has (X86_FEATURE_OSXSAVE )) {pr_info ("AVX or AES-NI instructions are not detected.\n" );
arch/x86/crypto/chacha20_glue.c +2 -1
@@ -129,7 +129,8 @@ static int __init chacha20_simd_mod_init(void)return -ENODEV ;#ifdef CONFIG_AS_AVX2 - chacha20_use_avx2 = cpu_has_avx &&boot_cpu_has (X86_FEATURE_AVX2 ) && + chacha20_use_avx2 =boot_cpu_has (X86_FEATURE_AVX ) && +boot_cpu_has (X86_FEATURE_AVX2 ) &&cpu_has_xfeatures (XFEATURE_MASK_SSE |XFEATURE_MASK_YMM ,NULL );#endif return crypto_register_alg (&alg);
arch/x86/crypto/poly1305_glue.c +2 -1
@@ -183,7 +183,8 @@ static int __init poly1305_simd_mod_init(void)return -ENODEV ;#ifdef CONFIG_AS_AVX2 - poly1305_use_avx2 = cpu_has_avx &&boot_cpu_has (X86_FEATURE_AVX2 ) && + poly1305_use_avx2 =boot_cpu_has (X86_FEATURE_AVX ) && +boot_cpu_has (X86_FEATURE_AVX2 ) &&cpu_has_xfeatures (XFEATURE_MASK_SSE |XFEATURE_MASK_YMM ,NULL ); alg.descsize =sizeof (struct poly1305_simd_desc_ctx );if (poly1305_use_avx2)
arch/x86/crypto/sha1_ssse3_glue.c +1 -1
@@ -166,7 +166,7 @@ static struct shash_alg sha1_avx_alg = {static bool avx_usable (void ) {if (!cpu_has_xfeatures (XFEATURE_MASK_SSE |XFEATURE_MASK_YMM ,NULL )) { -if (cpu_has_avx) +if (boot_cpu_has (X86_FEATURE_AVX ))pr_info ("AVX detected but unusable.\n" );return false; }
arch/x86/crypto/sha256_ssse3_glue.c +1 -1
@@ -201,7 +201,7 @@ static struct shash_alg sha256_avx_algs[] = { {static bool avx_usable (void ) {if (!cpu_has_xfeatures (XFEATURE_MASK_SSE |XFEATURE_MASK_YMM ,NULL )) { -if (cpu_has_avx) +if (boot_cpu_has (X86_FEATURE_AVX ))pr_info ("AVX detected but unusable.\n" );return false; }
arch/x86/crypto/sha512_ssse3_glue.c +1 -1
@@ -151,7 +151,7 @@ asmlinkage void sha512_transform_avx(u64 *digest, const char *data,static bool avx_usable (void ) {if (!cpu_has_xfeatures (XFEATURE_MASK_SSE |XFEATURE_MASK_YMM ,NULL )) { -if (cpu_has_avx) +if (boot_cpu_has (X86_FEATURE_AVX ))pr_info ("AVX detected but unusable.\n" );return false; }
arch/x86/include/asm/cpufeature.h +0 -1
@@ -123,7 +123,6 @@ extern const char * const x86_bug_flags[NBUGINTS*32];#define cpu_has_apic boot_cpu_has(X86_FEATURE_APIC)#define cpu_has_fxsr boot_cpu_has(X86_FEATURE_FXSR)#define cpu_has_xmm boot_cpu_has(X86_FEATURE_XMM) -#define cpu_has_avx boot_cpu_has(X86_FEATURE_AVX)#define cpu_has_xsave boot_cpu_has(X86_FEATURE_XSAVE)#define cpu_has_xsaves boot_cpu_has(X86_FEATURE_XSAVES)/*
arch/x86/include/asm/xor_avx.h +2 -2
@@ -167,12 +167,12 @@ static struct xor_block_template xor_block_avx = {#define AVX_XOR_SPEED \ do { \ - if (cpu_has_avx && boot_cpu_has(X86_FEATURE_OSXSAVE)) \ + if (boot_cpu_has(X86_FEATURE_AVX) && boot_cpu_has(X86_FEATURE_OSXSAVE)) \ xor_speed(&xor_block_avx); \ } while (0)#define AVX_SELECT (FASTEST ) \ - (cpu_has_avx && boot_cpu_has(X86_FEATURE_OSXSAVE) ? &xor_block_avx : FASTEST) + (boot_cpu_has(X86_FEATURE_AVX) && boot_cpu_has(X86_FEATURE_OSXSAVE) ? &xor_block_avx : FASTEST)#else
Borislav Petkov
maintainerPATCH 4/10 x86/cpufeature: Remove cpu_has_xmm
In reply to Borislav PetkovFrom: Borislav Petkov <[email protected]>
--- arch/x86/include/asm/cpufeature.h | 1 - arch/x86/include/asm/xor_32.h | 2 +- arch/x86/kernel/fpu/core.c | 2 +- arch/x86/kernel/fpu/init.c | 2 +- 4 files changed, 3 insertions(+), 4 deletions(-)
arch/x86/include/asm/cpufeature.h +0 -1
@@ -122,7 +122,6 @@ extern const char * const x86_bug_flags[NBUGINTS*32];#define cpu_has_tsc boot_cpu_has(X86_FEATURE_TSC)#define cpu_has_apic boot_cpu_has(X86_FEATURE_APIC)#define cpu_has_fxsr boot_cpu_has(X86_FEATURE_FXSR) -#define cpu_has_xmm boot_cpu_has(X86_FEATURE_XMM)#define cpu_has_xsave boot_cpu_has(X86_FEATURE_XSAVE)#define cpu_has_xsaves boot_cpu_has(X86_FEATURE_XSAVES)/*
arch/x86/include/asm/xor_32.h +1 -1
@@ -550,7 +550,7 @@ static struct xor_block_template xor_block_pIII_sse = {#define XOR_TRY_TEMPLATES \ do { \ AVX_XOR_SPEED; \ - if (cpu_has_xmm) { \ + if (boot_cpu_has(X86_FEATURE_XMM)) { \ xor_speed(&xor_block_pIII_sse); \ xor_speed(&xor_block_sse_pf64); \ } else if (boot_cpu_has(X86_FEATURE_MMX)) { \
arch/x86/kernel/fpu/core.c +1 -1
@@ -526,7 +526,7 @@ static inline unsigned short get_fpu_swd(struct fpu *fpu)static inline unsigned short get_fpu_mxcsr (struct fpu *fpu) { -if (cpu_has_xmm) { +if (boot_cpu_has (X86_FEATURE_XMM )) {return fpu->state.fxsave.mxcsr; }else {return MXCSR_DEFAULT ;
arch/x86/kernel/fpu/init.c +1 -1
@@ -31,7 +31,7 @@ static void fpu__init_cpu_generic(void)if (cpu_has_fxsr) cr4_mask |=X86_CR4_OSFXSR ; -if (cpu_has_xmm) +if (boot_cpu_has (X86_FEATURE_XMM )) cr4_mask |=X86_CR4_OSXMMEXCPT ;if (cr4_mask)cr4_set_bits (cr4_mask);
Signature · 1 line
2.7.3
tip-bot for Borislav Petkov
merge bot[tip:x86/asm] x86/cpufeature: Replace cpu_has_xmm with boot_cpu_has() usage
x86/cpufeature: Replace cpu_has_xmm with boot_cpu_has() usage
Commit-ID: dda9edf7c1fdc0d7a7ed7f46299a26282190fb6d Gitweb: http://git.kernel.org/tip/dda9edf7c1fdc0d7a7ed7f46299a26282190fb6d Author: Borislav Petkov <[email protected]> AuthorDate: Mon, 4 Apr 2016 22:24:57 +0200 Committer: Ingo Molnar <[email protected]> CommitDate: Wed, 13 Apr 2016 11:37:40 +0200
x86/cpufeature: Replace cpu_has_xmm with boot_cpu_has() usage
--- arch/x86/include/asm/cpufeature.h | 1 - arch/x86/include/asm/xor_32.h | 2 +- arch/x86/kernel/fpu/core.c | 2 +- arch/x86/kernel/fpu/init.c | 2 +- 4 files changed, 3 insertions(+), 4 deletions(-)
arch/x86/include/asm/cpufeature.h +0 -1
@@ -122,7 +122,6 @@ extern const char * const x86_bug_flags[NBUGINTS*32];#define cpu_has_tsc boot_cpu_has(X86_FEATURE_TSC)#define cpu_has_apic boot_cpu_has(X86_FEATURE_APIC)#define cpu_has_fxsr boot_cpu_has(X86_FEATURE_FXSR) -#define cpu_has_xmm boot_cpu_has(X86_FEATURE_XMM)#define cpu_has_xsave boot_cpu_has(X86_FEATURE_XSAVE)#define cpu_has_xsaves boot_cpu_has(X86_FEATURE_XSAVES)/*
arch/x86/include/asm/xor_32.h +1 -1
@@ -550,7 +550,7 @@ static struct xor_block_template xor_block_pIII_sse = {#define XOR_TRY_TEMPLATES \ do { \ AVX_XOR_SPEED; \ - if (cpu_has_xmm) { \ + if (boot_cpu_has(X86_FEATURE_XMM)) { \ xor_speed(&xor_block_pIII_sse); \ xor_speed(&xor_block_sse_pf64); \ } else if (boot_cpu_has(X86_FEATURE_MMX)) { \
arch/x86/kernel/fpu/core.c +1 -1
@@ -526,7 +526,7 @@ static inline unsigned short get_fpu_swd(struct fpu *fpu)static inline unsigned short get_fpu_mxcsr (struct fpu *fpu) { -if (cpu_has_xmm) { +if (boot_cpu_has (X86_FEATURE_XMM )) {return fpu->state.fxsave.mxcsr; }else {return MXCSR_DEFAULT ;
arch/x86/kernel/fpu/init.c +1 -1
@@ -31,7 +31,7 @@ static void fpu__init_cpu_generic(void)if (cpu_has_fxsr) cr4_mask |=X86_CR4_OSFXSR ; -if (cpu_has_xmm) +if (boot_cpu_has (X86_FEATURE_XMM )) cr4_mask |=X86_CR4_OSXMMEXCPT ;if (cr4_mask)cr4_set_bits (cr4_mask);
Borislav Petkov
maintainerPATCH 5/10 x86/cpufeature: Remove cpu_has_fpu
In reply to Borislav PetkovFrom: Borislav Petkov <[email protected]>
Use static_cpu_has() in the timing-sensitive paths in fpstate_init() and fpu__copy().
While at it, simplify the use in init_cyrix() and get rid of the ternary operator.
--- arch/x86/include/asm/cpufeature.h | 1 - arch/x86/kernel/cpu/cyrix.c | 2 +- arch/x86/kernel/fpu/bugs.c | 2 +- arch/x86/kernel/fpu/core.c | 4 ++-- arch/x86/kernel/fpu/init.c | 8 ++++---- 5 files changed, 8 insertions(+), 9 deletions(-)
arch/x86/include/asm/cpufeature.h +0 -1
@@ -118,7 +118,6 @@ extern const char * const x86_bug_flags[NBUGINTS*32];set_bit (bit, (unsigned long *)cpu_caps_set); \ } while (0) -#define cpu_has_fpu boot_cpu_has(X86_FEATURE_FPU)#define cpu_has_tsc boot_cpu_has(X86_FEATURE_TSC)#define cpu_has_apic boot_cpu_has(X86_FEATURE_APIC)#define cpu_has_fxsr boot_cpu_has(X86_FEATURE_FXSR)
arch/x86/kernel/cpu/cyrix.c +1 -1
@@ -333,7 +333,7 @@ static void init_cyrix(struct cpuinfo_x86 *c)switch (dir0_lsn) {case 0xd :/* either a 486SLC or DLC w/o DEVID */ dir0_msn =0 ; - p = Cx486_name[(cpu_has_fpu ?1 :0 )]; + p = Cx486_name[!!boot_cpu_has (X86_FEATURE_FPU )];break ;case 0xe :/* a 486S A step */
arch/x86/kernel/fpu/bugs.c +1 -1
@@ -66,6 +66,6 @@ void __init fpu__init_check_bugs(void)* kernel_fpu_begin/end() in check_fpu() relies on the patched * alternative instructions. */ -if (cpu_has_fpu) +if (boot_cpu_has (X86_FEATURE_FPU ))check_fpu (); }
arch/x86/kernel/fpu/core.c +2 -2
@@ -217,7 +217,7 @@ static inline void fpstate_init_fstate(struct fregs_state *fp)void fpstate_init (union fpregs_state *state) { -if (!cpu_has_fpu) { +if (!static_cpu_has (X86_FEATURE_FPU )) {fpstate_init_soft (&state->soft);return ; }
@@ -237,7 +237,7 @@ int fpu__copy(struct fpu *dst_fpu, struct fpu *src_fpu) dst_fpu->fpregs_active =0 ; dst_fpu->last_cpu =-1 ; -if (!src_fpu->fpstate_active || !cpu_has_fpu) +if (!src_fpu->fpstate_active || !static_cpu_has (X86_FEATURE_FPU ))return 0 ;WARN_ON_FPU (src_fpu != ¤t->thread.fpu);
arch/x86/kernel/fpu/init.c +4 -4
@@ -38,13 +38,13 @@ static void fpu__init_cpu_generic(void) cr0 =read_cr0 (); cr0 &= ~(X86_CR0_TS |X86_CR0_EM );/* clear TS and EM */ -if (!cpu_has_fpu) +if (!boot_cpu_has (X86_FEATURE_FPU )) cr0 |=X86_CR0_EM ;write_cr0 (cr0);/* Flush out any pending x87 state: */ #ifdef CONFIG_MATH_EMULATION -if (!cpu_has_fpu) +if (!boot_cpu_has (X86_FEATURE_FPU ))fpstate_init_soft (¤t->thread.fpu.state.soft); else#endif
@@ -89,7 +89,7 @@ static void fpu__init_system_early_generic(struct cpuinfo_x86 *c) }#ifndef CONFIG_MATH_EMULATION -if (!cpu_has_fpu) { +if (!boot_cpu_has (X86_FEATURE_FPU )) {pr_emerg ("x86/fpu: Giving up, no FPU found and no math emulation present\n" );for (;;) asmvolatile ("hlt" );
@@ -212,7 +212,7 @@ static void __init fpu__init_system_xstate_size_legacy(void)* fpu__init_system_xstate(). */ -if (!cpu_has_fpu) { +if (!boot_cpu_has (X86_FEATURE_FPU )) {/* * Disable xsave as we do not support it if i387 * emulation is enabled.
Signature · 1 line
2.7.3
tip-bot for Borislav Petkov
merge bot[tip:x86/asm] x86/cpufeature: Replace cpu_has_fpu with boot_cpu_has() usage
x86/cpufeature: Replace cpu_has_fpu with boot_cpu_has() usage
Commit-ID: a402a8dffc9f838b413c5ee0317d2d3184968f5b Gitweb: http://git.kernel.org/tip/a402a8dffc9f838b413c5ee0317d2d3184968f5b Author: Borislav Petkov <[email protected]> AuthorDate: Mon, 4 Apr 2016 22:24:58 +0200 Committer: Ingo Molnar <[email protected]> CommitDate: Wed, 13 Apr 2016 11:37:40 +0200
x86/cpufeature: Replace cpu_has_fpu with boot_cpu_has() usage
Use static_cpu_has() in the timing-sensitive paths in fpstate_init() and fpu__copy().
While at it, simplify the use in init_cyrix() and get rid of the ternary operator.
--- arch/x86/include/asm/cpufeature.h | 1 - arch/x86/kernel/cpu/cyrix.c | 2 +- arch/x86/kernel/fpu/bugs.c | 2 +- arch/x86/kernel/fpu/core.c | 4 ++-- arch/x86/kernel/fpu/init.c | 8 ++++---- 5 files changed, 8 insertions(+), 9 deletions(-)
arch/x86/include/asm/cpufeature.h +0 -1
@@ -118,7 +118,6 @@ extern const char * const x86_bug_flags[NBUGINTS*32];set_bit (bit, (unsigned long *)cpu_caps_set); \ } while (0) -#define cpu_has_fpu boot_cpu_has(X86_FEATURE_FPU)#define cpu_has_tsc boot_cpu_has(X86_FEATURE_TSC)#define cpu_has_apic boot_cpu_has(X86_FEATURE_APIC)#define cpu_has_fxsr boot_cpu_has(X86_FEATURE_FXSR)
arch/x86/kernel/cpu/cyrix.c +1 -1
@@ -333,7 +333,7 @@ static void init_cyrix(struct cpuinfo_x86 *c)switch (dir0_lsn) {case 0xd :/* either a 486SLC or DLC w/o DEVID */ dir0_msn =0 ; - p = Cx486_name[(cpu_has_fpu ?1 :0 )]; + p = Cx486_name[!!boot_cpu_has (X86_FEATURE_FPU )];break ;case 0xe :/* a 486S A step */
arch/x86/kernel/fpu/bugs.c +1 -1
@@ -66,6 +66,6 @@ void __init fpu__init_check_bugs(void)* kernel_fpu_begin/end() in check_fpu() relies on the patched * alternative instructions. */ -if (cpu_has_fpu) +if (boot_cpu_has (X86_FEATURE_FPU ))check_fpu (); }
arch/x86/kernel/fpu/core.c +2 -2
@@ -217,7 +217,7 @@ static inline void fpstate_init_fstate(struct fregs_state *fp)void fpstate_init (union fpregs_state *state) { -if (!cpu_has_fpu) { +if (!static_cpu_has (X86_FEATURE_FPU )) {fpstate_init_soft (&state->soft);return ; }
@@ -237,7 +237,7 @@ int fpu__copy(struct fpu *dst_fpu, struct fpu *src_fpu) dst_fpu->fpregs_active =0 ; dst_fpu->last_cpu =-1 ; -if (!src_fpu->fpstate_active || !cpu_has_fpu) +if (!src_fpu->fpstate_active || !static_cpu_has (X86_FEATURE_FPU ))return 0 ;WARN_ON_FPU (src_fpu != ¤t->thread.fpu);
arch/x86/kernel/fpu/init.c +4 -4
@@ -38,13 +38,13 @@ static void fpu__init_cpu_generic(void) cr0 =read_cr0 (); cr0 &= ~(X86_CR0_TS |X86_CR0_EM );/* clear TS and EM */ -if (!cpu_has_fpu) +if (!boot_cpu_has (X86_FEATURE_FPU )) cr0 |=X86_CR0_EM ;write_cr0 (cr0);/* Flush out any pending x87 state: */ #ifdef CONFIG_MATH_EMULATION -if (!cpu_has_fpu) +if (!boot_cpu_has (X86_FEATURE_FPU ))fpstate_init_soft (¤t->thread.fpu.state.soft); else#endif
@@ -89,7 +89,7 @@ static void fpu__init_system_early_generic(struct cpuinfo_x86 *c) }#ifndef CONFIG_MATH_EMULATION -if (!cpu_has_fpu) { +if (!boot_cpu_has (X86_FEATURE_FPU )) {pr_emerg ("x86/fpu: Giving up, no FPU found and no math emulation present\n" );for (;;) asmvolatile ("hlt" );
@@ -212,7 +212,7 @@ static void __init fpu__init_system_xstate_size_legacy(void)* fpu__init_system_xstate(). */ -if (!cpu_has_fpu) { +if (!boot_cpu_has (X86_FEATURE_FPU )) {/* * Disable xsave as we do not support it if i387 * emulation is enabled.
Borislav Petkov
maintainerPATCH 6/10 x86/cpufeature: Remove cpu_has_tsc
In reply to Borislav PetkovFrom: Borislav Petkov <[email protected]>
--- arch/x86/include/asm/cpufeature.h | 1 - arch/x86/include/asm/tsc.h | 2 +- arch/x86/kernel/apic/apic.c | 10 +++++----- arch/x86/kernel/cpu/common.c | 2 +- arch/x86/kernel/tsc.c | 12 ++++++------ drivers/input/joystick/analog.c | 6 +++--- drivers/net/hamradio/baycom_epp.c | 8 ++++---- 7 files changed, 20 insertions(+), 21 deletions(-)
arch/x86/include/asm/cpufeature.h +0 -1
@@ -118,7 +118,6 @@ extern const char * const x86_bug_flags[NBUGINTS*32];set_bit (bit, (unsigned long *)cpu_caps_set); \ } while (0) -#define cpu_has_tsc boot_cpu_has(X86_FEATURE_TSC)#define cpu_has_apic boot_cpu_has(X86_FEATURE_APIC)#define cpu_has_fxsr boot_cpu_has(X86_FEATURE_FXSR)#define cpu_has_xsave boot_cpu_has(X86_FEATURE_XSAVE)
arch/x86/include/asm/tsc.h +1 -1
@@ -22,7 +22,7 @@ extern void disable_TSC(void);static inline cycles_t get_cycles (void ) {#ifndef CONFIG_X86_TSC -if (!cpu_has_tsc) +if (!boot_cpu_has (X86_FEATURE_TSC ))return 0 ;#endif
arch/x86/kernel/apic/apic.c +5 -5
@@ -607,7 +607,7 @@ static void __init lapic_cal_handler(struct clock_event_device *dev)long tapic =apic_read (APIC_TMCCT );unsigned long pm =acpi_pm_read_early (); -if (cpu_has_tsc) +if (boot_cpu_has (X86_FEATURE_TSC )) tsc =rdtsc ();switch (lapic_cal_loops++) {
@@ -668,7 +668,7 @@ calibrate_by_pmtimer(long deltapm, long *delta, long *deltatsc) *delta = (long )res;/* Correct the tsc counter value */ -if (cpu_has_tsc) { +if (boot_cpu_has (X86_FEATURE_TSC )) { res = (((u64)(*deltatsc)) * pm_100ms);do_div (res, deltapm); apic_printk(APIC_VERBOSE, "TSC delta adjusted to "
@@ -760,7 +760,7 @@ static int __init calibrate_APIC_clock(void)apic_printk (APIC_VERBOSE ,"..... calibration result: %u\n" , lapic_timer_frequency); -if (cpu_has_tsc) { +if (boot_cpu_has (X86_FEATURE_TSC )) { apic_printk(APIC_VERBOSE, "..... CPU clock speed is " "%ld.%04ld MHz.\n", (deltatsc / LAPIC_CAL_LOOPS) / (1000000 / HZ),
@@ -1227,7 +1227,7 @@ void setup_local_APIC(void)unsigned long long tsc =0 , ntsc;long long max_loops = cpu_khz ? cpu_khz :1000000 ; -if (cpu_has_tsc) +if (boot_cpu_has (X86_FEATURE_TSC )) tsc =rdtsc ();if (disable_apic) {
@@ -1311,7 +1311,7 @@ void setup_local_APIC(void)break ; }if (queued) { -if (cpu_has_tsc && cpu_khz) { +if (boot_cpu_has (X86_FEATURE_TSC ) && cpu_khz) { ntsc =rdtsc (); max_loops = (cpu_khz <<10 ) - (ntsc - tsc); }else
arch/x86/kernel/cpu/common.c +1 -1
@@ -1527,7 +1527,7 @@ void cpu_init(void)pr_info ("Initializing CPU#%d\n" , cpu);if (cpu_feature_enabled (X86_FEATURE_VME ) || - cpu_has_tsc || +boot_cpu_has (X86_FEATURE_TSC ) ||boot_cpu_has (X86_FEATURE_DE ))cr4_clear_bits (X86_CR4_VME |X86_CR4_PVI |X86_CR4_TSD |X86_CR4_DE );
arch/x86/kernel/tsc.c +6 -6
@@ -36,7 +36,7 @@ static int __read_mostly tsc_unstable;/* native_sched_clock() is called before tsc_init(), so we must start with the TSC soft disabled to prevent -erroneous rdtsc usage on !cpu_has_tsc processors */ +erroneous rdtsc usage on !boot_cpu_has(X86_FEATURE_TSC) processors */ static int __read_mostly tsc_disabled =-1 ;static DEFINE_STATIC_KEY_FALSE (__use_tsc);
@@ -834,7 +834,7 @@ int recalibrate_cpu_khz(void)#ifndef CONFIG_SMP unsigned long cpu_khz_old = cpu_khz; -if (cpu_has_tsc) { +if (boot_cpu_has (X86_FEATURE_TSC )) { tsc_khz = x86_platform.calibrate_tsc (); cpu_khz = tsc_khz; cpu_data(0).loops_per_jiffy =
@@ -956,7 +956,7 @@ static struct notifier_block time_cpufreq_notifier_block = {static int __init cpufreq_tsc (void ) { -if (!cpu_has_tsc) +if (!boot_cpu_has (X86_FEATURE_TSC ))return 0 ;if (boot_cpu_has (X86_FEATURE_CONSTANT_TSC ))return 0 ;
@@ -1081,7 +1081,7 @@ static void __init check_system_tsc_reliable(void)*/ int unsynchronized_tsc (void ) { -if (!cpu_has_tsc || tsc_unstable) +if (!boot_cpu_has (X86_FEATURE_TSC ) || tsc_unstable)return 1 ;#ifdef CONFIG_SMP
@@ -1205,7 +1205,7 @@ out:static int __init init_tsc_clocksource (void ) { -if (!cpu_has_tsc || tsc_disabled >0 || !tsc_khz) +if (!boot_cpu_has (X86_FEATURE_TSC ) || tsc_disabled >0 || !tsc_khz)return 0 ;if (tsc_clocksource_reliable)
@@ -1242,7 +1242,7 @@ void __init tsc_init(void)u64 lpj;int cpu; -if (!cpu_has_tsc) { +if (!boot_cpu_has (X86_FEATURE_TSC )) {setup_clear_cpu_cap (X86_FEATURE_TSC_DEADLINE_TIMER );return ; }
drivers/input/joystick/analog.c +3 -3
@@ -143,9 +143,9 @@ struct analog_port {#include <linux/i8253.h> -#define GET_TIME (x) do { if (cpu_has_tsc) x = (unsigned int)rdtsc(); else x = get_time_pit(); } while (0) -#define DELTA (x,y) (cpu_has_tsc ? ((y) - (x)) : ((x) - (y) + ((x) < (y) ? PIT_TICK_RATE / HZ : 0))) -#define TIME_NAME (cpu_has_tsc?"TSC":"PIT") +#define GET_TIME (x) do { if (boot_cpu_has(X86_FEATURE_TSC)) x = (unsigned int)rdtsc(); else x = get_time_pit(); } while (0) +#define DELTA (x,y) (boot_cpu_has(X86_FEATURE_TSC) ? ((y) - (x)) : ((x) - (y) + ((x) < (y) ? PIT_TICK_RATE / HZ : 0))) +#define TIME_NAME (boot_cpu_has(X86_FEATURE_TSC)?"TSC":"PIT")static unsigned int get_time_pit (void ) {unsigned long flags;
drivers/net/hamradio/baycom_epp.c +4 -4
@@ -635,10 +635,10 @@ static int receive(struct net_device *dev, int cnt)#ifdef __i386__#include <asm/msr.h> -#define GETTICK (x) \ -({ \ - if (cpu_has_tsc) \ - x = (unsigned int)rdtsc(); \ +#define GETTICK (x) \ +({ \ + if (boot_cpu_has(X86_FEATURE_TSC)) \ + x = (unsigned int)rdtsc(); \ })#else /* __i386__ */ #define GETTICK (x)
Signature · 1 line
2.7.3
tip-bot for Borislav Petkov
merge bot[tip:x86/asm] x86/cpufeature: Replace cpu_has_tsc with boot_cpu_has() usage
x86/cpufeature: Replace cpu_has_tsc with boot_cpu_has() usage
Commit-ID: 59e21e3d00e6bc23186763c3e0bf11baf8924124 Gitweb: http://git.kernel.org/tip/59e21e3d00e6bc23186763c3e0bf11baf8924124 Author: Borislav Petkov <[email protected]> AuthorDate: Mon, 4 Apr 2016 22:24:59 +0200 Committer: Ingo Molnar <[email protected]> CommitDate: Wed, 13 Apr 2016 11:37:41 +0200
x86/cpufeature: Replace cpu_has_tsc with boot_cpu_has() usage
--- arch/x86/include/asm/cpufeature.h | 1 - arch/x86/include/asm/tsc.h | 2 +- arch/x86/kernel/apic/apic.c | 10 +++++----- arch/x86/kernel/cpu/common.c | 2 +- arch/x86/kernel/tsc.c | 12 ++++++------ drivers/input/joystick/analog.c | 6 +++--- drivers/net/hamradio/baycom_epp.c | 8 ++++---- 7 files changed, 20 insertions(+), 21 deletions(-)
arch/x86/include/asm/cpufeature.h +0 -1
@@ -118,7 +118,6 @@ extern const char * const x86_bug_flags[NBUGINTS*32];set_bit (bit, (unsigned long *)cpu_caps_set); \ } while (0) -#define cpu_has_tsc boot_cpu_has(X86_FEATURE_TSC)#define cpu_has_apic boot_cpu_has(X86_FEATURE_APIC)#define cpu_has_fxsr boot_cpu_has(X86_FEATURE_FXSR)#define cpu_has_xsave boot_cpu_has(X86_FEATURE_XSAVE)
arch/x86/include/asm/tsc.h +1 -1
@@ -22,7 +22,7 @@ extern void disable_TSC(void);static inline cycles_t get_cycles (void ) {#ifndef CONFIG_X86_TSC -if (!cpu_has_tsc) +if (!boot_cpu_has (X86_FEATURE_TSC ))return 0 ;#endif
arch/x86/kernel/apic/apic.c +5 -5
@@ -607,7 +607,7 @@ static void __init lapic_cal_handler(struct clock_event_device *dev)long tapic =apic_read (APIC_TMCCT );unsigned long pm =acpi_pm_read_early (); -if (cpu_has_tsc) +if (boot_cpu_has (X86_FEATURE_TSC )) tsc =rdtsc ();switch (lapic_cal_loops++) {
@@ -668,7 +668,7 @@ calibrate_by_pmtimer(long deltapm, long *delta, long *deltatsc) *delta = (long )res;/* Correct the tsc counter value */ -if (cpu_has_tsc) { +if (boot_cpu_has (X86_FEATURE_TSC )) { res = (((u64)(*deltatsc)) * pm_100ms);do_div (res, deltapm); apic_printk(APIC_VERBOSE, "TSC delta adjusted to "
@@ -760,7 +760,7 @@ static int __init calibrate_APIC_clock(void)apic_printk (APIC_VERBOSE ,"..... calibration result: %u\n" , lapic_timer_frequency); -if (cpu_has_tsc) { +if (boot_cpu_has (X86_FEATURE_TSC )) { apic_printk(APIC_VERBOSE, "..... CPU clock speed is " "%ld.%04ld MHz.\n", (deltatsc / LAPIC_CAL_LOOPS) / (1000000 / HZ),
@@ -1227,7 +1227,7 @@ void setup_local_APIC(void)unsigned long long tsc =0 , ntsc;long long max_loops = cpu_khz ? cpu_khz :1000000 ; -if (cpu_has_tsc) +if (boot_cpu_has (X86_FEATURE_TSC )) tsc =rdtsc ();if (disable_apic) {
@@ -1311,7 +1311,7 @@ void setup_local_APIC(void)break ; }if (queued) { -if (cpu_has_tsc && cpu_khz) { +if (boot_cpu_has (X86_FEATURE_TSC ) && cpu_khz) { ntsc =rdtsc (); max_loops = (cpu_khz <<10 ) - (ntsc - tsc); }else
arch/x86/kernel/cpu/common.c +1 -1
@@ -1558,7 +1558,7 @@ void cpu_init(void)pr_info ("Initializing CPU#%d\n" , cpu);if (cpu_feature_enabled (X86_FEATURE_VME ) || - cpu_has_tsc || +boot_cpu_has (X86_FEATURE_TSC ) ||boot_cpu_has (X86_FEATURE_DE ))cr4_clear_bits (X86_CR4_VME |X86_CR4_PVI |X86_CR4_TSD |X86_CR4_DE );
arch/x86/kernel/tsc.c +6 -6
@@ -36,7 +36,7 @@ static int __read_mostly tsc_unstable;/* native_sched_clock() is called before tsc_init(), so we must start with the TSC soft disabled to prevent -erroneous rdtsc usage on !cpu_has_tsc processors */ +erroneous rdtsc usage on !boot_cpu_has(X86_FEATURE_TSC) processors */ static int __read_mostly tsc_disabled =-1 ;static DEFINE_STATIC_KEY_FALSE (__use_tsc);
@@ -834,7 +834,7 @@ int recalibrate_cpu_khz(void)#ifndef CONFIG_SMP unsigned long cpu_khz_old = cpu_khz; -if (cpu_has_tsc) { +if (boot_cpu_has (X86_FEATURE_TSC )) { tsc_khz = x86_platform.calibrate_tsc (); cpu_khz = tsc_khz; cpu_data(0).loops_per_jiffy =
@@ -956,7 +956,7 @@ static struct notifier_block time_cpufreq_notifier_block = {static int __init cpufreq_tsc (void ) { -if (!cpu_has_tsc) +if (!boot_cpu_has (X86_FEATURE_TSC ))return 0 ;if (boot_cpu_has (X86_FEATURE_CONSTANT_TSC ))return 0 ;
@@ -1081,7 +1081,7 @@ static void __init check_system_tsc_reliable(void)*/ int unsynchronized_tsc (void ) { -if (!cpu_has_tsc || tsc_unstable) +if (!boot_cpu_has (X86_FEATURE_TSC ) || tsc_unstable)return 1 ;#ifdef CONFIG_SMP
@@ -1205,7 +1205,7 @@ out:static int __init init_tsc_clocksource (void ) { -if (!cpu_has_tsc || tsc_disabled >0 || !tsc_khz) +if (!boot_cpu_has (X86_FEATURE_TSC ) || tsc_disabled >0 || !tsc_khz)return 0 ;if (tsc_clocksource_reliable)
@@ -1242,7 +1242,7 @@ void __init tsc_init(void)u64 lpj;int cpu; -if (!cpu_has_tsc) { +if (!boot_cpu_has (X86_FEATURE_TSC )) {setup_clear_cpu_cap (X86_FEATURE_TSC_DEADLINE_TIMER );return ; }
drivers/input/joystick/analog.c +3 -3
@@ -143,9 +143,9 @@ struct analog_port {#include <linux/i8253.h> -#define GET_TIME (x) do { if (cpu_has_tsc) x = (unsigned int)rdtsc(); else x = get_time_pit(); } while (0) -#define DELTA (x,y) (cpu_has_tsc ? ((y) - (x)) : ((x) - (y) + ((x) < (y) ? PIT_TICK_RATE / HZ : 0))) -#define TIME_NAME (cpu_has_tsc?"TSC":"PIT") +#define GET_TIME (x) do { if (boot_cpu_has(X86_FEATURE_TSC)) x = (unsigned int)rdtsc(); else x = get_time_pit(); } while (0) +#define DELTA (x,y) (boot_cpu_has(X86_FEATURE_TSC) ? ((y) - (x)) : ((x) - (y) + ((x) < (y) ? PIT_TICK_RATE / HZ : 0))) +#define TIME_NAME (boot_cpu_has(X86_FEATURE_TSC)?"TSC":"PIT")static unsigned int get_time_pit (void ) {unsigned long flags;
drivers/net/hamradio/baycom_epp.c +4 -4
@@ -635,10 +635,10 @@ static int receive(struct net_device *dev, int cnt)#ifdef __i386__#include <asm/msr.h> -#define GETTICK (x) \ -({ \ - if (cpu_has_tsc) \ - x = (unsigned int)rdtsc(); \ +#define GETTICK (x) \ +({ \ + if (boot_cpu_has(X86_FEATURE_TSC)) \ + x = (unsigned int)rdtsc(); \ })#else /* __i386__ */ #define GETTICK (x)
Borislav Petkov
maintainerPATCH 7/10 x86/cpufeature: Remove cpu_has_apic
In reply to Borislav PetkovFrom: Borislav Petkov <[email protected]>
--- arch/x86/events/core.c | 2 +- arch/x86/include/asm/cpufeature.h | 1 - arch/x86/include/asm/irq_work.h | 2 +- arch/x86/kernel/acpi/boot.c | 8 ++++---- arch/x86/kernel/apic/apic.c | 20 ++++++++++---------- arch/x86/kernel/apic/apic_noop.c | 4 ++-- arch/x86/kernel/apic/io_apic.c | 2 +- arch/x86/kernel/apic/ipi.c | 2 +- arch/x86/kernel/apic/vector.c | 2 +- arch/x86/kernel/cpu/amd.c | 4 ++-- arch/x86/kernel/cpu/intel.c | 2 +- arch/x86/kernel/cpu/mcheck/mce_intel.c | 2 +- arch/x86/kernel/cpu/mcheck/therm_throt.c | 2 +- arch/x86/kernel/devicetree.c | 2 +- arch/x86/kernel/smpboot.c | 2 +- arch/x86/oprofile/nmi_int.c | 2 +- arch/x86/pci/xen.c | 2 +- drivers/cpufreq/longhaul.c | 2 +- drivers/iommu/irq_remapping.c | 2 +- 19 files changed, 32 insertions(+), 33 deletions(-)
arch/x86/events/core.c +1 -1
@@ -1518,7 +1518,7 @@ x86_pmu_notifier(struct notifier_block *self, unsigned long action, void *hcpu)static void __init pmu_check_apic (void ) { -if (cpu_has_apic) +if (boot_cpu_has (X86_FEATURE_APIC ))return ; x86_pmu.apic =0 ;
arch/x86/include/asm/cpufeature.h +0 -1
@@ -118,7 +118,6 @@ extern const char * const x86_bug_flags[NBUGINTS*32];set_bit (bit, (unsigned long *)cpu_caps_set); \ } while (0) -#define cpu_has_apic boot_cpu_has(X86_FEATURE_APIC)#define cpu_has_fxsr boot_cpu_has(X86_FEATURE_FXSR)#define cpu_has_xsave boot_cpu_has(X86_FEATURE_XSAVE)#define cpu_has_xsaves boot_cpu_has(X86_FEATURE_XSAVES)
arch/x86/include/asm/irq_work.h +1 -1
@@ -5,7 +5,7 @@static inline bool arch_irq_work_has_interrupt (void ) { -return cpu_has_apic; +return boot_cpu_has (X86_FEATURE_APIC ); }#endif /* _ASM_IRQ_WORK_H */
arch/x86/kernel/acpi/boot.c +4 -4
@@ -136,7 +136,7 @@ static int __init acpi_parse_madt(struct acpi_table_header *table) {struct acpi_table_madt *madt =NULL ; -if (!cpu_has_apic) +if (!boot_cpu_has (X86_FEATURE_APIC ))return -EINVAL ; madt = (struct acpi_table_madt *)table;
@@ -951,7 +951,7 @@ static int __init early_acpi_parse_madt_lapic_addr_ovr(void) {int count; -if (!cpu_has_apic) +if (!boot_cpu_has (X86_FEATURE_APIC ))return -ENODEV ;/*
@@ -979,7 +979,7 @@ static int __init acpi_parse_madt_lapic_entries(void)int ret;struct acpi_subtable_proc madt_proc[2 ]; -if (!cpu_has_apic) +if (!boot_cpu_has (X86_FEATURE_APIC ))return -ENODEV ;/*
@@ -1125,7 +1125,7 @@ static int __init acpi_parse_madt_ioapic_entries(void)if (acpi_disabled || acpi_noirq)return -ENODEV ; -if (!cpu_has_apic) +if (!boot_cpu_has (X86_FEATURE_APIC ))return -ENODEV ;/*
arch/x86/kernel/apic/apic.c +10 -10
@@ -1085,7 +1085,7 @@ void lapic_shutdown(void) {unsigned long flags; -if (!cpu_has_apic && !apic_from_smp_config ()) +if (!boot_cpu_has (X86_FEATURE_APIC ) && !apic_from_smp_config ())return ;local_irq_save (flags);
@@ -1134,7 +1134,7 @@ void __init init_bsp_APIC(void)* Don't do the setup now if we have a SMP BIOS as the * through-I/O-APIC virtual wire mode might be active. */ -if (smp_found_config || !cpu_has_apic) +if (smp_found_config || !boot_cpu_has (X86_FEATURE_APIC ))return ;/*
@@ -1445,7 +1445,7 @@ static void __x2apic_disable(void) {u64 msr; -if (!cpu_has_apic) +if (!boot_cpu_has (X86_FEATURE_APIC ))return ;rdmsrl (MSR_IA32_APICBASE , msr);
@@ -1632,7 +1632,7 @@ void __init enable_IR_x2apic(void)*/ static int __init detect_init_APIC (void ) { -if (!cpu_has_apic) { +if (!boot_cpu_has (X86_FEATURE_APIC )) {pr_info ("No local APIC present\n" );return -1 ; }
@@ -1711,14 +1711,14 @@ static int __init detect_init_APIC(void) goto no_apic;case X86_VENDOR_INTEL :if (boot_cpu_data.x86 ==6 || boot_cpu_data.x86 ==15 || - (boot_cpu_data.x86 ==5 && cpu_has_apic)) + (boot_cpu_data.x86 ==5 &&boot_cpu_has (X86_FEATURE_APIC )))break ; goto no_apic;default : goto no_apic; } -if (!cpu_has_apic) { +if (!boot_cpu_has (X86_FEATURE_APIC )) {/* * Over-ride BIOS and try to enable the local APIC only if * "lapic" specified.
@@ -2233,19 +2233,19 @@ int __init APIC_init_uniprocessor(void)return -1 ; }#ifdef CONFIG_X86_64 -if (!cpu_has_apic) { +if (!boot_cpu_has (X86_FEATURE_APIC )) { disable_apic =1 ;pr_info ("Apic disabled by BIOS\n" );return -1 ; }#else -if (!smp_found_config && !cpu_has_apic) +if (!smp_found_config && !boot_cpu_has (X86_FEATURE_APIC ))return -1 ;/* * Complain if the BIOS pretends there is one. */ -if (!cpu_has_apic && +if (!boot_cpu_has (X86_FEATURE_APIC ) &&APIC_INTEGRATED (apic_version[boot_cpu_physical_apicid])) {pr_err ("BIOS bug, local APIC 0x%x not detected!...\n" , boot_cpu_physical_apicid);
@@ -2426,7 +2426,7 @@ static void apic_pm_activate(void)static int __init init_lapic_sysfs (void ) {/* XXX: remove suspend/resume procs if !apic_pm_state.active? */ -if (cpu_has_apic) +if (boot_cpu_has (X86_FEATURE_APIC ))register_syscore_ops (&lapic_syscore_ops);return 0 ;
arch/x86/kernel/apic/apic_noop.c +2 -2
@@ -100,13 +100,13 @@ static void noop_vector_allocation_domain(int cpu, struct cpumask *retmask,static u32 noop_apic_read (u32 reg) { -WARN_ON_ONCE ((cpu_has_apic && !disable_apic)); +WARN_ON_ONCE (boot_cpu_has (X86_FEATURE_APIC ) && !disable_apic);return 0 ; }static void noop_apic_write (u32 reg,u32 v) { -WARN_ON_ONCE (cpu_has_apic && !disable_apic); +WARN_ON_ONCE (boot_cpu_has (X86_FEATURE_APIC ) && !disable_apic); }struct apic apic_noop = {
arch/x86/kernel/apic/io_apic.c +1 -1
@@ -1454,7 +1454,7 @@ void native_disable_io_apic(void)ioapic_write_entry (ioapic_i8259.apic, ioapic_i8259.pin, entry); } -if (cpu_has_apic ||apic_from_smp_config ()) +if (boot_cpu_has (X86_FEATURE_APIC ) ||apic_from_smp_config ())disconnect_bsp_APIC (ioapic_i8259.pin !=-1 ); }
arch/x86/kernel/apic/ipi.c +1 -1
@@ -230,7 +230,7 @@ int safe_smp_processor_id(void) {int apicid, cpuid; -if (!cpu_has_apic) +if (!boot_cpu_has (X86_FEATURE_APIC ))return 0 ; apicid =hard_smp_processor_id ();
arch/x86/kernel/apic/vector.c +1 -1
@@ -943,7 +943,7 @@ static int __init print_ICs(void)print_PIC ();/* don't print out if apic is not there */ -if (!cpu_has_apic && !apic_from_smp_config ()) +if (!boot_cpu_has (X86_FEATURE_APIC ) && !apic_from_smp_config ())return 0 ;print_local_APICs (show_lapic);
arch/x86/kernel/cpu/amd.c +2 -2
@@ -565,9 +565,9 @@ static void early_init_amd(struct cpuinfo_x86 *c)* can safely set X86_FEATURE_EXTD_APICID unconditionally for families * after 16h. */ -if (cpu_has_apic && c->x86 >0x16 ) { +if (boot_cpu_has (X86_FEATURE_APIC ) && c->x86 >0x16 ) {set_cpu_cap (c,X86_FEATURE_EXTD_APICID ); - }else if (cpu_has_apic && c->x86 >=0xf ) { + }else if (boot_cpu_has (X86_FEATURE_APIC ) && c->x86 >=0xf ) {/* check CPU config space for extended APIC ID */ unsigned int val; val =read_pci_config (0 ,24 ,0 ,0x68 );
arch/x86/kernel/cpu/intel.c +1 -1
@@ -281,7 +281,7 @@ static void intel_workarounds(struct cpuinfo_x86 *c)* integrated APIC (see 11AP erratum in "Pentium Processor * Specification Update"). */ -if (cpu_has_apic && (c->x86<<8 | c->x86_model<<4 ) ==0x520 && +if (boot_cpu_has (X86_FEATURE_APIC ) && (c->x86<<8 | c->x86_model<<4 ) ==0x520 && (c->x86_mask <0x6 || c->x86_mask ==0xb ))set_cpu_bug (c,X86_BUG_11AP );
arch/x86/kernel/cpu/mcheck/mce_intel.c +1 -1
@@ -84,7 +84,7 @@ static int cmci_supported(int *banks)*/ if (boot_cpu_data.x86_vendor !=X86_VENDOR_INTEL )return 0 ; -if (!cpu_has_apic ||lapic_get_maxlvt () <6 ) +if (!boot_cpu_has (X86_FEATURE_APIC ) ||lapic_get_maxlvt () <6 )return 0 ;rdmsrl (MSR_IA32_MCG_CAP , cap); *banks =min_t (unsigned,MAX_NR_BANKS , cap &0xff );
arch/x86/kernel/cpu/mcheck/therm_throt.c +1 -1
@@ -450,7 +450,7 @@ asmlinkage __visible void smp_trace_thermal_interrupt(struct pt_regs *regs)/* Thermal monitoring depends on APIC, ACPI and clock modulation */ static int intel_thermal_supported (struct cpuinfo_x86 *c) { -if (!cpu_has_apic) +if (!boot_cpu_has (X86_FEATURE_APIC ))return 0 ;if (!cpu_has (c,X86_FEATURE_ACPI ) || !cpu_has (c,X86_FEATURE_ACC ))return 0 ;
arch/x86/kernel/devicetree.c +1 -1
@@ -151,7 +151,7 @@ static void __init dtb_lapic_setup(void)return ;/* Did the boot loader setup the local APIC ? */ -if (!cpu_has_apic) { +if (!boot_cpu_has (X86_FEATURE_APIC )) {if (apic_force_enable (r.start))return ; }
arch/x86/kernel/smpboot.c +1 -1
@@ -1231,7 +1231,7 @@ static int __init smp_sanity_check(unsigned max_cpus)* If we couldn't find a local APIC, then get out of here now! */ if (APIC_INTEGRATED (apic_version[boot_cpu_physical_apicid]) && - !cpu_has_apic) { + !boot_cpu_has (X86_FEATURE_APIC )) {if (!disable_apic) {pr_err ("BIOS bug, local APIC #%d not detected!...\n" , boot_cpu_physical_apicid);
arch/x86/oprofile/nmi_int.c +1 -1
@@ -700,7 +700,7 @@ int __init op_nmi_init(struct oprofile_operations *ops)char *cpu_type =NULL ;int ret =0 ; -if (!cpu_has_apic) +if (!boot_cpu_has (X86_FEATURE_APIC ))return -ENODEV ;if (force_cpu_type == timer)
arch/x86/pci/xen.c +1 -1
@@ -445,7 +445,7 @@ void __init xen_msi_init(void)uint32_t eax =cpuid_eax (xen_cpuid_base () +4 );if (((eax &XEN_HVM_CPUID_X2APIC_VIRT ) && x2apic_mode) || - ((eax &XEN_HVM_CPUID_APIC_ACCESS_VIRT ) && cpu_has_apic)) + ((eax &XEN_HVM_CPUID_APIC_ACCESS_VIRT ) &&boot_cpu_has (X86_FEATURE_APIC )))return ; }
drivers/cpufreq/longhaul.c +1 -1
@@ -945,7 +945,7 @@ static int __init longhaul_init(void) }#endif #ifdef CONFIG_X86_IO_APIC -if (cpu_has_apic) { +if (boot_cpu_has (X86_FEATURE_APIC )) { printk(KERN_ERR PFX "APIC detected. Longhaul is currently " "broken in this configuration.\n");return -ENODEV ;
drivers/iommu/irq_remapping.c +1 -1
@@ -36,7 +36,7 @@ static void irq_remapping_disable_io_apic(void)* As this gets called during crash dump, keep this simple for * now. */ -if (cpu_has_apic ||apic_from_smp_config ()) +if (boot_cpu_has (X86_FEATURE_APIC ) ||apic_from_smp_config ())disconnect_bsp_APIC (0 ); }
Signature · 1 line
2.7.3
tip-bot for Borislav Petkov
merge bot[tip:x86/asm] x86/cpufeature: Replace cpu_has_apic with boot_cpu_has() usage
x86/cpufeature: Replace cpu_has_apic with boot_cpu_has() usage
Commit-ID: 93984fbd4e33cc861d5b49caed02a02cbfb01340 Gitweb: http://git.kernel.org/tip/93984fbd4e33cc861d5b49caed02a02cbfb01340 Author: Borislav Petkov <[email protected]> AuthorDate: Mon, 4 Apr 2016 22:25:00 +0200 Committer: Ingo Molnar <[email protected]> CommitDate: Wed, 13 Apr 2016 11:37:41 +0200
x86/cpufeature: Replace cpu_has_apic with boot_cpu_has() usage
--- arch/x86/events/core.c | 2 +- arch/x86/include/asm/cpufeature.h | 1 - arch/x86/include/asm/irq_work.h | 2 +- arch/x86/kernel/acpi/boot.c | 8 ++++---- arch/x86/kernel/apic/apic.c | 20 ++++++++++---------- arch/x86/kernel/apic/apic_noop.c | 4 ++-- arch/x86/kernel/apic/io_apic.c | 2 +- arch/x86/kernel/apic/ipi.c | 2 +- arch/x86/kernel/apic/vector.c | 2 +- arch/x86/kernel/cpu/amd.c | 4 ++-- arch/x86/kernel/cpu/intel.c | 2 +- arch/x86/kernel/cpu/mcheck/mce_intel.c | 2 +- arch/x86/kernel/cpu/mcheck/therm_throt.c | 2 +- arch/x86/kernel/devicetree.c | 2 +- arch/x86/kernel/smpboot.c | 2 +- arch/x86/oprofile/nmi_int.c | 2 +- arch/x86/pci/xen.c | 2 +- drivers/cpufreq/longhaul.c | 2 +- drivers/iommu/irq_remapping.c | 2 +- 19 files changed, 32 insertions(+), 33 deletions(-)
arch/x86/events/core.c +1 -1
@@ -1518,7 +1518,7 @@ x86_pmu_notifier(struct notifier_block *self, unsigned long action, void *hcpu)static void __init pmu_check_apic (void ) { -if (cpu_has_apic) +if (boot_cpu_has (X86_FEATURE_APIC ))return ; x86_pmu.apic =0 ;
arch/x86/include/asm/cpufeature.h +0 -1
@@ -118,7 +118,6 @@ extern const char * const x86_bug_flags[NBUGINTS*32];set_bit (bit, (unsigned long *)cpu_caps_set); \ } while (0) -#define cpu_has_apic boot_cpu_has(X86_FEATURE_APIC)#define cpu_has_fxsr boot_cpu_has(X86_FEATURE_FXSR)#define cpu_has_xsave boot_cpu_has(X86_FEATURE_XSAVE)#define cpu_has_xsaves boot_cpu_has(X86_FEATURE_XSAVES)
arch/x86/include/asm/irq_work.h +1 -1
@@ -5,7 +5,7 @@static inline bool arch_irq_work_has_interrupt (void ) { -return cpu_has_apic; +return boot_cpu_has (X86_FEATURE_APIC ); }#endif /* _ASM_IRQ_WORK_H */
arch/x86/kernel/acpi/boot.c +4 -4
@@ -136,7 +136,7 @@ static int __init acpi_parse_madt(struct acpi_table_header *table) {struct acpi_table_madt *madt =NULL ; -if (!cpu_has_apic) +if (!boot_cpu_has (X86_FEATURE_APIC ))return -EINVAL ; madt = (struct acpi_table_madt *)table;
@@ -951,7 +951,7 @@ static int __init early_acpi_parse_madt_lapic_addr_ovr(void) {int count; -if (!cpu_has_apic) +if (!boot_cpu_has (X86_FEATURE_APIC ))return -ENODEV ;/*
@@ -979,7 +979,7 @@ static int __init acpi_parse_madt_lapic_entries(void)int ret;struct acpi_subtable_proc madt_proc[2 ]; -if (!cpu_has_apic) +if (!boot_cpu_has (X86_FEATURE_APIC ))return -ENODEV ;/*
@@ -1125,7 +1125,7 @@ static int __init acpi_parse_madt_ioapic_entries(void)if (acpi_disabled || acpi_noirq)return -ENODEV ; -if (!cpu_has_apic) +if (!boot_cpu_has (X86_FEATURE_APIC ))return -ENODEV ;/*
arch/x86/kernel/apic/apic.c +10 -10
@@ -1085,7 +1085,7 @@ void lapic_shutdown(void) {unsigned long flags; -if (!cpu_has_apic && !apic_from_smp_config ()) +if (!boot_cpu_has (X86_FEATURE_APIC ) && !apic_from_smp_config ())return ;local_irq_save (flags);
@@ -1134,7 +1134,7 @@ void __init init_bsp_APIC(void)* Don't do the setup now if we have a SMP BIOS as the * through-I/O-APIC virtual wire mode might be active. */ -if (smp_found_config || !cpu_has_apic) +if (smp_found_config || !boot_cpu_has (X86_FEATURE_APIC ))return ;/*
@@ -1445,7 +1445,7 @@ static void __x2apic_disable(void) {u64 msr; -if (!cpu_has_apic) +if (!boot_cpu_has (X86_FEATURE_APIC ))return ;rdmsrl (MSR_IA32_APICBASE , msr);
@@ -1632,7 +1632,7 @@ void __init enable_IR_x2apic(void)*/ static int __init detect_init_APIC (void ) { -if (!cpu_has_apic) { +if (!boot_cpu_has (X86_FEATURE_APIC )) {pr_info ("No local APIC present\n" );return -1 ; }
@@ -1711,14 +1711,14 @@ static int __init detect_init_APIC(void) goto no_apic;case X86_VENDOR_INTEL :if (boot_cpu_data.x86 ==6 || boot_cpu_data.x86 ==15 || - (boot_cpu_data.x86 ==5 && cpu_has_apic)) + (boot_cpu_data.x86 ==5 &&boot_cpu_has (X86_FEATURE_APIC )))break ; goto no_apic;default : goto no_apic; } -if (!cpu_has_apic) { +if (!boot_cpu_has (X86_FEATURE_APIC )) {/* * Over-ride BIOS and try to enable the local APIC only if * "lapic" specified.
@@ -2233,19 +2233,19 @@ int __init APIC_init_uniprocessor(void)return -1 ; }#ifdef CONFIG_X86_64 -if (!cpu_has_apic) { +if (!boot_cpu_has (X86_FEATURE_APIC )) { disable_apic =1 ;pr_info ("Apic disabled by BIOS\n" );return -1 ; }#else -if (!smp_found_config && !cpu_has_apic) +if (!smp_found_config && !boot_cpu_has (X86_FEATURE_APIC ))return -1 ;/* * Complain if the BIOS pretends there is one. */ -if (!cpu_has_apic && +if (!boot_cpu_has (X86_FEATURE_APIC ) &&APIC_INTEGRATED (apic_version[boot_cpu_physical_apicid])) {pr_err ("BIOS bug, local APIC 0x%x not detected!...\n" , boot_cpu_physical_apicid);
@@ -2426,7 +2426,7 @@ static void apic_pm_activate(void)static int __init init_lapic_sysfs (void ) {/* XXX: remove suspend/resume procs if !apic_pm_state.active? */ -if (cpu_has_apic) +if (boot_cpu_has (X86_FEATURE_APIC ))register_syscore_ops (&lapic_syscore_ops);return 0 ;
arch/x86/kernel/apic/apic_noop.c +2 -2
@@ -100,13 +100,13 @@ static void noop_vector_allocation_domain(int cpu, struct cpumask *retmask,static u32 noop_apic_read (u32 reg) { -WARN_ON_ONCE ((cpu_has_apic && !disable_apic)); +WARN_ON_ONCE (boot_cpu_has (X86_FEATURE_APIC ) && !disable_apic);return 0 ; }static void noop_apic_write (u32 reg,u32 v) { -WARN_ON_ONCE (cpu_has_apic && !disable_apic); +WARN_ON_ONCE (boot_cpu_has (X86_FEATURE_APIC ) && !disable_apic); }struct apic apic_noop = {
arch/x86/kernel/apic/io_apic.c +1 -1
@@ -1454,7 +1454,7 @@ void native_disable_io_apic(void)ioapic_write_entry (ioapic_i8259.apic, ioapic_i8259.pin, entry); } -if (cpu_has_apic ||apic_from_smp_config ()) +if (boot_cpu_has (X86_FEATURE_APIC ) ||apic_from_smp_config ())disconnect_bsp_APIC (ioapic_i8259.pin !=-1 ); }
arch/x86/kernel/apic/ipi.c +1 -1
@@ -230,7 +230,7 @@ int safe_smp_processor_id(void) {int apicid, cpuid; -if (!cpu_has_apic) +if (!boot_cpu_has (X86_FEATURE_APIC ))return 0 ; apicid =hard_smp_processor_id ();
arch/x86/kernel/apic/vector.c +1 -1
@@ -943,7 +943,7 @@ static int __init print_ICs(void)print_PIC ();/* don't print out if apic is not there */ -if (!cpu_has_apic && !apic_from_smp_config ()) +if (!boot_cpu_has (X86_FEATURE_APIC ) && !apic_from_smp_config ())return 0 ;print_local_APICs (show_lapic);
arch/x86/kernel/cpu/amd.c +2 -2
@@ -565,9 +565,9 @@ static void early_init_amd(struct cpuinfo_x86 *c)* can safely set X86_FEATURE_EXTD_APICID unconditionally for families * after 16h. */ -if (cpu_has_apic && c->x86 >0x16 ) { +if (boot_cpu_has (X86_FEATURE_APIC ) && c->x86 >0x16 ) {set_cpu_cap (c,X86_FEATURE_EXTD_APICID ); - }else if (cpu_has_apic && c->x86 >=0xf ) { + }else if (boot_cpu_has (X86_FEATURE_APIC ) && c->x86 >=0xf ) {/* check CPU config space for extended APIC ID */ unsigned int val; val =read_pci_config (0 ,24 ,0 ,0x68 );
arch/x86/kernel/cpu/intel.c +1 -1
@@ -281,7 +281,7 @@ static void intel_workarounds(struct cpuinfo_x86 *c)* integrated APIC (see 11AP erratum in "Pentium Processor * Specification Update"). */ -if (cpu_has_apic && (c->x86<<8 | c->x86_model<<4 ) ==0x520 && +if (boot_cpu_has (X86_FEATURE_APIC ) && (c->x86<<8 | c->x86_model<<4 ) ==0x520 && (c->x86_mask <0x6 || c->x86_mask ==0xb ))set_cpu_bug (c,X86_BUG_11AP );
arch/x86/kernel/cpu/mcheck/mce_intel.c +1 -1
@@ -84,7 +84,7 @@ static int cmci_supported(int *banks)*/ if (boot_cpu_data.x86_vendor !=X86_VENDOR_INTEL )return 0 ; -if (!cpu_has_apic ||lapic_get_maxlvt () <6 ) +if (!boot_cpu_has (X86_FEATURE_APIC ) ||lapic_get_maxlvt () <6 )return 0 ;rdmsrl (MSR_IA32_MCG_CAP , cap); *banks =min_t (unsigned,MAX_NR_BANKS , cap &0xff );
arch/x86/kernel/cpu/mcheck/therm_throt.c +1 -1
@@ -447,7 +447,7 @@ asmlinkage __visible void smp_trace_thermal_interrupt(struct pt_regs *regs)/* Thermal monitoring depends on APIC, ACPI and clock modulation */ static int intel_thermal_supported (struct cpuinfo_x86 *c) { -if (!cpu_has_apic) +if (!boot_cpu_has (X86_FEATURE_APIC ))return 0 ;if (!cpu_has (c,X86_FEATURE_ACPI ) || !cpu_has (c,X86_FEATURE_ACC ))return 0 ;
arch/x86/kernel/devicetree.c +1 -1
@@ -151,7 +151,7 @@ static void __init dtb_lapic_setup(void)return ;/* Did the boot loader setup the local APIC ? */ -if (!cpu_has_apic) { +if (!boot_cpu_has (X86_FEATURE_APIC )) {if (apic_force_enable (r.start))return ; }
arch/x86/kernel/smpboot.c +1 -1
@@ -1231,7 +1231,7 @@ static int __init smp_sanity_check(unsigned max_cpus)* If we couldn't find a local APIC, then get out of here now! */ if (APIC_INTEGRATED (apic_version[boot_cpu_physical_apicid]) && - !cpu_has_apic) { + !boot_cpu_has (X86_FEATURE_APIC )) {if (!disable_apic) {pr_err ("BIOS bug, local APIC #%d not detected!...\n" , boot_cpu_physical_apicid);
arch/x86/oprofile/nmi_int.c +1 -1
@@ -700,7 +700,7 @@ int __init op_nmi_init(struct oprofile_operations *ops)char *cpu_type =NULL ;int ret =0 ; -if (!cpu_has_apic) +if (!boot_cpu_has (X86_FEATURE_APIC ))return -ENODEV ;if (force_cpu_type == timer)
arch/x86/pci/xen.c +1 -1
@@ -445,7 +445,7 @@ void __init xen_msi_init(void)uint32_t eax =cpuid_eax (xen_cpuid_base () +4 );if (((eax &XEN_HVM_CPUID_X2APIC_VIRT ) && x2apic_mode) || - ((eax &XEN_HVM_CPUID_APIC_ACCESS_VIRT ) && cpu_has_apic)) + ((eax &XEN_HVM_CPUID_APIC_ACCESS_VIRT ) &&boot_cpu_has (X86_FEATURE_APIC )))return ; }
drivers/cpufreq/longhaul.c +1 -1
@@ -945,7 +945,7 @@ static int __init longhaul_init(void) }#endif #ifdef CONFIG_X86_IO_APIC -if (cpu_has_apic) { +if (boot_cpu_has (X86_FEATURE_APIC )) { printk(KERN_ERR PFX "APIC detected. Longhaul is currently " "broken in this configuration.\n");return -ENODEV ;
drivers/iommu/irq_remapping.c +1 -1
@@ -36,7 +36,7 @@ static void irq_remapping_disable_io_apic(void)* As this gets called during crash dump, keep this simple for * now. */ -if (cpu_has_apic ||apic_from_smp_config ()) +if (boot_cpu_has (X86_FEATURE_APIC ) ||apic_from_smp_config ())disconnect_bsp_APIC (0 ); }
Borislav Petkov
maintainerPATCH 8/10 x86/cpufeature: Remove cpu_has_fxsr
In reply to Borislav PetkovFrom: Borislav Petkov <[email protected]>
--- arch/x86/include/asm/cpufeature.h | 1 - arch/x86/kernel/fpu/core.c | 6 +++--- arch/x86/kernel/fpu/init.c | 6 +++--- arch/x86/kernel/fpu/regset.c | 13 ++++++++----- 4 files changed, 14 insertions(+), 12 deletions(-)
arch/x86/include/asm/cpufeature.h +0 -1
@@ -118,7 +118,6 @@ extern const char * const x86_bug_flags[NBUGINTS*32];set_bit (bit, (unsigned long *)cpu_caps_set); \ } while (0) -#define cpu_has_fxsr boot_cpu_has(X86_FEATURE_FXSR)#define cpu_has_xsave boot_cpu_has(X86_FEATURE_XSAVE)#define cpu_has_xsaves boot_cpu_has(X86_FEATURE_XSAVES)/*
arch/x86/kernel/fpu/core.c +3 -3
@@ -224,7 +224,7 @@ void fpstate_init(union fpregs_state *state)memset (state,0 , xstate_size); -if (cpu_has_fxsr) +if (static_cpu_has (X86_FEATURE_FXSR ))fpstate_init_fxstate (&state->fxsave);else fpstate_init_fstate (&state->fsave);
@@ -508,7 +508,7 @@ void fpu__clear(struct fpu *fpu)static inline unsigned short get_fpu_cwd (struct fpu *fpu) { -if (cpu_has_fxsr) { +if (boot_cpu_has (X86_FEATURE_FXSR )) {return fpu->state.fxsave.cwd; }else {return (unsigned short )fpu->state.fsave.cwd;
@@ -517,7 +517,7 @@ static inline unsigned short get_fpu_cwd(struct fpu *fpu)static inline unsigned short get_fpu_swd (struct fpu *fpu) { -if (cpu_has_fxsr) { +if (boot_cpu_has (X86_FEATURE_FXSR )) {return fpu->state.fxsave.swd; }else {return (unsigned short )fpu->state.fsave.swd;
arch/x86/kernel/fpu/init.c +3 -3
@@ -29,7 +29,7 @@ static void fpu__init_cpu_generic(void)unsigned long cr0;unsigned long cr4_mask =0 ; -if (cpu_has_fxsr) +if (boot_cpu_has (X86_FEATURE_FXSR )) cr4_mask |=X86_CR4_OSFXSR ;if (boot_cpu_has (X86_FEATURE_XMM )) cr4_mask |=X86_CR4_OSXMMEXCPT ;
@@ -106,7 +106,7 @@ static void __init fpu__init_system_mxcsr(void) {unsigned int mask =0 ; -if (cpu_has_fxsr) { +if (boot_cpu_has (X86_FEATURE_FXSR )) {/* Static because GCC does not get 16-byte stack alignment right: */ static struct fxregs_state fxregs__initdata ;
@@ -221,7 +221,7 @@ static void __init fpu__init_system_xstate_size_legacy(void)setup_clear_cpu_cap (X86_FEATURE_XSAVEOPT ); xstate_size =sizeof (struct swregs_state ); }else { -if (cpu_has_fxsr) +if (boot_cpu_has (X86_FEATURE_FXSR )) xstate_size =sizeof (struct fxregs_state );else xstate_size =sizeof (struct fregs_state );
arch/x86/kernel/fpu/regset.c +8 -5
@@ -21,7 +21,10 @@ int regset_xregset_fpregs_active(struct task_struct *target, const struct user_r {struct fpu *target_fpu = &target->thread.fpu; -return (cpu_has_fxsr && target_fpu->fpstate_active) ? regset->n :0 ; +if (boot_cpu_has (X86_FEATURE_FXSR ) && target_fpu->fpstate_active) +return regset->n; +else +return 0 ; } int xfpregs_get(struct task_struct *target, const struct user_regset *regset,
@@ -30,7 +33,7 @@ int xfpregs_get(struct task_struct *target, const struct user_regset *regset, {struct fpu *fpu = &target->thread.fpu; -if (!cpu_has_fxsr) +if (!boot_cpu_has (X86_FEATURE_FXSR ))return -ENODEV ;fpu__activate_fpstate_read (fpu);
@@ -47,7 +50,7 @@ int xfpregs_set(struct task_struct *target, const struct user_regset *regset,struct fpu *fpu = &target->thread.fpu;int ret; -if (!cpu_has_fxsr) +if (!boot_cpu_has (X86_FEATURE_FXSR ))return -ENODEV ;fpu__activate_fpstate_write (fpu);
@@ -278,7 +281,7 @@ int fpregs_get(struct task_struct *target, const struct user_regset *regset,if (!static_cpu_has (X86_FEATURE_FPU ))return fpregs_soft_get (target, regset, pos, count, kbuf, ubuf); -if (!cpu_has_fxsr) +if (!boot_cpu_has (X86_FEATURE_FXSR ))return user_regset_copyout (&pos, &count, &kbuf, &ubuf, &fpu->state.fsave,0 ,-1 );
@@ -309,7 +312,7 @@ int fpregs_set(struct task_struct *target, const struct user_regset *regset,if (!static_cpu_has (X86_FEATURE_FPU ))return fpregs_soft_set (target, regset, pos, count, kbuf, ubuf); -if (!cpu_has_fxsr) +if (!boot_cpu_has (X86_FEATURE_FXSR ))return user_regset_copyin (&pos, &count, &kbuf, &ubuf, &fpu->state.fsave,0 ,-1 );
Signature · 1 line
2.7.3
tip-bot for Borislav Petkov
merge bot[tip:x86/asm] x86/cpufeature: Replace cpu_has_fxsr with boot_cpu_has() usage
x86/cpufeature: Replace cpu_has_fxsr with boot_cpu_has() usage
Commit-ID: 01f8fd7379149fb9a4046e76617958bf771f856f Gitweb: http://git.kernel.org/tip/01f8fd7379149fb9a4046e76617958bf771f856f Author: Borislav Petkov <[email protected]> AuthorDate: Mon, 4 Apr 2016 22:25:01 +0200 Committer: Ingo Molnar <[email protected]> CommitDate: Wed, 13 Apr 2016 11:37:41 +0200
x86/cpufeature: Replace cpu_has_fxsr with boot_cpu_has() usage
--- arch/x86/include/asm/cpufeature.h | 1 - arch/x86/kernel/fpu/core.c | 6 +++--- arch/x86/kernel/fpu/init.c | 6 +++--- arch/x86/kernel/fpu/regset.c | 13 ++++++++----- 4 files changed, 14 insertions(+), 12 deletions(-)
arch/x86/include/asm/cpufeature.h +0 -1
@@ -118,7 +118,6 @@ extern const char * const x86_bug_flags[NBUGINTS*32];set_bit (bit, (unsigned long *)cpu_caps_set); \ } while (0) -#define cpu_has_fxsr boot_cpu_has(X86_FEATURE_FXSR)#define cpu_has_xsave boot_cpu_has(X86_FEATURE_XSAVE)#define cpu_has_xsaves boot_cpu_has(X86_FEATURE_XSAVES)/*
arch/x86/kernel/fpu/core.c +3 -3
@@ -224,7 +224,7 @@ void fpstate_init(union fpregs_state *state)memset (state,0 , xstate_size); -if (cpu_has_fxsr) +if (static_cpu_has (X86_FEATURE_FXSR ))fpstate_init_fxstate (&state->fxsave);else fpstate_init_fstate (&state->fsave);
@@ -508,7 +508,7 @@ void fpu__clear(struct fpu *fpu)static inline unsigned short get_fpu_cwd (struct fpu *fpu) { -if (cpu_has_fxsr) { +if (boot_cpu_has (X86_FEATURE_FXSR )) {return fpu->state.fxsave.cwd; }else {return (unsigned short )fpu->state.fsave.cwd;
@@ -517,7 +517,7 @@ static inline unsigned short get_fpu_cwd(struct fpu *fpu)static inline unsigned short get_fpu_swd (struct fpu *fpu) { -if (cpu_has_fxsr) { +if (boot_cpu_has (X86_FEATURE_FXSR )) {return fpu->state.fxsave.swd; }else {return (unsigned short )fpu->state.fsave.swd;
arch/x86/kernel/fpu/init.c +3 -3
@@ -29,7 +29,7 @@ static void fpu__init_cpu_generic(void)unsigned long cr0;unsigned long cr4_mask =0 ; -if (cpu_has_fxsr) +if (boot_cpu_has (X86_FEATURE_FXSR )) cr4_mask |=X86_CR4_OSFXSR ;if (boot_cpu_has (X86_FEATURE_XMM )) cr4_mask |=X86_CR4_OSXMMEXCPT ;
@@ -106,7 +106,7 @@ static void __init fpu__init_system_mxcsr(void) {unsigned int mask =0 ; -if (cpu_has_fxsr) { +if (boot_cpu_has (X86_FEATURE_FXSR )) {/* Static because GCC does not get 16-byte stack alignment right: */ static struct fxregs_state fxregs__initdata ;
@@ -221,7 +221,7 @@ static void __init fpu__init_system_xstate_size_legacy(void)setup_clear_cpu_cap (X86_FEATURE_XSAVEOPT ); xstate_size =sizeof (struct swregs_state ); }else { -if (cpu_has_fxsr) +if (boot_cpu_has (X86_FEATURE_FXSR )) xstate_size =sizeof (struct fxregs_state );else xstate_size =sizeof (struct fregs_state );
arch/x86/kernel/fpu/regset.c +8 -5
@@ -21,7 +21,10 @@ int regset_xregset_fpregs_active(struct task_struct *target, const struct user_r {struct fpu *target_fpu = &target->thread.fpu; -return (cpu_has_fxsr && target_fpu->fpstate_active) ? regset->n :0 ; +if (boot_cpu_has (X86_FEATURE_FXSR ) && target_fpu->fpstate_active) +return regset->n; +else +return 0 ; } int xfpregs_get(struct task_struct *target, const struct user_regset *regset,
@@ -30,7 +33,7 @@ int xfpregs_get(struct task_struct *target, const struct user_regset *regset, {struct fpu *fpu = &target->thread.fpu; -if (!cpu_has_fxsr) +if (!boot_cpu_has (X86_FEATURE_FXSR ))return -ENODEV ;fpu__activate_fpstate_read (fpu);
@@ -47,7 +50,7 @@ int xfpregs_set(struct task_struct *target, const struct user_regset *regset,struct fpu *fpu = &target->thread.fpu;int ret; -if (!cpu_has_fxsr) +if (!boot_cpu_has (X86_FEATURE_FXSR ))return -ENODEV ;fpu__activate_fpstate_write (fpu);
@@ -278,7 +281,7 @@ int fpregs_get(struct task_struct *target, const struct user_regset *regset,if (!static_cpu_has (X86_FEATURE_FPU ))return fpregs_soft_get (target, regset, pos, count, kbuf, ubuf); -if (!cpu_has_fxsr) +if (!boot_cpu_has (X86_FEATURE_FXSR ))return user_regset_copyout (&pos, &count, &kbuf, &ubuf, &fpu->state.fsave,0 ,-1 );
@@ -309,7 +312,7 @@ int fpregs_set(struct task_struct *target, const struct user_regset *regset,if (!static_cpu_has (X86_FEATURE_FPU ))return fpregs_soft_set (target, regset, pos, count, kbuf, ubuf); -if (!cpu_has_fxsr) +if (!boot_cpu_has (X86_FEATURE_FXSR ))return user_regset_copyin (&pos, &count, &kbuf, &ubuf, &fpu->state.fsave,0 ,-1 );
Borislav Petkov
maintainerPATCH 9/10 x86/cpufeature: Remove cpu_has_xsave
In reply to Borislav PetkovFrom: Borislav Petkov <[email protected]>
--- arch/x86/ia32/ia32_signal.c | 2 +- arch/x86/include/asm/cpufeature.h | 1 - arch/x86/kernel/fpu/regset.c | 8 ++++---- arch/x86/kernel/fpu/xstate.c | 8 ++++---- arch/x86/kernel/signal.c | 4 ++-- arch/x86/kvm/cpuid.c | 2 +- arch/x86/kvm/x86.c | 12 ++++++------ 7 files changed, 18 insertions(+), 19 deletions(-)
arch/x86/ia32/ia32_signal.c +1 -1
@@ -357,7 +357,7 @@ int ia32_setup_rt_frame(int sig, struct ksignal *ksig,put_user_ex (ptr_to_compat (&frame->uc), &frame->puc);/* Create the ucontext. */ -if (cpu_has_xsave) +if (boot_cpu_has (X86_FEATURE_XSAVE ))put_user_ex (UC_FP_XSTATE , &frame->uc.uc_flags);else put_user_ex (0 , &frame->uc.uc_flags);
arch/x86/include/asm/cpufeature.h +0 -1
@@ -118,7 +118,6 @@ extern const char * const x86_bug_flags[NBUGINTS*32];set_bit (bit, (unsigned long *)cpu_caps_set); \ } while (0) -#define cpu_has_xsave boot_cpu_has(X86_FEATURE_XSAVE)#define cpu_has_xsaves boot_cpu_has(X86_FEATURE_XSAVES)/* * Do not add any more of those clumsy macros - use static_cpu_has() for
arch/x86/kernel/fpu/regset.c +4 -4
@@ -68,7 +68,7 @@ int xfpregs_set(struct task_struct *target, const struct user_regset *regset,* update the header bits in the xsave header, indicating the * presence of FP and SSE state. */ -if (cpu_has_xsave) +if (boot_cpu_has (X86_FEATURE_XSAVE )) fpu->state.xsave.header.xfeatures |=XFEATURE_MASK_FPSSE ;return ret;
@@ -82,7 +82,7 @@ int xstateregs_get(struct task_struct *target, const struct user_regset *regset,struct xregs_state *xsave;int ret; -if (!cpu_has_xsave) +if (!boot_cpu_has (X86_FEATURE_XSAVE ))return -ENODEV ;fpu__activate_fpstate_read (fpu);
@@ -111,7 +111,7 @@ int xstateregs_set(struct task_struct *target, const struct user_regset *regset,struct xregs_state *xsave;int ret; -if (!cpu_has_xsave) +if (!boot_cpu_has (X86_FEATURE_XSAVE ))return -ENODEV ;fpu__activate_fpstate_write (fpu);
@@ -328,7 +328,7 @@ int fpregs_set(struct task_struct *target, const struct user_regset *regset,* update the header bit in the xsave header, indicating the * presence of FP. */ -if (cpu_has_xsave) +if (boot_cpu_has (X86_FEATURE_XSAVE )) fpu->state.xsave.header.xfeatures |=XFEATURE_MASK_FP ;return ret; }
arch/x86/kernel/fpu/xstate.c +4 -4
@@ -190,7 +190,7 @@ void fpstate_sanitize_xstate(struct fpu *fpu)*/ void fpu__init_cpu_xstate (void ) { -if (!cpu_has_xsave || !xfeatures_mask) +if (!boot_cpu_has (X86_FEATURE_XSAVE ) || !xfeatures_mask)return ;cr4_set_bits (X86_CR4_OSXSAVE );
@@ -316,7 +316,7 @@ static void __init setup_init_fpu_buf(void)WARN_ON_FPU (!on_boot_cpu); on_boot_cpu =0 ; -if (!cpu_has_xsave) +if (!boot_cpu_has (X86_FEATURE_XSAVE ))return ;setup_xstate_features ();
@@ -630,7 +630,7 @@ void __init fpu__init_system_xstate(void)WARN_ON_FPU (!on_boot_cpu); on_boot_cpu =0 ; -if (!cpu_has_xsave) { +if (!boot_cpu_has (X86_FEATURE_XSAVE )) {pr_info ("x86/fpu: Legacy x87 FPU detected.\n" );return ; }
@@ -678,7 +678,7 @@ void fpu__resume_cpu(void)/* * Restore XCR0 on xsave capable CPUs: */ -if (cpu_has_xsave) +if (boot_cpu_has (X86_FEATURE_XSAVE ))xsetbv (XCR_XFEATURE_ENABLED_MASK , xfeatures_mask); }
arch/x86/kernel/signal.c +2 -2
@@ -391,7 +391,7 @@ static int __setup_rt_frame(int sig, struct ksignal *ksig,put_user_ex (&frame->uc, &frame->puc);/* Create the ucontext. */ -if (cpu_has_xsave) +if (boot_cpu_has (X86_FEATURE_XSAVE ))put_user_ex (UC_FP_XSTATE , &frame->uc.uc_flags);else put_user_ex (0 , &frame->uc.uc_flags);
@@ -442,7 +442,7 @@ static unsigned long frame_uc_flags(struct pt_regs *regs) {unsigned long flags; -if (cpu_has_xsave) +if (boot_cpu_has (X86_FEATURE_XSAVE )) flags =UC_FP_XSTATE |UC_SIGCONTEXT_SS ;else flags =UC_SIGCONTEXT_SS ;
arch/x86/kvm/cpuid.c +1 -1
@@ -75,7 +75,7 @@ int kvm_update_cpuid(struct kvm_vcpu *vcpu)return 0 ;/* Update OSXSAVE bit */ -if (cpu_has_xsave && best->function ==0x1 ) { +if (boot_cpu_has (X86_FEATURE_XSAVE ) && best->function ==0x1 ) { best->ecx &= ~F (OSXSAVE );if (kvm_read_cr4_bits (vcpu,X86_CR4_OSXSAVE )) best->ecx |=F (OSXSAVE );
arch/x86/kvm/x86.c +6 -6
@@ -2612,7 +2612,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext) r =KVM_MAX_MCE_BANKS ;break ;case KVM_CAP_XCRS : - r = cpu_has_xsave; + r =boot_cpu_has (X86_FEATURE_XSAVE );break ;case KVM_CAP_TSC_CONTROL : r = kvm_has_tsc_control;
@@ -3122,7 +3122,7 @@ static void load_xsave(struct kvm_vcpu *vcpu, u8 *src)static void kvm_vcpu_ioctl_x86_get_xsave (struct kvm_vcpu *vcpu,struct kvm_xsave *guest_xsave) { -if (cpu_has_xsave) { +if (boot_cpu_has (X86_FEATURE_XSAVE )) {memset (guest_xsave,0 ,sizeof (struct kvm_xsave ));fill_xsave ((u8 *) guest_xsave->region, vcpu); }else {
@@ -3140,7 +3140,7 @@ static int kvm_vcpu_ioctl_x86_set_xsave(struct kvm_vcpu *vcpu,u64 xstate_bv = *(u64 *)&guest_xsave->region[XSAVE_HDR_OFFSET /sizeof (u32)]; -if (cpu_has_xsave) { +if (boot_cpu_has (X86_FEATURE_XSAVE )) {/* * Here we allow setting states that are not present in * CPUID leaf 0xD, index 0, EDX:EAX. This is for compatibility
@@ -3161,7 +3161,7 @@ static int kvm_vcpu_ioctl_x86_set_xsave(struct kvm_vcpu *vcpu,static void kvm_vcpu_ioctl_x86_get_xcrs (struct kvm_vcpu *vcpu,struct kvm_xcrs *guest_xcrs) { -if (!cpu_has_xsave) { +if (!boot_cpu_has (X86_FEATURE_XSAVE )) { guest_xcrs->nr_xcrs =0 ;return ; }
@@ -3177,7 +3177,7 @@ static int kvm_vcpu_ioctl_x86_set_xcrs(struct kvm_vcpu *vcpu, {int i, r =0 ; -if (!cpu_has_xsave) +if (!boot_cpu_has (X86_FEATURE_XSAVE ))return -EINVAL ;if (guest_xcrs->nr_xcrs >KVM_MAX_XCRS || guest_xcrs->flags)
@@ -5866,7 +5866,7 @@ int kvm_arch_init(void *opaque)perf_register_guest_info_callbacks (&kvm_guest_cbs); -if (cpu_has_xsave) +if (boot_cpu_has (X86_FEATURE_XSAVE )) host_xcr0 =xgetbv (XCR_XFEATURE_ENABLED_MASK );kvm_lapic_init ();
Signature · 1 line
2.7.3
tip-bot for Borislav Petkov
merge bot[tip:x86/asm] x86/cpufeature: Replace cpu_has_xsave with boot_cpu_has() usage
x86/cpufeature: Replace cpu_has_xsave with boot_cpu_has() usage
Commit-ID: d366bf7eb99d0644e47ecd52c184d7ad95df02f2 Gitweb: http://git.kernel.org/tip/d366bf7eb99d0644e47ecd52c184d7ad95df02f2 Author: Borislav Petkov <[email protected]> AuthorDate: Mon, 4 Apr 2016 22:25:02 +0200 Committer: Ingo Molnar <[email protected]> CommitDate: Wed, 13 Apr 2016 11:37:41 +0200
x86/cpufeature: Replace cpu_has_xsave with boot_cpu_has() usage
--- arch/x86/ia32/ia32_signal.c | 2 +- arch/x86/include/asm/cpufeature.h | 1 - arch/x86/kernel/fpu/regset.c | 8 ++++---- arch/x86/kernel/fpu/xstate.c | 8 ++++---- arch/x86/kernel/signal.c | 4 ++-- arch/x86/kvm/cpuid.c | 2 +- arch/x86/kvm/x86.c | 12 ++++++------ 7 files changed, 18 insertions(+), 19 deletions(-)
arch/x86/ia32/ia32_signal.c +1 -1
@@ -357,7 +357,7 @@ int ia32_setup_rt_frame(int sig, struct ksignal *ksig,put_user_ex (ptr_to_compat (&frame->uc), &frame->puc);/* Create the ucontext. */ -if (cpu_has_xsave) +if (boot_cpu_has (X86_FEATURE_XSAVE ))put_user_ex (UC_FP_XSTATE , &frame->uc.uc_flags);else put_user_ex (0 , &frame->uc.uc_flags);
arch/x86/include/asm/cpufeature.h +0 -1
@@ -118,7 +118,6 @@ extern const char * const x86_bug_flags[NBUGINTS*32];set_bit (bit, (unsigned long *)cpu_caps_set); \ } while (0) -#define cpu_has_xsave boot_cpu_has(X86_FEATURE_XSAVE)#define cpu_has_xsaves boot_cpu_has(X86_FEATURE_XSAVES)/* * Do not add any more of those clumsy macros - use static_cpu_has() for
arch/x86/kernel/fpu/regset.c +4 -4
@@ -68,7 +68,7 @@ int xfpregs_set(struct task_struct *target, const struct user_regset *regset,* update the header bits in the xsave header, indicating the * presence of FP and SSE state. */ -if (cpu_has_xsave) +if (boot_cpu_has (X86_FEATURE_XSAVE )) fpu->state.xsave.header.xfeatures |=XFEATURE_MASK_FPSSE ;return ret;
@@ -82,7 +82,7 @@ int xstateregs_get(struct task_struct *target, const struct user_regset *regset,struct xregs_state *xsave;int ret; -if (!cpu_has_xsave) +if (!boot_cpu_has (X86_FEATURE_XSAVE ))return -ENODEV ;fpu__activate_fpstate_read (fpu);
@@ -111,7 +111,7 @@ int xstateregs_set(struct task_struct *target, const struct user_regset *regset,struct xregs_state *xsave;int ret; -if (!cpu_has_xsave) +if (!boot_cpu_has (X86_FEATURE_XSAVE ))return -ENODEV ;fpu__activate_fpstate_write (fpu);
@@ -328,7 +328,7 @@ int fpregs_set(struct task_struct *target, const struct user_regset *regset,* update the header bit in the xsave header, indicating the * presence of FP. */ -if (cpu_has_xsave) +if (boot_cpu_has (X86_FEATURE_XSAVE )) fpu->state.xsave.header.xfeatures |=XFEATURE_MASK_FP ;return ret; }
arch/x86/kernel/fpu/xstate.c +4 -4
@@ -190,7 +190,7 @@ void fpstate_sanitize_xstate(struct fpu *fpu)*/ void fpu__init_cpu_xstate (void ) { -if (!cpu_has_xsave || !xfeatures_mask) +if (!boot_cpu_has (X86_FEATURE_XSAVE ) || !xfeatures_mask)return ;cr4_set_bits (X86_CR4_OSXSAVE );
@@ -316,7 +316,7 @@ static void __init setup_init_fpu_buf(void)WARN_ON_FPU (!on_boot_cpu); on_boot_cpu =0 ; -if (!cpu_has_xsave) +if (!boot_cpu_has (X86_FEATURE_XSAVE ))return ;setup_xstate_features ();
@@ -630,7 +630,7 @@ void __init fpu__init_system_xstate(void)WARN_ON_FPU (!on_boot_cpu); on_boot_cpu =0 ; -if (!cpu_has_xsave) { +if (!boot_cpu_has (X86_FEATURE_XSAVE )) {pr_info ("x86/fpu: Legacy x87 FPU detected.\n" );return ; }
@@ -678,7 +678,7 @@ void fpu__resume_cpu(void)/* * Restore XCR0 on xsave capable CPUs: */ -if (cpu_has_xsave) +if (boot_cpu_has (X86_FEATURE_XSAVE ))xsetbv (XCR_XFEATURE_ENABLED_MASK , xfeatures_mask); }
arch/x86/kernel/signal.c +2 -2
@@ -391,7 +391,7 @@ static int __setup_rt_frame(int sig, struct ksignal *ksig,put_user_ex (&frame->uc, &frame->puc);/* Create the ucontext. */ -if (cpu_has_xsave) +if (boot_cpu_has (X86_FEATURE_XSAVE ))put_user_ex (UC_FP_XSTATE , &frame->uc.uc_flags);else put_user_ex (0 , &frame->uc.uc_flags);
@@ -442,7 +442,7 @@ static unsigned long frame_uc_flags(struct pt_regs *regs) {unsigned long flags; -if (cpu_has_xsave) +if (boot_cpu_has (X86_FEATURE_XSAVE )) flags =UC_FP_XSTATE |UC_SIGCONTEXT_SS ;else flags =UC_SIGCONTEXT_SS ;
arch/x86/kvm/cpuid.c +1 -1
@@ -75,7 +75,7 @@ int kvm_update_cpuid(struct kvm_vcpu *vcpu)return 0 ;/* Update OSXSAVE bit */ -if (cpu_has_xsave && best->function ==0x1 ) { +if (boot_cpu_has (X86_FEATURE_XSAVE ) && best->function ==0x1 ) { best->ecx &= ~F (OSXSAVE );if (kvm_read_cr4_bits (vcpu,X86_CR4_OSXSAVE )) best->ecx |=F (OSXSAVE );
arch/x86/kvm/x86.c +6 -6
@@ -2612,7 +2612,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext) r =KVM_MAX_MCE_BANKS ;break ;case KVM_CAP_XCRS : - r = cpu_has_xsave; + r =boot_cpu_has (X86_FEATURE_XSAVE );break ;case KVM_CAP_TSC_CONTROL : r = kvm_has_tsc_control;
@@ -3122,7 +3122,7 @@ static void load_xsave(struct kvm_vcpu *vcpu, u8 *src)static void kvm_vcpu_ioctl_x86_get_xsave (struct kvm_vcpu *vcpu,struct kvm_xsave *guest_xsave) { -if (cpu_has_xsave) { +if (boot_cpu_has (X86_FEATURE_XSAVE )) {memset (guest_xsave,0 ,sizeof (struct kvm_xsave ));fill_xsave ((u8 *) guest_xsave->region, vcpu); }else {
@@ -3140,7 +3140,7 @@ static int kvm_vcpu_ioctl_x86_set_xsave(struct kvm_vcpu *vcpu,u64 xstate_bv = *(u64 *)&guest_xsave->region[XSAVE_HDR_OFFSET /sizeof (u32)]; -if (cpu_has_xsave) { +if (boot_cpu_has (X86_FEATURE_XSAVE )) {/* * Here we allow setting states that are not present in * CPUID leaf 0xD, index 0, EDX:EAX. This is for compatibility
@@ -3161,7 +3161,7 @@ static int kvm_vcpu_ioctl_x86_set_xsave(struct kvm_vcpu *vcpu,static void kvm_vcpu_ioctl_x86_get_xcrs (struct kvm_vcpu *vcpu,struct kvm_xcrs *guest_xcrs) { -if (!cpu_has_xsave) { +if (!boot_cpu_has (X86_FEATURE_XSAVE )) { guest_xcrs->nr_xcrs =0 ;return ; }
@@ -3177,7 +3177,7 @@ static int kvm_vcpu_ioctl_x86_set_xcrs(struct kvm_vcpu *vcpu, {int i, r =0 ; -if (!cpu_has_xsave) +if (!boot_cpu_has (X86_FEATURE_XSAVE ))return -EINVAL ;if (guest_xcrs->nr_xcrs >KVM_MAX_XCRS || guest_xcrs->flags)
@@ -5866,7 +5866,7 @@ int kvm_arch_init(void *opaque)perf_register_guest_info_callbacks (&kvm_guest_cbs); -if (cpu_has_xsave) +if (boot_cpu_has (X86_FEATURE_XSAVE )) host_xcr0 =xgetbv (XCR_XFEATURE_ENABLED_MASK );kvm_lapic_init ();
Borislav Petkov
maintainerPATCH 10/10 x86/cpufeature: Remove cpu_has_xsaves
In reply to Borislav PetkovFrom: Borislav Petkov <[email protected]>
--- arch/x86/include/asm/cpufeature.h | 6 ------ arch/x86/kernel/fpu/xstate.c | 10 +++++----- arch/x86/kvm/vmx.c | 2 +- arch/x86/kvm/x86.c | 4 ++-- 4 files changed, 8 insertions(+), 14 deletions(-)
arch/x86/include/asm/cpufeature.h +0 -6
@@ -118,12 +118,6 @@ extern const char * const x86_bug_flags[NBUGINTS*32];set_bit (bit, (unsigned long *)cpu_caps_set); \ } while (0) -#define cpu_has_xsaves boot_cpu_has(X86_FEATURE_XSAVES) -/* -* Do not add any more of those clumsy macros - use static_cpu_has() for -* fast paths and boot_cpu_has() otherwise! -*/ -#if defined(CC_HAVE_ASM_GOTO ) && defined(CONFIG_X86_FAST_FEATURE_TESTS )/* * Static testing of CPU features. Used the same as boot_cpu_has().
arch/x86/kernel/fpu/xstate.c +5 -5
@@ -280,7 +280,7 @@ static void __init setup_xstate_comp(void) xstate_comp_offsets[0 ] =0 ; xstate_comp_offsets[1 ] = offsetof(struct fxregs_state , xmm_space); -if (!cpu_has_xsaves) { +if (!boot_cpu_has (X86_FEATURE_XSAVES )) {for (i =FIRST_EXTENDED_XFEATURE ; i <XFEATURE_MAX ; i++) {if (xfeature_enabled (i)) { xstate_comp_offsets[i] = xstate_offsets[i];
@@ -322,7 +322,7 @@ static void __init setup_init_fpu_buf(void)setup_xstate_features ();print_xstate_features (); -if (cpu_has_xsaves) { +if (boot_cpu_has (X86_FEATURE_XSAVES )) { init_fpstate.xsave.header.xcomp_bv = (u64 )1 <<63 | xfeatures_mask; init_fpstate.xsave.header.xfeatures = xfeatures_mask; }
@@ -417,7 +417,7 @@ static int xfeature_size(int xfeature_nr)*/ static int using_compacted_format (void ) { -return cpu_has_xsaves; +return boot_cpu_has (X86_FEATURE_XSAVES ); }static void __xstate_dump_leaves (void )
@@ -549,7 +549,7 @@ static unsigned int __init calculate_xstate_size(void)unsigned int eax, ebx, ecx, edx;unsigned int calculated_xstate_size; -if (!cpu_has_xsaves) { +if (!boot_cpu_has (X86_FEATURE_XSAVES )) {/* * - CPUID function 0DH, sub-function 0: * EBX enumerates the size (in bytes) required by
@@ -667,7 +667,7 @@ void __init fpu__init_system_xstate(void)pr_info ("x86/fpu: Enabled xstate features 0x%llx, context size is %d bytes, using '%s' format.\n" , xfeatures_mask, xstate_size, - cpu_has_xsaves ?"compacted" :"standard" ); +boot_cpu_has (X86_FEATURE_XSAVES ) ?"compacted" :"standard" ); }/*
arch/x86/kvm/vmx.c +1 -1
@@ -3386,7 +3386,7 @@ static __init int setup_vmcs_config(struct vmcs_config *vmcs_conf) } } -if (cpu_has_xsaves) +if (boot_cpu_has (X86_FEATURE_XSAVES ))rdmsrl (MSR_IA32_XSS , host_xss);return 0 ;
arch/x86/kvm/x86.c +2 -2
@@ -3095,7 +3095,7 @@ static void load_xsave(struct kvm_vcpu *vcpu, u8 *src)/* Set XSTATE_BV and possibly XCOMP_BV. */ xsave->header.xfeatures = xstate_bv; -if (cpu_has_xsaves) +if (boot_cpu_has (X86_FEATURE_XSAVES )) xsave->header.xcomp_bv = host_xcr0 |XSTATE_COMPACTION_ENABLED ;/*
@@ -7292,7 +7292,7 @@ int kvm_arch_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)static void fx_init (struct kvm_vcpu *vcpu) {fpstate_init (&vcpu->arch.guest_fpu.state); -if (cpu_has_xsaves) +if (boot_cpu_has (X86_FEATURE_XSAVES )) vcpu->arch.guest_fpu.state.xsave.header.xcomp_bv = host_xcr0 |XSTATE_COMPACTION_ENABLED ;
Signature · 1 line
2.7.3
tip-bot for Borislav Petkov
merge bot[tip:x86/asm] x86/cpufeature: Replace cpu_has_xsaves with boot_cpu_has() usage
x86/cpufeature: Replace cpu_has_xsaves with boot_cpu_has() usage
Commit-ID: 782511b00f749cfebc0cb5d6ce960de5410c221d Gitweb: http://git.kernel.org/tip/782511b00f749cfebc0cb5d6ce960de5410c221d Author: Borislav Petkov <[email protected]> AuthorDate: Mon, 4 Apr 2016 22:25:03 +0200 Committer: Ingo Molnar <[email protected]> CommitDate: Wed, 13 Apr 2016 11:37:42 +0200
x86/cpufeature: Replace cpu_has_xsaves with boot_cpu_has() usage
--- arch/x86/include/asm/cpufeature.h | 6 ------ arch/x86/kernel/fpu/xstate.c | 10 +++++----- arch/x86/kvm/vmx.c | 2 +- arch/x86/kvm/x86.c | 4 ++-- 4 files changed, 8 insertions(+), 14 deletions(-)
arch/x86/include/asm/cpufeature.h +0 -6
@@ -118,12 +118,6 @@ extern const char * const x86_bug_flags[NBUGINTS*32];set_bit (bit, (unsigned long *)cpu_caps_set); \ } while (0) -#define cpu_has_xsaves boot_cpu_has(X86_FEATURE_XSAVES) -/* -* Do not add any more of those clumsy macros - use static_cpu_has() for -* fast paths and boot_cpu_has() otherwise! -*/ -#if defined(CC_HAVE_ASM_GOTO ) && defined(CONFIG_X86_FAST_FEATURE_TESTS )/* * Static testing of CPU features. Used the same as boot_cpu_has().
arch/x86/kernel/fpu/xstate.c +5 -5
@@ -280,7 +280,7 @@ static void __init setup_xstate_comp(void) xstate_comp_offsets[0 ] =0 ; xstate_comp_offsets[1 ] = offsetof(struct fxregs_state , xmm_space); -if (!cpu_has_xsaves) { +if (!boot_cpu_has (X86_FEATURE_XSAVES )) {for (i =FIRST_EXTENDED_XFEATURE ; i <XFEATURE_MAX ; i++) {if (xfeature_enabled (i)) { xstate_comp_offsets[i] = xstate_offsets[i];
@@ -322,7 +322,7 @@ static void __init setup_init_fpu_buf(void)setup_xstate_features ();print_xstate_features (); -if (cpu_has_xsaves) { +if (boot_cpu_has (X86_FEATURE_XSAVES )) { init_fpstate.xsave.header.xcomp_bv = (u64 )1 <<63 | xfeatures_mask; init_fpstate.xsave.header.xfeatures = xfeatures_mask; }
@@ -417,7 +417,7 @@ static int xfeature_size(int xfeature_nr)*/ static int using_compacted_format (void ) { -return cpu_has_xsaves; +return boot_cpu_has (X86_FEATURE_XSAVES ); }static void __xstate_dump_leaves (void )
@@ -549,7 +549,7 @@ static unsigned int __init calculate_xstate_size(void)unsigned int eax, ebx, ecx, edx;unsigned int calculated_xstate_size; -if (!cpu_has_xsaves) { +if (!boot_cpu_has (X86_FEATURE_XSAVES )) {/* * - CPUID function 0DH, sub-function 0: * EBX enumerates the size (in bytes) required by
@@ -667,7 +667,7 @@ void __init fpu__init_system_xstate(void)pr_info ("x86/fpu: Enabled xstate features 0x%llx, context size is %d bytes, using '%s' format.\n" , xfeatures_mask, xstate_size, - cpu_has_xsaves ?"compacted" :"standard" ); +boot_cpu_has (X86_FEATURE_XSAVES ) ?"compacted" :"standard" ); }/*
arch/x86/kvm/vmx.c +1 -1
@@ -3386,7 +3386,7 @@ static __init int setup_vmcs_config(struct vmcs_config *vmcs_conf) } } -if (cpu_has_xsaves) +if (boot_cpu_has (X86_FEATURE_XSAVES ))rdmsrl (MSR_IA32_XSS , host_xss);return 0 ;
arch/x86/kvm/x86.c +2 -2
@@ -3095,7 +3095,7 @@ static void load_xsave(struct kvm_vcpu *vcpu, u8 *src)/* Set XSTATE_BV and possibly XCOMP_BV. */ xsave->header.xfeatures = xstate_bv; -if (cpu_has_xsaves) +if (boot_cpu_has (X86_FEATURE_XSAVES )) xsave->header.xcomp_bv = host_xcr0 |XSTATE_COMPACTION_ENABLED ;/*
@@ -7292,7 +7292,7 @@ int kvm_arch_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)static void fx_init (struct kvm_vcpu *vcpu) {fpstate_init (&vcpu->arch.guest_fpu.state); -if (cpu_has_xsaves) +if (boot_cpu_has (X86_FEATURE_XSAVES )) vcpu->arch.guest_fpu.state.xsave.header.xcomp_bv = host_xcr0 |XSTATE_COMPACTION_ENABLED ;