Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760349AbcJ1KNJ (ORCPT ); Fri, 28 Oct 2016 06:13:09 -0400 Received: from mga09.intel.com ([134.134.136.24]:8979 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756338AbcJ1KNG (ORCPT ); Fri, 28 Oct 2016 06:13:06 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,557,1473145200"; d="scan'208";a="778996075" From: "Luc, Piotr" To: "kvm@vger.kernel.org" , "he.chen@linux.intel.com" CC: "linux-kernel@vger.kernel.org" , "tglx@linutronix.de" , "x86@kernel.org" , "hpa@zytor.com" , "mingo@redhat.com" , "pbonzini@redhat.com" , "Kang, Luwei" , "rkrcmar@redhat.com" Subject: Re: [PATCH] x86/cpuid: expose AVX512_4VNNIW and AVX512_4FMAPS features to kvm guest Thread-Topic: [PATCH] x86/cpuid: expose AVX512_4VNNIW and AVX512_4FMAPS features to kvm guest Thread-Index: AQHSMPuRndHUs4kUQU6QbMeh/lFjbKC9k48A Date: Fri, 28 Oct 2016 10:13:01 +0000 Message-ID: <1477649272.17668.7.camel@intel.com> References: <1477645960-6898-1-git-send-email-he.chen@linux.intel.com> In-Reply-To: <1477645960-6898-1-git-send-email-he.chen@linux.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.237.138.164] Content-Type: text/plain; charset="utf-8" Content-ID: <0AE2ACCABB867B43B32248E1565A6DF8@intel.com> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id u9SADEEt014268 Content-Length: 1684 Lines: 52 On Fri, 2016-10-28 at 17:12 +0800, He Chen wrote: > The spec can be found in Intel Software Developer Manual or in > Instruction Set Extensions Programming Reference. > > Signed-off-by: Luwei Kang > Signed-off-by: He Chen > --- >  arch/x86/kvm/cpuid.c | 7 ++++++- >  1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c > index afa7bbb..328b169 100644 > --- a/arch/x86/kvm/cpuid.c > +++ b/arch/x86/kvm/cpuid.c > @@ -376,6 +376,10 @@ static inline int __do_cpuid_ent(struct > kvm_cpuid_entry2 *entry, u32 function, >   /* cpuid 7.0.ecx*/ >   const u32 kvm_cpuid_7_0_ecx_x86_features = F(PKU) | 0 > /*OSPKE*/; >   > + /* cpuid 7.0.edx*/ > + const u32 kvm_cpuid_7_0_edx_x86_features = > +        0x4 /* AVX512-4VNNIW */ | 0x8 /* AVX512-4FMAPS */; > + >   /* all calls to cpuid_count() should be made on the same cpu > */ >   get_cpu(); >   > @@ -458,12 +462,13 @@ static inline int __do_cpuid_ent(struct > kvm_cpuid_entry2 *entry, u32 function, >   /* PKU is not yet implemented for shadow > paging. */ >   if (!tdp_enabled) >   entry->ecx &= ~F(PKU); > +            entry->edx &= kvm_cpuid_7_0_edx_x86_features; The cpu_mask() is missed here. I understand that it doesn't work for this scattered features but the bits in edx must be zeroed if corresponding flags were cleared in fpu__xstate_clear_all_cpu_caps. So this implies more work unfortunately. >   } else { >   entry->ebx = 0; >   entry->ecx = 0; > +            entry->edx = 0; >   } >   entry->eax = 0; > - entry->edx = 0; >   break; >   } >   case 9: