Message ID | 20221125125845.1182922-8-jiaxi.chen@linux.intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3995671wrr; Fri, 25 Nov 2022 05:00:32 -0800 (PST) X-Google-Smtp-Source: AA0mqf4I/icak6+A+nO5NTC/QpcvZXeYzUtPdG2JdBjix0JGDIjVbsqN24Ur4YNpBQBYQWEYk9y6 X-Received: by 2002:a65:4c04:0:b0:470:3fc2:65af with SMTP id u4-20020a654c04000000b004703fc265afmr17059135pgq.492.1669381231892; Fri, 25 Nov 2022 05:00:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669381231; cv=none; d=google.com; s=arc-20160816; b=dg64plyIs8AgYoi9xHwCnY/wHBTH5bHDSmkw7/oK1iypJdaLndyzk19pnBrHfr+GXn HQABkaEk/O1VklE40wHcMsubg0g1BfHUIphTG78QVGHcjD7mGSwCKO+Vg1/Fh0kLmB2t RDCy7fMie4vBeb7cX9/hhbwdYPvFCKUe4HW2+LC8eKqymzYmbfSglNnVzgl5nHepL4vf MiqK3D4ToElWxh+qDItGVC2kTky3DGzfgVf6QX50BqoKvXFlfbLwJM3gz93WRz79/n7T PtYI92nFFuuwIArSvVdq7A24KdwWwQ5EwDitQLe8kCRojJ4tA9EUsxpHzqxRGjjlUQxs SdIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=vjTBP6eVQPWPsdHIYyOMk8DQCGN+Zh2uf7AuyEZ9F4Q=; b=RRL5ad9mHpdkMOEdzhwjry79Mcs+fWAaP8mnyPBV0P/7Bw2K8oqNpsYpF9AntG9i7Y QYtRdDhbVzxYdGBNtbPlmabtwgKVHn8KtviCpgbUc2rrXUiUCLQBcUVKctU8T7vvNJgL 0aHbErVcJh/2lWil8AZevpZEFdkftX7sm3XFXzu8U8Pm7XHqgZeIBK6BsS5+5g4Or5bA sKduiwHPJsejzrFOCV33fHlgP46+gb6WLgqeKZhWyLAteFPtaKvYvqLao4ECRcg2l22p an/znyiGuVtL3D1lKj0kJRNKnuZGQ1+AiXIbvUDNFHjPElKMn7BTmHaLqRJU+est5aNI U/RA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="R/bB2L2U"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s5-20020a056a0008c500b005614fb190e4si4252093pfu.193.2022.11.25.05.00.18; Fri, 25 Nov 2022 05:00:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="R/bB2L2U"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230004AbiKYM7x (ORCPT <rfc822;zxc52fgh@gmail.com> + 99 others); Fri, 25 Nov 2022 07:59:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229990AbiKYM70 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 25 Nov 2022 07:59:26 -0500 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B86B4B74C; Fri, 25 Nov 2022 04:59:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669381153; x=1700917153; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=16du4i0I8Bj9j8DC+WImdAtC9niWfE1nLhKyIXA12A8=; b=R/bB2L2U5aLizb9jjf6toL5jlxecxLRaFPwDSFqwT65LPULxkkhF8a/U qTpbFaB5z/JYBGwW/RzQDhshlgdm42f57OF+L34M+yi8zbWvv5B4Zlkti oby0tuJohWs419l/VKyRixV9zlNrCtU4CyRIZAXsYy+Guy5lTlS7fxAlx h2wN3gPryIT9Z0skae7EbyJm6OXsbV3HaSbBf3YMIRHre6FTxJtEWDCt4 3kAn1V6gUdtgHI8hw+1p0W2dmhVHcK+Ct6k92VrGBS+HRJsx52plyS9MZ isFVcKe0tM2SWOLPPO0hpTmiqQG3HYAuauP46hT1gz7ix1jT6WzdUAxwZ Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10541"; a="376622366" X-IronPort-AV: E=Sophos;i="5.96,193,1665471600"; d="scan'208";a="376622366" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Nov 2022 04:59:12 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10541"; a="706061331" X-IronPort-AV: E=Sophos;i="5.96,193,1665471600"; d="scan'208";a="706061331" Received: from jiaxichen-precision-3650-tower.sh.intel.com ([10.239.159.75]) by fmsmga008.fm.intel.com with ESMTP; 25 Nov 2022 04:59:08 -0800 From: Jiaxi Chen <jiaxi.chen@linux.intel.com> To: kvm@vger.kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, seanjc@google.com, pbonzini@redhat.com, ndesaulniers@google.com, alexandre.belloni@bootlin.com, peterz@infradead.org, jpoimboe@kernel.org, chang.seok.bae@intel.com, pawan.kumar.gupta@linux.intel.com, babu.moger@amd.com, jmattson@google.com, sandipan.das@amd.com, tony.luck@intel.com, sathyanarayanan.kuppuswamy@linux.intel.com, fenghua.yu@intel.com, keescook@chromium.org, nathan@kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 7/8] KVM: x86: Advertise AVX-NE-CONVERT CPUID to user space Date: Fri, 25 Nov 2022 20:58:44 +0800 Message-Id: <20221125125845.1182922-8-jiaxi.chen@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221125125845.1182922-1-jiaxi.chen@linux.intel.com> References: <20221125125845.1182922-1-jiaxi.chen@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750473094390120021?= X-GMAIL-MSGID: =?utf-8?q?1750473094390120021?= |
Series |
x86: KVM: Advertise CPUID of new Intel platform instructions to user space
|
|
Commit Message
Jiaxi Chen
Nov. 25, 2022, 12:58 p.m. UTC
AVX-NE-CONVERT is a new set of instructions which can convert low
precision floating point like BF16/FP16 to high precision floating point
FP32, and can also convert FP32 elements to BF16. This instruction
allows the platform to have improved AI capabilities and better
compatibility.
The bit definition:
CPUID.(EAX=7,ECX=1):EDX[bit 5]
AVX-NE-CONVERT is on a KVM-only subleaf. Plus an x86_FEATURE definition
for this feature bit to direct it to the KVM entry.
Advertise AVX-NE-CONVERT to KVM userspace. This is safe because there
are no new VMX controls or additional host enabling required for guests
to use this feature.
Signed-off-by: Jiaxi Chen <jiaxi.chen@linux.intel.com>
---
arch/x86/kvm/cpuid.c | 2 +-
arch/x86/kvm/reverse_cpuid.h | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c index 2dfa8363b9d9..c4ea8f593b72 100644 --- a/arch/x86/kvm/cpuid.c +++ b/arch/x86/kvm/cpuid.c @@ -668,7 +668,7 @@ void kvm_set_cpu_caps(void) ); kvm_cpu_cap_init_kvm_defined(CPUID_7_1_EDX, - F(AVX_VNNI_INT8) + F(AVX_VNNI_INT8) | F(AVX_NE_CONVERT) ); kvm_cpu_cap_mask(CPUID_D_1_EAX, diff --git a/arch/x86/kvm/reverse_cpuid.h b/arch/x86/kvm/reverse_cpuid.h index 84f56b662424..43eff7207e01 100644 --- a/arch/x86/kvm/reverse_cpuid.h +++ b/arch/x86/kvm/reverse_cpuid.h @@ -39,6 +39,7 @@ enum kvm_only_cpuid_leafs { /* Intel-defined sub-features, CPUID level 0x00000007:1 (EDX) */ #define X86_FEATURE_AVX_VNNI_INT8 KVM_X86_FEATURE(CPUID_7_1_EDX, 4) +#define X86_FEATURE_AVX_NE_CONVERT KVM_X86_FEATURE(CPUID_7_1_EDX, 5) struct cpuid_reg { u32 function;