459f93
From b37a398da4323407de24d19afac937eac80170cc Mon Sep 17 00:00:00 2001
459f93
Message-Id: <b37a398da4323407de24d19afac937eac80170cc@dist-git>
459f93
From: Jiri Denemark <jdenemar@redhat.com>
459f93
Date: Thu, 21 Apr 2022 18:25:15 +0200
459f93
Subject: [PATCH] cputest: Add some real world baseline tests
459f93
459f93
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
459f93
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
459f93
(cherry picked from commit 63d633b9a4fc42da7e2acaf45501914607d968a5)
459f93
459f93
https://bugzilla.redhat.com/show_bug.cgi?id=1851227
459f93
459f93
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
459f93
---
459f93
 tests/cputest.c                               | 118 +++++++++++++++---
459f93
 ...id-baseline-Broadwell-IBRS+Cascadelake.xml |  11 ++
459f93
 ..._64-cpuid-baseline-Cascadelake+Icelake.xml |  14 +++
459f93
 ...puid-baseline-Cascadelake+Skylake-IBRS.xml |  12 ++
459f93
 ..._64-cpuid-baseline-Cascadelake+Skylake.xml |   8 ++
459f93
 ...-cpuid-baseline-Cooperlake+Cascadelake.xml |  17 +++
459f93
 ...6_64-cpuid-baseline-Cooperlake+Icelake.xml |  14 +++
459f93
 .../x86_64-cpuid-baseline-EPYC+Rome.xml       |  13 ++
459f93
 .../x86_64-cpuid-baseline-Haswell+Skylake.xml |  14 +++
459f93
 ...-baseline-Haswell-noTSX-IBRS+Broadwell.xml |  14 +++
459f93
 ...seline-Haswell-noTSX-IBRS+Skylake-IBRS.xml |  14 +++
459f93
 ...id-baseline-Haswell-noTSX-IBRS+Skylake.xml |  14 +++
459f93
 .../x86_64-cpuid-baseline-Ryzen+Rome.xml      |  13 ++
459f93
 ...4-cpuid-baseline-Skylake-Client+Server.xml |   9 ++
459f93
 14 files changed, 271 insertions(+), 14 deletions(-)
459f93
 create mode 100644 tests/cputestdata/x86_64-cpuid-baseline-Broadwell-IBRS+Cascadelake.xml
459f93
 create mode 100644 tests/cputestdata/x86_64-cpuid-baseline-Cascadelake+Icelake.xml
459f93
 create mode 100644 tests/cputestdata/x86_64-cpuid-baseline-Cascadelake+Skylake-IBRS.xml
459f93
 create mode 100644 tests/cputestdata/x86_64-cpuid-baseline-Cascadelake+Skylake.xml
459f93
 create mode 100644 tests/cputestdata/x86_64-cpuid-baseline-Cooperlake+Cascadelake.xml
459f93
 create mode 100644 tests/cputestdata/x86_64-cpuid-baseline-Cooperlake+Icelake.xml
459f93
 create mode 100644 tests/cputestdata/x86_64-cpuid-baseline-EPYC+Rome.xml
459f93
 create mode 100644 tests/cputestdata/x86_64-cpuid-baseline-Haswell+Skylake.xml
459f93
 create mode 100644 tests/cputestdata/x86_64-cpuid-baseline-Haswell-noTSX-IBRS+Broadwell.xml
459f93
 create mode 100644 tests/cputestdata/x86_64-cpuid-baseline-Haswell-noTSX-IBRS+Skylake-IBRS.xml
459f93
 create mode 100644 tests/cputestdata/x86_64-cpuid-baseline-Haswell-noTSX-IBRS+Skylake.xml
459f93
 create mode 100644 tests/cputestdata/x86_64-cpuid-baseline-Ryzen+Rome.xml
459f93
 create mode 100644 tests/cputestdata/x86_64-cpuid-baseline-Skylake-Client+Server.xml
