[PATCH] conf: cpu: Add <signature family=X model=X stepping=X/>

Cole Robinson posted 1 patch 1 year, 11 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/9cc30aad0b5cbe735d7fc68ce431525068b6c782.1654965986.git.crobinso@redhat.com
There is a newer version of this series
src/conf/cpu_conf.c                           | 36 +++++++++++++++++++
src/conf/cpu_conf.h                           |  3 ++
src/conf/schemas/cputypes.rng                 | 13 +++++++
src/cpu/cpu_x86.c                             |  3 ++
.../x86_64-cpuid-A10-5800K-host.xml           |  1 +
.../x86_64-cpuid-Atom-D510-host.xml           |  1 +
.../x86_64-cpuid-Atom-N450-host.xml           |  1 +
.../x86_64-cpuid-Atom-P5362-host.xml          |  1 +
.../x86_64-cpuid-Cooperlake-host.xml          |  1 +
.../x86_64-cpuid-Core-i5-2500-host.xml        |  1 +
.../x86_64-cpuid-Core-i5-2540M-host.xml       |  1 +
.../x86_64-cpuid-Core-i5-4670T-host.xml       |  1 +
.../x86_64-cpuid-Core-i5-650-host.xml         |  1 +
.../x86_64-cpuid-Core-i5-6600-host.xml        |  1 +
.../x86_64-cpuid-Core-i7-2600-host.xml        |  1 +
...86_64-cpuid-Core-i7-2600-xsaveopt-host.xml |  1 +
.../x86_64-cpuid-Core-i7-3520M-host.xml       |  1 +
.../x86_64-cpuid-Core-i7-3740QM-host.xml      |  1 +
.../x86_64-cpuid-Core-i7-3770-host.xml        |  1 +
.../x86_64-cpuid-Core-i7-4510U-host.xml       |  1 +
.../x86_64-cpuid-Core-i7-4600U-host.xml       |  1 +
.../x86_64-cpuid-Core-i7-5600U-arat-host.xml  |  1 +
.../x86_64-cpuid-Core-i7-5600U-host.xml       |  1 +
.../x86_64-cpuid-Core-i7-5600U-ibrs-host.xml  |  1 +
.../x86_64-cpuid-Core-i7-7600U-host.xml       |  1 +
.../x86_64-cpuid-Core-i7-7700-host.xml        |  1 +
.../x86_64-cpuid-Core-i7-8550U-host.xml       |  1 +
.../x86_64-cpuid-Core-i7-8700-host.xml        |  1 +
.../x86_64-cpuid-Core2-E6850-host.xml         |  1 +
.../x86_64-cpuid-Core2-Q9500-host.xml         |  1 +
.../x86_64-cpuid-EPYC-7601-32-Core-host.xml   |  1 +
...6_64-cpuid-EPYC-7601-32-Core-ibpb-host.xml |  1 +
.../cputestdata/x86_64-cpuid-FX-8150-host.xml |  1 +
.../x86_64-cpuid-Opteron-1352-host.xml        |  1 +
.../x86_64-cpuid-Opteron-2350-host.xml        |  1 +
.../x86_64-cpuid-Opteron-6234-host.xml        |  1 +
.../x86_64-cpuid-Opteron-6282-host.xml        |  1 +
.../x86_64-cpuid-Pentium-P6100-host.xml       |  1 +
.../x86_64-cpuid-Phenom-B95-host.xml          |  1 +
...64-cpuid-Ryzen-7-1800X-Eight-Core-host.xml |  1 +
.../x86_64-cpuid-Xeon-5110-host.xml           |  1 +
.../x86_64-cpuid-Xeon-E3-1225-v5-host.xml     |  1 +
.../x86_64-cpuid-Xeon-E3-1245-v5-host.xml     |  1 +
.../x86_64-cpuid-Xeon-E5-2609-v3-host.xml     |  1 +
.../x86_64-cpuid-Xeon-E5-2623-v4-host.xml     |  1 +
.../x86_64-cpuid-Xeon-E5-2630-v3-host.xml     |  1 +
.../x86_64-cpuid-Xeon-E5-2630-v4-host.xml     |  1 +
.../x86_64-cpuid-Xeon-E5-2650-host.xml        |  1 +
.../x86_64-cpuid-Xeon-E5-2650-v3-host.xml     |  1 +
.../x86_64-cpuid-Xeon-E5-2650-v4-host.xml     |  1 +
.../x86_64-cpuid-Xeon-E7-4820-host.xml        |  1 +
.../x86_64-cpuid-Xeon-E7-4830-host.xml        |  1 +
.../x86_64-cpuid-Xeon-E7-8890-v3-host.xml     |  1 +
.../x86_64-cpuid-Xeon-E7540-host.xml          |  1 +
.../x86_64-cpuid-Xeon-Gold-5115-host.xml      |  1 +
.../x86_64-cpuid-Xeon-Gold-6130-host.xml      |  1 +
.../x86_64-cpuid-Xeon-Gold-6148-host.xml      |  1 +
.../x86_64-cpuid-Xeon-Platinum-8268-host.xml  |  1 +
.../x86_64-cpuid-Xeon-Platinum-9242-host.xml  |  1 +
.../x86_64-cpuid-Xeon-W3520-host.xml          |  1 +
.../x86_64-cpuid-Xeon-X5460-host.xml          |  1 +
61 files changed, 112 insertions(+)
[PATCH] conf: cpu: Add <signature family=X model=X stepping=X/>
Posted by Cole Robinson 1 year, 11 months ago
Internally we already collect x86 host family + model + stepping
numeric values. This exposed them in capabilities CPU output.
Example:

$ sudo virsh capabilities | grep -A1 -B1 signature
      <microcode version='240'/>
      <signature family='6' model='94' stepping='3'/>
      <counter name='tsc' frequency='3408010000' scaling='no'/>

