linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Radim Krčmář" <rkrcmar@redhat.com>
To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	David Hildenbrand <david@redhat.com>
Subject: [PATCH v2 1/3] KVM: x86: X86_FEATURE_NRIPS is not scattered anymore
Date: Sat,  5 Aug 2017 00:12:48 +0200	[thread overview]
Message-ID: <20170804221250.27674-2-rkrcmar@redhat.com> (raw)
In-Reply-To: <20170804221250.27674-1-rkrcmar@redhat.com>

bit(X86_FEATURE_NRIPS) is 3 since 2ccd71f1b278 ("x86/cpufeature: Move
some of the scattered feature bits to x86_capability"), so we can
simplify the code.

Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
---
v2: new, explain why it's ok to use X86_FEATURE_NRIPS (David)
---
 arch/x86/kvm/cpuid.h | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/arch/x86/kvm/cpuid.h b/arch/x86/kvm/cpuid.h
index da6728383052..c723d64657d0 100644
--- a/arch/x86/kvm/cpuid.h
+++ b/arch/x86/kvm/cpuid.h
@@ -160,25 +160,13 @@ static inline bool guest_cpuid_has_rdtscp(struct kvm_vcpu *vcpu)
 	return best && (best->edx & bit(X86_FEATURE_RDTSCP));
 }
 
-/*
- * NRIPS is provided through cpuidfn 0x8000000a.edx bit 3
- */
-#define BIT_NRIPS	3
-
 static inline bool guest_cpuid_has_nrips(struct kvm_vcpu *vcpu)
 {
 	struct kvm_cpuid_entry2 *best;
 
 	best = kvm_find_cpuid_entry(vcpu, 0x8000000a, 0);
-
-	/*
-	 * NRIPS is a scattered cpuid feature, so we can't use
-	 * X86_FEATURE_NRIPS here (X86_FEATURE_NRIPS would be bit
-	 * position 8, not 3).
-	 */
-	return best && (best->edx & bit(BIT_NRIPS));
+	return best && (best->edx & bit(X86_FEATURE_NRIPS));
 }
-#undef BIT_NRIPS
 
 static inline int guest_cpuid_family(struct kvm_vcpu *vcpu)
 {
-- 
2.13.3

  reply	other threads:[~2017-08-04 22:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-04 22:12 [PATCH v2 0/3] KVM: x86: generalize guest cpuid helpers Radim Krčmář
2017-08-04 22:12 ` Radim Krčmář [this message]
2017-08-07  8:29   ` [PATCH v2 1/3] KVM: x86: X86_FEATURE_NRIPS is not scattered anymore David Hildenbrand
2017-08-04 22:12 ` [PATCH v2 2/3] KVM: x86: generalize guest_cpuid_has_ helpers Radim Krčmář
2017-08-07  8:34   ` David Hildenbrand
2017-08-04 22:12 ` [PATCH v2 3/3] KVM: x86: use general helpers for some cpuid manipulation Radim Krčmář
2017-08-07  8:36   ` David Hildenbrand
2017-08-07 14:16 ` [PATCH v2 0/3] KVM: x86: generalize guest cpuid helpers Paolo Bonzini

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=20170804221250.27674-2-rkrcmar@redhat.com \
    --to=rkrcmar@redhat.com \
    --cc=david@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    /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).