459f93
459f93
diff --git a/tests/cputest.c b/tests/cputest.c
459f93
index b939e20718..b39ec7e18b 100644
459f93
--- a/tests/cputest.c
459f93
+++ b/tests/cputest.c
459f93
@@ -58,6 +58,8 @@ struct data {
459f93
     const char *name;
459f93
     virDomainCapsCPUModels *models;
459f93
     const char *modelsName;
459f93
+    const char **cpus;
459f93
+    int ncpus;
459f93
     unsigned int flags;
459f93
     int result;
459f93
 };
459f93
@@ -561,6 +563,60 @@ cpuTestCPUID(bool guest, const void *arg)
459f93
 }
459f93
 
459f93
 
459f93
+static int
459f93
+cpuTestCPUIDBaseline(const void *arg)
459f93
+{
459f93
+    const struct data *data = arg;
459f93
+    int ret = -1;
459f93
+    virCPUDef **cpus = NULL;
459f93
+    virCPUDef *baseline = NULL;
459f93
+    g_autofree char *result = NULL;
459f93
+    size_t i;
459f93
+
459f93
+    cpus = g_new0(virCPUDef *, data->ncpus);
459f93
+    for (i = 0; i < data->ncpus; i++) {
459f93
+        g_autofree char *name = NULL;
459f93
+
459f93
+        name = g_strdup_printf("cpuid-%s-json", data->cpus[i]);
459f93
+        if (!(cpus[i] = cpuTestLoadXML(data->arch, name)))
459f93
+            goto cleanup;
459f93
+    }
459f93
+
459f93
+    baseline = virCPUBaseline(data->arch, cpus, data->ncpus, NULL, NULL, false);
459f93
+    if (!baseline)
459f93
+        goto cleanup;
459f93
+
459f93
+    result = g_strdup_printf("cpuid-baseline-%s", data->name);
459f93
+
459f93
+    if (cpuTestCompareXML(data->arch, baseline, result) < 0)
459f93
+        goto cleanup;
459f93
+
459f93
+    for (i = 0; i < data->ncpus; i++) {
459f93
+        virCPUCompareResult cmp;
459f93
+
459f93
+        cmp = virCPUCompare(data->arch, cpus[i], baseline, false);
459f93
+        if (cmp != VIR_CPU_COMPARE_SUPERSET &&
459f93
+            cmp != VIR_CPU_COMPARE_IDENTICAL) {
459f93
+            VIR_TEST_VERBOSE("\nbaseline CPU is incompatible with CPU %zu", i);
459f93
+            VIR_TEST_VERBOSE("%74s", "... ");
459f93
+            ret = -1;
459f93
+            goto cleanup;
459f93
+        }
459f93
+    }
459f93
+
459f93
+    ret = 0;
459f93
+
459f93
+ cleanup:
459f93
+    if (cpus) {
459f93
+        for (i = 0; i < data->ncpus; i++)
459f93
+            virCPUDefFree(cpus[i]);
459f93
+        VIR_FREE(cpus);
459f93
+    }
459f93
+    virCPUDefFree(baseline);
459f93
+    return ret;
459f93
+}
459f93
+
459f93
+
459f93
 static int
459f93
 cpuTestHostCPUID(const void *arg)
459f93
 {
459f93
@@ -888,13 +944,13 @@ mymain(void)
459f93
         goto cleanup;
459f93
     }
459f93
 
459f93
-#define DO_TEST(arch, api, name, host, cpu, \
459f93
+#define DO_TEST(arch, api, name, host, cpu, cpus, ncpus, \
459f93
                 models, flags, result) \
459f93
     do { \
459f93
         struct data data = { \
459f93
             arch, host, cpu, models, \
459f93
             models == NULL ? NULL : #models, \
459f93
-            flags, result \
459f93
+            cpus, ncpus, flags, result \
459f93
         }; \
459f93
         g_autofree char *testLabel = NULL; \
459f93
  \
459f93
@@ -907,12 +963,12 @@ mymain(void)
459f93
 #define DO_TEST_COMPARE(arch, host, cpu, result) \
459f93
     DO_TEST(arch, cpuTestCompare, \
459f93
             host "/" cpu " (" #result ")", \
459f93
-            host, cpu, NULL, 0, result)
459f93
+            host, cpu, NULL, 0, NULL, 0, result)
459f93
 
