Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935010AbcJaKr6 (ORCPT ); Mon, 31 Oct 2016 06:47:58 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:35054 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932766AbcJaKr4 (ORCPT ); Mon, 31 Oct 2016 06:47:56 -0400 Subject: Re: [PATCH] x86/cpuid: expose AVX512_4VNNIW and AVX512_4FMAPS features to kvm guest To: Borislav Petkov , "Luc, Piotr" 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> <20161028122123.24i3synevehn6r3p@pd.tnic> <425702906.9319122.1477743677017.JavaMail.zimbra@redhat.com> <1477905033.32008.5.camel@intel.com> <20161031095312.dzv3rj2fqgjjsy7w@pd.tnic> <1477908811.32008.20.camel@intel.com> <20161031103050.k7b2l64blhmv33mw@pd.tnic> Cc: "kvm@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "he.chen@linux.intel.com" , "tglx@linutronix.de" , "x86@kernel.org" , "hpa@zytor.com" , "mingo@redhat.com" , "Kang, Luwei" , "rkrcmar@redhat.com" From: Paolo Bonzini Message-ID: <48ef617f-c438-cfcf-6f0c-1eb3b59820ff@redhat.com> Date: Mon, 31 Oct 2016 11:47:48 +0100 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: <20161031103050.k7b2l64blhmv33mw@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: 815 Lines: 24 On 31/10/2016 11:30, Borislav Petkov wrote: > On Mon, Oct 31, 2016 at 10:18:41AM +0000, Luc, Piotr wrote: >> The cpuid_mask function, which usually used in kvm, read bit from this >> x86_capabity and mask out. This prevents passing disabled features to >> guest. If we use cpu_count instead, which reports bits directly from > > Ah, you mean cpuid_count(). > >> CPU, then the bits of features that are disabled in host are passed to >> guest as enabled. This seems be inconsistent. > > Ok, I see what you mean. > > So I guess we'll have to iterate over the cpuid_bits[] array and > recreate the CPUID leaf for KVM instead, as I suggested earlier. Yes, indeed. :( The information is all in arch/x86/kernel/cpu/scattered.c's cpuid_bits array. Borislav, would it be okay to export the cpuid_regs enum? Paolo