All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/7] x86: KVM: Advertise CPUID of new Intel platform
@ 2022-11-10  1:52 Jiaxi Chen
  2022-11-10  1:52 ` [PATCH v3 1/7] x86: KVM: Move existing x86 CPUID leaf [CPUID_7_1_EAX] to kvm-only leaf Jiaxi Chen
                   ` (6 more replies)
  0 siblings, 7 replies; 12+ messages in thread
From: Jiaxi Chen @ 2022-11-10  1:52 UTC (permalink / raw)
  To: kvm
  Cc: tglx, mingo, bp, dave.hansen, x86, hpa, seanjc, pbonzini,
	ndesaulniers, alexandre.belloni, peterz, jpoimboe,
	chang.seok.bae, pawan.kumar.gupta, babu.moger, jmattson,
	sandipan.das, tony.luck, sathyanarayanan.kuppuswamy, fenghua.yu,
	keescook, nathan, linux-kernel

Latest Intel platform Granite Rapids/Sierra Forest has introduced below
new instructions and CPUIDs:

 - CMPccXADD CPUID.(EAX=7,ECX=1):EAX[bit 7]
 - AMX-FP16 CPUID.(EAX=7,ECX=1):EAX[bit 21]
 - AVX-IFMA CPUID.(EAX=7,ECX=1):EAX[bit 23]
 - AVX-VNNI-INT8 CPUID.(EAX=7,ECX=1):EDX[bit 4]
 - AVX-NE-CONVERT CPUID.(EAX=7,ECX=1):EDX[bit 5]
 - PREFETCHITI CPUID.(EAX=7,ECX=1):EDX[bit 14]

Details can be found in recent Intel ISE (Instruction Set
Extensions)[1].

This patch series advertises KVM support of these CPUIDs to host
userspace.

[1] Intel ISE: https://cdrdv2.intel.com/v1/dl/getContent/671368

v3:
 - Remain CPUID_8000_001F_EAX in the last leaf of cpuid_leaf[]
 - Replace CPUID_7_1_EAX with CPUID_LNX_5, waiting for future new CPUIDs

v2:
https://lore.kernel.org/all/20221103025030.78371-1-jiaxi.chen@linux.intel.com/
 - Remove vague descriptions in the changelogs, including pronouns and
   "this patch" kind of things.
 - Move the two CPUIDs of cpuid_leaf[12] CPUID_7_1_EAX to kvm-only
   subleaves.
 - Replace cpuid_leaf[12] CPUID_7_1_EAX with the last leaf
   CPUID_8000_001F_EAX to shorten array length.
 - Change the newly-added CPUID leaf [CPUID_7_1_EDX] in v1 into kvm-only
   subleaves. 

v1:
https://lore.kernel.org/all/20221019084734.3590760-1-jiaxi.chen@linux.intel.com/

Jiaxi Chen (7):
  x86: KVM: Move existing x86 CPUID leaf [CPUID_7_1_EAX] to kvm-only
    leaf
  x86: KVM: Advertise CMPccXADD CPUID to user space
  x86: KVM: Advertise AMX-FP16 CPUID to user space
  x86: KVM: Advertise AVX-IFMA CPUID to user space
  x86: KVM: Advertise AVX-VNNI-INT8 CPUID to user space
  x86: KVM: Advertise AVX-NE-CONVERT CPUID to user space
  x86: KVM: Advertise PREFETCHIT0/1 CPUID to user space

 arch/x86/include/asm/cpufeature.h  |  2 +-
 arch/x86/include/asm/cpufeatures.h |  4 +---
 arch/x86/kernel/cpu/common.c       |  6 ------
 arch/x86/kernel/cpu/cpuid-deps.c   |  1 -
 arch/x86/kvm/cpuid.c               | 11 ++++++++---
 arch/x86/kvm/reverse_cpuid.h       | 15 +++++++++++++++
 6 files changed, 25 insertions(+), 14 deletions(-)


base-commit: 30a0b95b1335e12efef89dd78518ed3e4a71a763
-- 
2.27.0


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v3 1/7] x86: KVM: Move existing x86 CPUID leaf [CPUID_7_1_EAX] to kvm-only leaf
  2022-11-10  1:52 [PATCH v3 0/7] x86: KVM: Advertise CPUID of new Intel platform Jiaxi Chen