459f93
 #define DO_TEST_UPDATE_ONLY(arch, host, cpu) \
459f93
     DO_TEST(arch, cpuTestUpdate, \
459f93
             cpu " on " host, \
459f93
-            host, cpu, NULL, 0, 0)
459f93
+            host, cpu, NULL, 0, NULL, 0, 0)
459f93
 
459f93
 #define DO_TEST_UPDATE(arch, host, cpu, result) \
459f93
     do { \
459f93
@@ -930,31 +986,31 @@ mymain(void)
459f93
             suffix = " (migratable)"; \
459f93
         label = g_strdup_printf("%s%s", name, suffix); \
459f93
         DO_TEST(arch, cpuTestBaseline, label, NULL, \
459f93
-                "baseline-" name, NULL, flags, result); \
459f93
+                "baseline-" name, NULL, 0, NULL, flags, result); \
459f93
     } while (0)
459f93
 
459f93
 #define DO_TEST_HASFEATURE(arch, host, feature, result) \
459f93
     DO_TEST(arch, cpuTestHasFeature, \
459f93
             host "/" feature " (" #result ")", \
459f93
-            host, feature, NULL, 0, result)
459f93
+            host, feature, NULL, 0, NULL, 0, result)
459f93
 
459f93
 #define DO_TEST_GUESTCPU(arch, host, cpu, models, result) \
459f93
     DO_TEST(arch, cpuTestGuestCPU, \
459f93
             host "/" cpu " (" #models ")", \
459f93
-            host, cpu, models, 0, result)
459f93
+            host, cpu, NULL, 0, models, 0, result)
459f93
 
459f93
 #if WITH_QEMU
459f93
 # define DO_TEST_JSON(arch, host, json) \
459f93
     do { \
459f93
         if (json == JSON_MODELS) { \
459f93
             DO_TEST(arch, cpuTestGuestCPUID, host, host, \
459f93
-                    NULL, NULL, 0, 0); \
459f93
+                    NULL, NULL, 0, NULL, 0, 0); \
459f93
         } \
459f93
         if (json != JSON_NONE) { \
459f93
             DO_TEST(arch, cpuTestJSONCPUID, host, host, \
459f93
-                    NULL, NULL, json, 0); \
459f93
+                    NULL, NULL, 0, NULL, json, 0); \
459f93
             DO_TEST(arch, cpuTestJSONSignature, host, host, \
459f93
-                    NULL, NULL, 0, 0); \
459f93
+                    NULL, NULL, 0, NULL, 0, 0); \
459f93
         } \
459f93
     } while (0)
459f93
 #else
459f93
@@ -964,18 +1020,26 @@ mymain(void)
459f93
 #define DO_TEST_CPUID(arch, host, json) \
459f93
     do { \
459f93
         DO_TEST(arch, cpuTestHostCPUID, host, host, \
459f93
-                NULL, NULL, 0, 0); \
459f93
+                NULL, NULL, 0, NULL, 0, 0); \
459f93
         DO_TEST(arch, cpuTestGuestCPUID, host, host, \
459f93
-                NULL, NULL, json, 0); \
459f93
+                NULL, NULL, 0, NULL, json, 0); \
459f93
         DO_TEST(arch, cpuTestCPUIDSignature, host, host, \
459f93
-                NULL, NULL, 0, 0); \
459f93
+                NULL, NULL, 0, NULL, 0, 0); \
459f93
         DO_TEST_JSON(arch, host, json); \
459f93
         if (json != JSON_NONE) { \
459f93
             DO_TEST(arch, cpuTestUpdateLive, host, host, \
459f93
-                    NULL, NULL, json, 0); \
459f93
+                    NULL, NULL, 0, NULL, json, 0); \
459f93
         } \
459f93
     } while (0)
459f93
 
459f93
+#define DO_TEST_CPUID_BASELINE(arch, label, cpu1, cpu2) \
459f93
+    do { \
459f93
+        const char *cpus[] = {cpu1, cpu2}; \
459f93
+        DO_TEST(arch, cpuTestCPUIDBaseline, \
459f93
+                label " (" cpu1 ", " cpu2 ")", \
459f93
+                NULL, label, cpus, 2, NULL, 0, 0); \
459f93
+    } while (0)
459f93
+
459f93
     /* host to host comparison */
