[PATCH v5 0/8] x86: KVM: Advertise CPUID of new Intel platform instructions to user space
From: Jiaxi Chen
Date: Fri Nov 25 2022 - 07:58:41 EST
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].
These features bits are on two CPUID leafs: CPUID_7_1_EAX and
CPUID_7_1_EDX. CPUID_7_1_EAX is an expected-dense leaf and some of its
bits have kernel usages, therefore give bits on this leaf an X86_FEATURE
definition in kernel. However, CPUID_7_1_EDX is dense and none of its
bits have truly kernel usages for the moment. Given that, move
CPUID_7_1_EDX to be a KVM-only leaf and plus an x86_FEATURE definition
for bits on this leaf to direct them to the KVM entry.
This patch series advertises KVM support of these CPUIDs to host
userspace. For all of these features, there are no new VMX controls or
additional host enabling required for guests to use them.
[1] Intel ISE: https://cdrdv2.intel.com/v1/dl/getContent/671368
v5:
- Modify some inaccurate descriptions in the changelogs.
- Address some naming-confusing problems for adding KVM-only leaves,
including renaming function and adding comments.
v4:
https://lore.kernel.org/kvm/20221118141509.489359-1-jiaxi.chen@xxxxxxxxxxxxxxx/
- Put CPUID_7_1_EAX back to cpuid_leaf[], considering more bits will be
defined in the future for this leaf.
v3:
https://lore.kernel.org/kvm/20221110015252.202566-1-jiaxi.chen@xxxxxxxxxxxxxxx/
- 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/kvm/20221103025030.78371-1-jiaxi.chen@xxxxxxxxxxxxxxx/
- 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/kvm/20221019084734.3590760-1-jiaxi.chen@xxxxxxxxxxxxxxx/
Chang S. Bae (1):
x86: KVM: Advertise AMX-FP16 CPUID to user space
Jiaxi Chen (5):
x86: KVM: Advertise CMPccXADD CPUID to user space
x86: KVM: Advertise AVX-IFMA CPUID to user space
KVM: x86: Advertise AVX-VNNI-INT8 CPUID to user space
KVM: x86: Advertise AVX-NE-CONVERT CPUID to user space
KVM: x86: Advertise PREFETCHIT0/1 CPUID to user space
Sean Christopherson (2):
KVM: x86: Add BUILD_BUG_ON() to detect bad usage of "scattered" flags
KVM: x86: Update KVM-only leaf handling to allow for 100% KVM-only
leafs
arch/x86/include/asm/cpufeatures.h | 3 +++
arch/x86/kvm/cpuid.c | 25 ++++++++++++++++++-------
arch/x86/kvm/reverse_cpuid.h | 25 ++++++++++++++++++++++---
3 files changed, 43 insertions(+), 10 deletions(-)
base-commit: 094226ad94f471a9f19e8f8e7140a09c2625abaa
--
2.27.0