Received: by 10.223.176.5 with SMTP id f5csp3288556wra; Thu, 1 Feb 2018 14:03:31 -0800 (PST) X-Google-Smtp-Source: AH8x224/6yLkNijlHFn++6knWGjZmxm27pJrJgkHQG39rDhNECiwTDG5iKKuz9pDRkr7btemZ5cs X-Received: by 2002:a17:902:4681:: with SMTP id p1-v6mr6885386pld.47.1517522611029; Thu, 01 Feb 2018 14:03:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517522610; cv=none; d=google.com; s=arc-20160816; b=Mbngb8KYFX6Nzks7hY1YZB97qdevMF9yBQOh2wK0funJNY/CEZKIWedNQEIGIkAE+z R2Hig6MdV0WnbFJ8XMavJ0HudgIxLs7JQeqAZGhAanx1KcTmsSG9SpN1mxtxMgsOpNkq KDTN4ePelFVvJJFg3wIrKtDutNdxoAV+Kw19uF4Elg+wIniWAQ7lQIgVeiXIUeR0Cjl9 f8DnvBaWkhCiU09FqzCI7GPDhUvJCYFL9SsPbHZY1cK9GuPQzcJ5js6lZn2IMIYARcMv yaWqTrPA1BdNmv6Nnf/zbI+rcdoFEa5nVnLVzTEN7VuLppEjc6pj2vjw152Y30ZVzCzc Q2mA== 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=dGgErZl0dBLgx+fJqGT7gOQ1Tovt3mb4pr/ub06wm+c=; b=DQAwFhmSi/c2xY94dWqNROCXk67PixoAS6NcVzyrbB0D5uhin/2joud+a7bp+04yrt H/IRbodDU0N0aI36PJ67Rxx42BKAeKAVvVUhklUz7i93dXUgyk51M3GZiDQQpRbFSOHc a3r3MiexJg4lavYCepTkm7IwmGz4Wosp48qHp6n8lZ+FKLf6UXMKmTT1TfOiwBHwuTkU bf/TUlAkKsaEfnDNArR3X8JSTUqfaWT7KbZgKQ56riEHYFHPPjNb/5zjiie1XZgO99af WBYE+VwJmpc7siKlBJm2e0fgmGgC1Cb0V9b+ubCGp0kAybTQU3D/Vfqi11nbgo5IhzfX KLXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.de header.s=amazon201209 header.b=XJLSov2m; 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 f29si449600pfk.117.2018.02.01.14.03.16; Thu, 01 Feb 2018 14:03:30 -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=XJLSov2m; 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 S1752384AbeBAWB6 (ORCPT + 99 others); Thu, 1 Feb 2018 17:01:58 -0500 Received: from smtp-fw-9102.amazon.com ([207.171.184.29]:42599 "EHLO smtp-fw-9102.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752053AbeBAWAR (ORCPT ); Thu, 1 Feb 2018 17:00:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.de; i=@amazon.de; q=dns/txt; s=amazon201209; t=1517522417; x=1549058417; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=dGgErZl0dBLgx+fJqGT7gOQ1Tovt3mb4pr/ub06wm+c=; b=XJLSov2mLu9P38iAVDOxOrSr28XxtfDk1tMPR1bUlv3PqSmaROjsCezi jg4XrKnd7mtmZyh7Y9StW4n6sECnp5ZED1A5LLr/Vc6e4Q0s2K+c1Kz0R R7VFrCCrfNBWhCl5rF39xdmOAg2bi8ivpS9tuc3ik4S67ic979s3jDL0m 8=; X-IronPort-AV: E=Sophos;i="5.46,444,1511827200"; d="scan'208";a="592233189" Received: from sea3-co-svc-lb6-vlan3.sea.amazon.com (HELO email-inbound-relay-1e-62350142.us-east-1.amazon.com) ([10.47.22.38]) by smtp-border-fw-out-9102.sea19.amazon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 01 Feb 2018 22:00:05 +0000 Received: from u54e1ad5160425a4b64ea.ant.amazon.com (iad1-ws-svc-lb91-vlan3.amazon.com [10.0.103.150]) by email-inbound-relay-1e-62350142.us-east-1.amazon.com (8.14.7/8.14.7) with ESMTP id w11LxvLh036514 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 1 Feb 2018 21:59:59 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 w11LxtfO018746; Thu, 1 Feb 2018 22:59:56 +0100 Received: (from karahmed@localhost) by u54e1ad5160425a4b64ea.ant.amazon.com (8.15.2/8.15.2/Submit) id w11Lxtdx018745; Thu, 1 Feb 2018 22:59:55 +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 v6 1/5] KVM: x86: Update the reverse_cpuid list to include CPUID_7_EDX Date: Thu, 1 Feb 2018 22:59:42 +0100 Message-Id: <1517522386-18410-2-git-send-email-karahmed@amazon.de> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517522386-18410-1-git-send-email-karahmed@amazon.de> References: <1517522386-18410-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 Reviewed-by: Konrad Rzeszutek Wilk 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