Blame SOURCES/kvm-target-i386-cpu-add-new-CPU-models-for-indirect-bran.patch

9bac43
From 052aaec83e84cc99a03e023eaaf58d289e0d5d05 Mon Sep 17 00:00:00 2001
9bac43
From: Eduardo Habkost <ehabkost@redhat.com>
9bac43
Date: Wed, 13 Dec 2017 15:47:38 -0200
9bac43
Subject: [PATCH 3/3] target-i386: cpu: add new CPU models for indirect branch
9bac43
 predictor restrictions
9bac43
9bac43
RH-Author: Eduardo Habkost <ehabkost@redhat.com>
9bac43
Message-id: <20171213174738.20852-4-ehabkost@redhat.com>
9bac43
Patchwork-id: n/a
9bac43
O-Subject: [CONFIDENTIAL][RHEL-7.5 qemu-kvm-rhev PATCH v2 3/3] target-i386: cpu: add
9bac43
 new CPU models for indirect branch predictor restrictions
9bac43
Bugzilla: CVE-2017-5715
9bac43
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
9bac43
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
9bac43
9bac43
To ensure the New CPU models won't introduce any unexpected
9bac43
changes except for the spec-ctrl feature (even if people are
9bac43
running older machine-types), copy all compat_props entries for
9bac43
existing CPU models to their *-IBRS versions.
9bac43
9bac43
The only entries that are not being copied are the ones touching
9bac43
"(min-)level" and "(min-)xlevel" because it's an expected result
9bac43
of the CPU model change (otherwise the spec-ctrl feature would
9bac43
remain unavailable to the guest).
9bac43
9bac43
The entries that had to be copied can be found using:
9bac43
  $ git grep -E 'Nehalem|Westmere|SandyBridge|IvyBridge|Haswell-noTSX|Haswell|Broadwell-noTSX|Broadwell|Skylake-Client|Skylake-Server|EPYC'
9bac43
9bac43
Note that the upstream-only PC_COMPAT_* macros are not being
9bac43
touched as they are not used by the RHEL machine-types
9bac43
9bac43
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>.
9bac43
---
9bac43
 hw/i386/pc_piix.c    | 100 ++++++++++++
9bac43
 include/hw/i386/pc.h |  75 +++++++++
9bac43
 target/i386/cpu.c    | 425 ++++++++++++++++++++++++++++++++++++++++++++++++++-
9bac43
 target/i386/cpu.h    |   3 +
9bac43
 4 files changed, 602 insertions(+), 1 deletion(-)
9bac43
9bac43
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
9bac43
index c10e462..7a205c4 100644
9bac43
--- a/hw/i386/pc_piix.c
9bac43
+++ b/hw/i386/pc_piix.c
9bac43
@@ -1444,96 +1444,191 @@ DEFINE_PC_MACHINE(rhel700, "pc-i440fx-rhel7.0.0", pc_init_rhel700,
9bac43
             .property = "x2apic",\
9bac43
             .value = "on",\
9bac43
         },\
9bac43
+        { /* PC_RHEL6_6_COMPAT (copied from the entry above) */ \
9bac43
+            .driver = "Nehalem-IBRS" "-" TYPE_X86_CPU,\
9bac43
+            .property = "x2apic",\
9bac43
+            .value = "on",\
9bac43
+        },\
9bac43
         {\
9bac43
             .driver = "Westmere" "-" TYPE_X86_CPU,\
9bac43
             .property = "x2apic",\
9bac43
             .value = "on",\
9bac43
         },\
9bac43
+        { /* PC_RHEL6_6_COMPAT (copied from the entry above) */ \
9bac43
+            .driver = "Westmere-IBRS" "-" TYPE_X86_CPU,\
9bac43
+            .property = "x2apic",\
9bac43
+            .value = "on",\
9bac43
+        },\
9bac43
         {\
9bac43
             .driver = "Westmere" "-" TYPE_X86_CPU,\
9bac43
             .property = "pclmulqdq",\
9bac43
             .value = "off",\
9bac43
         },\
9bac43
+        { /* PC_RHEL6_6_COMPAT (copied from the entry above) */ \
9bac43
+            .driver = "Westmere-IBRS" "-" TYPE_X86_CPU,\
9bac43
+            .property = "pclmulqdq",\
9bac43
+            .value = "off",\
9bac43
+        },\
9bac43
         {\
9bac43
             .driver = "Westmere" "-" TYPE_X86_CPU,\
9bac43
             .property = "fxsr",\
9bac43
             .value = "on",\
9bac43
         },\
9bac43
+        { /* PC_RHEL6_6_COMPAT (copied from the entry above) */ \
9bac43
+            .driver = "Westmere-IBRS" "-" TYPE_X86_CPU,\
9bac43
+            .property = "fxsr",\
9bac43
+            .value = "on",\
9bac43
+        },\
9bac43
         {\
9bac43
             .driver = "Westmere" "-" TYPE_X86_CPU,\
9bac43
             .property = "mmx",\
9bac43
             .value = "on",\
9bac43
         },\
9bac43
+        { /* PC_RHEL6_6_COMPAT (copied from the entry above) */ \
9bac43
+            .driver = "Westmere-IBRS" "-" TYPE_X86_CPU,\
9bac43
+            .property = "mmx",\
9bac43
+            .value = "on",\
9bac43
+        },\
9bac43
         {\
9bac43
             .driver = "Westmere" "-" TYPE_X86_CPU,\
9bac43
             .property = "pat",\
9bac43
             .value = "on",\
9bac43
         },\
9bac43
+        { /* PC_RHEL6_6_COMPAT (copied from the entry above) */ \
9bac43
+            .driver = "Westmere-IBRS" "-" TYPE_X86_CPU,\
9bac43
+            .property = "pat",\
9bac43
+            .value = "on",\
9bac43
+        },\
9bac43
         {\
9bac43
             .driver = "Westmere" "-" TYPE_X86_CPU,\
9bac43
             .property = "cmov",\
9bac43
             .value = "on",\
9bac43
         },\
9bac43
+        { /* PC_RHEL6_6_COMPAT (copied from the entry above) */ \
9bac43
+            .driver = "Westmere-IBRS" "-" TYPE_X86_CPU,\
9bac43
+            .property = "cmov",\
9bac43
+            .value = "on",\
9bac43
+        },\
9bac43
         {\
9bac43
             .driver = "Westmere" "-" TYPE_X86_CPU,\
9bac43
             .property = "pge",\
9bac43
             .value = "on",\
9bac43
         },\
9bac43
+        { /* PC_RHEL6_6_COMPAT (copied from the entry above) */ \
9bac43
+            .driver = "Westmere-IBRS" "-" TYPE_X86_CPU,\
9bac43
+            .property = "pge",\
9bac43
+            .value = "on",\
9bac43
+        },\
9bac43
         {\
9bac43
             .driver = "Westmere" "-" TYPE_X86_CPU,\
9bac43
             .property = "apic",\
9bac43
             .value = "on",\
9bac43
         },\
9bac43
+        { /* PC_RHEL6_6_COMPAT (copied from the entry above) */ \
9bac43
+            .driver = "Westmere-IBRS" "-" TYPE_X86_CPU,\
9bac43
+            .property = "apic",\
9bac43
+            .value = "on",\
9bac43
+        },\
9bac43
         {\
9bac43
             .driver = "Westmere" "-" TYPE_X86_CPU,\
9bac43
             .property = "cx8",\
9bac43
             .value = "on",\
9bac43
         },\
9bac43
+        { /* PC_RHEL6_6_COMPAT (copied from the entry above) */ \
9bac43
+            .driver = "Westmere-IBRS" "-" TYPE_X86_CPU,\
9bac43
+            .property = "cx8",\
9bac43
+            .value = "on",\
9bac43
+        },\
9bac43
         {\
9bac43
             .driver = "Westmere" "-" TYPE_X86_CPU,\
9bac43
             .property = "mce",\
9bac43
             .value = "on",\
9bac43
         },\
9bac43
+        { /* PC_RHEL6_6_COMPAT (copied from the entry above) */ \
9bac43
+            .driver = "Westmere-IBRS" "-" TYPE_X86_CPU,\
9bac43
+            .property = "mce",\
9bac43
+            .value = "on",\
9bac43
+        },\
9bac43
         {\
9bac43
             .driver = "Westmere" "-" TYPE_X86_CPU,\
9bac43
             .property = "pae",\
9bac43
             .value = "on",\
9bac43
         },\
9bac43
+        { /* PC_RHEL6_6_COMPAT (copied from the entry above) */ \
9bac43
+            .driver = "Westmere-IBRS" "-" TYPE_X86_CPU,\
9bac43
+            .property = "pae",\
9bac43
+            .value = "on",\
9bac43
+        },\
9bac43
         {\
9bac43
             .driver = "Westmere" "-" TYPE_X86_CPU,\
9bac43
             .property = "msr",\
9bac43
             .value = "on",\
9bac43
         },\
9bac43
+        { /* PC_RHEL6_6_COMPAT (copied from the entry above) */ \
9bac43
+            .driver = "Westmere-IBRS" "-" TYPE_X86_CPU,\
9bac43
+            .property = "msr",\
9bac43
+            .value = "on",\
9bac43
+        },\
9bac43
         {\
9bac43
             .driver = "Westmere" "-" TYPE_X86_CPU,\
9bac43
             .property = "tsc",\
9bac43
             .value = "on",\
9bac43
         },\
9bac43
+        { /* PC_RHEL6_6_COMPAT (copied from the entry above) */ \
9bac43
+            .driver = "Westmere-IBRS" "-" TYPE_X86_CPU,\
9bac43
+            .property = "tsc",\
9bac43
+            .value = "on",\
9bac43
+        },\
9bac43
         {\
9bac43
             .driver = "Westmere" "-" TYPE_X86_CPU,\
9bac43
             .property = "pse",\
9bac43
             .value = "on",\
9bac43
         },\
9bac43
+        { /* PC_RHEL6_6_COMPAT (copied from the entry above) */ \
9bac43
+            .driver = "Westmere-IBRS" "-" TYPE_X86_CPU,\
9bac43
+            .property = "pse",\
9bac43
+            .value = "on",\
9bac43
+        },\
9bac43
         {\
9bac43
             .driver = "Westmere" "-" TYPE_X86_CPU,\
9bac43
             .property = "de",\
9bac43
             .value = "on",\
9bac43
         },\
9bac43
+        { /* PC_RHEL6_6_COMPAT (copied from the entry above) */ \
9bac43
+            .driver = "Westmere-IBRS" "-" TYPE_X86_CPU,\
9bac43
+            .property = "de",\
9bac43
+            .value = "on",\
9bac43
+        },\
9bac43
         {\
9bac43
             .driver = "Westmere" "-" TYPE_X86_CPU,\
9bac43
             .property = "fpu",\
9bac43
             .value = "on",\
9bac43
         },\
9bac43
+        { /* PC_RHEL6_6_COMPAT (copied from the entry above) */ \
9bac43
+            .driver = "Westmere-IBRS" "-" TYPE_X86_CPU,\
9bac43
+            .property = "fpu",\
9bac43
+            .value = "on",\
9bac43
+        },\
9bac43
         {\
9bac43
             .driver = "Broadwell" "-" TYPE_X86_CPU,\
9bac43
             .property = "rdtscp",\
9bac43
             .value = "off",\
9bac43
         },\
9bac43
+        { /* PC_RHEL6_6_COMPAT (copied from the entry above) */ \
9bac43
+            .driver = "Broadwell-IBRS" "-" TYPE_X86_CPU,\
9bac43
+            .property = "rdtscp",\
9bac43
+            .value = "off",\
9bac43
+        },\
9bac43
         {\
9bac43
             .driver = "Broadwell" "-" TYPE_X86_CPU,\
9bac43
             .property = "smap",\
9bac43
             .value = "off",\
9bac43
         },\
9bac43
+        { /* PC_RHEL6_6_COMPAT (copied from the entry above) */ \
9bac43
+            .driver = "Broadwell-IBRS" "-" TYPE_X86_CPU,\
9bac43
+            .property = "smap",\
9bac43
+            .value = "off",\
9bac43
+        },\
9bac43
         {\
9bac43
             .driver = TYPE_X86_CPU,\
9bac43
             .property = "rdtscp",\
9bac43
@@ -1752,6 +1847,11 @@ DEFINE_PC_MACHINE(rhel640, "rhel6.4.0", pc_init_rhel640,
9bac43
             .driver = "SandyBridge" "-" TYPE_X86_CPU,\
9bac43
             .property = "tsc-deadline",\
9bac43
             .value = "off",\
9bac43
+        },\
9bac43
+        { /* PC_RHEL6_3_COMPAT (copied from the entry above) */ \
9bac43
+            .driver = "SandyBridge-IBRS" "-" TYPE_X86_CPU,\
9bac43
+            .property = "tsc-deadline",\
9bac43
+            .value = "off",\
9bac43
         },
9bac43
 
9bac43
 static void pc_compat_rhel630(MachineState *machine)
9bac43
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
9bac43
index f9b7998..d1b1320 100644
9bac43
--- a/include/hw/i386/pc.h
9bac43
+++ b/include/hw/i386/pc.h
9bac43
@@ -1118,21 +1118,41 @@ extern void igd_passthrough_isa_bridge_create(PCIBus *bus, uint16_t gpu_dev_id);
9bac43
             .property = "abm",\
9bac43
             .value    = "off",\
9bac43
         },\
9bac43
+        { /* PC_RHEL7_2_COMPAT (copied from the entry above) */ \
9bac43
+            .driver   = "Haswell-IBRS" "-" TYPE_X86_CPU,\
9bac43
+            .property = "abm",\
9bac43
+            .value    = "off",\
9bac43
+        },\
9bac43
         { /* PC_RHEL7_2_COMPAT */ \
9bac43
             .driver   = "Haswell-noTSX-" TYPE_X86_CPU,\
9bac43
             .property = "abm",\
9bac43
             .value    = "off",\
9bac43
         },\
9bac43
+        { /* PC_RHEL7_2_COMPAT (copied from the entry above) */ \
9bac43
+            .driver   = "Haswell-noTSX-IBRS" "-" TYPE_X86_CPU,\
9bac43
+            .property = "abm",\
9bac43
+            .value    = "off",\
9bac43
+        },\
9bac43
         { /* PC_RHEL7_2_COMPAT */ \
9bac43
             .driver   = "Broadwell-" TYPE_X86_CPU,\
9bac43
             .property = "abm",\
9bac43
             .value    = "off",\
9bac43
         },\
9bac43
+        { /* PC_RHEL7_2_COMPAT (copied from the entry above) */ \
9bac43
+            .driver   = "Broadwell-IBRS" "-" TYPE_X86_CPU,\
9bac43
+            .property = "abm",\
9bac43
+            .value    = "off",\
9bac43
+        },\
9bac43
         { /* PC_RHEL7_2_COMPAT */ \
9bac43
             .driver   = "Broadwell-noTSX-" TYPE_X86_CPU,\
9bac43
             .property = "abm",\
9bac43
             .value    = "off",\
9bac43
         },\
9bac43
+        { /* PC_RHEL7_2_COMPAT (copied from the entry above) */ \
9bac43
+            .driver   = "Broadwell-noTSX-IBRS" "-" TYPE_X86_CPU,\
9bac43
+            .property = "abm",\
9bac43
+            .value    = "off",\
9bac43
+        },\
9bac43
         { /* PC_RHEL7_2_COMPAT */ \
9bac43
             .driver   = "host" "-" TYPE_X86_CPU,\
9bac43
             .property = "host-cache-info",\
9bac43
@@ -1198,26 +1218,51 @@ extern void igd_passthrough_isa_bridge_create(PCIBus *bus, uint16_t gpu_dev_id);
9bac43
 		.property = "vme",\
9bac43
 		.value = "off",\
9bac43
 	},\
9bac43
+	{ /* PC_RHEL7_1_COMPAT (copied from the entry above) */ \
9bac43
+		.driver = "Nehalem-IBRS" "-" TYPE_X86_CPU,\
9bac43
+		.property = "vme",\
9bac43
+		.value = "off",\
9bac43
+	},\
9bac43
 	{\
9bac43
 		.driver = "Westmere" "-" TYPE_X86_CPU,\
9bac43
 		.property = "vme",\
9bac43
 		.value = "off",\
9bac43
 	},\
9bac43
+	{ /* PC_RHEL7_1_COMPAT (copied from the entry above) */ \
9bac43
+		.driver = "Westmere-IBRS" "-" TYPE_X86_CPU,\
9bac43
+		.property = "vme",\
9bac43
+		.value = "off",\
9bac43
+	},\
9bac43
 	{\
9bac43
 		.driver = "SandyBridge" "-" TYPE_X86_CPU,\
9bac43
 		.property = "vme",\
9bac43
 		.value = "off",\
9bac43
 	},\
9bac43
+	{ /* PC_RHEL7_1_COMPAT (copied from the entry above) */ \
9bac43
+		.driver = "SandyBridge-IBRS" "-" TYPE_X86_CPU,\
9bac43
+		.property = "vme",\
9bac43
+		.value = "off",\
9bac43
+	},\
9bac43
 	{\
9bac43
 		.driver = "Haswell" "-" TYPE_X86_CPU,\
9bac43
 		.property = "vme",\
9bac43
 		.value = "off",\
9bac43
 	},\
9bac43
+	{ /* PC_RHEL7_1_COMPAT (copied from the entry above) */ \
9bac43
+		.driver = "Haswell-IBRS" "-" TYPE_X86_CPU,\
9bac43
+		.property = "vme",\
9bac43
+		.value = "off",\
9bac43
+	},\
9bac43
 	{\
9bac43
 		.driver = "Broadwell" "-" TYPE_X86_CPU,\
9bac43
 		.property = "vme",\
9bac43
 		.value = "off",\
9bac43
 	},\
9bac43
+	{ /* PC_RHEL7_1_COMPAT (copied from the entry above) */ \
9bac43
+		.driver = "Broadwell-IBRS" "-" TYPE_X86_CPU,\
9bac43
+		.property = "vme",\
9bac43
+		.value = "off",\
9bac43
+	},\
9bac43
 	{\
9bac43
 		.driver = "Opteron_G1" "-" TYPE_X86_CPU,\
9bac43
 		.property = "vme",\
9bac43
@@ -1248,21 +1293,41 @@ extern void igd_passthrough_isa_bridge_create(PCIBus *bus, uint16_t gpu_dev_id);
9bac43
 		.property = "f16c",\
9bac43
 		.value = "off",\
9bac43
 	},\
9bac43
+	{ /* PC_RHEL7_1_COMPAT (copied from the entry above) */ \
9bac43
+		.driver = "Haswell-IBRS" "-" TYPE_X86_CPU,\
9bac43
+		.property = "f16c",\
9bac43
+		.value = "off",\
9bac43
+	},\
9bac43
 	{\
9bac43
 		.driver = "Haswell" "-" TYPE_X86_CPU,\
9bac43
 		.property = "rdrand",\
9bac43
 		.value = "off",\
9bac43
 	},\
9bac43
+	{ /* PC_RHEL7_1_COMPAT (copied from the entry above) */ \
9bac43
+		.driver = "Haswell-IBRS" "-" TYPE_X86_CPU,\
9bac43
+		.property = "rdrand",\
9bac43
+		.value = "off",\
9bac43
+	},\
9bac43
 	{\
9bac43
 		.driver = "Broadwell" "-" TYPE_X86_CPU,\
9bac43
 		.property = "f16c",\
9bac43
 		.value = "off",\
9bac43
 	},\
9bac43
+	{ /* PC_RHEL7_1_COMPAT (copied from the entry above) */ \
9bac43
+		.driver = "Broadwell-IBRS" "-" TYPE_X86_CPU,\
9bac43
+		.property = "f16c",\
9bac43
+		.value = "off",\
9bac43
+	},\
9bac43
 	{\
9bac43
 		.driver = "Broadwell" "-" TYPE_X86_CPU,\
9bac43
 		.property = "rdrand",\
9bac43
 		.value = "off",\
9bac43
 	},\
9bac43
+	{ /* PC_RHEL7_1_COMPAT (copied from the entry above) */ \
9bac43
+		.driver = "Broadwell-IBRS" "-" TYPE_X86_CPU,\
9bac43
+		.property = "rdrand",\
9bac43
+		.value = "off",\
9bac43
+	},\
9bac43
 	{\
9bac43
 		.driver = "coreduo" "-" TYPE_X86_CPU,\
9bac43
 		.property = "vmx",\
9bac43
@@ -1431,11 +1496,21 @@ extern void igd_passthrough_isa_bridge_create(PCIBus *bus, uint16_t gpu_dev_id);
9bac43
 		.property = "x2apic",\
9bac43
 		.value = "on",\
9bac43
 	},\
9bac43
+	{ /* PC_RHEL7_0_COMPAT (copied from the entry above) */ \
9bac43
+		.driver = "Nehalem-IBRS" "-" TYPE_X86_CPU,\
9bac43
+		.property = "x2apic",\
9bac43
+		.value = "on",\
9bac43
+	},\
9bac43
 	{\
9bac43
 		.driver = "Westmere" "-" TYPE_X86_CPU,\
9bac43
 		.property = "x2apic",\
9bac43
 		.value = "on",\
9bac43
 	},\