@ 2022-11-10  1:52 ` Jiaxi Chen
  2022-11-15 13:50   ` Xiaoyao Li
  2022-11-10  1:52 ` [PATCH v3 2/7] x86: KVM: Advertise CMPccXADD CPUID to user space Jiaxi Chen
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 12+ messages in thread
From: Jiaxi Chen @ 2022-11-10  1:52 UTC (permalink / raw)
  To: kvm
  Cc: tglx, mingo, bp, dave.hansen, x86, hpa, seanjc, pbonzini,
	ndesaulniers, alexandre.belloni, peterz, jpoimboe,
	chang.seok.bae, pawan.kumar.gupta, babu.moger, jmattson,
	sandipan.das, tony.luck, sathyanarayanan.kuppuswamy, fenghua.yu,
	keescook, nathan, linux-kernel

cpuid_leaf[12] CPUID_7_1_EAX has only two bits are in use currently:

 - AVX-VNNI CPUID.(EAX=7,ECX=1):EAX[bit 4]
 - AVX512-BF16 CPUID.(EAX=7,ECX=1):EAX[bit 5]

These two bits have no other kernel usages other than the guest
CPUID advertisement in KVM. Given that and to save space for kernel
feature bits, move these two bits to the kvm-only subleaves. The
existing leaf cpuid_leafs[12] is set to CPUID_LNX_5 so future feature
can pick it. This basically reverts:

 - commit b85a0425d805 ("Enumerate AVX Vector Neural Network
instructions")
 - commit b302e4b176d0 ("x86/cpufeatures: Enumerate the new AVX512
BFLOAT16 instructions")
 - commit 1085a6b585d7 ("KVM: Expose AVX_VNNI instruction to guset")

Signed-off-by: Jiaxi Chen <jiaxi.chen@linux.intel.com>
---
 arch/x86/include/asm/cpufeature.h  | 2 +-
 arch/x86/include/asm/cpufeatures.h | 4 +---
 arch/x86/kernel/cpu/common.c       | 6 ------
 arch/x86/kernel/cpu/cpuid-deps.c   | 1 -
 arch/x86/kvm/cpuid.c               | 2 +-
 arch/x86/kvm/reverse_cpuid.h       | 5 +++++
 6 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
index 1a85e1fb0922..b2905ddd7ab4 100644
--- a/arch/x86/include/asm/cpufeature.h
+++ b/arch/x86/include/asm/cpufeature.h
@@ -24,7 +24,7 @@ enum cpuid_leafs
 	CPUID_7_0_EBX,
 	CPUID_D_1_EAX,
 	CPUID_LNX_4,
-	CPUID_7_1_EAX,
+	CPUID_LNX_5,
 	CPUID_8000_0008_EBX,
 	CPUID_6_EAX,
 	CPUID_8000_000A_EDX,
diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h
index b71f4f2ecdd5..ec468d6eaf06 100644
--- a/arch/x86/include/asm/cpufeatures.h
+++ b/arch/x86/include/asm/cpufeatures.h
@@ -305,9 +305,7 @@
 #define X86_FEATURE_USE_IBPB_FW		(11*32+16) /* "" Use IBPB during runtime firmware calls */
 #define X86_FEATURE_RSB_VMEXIT_LITE	(11*32+17) /* "" Fill RSB on VM exit when EIBRS is enabled */
 
-/* Intel-defined CPU features, CPUID level 0x00000007:1 (EAX), word 12 */
-#define X86_FEATURE_AVX_VNNI		(12*32+ 4) /* AVX VNNI instructions */
-#define X86_FEATURE_AVX512_BF16		(12*32+ 5) /* AVX512 BFLOAT16 instructions */
+/* Linux-defined mapping, word 12 */
 
 /* AMD-defined CPU features, CPUID level 0x80000008 (EBX), word 13 */
 #define X86_FEATURE_CLZERO		(13*32+ 0) /* CLZERO instruction */
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 3e508f239098..0c19c84d7ba0 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -1026,12 +1026,6 @@ void get_cpu_cap(struct cpuinfo_x86 *c)
 		c->x86_capability[CPUID_7_0_EBX] = ebx;
 		c->x86_capability[CPUID_7_ECX] = ecx;
 		c->x86_capability[CPUID_7_EDX] = edx;
-
-		/* Check valid sub-leaf index before accessing it */
-		if (eax >= 1) {
-			cpuid_count(0x00000007, 1, &eax, &ebx, &ecx, &edx);
-			c->x86_capability[CPUID_7_1_EAX] = eax;
-		}
 	}
 
 	/* Extended state features: level 0x0000000d */
diff --git a/arch/x86/kernel/cpu/cpuid-deps.c b/arch/x86/kernel/cpu/cpuid-deps.c
index c881bcafba7d..a88e0e8c39fa 100644
--- a/arch/x86/kernel/cpu/cpuid-deps.c
+++ b/arch/x86/kernel/cpu/cpuid-deps.c
@@ -68,7 +68,6 @@ static const struct cpuid_dep cpuid_deps[] = {
 	{ X86_FEATURE_CQM_OCCUP_LLC,		X86_FEATURE_CQM_LLC   },
 	{ X86_FEATURE_CQM_MBM_TOTAL,		X86_FEATURE_CQM_LLC   },
 	{ X86_FEATURE_CQM_MBM_LOCAL,		X86_FEATURE_CQM_LLC   },
-	{ X86_FEATURE_AVX512_BF16,		X86_FEATURE_AVX512VL  },
 	{ X86_FEATURE_AVX512_FP16,		X86_FEATURE_AVX512BW  },
 	{ X86_FEATURE_ENQCMD,			X86_FEATURE_XSAVES    },
 	{ X86_FEATURE_PER_THREAD_MBA,		X86_FEATURE_MBA       },
diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
index 7065462378e2..89f5e7f0402b 100644
--- a/arch/x86/kvm/cpuid.c
+++ b/arch/x86/kvm/cpuid.c
@@ -656,7 +656,7 @@ void kvm_set_cpu_caps(void)
 	if (boot_cpu_has(X86_FEATURE_AMD_SSBD))
 		kvm_cpu_cap_set(X86_FEATURE_SPEC_CTRL_SSBD);
 
-	kvm_cpu_cap_mask(CPUID_7_1_EAX,
+	kvm_cpu_cap_init_scattered(CPUID_7_1_EAX,
 		F(AVX_VNNI) | F(AVX512_BF16)
 	);
 
diff --git a/arch/x86/kvm/reverse_cpuid.h b/arch/x86/kvm/reverse_cpuid.h
index a19d473d0184..674de5b24f8d 100644
--- a/arch/x86/kvm/reverse_cpuid.h
+++ b/arch/x86/kvm/reverse_cpuid.h
@@ -13,6 +13,7 @@
  */
 enum kvm_only_cpuid_leafs {
 	CPUID_12_EAX	 = NCAPINTS,
+	CPUID_7_1_EAX,
 	NR_KVM_CPU_CAPS,
 
 	NKVMCAPINTS = NR_KVM_CPU_CAPS - NCAPINTS,
@@ -24,6 +25,10 @@ enum kvm_only_cpuid_leafs {
 #define KVM_X86_FEATURE_SGX1		KVM_X86_FEATURE(CPUID_12_EAX, 0)
 #define KVM_X86_FEATURE_SGX2		KVM_X86_FEATURE(CPUID_12_EAX, 1)
 
+/* Intel-defined sub-features, CPUID level 0x00000007:1 (EAX) */
+#define X86_FEATURE_AVX_VNNI            KVM_X86_FEATURE(CPUID_7_1_EAX, 4)
+#define X86_FEATURE_AVX512_BF16         KVM_X86_FEATURE(CPUID_7_1_EAX, 5)
+
 struct cpuid_reg {
 	u32 function;
 	u32 index;
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v3 2/7] x86: KVM: Advertise CMPccXADD CPUID to user space
  2022-11-10  1:52 [PATCH v3 0/7] x86: KVM: Advertise CPUID of new Intel platform Jiaxi Chen
  2022-11-10  1:52 ` [PATCH v3 1/7] x86: KVM: Move existing x86 CPUID leaf [CPUID_7_1_EAX] to kvm-only leaf Jiaxi Chen
