From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wanpeng Li Subject: Re: [PATCH 6/9] KVM: cpuid: mask more bits in leaf 0xd and subleaves Date: Fri, 5 Dec 2014 08:34:47 +0800 Message-ID: <20141205003446.GA6967@kernel> References: <1417708634-24333-1-git-send-email-pbonzini@redhat.com> <1417708634-24333-7-git-send-email-pbonzini@redhat.com> Reply-To: Wanpeng Li Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, rkrcmar@redhat.com To: Paolo Bonzini Return-path: Content-Disposition: inline In-Reply-To: <1417708634-24333-7-git-send-email-pbonzini@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org Hi Paolo, On Thu, Dec 04, 2014 at 04:57:11PM +0100, Paolo Bonzini wrote: >- EAX=3D0Dh, ECX=3D1: output registers ECX/EDX are reserved. > >- EAX=3D0Dh, ECX>1: output register ECX bit 0 is clear for all the CPU= ID >leaves we support, because variable "supported" comes from XCR0 and no= t >XSS. Bits above 0 are reserved, so ECX is overall zero. Output regis= ter >EDX is reserved. > >Source: Intel Architecture Instruction Set Extensions Programming >Reference, ref. number 319433-022 > >Reviewed-by: Radim Kr=C4=8Dm=C3=A1=C5=99 >Signed-off-by: Paolo Bonzini >--- > arch/x86/kvm/cpuid.c | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > Do you miss this in your patch? + /* cpuid 0xD.1.eax */ + const u32 kvm_supported_word10_x86_features =3D + F(XSAVEOPT) | F(XSAVEC) | F(XGETBV1); + In addition, there is bisect issue if this is added in this patch. (4/9 will take advantage of kvm_supported_word10_x86_features) Regards, Wanpeng Li=20 >diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c >index 2f7bc2de9915..644bfe828ce1 100644 >--- a/arch/x86/kvm/cpuid.c >+++ b/arch/x86/kvm/cpuid.c >@@ -482,8 +482,14 @@ static inline int __do_cpuid_ent(struct kvm_cpuid= _entry2 *entry, u32 function, > entry[i].ebx =3D > xstate_required_size(supported, > true); >- } else if (entry[i].eax =3D=3D 0 || !(supported & mask)) >- continue; >+ } else { >+ if (entry[i].eax =3D=3D 0 || !(supported & mask)) >+ continue; >+ if (WARN_ON_ONCE(entry[i].ecx & 1)) >+ continue; >+ } >+ entry[i].ecx =3D 0; >+ entry[i].edx =3D 0; > entry[i].flags |=3D > KVM_CPUID_FLAG_SIGNIFCANT_INDEX; > ++*nent; >--=20 >1.8.3.1 >