public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Tao Su <tao1.su@linux.intel.com>
To: kvm@vger.kernel.org, x86@kernel.org
Cc: seanjc@google.com, pbonzini@redhat.com, bp@alien8.de,
	dave.hansen@linux.intel.com, chao.gao@intel.com,
	xiaoyao.li@intel.com, jiaan.lu@intel.com, xuelian.guo@intel.com,
	tao1.su@linux.intel.com
Subject: [PATCH 4/4] KVM: x86: Advertise AVX-VNNI-INT16 CPUID to userspace
Date: Mon,  4 Nov 2024 14:35:59 +0800	[thread overview]
Message-ID: <20241104063559.727228-5-tao1.su@linux.intel.com> (raw)
In-Reply-To: <20241104063559.727228-1-tao1.su@linux.intel.com>

AVX-VNNI-INT16 is a new set of instructions in the latest Intel platform
Clearwater Forest, which can multiply and add unsigned and signed words
with and without saturation.

AVX-VNNI-INT16 is enumerated via CPUID.(EAX=7,ECX=1):EDX[bit 10].

Advertise AVX-VNNI-INT16 if it's supported in hardware. There are no new
VMX controls for the feature, i.e. the instructions can't be intercepted
and only use xmm, ymm registers.

Tested-by: Jiaan Lu <jiaan.lu@intel.com>
Tested-by: Xuelian Guo <xuelian.guo@intel.com>
Signed-off-by: Tao Su <tao1.su@linux.intel.com>
---
 arch/x86/kvm/cpuid.c         | 4 ++--
 arch/x86/kvm/reverse_cpuid.h | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
index 160b060121b2..68cde739a5a3 100644
--- a/arch/x86/kvm/cpuid.c
+++ b/arch/x86/kvm/cpuid.c
@@ -704,8 +704,8 @@ void kvm_set_cpu_caps(void)
 	);
 
 	kvm_cpu_cap_init_kvm_defined(CPUID_7_1_EDX,
-		F(AVX_VNNI_INT8) | F(AVX_NE_CONVERT) | F(PREFETCHITI) |
-		F(AMX_COMPLEX) | F(AVX10)
+		F(AVX_VNNI_INT8) | F(AVX_NE_CONVERT) | F(AMX_COMPLEX) |
+		F(AVX_VNNI_INT16) | F(PREFETCHITI) | F(AVX10)
 	);
 
 	kvm_cpu_cap_init_kvm_defined(CPUID_7_2_EDX,
diff --git a/arch/x86/kvm/reverse_cpuid.h b/arch/x86/kvm/reverse_cpuid.h
index 0d17d6b70639..e46220ece83c 100644
--- a/arch/x86/kvm/reverse_cpuid.h
+++ b/arch/x86/kvm/reverse_cpuid.h
@@ -46,6 +46,7 @@ enum kvm_only_cpuid_leafs {
 #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)
 #define X86_FEATURE_AMX_COMPLEX         KVM_X86_FEATURE(CPUID_7_1_EDX, 8)
+#define X86_FEATURE_AVX_VNNI_INT16      KVM_X86_FEATURE(CPUID_7_1_EDX, 10)
 #define X86_FEATURE_PREFETCHITI         KVM_X86_FEATURE(CPUID_7_1_EDX, 14)
 #define X86_FEATURE_AVX10               KVM_X86_FEATURE(CPUID_7_1_EDX, 19)
 
-- 
2.34.1


  parent reply	other threads:[~2024-11-04  6:42 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-04  6:35 [PATCH 0/4] Advertise CPUID for new instructions in Clearwater Forest Tao Su
2024-11-04  6:35 ` [PATCH 1/4] x86: KVM: Advertise SHA512 CPUID to userspace Tao Su
2024-11-04  6:35 ` [PATCH 2/4] x86: KVM: Advertise SM3 " Tao Su
2024-11-04 16:40   ` Dave Hansen
2024-11-05  0:58     ` Tao Su
2024-11-04  6:35 ` [PATCH 3/4] x86: KVM: Advertise SM4 " Tao Su
2024-11-04  6:35 ` Tao Su [this message]
2024-11-04  6:51 ` [PATCH 0/4] Advertise CPUID for new instructions in Clearwater Forest Borislav Petkov
2024-11-04  7:04   ` Tao Su
2024-11-04  9:58     ` Borislav Petkov
2024-11-04 13:21       ` Tao Su

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241104063559.727228-5-tao1.su@linux.intel.com \
    --to=tao1.su@linux.intel.com \
    --cc=bp@alien8.de \
    --cc=chao.gao@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=jiaan.lu@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    --cc=x86@kernel.org \
    --cc=xiaoyao.li@intel.com \
    --cc=xuelian.guo@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox