Add Icelake CPU model
v4 cover Add Icelake CPU model
This patch set defines the new guest CPU models of Icelake.
The first patch defines new indices for IA32_PRED_CMD MSR (IBPB) and IA32_ARCH_CAPABILITIES MSR. Other patches add CPUID bits feature words for new features, like PCONFIG, WBNOINVD. The final patch defines Icelake-{Server,Client} CPU models.
Changelog:
v4
At present, mark CPUID_7_0_EDX_ARCH_CAPABILITIES unmigratable.
v3
Remove ARCH_CAPABILITIES from Icelake CPU model, at present. Going to
compose a separate patch to do 1) qemu set ARCH_CAPABILITES MSR with some default value. 2) expand current CPU feature expression frame work from CPUID features only to MSR bit included as well.
Fix some patch format error and update some trivial patch descrptions.
v2
Per Paolo's comment, remove unnecessary CPU vmstate check for write/read onlyIA32_PRED_CMD and IA32_ARCH_CAPABILITIES MSRs.
Robert Hoo (5):
i386: Add new MSR indices for IA32_PRED_CMD and IA32_ARCH_CAPABILITIES
i386: Add CPUID bit and feature words for IA32_ARCH_CAPABILITIES MSR
i386: Add CPUID bit for PCONFIG
i386: Add CPUID bit for WBNOINVD
i386: Add new CPU model Icelake-{Server,Client}
target/i386/cpu.c | 122 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- target/i386/cpu.h | 6 +++ 2 files changed, 125 insertions(+), 3 deletions(-)
Signature · 1 line
1.8.3.1
PATCH v4 1/5 i386: Add new MSR indices for IA32_PRED_CMD and IA32_ARCH_CAPABILITIES
IA32_PRED_CMD MSR gives software a way to issue commands that affect the state of indirect branch predictors. Enumerated by CPUID.(EAX=7H,ECX=0):EDX[26]. IA32_ARCH_CAPABILITIES MSR enumerates architectural features of RDCL_NO and IBRS_ALL. Enumerated by CPUID.(EAX=07H, ECX=0):EDX[29].
--- target/i386/cpu.h | 2 ++ 1 file changed, 2 insertions(+)
target/i386/cpu.h +2 -0
@@ -354,6 +354,8 @@ typedef enum X86Seg {#define MSR_TSC_ADJUST 0x0000003b#define MSR_IA32_SPEC_CTRL 0x48#define MSR_VIRT_SSBD 0xc001011f +#define MSR_IA32_PRED_CMD 0x49 +#define MSR_IA32_ARCH_CAPABILITIES 0x10a#define MSR_IA32_TSCDEADLINE 0x6e0#define FEATURE_CONTROL_LOCKED (1<<0)
Signature · 1 line
1.8.3.1
PATCH v4 2/5 i386: Add CPUID bit and feature words for IA32_ARCH_CAPABILITIES MSR
In reply to Robert HooSupport of IA32_PRED_CMD MSR already be enumerated by same CPUID bit as SPEC_CTRL.
At present, mark CPUID_7_0_EDX_ARCH_CAPABILITIES unmigratable, per Paolo's comment.
--- target/i386/cpu.c | 3 ++- target/i386/cpu.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)
target/i386/cpu.c +2 -1
@@ -1000,12 +1000,13 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = {NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,"spec-ctrl" ,NULL , - NULL, NULL, NULL, "ssbd", + NULL, "arch-capabilities", NULL, "ssbd", }, .cpuid_eax =7 , .cpuid_needs_ecx = true, .cpuid_ecx = 0, .cpuid_reg = R_EDX, .tcg_features = TCG_7_0_EDX_FEATURES, + .unmigratable_flags = CPUID_7_0_EDX_ARCH_CAPABILITIES, }, [FEAT_8000_0007_EDX] = { .feat_names = {
target/i386/cpu.h +1 -0
@@ -690,6 +690,7 @@ typedef uint32_t FeatureWordArray[FEATURE_WORDS];#define CPUID_7_0_EDX_AVX512_4VNNIW (1U << 2)/* AVX512 Neural Network Instructions */ #define CPUID_7_0_EDX_AVX512_4FMAPS (1U << 3)/* AVX512 Multiply Accumulation Single Precision */ #define CPUID_7_0_EDX_SPEC_CTRL (1U << 26)/* Speculation Control */ +#define CPUID_7_0_EDX_ARCH_CAPABILITIES (1U << 29)/*Arch Capabilities*/ #define CPUID_7_0_EDX_SPEC_CTRL_SSBD (1U << 31)/* Speculative Store Bypass Disable */ #define CPUID_8000_0008_EBX_IBPB (1U << 12)/* Indirect Branch Prediction Barrier */
Signature · 1 line
1.8.3.1
PATCH v4 3/5 i386: Add CPUID bit for PCONFIG
In reply to Robert HooPCONFIG: Platform configuration, enumerated by CPUID.(EAX=07H, ECX=0):
EDX[bit18].
--- target/i386/cpu.c | 2 +- target/i386/cpu.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
target/i386/cpu.c +1 -1
@@ -997,7 +997,7 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = {NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL , -NULL ,NULL ,NULL ,NULL , +NULL ,NULL ,"pconfig" ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,"spec-ctrl" ,NULL , NULL, "arch-capabilities", NULL, "ssbd",
target/i386/cpu.h +1 -0
@@ -689,6 +689,7 @@ typedef uint32_t FeatureWordArray[FEATURE_WORDS];#define CPUID_7_0_EDX_AVX512_4VNNIW (1U << 2)/* AVX512 Neural Network Instructions */ #define CPUID_7_0_EDX_AVX512_4FMAPS (1U << 3)/* AVX512 Multiply Accumulation Single Precision */ +#define CPUID_7_0_EDX_PCONFIG (1U << 18)/* Platform Configuration */ #define CPUID_7_0_EDX_SPEC_CTRL (1U << 26)/* Speculation Control */ #define CPUID_7_0_EDX_ARCH_CAPABILITIES (1U << 29)/*Arch Capabilities*/ #define CPUID_7_0_EDX_SPEC_CTRL_SSBD (1U << 31)/* Speculative Store Bypass Disable */
Signature · 1 line
1.8.3.1
PATCH v4 4/5 i386: Add CPUID bit for WBNOINVD
In reply to Robert HooWBNOINVD: Write back and do not invalidate cache, enumerated by CPUID.(EAX=80000008H, ECX=0):EBX[bit 9].
--- target/i386/cpu.c | 2 +- target/i386/cpu.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-)
target/i386/cpu.c +1 -1
@@ -1028,7 +1028,7 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = { .feat_names = {NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL , -NULL ,NULL ,NULL ,NULL , +NULL ,"wbnoinvd" ,NULL ,NULL ,"ibpb" ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL , NULL, NULL, NULL, NULL,
target/i386/cpu.h +2 -0
@@ -694,6 +694,8 @@ typedef uint32_t FeatureWordArray[FEATURE_WORDS];#define CPUID_7_0_EDX_ARCH_CAPABILITIES (1U << 29)/*Arch Capabilities*/ #define CPUID_7_0_EDX_SPEC_CTRL_SSBD (1U << 31)/* Speculative Store Bypass Disable */ +#define CPUID_8000_0008_EBX_WBNOINVD (1U << 9)/* Write back and +do not invalidate cache */ #define CPUID_8000_0008_EBX_IBPB (1U << 12)/* Indirect Branch Prediction Barrier */ #define CPUID_XSAVE_XSAVEOPT (1U << 0)
Signature · 1 line
1.8.3.1
PATCH v4 5/5 i386: Add new CPU model Icelake-{Server, Client}
In reply to Robert HooNew CPU models mostly inherit features from ancestor Skylake, while addin new
features: UMIP, New Instructions ( PCONIFIG (server only), WBNOINVD, AVX512_VBMI2, GFNI, AVX512_VNNI, VPCLMULQDQ, VAES, AVX512_BITALG), Intel PT and 5-level paging (Server only). As well as IA32_PRED_CMD, SSBD support for speculative execution
side channel mitigations.
Note:
For 5-level paging, Guest physical address width can be configured, with parameter "phys-bits". Unless explicitly specified, we still use its default value, even for Icelake-Server cpu model.
At present, hold on expose IA32_ARCH_CAPABILITIES to guest, as 1) This MSR actually presents more than 1 'feature', maintainers are considering expanding current features presentation of only CPUIDs to MSR bits; 2) a reasonable default value for MSR_IA32_ARCH_CAPABILITIES needs to settled first. These 2 are actully beyond Icelake CPU model itself but fundamental. So split these work apart and do it later.
https://lists.gnu.org/archive/html/qemu-devel/2018-07/msg00774.html
https://lists.gnu.org/archive/html/qemu-devel/2018-07/msg00796.html
--- target/i386/cpu.c | 115 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+)
target/i386/cpu.c +115 -0
@@ -2381,6 +2381,121 @@ static X86CPUDefinition builtin_x86_defs[] = { .model_id = "Intel Xeon Processor (Skylake, IBRS)", }, { + .name = "Icelake-Client", + .level = 0xd, + .vendor = CPUID_VENDOR_INTEL, + .family = 6, + .model = 126, + .stepping = 0, + .features[FEAT_1_EDX ] = +CPUID_VME |CPUID_SSE2 |CPUID_SSE |CPUID_FXSR |CPUID_MMX | +CPUID_CLFLUSH |CPUID_PSE36 |CPUID_PAT |CPUID_CMOV |CPUID_MCA | +CPUID_PGE |CPUID_MTRR |CPUID_SEP |CPUID_APIC |CPUID_CX8 | +CPUID_MCE |CPUID_PAE |CPUID_MSR |CPUID_TSC |CPUID_PSE | + CPUID_DE | CPUID_FP87, + .features[FEAT_1_ECX ] = +CPUID_EXT_AVX |CPUID_EXT_XSAVE |CPUID_EXT_AES | +CPUID_EXT_POPCNT |CPUID_EXT_X2APIC |CPUID_EXT_SSE42 | +CPUID_EXT_SSE41 |CPUID_EXT_CX16 |CPUID_EXT_SSSE3 | +CPUID_EXT_PCLMULQDQ |CPUID_EXT_SSE3 | +CPUID_EXT_TSC_DEADLINE_TIMER |CPUID_EXT_FMA |CPUID_EXT_MOVBE | + CPUID_EXT_PCID | CPUID_EXT_F16C | CPUID_EXT_RDRAND, + .features[FEAT_8000_0001_EDX ] = +CPUID_EXT2_LM |CPUID_EXT2_RDTSCP |CPUID_EXT2_NX | + CPUID_EXT2_SYSCALL, + .features[FEAT_8000_0001_ECX ] = + CPUID_EXT3_ABM | CPUID_EXT3_LAHF_LM | CPUID_EXT3_3DNOWPREFETCH, + .features[FEAT_8000_0008_EBX ] = + CPUID_8000_0008_EBX_WBNOINVD, + .features[FEAT_7_0_EBX ] = +CPUID_7_0_EBX_FSGSBASE |CPUID_7_0_EBX_BMI1 | +CPUID_7_0_EBX_HLE |CPUID_7_0_EBX_AVX2 |CPUID_7_0_EBX_SMEP | +CPUID_7_0_EBX_BMI2 |CPUID_7_0_EBX_ERMS |CPUID_7_0_EBX_INVPCID | +CPUID_7_0_EBX_RTM |CPUID_7_0_EBX_RDSEED |CPUID_7_0_EBX_ADX | + CPUID_7_0_EBX_SMAP | CPUID_7_0_EBX_MPX | CPUID_7_0_EBX_INTEL_PT, + .features[FEAT_7_0_ECX ] = +CPUID_7_0_ECX_VBMI |CPUID_7_0_ECX_UMIP |CPUID_7_0_ECX_PKU | +CPUID_7_0_ECX_OSPKE |CPUID_7_0_ECX_VBMI2 |CPUID_7_0_ECX_GFNI | +CPUID_7_0_ECX_VAES |CPUID_7_0_ECX_VPCLMULQDQ | +CPUID_7_0_ECX_AVX512VNNI |CPUID_7_0_ECX_AVX512BITALG | + CPUID_7_0_ECX_AVX512_VPOPCNTDQ, + .features[FEAT_7_0_EDX ] = + CPUID_7_0_EDX_SPEC_CTRL | CPUID_7_0_EDX_SPEC_CTRL_SSBD, +/* Missing: XSAVES (not supported by some Linux versions, +* including v4.1 to v4.12). +* KVM doesn't yet expose any XSAVES state save component, +* and the only one defined in Skylake (processor tracing) +* probably will block migration anyway. +*/ + .features[FEAT_XSAVE ] = +CPUID_XSAVE_XSAVEOPT |CPUID_XSAVE_XSAVEC | + CPUID_XSAVE_XGETBV1, + .features[FEAT_6_EAX ] = + CPUID_6_EAX_ARAT, + .xlevel = 0x80000008, + .model_id = "Intel Core Processor (Icelake)", + }, + { + .name = "Icelake-Server", + .level = 0xd, + .vendor = CPUID_VENDOR_INTEL, + .family = 6, + .model = 134, + .stepping = 0, + .features[FEAT_1_EDX ] = +CPUID_VME |CPUID_SSE2 |CPUID_SSE |CPUID_FXSR |CPUID_MMX | +CPUID_CLFLUSH |CPUID_PSE36 |CPUID_PAT |CPUID_CMOV |CPUID_MCA | +CPUID_PGE |CPUID_MTRR |CPUID_SEP |CPUID_APIC |CPUID_CX8 | +CPUID_MCE |CPUID_PAE |CPUID_MSR |CPUID_TSC |CPUID_PSE | + CPUID_DE | CPUID_FP87, + .features[FEAT_1_ECX ] = +CPUID_EXT_AVX |CPUID_EXT_XSAVE |CPUID_EXT_AES | +CPUID_EXT_POPCNT |CPUID_EXT_X2APIC |CPUID_EXT_SSE42 | +CPUID_EXT_SSE41 |CPUID_EXT_CX16 |CPUID_EXT_SSSE3 | +CPUID_EXT_PCLMULQDQ |CPUID_EXT_SSE3 | +CPUID_EXT_TSC_DEADLINE_TIMER |CPUID_EXT_FMA |CPUID_EXT_MOVBE | + CPUID_EXT_PCID | CPUID_EXT_F16C | CPUID_EXT_RDRAND, + .features[FEAT_8000_0001_EDX ] = +CPUID_EXT2_LM |CPUID_EXT2_PDPE1GB |CPUID_EXT2_RDTSCP | + CPUID_EXT2_NX | CPUID_EXT2_SYSCALL, + .features[FEAT_8000_0001_ECX ] = + CPUID_EXT3_ABM | CPUID_EXT3_LAHF_LM | CPUID_EXT3_3DNOWPREFETCH, + .features[FEAT_8000_0008_EBX ] = + CPUID_8000_0008_EBX_WBNOINVD, + .features[FEAT_7_0_EBX ] = +CPUID_7_0_EBX_FSGSBASE |CPUID_7_0_EBX_BMI1 | +CPUID_7_0_EBX_HLE |CPUID_7_0_EBX_AVX2 |CPUID_7_0_EBX_SMEP | +CPUID_7_0_EBX_BMI2 |CPUID_7_0_EBX_ERMS |CPUID_7_0_EBX_INVPCID | +CPUID_7_0_EBX_RTM |CPUID_7_0_EBX_RDSEED |CPUID_7_0_EBX_ADX | +CPUID_7_0_EBX_SMAP |CPUID_7_0_EBX_MPX |CPUID_7_0_EBX_CLWB | +CPUID_7_0_EBX_AVX512F |CPUID_7_0_EBX_AVX512DQ | +CPUID_7_0_EBX_AVX512BW |CPUID_7_0_EBX_AVX512CD | +CPUID_7_0_EBX_AVX512VL |CPUID_7_0_EBX_CLFLUSHOPT | + CPUID_7_0_EBX_INTEL_PT, + .features[FEAT_7_0_ECX ] = +CPUID_7_0_ECX_VBMI |CPUID_7_0_ECX_UMIP |CPUID_7_0_ECX_PKU | +CPUID_7_0_ECX_OSPKE |CPUID_7_0_ECX_VBMI2 |CPUID_7_0_ECX_GFNI | +CPUID_7_0_ECX_VAES |CPUID_7_0_ECX_VPCLMULQDQ | +CPUID_7_0_ECX_AVX512VNNI |CPUID_7_0_ECX_AVX512BITALG | + CPUID_7_0_ECX_AVX512_VPOPCNTDQ | CPUID_7_0_ECX_LA57, + .features[FEAT_7_0_EDX ] = +CPUID_7_0_EDX_PCONFIG |CPUID_7_0_EDX_SPEC_CTRL | + CPUID_7_0_EDX_SPEC_CTRL_SSBD, +/* Missing: XSAVES (not supported by some Linux versions, +* including v4.1 to v4.12). +* KVM doesn't yet expose any XSAVES state save component, +* and the only one defined in Skylake (processor tracing) +* probably will block migration anyway. +*/ + .features[FEAT_XSAVE ] = +CPUID_XSAVE_XSAVEOPT |CPUID_XSAVE_XSAVEC | + CPUID_XSAVE_XGETBV1, + .features[FEAT_6_EAX ] = + CPUID_6_EAX_ARAT, + .xlevel = 0x80000008, + .model_id = "Intel Xeon Processor (Icelake)", + }, + { .name = "KnightsMill", .level = 0xd, .vendor = CPUID_VENDOR_INTEL,
Signature · 1 line
1.8.3.1
This series seems to have some coding style problems. See output below for more information:
Hi,
This series seems to have some coding style problems. See output below for more information:
Type: series
Message-id: [email protected]
Subject: [Qemu-devel] [PATCH v4 0/5] Add Icelake CPU model
=== TEST SCRIPT BEGIN ===
#!/bin/bash
BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
commits="$(git log --format=%H --reverse $BASE..)" for c in $commits; do
echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
failed=1
echo
fi
n=$((n+1))done
exit $failed
=== TEST SCRIPT END ===
Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
fe8d2d5737..8beb8cc64d master -> master * [new tag] patchew/[email protected] -> patchew/[email protected] t [tag update] patchew/[email protected] -> patchew/[email protected] t [tag update] patchew/[email protected] -> patchew/[email protected] * [new tag] patchew/[email protected] -> patchew/[email protected] * [new tag] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'c57219dd66 i386: Add new CPU model Icelake-{Server, Client} e4b41e6694 i386: Add CPUID bit for WBNOINVD0d363e4b5a i386: Add CPUID bit for PCONFIG1f198579c6 i386: Add CPUID bit and feature words for IA32_ARCH_CAPABILITIES MSR 27bdf2a6a2 i386: Add new MSR indices for IA32_PRED_CMD and IA32_ARCH_CAPABILITIES
=== OUTPUT BEGIN ===
Checking PATCH 1/5: i386: Add new MSR indices for IA32_PRED_CMD and IA32_ARCH_CAPABILITIES... Checking PATCH 2/5: i386: Add CPUID bit and feature words for IA32_ARCH_CAPABILITIES MSR... Checking PATCH 3/5: i386: Add CPUID bit for PCONFIG...
Checking PATCH 4/5: i386: Add CPUID bit for WBNOINVD...
ERROR: line over 90 characters
#34: FILE: target/i386/cpu.h:698:
+ do not invalidate cache */
total: 1 errors, 0 warnings, 16 lines checked
Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
Checking PATCH 5/5: i386: Add new CPU model Icelake-{Server, Client}... === OUTPUT END ===
Test command exited with code: 1
---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to [email protected]