@ 2022-11-10  1:52 ` Jiaxi Chen
  2022-11-10  1:52 ` [PATCH v3 3/7] x86: KVM: Advertise AMX-FP16 " Jiaxi Chen
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 12+ messages in thread
From: Jiaxi Chen @ 2022-11-10  1:52 UTC (permalink / raw)
  To: kvm
  Cc: tglx, mingo, bp, dave.hansen, x86, hpa, seanjc, pbonzini,
	ndesaulniers, alexandre.belloni, peterz, jpoimboe,
	chang.seok.bae, pawan.kumar.gupta, babu.moger, jmattson,
	sandipan.das, tony.luck, sathyanarayanan.kuppuswamy, fenghua.yu,
	keescook, nathan, linux-kernel

CMPccXADD is a new set of instructions in the latest Intel platform
Sierra Forest. This new instruction set includes a semaphore operation
that can compare and add the operands if condition is met, which can
improve database performance.

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

This CPUID is exposed to userspace. Besides, there is no other VMX
control for this instruction.

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 89f5e7f0402b..b388ef52f8c8 100644
--- a/arch/x86/kvm/cpuid.c
+++ b/arch/x86/kvm/cpuid.c
@@ -657,7 +657,7 @@ void kvm_set_cpu_caps(void)
 		kvm_cpu_cap_set(X86_FEATURE_SPEC_CTRL_SSBD);
 
 	kvm_cpu_cap_init_scattered(CPUID_7_1_EAX,
-		F(AVX_VNNI) | F(AVX512_BF16)
+		F(AVX_VNNI) | F(AVX512_BF16) | F(CMPCCXADD)
 	);
 
 	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 674de5b24f8d..24f570ddb225 100644
