From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936602AbcJ1JyX (ORCPT ); Fri, 28 Oct 2016 05:54:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38780 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753167AbcJ1JyV (ORCPT ); Fri, 28 Oct 2016 05:54:21 -0400 Subject: Re: [PATCH] x86/cpuid: expose AVX512_4VNNIW and AVX512_4FMAPS features to kvm guest To: He Chen References: <1477645960-6898-1-git-send-email-he.chen@linux.intel.com> <98097397-f1a5-c0b0-0620-31d07b715272@redhat.com> <20161028094645.GA8148@he> Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, x86@kernel.org, =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , Luwei Kang , Piotr Luc From: Paolo Bonzini Message-ID: <462c1f5a-1b91-7d03-d192-23d778ae54af@redhat.com> Date: Fri, 28 Oct 2016 11:54:13 +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: <20161028094645.GA8148@he> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 28 Oct 2016 09:54:20 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 28/10/2016 11:46, He Chen wrote: > On Fri, Oct 28, 2016 at 11:31:05AM +0200, Paolo Bonzini wrote: >> >> >> On 28/10/2016 11:12, 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 */; >> >> Please define the new features in cpufeature.h first. >> > These 2 new features defined as scattered features in kernel. > In cpufeature.h, there are: > #define X86_FEATURE_AVX512_4VNNIW (7*32+16) > #define X86_FEATURE_AVX512_4FMAPS (7*32+17) > > Please see disscusion here: > https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1250183.html Uff, that sucks. :( I'd agree with hpa's position in that thread. Please do something like /* These are scattered features in cpufeature.h. */ #define KVM_CPUID_BIT_AVX512_4VNNIW 2 #define KVM_CPUID_BIT_AVX512_4FMAPS 3 #define KF(x) bit(KVM_CPUID_BIT_##x) and then const u32 kvm_cpuid_7_0_edx_x86_features = KF(AVX512_4VNNIW) | KF(AVX512_4FMAPS) I'll think of a trick to avoid using F for scattered features... Thanks, Paolo