From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konrad Rzeszutek Wilk Subject: Re: [PATCH v5 1/5] KVM: x86: Update the reverse_cpuid list to include CPUID_7_EDX Date: Wed, 31 Jan 2018 15:22:50 -0500 Message-ID: <20180131202250.GF22045@char.us.oracle.com> References: <1517427467-28567-1-git-send-email-karahmed@amazon.de> <1517427467-28567-2-git-send-email-karahmed@amazon.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, x86@kernel.org, Paolo Bonzini , Radim =?utf-8?B?S3LEjW3DocWZ?= , Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , David Woodhouse To: KarimAllah Ahmed Return-path: Content-Disposition: inline In-Reply-To: <1517427467-28567-2-git-send-email-karahmed@amazon.de> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On Wed, Jan 31, 2018 at 08:37:43PM +0100, KarimAllah Ahmed wrote: > [dwmw2: Stop using KF() for bits in it, too] > Cc: Paolo Bonzini > Cc: Radim Kr=C4=8Dm=C3=A1=C5=99 > Cc: Thomas Gleixner > Cc: Ingo Molnar > Cc: H. Peter Anvin > Cc: x86@kernel.org > Cc: kvm@vger.kernel.org > Cc: linux-kernel@vger.kernel.org > Reviewed-by: Paolo Bonzini Reviewed-by: Konrad Rzeszutek Wilk > Signed-off-by: KarimAllah Ahmed > Signed-off-by: David Woodhouse > --- > arch/x86/kvm/cpuid.c | 8 +++----- > arch/x86/kvm/cpuid.h | 1 + > 2 files changed, 4 insertions(+), 5 deletions(-) >=20 > 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) > =20 > #define F(x) bit(X86_FEATURE_##x) > =20 > -/* 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) > =20 > int kvm_update_cpuid(struct kvm_vcpu *vcpu) > @@ -392,7 +390,7 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_e= ntry2 *entry, u32 function, > =20 > /* cpuid 7.0.edx*/ > const u32 kvm_cpuid_7_0_edx_x86_features =3D > - KF(AVX512_4VNNIW) | KF(AVX512_4FMAPS); > + F(AVX512_4VNNIW) | F(AVX512_4FMAPS); > =20 > /* 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_e= ntry2 *entry, u32 function, > if (!tdp_enabled || !boot_cpu_has(X86_FEATURE_OSPKE)) > entry->ecx &=3D ~F(PKU); > entry->edx &=3D kvm_cpuid_7_0_edx_x86_features; > - entry->edx &=3D get_scattered_cpuid_leaf(7, 0, CPUID_EDX); > + cpuid_mask(&entry->edx, CPUID_7_EDX); > } else { > entry->ebx =3D 0; > entry->ecx =3D 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[] =3D { > [CPUID_8000_000A_EDX] =3D {0x8000000a, 0, CPUID_EDX}, > [CPUID_7_ECX] =3D { 7, 0, CPUID_ECX}, > [CPUID_8000_0007_EBX] =3D {0x80000007, 0, CPUID_EBX}, > + [CPUID_7_EDX] =3D { 7, 0, CPUID_EDX}, > }; > =20 > static __always_inline struct cpuid_reg x86_feature_cpuid(unsigned x86= _feature) > --=20 > 2.7.4 >=20