459f93
     DO_TEST_COMPARE(VIR_ARCH_X86_64, "host", "host", VIR_CPU_COMPARE_IDENTICAL);
459f93
     DO_TEST_COMPARE(VIR_ARCH_X86_64, "host", "host-better", VIR_CPU_COMPARE_INCOMPATIBLE);
459f93
@@ -1157,6 +1221,32 @@ mymain(void)
459f93
     DO_TEST_CPUID(VIR_ARCH_X86_64, "Ice-Lake-Server", JSON_MODELS);
459f93
     DO_TEST_CPUID(VIR_ARCH_X86_64, "Cooperlake", JSON_MODELS);
459f93
 
459f93
+    DO_TEST_CPUID_BASELINE(VIR_ARCH_X86_64, "Ryzen+Rome",
459f93
+                           "Ryzen-7-1800X-Eight-Core", "Ryzen-9-3900X-12-Core");
459f93
+    DO_TEST_CPUID_BASELINE(VIR_ARCH_X86_64, "EPYC+Rome",
459f93
+                           "EPYC-7601-32-Core", "EPYC-7502-32-Core");
459f93
+    DO_TEST_CPUID_BASELINE(VIR_ARCH_X86_64, "Haswell-noTSX-IBRS+Skylake",
459f93
+                           "Xeon-E5-2609-v3", "Xeon-Gold-6148");
459f93
+    DO_TEST_CPUID_BASELINE(VIR_ARCH_X86_64, "Haswell-noTSX-IBRS+Skylake-IBRS",
459f93
+                           "Xeon-E5-2609-v3", "Xeon-Gold-6130");
459f93
+    DO_TEST_CPUID_BASELINE(VIR_ARCH_X86_64, "Broadwell-IBRS+Cascadelake",
459f93
+                           "Xeon-E5-2623-v4", "Xeon-Platinum-8268");
459f93
+    DO_TEST_CPUID_BASELINE(VIR_ARCH_X86_64, "Cascadelake+Skylake-IBRS",
459f93
+                           "Xeon-Platinum-8268", "Xeon-Gold-6130");
459f93
+    DO_TEST_CPUID_BASELINE(VIR_ARCH_X86_64, "Cascadelake+Skylake",
459f93
+                           "Xeon-Platinum-9242", "Xeon-Gold-6148");
459f93
+    DO_TEST_CPUID_BASELINE(VIR_ARCH_X86_64, "Cascadelake+Icelake",
459f93
+                           "Xeon-Platinum-9242", "Ice-Lake-Server");
459f93
+    DO_TEST_CPUID_BASELINE(VIR_ARCH_X86_64, "Cooperlake+Icelake",
459f93
+                           "Cooperlake", "Ice-Lake-Server");
459f93
+    DO_TEST_CPUID_BASELINE(VIR_ARCH_X86_64, "Cooperlake+Cascadelake",
459f93
+                           "Cooperlake", "Xeon-Platinum-9242");
459f93
+    DO_TEST_CPUID_BASELINE(VIR_ARCH_X86_64, "Skylake-Client+Server",
459f93
+                           "Core-i5-6600", "Xeon-Gold-6148");
459f93
+    DO_TEST_CPUID_BASELINE(VIR_ARCH_X86_64, "Haswell-noTSX-IBRS+Broadwell",
459f93
+                           "Xeon-E5-2609-v3", "Xeon-E5-2650-v4");
459f93
+    DO_TEST_CPUID_BASELINE(VIR_ARCH_X86_64, "Haswell+Skylake",
459f93
+                           "Xeon-E7-8890-v3", "Xeon-Gold-5115");
459f93
  cleanup:
459f93
 #if WITH_QEMU
459f93
     qemuTestDriverFree(&driver);