Users need to know these values to calculate an expected.
SEV-ES/SEV-SNP launch measurement.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
---
 src/conf/cpu_conf.c                           | 36 +++++++++++++++++++
 src/conf/cpu_conf.h                           |  3 ++
 src/conf/schemas/cputypes.rng                 | 13 +++++++
 src/cpu/cpu_x86.c                             |  3 ++
 .../x86_64-cpuid-A10-5800K-host.xml           |  1 +
 .../x86_64-cpuid-Atom-D510-host.xml           |  1 +
 .../x86_64-cpuid-Atom-N450-host.xml           |  1 +
 .../x86_64-cpuid-Atom-P5362-host.xml          |  1 +
 .../x86_64-cpuid-Cooperlake-host.xml          |  1 +
 .../x86_64-cpuid-Core-i5-2500-host.xml        |  1 +
 .../x86_64-cpuid-Core-i5-2540M-host.xml       |  1 +
 .../x86_64-cpuid-Core-i5-4670T-host.xml       |  1 +
 .../x86_64-cpuid-Core-i5-650-host.xml         |  1 +
 .../x86_64-cpuid-Core-i5-6600-host.xml        |  1 +
 .../x86_64-cpuid-Core-i7-2600-host.xml        |  1 +
 ...86_64-cpuid-Core-i7-2600-xsaveopt-host.xml |  1 +
 .../x86_64-cpuid-Core-i7-3520M-host.xml       |  1 +
 .../x86_64-cpuid-Core-i7-3740QM-host.xml      |  1 +
 .../x86_64-cpuid-Core-i7-3770-host.xml        |  1 +
 .../x86_64-cpuid-Core-i7-4510U-host.xml       |  1 +
 .../x86_64-cpuid-Core-i7-4600U-host.xml       |  1 +
 .../x86_64-cpuid-Core-i7-5600U-arat-host.xml  |  1 +
 .../x86_64-cpuid-Core-i7-5600U-host.xml       |  1 +
 .../x86_64-cpuid-Core-i7-5600U-ibrs-host.xml  |  1 +
 .../x86_64-cpuid-Core-i7-7600U-host.xml       |  1 +
 .../x86_64-cpuid-Core-i7-7700-host.xml        |  1 +
 .../x86_64-cpuid-Core-i7-8550U-host.xml       |  1 +
 .../x86_64-cpuid-Core-i7-8700-host.xml        |  1 +
 .../x86_64-cpuid-Core2-E6850-host.xml         |  1 +
 .../x86_64-cpuid-Core2-Q9500-host.xml         |  1 +
 .../x86_64-cpuid-EPYC-7601-32-Core-host.xml   |  1 +
 ...6_64-cpuid-EPYC-7601-32-Core-ibpb-host.xml |  1 +
 .../cputestdata/x86_64-cpuid-FX-8150-host.xml |  1 +
 .../x86_64-cpuid-Opteron-1352-host.xml        |  1 +
 .../x86_64-cpuid-Opteron-2350-host.xml        |  1 +
 .../x86_64-cpuid-Opteron-6234-host.xml        |  1 +
 .../x86_64-cpuid-Opteron-6282-host.xml        |  1 +
 .../x86_64-cpuid-Pentium-P6100-host.xml       |  1 +
 .../x86_64-cpuid-Phenom-B95-host.xml          |  1 +
 ...64-cpuid-Ryzen-7-1800X-Eight-Core-host.xml |  1 +
 .../x86_64-cpuid-Xeon-5110-host.xml           |  1 +
 .../x86_64-cpuid-Xeon-E3-1225-v5-host.xml     |  1 +
 .../x86_64-cpuid-Xeon-E3-1245-v5-host.xml     |  1 +
 .../x86_64-cpuid-Xeon-E5-2609-v3-host.xml     |  1 +
 .../x86_64-cpuid-Xeon-E5-2623-v4-host.xml     |  1 +
 .../x86_64-cpuid-Xeon-E5-2630-v3-host.xml     |  1 +
 .../x86_64-cpuid-Xeon-E5-2630-v4-host.xml     |  1 +
 .../x86_64-cpuid-Xeon-E5-2650-host.xml        |  1 +
 .../x86_64-cpuid-Xeon-E5-2650-v3-host.xml     |  1 +
 .../x86_64-cpuid-Xeon-E5-2650-v4-host.xml     |  1 +
 .../x86_64-cpuid-Xeon-E7-4820-host.xml        |  1 +
 .../x86_64-cpuid-Xeon-E7-4830-host.xml        |  1 +
 .../x86_64-cpuid-Xeon-E7-8890-v3-host.xml     |  1 +
 .../x86_64-cpuid-Xeon-E7540-host.xml          |  1 +
 .../x86_64-cpuid-Xeon-Gold-5115-host.xml      |  1 +
 .../x86_64-cpuid-Xeon-Gold-6130-host.xml      |  1 +
 .../x86_64-cpuid-Xeon-Gold-6148-host.xml      |  1 +
 .../x86_64-cpuid-Xeon-Platinum-8268-host.xml  |  1 +
 .../x86_64-cpuid-Xeon-Platinum-9242-host.xml  |  1 +
 .../x86_64-cpuid-Xeon-W3520-host.xml          |  1 +
 .../x86_64-cpuid-Xeon-X5460-host.xml          |  1 +
 61 files changed, 112 insertions(+)

diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
index 2d447da7c3..1a09e27dca 100644
--- a/src/conf/cpu_conf.c
+++ b/src/conf/cpu_conf.c
@@ -159,6 +159,9 @@ virCPUDefCopyModelFilter(virCPUDef *dst,
     dst->vendor = g_strdup(src->vendor);
     dst->vendor_id = g_strdup(src->vendor_id);
     dst->microcodeVersion = src->microcodeVersion;
+    dst->sigFamily = src->sigFamily;
+    dst->sigModel = src->sigModel;
+    dst->sigStepping = src->sigStepping;
     dst->nfeatures_max = src->nfeatures;
     dst->nfeatures = 0;
 
@@ -210,6 +213,9 @@ virCPUDefStealModel(virCPUDef *dst,
     dst->model = g_steal_pointer(&src->model);
     dst->features = g_steal_pointer(&src->features);
     dst->microcodeVersion = src->microcodeVersion;
+    dst->sigFamily = src->sigFamily;
+    dst->sigModel = src->sigModel;
+    dst->sigStepping = src->sigStepping;
     dst->nfeatures_max = src->nfeatures_max;
     src->nfeatures_max = 0;
     dst->nfeatures = src->nfeatures;
@@ -421,6 +427,7 @@ virCPUDefParseXML(xmlXPathContextPtr ctxt,
     if (def->type == VIR_CPU_TYPE_HOST) {
         g_autofree char *arch = virXPathString("string(./arch[1])", ctxt);
         xmlNodePtr counter_node = NULL;
+        xmlNodePtr signature_node = NULL;
 
         if (!arch) {
             virReportError(VIR_ERR_XML_ERROR, "%s",
@@ -441,6 +448,26 @@ virCPUDefParseXML(xmlXPathContextPtr ctxt,
             return -1;
         }
 
+        if ((signature_node = virXPathNode("./signature[1]", ctxt))) {
+            if (virXMLPropUInt(signature_node, "family", 10,
+                               VIR_XML_PROP_REQUIRED | VIR_XML_PROP_NONZERO,
+                               &def->sigFamily) < 0) {
+                return -1;
+            }
+
+            if (virXMLPropUInt(signature_node, "model", 10,
+                               VIR_XML_PROP_REQUIRED | VIR_XML_PROP_NONZERO,
+                               &def->sigModel) < 0) {
+                return -1;
+            }
+
+            if (virXMLPropUInt(signature_node, "stepping", 10,
+                               VIR_XML_PROP_REQUIRED | VIR_XML_PROP_NONZERO,
+                               &def->sigStepping) < 0) {
+                return -1;
+            }
+        }
+
         if ((counter_node = virXPathNode("./counter[@name='tsc']", ctxt))) {
             tsc = g_new0(virHostCPUTscInfo, 1);
 
@@ -753,6 +780,15 @@ virCPUDefFormatBuf(virBuffer *buf,
         virBufferAsprintf(buf, "<microcode version='%u'/>\n",
                           def->microcodeVersion);
 
+    if (def->type == VIR_CPU_TYPE_HOST &&
+        def->sigFamily && def->sigModel && def->sigStepping) {
+        virBufferAddLit(buf, "<signature");
+        virBufferAsprintf(buf, " family='%u'", def->sigFamily);
+        virBufferAsprintf(buf, " model='%u'", def->sigModel);
+        virBufferAsprintf(buf, " stepping='%u'", def->sigStepping);
+        virBufferAddLit(buf, "/>\n");
+    }
+
     if (def->type == VIR_CPU_TYPE_HOST && def->tsc) {
         virBufferAddLit(buf, "<counter name='tsc'");
         virBufferAsprintf(buf, " frequency='%llu'", def->tsc->frequency);
diff --git a/src/conf/cpu_conf.h b/src/conf/cpu_conf.h
index 2cda4ee1f4..17867d6a30 100644
--- a/src/conf/cpu_conf.h
+++ b/src/conf/cpu_conf.h
@@ -134,6 +134,9 @@ struct _virCPUDef {
     unsigned int dies;
     unsigned int cores;
     unsigned int threads;
+    unsigned int sigFamily;
+    unsigned int sigModel;
+    unsigned int sigStepping;
     size_t nfeatures;
     size_t nfeatures_max;
     virCPUFeatureDef *features;
diff --git a/src/conf/schemas/cputypes.rng b/src/conf/schemas/cputypes.rng
index 056e66e1b4..7c84216240 100644
--- a/src/conf/schemas/cputypes.rng
+++ b/src/conf/schemas/cputypes.rng
@@ -342,6 +342,19 @@
             </attribute>
           </element>
         </optional>
+        <optional>
+          <element name="signature">
+            <attribute name="family">
+              <ref name="positiveInteger"/>
+            </attribute>
+            <attribute name="model">
+              <ref name="positiveInteger"/>
+            </attribute>
+            <attribute name="stepping">
+              <ref name="positiveInteger"/>
+            </attribute>
+          </element>
+        </optional>
         <optional>
           <element name="counter">
             <attribute name="name">
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index a4aca6055d..c4462f34a7 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -2265,6 +2265,9 @@ x86Decode(virCPUDef *cpu,
     cpuModel->nfeatures = 0;
     cpu->nfeatures_max = cpuModel->nfeatures_max;
     cpuModel->nfeatures_max = 0;
+    cpu->sigFamily = sigFamily;
+    cpu->sigModel = sigModel;
+    cpu->sigStepping = sigStepping;
 
     return 0;
 }
diff --git a/tests/cputestdata/x86_64-cpuid-A10-5800K-host.xml b/tests/cputestdata/x86_64-cpuid-A10-5800K-host.xml
index 2430adbfbc..220dfb6467 100644
--- a/tests/cputestdata/x86_64-cpuid-A10-5800K-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-A10-5800K-host.xml
@@ -2,6 +2,7 @@
   <arch>x86_64</arch>
   <model>Opteron_G5</model>
   <vendor>AMD</vendor>
+  <signature family='21' model='16' stepping='1'/>
   <feature name='vme'/>
   <feature name='ht'/>
   <feature name='monitor'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Atom-D510-host.xml b/tests/cputestdata/x86_64-cpuid-Atom-D510-host.xml
index 8cf4341099..3c8a005122 100644
--- a/tests/cputestdata/x86_64-cpuid-Atom-D510-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Atom-D510-host.xml
@@ -2,6 +2,7 @@
   <arch>x86_64</arch>
   <model>n270</model>
   <vendor>Intel</vendor>
+  <signature family='6' model='28' stepping='10'/>
   <feature name='pse36'/>
   <feature name='ds'/>
   <feature name='acpi'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Atom-N450-host.xml b/tests/cputestdata/x86_64-cpuid-Atom-N450-host.xml
index c79713dcaa..1f4eb7b727 100644
--- a/tests/cputestdata/x86_64-cpuid-Atom-N450-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Atom-N450-host.xml
@@ -2,6 +2,7 @@
   <arch>x86_64</arch>
   <model>n270</model>
   <vendor>Intel</vendor>
+  <signature family='6' model='28' stepping='10'/>
   <feature name='ds'/>
   <feature name='acpi'/>
   <feature name='ss'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Atom-P5362-host.xml b/tests/cputestdata/x86_64-cpuid-Atom-P5362-host.xml
index b3e9d5c1ff..c59ebfa799 100644
--- a/tests/cputestdata/x86_64-cpuid-Atom-P5362-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Atom-P5362-host.xml
@@ -2,6 +2,7 @@
   <arch>x86_64</arch>
   <model>Westmere-IBRS</model>
   <vendor>Intel</vendor>
+  <signature family='6' model='134' stepping='5'/>
   <feature name='vme'/>
   <feature name='ds'/>
   <feature name='acpi'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Cooperlake-host.xml b/tests/cputestdata/x86_64-cpuid-Cooperlake-host.xml
index b0777181bb..6ac4ad55ef 100644
--- a/tests/cputestdata/x86_64-cpuid-Cooperlake-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Cooperlake-host.xml
@@ -2,6 +2,7 @@
   <arch>x86_64</arch>
   <model>Cooperlake</model>
   <vendor>Intel</vendor>
+  <signature family='6' model='85' stepping='11'/>
   <feature name='ds'/>
   <feature name='acpi'/>
   <feature name='ss'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i5-2500-host.xml b/tests/cputestdata/x86_64-cpuid-Core-i5-2500-host.xml
index a604acb911..cf8b175db1 100644
--- a/tests/cputestdata/x86_64-cpuid-Core-i5-2500-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Core-i5-2500-host.xml
@@ -2,6 +2,7 @@
   <arch>x86_64</arch>
   <model>SandyBridge</model>
   <vendor>Intel</vendor>
+  <signature family='6' model='42' stepping='7'/>
   <feature name='vme'/>
   <feature name='ds'/>
   <feature name='acpi'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i5-2540M-host.xml b/tests/cputestdata/x86_64-cpuid-Core-i5-2540M-host.xml
index a604acb911..cf8b175db1 100644
--- a/tests/cputestdata/x86_64-cpuid-Core-i5-2540M-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Core-i5-2540M-host.xml
@@ -2,6 +2,7 @@
   <arch>x86_64</arch>
   <model>SandyBridge</model>
   <vendor>Intel</vendor>
+  <signature family='6' model='42' stepping='7'/>
   <feature name='vme'/>
   <feature name='ds'/>
   <feature name='acpi'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i5-4670T-host.xml b/tests/cputestdata/x86_64-cpuid-Core-i5-4670T-host.xml
index d1d0bc7168..827b16cb69 100644
--- a/tests/cputestdata/x86_64-cpuid-Core-i5-4670T-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Core-i5-4670T-host.xml
@@ -2,6 +2,7 @@
   <arch>x86_64</arch>
   <model>Haswell-noTSX</model>
   <vendor>Intel</vendor>
+  <signature family='6' model='60' stepping='3'/>
   <feature name='vme'/>
   <feature name='ds'/>
   <feature name='acpi'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i5-650-host.xml b/tests/cputestdata/x86_64-cpuid-Core-i5-650-host.xml
index e7256d52d0..4234c4df5a 100644
--- a/tests/cputestdata/x86_64-cpuid-Core-i5-650-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Core-i5-650-host.xml
@@ -2,6 +2,7 @@
   <arch>x86_64</arch>
   <model>Westmere</model>
   <vendor>Intel</vendor>
+  <signature family='6' model='37' stepping='2'/>
   <feature name='vme'/>
   <feature name='ds'/>
   <feature name='acpi'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i5-6600-host.xml b/tests/cputestdata/x86_64-cpuid-Core-i5-6600-host.xml
index faaa07f19b..c52e8db235 100644
--- a/tests/cputestdata/x86_64-cpuid-Core-i5-6600-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Core-i5-6600-host.xml
@@ -2,6 +2,7 @@
   <arch>x86_64</arch>
   <model>Skylake-Client</model>
   <vendor>Intel</vendor>
+  <signature family='6' model='94' stepping='3'/>
   <feature name='ds'/>
   <feature name='acpi'/>
   <feature name='ss'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-2600-host.xml b/tests/cputestdata/x86_64-cpuid-Core-i7-2600-host.xml
index a604acb911..cf8b175db1 100644
--- a/tests/cputestdata/x86_64-cpuid-Core-i7-2600-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-2600-host.xml
@@ -2,6 +2,7 @@
   <arch>x86_64</arch>
   <model>SandyBridge</model>
   <vendor>Intel</vendor>
+  <signature family='6' model='42' stepping='7'/>
   <feature name='vme'/>
   <feature name='ds'/>
   <feature name='acpi'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-2600-xsaveopt-host.xml b/tests/cputestdata/x86_64-cpuid-Core-i7-2600-xsaveopt-host.xml
index e139004923..adcc4b86c5 100644
--- a/tests/cputestdata/x86_64-cpuid-Core-i7-2600-xsaveopt-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-2600-xsaveopt-host.xml
@@ -2,6 +2,7 @@
   <arch>x86_64</arch>
   <model>SandyBridge</model>
   <vendor>Intel</vendor>
+  <signature family='6' model='42' stepping='7'/>
   <feature name='vme'/>
   <feature name='ds'/>
   <feature name='acpi'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-3520M-host.xml b/tests/cputestdata/x86_64-cpuid-Core-i7-3520M-host.xml
index a23c651a08..94352ee8bf 100644
--- a/tests/cputestdata/x86_64-cpuid-Core-i7-3520M-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-3520M-host.xml
@@ -2,6 +2,7 @@
   <arch>x86_64</arch>
   <model>IvyBridge</model>
   <vendor>Intel</vendor>
+  <signature family='6' model='58' stepping='9'/>
   <feature name='ds'/>
   <feature name='acpi'/>
   <feature name='ss'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-3740QM-host.xml b/tests/cputestdata/x86_64-cpuid-Core-i7-3740QM-host.xml
index 9fec131ac9..e2503cd35c 100644
--- a/tests/cputestdata/x86_64-cpuid-Core-i7-3740QM-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-3740QM-host.xml
@@ -2,6 +2,7 @@
   <arch>x86_64</arch>
   <model>IvyBridge</model>
   <vendor>Intel</vendor>
+  <signature family='6' model='58' stepping='9'/>
   <feature name='ds'/>
   <feature name='acpi'/>
   <feature name='ss'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-3770-host.xml b/tests/cputestdata/x86_64-cpuid-Core-i7-3770-host.xml
index a23c651a08..94352ee8bf 100644
--- a/tests/cputestdata/x86_64-cpuid-Core-i7-3770-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-3770-host.xml
@@ -2,6 +2,7 @@
   <arch>x86_64</arch>
   <model>IvyBridge</model>
   <vendor>Intel</vendor>
+  <signature family='6' model='58' stepping='9'/>
   <feature name='ds'/>
   <feature name='acpi'/>
   <feature name='ss'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-4510U-host.xml b/tests/cputestdata/x86_64-cpuid-Core-i7-4510U-host.xml
index 61bcefbfcb..a6307e834e 100644
--- a/tests/cputestdata/x86_64-cpuid-Core-i7-4510U-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-4510U-host.xml
@@ -2,6 +2,7 @@
   <arch>x86_64</arch>
   <model>Westmere</model>
   <vendor>Intel</vendor>
+  <signature family='6' model='69' stepping='1'/>
   <feature name='vme'/>
   <feature name='ds'/>
   <feature name='acpi'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-4600U-host.xml b/tests/cputestdata/x86_64-cpuid-Core-i7-4600U-host.xml
index fae8e8d0a8..8bbac47a2e 100644
--- a/tests/cputestdata/x86_64-cpuid-Core-i7-4600U-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-4600U-host.xml
@@ -2,6 +2,7 @@
   <arch>x86_64</arch>
   <model>Haswell-noTSX</model>
   <vendor>Intel</vendor>
+  <signature family='6' model='69' stepping='1'/>
   <feature name='vme'/>
   <feature name='ds'/>
   <feature name='acpi'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-host.xml b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-host.xml
index ea622c87c7..b39148f37f 100644
--- a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-host.xml
@@ -2,6 +2,7 @@
   <arch>x86_64</arch>
   <model>Broadwell</model>
   <vendor>Intel</vendor>
+  <signature family='6' model='61' stepping='4'/>
   <feature name='vme'/>
   <feature name='ds'/>
   <feature name='acpi'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-host.xml b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-host.xml
index ea622c87c7..b39148f37f 100644
--- a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-host.xml
@@ -2,6 +2,7 @@
   <arch>x86_64</arch>
   <model>Broadwell</model>
   <vendor>Intel</vendor>
+  <signature family='6' model='61' stepping='4'/>
   <feature name='vme'/>
   <feature name='ds'/>
   <feature name='acpi'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-ibrs-host.xml b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-ibrs-host.xml
index a534d2dec5..2ab8890464 100644
--- a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-ibrs-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-ibrs-host.xml
@@ -2,6 +2,7 @@
   <arch>x86_64</arch>
   <model>Broadwell-IBRS</model>
   <vendor>Intel</vendor>
+  <signature family='6' model='61' stepping='4'/>
   <feature name='vme'/>
   <feature name='ds'/>
   <feature name='acpi'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-7600U-host.xml b/tests/cputestdata/x86_64-cpuid-Core-i7-7600U-host.xml
index bbdfb6aa61..edfb8ec421 100644
--- a/tests/cputestdata/x86_64-cpuid-Core-i7-7600U-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-7600U-host.xml
@@ -2,6 +2,7 @@
   <arch>x86_64</arch>
   <model>Skylake-Client-IBRS</model>
   <vendor>Intel</vendor>
+  <signature family='6' model='142' stepping='9'/>
   <feature name='ds'/>
   <feature name='acpi'/>
   <feature name='ss'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-7700-host.xml b/tests/cputestdata/x86_64-cpuid-Core-i7-7700-host.xml
index faaa07f19b..08255621ec 100644
--- a/tests/cputestdata/x86_64-cpuid-Core-i7-7700-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-7700-host.xml
@@ -2,6 +2,7 @@
   <arch>x86_64</arch>
   <model>Skylake-Client</model>
   <vendor>Intel</vendor>
+  <signature family='6' model='158' stepping='9'/>
   <feature name='ds'/>
   <feature name='acpi'/>
   <feature name='ss'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-8550U-host.xml b/tests/cputestdata/x86_64-cpuid-Core-i7-8550U-host.xml
index 7681c94649..1e3f1d1719 100644
--- a/tests/cputestdata/x86_64-cpuid-Core-i7-8550U-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-8550U-host.xml
@@ -2,6 +2,7 @@
   <arch>x86_64</arch>
   <model>Skylake-Client-noTSX-IBRS</model>
   <vendor>Intel</vendor>
+  <signature family='6' model='142' stepping='10'/>
   <feature name='ds'/>
   <feature name='acpi'/>
   <feature name='ss'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-8700-host.xml b/tests/cputestdata/x86_64-cpuid-Core-i7-8700-host.xml
index bbdfb6aa61..4174d79ce7 100644
--- a/tests/cputestdata/x86_64-cpuid-Core-i7-8700-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-8700-host.xml
@@ -2,6 +2,7 @@
   <arch>x86_64</arch>
   <model>Skylake-Client-IBRS</model>
   <vendor>Intel</vendor>
+  <signature family='6' model='158' stepping='10'/>
   <feature name='ds'/>
   <feature name='acpi'/>
   <feature name='ss'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Core2-E6850-host.xml b/tests/cputestdata/x86_64-cpuid-Core2-E6850-host.xml
index e7ddc39ceb..e0ec4cd795 100644
--- a/tests/cputestdata/x86_64-cpuid-Core2-E6850-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Core2-E6850-host.xml
@@ -2,6 +2,7 @@
   <arch>x86_64</arch>
   <model>Conroe</model>
   <vendor>Intel</vendor>
+  <signature family='6' model='15' stepping='11'/>
   <feature name='vme'/>
   <feature name='ds'/>
   <feature name='acpi'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Core2-Q9500-host.xml b/tests/cputestdata/x86_64-cpuid-Core2-Q9500-host.xml
index 4dc25588d5..586b8e0f59 100644
--- a/tests/cputestdata/x86_64-cpuid-Core2-Q9500-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Core2-Q9500-host.xml
@@ -2,6 +2,7 @@
   <arch>x86_64</arch>
   <model>Penryn</model>
   <vendor>Intel</vendor>
+  <signature family='6' model='23' stepping='10'/>
   <feature name='vme'/>
   <feature name='ds'/>
   <feature name='acpi'/>
diff --git a/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-host.xml b/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-host.xml
index 8c2c975fdd..da05dd4709 100644
--- a/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-host.xml
@@ -2,6 +2,7 @@
   <arch>x86_64</arch>
   <model>EPYC</model>
   <vendor>AMD</vendor>
+  <signature family='23' model='1' stepping='2'/>
   <feature name='ht'/>
   <feature name='monitor'/>
   <feature name='osxsave'/>
diff --git a/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-ibpb-host.xml b/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-ibpb-host.xml
index c3bbf78396..e91c14c715 100644
--- a/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-ibpb-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-ibpb-host.xml
@@ -2,6 +2,7 @@
   <arch>x86_64</arch>
   <model>EPYC-IBPB</model>
   <vendor>AMD</vendor>
+  <signature family='23' model='1' stepping='2'/>
   <feature name='ht'/>
   <feature name='monitor'/>
   <feature name='osxsave'/>
diff --git a/tests/cputestdata/x86_64-cpuid-FX-8150-host.xml b/tests/cputestdata/x86_64-cpuid-FX-8150-host.xml
index 75595c02af..4fb2d3978b 100644
--- a/tests/cputestdata/x86_64-cpuid-FX-8150-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-FX-8150-host.xml
@@ -2,6 +2,7 @@
   <arch>x86_64</arch>
   <model>Opteron_G4</model>
   <vendor>AMD</vendor>
+  <signature family='21' model='1' stepping='2'/>
   <feature name='vme'/>
   <feature name='ht'/>
   <feature name='monitor'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Opteron-1352-host.xml b/tests/cputestdata/x86_64-cpuid-Opteron-1352-host.xml
index ecd532167a..7b0b3dfe6a 100644
--- a/tests/cputestdata/x86_64-cpuid-Opteron-1352-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Opteron-1352-host.xml
@@ -2,6 +2,7 @@
   <arch>x86_64</arch>
   <model>Opteron_G3</model>
   <vendor>AMD</vendor>
+  <signature family='16' model='2' stepping='3'/>
   <feature name='vme'/>
   <feature name='ht'/>
   <feature name='monitor'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Opteron-2350-host.xml b/tests/cputestdata/x86_64-cpuid-Opteron-2350-host.xml
index ecd532167a..7b0b3dfe6a 100644
--- a/tests/cputestdata/x86_64-cpuid-Opteron-2350-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Opteron-2350-host.xml
@@ -2,6 +2,7 @@
   <arch>x86_64</arch>
   <model>Opteron_G3</model>
   <vendor>AMD</vendor>
+  <signature family='16' model='2' stepping='3'/>
   <feature name='vme'/>
   <feature name='ht'/>
   <feature name='monitor'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Opteron-6234-host.xml b/tests/cputestdata/x86_64-cpuid-Opteron-6234-host.xml
index 75595c02af..4fb2d3978b 100644
--- a/tests/cputestdata/x86_64-cpuid-Opteron-6234-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Opteron-6234-host.xml
@@ -2,6 +2,7 @@
   <arch>x86_64</arch>
   <model>Opteron_G4</model>
   <vendor>AMD</vendor>
+  <signature family='21' model='1' stepping='2'/>
   <feature name='vme'/>
   <feature name='ht'/>
   <feature name='monitor'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Opteron-6282-host.xml b/tests/cputestdata/x86_64-cpuid-Opteron-6282-host.xml
index 75595c02af..4fb2d3978b 100644
--- a/tests/cputestdata/x86_64-cpuid-Opteron-6282-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Opteron-6282-host.xml
@@ -2,6 +2,7 @@
   <arch>x86_64</arch>
   <model>Opteron_G4</model>
   <vendor>AMD</vendor>
+  <signature family='21' model='1' stepping='2'/>
   <feature name='vme'/>
   <feature name='ht'/>
   <feature name='monitor'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Pentium-P6100-host.xml b/tests/cputestdata/x86_64-cpuid-Pentium-P6100-host.xml
index 3975aa7e1f..a70f8ccd46 100644
--- a/tests/cputestdata/x86_64-cpuid-Pentium-P6100-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Pentium-P6100-host.xml
@@ -2,6 +2,7 @@
   <arch>x86_64</arch>
   <model>core2duo</model>
   <vendor>Intel</vendor>
+  <signature family='6' model='37' stepping='5'/>
   <feature name='ds'/>
   <feature name='acpi'/>
   <feature name='ss'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Phenom-B95-host.xml b/tests/cputestdata/x86_64-cpuid-Phenom-B95-host.xml
index 95875918c9..dba7b2b161 100644
--- a/tests/cputestdata/x86_64-cpuid-Phenom-B95-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Phenom-B95-host.xml
@@ -2,6 +2,7 @@
   <arch>x86_64</arch>
   <model>athlon</model>
   <vendor>AMD</vendor>
+  <signature family='16' model='4' stepping='2'/>
   <feature name='mca'/>
   <feature name='clflush'/>
   <feature name='ht'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Ryzen-7-1800X-Eight-Core-host.xml b/tests/cputestdata/x86_64-cpuid-Ryzen-7-1800X-Eight-Core-host.xml
index 8c2c975fdd..15ec20bd63 100644
--- a/tests/cputestdata/x86_64-cpuid-Ryzen-7-1800X-Eight-Core-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Ryzen-7-1800X-Eight-Core-host.xml
@@ -2,6 +2,7 @@
   <arch>x86_64</arch>
   <model>EPYC</model>
   <vendor>AMD</vendor>
+  <signature family='23' model='1' stepping='1'/>
   <feature name='ht'/>
   <feature name='monitor'/>
   <feature name='osxsave'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-5110-host.xml b/tests/cputestdata/x86_64-cpuid-Xeon-5110-host.xml
index ca3a84cc5c..beb465df86 100644
--- a/tests/cputestdata/x86_64-cpuid-Xeon-5110-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-5110-host.xml
@@ -2,6 +2,7 @@
   <arch>x86_64</arch>
   <model>Conroe</model>
   <vendor>Intel</vendor>
+  <signature family='6' model='15' stepping='6'/>
   <feature name='vme'/>
   <feature name='ds'/>
   <feature name='acpi'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-host.xml b/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-host.xml
index e7ced42797..d4a2a15e60 100644
--- a/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-host.xml
@@ -2,6 +2,7 @@
   <arch>x86_64</arch>
   <model>Skylake-Client-IBRS</model>
   <vendor>Intel</vendor>
+  <signature family='6' model='94' stepping='3'/>
   <feature name='ds'/>
   <feature name='acpi'/>
   <feature name='ss'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E3-1245-v5-host.xml b/tests/cputestdata/x86_64-cpuid-Xeon-E3-1245-v5-host.xml
index faaa07f19b..c52e8db235 100644
--- a/tests/cputestdata/x86_64-cpuid-Xeon-E3-1245-v5-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E3-1245-v5-host.xml
@@ -2,6 +2,7 @@
   <arch>x86_64</arch>
   <model>Skylake-Client</model>
   <vendor>Intel</vendor>
+  <signature family='6' model='94' stepping='3'/>
   <feature name='ds'/>
   <feature name='acpi'/>
   <feature name='ss'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2609-v3-host.xml b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2609-v3-host.xml
index 9bac4b4648..bc39536de9 100644
--- a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2609-v3-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2609-v3-host.xml
@@ -2,6 +2,7 @@
   <arch>x86_64</arch>
   <model>Haswell-noTSX-IBRS</model>
   <vendor>Intel</vendor>
+  <signature family='6' model='63' stepping='2'/>
   <feature name='vme'/>
   <feature name='ds'/>
   <feature name='acpi'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4-host.xml b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4-host.xml
index 43a0b93ab4..70419d7944 100644
--- a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4-host.xml
@@ -2,6 +2,7 @@
   <arch>x86_64</arch>
   <model>Broadwell-IBRS</model>
   <vendor>Intel</vendor>
+  <signature family='6' model='79' stepping='1'/>
   <feature name='vme'/>
   <feature name='ds'/>
   <feature name='acpi'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2630-v3-host.xml b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2630-v3-host.xml
index 431a737a44..6d959eedc3 100644
--- a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2630-v3-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2630-v3-host.xml
@@ -2,6 +2,7 @@
   <arch>x86_64</arch>
   <model>Haswell-noTSX</model>
   <vendor>Intel</vendor>
+  <signature family='6' model='63' stepping='2'/>
   <feature name='vme'/>
   <feature name='ds'/>
   <feature name='acpi'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2630-v4-host.xml b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2630-v4-host.xml
index 5dd8d749de..e2ace9021b 100644
--- a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2630-v4-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2630-v4-host.xml
@@ -2,6 +2,7 @@
   <arch>x86_64</arch>
   <model>Broadwell</model>
   <vendor>Intel</vendor>
+  <signature family='6' model='79' stepping='1'/>
   <feature name='vme'/>
   <feature name='ds'/>
   <feature name='acpi'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2650-host.xml b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2650-host.xml
index 80ca6c343f..628900fd2c 100644
--- a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2650-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2650-host.xml
@@ -2,6 +2,7 @@
   <arch>x86_64</arch>
   <model>SandyBridge-IBRS</model>
   <vendor>Intel</vendor>
+  <signature family='6' model='45' stepping='7'/>
   <feature name='vme'/>
   <feature name='ds'/>
   <feature name='acpi'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2650-v3-host.xml b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2650-v3-host.xml
index 431a737a44..6d959eedc3 100644
--- a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2650-v3-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2650-v3-host.xml
@@ -2,6 +2,7 @@
   <arch>x86_64</arch>
   <model>Haswell-noTSX</model>
   <vendor>Intel</vendor>
+  <signature family='6' model='63' stepping='2'/>
   <feature name='vme'/>
   <feature name='ds'/>
   <feature name='acpi'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2650-v4-host.xml b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2650-v4-host.xml
index 5dd8d749de..e2ace9021b 100644
--- a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2650-v4-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2650-v4-host.xml
@@ -2,6 +2,7 @@
   <arch>x86_64</arch>
   <model>Broadwell</model>
   <vendor>Intel</vendor>
+  <signature family='6' model='79' stepping='1'/>
   <feature name='vme'/>
   <feature name='ds'/>
   <feature name='acpi'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E7-4820-host.xml b/tests/cputestdata/x86_64-cpuid-Xeon-E7-4820-host.xml
index 52902479b9..58468cd096 100644
--- a/tests/cputestdata/x86_64-cpuid-Xeon-E7-4820-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E7-4820-host.xml
@@ -2,6 +2,7 @@
   <arch>x86_64</arch>
   <model>Westmere</model>
   <vendor>Intel</vendor>
+  <signature family='6' model='47' stepping='2'/>
   <feature name='vme'/>
   <feature name='ds'/>
   <feature name='acpi'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E7-4830-host.xml b/tests/cputestdata/x86_64-cpuid-Xeon-E7-4830-host.xml
index 52902479b9..58468cd096 100644
--- a/tests/cputestdata/x86_64-cpuid-Xeon-E7-4830-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E7-4830-host.xml
@@ -2,6 +2,7 @@
   <arch>x86_64</arch>
   <model>Westmere</model>
   <vendor>Intel</vendor>
+  <signature family='6' model='47' stepping='2'/>
   <feature name='vme'/>
   <feature name='ds'/>
   <feature name='acpi'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E7-8890-v3-host.xml b/tests/cputestdata/x86_64-cpuid-Xeon-E7-8890-v3-host.xml
index e90598ec63..6a18204c02 100644
--- a/tests/cputestdata/x86_64-cpuid-Xeon-E7-8890-v3-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E7-8890-v3-host.xml
@@ -2,6 +2,7 @@
   <arch>x86_64</arch>
   <model>Haswell</model>
   <vendor>Intel</vendor>
+  <signature family='6' model='63' stepping='4'/>
   <feature name='vme'/>
   <feature name='ds'/>
   <feature name='acpi'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E7540-host.xml b/tests/cputestdata/x86_64-cpuid-Xeon-E7540-host.xml
index 42b43116bd..ee526e7119 100644
--- a/tests/cputestdata/x86_64-cpuid-Xeon-E7540-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E7540-host.xml
@@ -2,6 +2,7 @@
   <arch>x86_64</arch>
   <model>Nehalem-IBRS</model>
   <vendor>Intel</vendor>
+  <signature family='6' model='46' stepping='6'/>
   <feature name='vme'/>
   <feature name='ds'/>
   <feature name='acpi'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-5115-host.xml b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-5115-host.xml
index 9de76fd640..e004747ada 100644
--- a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-5115-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-5115-host.xml
@@ -2,6 +2,7 @@
   <arch>x86_64</arch>
   <model>Skylake-Server-IBRS</model>
   <vendor>Intel</vendor>
+  <signature family='6' model='85' stepping='4'/>
   <feature name='ds'/>
   <feature name='acpi'/>
   <feature name='ss'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-host.xml b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-host.xml
index 207e9e0ee4..fba4ccf506 100644
--- a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-host.xml
@@ -2,6 +2,7 @@
   <arch>x86_64</arch>
   <model>Skylake-Server-IBRS</model>
   <vendor>Intel</vendor>
+  <signature family='6' model='85' stepping='4'/>
   <feature name='ds'/>
   <feature name='acpi'/>
   <feature name='ss'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6148-host.xml b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6148-host.xml
index b18ceddc60..da7e96e533 100644
--- a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6148-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6148-host.xml
@@ -2,6 +2,7 @@
   <arch>x86_64</arch>
   <model>Skylake-Server</model>
   <vendor>Intel</vendor>
+  <signature family='6' model='85' stepping='4'/>
   <feature name='ds'/>
   <feature name='acpi'/>
   <feature name='ss'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-8268-host.xml b/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-8268-host.xml
index fdeafc4870..96effe5684 100644
--- a/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-8268-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-8268-host.xml
@@ -2,6 +2,7 @@
   <arch>x86_64</arch>
   <model>Cascadelake-Server</model>
   <vendor>Intel</vendor>
+  <signature family='6' model='85' stepping='6'/>
   <feature name='ds'/>
   <feature name='acpi'/>
   <feature name='ss'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-host.xml b/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-host.xml
index 01447f3478..ea51fc40a1 100644
--- a/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-host.xml
@@ -2,6 +2,7 @@
   <arch>x86_64</arch>
   <model>Cascadelake-Server</model>
   <vendor>Intel</vendor>
+  <signature family='6' model='85' stepping='7'/>
   <feature name='ds'/>
   <feature name='acpi'/>
   <feature name='ss'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-W3520-host.xml b/tests/cputestdata/x86_64-cpuid-Xeon-W3520-host.xml
index c4a9226973..35dd63f360 100644
--- a/tests/cputestdata/x86_64-cpuid-Xeon-W3520-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-W3520-host.xml
@@ -2,6 +2,7 @@
   <arch>x86_64</arch>
   <model>Nehalem</model>
   <vendor>Intel</vendor>
+  <signature family='6' model='26' stepping='5'/>
   <feature name='vme'/>
   <feature name='ds'/>
   <feature name='acpi'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-X5460-host.xml b/tests/cputestdata/x86_64-cpuid-Xeon-X5460-host.xml
index e73c4780c9..91ab9726da 100644
--- a/tests/cputestdata/x86_64-cpuid-Xeon-X5460-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-X5460-host.xml
@@ -2,6 +2,7 @@
   <arch>x86_64</arch>
   <model>Penryn</model>
   <vendor>Intel</vendor>
+  <signature family='6' model='23' stepping='6'/>
   <feature name='vme'/>
   <feature name='ds'/>
   <feature name='acpi'/>
-- 
2.36.1
Re: [PATCH] conf: cpu: Add <signature family=X model=X stepping=X/>
Posted by Daniel P. Berrangé 1 year, 11 months ago
On Sat, Jun 11, 2022 at 12:46:26PM -0400, Cole Robinson wrote:
> Internally we already collect x86 host family + model + stepping
> numeric values. This exposed them in capabilities CPU output.
> Example:
> 
> $ sudo virsh capabilities | grep -A1 -B1 signature
>       <microcode version='240'/>
>       <signature family='6' model='94' stepping='3'/>
>       <counter name='tsc' frequency='3408010000' scaling='no'/>
> 
> Users need to know these values to calculate an expected.
> SEV-ES/SEV-SNP launch measurement.

More specifically, the VMSA register dumps contain a field that
encodes the family+model+stepping. So given a generic machine
portable VMSA blob, we need to be able to update it with the
family+model+stepping of the specific host executing a VM to
get a machine specific VMSA blob. This is then used in the
launjch measurement validation.


With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
Re: [PATCH] conf: cpu: Add <signature family=X model=X stepping=X/>
Posted by Jiri Denemark 1 year, 11 months ago
On Sat, Jun 11, 2022 at 12:46:26 -0400, Cole Robinson wrote:
> Internally we already collect x86 host family + model + stepping
> numeric values. This exposed them in capabilities CPU output.
> Example:
> 
> $ sudo virsh capabilities | grep -A1 -B1 signature
>       <microcode version='240'/>
>       <signature family='6' model='94' stepping='3'/>
>       <counter name='tsc' frequency='3408010000' scaling='no'/>
> 
> Users need to know these values to calculate an expected.
> SEV-ES/SEV-SNP launch measurement.
> 
> Signed-off-by: Cole Robinson <crobinso@redhat.com>
> ---
>  src/conf/cpu_conf.c                           | 36 +++++++++++++++++++
>  src/conf/cpu_conf.h                           |  3 ++
>  src/conf/schemas/cputypes.rng                 | 13 +++++++
>  src/cpu/cpu_x86.c                             |  3 ++
>  .../x86_64-cpuid-A10-5800K-host.xml           |  1 +
>  .../x86_64-cpuid-Atom-D510-host.xml           |  1 +
>  .../x86_64-cpuid-Atom-N450-host.xml           |  1 +
>  .../x86_64-cpuid-Atom-P5362-host.xml          |  1 +
>  .../x86_64-cpuid-Cooperlake-host.xml          |  1 +
>  .../x86_64-cpuid-Core-i5-2500-host.xml        |  1 +
>  .../x86_64-cpuid-Core-i5-2540M-host.xml       |  1 +
>  .../x86_64-cpuid-Core-i5-4670T-host.xml       |  1 +
>  .../x86_64-cpuid-Core-i5-650-host.xml         |  1 +
>  .../x86_64-cpuid-Core-i5-6600-host.xml        |  1 +
>  .../x86_64-cpuid-Core-i7-2600-host.xml        |  1 +
>  ...86_64-cpuid-Core-i7-2600-xsaveopt-host.xml |  1 +
>  .../x86_64-cpuid-Core-i7-3520M-host.xml       |  1 +
>  .../x86_64-cpuid-Core-i7-3740QM-host.xml      |  1 +
>  .../x86_64-cpuid-Core-i7-3770-host.xml        |  1 +
>  .../x86_64-cpuid-Core-i7-4510U-host.xml       |  1 +
>  .../x86_64-cpuid-Core-i7-4600U-host.xml       |  1 +
>  .../x86_64-cpuid-Core-i7-5600U-arat-host.xml  |  1 +
>  .../x86_64-cpuid-Core-i7-5600U-host.xml       |  1 +
>  .../x86_64-cpuid-Core-i7-5600U-ibrs-host.xml  |  1 +
>  .../x86_64-cpuid-Core-i7-7600U-host.xml       |  1 +
>  .../x86_64-cpuid-Core-i7-7700-host.xml        |  1 +
>  .../x86_64-cpuid-Core-i7-8550U-host.xml       |  1 +
>  .../x86_64-cpuid-Core-i7-8700-host.xml        |  1 +
>  .../x86_64-cpuid-Core2-E6850-host.xml         |  1 +
>  .../x86_64-cpuid-Core2-Q9500-host.xml         |  1 +
>  .../x86_64-cpuid-EPYC-7601-32-Core-host.xml   |  1 +
>  ...6_64-cpuid-EPYC-7601-32-Core-ibpb-host.xml |  1 +
>  .../cputestdata/x86_64-cpuid-FX-8150-host.xml |  1 +
>  .../x86_64-cpuid-Opteron-1352-host.xml        |  1 +
>  .../x86_64-cpuid-Opteron-2350-host.xml        |  1 +
>  .../x86_64-cpuid-Opteron-6234-host.xml        |  1 +
>  .../x86_64-cpuid-Opteron-6282-host.xml        |  1 +
>  .../x86_64-cpuid-Pentium-P6100-host.xml       |  1 +
>  .../x86_64-cpuid-Phenom-B95-host.xml          |  1 +
>  ...64-cpuid-Ryzen-7-1800X-Eight-Core-host.xml |  1 +
>  .../x86_64-cpuid-Xeon-5110-host.xml           |  1 +
>  .../x86_64-cpuid-Xeon-E3-1225-v5-host.xml     |  1 +
>  .../x86_64-cpuid-Xeon-E3-1245-v5-host.xml     |  1 +
>  .../x86_64-cpuid-Xeon-E5-2609-v3-host.xml     |  1 +
>  .../x86_64-cpuid-Xeon-E5-2623-v4-host.xml     |  1 +
>  .../x86_64-cpuid-Xeon-E5-2630-v3-host.xml     |  1 +
>  .../x86_64-cpuid-Xeon-E5-2630-v4-host.xml     |  1 +
>  .../x86_64-cpuid-Xeon-E5-2650-host.xml        |  1 +
>  .../x86_64-cpuid-Xeon-E5-2650-v3-host.xml     |  1 +
>  .../x86_64-cpuid-Xeon-E5-2650-v4-host.xml     |  1 +
>  .../x86_64-cpuid-Xeon-E7-4820-host.xml        |  1 +
>  .../x86_64-cpuid-Xeon-E7-4830-host.xml        |  1 +
>  .../x86_64-cpuid-Xeon-E7-8890-v3-host.xml     |  1 +
>  .../x86_64-cpuid-Xeon-E7540-host.xml          |  1 +
>  .../x86_64-cpuid-Xeon-Gold-5115-host.xml      |  1 +
>  .../x86_64-cpuid-Xeon-Gold-6130-host.xml      |  1 +
>  .../x86_64-cpuid-Xeon-Gold-6148-host.xml      |  1 +
>  .../x86_64-cpuid-Xeon-Platinum-8268-host.xml  |  1 +
>  .../x86_64-cpuid-Xeon-Platinum-9242-host.xml  |  1 +
>  .../x86_64-cpuid-Xeon-W3520-host.xml          |  1 +
>  .../x86_64-cpuid-Xeon-X5460-host.xml          |  1 +
>  61 files changed, 112 insertions(+)
> 
> diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
> index 2d447da7c3..1a09e27dca 100644
> --- a/src/conf/cpu_conf.c
> +++ b/src/conf/cpu_conf.c
> @@ -159,6 +159,9 @@ virCPUDefCopyModelFilter(virCPUDef *dst,
>      dst->vendor = g_strdup(src->vendor);
>      dst->vendor_id = g_strdup(src->vendor_id);
>      dst->microcodeVersion = src->microcodeVersion;
> +    dst->sigFamily = src->sigFamily;
> +    dst->sigModel = src->sigModel;
> +    dst->sigStepping = src->sigStepping;
>      dst->nfeatures_max = src->nfeatures;
>      dst->nfeatures = 0;
>  
> @@ -210,6 +213,9 @@ virCPUDefStealModel(virCPUDef *dst,
>      dst->model = g_steal_pointer(&src->model);
>      dst->features = g_steal_pointer(&src->features);
>      dst->microcodeVersion = src->microcodeVersion;
> +    dst->sigFamily = src->sigFamily;
> +    dst->sigModel = src->sigModel;
> +    dst->sigStepping = src->sigStepping;
>      dst->nfeatures_max = src->nfeatures_max;
>      src->nfeatures_max = 0;
>      dst->nfeatures = src->nfeatures;

The CPU signature is introduced only for reporting the host CPU
capability and it is not really related to the "model" part of CPU. Move
the code from the two hunks above to virCPUDefCopyWithoutModel.

> @@ -421,6 +427,7 @@ virCPUDefParseXML(xmlXPathContextPtr ctxt,
>      if (def->type == VIR_CPU_TYPE_HOST) {
>          g_autofree char *arch = virXPathString("string(./arch[1])", ctxt);
>          xmlNodePtr counter_node = NULL;
> +        xmlNodePtr signature_node = NULL;
>  
>          if (!arch) {
>              virReportError(VIR_ERR_XML_ERROR, "%s",
> @@ -441,6 +448,26 @@ virCPUDefParseXML(xmlXPathContextPtr ctxt,
>              return -1;
>          }
>  
> +        if ((signature_node = virXPathNode("./signature[1]", ctxt))) {
> +            if (virXMLPropUInt(signature_node, "family", 10,
> +                               VIR_XML_PROP_REQUIRED | VIR_XML_PROP_NONZERO,
> +                               &def->sigFamily) < 0) {
> +                return -1;
> +            }
> +
> +            if (virXMLPropUInt(signature_node, "model", 10,
> +                               VIR_XML_PROP_REQUIRED | VIR_XML_PROP_NONZERO,
> +                               &def->sigModel) < 0) {
> +                return -1;
> +            }
> +
> +            if (virXMLPropUInt(signature_node, "stepping", 10,
> +                               VIR_XML_PROP_REQUIRED | VIR_XML_PROP_NONZERO,
> +                               &def->sigStepping) < 0) {
> +                return -1;
> +            }
> +        }
> +

Searching for 0x00 in tests/cputestdata/*.sig shows:
tests/cputestdata/x86_64-cpuid-EPYC-7502-32-Core.sig:stepping:   0 (0x00)
tests/cputestdata/x86_64-cpuid-Hygon-C86-7185-32-core.sig:model:      0 (0x00)
tests/cputestdata/x86_64-cpuid-Ice-Lake-Server.sig:stepping:   0 (0x00)
tests/cputestdata/x86_64-cpuid-Ryzen-9-3900X-12-Core.sig:stepping:   0 (0x00)

So there are CPUs with stepping or even model equal to 0. The
VIR_XML_PROP_NONZERO flag should only remain for family.

>          if ((counter_node = virXPathNode("./counter[@name='tsc']", ctxt))) {
>              tsc = g_new0(virHostCPUTscInfo, 1);
>  
> @@ -753,6 +780,15 @@ virCPUDefFormatBuf(virBuffer *buf,
>          virBufferAsprintf(buf, "<microcode version='%u'/>\n",
>                            def->microcodeVersion);
>  
> +    if (def->type == VIR_CPU_TYPE_HOST &&
> +        def->sigFamily && def->sigModel && def->sigStepping) {

And you should only check family here as well.

> +        virBufferAddLit(buf, "<signature");
> +        virBufferAsprintf(buf, " family='%u'", def->sigFamily);
> +        virBufferAsprintf(buf, " model='%u'", def->sigModel);
> +        virBufferAsprintf(buf, " stepping='%u'", def->sigStepping);
> +        virBufferAddLit(buf, "/>\n");
> +    }
> +
>      if (def->type == VIR_CPU_TYPE_HOST && def->tsc) {
>          virBufferAddLit(buf, "<counter name='tsc'");
>          virBufferAsprintf(buf, " frequency='%llu'", def->tsc->frequency);
> diff --git a/src/conf/cpu_conf.h b/src/conf/cpu_conf.h
> index 2cda4ee1f4..17867d6a30 100644
> --- a/src/conf/cpu_conf.h
> +++ b/src/conf/cpu_conf.h
> @@ -134,6 +134,9 @@ struct _virCPUDef {
>      unsigned int dies;
>      unsigned int cores;
>      unsigned int threads;
> +    unsigned int sigFamily;
> +    unsigned int sigModel;
> +    unsigned int sigStepping;

I'd call them just family, model, and stepping. I think the semantics is
pretty obvious in the virCPUDef context.

>      size_t nfeatures;
>      size_t nfeatures_max;
>      virCPUFeatureDef *features;
> diff --git a/src/conf/schemas/cputypes.rng b/src/conf/schemas/cputypes.rng
> index 056e66e1b4..7c84216240 100644
> --- a/src/conf/schemas/cputypes.rng
> +++ b/src/conf/schemas/cputypes.rng
> @@ -342,6 +342,19 @@
>              </attribute>
>            </element>
>          </optional>
> +        <optional>
> +          <element name="signature">
> +            <attribute name="family">
> +              <ref name="positiveInteger"/>
> +            </attribute>
> +            <attribute name="model">
> +              <ref name="positiveInteger"/>
> +            </attribute>
> +            <attribute name="stepping">
> +              <ref name="positiveInteger"/>
> +            </attribute>
> +          </element>
> +        </optional>

Only family should be positiveInteger.

>          <optional>
>            <element name="counter">
>              <attribute name="name">
> diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
> index a4aca6055d..c4462f34a7 100644
> --- a/src/cpu/cpu_x86.c
> +++ b/src/cpu/cpu_x86.c
> @@ -2265,6 +2265,9 @@ x86Decode(virCPUDef *cpu,
>      cpuModel->nfeatures = 0;
>      cpu->nfeatures_max = cpuModel->nfeatures_max;
>      cpuModel->nfeatures_max = 0;
> +    cpu->sigFamily = sigFamily;
> +    cpu->sigModel = sigModel;
> +    cpu->sigStepping = sigStepping;
>  
>      return 0;
>  }
> diff --git a/tests/cputestdata/x86_64-cpuid-A10-5800K-host.xml b/tests/cputestdata/x86_64-cpuid-A10-5800K-host.xml
> index 2430adbfbc..220dfb6467 100644
> --- a/tests/cputestdata/x86_64-cpuid-A10-5800K-host.xml
> +++ b/tests/cputestdata/x86_64-cpuid-A10-5800K-host.xml
...

And because of the check for nonzero model and stepping, the following
files were not updated:

$ git grep -L signature tests/cputestdata/x86_64-cpuid-*-host.xml
tests/cputestdata/x86_64-cpuid-EPYC-7502-32-Core-host.xml
tests/cputestdata/x86_64-cpuid-Hygon-C86-7185-32-core-host.xml
tests/cputestdata/x86_64-cpuid-Ice-Lake-Server-host.xml
tests/cputestdata/x86_64-cpuid-Ryzen-9-3900X-12-Core-host.xml

Jirka