Received: by 10.223.176.5 with SMTP id f5csp1792985wra; Wed, 31 Jan 2018 11:39:32 -0800 (PST) X-Google-Smtp-Source: AH8x2253TVAvArtUx0PJLlBpBDs6oEME8ryH8gFUHwyi8+Bp1378HAst1vctpcuafmFXZsUs7LIR X-Received: by 2002:a17:902:be06:: with SMTP id r6-v6mr108267pls.448.1517427572159; Wed, 31 Jan 2018 11:39:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517427572; cv=none; d=google.com; s=arc-20160816; b=azftqSyyzAvzMO2g3jHLjjT7PPL3YvhlN0Gs7l61FJ+jwUJ0yNb2DpTj+7Ptx8WyE9 FaHdJipyEn/QbNT7D1elYJwEsFQtDAnPdq9JaOIFKwqycN8CWMLvWA5Ml4YovxqAIygm tBhoURvawSw3tCUXzUml0mjTUuIEWRSquRq3/iG7UqSD6mugU39e3xjP6qK0sDbrbyil f3qozaaGagEYsFwgA6QwHSHOU4kP8EtgQGQaFqfMeZsQLTlfH2mABXr696PgD54+hQqK MOT0yslvSoVuu6jKvD+GZPxICiwpuqrXGbqJcypD+RpAun3dMk8EWGMf0XuByRG4ZN7d Aw7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=ylDzME/9CWrwvKabvyhFkpOc8WT71hZrENQifXJeRcQ=; b=Ii0yROPz/f5d47CCpRvFHVFlGw651q8+Oc+Zcr9EBpljOYVhqMPlbc5U/NibRwzLig rX/7SFszOhOYkItcMm3/8yns5KKzxsfanwlCzhvRA2qPdToZx6xUG/U9eM/9HgUJptyY NNsgceJBf4U2oIqlTvJ1LOa4c83tatk0jAJ+UtL994YeUnNksk9C4ojZU8i4irkjI6mz W7ZdV4NNLC44d+NMy2vrCo4q/GWjUn+bQf6aEN5kX3hA5lWa4plGPFA4IkiE2GLtXKcq pz+MStRfyTbnwNTHsyBRWIF3bNVDzCtNJVAhUWW3k/+OkYt6ywrRNfI1F+MTM4mJ5bWh a6pA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.de header.s=amazon201209 header.b=uNFPt5/A; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a5-v6si4784809plh.640.2018.01.31.11.39.17; Wed, 31 Jan 2018 11:39:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@amazon.de header.s=amazon201209 header.b=uNFPt5/A; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751586AbeAaTiO (ORCPT + 99 others); Wed, 31 Jan 2018 14:38:14 -0500 Received: from smtp-fw-4101.amazon.com ([72.21.198.25]:27467 "EHLO smtp-fw-4101.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751405AbeAaTiN (ORCPT ); Wed, 31 Jan 2018 14:38:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.de; i=@amazon.de; q=dns/txt; s=amazon201209; t=1517427493; x=1548963493; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ylDzME/9CWrwvKabvyhFkpOc8WT71hZrENQifXJeRcQ=; b=uNFPt5/AOnGxiPBruyWerwqxHSMgp2ohT+eFn9Kabm35sGpW8K8Wt4Dv UhH+GE1cf4TQvzVd8AADEPrxhpe9K9Vg6pechGji2db3LiLTiaLlluEya SG0Qcd/jePr7cidRBTaNIr4d83LR1ZxUeowgDgXk86wEeT3//HvT0Zd4b 0=; X-IronPort-AV: E=Sophos;i="5.46,441,1511827200"; d="scan'208";a="706176340" Received: from iad6-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-2b-3714e498.us-west-2.amazon.com) ([10.124.125.6]) by smtp-border-fw-out-4101.iad4.amazon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 31 Jan 2018 19:38:11 +0000 Received: from u54e1ad5160425a4b64ea.ant.amazon.com (pdx2-ws-svc-lb17-vlan3.amazon.com [10.247.140.70]) by email-inbound-relay-2b-3714e498.us-west-2.amazon.com (8.14.7/8.14.7) with ESMTP id w0VJc6Ux007694 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 31 Jan 2018 19:38:08 GMT Received: from u54e1ad5160425a4b64ea.ant.amazon.com (localhost [127.0.0.1]) by u54e1ad5160425a4b64ea.ant.amazon.com (8.15.2/8.15.2/Debian-3) with ESMTP id w0VJc598028671; Wed, 31 Jan 2018 20:38:05 +0100 Received: (from karahmed@localhost) by u54e1ad5160425a4b64ea.ant.amazon.com (8.15.2/8.15.2/Submit) id w0VJc5i7028670; Wed, 31 Jan 2018 20:38:05 +0100 From: KarimAllah Ahmed To: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, x86@kernel.org Cc: KarimAllah Ahmed , Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= , Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , David Woodhouse Subject: [PATCH v5 1/5] KVM: x86: Update the reverse_cpuid list to include CPUID_7_EDX Date: Wed, 31 Jan 2018 20:37:43 +0100 Message-Id: <1517427467-28567-2-git-send-email-karahmed@amazon.de> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517427467-28567-1-git-send-email-karahmed@amazon.de> References: <1517427467-28567-1-git-send-email-karahmed@amazon.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [dwmw2: Stop using KF() for bits in it, too] Cc: Paolo Bonzini Cc: Radim Krčmář Cc: Thomas Gleixner Cc: Ingo Molnar Cc: H. Peter Anvin Cc: x86@kernel.org Cc: kvm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Reviewed-by: Paolo Bonzini Signed-off-by: KarimAllah Ahmed Signed-off-by: David Woodhouse --- arch/x86/kvm/cpuid.c | 8 +++----- arch/x86/kvm/cpuid.h | 1 + 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c index 0099e10..c0eb337 100644 --- a/arch/x86/kvm/cpuid.c +++ b/arch/x86/kvm/cpuid.c @@ -67,9 +67,7 @@ u64 kvm_supported_xcr0(void) #define F(x) bit(X86_FEATURE_##x) -/* These are scattered features in cpufeatures.h. */ -#define KVM_CPUID_BIT_AVX512_4VNNIW 2 -#define KVM_CPUID_BIT_AVX512_4FMAPS 3 +/* For scattered features from cpufeatures.h; we currently expose none */ #define KF(x) bit(KVM_CPUID_BIT_##x) int kvm_update_cpuid(struct kvm_vcpu *vcpu) @@ -392,7 +390,7 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function, /* cpuid 7.0.edx*/ const u32 kvm_cpuid_7_0_edx_x86_features = - KF(AVX512_4VNNIW) | KF(AVX512_4FMAPS); + F(AVX512_4VNNIW) | F(AVX512_4FMAPS); /* all calls to cpuid_count() should be made on the same cpu */ get_cpu(); @@ -477,7 +475,7 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function, if (!tdp_enabled || !boot_cpu_has(X86_FEATURE_OSPKE)) entry->ecx &= ~F(PKU); entry->edx &= kvm_cpuid_7_0_edx_x86_features; - entry->edx &= get_scattered_cpuid_leaf(7, 0, CPUID_EDX); + cpuid_mask(&entry->edx, CPUID_7_EDX); } else { entry->ebx = 0; entry->ecx = 0; diff --git a/arch/x86/kvm/cpuid.h b/arch/x86/kvm/cpuid.h index c2cea66..9a327d5 100644 --- a/arch/x86/kvm/cpuid.h +++ b/arch/x86/kvm/cpuid.h @@ -54,6 +54,7 @@ static const struct cpuid_reg reverse_cpuid[] = { [CPUID_8000_000A_EDX] = {0x8000000a, 0, CPUID_EDX}, [CPUID_7_ECX] = { 7, 0, CPUID_ECX}, [CPUID_8000_0007_EBX] = {0x80000007, 0, CPUID_EBX}, + [CPUID_7_EDX] = { 7, 0, CPUID_EDX}, }; static __always_inline struct cpuid_reg x86_feature_cpuid(unsigned x86_feature) -- 2.7.4