459f93
diff --git a/tests/cputestdata/x86_64-cpuid-baseline-Broadwell-IBRS+Cascadelake.xml b/tests/cputestdata/x86_64-cpuid-baseline-Broadwell-IBRS+Cascadelake.xml
459f93
new file mode 100644
459f93
index 0000000000..4e3f253e9b
459f93
--- /dev/null
459f93
+++ b/tests/cputestdata/x86_64-cpuid-baseline-Broadwell-IBRS+Cascadelake.xml
459f93
@@ -0,0 +1,11 @@
459f93
+<cpu mode='custom' match='exact'>
459f93
+  <model fallback='allow'>Skylake-Client-IBRS</model>
459f93
+  <vendor>Intel</vendor>
459f93
+  <feature policy='require' name='ss'/>
459f93
+  <feature policy='require' name='hypervisor'/>
459f93
+  <feature policy='require' name='tsc_adjust'/>
459f93
+  <feature policy='require' name='pdpe1gb'/>
459f93
+  <feature policy='disable' name='mpx'/>
459f93
+  <feature policy='disable' name='xsavec'/>
459f93
+  <feature policy='disable' name='xgetbv1'/>
459f93
+</cpu>
459f93
diff --git a/tests/cputestdata/x86_64-cpuid-baseline-Cascadelake+Icelake.xml b/tests/cputestdata/x86_64-cpuid-baseline-Cascadelake+Icelake.xml
459f93
new file mode 100644
459f93
index 0000000000..e372a3e446
459f93
--- /dev/null
459f93
+++ b/tests/cputestdata/x86_64-cpuid-baseline-Cascadelake+Icelake.xml
459f93
@@ -0,0 +1,14 @@
459f93
+<cpu mode='custom' match='exact'>
459f93
+  <model fallback='allow'>Cooperlake</model>
459f93
+  <vendor>Intel</vendor>
459f93
+  <feature policy='require' name='ss'/>
459f93
+  <feature policy='require' name='hypervisor'/>
459f93
+  <feature policy='require' name='tsc_adjust'/>
459f93
+  <feature policy='require' name='mpx'/>
459f93
+  <feature policy='require' name='umip'/>
459f93
+  <feature policy='require' name='xsaves'/>
459f93
+  <feature policy='disable' name='avx512-bf16'/>
459f93
+  <feature policy='disable' name='mds-no'/>
459f93
+  <feature policy='disable' name='pschange-mc-no'/>
459f93
+  <feature policy='disable' name='taa-no'/>
459f93
+</cpu>
459f93
diff --git a/tests/cputestdata/x86_64-cpuid-baseline-Cascadelake+Skylake-IBRS.xml b/tests/cputestdata/x86_64-cpuid-baseline-Cascadelake+Skylake-IBRS.xml
459f93
new file mode 100644
459f93
index 0000000000..e559e01583
459f93
--- /dev/null
459f93
+++ b/tests/cputestdata/x86_64-cpuid-baseline-Cascadelake+Skylake-IBRS.xml
459f93
@@ -0,0 +1,12 @@
459f93
+<cpu mode='custom' match='exact'>
459f93
+  <model fallback='allow'>Cascadelake-Server</model>
459f93
+  <vendor>Intel</vendor>
459f93
+  <feature policy='require' name='ss'/>
459f93
+  <feature policy='require' name='hypervisor'/>
459f93
+  <feature policy='require' name='tsc_adjust'/>
459f93
+  <feature policy='require' name='umip'/>
459f93
+  <feature policy='require' name='pku'/>
459f93
+  <feature policy='require' name='xsaves'/>
459f93
+  <feature policy='require' name='skip-l1dfl-vmentry'/>
459f93
+  <feature policy='disable' name='avx512vnni'/>
459f93
+</cpu>
459f93
diff --git a/tests/cputestdata/x86_64-cpuid-baseline-Cascadelake+Skylake.xml b/tests/cputestdata/x86_64-cpuid-baseline-Cascadelake+Skylake.xml
459f93
new file mode 100644
459f93
index 0000000000..906259df0b
459f93
--- /dev/null
459f93
+++ b/tests/cputestdata/x86_64-cpuid-baseline-Cascadelake+Skylake.xml
459f93
@@ -0,0 +1,8 @@
459f93
+<cpu mode='custom' match='exact'>
459f93
+  <model fallback='allow'>Skylake-Server</model>
459f93
+  <vendor>Intel</vendor>
459f93
+  <feature policy='require' name='ss'/>
459f93
+  <feature policy='require' name='hypervisor'/>
459f93
+  <feature policy='require' name='tsc_adjust'/>
459f93
+  <feature policy='require' name='clflushopt'/>
459f93
+</cpu>
459f93
diff --git a/tests/cputestdata/x86_64-cpuid-baseline-Cooperlake+Cascadelake.xml b/tests/cputestdata/x86_64-cpuid-baseline-Cooperlake+Cascadelake.xml
459f93
new file mode 100644
459f93
index 0000000000..46c32c996f
459f93
--- /dev/null
459f93
+++ b/tests/cputestdata/x86_64-cpuid-baseline-Cooperlake+Cascadelake.xml
459f93
@@ -0,0 +1,17 @@
459f93
+<cpu mode='custom' match='exact'>
459f93
+  <model fallback='allow'>Cooperlake</model>
459f93
+  <vendor>Intel</vendor>
459f93
+  <feature policy='require' name='ss'/>
459f93
+  <feature policy='require' name='vmx'/>
459f93
+  <feature policy='require' name='hypervisor'/>
459f93
+  <feature policy='require' name='tsc_adjust'/>
459f93
+  <feature policy='require' name='mpx'/>
459f93
+  <feature policy='require' name='umip'/>
459f93
+  <feature policy='require' name='md-clear'/>
459f93
+  <feature policy='require' name='xsaves'/>
459f93
+  <feature policy='require' name='ibpb'/>
459f93
+  <feature policy='require' name='amd-ssbd'/>
459f93
+  <feature policy='require' name='tsx-ctrl'/>
459f93
+  <feature policy='disable' name='avx512-bf16'/>
459f93
+  <feature policy='disable' name='taa-no'/>
459f93
+</cpu>
459f93
diff --git a/tests/cputestdata/x86_64-cpuid-baseline-Cooperlake+Icelake.xml b/tests/cputestdata/x86_64-cpuid-baseline-Cooperlake+Icelake.xml
459f93
new file mode 100644
459f93
index 0000000000..e372a3e446
459f93
--- /dev/null
459f93
+++ b/tests/cputestdata/x86_64-cpuid-baseline-Cooperlake+Icelake.xml
459f93
@@ -0,0 +1,14 @@
459f93
+<cpu mode='custom' match='exact'>
459f93
+  <model fallback='allow'>Cooperlake</model>
459f93
+  <vendor>Intel</vendor>
459f93
+  <feature policy='require' name='ss'/>
459f93
+  <feature policy='require' name='hypervisor'/>
459f93
+  <feature policy='require' name='tsc_adjust'/>
459f93
+  <feature policy='require' name='mpx'/>
459f93
+  <feature policy='require' name='umip'/>
459f93
+  <feature policy='require' name='xsaves'/>
459f93
+  <feature policy='disable' name='avx512-bf16'/>
459f93
+  <feature policy='disable' name='mds-no'/>
459f93
+  <feature policy='disable' name='pschange-mc-no'/>
459f93
+  <feature policy='disable' name='taa-no'/>
459f93
+</cpu>
459f93
diff --git a/tests/cputestdata/x86_64-cpuid-baseline-EPYC+Rome.xml b/tests/cputestdata/x86_64-cpuid-baseline-EPYC+Rome.xml
459f93
new file mode 100644
459f93
index 0000000000..e1984b2890
459f93
--- /dev/null
459f93
+++ b/tests/cputestdata/x86_64-cpuid-baseline-EPYC+Rome.xml
459f93
@@ -0,0 +1,13 @@
459f93
+<cpu mode='custom' match='exact'>
459f93
+  <model fallback='allow'>EPYC</model>
459f93
+  <vendor>AMD</vendor>
459f93
+  <feature policy='require' name='x2apic'/>
459f93
+  <feature policy='require' name='tsc-deadline'/>
459f93
+  <feature policy='require' name='hypervisor'/>
459f93
+  <feature policy='require' name='tsc_adjust'/>
459f93
+  <feature policy='require' name='cmp_legacy'/>
459f93
+  <feature policy='require' name='npt'/>
459f93
+  <feature policy='require' name='nrip-save'/>
459f93
+  <feature policy='disable' name='svm'/>
459f93
+  <feature policy='disable' name='monitor'/>
459f93
+</cpu>
459f93
diff --git a/tests/cputestdata/x86_64-cpuid-baseline-Haswell+Skylake.xml b/tests/cputestdata/x86_64-cpuid-baseline-Haswell+Skylake.xml
459f93
new file mode 100644
459f93
index 0000000000..e687a679b3
459f93
--- /dev/null
459f93
+++ b/tests/cputestdata/x86_64-cpuid-baseline-Haswell+Skylake.xml
459f93
@@ -0,0 +1,14 @@
459f93
+<cpu mode='custom' match='exact'>
459f93
+  <model fallback='allow'>Haswell</model>
459f93
+  <vendor>Intel</vendor>
459f93
+  <feature policy='require' name='vme'/>
459f93
+  <feature policy='require' name='ss'/>
459f93
+  <feature policy='require' name='f16c'/>
459f93
+  <feature policy='require' name='rdrand'/>
459f93
+  <feature policy='require' name='hypervisor'/>
459f93
+  <feature policy='require' name='arat'/>
459f93
+  <feature policy='require' name='tsc_adjust'/>
459f93
+  <feature policy='require' name='xsaveopt'/>
459f93
+  <feature policy='require' name='pdpe1gb'/>
459f93
+  <feature policy='require' name='abm'/>
459f93
+</cpu>
459f93
diff --git a/tests/cputestdata/x86_64-cpuid-baseline-Haswell-noTSX-IBRS+Broadwell.xml b/tests/cputestdata/x86_64-cpuid-baseline-Haswell-noTSX-IBRS+Broadwell.xml
459f93
new file mode 100644
459f93
index 0000000000..651457b17a
459f93
--- /dev/null
459f93
+++ b/tests/cputestdata/x86_64-cpuid-baseline-Haswell-noTSX-IBRS+Broadwell.xml
459f93
@@ -0,0 +1,14 @@
459f93
+<cpu mode='custom' match='exact'>
459f93
+  <model fallback='allow'>Haswell-noTSX</model>
459f93
+  <vendor>Intel</vendor>
459f93
+  <feature policy='require' name='vme'/>
459f93
+  <feature policy='require' name='ss'/>
459f93
+  <feature policy='require' name='f16c'/>
459f93
+  <feature policy='require' name='rdrand'/>
459f93
+  <feature policy='require' name='hypervisor'/>
459f93
+  <feature policy='require' name='arat'/>
459f93
+  <feature policy='require' name='tsc_adjust'/>
459f93
+  <feature policy='require' name='xsaveopt'/>
459f93
+  <feature policy='require' name='pdpe1gb'/>
459f93
+  <feature policy='require' name='abm'/>
459f93
+</cpu>
459f93
diff --git a/tests/cputestdata/x86_64-cpuid-baseline-Haswell-noTSX-IBRS+Skylake-IBRS.xml b/tests/cputestdata/x86_64-cpuid-baseline-Haswell-noTSX-IBRS+Skylake-IBRS.xml
459f93
new file mode 100644
459f93
index 0000000000..8bda1c02e2
459f93
--- /dev/null
459f93
+++ b/tests/cputestdata/x86_64-cpuid-baseline-Haswell-noTSX-IBRS+Skylake-IBRS.xml
459f93
@@ -0,0 +1,14 @@
459f93
+<cpu mode='custom' match='exact'>
459f93
+  <model fallback='allow'>Haswell-noTSX-IBRS</model>
459f93
+  <vendor>Intel</vendor>
459f93
+  <feature policy='require' name='vme'/>
459f93
+  <feature policy='require' name='ss'/>
459f93
+  <feature policy='require' name='f16c'/>
459f93
+  <feature policy='require' name='rdrand'/>
459f93
+  <feature policy='require' name='hypervisor'/>
459f93
+  <feature policy='require' name='arat'/>
459f93
+  <feature policy='require' name='tsc_adjust'/>
459f93
+  <feature policy='require' name='xsaveopt'/>
459f93
+  <feature policy='require' name='pdpe1gb'/>
459f93
+  <feature policy='require' name='abm'/>
459f93
+</cpu>
459f93
diff --git a/tests/cputestdata/x86_64-cpuid-baseline-Haswell-noTSX-IBRS+Skylake.xml b/tests/cputestdata/x86_64-cpuid-baseline-Haswell-noTSX-IBRS+Skylake.xml
459f93
new file mode 100644
459f93
index 0000000000..651457b17a
459f93
--- /dev/null
459f93
+++ b/tests/cputestdata/x86_64-cpuid-baseline-Haswell-noTSX-IBRS+Skylake.xml
459f93
@@ -0,0 +1,14 @@
459f93
+<cpu mode='custom' match='exact'>
459f93
+  <model fallback='allow'>Haswell-noTSX</model>
459f93
+  <vendor>Intel</vendor>
459f93
+  <feature policy='require' name='vme'/>
459f93
+  <feature policy='require' name='ss'/>
459f93
+  <feature policy='require' name='f16c'/>
459f93
+  <feature policy='require' name='rdrand'/>
459f93
+  <feature policy='require' name='hypervisor'/>
459f93
+  <feature policy='require' name='arat'/>
459f93
+  <feature policy='require' name='tsc_adjust'/>
459f93
+  <feature policy='require' name='xsaveopt'/>
459f93
+  <feature policy='require' name='pdpe1gb'/>
459f93
+  <feature policy='require' name='abm'/>
459f93
+</cpu>
459f93
diff --git a/tests/cputestdata/x86_64-cpuid-baseline-Ryzen+Rome.xml b/tests/cputestdata/x86_64-cpuid-baseline-Ryzen+Rome.xml
459f93
new file mode 100644
459f93
index 0000000000..051402b9d5
459f93
--- /dev/null
459f93
+++ b/tests/cputestdata/x86_64-cpuid-baseline-Ryzen+Rome.xml
459f93
@@ -0,0 +1,13 @@
459f93
+<cpu mode='custom' match='exact'>
459f93
+  <model fallback='allow'>EPYC</model>
459f93
+  <vendor>AMD</vendor>
459f93
+  <feature policy='require' name='x2apic'/>
459f93
+  <feature policy='require' name='tsc-deadline'/>
459f93
+  <feature policy='require' name='hypervisor'/>
459f93
+  <feature policy='require' name='tsc_adjust'/>
459f93
+  <feature policy='require' name='cmp_legacy'/>
459f93
+  <feature policy='require' name='npt'/>
459f93
+  <feature policy='require' name='nrip-save'/>
459f93
+  <feature policy='disable' name='sha-ni'/>
459f93
+  <feature policy='disable' name='monitor'/>
459f93
+</cpu>
459f93
diff --git a/tests/cputestdata/x86_64-cpuid-baseline-Skylake-Client+Server.xml b/tests/cputestdata/x86_64-cpuid-baseline-Skylake-Client+Server.xml
459f93
new file mode 100644
459f93
index 0000000000..d46ff26eeb
459f93
--- /dev/null
459f93
+++ b/tests/cputestdata/x86_64-cpuid-baseline-Skylake-Client+Server.xml
459f93
@@ -0,0 +1,9 @@
459f93
+<cpu mode='custom' match='exact'>
459f93
+  <model fallback='allow'>Skylake-Client</model>
459f93
+  <vendor>Intel</vendor>
459f93
+  <feature policy='require' name='ss'/>
459f93
+  <feature policy='require' name='hypervisor'/>
459f93
+  <feature policy='require' name='tsc_adjust'/>
459f93
+  <feature policy='require' name='clflushopt'/>
459f93
+  <feature policy='require' name='pdpe1gb'/>
459f93
+</cpu>
459f93
-- 
459f93
2.35.1
459f93