Commit 2f8de8c4 authored by Jiaxi Chen's avatar Jiaxi Chen Committed by Quanxian Wang
Browse files

x86: KVM: Advertise AVX-IFMA CPUID to user space

mainline inclusion
from mainline-v6.2-rc1
commit 5e85c4eb
category: feature
bugzilla: https://gitee.com/openeuler/intel-kernel/issues/I8GYV5
CVE: N/A
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5e85c4ebf206e50c58e82ca44c15e2be2bac6923



-------------------------------------

Intel-SIG: commit 5e85c4eb ("x86: KVM: Advertise AVX-IFMA CPUID to user space")

-------------------------------------

x86: KVM: Advertise AVX-IFMA CPUID to user space

AVX-IFMA is a new instruction in the latest Intel platform Sierra
Forest. This instruction packed multiplies unsigned 52-bit integers and
adds the low/high 52-bit products to Qword Accumulators.

The bit definition:
CPUID.(EAX=7,ECX=1):EAX[bit 23]

AVX-IFMA is on an expected-dense CPUID leaf and some other bits on this
leaf have kernel usages. Given that, define this feature bit like
X86_FEATURE_<name> in kernel. Considering AVX-IFMA itself has no truly
kernel usages and /proc/cpuinfo has too much unreadable flags, hide this
one in /proc/cpuinfo.

Advertise AVX-IFMA 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: default avatarJiaxi Chen <jiaxi.chen@linux.intel.com>
Acked-by: default avatarBorislav Petkov <bp@suse.de>
Message-Id: <20221125125845.1182922-6-jiaxi.chen@linux.intel.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Signed-off-by: default avatarQuanxian Wang <quanxian.wang@intel.com>
parent b500854d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -337,6 +337,7 @@
#define X86_FEATURE_FSRS		(12*32+11) /* "" Fast short REP STOSB */
#define X86_FEATURE_FSRC		(12*32+12) /* "" Fast short REP {CMPSB,SCASB} */
#define X86_FEATURE_AMX_FP16		(12*32+21) /* "" AMX fp16 Support */
#define X86_FEATURE_AVX_IFMA            (12*32+23) /* "" Support for VPMADD52[H,L]UQ */

/* AMD-defined CPU features, CPUID level 0x80000008 (EBX), word 13 */
#define X86_FEATURE_CLZERO		(13*32+ 0) /* CLZERO instruction */
+1 −1
Original line number Diff line number Diff line
@@ -504,7 +504,7 @@ void kvm_set_cpu_caps(void)

	kvm_cpu_cap_mask(CPUID_7_1_EAX,
		F(AVX_VNNI) | F(AVX512_BF16) | F(CMPCCXADD) | F(AMX_FP16) |
		F(FZRM) | F(FSRS) | F(FSRC)
		F(AVX_IFMA) | F(FZRM) | F(FSRS) | F(FSRC)
	);

	kvm_cpu_cap_mask(CPUID_D_1_EAX,