9bac43
+	{ /* PC_RHEL7_0_COMPAT (copied from the entry above) */ \
9bac43
+		.driver = "Westmere-IBRS" "-" TYPE_X86_CPU,\
9bac43
+		.property = "x2apic",\
9bac43
+		.value = "on",\
9bac43
+	},\
9bac43
 	{\
9bac43
 		.driver = "Opteron_G1" "-" TYPE_X86_CPU,\
9bac43
 		.property = "x2apic",\
9bac43
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
9bac43
index 364e52e..da5a266 100644
9bac43
--- a/target/i386/cpu.c
9bac43
+++ b/target/i386/cpu.c
9bac43
@@ -1102,6 +1102,31 @@ static X86CPUDefinition builtin_x86_defs[] = {
9bac43
         .model_id = "Intel Core i7 9xx (Nehalem Class Core i7)",
9bac43
     },
9bac43
     {
9bac43
+        .name = "Nehalem-IBRS",
9bac43
+        .level = 11,
9bac43
+        .vendor = CPUID_VENDOR_INTEL,
9bac43
+        .family = 6,
9bac43
+        .model = 26,
9bac43
+        .stepping = 3,
9bac43
+        .features[FEAT_1_EDX] =
9bac43
+            CPUID_VME | CPUID_SSE2 | CPUID_SSE | CPUID_FXSR | CPUID_MMX |
9bac43
+            CPUID_CLFLUSH | CPUID_PSE36 | CPUID_PAT | CPUID_CMOV | CPUID_MCA |
9bac43
+            CPUID_PGE | CPUID_MTRR | CPUID_SEP | CPUID_APIC | CPUID_CX8 |
9bac43
+            CPUID_MCE | CPUID_PAE | CPUID_MSR | CPUID_TSC | CPUID_PSE |
9bac43
+            CPUID_DE | CPUID_FP87,
9bac43
+        .features[FEAT_1_ECX] =
9bac43
+            CPUID_EXT_POPCNT | CPUID_EXT_SSE42 | CPUID_EXT_SSE41 |
9bac43
+            CPUID_EXT_CX16 | CPUID_EXT_SSSE3 | CPUID_EXT_SSE3,
9bac43
+        .features[FEAT_7_0_EDX] =
9bac43
+            CPUID_7_0_EDX_SPEC_CTRL,
9bac43
+        .features[FEAT_8000_0001_EDX] =
9bac43
+            CPUID_EXT2_LM | CPUID_EXT2_SYSCALL | CPUID_EXT2_NX,
9bac43
+        .features[FEAT_8000_0001_ECX] =
9bac43
+            CPUID_EXT3_LAHF_LM,
9bac43
+        .xlevel = 0x80000008,
9bac43
+        .model_id = "Intel Core i7 9xx (Nehalem Core i7, IBRS update)",
9bac43
+    },
9bac43
+    {
9bac43
         .name = "Westmere",
9bac43
         .level = 11,
9bac43
         .vendor = CPUID_VENDOR_INTEL,
9bac43
@@ -1128,6 +1153,34 @@ static X86CPUDefinition builtin_x86_defs[] = {
9bac43
         .model_id = "Westmere E56xx/L56xx/X56xx (Nehalem-C)",
9bac43
     },
9bac43
     {
9bac43
+        .name = "Westmere-IBRS",
9bac43
+        .level = 11,
9bac43
+        .vendor = CPUID_VENDOR_INTEL,
9bac43
+        .family = 6,
9bac43
+        .model = 44,
9bac43
+        .stepping = 1,
9bac43
+        .features[FEAT_1_EDX] =
9bac43
+            CPUID_VME | CPUID_SSE2 | CPUID_SSE | CPUID_FXSR | CPUID_MMX |
9bac43
+            CPUID_CLFLUSH | CPUID_PSE36 | CPUID_PAT | CPUID_CMOV | CPUID_MCA |
9bac43
+            CPUID_PGE | CPUID_MTRR | CPUID_SEP | CPUID_APIC | CPUID_CX8 |
9bac43
+            CPUID_MCE | CPUID_PAE | CPUID_MSR | CPUID_TSC | CPUID_PSE |
9bac43
+            CPUID_DE | CPUID_FP87,
9bac43
+        .features[FEAT_1_ECX] =
9bac43
+            CPUID_EXT_AES | CPUID_EXT_POPCNT | CPUID_EXT_SSE42 |
9bac43
+            CPUID_EXT_SSE41 | CPUID_EXT_CX16 | CPUID_EXT_SSSE3 |
9bac43
+            CPUID_EXT_PCLMULQDQ | CPUID_EXT_SSE3,
9bac43
+        .features[FEAT_8000_0001_EDX] =
9bac43
+            CPUID_EXT2_LM | CPUID_EXT2_SYSCALL | CPUID_EXT2_NX,
9bac43
+        .features[FEAT_8000_0001_ECX] =
9bac43
+            CPUID_EXT3_LAHF_LM,
9bac43
+        .features[FEAT_7_0_EDX] =
9bac43
+            CPUID_7_0_EDX_SPEC_CTRL,
9bac43
+        .features[FEAT_6_EAX] =
9bac43
+            CPUID_6_EAX_ARAT,
9bac43
+        .xlevel = 0x80000008,
9bac43
+        .model_id = "Westmere E56xx/L56xx/X56xx (IBRS update)",
9bac43
+    },
9bac43
+    {
9bac43
         .name = "SandyBridge",
9bac43
         .level = 0xd,
9bac43
         .vendor = CPUID_VENDOR_INTEL,
9bac43
@@ -1159,6 +1212,39 @@ static X86CPUDefinition builtin_x86_defs[] = {
9bac43
         .model_id = "Intel Xeon E312xx (Sandy Bridge)",
9bac43
     },
9bac43
     {
9bac43
+        .name = "SandyBridge-IBRS",
9bac43
+        .level = 0xd,
9bac43
+        .vendor = CPUID_VENDOR_INTEL,
9bac43
+        .family = 6,
9bac43
+        .model = 42,
9bac43
+        .stepping = 1,
9bac43
+        .features[FEAT_1_EDX] =
9bac43
+            CPUID_VME | CPUID_SSE2 | CPUID_SSE | CPUID_FXSR | CPUID_MMX |
9bac43
+            CPUID_CLFLUSH | CPUID_PSE36 | CPUID_PAT | CPUID_CMOV | CPUID_MCA |
9bac43
+            CPUID_PGE | CPUID_MTRR | CPUID_SEP | CPUID_APIC | CPUID_CX8 |
9bac43
+            CPUID_MCE | CPUID_PAE | CPUID_MSR | CPUID_TSC | CPUID_PSE |
9bac43
+            CPUID_DE | CPUID_FP87,
9bac43
+        .features[FEAT_1_ECX] =
9bac43
+            CPUID_EXT_AVX | CPUID_EXT_XSAVE | CPUID_EXT_AES |
9bac43
+            CPUID_EXT_TSC_DEADLINE_TIMER | CPUID_EXT_POPCNT |
9bac43
+            CPUID_EXT_X2APIC | CPUID_EXT_SSE42 | CPUID_EXT_SSE41 |
9bac43
+            CPUID_EXT_CX16 | CPUID_EXT_SSSE3 | CPUID_EXT_PCLMULQDQ |
9bac43
+            CPUID_EXT_SSE3,
9bac43
+        .features[FEAT_8000_0001_EDX] =
9bac43
+            CPUID_EXT2_LM | CPUID_EXT2_RDTSCP | CPUID_EXT2_NX |
9bac43
+            CPUID_EXT2_SYSCALL,
9bac43
+        .features[FEAT_8000_0001_ECX] =
9bac43
+            CPUID_EXT3_LAHF_LM,
9bac43
+        .features[FEAT_7_0_EDX] =
9bac43
+            CPUID_7_0_EDX_SPEC_CTRL,
9bac43
+        .features[FEAT_XSAVE] =
9bac43
+            CPUID_XSAVE_XSAVEOPT,
9bac43
+        .features[FEAT_6_EAX] =
9bac43
+            CPUID_6_EAX_ARAT,
9bac43
+        .xlevel = 0x80000008,
9bac43
+        .model_id = "Intel Xeon E312xx (Sandy Bridge, IBRS update)",
9bac43
+    },
9bac43
+    {
9bac43
         .name = "IvyBridge",
9bac43
         .level = 0xd,
9bac43
         .vendor = CPUID_VENDOR_INTEL,
9bac43
@@ -1193,6 +1279,42 @@ static X86CPUDefinition builtin_x86_defs[] = {
9bac43
         .model_id = "Intel Xeon E3-12xx v2 (Ivy Bridge)",
9bac43
     },
9bac43
     {
9bac43
+        .name = "IvyBridge-IBRS",
9bac43
+        .level = 0xd,
9bac43
+        .vendor = CPUID_VENDOR_INTEL,
9bac43
+        .family = 6,
9bac43
+        .model = 58,
9bac43
+        .stepping = 9,
9bac43
+        .features[FEAT_1_EDX] =
9bac43
+            CPUID_VME | CPUID_SSE2 | CPUID_SSE | CPUID_FXSR | CPUID_MMX |
9bac43
+            CPUID_CLFLUSH | CPUID_PSE36 | CPUID_PAT | CPUID_CMOV | CPUID_MCA |
9bac43
+            CPUID_PGE | CPUID_MTRR | CPUID_SEP | CPUID_APIC | CPUID_CX8 |
9bac43
+            CPUID_MCE | CPUID_PAE | CPUID_MSR | CPUID_TSC | CPUID_PSE |
9bac43
+            CPUID_DE | CPUID_FP87,
9bac43
+        .features[FEAT_1_ECX] =
9bac43
+            CPUID_EXT_AVX | CPUID_EXT_XSAVE | CPUID_EXT_AES |
9bac43
+            CPUID_EXT_TSC_DEADLINE_TIMER | CPUID_EXT_POPCNT |
9bac43
+            CPUID_EXT_X2APIC | CPUID_EXT_SSE42 | CPUID_EXT_SSE41 |
9bac43
+            CPUID_EXT_CX16 | CPUID_EXT_SSSE3 | CPUID_EXT_PCLMULQDQ |
9bac43
+            CPUID_EXT_SSE3 | CPUID_EXT_F16C | CPUID_EXT_RDRAND,
9bac43
+        .features[FEAT_7_0_EBX] =
9bac43
+            CPUID_7_0_EBX_FSGSBASE | CPUID_7_0_EBX_SMEP |
9bac43
+            CPUID_7_0_EBX_ERMS,
9bac43
+        .features[FEAT_8000_0001_EDX] =
9bac43
+            CPUID_EXT2_LM | CPUID_EXT2_RDTSCP | CPUID_EXT2_NX |
9bac43
+            CPUID_EXT2_SYSCALL,
9bac43
+        .features[FEAT_8000_0001_ECX] =
9bac43
+            CPUID_EXT3_LAHF_LM,
9bac43
+        .features[FEAT_7_0_EDX] =
9bac43
+            CPUID_7_0_EDX_SPEC_CTRL,
9bac43
+        .features[FEAT_XSAVE] =
9bac43
+            CPUID_XSAVE_XSAVEOPT,
9bac43
+        .features[FEAT_6_EAX] =
9bac43
+            CPUID_6_EAX_ARAT,
9bac43
+        .xlevel = 0x80000008,
9bac43
+        .model_id = "Intel Xeon E3-12xx v2 (Ivy Bridge, IBRS)",
9bac43
+    },
9bac43
+    {
9bac43
         .name = "Haswell-noTSX",
9bac43
         .level = 0xd,
9bac43
         .vendor = CPUID_VENDOR_INTEL,
9bac43
@@ -1227,7 +1349,46 @@ static X86CPUDefinition builtin_x86_defs[] = {
9bac43
             CPUID_6_EAX_ARAT,
9bac43
         .xlevel = 0x80000008,
9bac43
         .model_id = "Intel Core Processor (Haswell, no TSX)",
9bac43
-    },    {
9bac43
+    },
9bac43
+    {
9bac43
+        .name = "Haswell-noTSX-IBRS",
9bac43
+        .level = 0xd,
9bac43
+        .vendor = CPUID_VENDOR_INTEL,
9bac43
+        .family = 6,
9bac43
+        .model = 60,
9bac43
+        .stepping = 1,
9bac43
+        .features[FEAT_1_EDX] =
9bac43
+            CPUID_VME | CPUID_SSE2 | CPUID_SSE | CPUID_FXSR | CPUID_MMX |
9bac43
+            CPUID_CLFLUSH | CPUID_PSE36 | CPUID_PAT | CPUID_CMOV | CPUID_MCA |
9bac43
+            CPUID_PGE | CPUID_MTRR | CPUID_SEP | CPUID_APIC | CPUID_CX8 |
9bac43
+            CPUID_MCE | CPUID_PAE | CPUID_MSR | CPUID_TSC | CPUID_PSE |
9bac43
+            CPUID_DE | CPUID_FP87,
9bac43
+        .features[FEAT_1_ECX] =
9bac43
+            CPUID_EXT_AVX | CPUID_EXT_XSAVE | CPUID_EXT_AES |
9bac43
+            CPUID_EXT_POPCNT | CPUID_EXT_X2APIC | CPUID_EXT_SSE42 |
9bac43
+            CPUID_EXT_SSE41 | CPUID_EXT_CX16 | CPUID_EXT_SSSE3 |
9bac43
+            CPUID_EXT_PCLMULQDQ | CPUID_EXT_SSE3 |
9bac43
+            CPUID_EXT_TSC_DEADLINE_TIMER | CPUID_EXT_FMA | CPUID_EXT_MOVBE |
9bac43
+            CPUID_EXT_PCID | CPUID_EXT_F16C | CPUID_EXT_RDRAND,
9bac43
+        .features[FEAT_8000_0001_EDX] =
9bac43
+            CPUID_EXT2_LM | CPUID_EXT2_RDTSCP | CPUID_EXT2_NX |
9bac43
+            CPUID_EXT2_SYSCALL,
9bac43
+        .features[FEAT_8000_0001_ECX] =
9bac43
+            CPUID_EXT3_ABM | CPUID_EXT3_LAHF_LM,
9bac43
+        .features[FEAT_7_0_EDX] =
9bac43
+            CPUID_7_0_EDX_SPEC_CTRL,
9bac43
+        .features[FEAT_7_0_EBX] =
9bac43
+            CPUID_7_0_EBX_FSGSBASE | CPUID_7_0_EBX_BMI1 |
9bac43
+            CPUID_7_0_EBX_AVX2 | CPUID_7_0_EBX_SMEP |
9bac43
+            CPUID_7_0_EBX_BMI2 | CPUID_7_0_EBX_ERMS | CPUID_7_0_EBX_INVPCID,
9bac43
+        .features[FEAT_XSAVE] =
9bac43
+            CPUID_XSAVE_XSAVEOPT,
9bac43
+        .features[FEAT_6_EAX] =
9bac43
+            CPUID_6_EAX_ARAT,
9bac43
+        .xlevel = 0x80000008,
9bac43
+        .model_id = "Intel Core Processor (Haswell, no TSX, IBRS)",
9bac43
+    },
9bac43
+    {
9bac43
         .name = "Haswell",
9bac43
         .level = 0xd,
9bac43
         .vendor = CPUID_VENDOR_INTEL,
9bac43
@@ -1265,6 +1426,45 @@ static X86CPUDefinition builtin_x86_defs[] = {
9bac43
         .model_id = "Intel Core Processor (Haswell)",
9bac43
     },
9bac43
     {
9bac43
+        .name = "Haswell-IBRS",
9bac43
+        .level = 0xd,
9bac43
+        .vendor = CPUID_VENDOR_INTEL,
9bac43
+        .family = 6,
9bac43
+        .model = 60,
9bac43
+        .stepping = 4,
9bac43
+        .features[FEAT_1_EDX] =
9bac43
+            CPUID_VME | CPUID_SSE2 | CPUID_SSE | CPUID_FXSR | CPUID_MMX |
9bac43
+            CPUID_CLFLUSH | CPUID_PSE36 | CPUID_PAT | CPUID_CMOV | CPUID_MCA |
9bac43
+            CPUID_PGE | CPUID_MTRR | CPUID_SEP | CPUID_APIC | CPUID_CX8 |
9bac43
+            CPUID_MCE | CPUID_PAE | CPUID_MSR | CPUID_TSC | CPUID_PSE |
9bac43
+            CPUID_DE | CPUID_FP87,
9bac43
+        .features[FEAT_1_ECX] =
9bac43
+            CPUID_EXT_AVX | CPUID_EXT_XSAVE | CPUID_EXT_AES |
9bac43
+            CPUID_EXT_POPCNT | CPUID_EXT_X2APIC | CPUID_EXT_SSE42 |
9bac43
+            CPUID_EXT_SSE41 | CPUID_EXT_CX16 | CPUID_EXT_SSSE3 |
9bac43
+            CPUID_EXT_PCLMULQDQ | CPUID_EXT_SSE3 |
9bac43
+            CPUID_EXT_TSC_DEADLINE_TIMER | CPUID_EXT_FMA | CPUID_EXT_MOVBE |
9bac43
+            CPUID_EXT_PCID | CPUID_EXT_F16C | CPUID_EXT_RDRAND,
9bac43
+        .features[FEAT_8000_0001_EDX] =
9bac43
+            CPUID_EXT2_LM | CPUID_EXT2_RDTSCP | CPUID_EXT2_NX |
9bac43
+            CPUID_EXT2_SYSCALL,
9bac43
+        .features[FEAT_8000_0001_ECX] =
9bac43
+            CPUID_EXT3_ABM | CPUID_EXT3_LAHF_LM,
9bac43
+        .features[FEAT_7_0_EDX] =
9bac43
+            CPUID_7_0_EDX_SPEC_CTRL,
9bac43
+        .features[FEAT_7_0_EBX] =
9bac43
+            CPUID_7_0_EBX_FSGSBASE | CPUID_7_0_EBX_BMI1 |
9bac43
+            CPUID_7_0_EBX_HLE | CPUID_7_0_EBX_AVX2 | CPUID_7_0_EBX_SMEP |
9bac43
+            CPUID_7_0_EBX_BMI2 | CPUID_7_0_EBX_ERMS | CPUID_7_0_EBX_INVPCID |
9bac43
+            CPUID_7_0_EBX_RTM,
9bac43
+        .features[FEAT_XSAVE] =
9bac43
+            CPUID_XSAVE_XSAVEOPT,
9bac43
+        .features[FEAT_6_EAX] =
9bac43
+            CPUID_6_EAX_ARAT,
9bac43
+        .xlevel = 0x80000008,
9bac43
+        .model_id = "Intel Core Processor (Haswell, IBRS)",
9bac43
+    },
9bac43
+    {
9bac43
         .name = "Broadwell-noTSX",
9bac43
         .level = 0xd,
9bac43
         .vendor = CPUID_VENDOR_INTEL,
9bac43
@@ -1303,6 +1503,46 @@ static X86CPUDefinition builtin_x86_defs[] = {
9bac43
         .model_id = "Intel Core Processor (Broadwell, no TSX)",
9bac43
     },
9bac43
     {
9bac43
+        .name = "Broadwell-noTSX-IBRS",
9bac43
+        .level = 0xd,
9bac43
+        .vendor = CPUID_VENDOR_INTEL,
9bac43
+        .family = 6,
9bac43
+        .model = 61,
9bac43
+        .stepping = 2,
9bac43
+        .features[FEAT_1_EDX] =
9bac43
+            CPUID_VME | CPUID_SSE2 | CPUID_SSE | CPUID_FXSR | CPUID_MMX |
9bac43
+            CPUID_CLFLUSH | CPUID_PSE36 | CPUID_PAT | CPUID_CMOV | CPUID_MCA |
9bac43
+            CPUID_PGE | CPUID_MTRR | CPUID_SEP | CPUID_APIC | CPUID_CX8 |
9bac43
+            CPUID_MCE | CPUID_PAE | CPUID_MSR | CPUID_TSC | CPUID_PSE |
9bac43
+            CPUID_DE | CPUID_FP87,
9bac43
+        .features[FEAT_1_ECX] =
9bac43
+            CPUID_EXT_AVX | CPUID_EXT_XSAVE | CPUID_EXT_AES |
9bac43
+            CPUID_EXT_POPCNT | CPUID_EXT_X2APIC | CPUID_EXT_SSE42 |
9bac43
+            CPUID_EXT_SSE41 | CPUID_EXT_CX16 | CPUID_EXT_SSSE3 |
9bac43
+            CPUID_EXT_PCLMULQDQ | CPUID_EXT_SSE3 |
9bac43
+            CPUID_EXT_TSC_DEADLINE_TIMER | CPUID_EXT_FMA | CPUID_EXT_MOVBE |
9bac43
+            CPUID_EXT_PCID | CPUID_EXT_F16C | CPUID_EXT_RDRAND,
9bac43
+        .features[FEAT_8000_0001_EDX] =
9bac43
+            CPUID_EXT2_LM | CPUID_EXT2_RDTSCP | CPUID_EXT2_NX |
9bac43
+            CPUID_EXT2_SYSCALL,
9bac43
+        .features[FEAT_8000_0001_ECX] =
9bac43
+            CPUID_EXT3_ABM | CPUID_EXT3_LAHF_LM | CPUID_EXT3_3DNOWPREFETCH,
9bac43
+        .features[FEAT_7_0_EDX] =
9bac43
+            CPUID_7_0_EDX_SPEC_CTRL,
9bac43
+        .features[FEAT_7_0_EBX] =
9bac43
+            CPUID_7_0_EBX_FSGSBASE | CPUID_7_0_EBX_BMI1 |
9bac43
+            CPUID_7_0_EBX_AVX2 | CPUID_7_0_EBX_SMEP |
9bac43
+            CPUID_7_0_EBX_BMI2 | CPUID_7_0_EBX_ERMS | CPUID_7_0_EBX_INVPCID |
9bac43
+            CPUID_7_0_EBX_RDSEED | CPUID_7_0_EBX_ADX |
9bac43
+            CPUID_7_0_EBX_SMAP,
9bac43
+        .features[FEAT_XSAVE] =
9bac43
+            CPUID_XSAVE_XSAVEOPT,
9bac43
+        .features[FEAT_6_EAX] =
9bac43
+            CPUID_6_EAX_ARAT,
9bac43
+        .xlevel = 0x80000008,
9bac43
+        .model_id = "Intel Core Processor (Broadwell, no TSX, IBRS)",
9bac43
+    },
9bac43
+    {
9bac43
         .name = "Broadwell",
9bac43
         .level = 0xd,
9bac43
         .vendor = CPUID_VENDOR_INTEL,
9bac43
@@ -1341,6 +1581,46 @@ static X86CPUDefinition builtin_x86_defs[] = {
9bac43
         .model_id = "Intel Core Processor (Broadwell)",
9bac43
     },
9bac43
     {
9bac43
+        .name = "Broadwell-IBRS",
9bac43
+        .level = 0xd,
9bac43
+        .vendor = CPUID_VENDOR_INTEL,
9bac43
+        .family = 6,
9bac43
+        .model = 61,
9bac43
+        .stepping = 2,
9bac43
+        .features[FEAT_1_EDX] =
9bac43
+            CPUID_VME | CPUID_SSE2 | CPUID_SSE | CPUID_FXSR | CPUID_MMX |
9bac43
+            CPUID_CLFLUSH | CPUID_PSE36 | CPUID_PAT | CPUID_CMOV | CPUID_MCA |
9bac43
+            CPUID_PGE | CPUID_MTRR | CPUID_SEP | CPUID_APIC | CPUID_CX8 |
9bac43
+            CPUID_MCE | CPUID_PAE | CPUID_MSR | CPUID_TSC | CPUID_PSE |
9bac43
+            CPUID_DE | CPUID_FP87,
9bac43
+        .features[FEAT_1_ECX] =
9bac43
+            CPUID_EXT_AVX | CPUID_EXT_XSAVE | CPUID_EXT_AES |
9bac43
+            CPUID_EXT_POPCNT | CPUID_EXT_X2APIC | CPUID_EXT_SSE42 |
9bac43
+            CPUID_EXT_SSE41 | CPUID_EXT_CX16 | CPUID_EXT_SSSE3 |
9bac43
+            CPUID_EXT_PCLMULQDQ | CPUID_EXT_SSE3 |
9bac43
+            CPUID_EXT_TSC_DEADLINE_TIMER | CPUID_EXT_FMA | CPUID_EXT_MOVBE |
9bac43
+            CPUID_EXT_PCID | CPUID_EXT_F16C | CPUID_EXT_RDRAND,
9bac43
+        .features[FEAT_8000_0001_EDX] =
9bac43
+            CPUID_EXT2_LM | CPUID_EXT2_RDTSCP | CPUID_EXT2_NX |
9bac43
+            CPUID_EXT2_SYSCALL,
9bac43
+        .features[FEAT_8000_0001_ECX] =
9bac43
+            CPUID_EXT3_ABM | CPUID_EXT3_LAHF_LM | CPUID_EXT3_3DNOWPREFETCH,
9bac43
+        .features[FEAT_7_0_EDX] =
9bac43
+            CPUID_7_0_EDX_SPEC_CTRL,
9bac43
+        .features[FEAT_7_0_EBX] =
9bac43
+            CPUID_7_0_EBX_FSGSBASE | CPUID_7_0_EBX_BMI1 |
9bac43
+            CPUID_7_0_EBX_HLE | CPUID_7_0_EBX_AVX2 | CPUID_7_0_EBX_SMEP |
9bac43
+            CPUID_7_0_EBX_BMI2 | CPUID_7_0_EBX_ERMS | CPUID_7_0_EBX_INVPCID |
9bac43
+            CPUID_7_0_EBX_RTM | CPUID_7_0_EBX_RDSEED | CPUID_7_0_EBX_ADX |
9bac43
+            CPUID_7_0_EBX_SMAP,
9bac43
+        .features[FEAT_XSAVE] =
9bac43
+            CPUID_XSAVE_XSAVEOPT,
9bac43
+        .features[FEAT_6_EAX] =
9bac43
+            CPUID_6_EAX_ARAT,
9bac43
+        .xlevel = 0x80000008,
9bac43
+        .model_id = "Intel Core Processor (Broadwell, IBRS)",
9bac43
+    },
9bac43
+    {
9bac43
         .name = "Skylake-Client",
9bac43
         .level = 0xd,
9bac43
         .vendor = CPUID_VENDOR_INTEL,
9bac43
@@ -1386,6 +1666,53 @@ static X86CPUDefinition builtin_x86_defs[] = {
9bac43
         .model_id = "Intel Core Processor (Skylake)",
9bac43
     },
9bac43
     {
9bac43
+        .name = "Skylake-Client-IBRS",
9bac43
+        .level = 0xd,
9bac43
+        .vendor = CPUID_VENDOR_INTEL,
9bac43
+        .family = 6,
9bac43
+        .model = 94,
9bac43
+        .stepping = 3,
9bac43
+        .features[FEAT_1_EDX] =
9bac43
+            CPUID_VME | CPUID_SSE2 | CPUID_SSE | CPUID_FXSR | CPUID_MMX |
9bac43
+            CPUID_CLFLUSH | CPUID_PSE36 | CPUID_PAT | CPUID_CMOV | CPUID_MCA |
9bac43
+            CPUID_PGE | CPUID_MTRR | CPUID_SEP | CPUID_APIC | CPUID_CX8 |
9bac43
+            CPUID_MCE | CPUID_PAE | CPUID_MSR | CPUID_TSC | CPUID_PSE |
9bac43
+            CPUID_DE | CPUID_FP87,
9bac43
+        .features[FEAT_1_ECX] =
9bac43
+            CPUID_EXT_AVX | CPUID_EXT_XSAVE | CPUID_EXT_AES |
9bac43
+            CPUID_EXT_POPCNT | CPUID_EXT_X2APIC | CPUID_EXT_SSE42 |
9bac43
+            CPUID_EXT_SSE41 | CPUID_EXT_CX16 | CPUID_EXT_SSSE3 |
9bac43
+            CPUID_EXT_PCLMULQDQ | CPUID_EXT_SSE3 |
9bac43
+            CPUID_EXT_TSC_DEADLINE_TIMER | CPUID_EXT_FMA | CPUID_EXT_MOVBE |
9bac43
+            CPUID_EXT_PCID | CPUID_EXT_F16C | CPUID_EXT_RDRAND,
9bac43
+        .features[FEAT_8000_0001_EDX] =
9bac43
+            CPUID_EXT2_LM | CPUID_EXT2_RDTSCP | CPUID_EXT2_NX |
9bac43
+            CPUID_EXT2_SYSCALL,
9bac43
+        .features[FEAT_8000_0001_ECX] =
9bac43
+            CPUID_EXT3_ABM | CPUID_EXT3_LAHF_LM | CPUID_EXT3_3DNOWPREFETCH,
9bac43
+        .features[FEAT_7_0_EDX] =
9bac43
+            CPUID_7_0_EDX_SPEC_CTRL,
9bac43
+        .features[FEAT_7_0_EBX] =
9bac43
+            CPUID_7_0_EBX_FSGSBASE | CPUID_7_0_EBX_BMI1 |
9bac43
+            CPUID_7_0_EBX_HLE | CPUID_7_0_EBX_AVX2 | CPUID_7_0_EBX_SMEP |
9bac43
+            CPUID_7_0_EBX_BMI2 | CPUID_7_0_EBX_ERMS | CPUID_7_0_EBX_INVPCID |
9bac43
+            CPUID_7_0_EBX_RTM | CPUID_7_0_EBX_RDSEED | CPUID_7_0_EBX_ADX |
9bac43
+            CPUID_7_0_EBX_SMAP | CPUID_7_0_EBX_MPX,
9bac43
+        /* Missing: XSAVES (not supported by some Linux versions,
9bac43
+         * including v4.1 to v4.12).
9bac43
+         * KVM doesn't yet expose any XSAVES state save component,
9bac43
+         * and the only one defined in Skylake (processor tracing)
9bac43
+         * probably will block migration anyway.
9bac43
+         */
9bac43
+        .features[FEAT_XSAVE] =
9bac43
+            CPUID_XSAVE_XSAVEOPT | CPUID_XSAVE_XSAVEC |
9bac43
+            CPUID_XSAVE_XGETBV1,
9bac43
+        .features[FEAT_6_EAX] =
9bac43
+            CPUID_6_EAX_ARAT,
9bac43
+        .xlevel = 0x80000008,
9bac43
+        .model_id = "Intel Core Processor (Skylake, IBRS)",
9bac43
+    },
9bac43
+    {
9bac43
         .name = "Skylake-Server",
9bac43
         .level = 0xd,
9bac43
         .vendor = CPUID_VENDOR_INTEL,
9bac43
@@ -1434,6 +1761,56 @@ static X86CPUDefinition builtin_x86_defs[] = {
9bac43
         .model_id = "Intel Xeon Processor (Skylake)",
9bac43
     },
9bac43
     {
9bac43
+        .name = "Skylake-Server-IBRS",
9bac43
+        .level = 0xd,
9bac43
+        .vendor = CPUID_VENDOR_INTEL,
9bac43
+        .family = 6,
9bac43
+        .model = 85,
9bac43
+        .stepping = 4,
9bac43
+        .features[FEAT_1_EDX] =
9bac43
+            CPUID_VME | CPUID_SSE2 | CPUID_SSE | CPUID_FXSR | CPUID_MMX |
9bac43
+            CPUID_CLFLUSH | CPUID_PSE36 | CPUID_PAT | CPUID_CMOV | CPUID_MCA |
9bac43
+            CPUID_PGE | CPUID_MTRR | CPUID_SEP | CPUID_APIC | CPUID_CX8 |
9bac43
+            CPUID_MCE | CPUID_PAE | CPUID_MSR | CPUID_TSC | CPUID_PSE |
9bac43
+            CPUID_DE | CPUID_FP87,
9bac43
+        .features[FEAT_1_ECX] =
9bac43
+            CPUID_EXT_AVX | CPUID_EXT_XSAVE | CPUID_EXT_AES |
9bac43
+            CPUID_EXT_POPCNT | CPUID_EXT_X2APIC | CPUID_EXT_SSE42 |
9bac43
+            CPUID_EXT_SSE41 | CPUID_EXT_CX16 | CPUID_EXT_SSSE3 |
9bac43
+            CPUID_EXT_PCLMULQDQ | CPUID_EXT_SSE3 |
9bac43
+            CPUID_EXT_TSC_DEADLINE_TIMER | CPUID_EXT_FMA | CPUID_EXT_MOVBE |
9bac43
+            CPUID_EXT_PCID | CPUID_EXT_F16C | CPUID_EXT_RDRAND,
9bac43
+        .features[FEAT_8000_0001_EDX] =
9bac43
+            CPUID_EXT2_LM | CPUID_EXT2_PDPE1GB | CPUID_EXT2_RDTSCP |
9bac43
+            CPUID_EXT2_NX | CPUID_EXT2_SYSCALL,
9bac43
+        .features[FEAT_8000_0001_ECX] =
9bac43
+            CPUID_EXT3_ABM | CPUID_EXT3_LAHF_LM | CPUID_EXT3_3DNOWPREFETCH,
9bac43
+        .features[FEAT_7_0_EDX] =
9bac43
+            CPUID_7_0_EDX_SPEC_CTRL,
9bac43
+        .features[FEAT_7_0_EBX] =
9bac43
+            CPUID_7_0_EBX_FSGSBASE | CPUID_7_0_EBX_BMI1 |
9bac43
+            CPUID_7_0_EBX_HLE | CPUID_7_0_EBX_AVX2 | CPUID_7_0_EBX_SMEP |
9bac43
+            CPUID_7_0_EBX_BMI2 | CPUID_7_0_EBX_ERMS | CPUID_7_0_EBX_INVPCID |
9bac43
+            CPUID_7_0_EBX_RTM | CPUID_7_0_EBX_RDSEED | CPUID_7_0_EBX_ADX |
9bac43
+            CPUID_7_0_EBX_SMAP | CPUID_7_0_EBX_MPX | CPUID_7_0_EBX_CLWB |
9bac43
+            CPUID_7_0_EBX_AVX512F | CPUID_7_0_EBX_AVX512DQ |
9bac43
+            CPUID_7_0_EBX_AVX512BW | CPUID_7_0_EBX_AVX512CD |
9bac43
+            CPUID_7_0_EBX_AVX512VL,
9bac43
+        /* Missing: XSAVES (not supported by some Linux versions,
9bac43
+         * including v4.1 to v4.12).
9bac43
+         * KVM doesn't yet expose any XSAVES state save component,
9bac43
+         * and the only one defined in Skylake (processor tracing)
9bac43
+         * probably will block migration anyway.
9bac43
+         */
9bac43
+        .features[FEAT_XSAVE] =
9bac43
+            CPUID_XSAVE_XSAVEOPT | CPUID_XSAVE_XSAVEC |
9bac43
+            CPUID_XSAVE_XGETBV1,
9bac43
+        .features[FEAT_6_EAX] =
9bac43
+            CPUID_6_EAX_ARAT,
9bac43
+        .xlevel = 0x80000008,
9bac43
+        .model_id = "Intel Xeon Processor (Skylake, IBRS)",
9bac43
+    },
9bac43
+    {
9bac43
         .name = "Opteron_G1",
9bac43
         .level = 5,
9bac43
         .vendor = CPUID_VENDOR_AMD,
9bac43
@@ -1607,6 +1984,52 @@ static X86CPUDefinition builtin_x86_defs[] = {
9bac43
         .xlevel = 0x8000000A,
9bac43
         .model_id = "AMD EPYC Processor",
9bac43
     },
9bac43
+    {
9bac43
+        .name = "EPYC-IBPB",
9bac43
+        .level = 0xd,
9bac43
+        .vendor = CPUID_VENDOR_AMD,
9bac43
+        .family = 23,
9bac43
+        .model = 1,
9bac43
+        .stepping = 2,
9bac43
+        .features[FEAT_1_EDX] =
9bac43
+            CPUID_SSE2 | CPUID_SSE | CPUID_FXSR | CPUID_MMX | CPUID_CLFLUSH |
9bac43
+            CPUID_PSE36 | CPUID_PAT | CPUID_CMOV | CPUID_MCA | CPUID_PGE |
9bac43
+            CPUID_MTRR | CPUID_SEP | CPUID_APIC | CPUID_CX8 | CPUID_MCE |
9bac43
+            CPUID_PAE | CPUID_MSR | CPUID_TSC | CPUID_PSE | CPUID_DE |
9bac43
+            CPUID_VME | CPUID_FP87,
9bac43
+        .features[FEAT_1_ECX] =
9bac43
+            CPUID_EXT_RDRAND | CPUID_EXT_F16C | CPUID_EXT_AVX |
9bac43
+            CPUID_EXT_XSAVE | CPUID_EXT_AES |  CPUID_EXT_POPCNT |
9bac43
+            CPUID_EXT_MOVBE | CPUID_EXT_SSE42 | CPUID_EXT_SSE41 |
9bac43
+            CPUID_EXT_CX16 | CPUID_EXT_FMA | CPUID_EXT_SSSE3 |
9bac43
+            CPUID_EXT_MONITOR | CPUID_EXT_PCLMULQDQ | CPUID_EXT_SSE3,
9bac43
+        .features[FEAT_8000_0001_EDX] =
9bac43
+            CPUID_EXT2_LM | CPUID_EXT2_RDTSCP | CPUID_EXT2_PDPE1GB |
9bac43
+            CPUID_EXT2_FFXSR | CPUID_EXT2_MMXEXT | CPUID_EXT2_NX |
9bac43
+            CPUID_EXT2_SYSCALL,
9bac43
+        .features[FEAT_8000_0001_ECX] =
9bac43
+            CPUID_EXT3_OSVW | CPUID_EXT3_3DNOWPREFETCH |
9bac43
+            CPUID_EXT3_MISALIGNSSE | CPUID_EXT3_SSE4A | CPUID_EXT3_ABM |
9bac43
+            CPUID_EXT3_CR8LEG | CPUID_EXT3_SVM | CPUID_EXT3_LAHF_LM,
9bac43
+        .features[FEAT_8000_0008_EBX] =
9bac43
+            CPUID_8000_0008_EBX_IBPB,
9bac43
+        .features[FEAT_7_0_EBX] =
9bac43
+            CPUID_7_0_EBX_FSGSBASE | CPUID_7_0_EBX_BMI1 | CPUID_7_0_EBX_AVX2 |
9bac43
+            CPUID_7_0_EBX_SMEP | CPUID_7_0_EBX_BMI2 | CPUID_7_0_EBX_RDSEED |
9bac43
+            CPUID_7_0_EBX_ADX | CPUID_7_0_EBX_SMAP | CPUID_7_0_EBX_CLFLUSHOPT |
9bac43
+            CPUID_7_0_EBX_SHA_NI,
9bac43
+        /* Missing: XSAVES (not supported by some Linux versions,
9bac43
+         * including v4.1 to v4.12).
9bac43
+         * KVM doesn't yet expose any XSAVES state save component.
9bac43
+         */
9bac43
+        .features[FEAT_XSAVE] =
9bac43
+            CPUID_XSAVE_XSAVEOPT | CPUID_XSAVE_XSAVEC |
9bac43
+            CPUID_XSAVE_XGETBV1,
9bac43
+        .features[FEAT_6_EAX] =
9bac43
+            CPUID_6_EAX_ARAT,
9bac43
+        .xlevel = 0x8000000A,
9bac43
+        .model_id = "AMD EPYC Processor (with IBPB)",
9bac43
+    },
9bac43
 };
9bac43
 
9bac43
 typedef struct PropValue {
9bac43
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
9bac43
index f2686d5..eb77e85 100644
9bac43
--- a/target/i386/cpu.h
9bac43
+++ b/target/i386/cpu.h
9bac43
@@ -643,6 +643,9 @@ typedef uint32_t FeatureWordArray[FEATURE_WORDS];
9bac43
 
9bac43
 #define CPUID_7_0_EDX_AVX512_4VNNIW (1U << 2) /* AVX512 Neural Network Instructions */
9bac43
 #define CPUID_7_0_EDX_AVX512_4FMAPS (1U << 3) /* AVX512 Multiply Accumulation Single Precision */
9bac43
+#define CPUID_7_0_EDX_SPEC_CTRL     (1U << 26) /* Indirect Branch - Restrict Speculation */
9bac43
+
9bac43
+#define CPUID_8000_0008_EBX_IBPB    (1U << 12) /* Indirect Branch Prediction Barrier */
9bac43
 
9bac43
 #define CPUID_XSAVE_XSAVEOPT   (1U << 0)
9bac43
 #define CPUID_XSAVE_XSAVEC     (1U << 1)
9bac43
-- 
9bac43
1.8.3.1
9bac43