linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: tip-bot for Borislav Petkov <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: brgerst@gmail.com, luto@amacapital.net,
	torvalds@linux-foundation.org, linux-kernel@vger.kernel.org,
	kvm@vger.kernel.org, dvlasenk@redhat.com, tglx@linutronix.de,
	bp@alien8.de, mingo@kernel.org, hpa@zytor.com,
	peterz@infradead.org, bp@suse.de
Subject: [tip:x86/asm] x86/cpufeature: Replace cpu_has_xsaves with boot_cpu_has() usage
Date: Wed, 13 Apr 2016 04:40:35 -0700	[thread overview]
Message-ID: <tip-782511b00f749cfebc0cb5d6ce960de5410c221d@git.kernel.org> (raw)
In-Reply-To: <1459801503-15600-11-git-send-email-bp@alien8.de>

Commit-ID:  782511b00f749cfebc0cb5d6ce960de5410c221d
Gitweb:     http://git.kernel.org/tip/782511b00f749cfebc0cb5d6ce960de5410c221d
Author:     Borislav Petkov <bp@suse.de>
AuthorDate: Mon, 4 Apr 2016 22:25:03 +0200
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 13 Apr 2016 11:37:42 +0200

x86/cpufeature: Replace cpu_has_xsaves with boot_cpu_has() usage

Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: <kvm@vger.kernel.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1459801503-15600-11-git-send-email-bp@alien8.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 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(-)

diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
index 732a00f..07c942d 100644
--- a/arch/x86/include/asm/cpufeature.h
+++ b/arch/x86/include/asm/cpufeature.h
@@ -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().
diff --git a/arch/x86/kernel/fpu/xstate.c b/arch/x86/kernel/fpu/xstate.c
index 18b9fd8..4ea2a59 100644
--- a/arch/x86/kernel/fpu/xstate.c
+++ b/arch/x86/kernel/fpu/xstate.c
@@ -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");
 }
 
 /*
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index ee1c8a9..d5908bd 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -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;
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 4eb2fca..33102de 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -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;
 

      reply	other threads:[~2016-04-13 11:41 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-04 20:24 [PATCH 00/10] x86/cpufeature: Bye bye cpu_has_YYY Borislav Petkov
2016-04-04 20:24 ` [PATCH 01/10] x86/cpufeature: Remove cpu_has_avx2 Borislav Petkov
2016-04-13 11:37   ` [tip:x86/asm] x86/cpufeature: Replace cpu_has_avx2 with boot_cpu_has() usage tip-bot for Borislav Petkov
2016-04-04 20:24 ` [PATCH 02/10] x86/cpufeature: Remove cpu_has_aes Borislav Petkov
2016-04-13 11:37   ` [tip:x86/asm] x86/cpufeature: Replace cpu_has_aes with boot_cpu_has() usage tip-bot for Borislav Petkov
2016-04-04 20:24 ` [PATCH 03/10] x86/cpufeature: Remove cpu_has_avx Borislav Petkov
2016-04-13 11:37   ` [tip:x86/asm] x86/cpufeature: Replace cpu_has_avx with boot_cpu_has() usage tip-bot for Borislav Petkov
2016-04-04 20:24 ` [PATCH 04/10] x86/cpufeature: Remove cpu_has_xmm Borislav Petkov
2016-04-13 11:38   ` [tip:x86/asm] x86/cpufeature: Replace cpu_has_xmm with boot_cpu_has() usage tip-bot for Borislav Petkov
2016-04-04 20:24 ` [PATCH 05/10] x86/cpufeature: Remove cpu_has_fpu Borislav Petkov
2016-04-13 11:38   ` [tip:x86/asm] x86/cpufeature: Replace cpu_has_fpu with boot_cpu_has() usage tip-bot for Borislav Petkov
2016-04-04 20:24 ` [PATCH 06/10] x86/cpufeature: Remove cpu_has_tsc Borislav Petkov
2016-04-13 11:39   ` [tip:x86/asm] x86/cpufeature: Replace cpu_has_tsc with boot_cpu_has() usage tip-bot for Borislav Petkov
2016-04-04 20:25 ` [PATCH 07/10] x86/cpufeature: Remove cpu_has_apic Borislav Petkov
2016-04-13 11:39   ` [tip:x86/asm] x86/cpufeature: Replace cpu_has_apic with boot_cpu_has() usage tip-bot for Borislav Petkov
2016-04-04 20:25 ` [PATCH 08/10] x86/cpufeature: Remove cpu_has_fxsr Borislav Petkov
2016-04-13 11:39   ` [tip:x86/asm] x86/cpufeature: Replace cpu_has_fxsr with boot_cpu_has() usage tip-bot for Borislav Petkov
2016-04-04 20:25 ` [PATCH 09/10] x86/cpufeature: Remove cpu_has_xsave Borislav Petkov
2016-04-13 11:40   ` [tip:x86/asm] x86/cpufeature: Replace cpu_has_xsave with boot_cpu_has() usage tip-bot for Borislav Petkov
2016-04-04 20:25 ` [PATCH 10/10] x86/cpufeature: Remove cpu_has_xsaves Borislav Petkov
2016-04-13 11:40   ` tip-bot for Borislav Petkov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-782511b00f749cfebc0cb5d6ce960de5410c221d@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=bp@alien8.de \
    --cc=bp@suse.de \
    --cc=brgerst@gmail.com \
    --cc=dvlasenk@redhat.com \
    --cc=hpa@zytor.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).