Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759585AbcJ1MHa (ORCPT ); Fri, 28 Oct 2016 08:07:30 -0400 Received: from mail-wm0-f46.google.com ([74.125.82.46]:35374 "EHLO mail-wm0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757566AbcJ1MH1 (ORCPT ); Fri, 28 Oct 2016 08:07:27 -0400 Subject: Re: [PATCH] x86/cpuid: expose AVX512_4VNNIW and AVX512_4FMAPS features to kvm guest To: Borislav Petkov References: <1477645960-6898-1-git-send-email-he.chen@linux.intel.com> <1477649272.17668.7.camel@intel.com> <5c00fdf0-a5a4-7a78-4ed8-8ae3ef710a68@redhat.com> <20161028110834.svzzs5hftg3bybiz@pd.tnic> Cc: "Luc, Piotr" , "kvm@vger.kernel.org" , "he.chen@linux.intel.com" , "linux-kernel@vger.kernel.org" , "tglx@linutronix.de" , "x86@kernel.org" , "hpa@zytor.com" , "mingo@redhat.com" , "Kang, Luwei" , "rkrcmar@redhat.com" From: Paolo Bonzini Message-ID: Date: Fri, 28 Oct 2016 14:07:21 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20161028110834.svzzs5hftg3bybiz@pd.tnic> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 623 Lines: 27 On 28/10/2016 13:08, Borislav Petkov wrote: > On Fri, Oct 28, 2016 at 12:17:02PM +0200, Paolo Bonzini wrote: >> Otherwise, if you add a cpuid_count_edx function to processor.h then one >> can do: >> >> entry_>edx &= cpuid_count_edx(7, 0); >> >> which is decent too. > > If you think of iterating over the cpuid_bits[] array and recreating the > CPUID leaf for KVM, sure, why not... > cpuid_count_edx would be just static inline unsigned int cpuid_count_edx(unsigned op, unsigned count) { unsigned int eax, ebx, ecx, edx; cpuid_count(op, count, &eax, &ebx, &ecx, &edx); return edx; } Paolo