yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-i386-Add-new-CPU-model-Icelake-Server-Client.patch

ae23c9
From 0a8e2990b83c805fc6cc2421950a938caa9ba8a5 Mon Sep 17 00:00:00 2001
ae23c9
From: "plai@redhat.com" <plai@redhat.com>
ae23c9
Date: Wed, 3 Apr 2019 15:54:29 +0100
ae23c9
Subject: [PATCH 05/10] i386: Add new CPU model Icelake-{Server, Client}
ae23c9
ae23c9
RH-Author: plai@redhat.com
ae23c9
Message-id: <1554306874-28796-6-git-send-email-plai@redhat.com>
ae23c9
Patchwork-id: 85383
ae23c9
O-Subject: [RHEL8.1 qemu-kvm PATCH resend 05/10] i386: Add new CPU model Icelake-{Server, Client}
ae23c9
Bugzilla: 1561761
ae23c9
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
ae23c9
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
ae23c9
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
ae23c9
ae23c9
From: Robert Hoo <robert.hu@linux.intel.com>
ae23c9
ae23c9
New CPU models mostly inherit features from ancestor Skylake, while addin new
ae23c9
features: UMIP, New Instructions ( PCONIFIG (server only), WBNOINVD,
ae23c9
AVX512_VBMI2, GFNI, AVX512_VNNI, VPCLMULQDQ, VAES, AVX512_BITALG),
ae23c9
Intel PT and 5-level paging (Server only). As well as
ae23c9
IA32_PRED_CMD, SSBD support for speculative execution
ae23c9
side channel mitigations.
ae23c9
ae23c9
Note:
ae23c9
For 5-level paging, Guest physical address width can be configured, with
ae23c9
parameter "phys-bits". Unless explicitly specified, we still use its default
ae23c9
value, even for Icelake-Server cpu model.
ae23c9
At present, hold on expose IA32_ARCH_CAPABILITIES to guest, as 1) This MSR
ae23c9
actually presents more than 1 'feature', maintainers are considering expanding current
ae23c9
features presentation of only CPUIDs to MSR bits; 2) a reasonable default value
ae23c9
for MSR_IA32_ARCH_CAPABILITIES needs to settled first. These 2 are actully
ae23c9
beyond Icelake CPU model itself but fundamental. So split these work apart
ae23c9
and do it later.
ae23c9
https://lists.gnu.org/archive/html/qemu-devel/2018-07/msg00774.html
ae23c9
https://lists.gnu.org/archive/html/qemu-devel/2018-07/msg00796.html
ae23c9
ae23c9
Signed-off-by: Robert Hoo <robert.hu@linux.intel.com>
ae23c9
Message-Id: <1530781798-183214-6-git-send-email-robert.hu@linux.intel.com>
ae23c9
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
ae23c9
(cherry picked from commit 8a11c62da9146dd89aee98947e6bd831e65a970d)
ae23c9
Signed-off-by: Paul Lai <plai@redhat.com>
ae23c9
ae23c9
Resovled Conflicts:
ae23c9
	target/i386/cpu.c
ae23c9
ae23c9
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
ae23c9
---
ae23c9
 target/i386/cpu.c | 115 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
ae23c9
 1 file changed, 115 insertions(+)
ae23c9
ae23c9
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
ae23c9
index 8b9a9f6..d86b744 100644
ae23c9
--- a/target/i386/cpu.c
ae23c9
+++ b/target/i386/cpu.c
ae23c9
@@ -2414,6 +2414,121 @@ static X86CPUDefinition builtin_x86_defs[] = {
ae23c9
         .model_id = "Intel Xeon Processor (Skylake, IBRS)",
ae23c9
     },
