All of lore.kernel.org
 help / color / mirror / Atom feed
From: KarimAllah Ahmed <karahmed@amazon.de>
To: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, x86@kernel.org
Cc: "KarimAllah Ahmed" <karahmed@amazon.de>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Radim Krčmář" <rkrcmar@redhat.com>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"Ingo Molnar" <mingo@redhat.com>,
	"H . Peter Anvin" <hpa@zytor.com>,
	"David Woodhouse" <dwmw@amazon.co.uk>
Subject: [PATCH v5 1/5] KVM: x86: Update the reverse_cpuid list to include CPUID_7_EDX
Date: Wed, 31 Jan 2018 20:37:43 +0100	[thread overview]
Message-ID: <1517427467-28567-2-git-send-email-karahmed@amazon.de> (raw)
In-Reply-To: <1517427467-28567-1-git-send-email-karahmed@amazon.de>

[dwmw2: Stop using KF() for bits in it, too]
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Radim Krčmář <rkrcmar@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: x86@kernel.org
Cc: kvm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: KarimAllah Ahmed <karahmed@amazon.de>
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
---
 arch/x86/kvm/cpuid.c | 8 +++-----
 arch/x86/kvm/cpuid.h | 1 +
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
index 0099e10..c0eb337 100644
--- a/arch/x86/kvm/cpuid.c
+++ b/arch/x86/kvm/cpuid.c
@@ -67,9 +67,7 @@ u64 kvm_supported_xcr0(void)
 
 #define F(x) bit(X86_FEATURE_##x)
 
-/* These are scattered features in cpufeatures.h. */
-#define KVM_CPUID_BIT_AVX512_4VNNIW     2
-#define KVM_CPUID_BIT_AVX512_4FMAPS     3
+/* For scattered features from cpufeatures.h; we currently expose none */
 #define KF(x) bit(KVM_CPUID_BIT_##x)
 
 int kvm_update_cpuid(struct kvm_vcpu *vcpu)
@@ -392,7 +390,7 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
 
 	/* cpuid 7.0.edx*/
 	const u32 kvm_cpuid_7_0_edx_x86_features =
-		KF(AVX512_4VNNIW) | KF(AVX512_4FMAPS);
+		F(AVX512_4VNNIW) | F(AVX512_4FMAPS);
 
 	/* all calls to cpuid_count() should be made on the same cpu */
 	get_cpu();
@@ -477,7 +475,7 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
 			if (!tdp_enabled || !boot_cpu_has(X86_FEATURE_OSPKE))
 				entry->ecx &= ~F(PKU);
 			entry->edx &= kvm_cpuid_7_0_edx_x86_features;