--- a/arch/x86/kvm/reverse_cpuid.h
+++ b/arch/x86/kvm/reverse_cpuid.h
@@ -28,6 +28,7 @@ enum kvm_only_cpuid_leafs {
 /* Intel-defined sub-features, CPUID level 0x00000007:1 (EAX) */
 #define X86_FEATURE_AVX_VNNI            KVM_X86_FEATURE(CPUID_7_1_EAX, 4)
 #define X86_FEATURE_AVX512_BF16         KVM_X86_FEATURE(CPUID_7_1_EAX, 5)
+#define X86_FEATURE_CMPCCXADD           KVM_X86_FEATURE(CPUID_7_1_EAX, 7)
 
 struct cpuid_reg {
 	u32 function;
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v3 3/7] x86: KVM: Advertise AMX-FP16 CPUID to user space
  2022-11-10  1:52 [PATCH v3 0/7] x86: KVM: Advertise CPUID of new Intel platform Jiaxi Chen
  2022-11-10  1:52 ` [PATCH v3 1/7] x86: KVM: Move existing x86 CPUID leaf [CPUID_7_1_EAX] to kvm-only leaf Jiaxi Chen
  2022-11-10  1:52 ` [PATCH v3 2/7] x86: KVM: Advertise CMPccXADD CPUID to user space Jiaxi Chen
@ 2022-11-10  1:52 ` Jiaxi Chen
  2022-11-10  1:52 ` [PATCH v3 4/7] x86: KVM: Advertise AVX-IFMA " Jiaxi Chen
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 12+ messages in thread
From: Jiaxi Chen @ 2022-11-10  1:52 UTC (permalink / raw)
  To: kvm
  Cc: tglx, mingo, bp, dave.hansen, x86, hpa, seanjc, pbonzini,
	ndesaulniers, alexandre.belloni, peterz, jpoimboe,
	chang.seok.bae, pawan.kumar.gupta, babu.moger, jmattson,
	sandipan.das, tony.luck, sathyanarayanan.kuppuswamy, fenghua.yu,
	keescook, nathan, linux-kernel

Latest Intel platform Granite Rapids has introduced a new instruction -
AMX-FP16, which performs dot-products of two FP16 tiles and accumulates
the results into a packed single precision tile. This instrucion needs
no additional enabling on top of the existing kernel AMX enabling.

AMX-FP16 adds FP16 capability and also allows a FP16 GPU trained model
to run faster without loss of accuracy or added SW overhead.

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

This CPUID is exposed to user space. Besides, there is no other VMX
control for this instruction.

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 b388ef52f8c8..19ef02d5b11b 100644
--- a/arch/x86/kvm/cpuid.c
+++ b/arch/x86/kvm/cpuid.c
@@ -657,7 +657,7 @@ void kvm_set_cpu_caps(void)
 		kvm_cpu_cap_set(X86_FEATURE_SPEC_CTRL_SSBD);
 
 	kvm_cpu_cap_init_scattered(CPUID_7_1_EAX,
-		F(AVX_VNNI) | F(AVX512_BF16) | F(CMPCCXADD)
+		F(AVX_VNNI) | F(AVX512_BF16) | F(CMPCCXADD) | F(AMX_FP16)
 	);
 
 	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 24f570ddb225..05fd43ebd226 100644
--- a/arch/x86/kvm/reverse_cpuid.h
+++ b/arch/x86/kvm/reverse_cpuid.h
@@ -29,6 +29,7 @@ enum kvm_only_cpuid_leafs {
 #define X86_FEATURE_AVX_VNNI            KVM_X86_FEATURE(CPUID_7_1_EAX, 4)
 #define X86_FEATURE_AVX512_BF16         KVM_X86_FEATURE(CPUID_7_1_EAX, 5)
 #define X86_FEATURE_CMPCCXADD           KVM_X86_FEATURE(CPUID_7_1_EAX, 7)
+#define X86_FEATURE_AMX_FP16            KVM_X86_FEATURE(CPUID_7_1_EAX, 21)
 
 struct cpuid_reg {
 	u32 function;
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v3 4/7] x86: KVM: Advertise AVX-IFMA CPUID to user space
  2022-11-10  1:52 [PATCH v3 0/7] x86: KVM: Advertise CPUID of new Intel platform Jiaxi Chen
                   ` (2 preceding siblings ...)
  2022-11-10  1:52 ` [PATCH v3 3/7] x86: KVM: Advertise AMX-FP16 " Jiaxi Chen
@ 2022-11-10  1:52 ` Jiaxi Chen
  2022-11-10  1:52 ` [PATCH v3 5/7] x86: KVM: Advertise AVX-VNNI-INT8 " Jiaxi Chen
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 12+ messages in thread
From: Jiaxi Chen @ 2022-11-10  1:52 UTC (permalink / raw)
  To: kvm
  Cc: tglx, mingo, bp, dave.hansen, x86, hpa, seanjc, pbonzini,
	ndesaulniers, alexandre.belloni, peterz, jpoimboe,
	chang.seok.bae, pawan.kumar.gupta, babu.moger, jmattson,
	sandipan.das, tony.luck, sathyanarayanan.kuppuswamy, fenghua.yu,
	keescook, nathan, linux-kernel

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]

This CPUID is exposed to user space. Besides, there is no other VMX
control for this instruction.

Signed-off-by: Jiaxi Chen <jiaxi.chen@linux.intel.com>
---
 arch/x86/kvm/cpuid.c         | 3 ++-
 arch/x86/kvm/reverse_cpuid.h | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
index 19ef02d5b11b..e84c6216a72c 100644
--- a/arch/x86/kvm/cpuid.c
+++ b/arch/x86/kvm/cpuid.c
@@ -657,7 +657,8 @@ void kvm_set_cpu_caps(void)
 		kvm_cpu_cap_set(X86_FEATURE_SPEC_CTRL_SSBD);
 
 	kvm_cpu_cap_init_scattered(CPUID_7_1_EAX,
-		F(AVX_VNNI) | F(AVX512_BF16) | F(CMPCCXADD) | F(AMX_FP16)
+		F(AVX_VNNI) | F(AVX512_BF16) | F(CMPCCXADD) | F(AMX_FP16) |
+		F(AVX_IFMA)
 	);
 
 	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 05fd43ebd226..954c0ceb1e90 100644
--- a/arch/x86/kvm/reverse_cpuid.h
+++ b/arch/x86/kvm/reverse_cpuid.h
@@ -30,6 +30,7 @@ enum kvm_only_cpuid_leafs {
 #define X86_FEATURE_AVX512_BF16         KVM_X86_FEATURE(CPUID_7_1_EAX, 5)
 #define X86_FEATURE_CMPCCXADD           KVM_X86_FEATURE(CPUID_7_1_EAX, 7)
 #define X86_FEATURE_AMX_FP16            KVM_X86_FEATURE(CPUID_7_1_EAX, 21)
+#define X86_FEATURE_AVX_IFMA            KVM_X86_FEATURE(CPUID_7_1_EAX, 23)
 
 struct cpuid_reg {
 	u32 function;
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v3 5/7] x86: KVM: Advertise AVX-VNNI-INT8 CPUID to user space
  2022-11-10  1:52 [PATCH v3 0/7] x86: KVM: Advertise CPUID of new Intel platform Jiaxi Chen
                   ` (3 preceding siblings ...)
  2022-11-10  1:52 ` [PATCH v3 4/7] x86: KVM: Advertise AVX-IFMA " Jiaxi Chen
@ 2022-11-10  1:52 ` Jiaxi Chen
  2022-11-10  1:52 ` [PATCH v3 6/7] x86: KVM: Advertise AVX-NE-CONVERT " Jiaxi Chen
  2022-11-10  1:52 ` [PATCH v3 7/7] x86: KVM: Advertise PREFETCHIT0/1 " Jiaxi Chen
  6 siblings, 0 replies; 12+ messages in thread
From: Jiaxi Chen @ 2022-11-10  1:52 UTC (permalink / raw)
  To: kvm
  Cc: tglx, mingo, bp, dave.hansen, x86, hpa, seanjc, pbonzini,
	ndesaulniers, alexandre.belloni, peterz, jpoimboe,
	chang.seok.bae, pawan.kumar.gupta, babu.moger, jmattson,
	sandipan.das, tony.luck, sathyanarayanan.kuppuswamy, fenghua.yu,
	keescook, nathan, linux-kernel

AVX-VNNI-INT8 is a new set of instructions in the latest Intel platform
Sierra Forest, aims for the platform to have superior AI capabilities.
This instruction multiplies the individual bytes of two unsigned or
unsigned source operands, then adds and accumulates the results into the
destination dword element size operand.

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

This CPUID is exposed to user space. Besides, there is no other VMX
control for this instruction.

Signed-off-by: Jiaxi Chen <jiaxi.chen@linux.intel.com>
---
 arch/x86/kvm/cpuid.c         | 5 ++++-
 arch/x86/kvm/reverse_cpuid.h | 5 +++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
index e84c6216a72c..06dacf71ff9c 100644
--- a/arch/x86/kvm/cpuid.c
+++ b/arch/x86/kvm/cpuid.c
@@ -661,6 +661,9 @@ void kvm_set_cpu_caps(void)
 		F(AVX_IFMA)
 	);
 
+	kvm_cpu_cap_init_scattered(CPUID_7_1_EDX,
+		F(AVX_VNNI_INT8));
+
 	kvm_cpu_cap_mask(CPUID_D_1_EAX,
 		F(XSAVEOPT) | F(XSAVEC) | F(XGETBV1) | F(XSAVES) | f_xfd
 	);
@@ -914,9 +917,9 @@ static inline int __do_cpuid_func(struct kvm_cpuid_array *array, u32 function)
 				goto out;
 
 			cpuid_entry_override(entry, CPUID_7_1_EAX);
+			cpuid_entry_override(entry, CPUID_7_1_EDX);
 			entry->ebx = 0;
 			entry->ecx = 0;
-			entry->edx = 0;
 		}
 		break;
 	case 0xa: { /* Architectural Performance Monitoring */
diff --git a/arch/x86/kvm/reverse_cpuid.h b/arch/x86/kvm/reverse_cpuid.h
index 954c0ceb1e90..819b4e0b13a3 100644
--- a/arch/x86/kvm/reverse_cpuid.h
+++ b/arch/x86/kvm/reverse_cpuid.h
@@ -14,6 +14,7 @@
 enum kvm_only_cpuid_leafs {
 	CPUID_12_EAX	 = NCAPINTS,
 	CPUID_7_1_EAX,
+	CPUID_7_1_EDX,
 	NR_KVM_CPU_CAPS,
 
 	NKVMCAPINTS = NR_KVM_CPU_CAPS - NCAPINTS,
@@ -32,6 +33,9 @@ enum kvm_only_cpuid_leafs {
 #define X86_FEATURE_AMX_FP16            KVM_X86_FEATURE(CPUID_7_1_EAX, 21)
 #define X86_FEATURE_AVX_IFMA            KVM_X86_FEATURE(CPUID_7_1_EAX, 23)
 
+/* Intel-defined sub-features, CPUID level 0x00000007:1 (EDX) */
+#define X86_FEATURE_AVX_VNNI_INT8       KVM_X86_FEATURE(CPUID_7_1_EDX, 4)
+
 struct cpuid_reg {
 	u32 function;
 	u32 index;
@@ -56,6 +60,7 @@ static const struct cpuid_reg reverse_cpuid[] = {
 	[CPUID_7_1_EAX]       = {         7, 1, CPUID_EAX},
 	[CPUID_12_EAX]        = {0x00000012, 0, CPUID_EAX},
 	[CPUID_8000_001F_EAX] = {0x8000001f, 0, CPUID_EAX},
+	[CPUID_7_1_EDX]       = {         7, 1, CPUID_EDX},
 };
 
 /*
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v3 6/7] x86: KVM: Advertise AVX-NE-CONVERT CPUID to user space
  2022-11-10  1:52 [PATCH v3 0/7] x86: KVM: Advertise CPUID of new Intel platform Jiaxi Chen
                   ` (4 preceding siblings ...)
  2022-11-10  1:52 ` [PATCH v3 5/7] x86: KVM: Advertise AVX-VNNI-INT8 " Jiaxi Chen
@ 2022-11-10  1:52 ` Jiaxi Chen
  2022-11-10  1:52 ` [PATCH v3 7/7] x86: KVM: Advertise PREFETCHIT0/1 " Jiaxi Chen
  6 siblings, 0 replies; 12+ messages in thread
From: Jiaxi Chen @ 2022-11-10  1:52 UTC (permalink / raw)
  To: kvm
  Cc: tglx, mingo, bp, dave.hansen, x86, hpa, seanjc, pbonzini,
	ndesaulniers, alexandre.belloni, peterz, jpoimboe,
	chang.seok.bae, pawan.kumar.gupta, babu.moger, jmattson,
	sandipan.das, tony.luck, sathyanarayanan.kuppuswamy, fenghua.yu,
	keescook, nathan, linux-kernel

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]

This CPUID is exposed to user space. Besides, there is no other VMX
control for this instruction.

Signed-off-by: Jiaxi Chen <jiaxi.chen@linux.intel.com>
---
 arch/x86/kvm/cpuid.c         | 3 ++-
 arch/x86/kvm/reverse_cpuid.h | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
index 06dacf71ff9c..47ac2a502d91 100644
--- a/arch/x86/kvm/cpuid.c
+++ b/arch/x86/kvm/cpuid.c
@@ -662,7 +662,8 @@ void kvm_set_cpu_caps(void)
 	);
 
 	kvm_cpu_cap_init_scattered(CPUID_7_1_EDX,
-		F(AVX_VNNI_INT8));
+		F(AVX_VNNI_INT8) | F(AVX_NE_CONVERT)
+	);
 
 	kvm_cpu_cap_mask(CPUID_D_1_EAX,
 		F(XSAVEOPT) | F(XSAVEC) | F(XGETBV1) | F(XSAVES) | f_xfd
diff --git a/arch/x86/kvm/reverse_cpuid.h b/arch/x86/kvm/reverse_cpuid.h
index 819b4e0b13a3..b8addd85b062 100644
--- a/arch/x86/kvm/reverse_cpuid.h
+++ b/arch/x86/kvm/reverse_cpuid.h
@@ -35,6 +35,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;
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v3 7/7] x86: KVM: Advertise PREFETCHIT0/1 CPUID to user space
  2022-11-10  1:52 [PATCH v3 0/7] x86: KVM: Advertise CPUID of new Intel platform Jiaxi Chen
                   ` (5 preceding siblings ...)
  2022-11-10  1:52 ` [PATCH v3 6/7] x86: KVM: Advertise AVX-NE-CONVERT " Jiaxi Chen
@ 2022-11-10  1:52 ` Jiaxi Chen
  6 siblings, 0 replies; 12+ messages in thread
From: Jiaxi Chen @ 2022-11-10  1:52 UTC (permalink / raw)
  To: kvm
  Cc: tglx, mingo, bp, dave.hansen, x86, hpa, seanjc, pbonzini,
	ndesaulniers, alexandre.belloni, peterz, jpoimboe,
	chang.seok.bae, pawan.kumar.gupta, babu.moger, jmattson,
	sandipan.das, tony.luck, sathyanarayanan.kuppuswamy, fenghua.yu,
	keescook, nathan, linux-kernel

Latest Intel platform Granite Rapids has introduced a new instruction -
PREFETCHIT0/1, which moves code to memory (cache) closer to the
processor depending on specific hints.

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

This CPUID is exposed to user space. Besides, there is no other VMX
control for this instruction.

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 47ac2a502d91..9021a80b3553 100644
--- a/arch/x86/kvm/cpuid.c
+++ b/arch/x86/kvm/cpuid.c
@@ -662,7 +662,7 @@ void kvm_set_cpu_caps(void)
 	);
 
 	kvm_cpu_cap_init_scattered(CPUID_7_1_EDX,
-		F(AVX_VNNI_INT8) | F(AVX_NE_CONVERT)
+		F(AVX_VNNI_INT8) | F(AVX_NE_CONVERT) | F(PREFETCHITI)
 	);
 
 	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 b8addd85b062..884aebe7b3c2 100644
--- a/arch/x86/kvm/reverse_cpuid.h
+++ b/arch/x86/kvm/reverse_cpuid.h
@@ -36,6 +36,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)
+#define X86_FEATURE_PREFETCHITI         KVM_X86_FEATURE(CPUID_7_1_EDX, 14)
 
 struct cpuid_reg {
 	u32 function;
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH v3 1/7] x86: KVM: Move existing x86 CPUID leaf [CPUID_7_1_EAX] to kvm-only leaf
  2022-11-10  1:52 ` [PATCH v3 1/7] x86: KVM: Move existing x86 CPUID leaf [CPUID_7_1_EAX] to kvm-only leaf Jiaxi Chen
@ 2022-11-15 13:50   ` Xiaoyao Li
  2022-11-15 15:29     ` Sean Christopherson
  0 siblings, 1 reply; 12+ messages in thread
From: Xiaoyao Li @ 2022-11-15 13:50 UTC (permalink / raw)
  To: Jiaxi Chen, kvm
  Cc: tglx, mingo, bp, dave.hansen, x86, hpa, seanjc, pbonzini,
	ndesaulniers, alexandre.belloni, peterz, jpoimboe,
	chang.seok.bae, pawan.kumar.gupta, babu.moger, jmattson,
	sandipan.das, tony.luck, sathyanarayanan.kuppuswamy, fenghua.yu,
	keescook, nathan, linux-kernel

On 11/10/2022 9:52 AM, Jiaxi Chen wrote:
> cpuid_leaf[12] CPUID_7_1_EAX has only two bits are in use currently:
> 
>   - AVX-VNNI CPUID.(EAX=7,ECX=1):EAX[bit 4]
>   - AVX512-BF16 CPUID.(EAX=7,ECX=1):EAX[bit 5]
> 
> These two bits have no other kernel usages other than the guest
> CPUID advertisement in KVM. Given that and to save space for kernel
> feature bits, move these two bits to the kvm-only subleaves. The
> existing leaf cpuid_leafs[12] is set to CPUID_LNX_5 so future feature
> can pick it. This basically reverts:
> 
>   - commit b85a0425d805 ("Enumerate AVX Vector Neural Network
> instructions")
>   - commit b302e4b176d0 ("x86/cpufeatures: Enumerate the new AVX512
> BFLOAT16 instructions")
>   - commit 1085a6b585d7 ("KVM: Expose AVX_VNNI instruction to guset")

FYI, LAM support has been queued in tip 
https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?id=aa387b1b1e666cacffc0b7ac7e0949a68013b2d9

It adds

+#define X86_FEATURE_LAM			(12*32+26) /* Linear Address Masking */

and conflict with this patch.

Seen from the ISE, there are more bits defined in CPUID_7_1_EAX. And I 
believe Intel will define more and it's likely some of them will be used 
by kernel just like LAM.

> Signed-off-by: Jiaxi Chen <jiaxi.chen@linux.intel.com>
> ---
>   arch/x86/include/asm/cpufeature.h  | 2 +-
>   arch/x86/include/asm/cpufeatures.h | 4 +---
>   arch/x86/kernel/cpu/common.c       | 6 ------
>   arch/x86/kernel/cpu/cpuid-deps.c   | 1 -
>   arch/x86/kvm/cpuid.c               | 2 +-
>   arch/x86/kvm/reverse_cpuid.h       | 5 +++++
>   6 files changed, 8 insertions(+), 12 deletions(-)
> 
> diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
> index 1a85e1fb0922..b2905ddd7ab4 100644
> --- a/arch/x86/include/asm/cpufeature.h
> +++ b/arch/x86/include/asm/cpufeature.h
> @@ -24,7 +24,7 @@ enum cpuid_leafs
>   	CPUID_7_0_EBX,
>   	CPUID_D_1_EAX,
>   	CPUID_LNX_4,
> -	CPUID_7_1_EAX,
> +	CPUID_LNX_5,
>   	CPUID_8000_0008_EBX,
>   	CPUID_6_EAX,
>   	CPUID_8000_000A_EDX,
> diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h
> index b71f4f2ecdd5..ec468d6eaf06 100644
> --- a/arch/x86/include/asm/cpufeatures.h
> +++ b/arch/x86/include/asm/cpufeatures.h
> @@ -305,9 +305,7 @@
>   #define X86_FEATURE_USE_IBPB_FW		(11*32+16) /* "" Use IBPB during runtime firmware calls */
>   #define X86_FEATURE_RSB_VMEXIT_LITE	(11*32+17) /* "" Fill RSB on VM exit when EIBRS is enabled */
>   
> -/* Intel-defined CPU features, CPUID level 0x00000007:1 (EAX), word 12 */
> -#define X86_FEATURE_AVX_VNNI		(12*32+ 4) /* AVX VNNI instructions */
> -#define X86_FEATURE_AVX512_BF16		(12*32+ 5) /* AVX512 BFLOAT16 instructions */
> +/* Linux-defined mapping, word 12 */
>   
>   /* AMD-defined CPU features, CPUID level 0x80000008 (EBX), word 13 */
>   #define X86_FEATURE_CLZERO		(13*32+ 0) /* CLZERO instruction */
> diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
> index 3e508f239098..0c19c84d7ba0 100644
> --- a/arch/x86/kernel/cpu/common.c
> +++ b/arch/x86/kernel/cpu/common.c
> @@ -1026,12 +1026,6 @@ void get_cpu_cap(struct cpuinfo_x86 *c)
>   		c->x86_capability[CPUID_7_0_EBX] = ebx;
>   		c->x86_capability[CPUID_7_ECX] = ecx;
>   		c->x86_capability[CPUID_7_EDX] = edx;
> -
> -		/* Check valid sub-leaf index before accessing it */
> -		if (eax >= 1) {
> -			cpuid_count(0x00000007, 1, &eax, &ebx, &ecx, &edx);
> -			c->x86_capability[CPUID_7_1_EAX] = eax;
> -		}
>   	}
>   
>   	/* Extended state features: level 0x0000000d */
> diff --git a/arch/x86/kernel/cpu/cpuid-deps.c b/arch/x86/kernel/cpu/cpuid-deps.c
> index c881bcafba7d..a88e0e8c39fa 100644
> --- a/arch/x86/kernel/cpu/cpuid-deps.c
> +++ b/arch/x86/kernel/cpu/cpuid-deps.c
> @@ -68,7 +68,6 @@ static const struct cpuid_dep cpuid_deps[] = {
>   	{ X86_FEATURE_CQM_OCCUP_LLC,		X86_FEATURE_CQM_LLC   },
>   	{ X86_FEATURE_CQM_MBM_TOTAL,		X86_FEATURE_CQM_LLC   },
>   	{ X86_FEATURE_CQM_MBM_LOCAL,		X86_FEATURE_CQM_LLC   },
> -	{ X86_FEATURE_AVX512_BF16,		X86_FEATURE_AVX512VL  },
>   	{ X86_FEATURE_AVX512_FP16,		X86_FEATURE_AVX512BW  },
>   	{ X86_FEATURE_ENQCMD,			X86_FEATURE_XSAVES    },
>   	{ X86_FEATURE_PER_THREAD_MBA,		X86_FEATURE_MBA       },
> diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
> index 7065462378e2..89f5e7f0402b 100644
> --- a/arch/x86/kvm/cpuid.c
> +++ b/arch/x86/kvm/cpuid.c
> @@ -656,7 +656,7 @@ void kvm_set_cpu_caps(void)
>   	if (boot_cpu_has(X86_FEATURE_AMD_SSBD))
>   		kvm_cpu_cap_set(X86_FEATURE_SPEC_CTRL_SSBD);
>   
> -	kvm_cpu_cap_mask(CPUID_7_1_EAX,
> +	kvm_cpu_cap_init_scattered(CPUID_7_1_EAX,
>   		F(AVX_VNNI) | F(AVX512_BF16)
>   	);
>   
> diff --git a/arch/x86/kvm/reverse_cpuid.h b/arch/x86/kvm/reverse_cpuid.h
> index a19d473d0184..674de5b24f8d 100644
> --- a/arch/x86/kvm/reverse_cpuid.h
> +++ b/arch/x86/kvm/reverse_cpuid.h
> @@ -13,6 +13,7 @@
>    */
>   enum kvm_only_cpuid_leafs {
>   	CPUID_12_EAX	 = NCAPINTS,
> +	CPUID_7_1_EAX,
>   	NR_KVM_CPU_CAPS,
>   
>   	NKVMCAPINTS = NR_KVM_CPU_CAPS - NCAPINTS,
> @@ -24,6 +25,10 @@ enum kvm_only_cpuid_leafs {
>   #define KVM_X86_FEATURE_SGX1		KVM_X86_FEATURE(CPUID_12_EAX, 0)
>   #define KVM_X86_FEATURE_SGX2		KVM_X86_FEATURE(CPUID_12_EAX, 1)
>   
> +/* Intel-defined sub-features, CPUID level 0x00000007:1 (EAX) */
> +#define X86_FEATURE_AVX_VNNI            KVM_X86_FEATURE(CPUID_7_1_EAX, 4)
> +#define X86_FEATURE_AVX512_BF16         KVM_X86_FEATURE(CPUID_7_1_EAX, 5)
> +
>   struct cpuid_reg {
>   	u32 function;
>   	u32 index;


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v3 1/7] x86: KVM: Move existing x86 CPUID leaf [CPUID_7_1_EAX] to kvm-only leaf
  2022-11-15 13:50   ` Xiaoyao Li