ae23c9
     {
ae23c9
+        .name = "Icelake-Client",
ae23c9
+        .level = 0xd,
ae23c9
+        .vendor = CPUID_VENDOR_INTEL,
ae23c9
+        .family = 6,
ae23c9
+        .model = 126,
ae23c9
+        .stepping = 0,
ae23c9
+        .features[FEAT_1_EDX] =
ae23c9
+            CPUID_VME | CPUID_SSE2 | CPUID_SSE | CPUID_FXSR | CPUID_MMX |
ae23c9
+            CPUID_CLFLUSH | CPUID_PSE36 | CPUID_PAT | CPUID_CMOV | CPUID_MCA |
ae23c9
+            CPUID_PGE | CPUID_MTRR | CPUID_SEP | CPUID_APIC | CPUID_CX8 |
ae23c9
+            CPUID_MCE | CPUID_PAE | CPUID_MSR | CPUID_TSC | CPUID_PSE |
ae23c9
+            CPUID_DE | CPUID_FP87,
ae23c9
+        .features[FEAT_1_ECX] =
ae23c9
+            CPUID_EXT_AVX | CPUID_EXT_XSAVE | CPUID_EXT_AES |
ae23c9
+            CPUID_EXT_POPCNT | CPUID_EXT_X2APIC | CPUID_EXT_SSE42 |
ae23c9
+            CPUID_EXT_SSE41 | CPUID_EXT_CX16 | CPUID_EXT_SSSE3 |
ae23c9
+            CPUID_EXT_PCLMULQDQ | CPUID_EXT_SSE3 |
ae23c9
+            CPUID_EXT_TSC_DEADLINE_TIMER | CPUID_EXT_FMA | CPUID_EXT_MOVBE |
ae23c9
+            CPUID_EXT_PCID | CPUID_EXT_F16C | CPUID_EXT_RDRAND,
ae23c9
+        .features[FEAT_8000_0001_EDX] =
ae23c9
+            CPUID_EXT2_LM | CPUID_EXT2_RDTSCP | CPUID_EXT2_NX |
ae23c9
+            CPUID_EXT2_SYSCALL,
ae23c9
+        .features[FEAT_8000_0001_ECX] =
ae23c9
+            CPUID_EXT3_ABM | CPUID_EXT3_LAHF_LM | CPUID_EXT3_3DNOWPREFETCH,
ae23c9
+        .features[FEAT_8000_0008_EBX] =
ae23c9
+            CPUID_8000_0008_EBX_WBNOINVD,
ae23c9
+        .features[FEAT_7_0_EBX] =
ae23c9
+            CPUID_7_0_EBX_FSGSBASE | CPUID_7_0_EBX_BMI1 |
ae23c9
+            CPUID_7_0_EBX_HLE | CPUID_7_0_EBX_AVX2 | CPUID_7_0_EBX_SMEP |
ae23c9
+            CPUID_7_0_EBX_BMI2 | CPUID_7_0_EBX_ERMS | CPUID_7_0_EBX_INVPCID |
ae23c9
+            CPUID_7_0_EBX_RTM | CPUID_7_0_EBX_RDSEED | CPUID_7_0_EBX_ADX |
ae23c9
+            CPUID_7_0_EBX_SMAP | CPUID_7_0_EBX_MPX | CPUID_7_0_EBX_INTEL_PT,
ae23c9
+        .features[FEAT_7_0_ECX] =
ae23c9
+            CPUID_7_0_ECX_VBMI | CPUID_7_0_ECX_UMIP | CPUID_7_0_ECX_PKU |
ae23c9
+            CPUID_7_0_ECX_OSPKE | CPUID_7_0_ECX_VBMI2 | CPUID_7_0_ECX_GFNI |
ae23c9
+            CPUID_7_0_ECX_VAES | CPUID_7_0_ECX_VPCLMULQDQ |
ae23c9
+            CPUID_7_0_ECX_AVX512VNNI | CPUID_7_0_ECX_AVX512BITALG |
ae23c9
+            CPUID_7_0_ECX_AVX512_VPOPCNTDQ,
ae23c9
+        .features[FEAT_7_0_EDX] =
ae23c9
+            CPUID_7_0_EDX_SPEC_CTRL | CPUID_7_0_EDX_SPEC_CTRL_SSBD,
ae23c9
+        /* Missing: XSAVES (not supported by some Linux versions,
ae23c9
+                * including v4.1 to v4.12).
ae23c9
+                * KVM doesn't yet expose any XSAVES state save component,
ae23c9
+                * and the only one defined in Skylake (processor tracing)
ae23c9
+                * probably will block migration anyway.
ae23c9
+                */
ae23c9
+        .features[FEAT_XSAVE] =
ae23c9
+            CPUID_XSAVE_XSAVEOPT | CPUID_XSAVE_XSAVEC |
ae23c9
+            CPUID_XSAVE_XGETBV1,
ae23c9
+        .features[FEAT_6_EAX] =
ae23c9
+            CPUID_6_EAX_ARAT,
ae23c9
+        .xlevel = 0x80000008,
ae23c9
+        .model_id = "Intel Core Processor (Icelake)",
ae23c9
+    },
ae23c9
+    {
ae23c9
+        .name = "Icelake-Server",
ae23c9
+        .level = 0xd,
ae23c9
+        .vendor = CPUID_VENDOR_INTEL,
ae23c9
+        .family = 6,
ae23c9
+        .model = 134,
ae23c9
+        .stepping = 0,
ae23c9
+        .features[FEAT_1_EDX] =
ae23c9
+            CPUID_VME | CPUID_SSE2 | CPUID_SSE | CPUID_FXSR | CPUID_MMX |
ae23c9
+            CPUID_CLFLUSH | CPUID_PSE36 | CPUID_PAT | CPUID_CMOV | CPUID_MCA |
ae23c9
+            CPUID_PGE | CPUID_MTRR | CPUID_SEP | CPUID_APIC | CPUID_CX8 |
ae23c9
+            CPUID_MCE | CPUID_PAE | CPUID_MSR | CPUID_TSC | CPUID_PSE |
ae23c9
+            CPUID_DE | CPUID_FP87,
ae23c9
+        .features[FEAT_1_ECX] =
ae23c9
+            CPUID_EXT_AVX | CPUID_EXT_XSAVE | CPUID_EXT_AES |
ae23c9
+            CPUID_EXT_POPCNT | CPUID_EXT_X2APIC | CPUID_EXT_SSE42 |
ae23c9
+            CPUID_EXT_SSE41 | CPUID_EXT_CX16 | CPUID_EXT_SSSE3 |
ae23c9
+            CPUID_EXT_PCLMULQDQ | CPUID_EXT_SSE3 |
ae23c9
+            CPUID_EXT_TSC_DEADLINE_TIMER | CPUID_EXT_FMA | CPUID_EXT_MOVBE |
ae23c9
+            CPUID_EXT_PCID | CPUID_EXT_F16C | CPUID_EXT_RDRAND,
ae23c9
+        .features[FEAT_8000_0001_EDX] =
ae23c9
+            CPUID_EXT2_LM | CPUID_EXT2_PDPE1GB | CPUID_EXT2_RDTSCP |
ae23c9
+            CPUID_EXT2_NX | CPUID_EXT2_SYSCALL,
ae23c9
+        .features[FEAT_8000_0001_ECX] =
ae23c9
+            CPUID_EXT3_ABM | CPUID_EXT3_LAHF_LM | CPUID_EXT3_3DNOWPREFETCH,
ae23c9
+        .features[FEAT_8000_0008_EBX] =
ae23c9
+            CPUID_8000_0008_EBX_WBNOINVD,
ae23c9
+        .features[FEAT_7_0_EBX] =
ae23c9
+            CPUID_7_0_EBX_FSGSBASE | CPUID_7_0_EBX_BMI1 |
ae23c9
+            CPUID_7_0_EBX_HLE | CPUID_7_0_EBX_AVX2 | CPUID_7_0_EBX_SMEP |
ae23c9
+            CPUID_7_0_EBX_BMI2 | CPUID_7_0_EBX_ERMS | CPUID_7_0_EBX_INVPCID |
ae23c9
+            CPUID_7_0_EBX_RTM | CPUID_7_0_EBX_RDSEED | CPUID_7_0_EBX_ADX |
ae23c9
+            CPUID_7_0_EBX_SMAP | CPUID_7_0_EBX_MPX | CPUID_7_0_EBX_CLWB |
ae23c9
+            CPUID_7_0_EBX_AVX512F | CPUID_7_0_EBX_AVX512DQ |
ae23c9
+            CPUID_7_0_EBX_AVX512BW | CPUID_7_0_EBX_AVX512CD |
ae23c9
+            CPUID_7_0_EBX_AVX512VL | CPUID_7_0_EBX_CLFLUSHOPT |
ae23c9
+            CPUID_7_0_EBX_INTEL_PT,
ae23c9
+        .features[FEAT_7_0_ECX] =
ae23c9
+            CPUID_7_0_ECX_VBMI | CPUID_7_0_ECX_UMIP | CPUID_7_0_ECX_PKU |
ae23c9
+            CPUID_7_0_ECX_OSPKE | CPUID_7_0_ECX_VBMI2 | CPUID_7_0_ECX_GFNI |
ae23c9
+            CPUID_7_0_ECX_VAES | CPUID_7_0_ECX_VPCLMULQDQ |
ae23c9
+            CPUID_7_0_ECX_AVX512VNNI | CPUID_7_0_ECX_AVX512BITALG |
ae23c9
+            CPUID_7_0_ECX_AVX512_VPOPCNTDQ | CPUID_7_0_ECX_LA57,
ae23c9
+        .features[FEAT_7_0_EDX] =
ae23c9
+            CPUID_7_0_EDX_PCONFIG | CPUID_7_0_EDX_SPEC_CTRL |
ae23c9
+            CPUID_7_0_EDX_SPEC_CTRL_SSBD,
ae23c9
+        /* Missing: XSAVES (not supported by some Linux versions,
ae23c9
+                * including v4.1 to v4.12).
ae23c9
+                * KVM doesn't yet expose any XSAVES state save component,
ae23c9
+                * and the only one defined in Skylake (processor tracing)
ae23c9
+                * probably will block migration anyway.
ae23c9
+                */
ae23c9
+        .features[FEAT_XSAVE] =
ae23c9
+            CPUID_XSAVE_XSAVEOPT | CPUID_XSAVE_XSAVEC |
ae23c9
+            CPUID_XSAVE_XGETBV1,
ae23c9
+        .features[FEAT_6_EAX] =
ae23c9
+            CPUID_6_EAX_ARAT,
ae23c9
+        .xlevel = 0x80000008,
ae23c9
+        .model_id = "Intel Xeon Processor (Icelake)",
ae23c9
+    },
ae23c9
+    {
ae23c9
         .name = "Opteron_G1",
ae23c9
         .level = 5,
ae23c9
         .vendor = CPUID_VENDOR_AMD,
ae23c9
-- 
ae23c9
1.8.3.1
ae23c9