-			entry->edx &= get_scattered_cpuid_leaf(7, 0, CPUID_EDX);
+			cpuid_mask(&entry->edx, CPUID_7_EDX);
 		} else {
 			entry->ebx = 0;
 			entry->ecx = 0;
diff --git a/arch/x86/kvm/cpuid.h b/arch/x86/kvm/cpuid.h
index c2cea66..9a327d5 100644
--- a/arch/x86/kvm/cpuid.h
+++ b/arch/x86/kvm/cpuid.h
@@ -54,6 +54,7 @@ static const struct cpuid_reg reverse_cpuid[] = {
 	[CPUID_8000_000A_EDX] = {0x8000000a, 0, CPUID_EDX},
 	[CPUID_7_ECX]         = {         7, 0, CPUID_ECX},
 	[CPUID_8000_0007_EBX] = {0x80000007, 0, CPUID_EBX},
+	[CPUID_7_EDX]         = {         7, 0, CPUID_EDX},
 };
 
 static __always_inline struct cpuid_reg x86_feature_cpuid(unsigned x86_feature)
-- 
2.7.4

  reply	other threads:[~2018-01-31 19:38 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-31 19:37 [PATCH v5 0/5] KVM: Expose speculation control feature to guests KarimAllah Ahmed
2018-01-31 19:37 ` KarimAllah Ahmed
2018-01-31 19:37 ` KarimAllah Ahmed [this message]
2018-01-31 20:22   ` [PATCH v5 1/5] KVM: x86: Update the reverse_cpuid list to include CPUID_7_EDX Konrad Rzeszutek Wilk
2018-01-31 19:37 ` [PATCH v5 2/5] KVM: x86: Add IBPB support KarimAllah Ahmed
2018-01-31 19:45   ` Jim Mattson
2018-01-31 19:53     ` David Woodhouse
2018-01-31 19:53       ` David Woodhouse
2018-01-31 19:55       ` Jim Mattson
2018-02-01  0:27         ` KarimAllah Ahmed
2018-01-31 20:28   ` Konrad Rzeszutek Wilk
2018-01-31 20:36     ` KarimAllah Ahmed
2018-02-01  4:54   ` Tom Lendacky
2018-02-01 17:00   ` Raj, Ashok
2018-01-31 19:37 ` [PATCH v5 3/5] KVM: VMX: Emulate MSR_IA32_ARCH_CAPABILITIES KarimAllah Ahmed
2018-01-31 19:37 ` [PATCH v5 4/5] KVM: VMX: Allow direct access to MSR_IA32_SPEC_CTRL KarimAllah Ahmed
2018-01-31 19:53   ` Jim Mattson
2018-01-31 20:00     ` David Woodhouse
2018-01-31 20:00       ` David Woodhouse
2018-01-31 20:01     ` KarimAllah Ahmed
2018-01-31 20:18       ` Jim Mattson
2018-01-31 20:21         ` David Woodhouse
2018-01-31 20:21           ` David Woodhouse
2018-01-31 21:18           ` Jim Mattson
2018-01-31 22:05             ` David Woodhouse
2018-01-31 20:34         ` Paolo Bonzini
2018-01-31 20:54           ` Jim Mattson
2018-01-31 21:00             ` Paolo Bonzini
2018-01-31 21:05               ` Jim Mattson
2018-01-31 21:17                 ` Woodhouse, David
2018-01-31 21:17                   ` Woodhouse, David
2018-01-31 21:42                 ` Paolo Bonzini
2018-01-31 21:53                   ` Jim Mattson
2018-01-31 21:59                     ` Paolo Bonzini
2018-01-31 21:59                     ` David Woodhouse
2018-01-31 22:06                       ` Jim Mattson
2018-01-31 22:10                         ` David Woodhouse
2018-01-31 22:10                           ` David Woodhouse
2018-01-31 22:21                           ` Linus Torvalds
2018-01-31 22:53                         ` Andy Lutomirski
2018-01-31 22:53                           ` Andy Lutomirski
2018-02-01 14:09                       ` Paolo Bonzini
2018-01-31 22:52         ` KarimAllah Ahmed
2018-02-01  0:24           ` KarimAllah Ahmed
2018-02-01  4:26             ` Konrad Rzeszutek Wilk
2018-02-01  4:26               ` Konrad Rzeszutek Wilk
2018-02-01 13:25               ` David Woodhouse
2018-02-01 13:25                 ` David Woodhouse
2018-02-01 17:37                 ` KarimAllah Ahmed
2018-02-01 17:46                   ` KarimAllah Ahmed
2018-02-01 14:19               ` Konrad Rzeszutek Wilk
2018-02-01 14:19                 ` Konrad Rzeszutek Wilk
2018-02-01 14:28                 ` KarimAllah Ahmed
2018-02-01 14:28                   ` KarimAllah Ahmed
2018-01-31 22:56   ` Raj, Ashok
2018-01-31 19:37 ` [PATCH v5 5/5] KVM: SVM: " KarimAllah Ahmed

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=1517427467-28567-2-git-send-email-karahmed@amazon.de \
    --to=karahmed@amazon.de \
    --cc=dwmw@amazon.co.uk \
    --cc=hpa@zytor.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=rkrcmar@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.