@ 2022-11-15 15:29     ` Sean Christopherson
  2022-11-15 16:16       ` Borislav Petkov
  0 siblings, 1 reply; 12+ messages in thread
From: Sean Christopherson @ 2022-11-15 15:29 UTC (permalink / raw)
  To: Xiaoyao Li
  Cc: Jiaxi Chen, kvm, tglx, mingo, bp, dave.hansen, x86, hpa,
	pbonzini, ndesaulniers, alexandre.belloni, peterz, jpoimboe,
	chang.seok.bae, pawan.kumar.gupta, babu.moger, jmattson,
	sandipan.das, tony.luck, sathyanarayanan.kuppuswamy, fenghua.yu,
	keescook, nathan, linux-kernel

On Tue, Nov 15, 2022, Xiaoyao Li wrote:
> On 11/10/2022 9:52 AM, Jiaxi Chen wrote:
> > cpuid_leaf[12] CPUID_7_1_EAX has only two bits are in use currently:
> > 
> >   - AVX-VNNI CPUID.(EAX=7,ECX=1):EAX[bit 4]
> >   - AVX512-BF16 CPUID.(EAX=7,ECX=1):EAX[bit 5]
> > 
> > These two bits have no other kernel usages other than the guest
> > CPUID advertisement in KVM. Given that and to save space for kernel
> > feature bits, move these two bits to the kvm-only subleaves. The
> > existing leaf cpuid_leafs[12] is set to CPUID_LNX_5 so future feature
> > can pick it. This basically reverts:
> > 
> >   - commit b85a0425d805 ("Enumerate AVX Vector Neural Network
> > instructions")
> >   - commit b302e4b176d0 ("x86/cpufeatures: Enumerate the new AVX512
> > BFLOAT16 instructions")
> >   - commit 1085a6b585d7 ("KVM: Expose AVX_VNNI instruction to guset")
> 
> FYI, LAM support has been queued in tip https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?id=aa387b1b1e666cacffc0b7ac7e0949a68013b2d9
> 
> It adds
> 
> +#define X86_FEATURE_LAM			(12*32+26) /* Linear Address Masking */
> 
> and conflict with this patch.
> 
> Seen from the ISE, there are more bits defined in CPUID_7_1_EAX. And I
> believe Intel will define more and it's likely some of them will be used by
> kernel just like LAM.

Heh, are any of the bits you believe Intel will add publicly documented?  :-)

LAM could be scattered, but if more bits are expected that's probably a waste of
time and effort.

Thanks for the heads up!

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v3 1/7] x86: KVM: Move existing x86 CPUID leaf [CPUID_7_1_EAX] to kvm-only leaf
  2022-11-15 15:29     ` Sean Christopherson
@ 2022-11-15 16:16       ` Borislav Petkov
  2022-11-16  2:27         ` Jiaxi Chen
  0 siblings, 1 reply; 12+ messages in thread
From: Borislav Petkov @ 2022-11-15 16:16 UTC (permalink / raw)
  To: Sean Christopherson
  Cc: Xiaoyao Li, Jiaxi Chen, kvm, tglx, mingo, dave.hansen, x86, hpa,
	pbonzini, ndesaulniers, alexandre.belloni, peterz, jpoimboe,
	chang.seok.bae, pawan.kumar.gupta, babu.moger, jmattson,
	sandipan.das, tony.luck, sathyanarayanan.kuppuswamy, fenghua.yu,
	keescook, nathan, linux-kernel

On Tue, Nov 15, 2022 at 03:29:45PM +0000, Sean Christopherson wrote:
> Heh, are any of the bits you believe Intel will add publicly documented?  :-)
> 
> LAM could be scattered, but if more bits are expected that's probably a waste of
> time and effort.

I'm being told the bigger part of that word is going to be used for
either kernel or KVM bits so we might as well use it the "normal" way
instead of doing KVM-only or scattered bits after all.

Thx.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v3 1/7] x86: KVM: Move existing x86 CPUID leaf [CPUID_7_1_EAX] to kvm-only leaf
  2022-11-15 16:16       ` Borislav Petkov
@ 2022-11-16  2:27         ` Jiaxi Chen
  0 siblings, 0 replies; 12+ messages in thread
From: Jiaxi Chen @ 2022-11-16  2:27 UTC (permalink / raw)
  To: Borislav Petkov, Sean Christopherson
  Cc: Xiaoyao Li, kvm, tglx, mingo, dave.hansen, x86, hpa, pbonzini,
	ndesaulniers, alexandre.belloni, peterz, jpoimboe,
	chang.seok.bae, pawan.kumar.gupta, babu.moger, jmattson,
	sandipan.das, tony.luck, sathyanarayanan.kuppuswamy, fenghua.yu,
	keescook, nathan, linux-kernel



On 11/16/2022 12:16 AM, Borislav Petkov wrote:
> On Tue, Nov 15, 2022 at 03:29:45PM +0000, Sean Christopherson wrote:
>> Heh, are any of the bits you believe Intel will add publicly documented?  :-)
>>
>> LAM could be scattered, but if more bits are expected that's probably a waste of
>> time and effort.
> 
> I'm being told the bigger part of that word is going to be used for
> either kernel or KVM bits so we might as well use it the "normal" way
> instead of doing KVM-only or scattered bits after all.
> 
> Thx.
> 
Intel published ISE spec
[https://cdrdv2.intel.com/v1/dl/getContent/671368] has documented 11
instructions for this leaf CPUID.7.1.EAX by now. Given that more bits
are going to be defined, I will enable these bits in the patch series as
v1 did and will not move them to kvm-only leaves.

By the way, Boris, what about CPUID.7.1.EDX, whether bigger part of it
is expected to be used? In intel ISE, 3 bits are defined for this word.
For now, I think put them in kvm-only subleaves as this patch series did
is a better choice. What's your opinion?

-- 
Regards,
Jiaxi

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2022-11-16  2:27 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-10  1:52 [PATCH v3 0/7] x86: KVM: Advertise CPUID of new Intel platform Jiaxi Chen
2022-11-10  1:52 ` [PATCH v3 1/7] x86: KVM: Move existing x86 CPUID leaf [CPUID_7_1_EAX] to kvm-only leaf Jiaxi Chen
2022-11-15 13:50   ` Xiaoyao Li
2022-11-15 15:29     ` Sean Christopherson
2022-11-15 16:16       ` Borislav Petkov
2022-11-16  2:27         ` Jiaxi Chen
2022-11-10  1:52 ` [PATCH v3 2/7] x86: KVM: Advertise CMPccXADD CPUID to user space Jiaxi Chen
2022-11-10  1:52 ` [PATCH v3 3/7] x86: KVM: Advertise AMX-FP16 " Jiaxi Chen
2022-11-10  1:52 ` [PATCH v3 4/7] x86: KVM: Advertise AVX-IFMA " Jiaxi Chen
2022-11-10  1:52 ` [PATCH v3 5/7] x86: KVM: Advertise AVX-VNNI-INT8 " Jiaxi Chen
2022-11-10  1:52 ` [PATCH v3 6/7] x86: KVM: Advertise AVX-NE-CONVERT " Jiaxi Chen
2022-11-10  1:52 ` [PATCH v3 7/7] x86: KVM: Advertise PREFETCHIT0/1 " Jiaxi Chen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.