From 576236efe092a457cd3c33fef139fb21985713c6 Mon Sep 17 00:00:00 2001
From: zhangxinhao <zhangxinhao1@huawei.com>
Date: Tue, 9 May 2023 15:23:48 +0800
Subject: cpu_topo: support for cpu_topo "clusters” in conf

Kunpeng920 support a new structure "cluster" in cpu topology. Support
"clusters" in XML parser.

Signed-off-by: zhangxinhao <zhangxinhao1@huawei.com>
---
 docs/formatcaps.html.in                       |  2 +-
 docs/formatdomain.html.in                     | 23 +++++++++--------
 docs/schemas/cputypes.rng                     |  5 ++++
 src/conf/cpu_conf.c                           | 25 +++++++++++++++++--
 src/conf/cpu_conf.h                           |  1 +
 src/conf/domain_conf.c                        |  1 +
 src/cpu/cpu.c                                 |  1 +
 src/qemu/qemu_command.c                       |  5 ++++
 src/vmx/vmx.c                                 |  7 ++++++
 .../x86_64-host+guest,model486-result.xml     |  2 +-
 .../x86_64-host+guest,models-result.xml       |  2 +-
 .../cputestdata/x86_64-host+guest-result.xml  |  2 +-
 tests/cputestdata/x86_64-host+guest.xml       |  2 +-
 .../x86_64-host+host-model-nofallback.xml     |  2 +-
 ...t-Haswell-noTSX+Haswell,haswell-result.xml |  2 +-
 ...ell-noTSX+Haswell-noTSX,haswell-result.xml |  2 +-
 ...ost-Haswell-noTSX+Haswell-noTSX-result.xml |  2 +-
 .../x86_64-host-worse+guest-result.xml        |  2 +-
 .../ppc64-modern-bulk-result-conf.xml         |  2 +-
 .../ppc64-modern-bulk-result-live.xml         |  2 +-
 .../ppc64-modern-individual-result-conf.xml   |  2 +-
 .../ppc64-modern-individual-result-live.xml   |  2 +-
 .../x86-modern-bulk-result-conf.xml           |  2 +-
 .../x86-modern-bulk-result-live.xml           |  2 +-
 .../x86-modern-individual-add-result-conf.xml |  2 +-
 .../x86-modern-individual-add-result-live.xml |  2 +-
 .../x86-old-bulk-result-conf.xml              |  2 +-
 .../x86-old-bulk-result-live.xml              |  2 +-
 .../fd-memory-no-numa-topology.xml            |  2 +-
 .../fd-memory-numa-topology.xml               |  2 +-
 .../fd-memory-numa-topology2.xml              |  2 +-
 .../fd-memory-numa-topology3.xml              |  2 +-
 tests/qemuxml2argvdata/hugepages-nvdimm.xml   |  2 +-
 .../memfd-memory-default-hugepage.xml         |  2 +-
 tests/qemuxml2argvdata/memfd-memory-numa.xml  |  2 +-
 .../memory-hotplug-nvdimm-access.xml          |  2 +-
 .../memory-hotplug-nvdimm-align.xml           |  2 +-
 .../memory-hotplug-nvdimm-label.xml           |  2 +-
 .../memory-hotplug-nvdimm-pmem.xml            |  2 +-
 .../memory-hotplug-nvdimm-readonly.xml        |  2 +-
 .../memory-hotplug-nvdimm.xml                 |  2 +-
 .../qemuxml2xmloutdata/cpu-numa-disjoint.xml  |  2 +-
 .../cpu-numa-disordered.xml                   |  2 +-
 .../qemuxml2xmloutdata/cpu-numa-memshared.xml |  2 +-
 .../cpu-numa-no-memory-element.xml            |  2 +-
 tests/qemuxml2xmloutdata/cpu-numa1.xml        |  2 +-
 tests/qemuxml2xmloutdata/cpu-numa2.xml        |  2 +-
 .../fd-memory-no-numa-topology.xml            |  2 +-
 .../fd-memory-numa-topology.xml               |  2 +-
 .../fd-memory-numa-topology2.xml              |  2 +-
 .../fd-memory-numa-topology3.xml              |  2 +-
 .../graphics-spice-timeout.xml                |  2 +-
 tests/qemuxml2xmloutdata/hugepages-nvdimm.xml |  2 +-
 .../memfd-memory-default-hugepage.xml         |  2 +-
 .../qemuxml2xmloutdata/memfd-memory-numa.xml  |  2 +-
 .../memory-hotplug-dimm.xml                   |  2 +-
 .../memory-hotplug-nvdimm-access.xml          |  2 +-
 .../memory-hotplug-nvdimm-align.xml           |  2 +-
 .../memory-hotplug-nvdimm-label.xml           |  2 +-
 .../memory-hotplug-nvdimm-pmem.xml            |  2 +-
 .../memory-hotplug-nvdimm-ppc64.xml           |  2 +-
 .../memory-hotplug-nvdimm-readonly.xml        |  2 +-
 .../memory-hotplug-nvdimm.xml                 |  2 +-
 tests/qemuxml2xmloutdata/memory-hotplug.xml   |  2 +-
 .../numad-auto-memory-vcpu-cpuset.xml         |  2 +-
 ...to-memory-vcpu-no-cpuset-and-placement.xml |  2 +-
 .../numad-auto-vcpu-no-numatune.xml           |  2 +-
 .../numad-static-vcpu-no-numatune.xml         |  2 +-
 tests/qemuxml2xmloutdata/pci-expander-bus.xml |  2 +-
 .../qemuxml2xmloutdata/pcie-expander-bus.xml  |  2 +-
 .../pseries-phb-numa-node.xml                 |  2 +-
 tests/qemuxml2xmloutdata/smp.xml              |  2 +-
 .../vmx2xmldata/vmx2xml-esx-in-the-wild-8.xml |  2 +-
 .../vmx2xmldata/vmx2xml-esx-in-the-wild-9.xml |  2 +-
 74 files changed, 121 insertions(+), 79 deletions(-)

diff --git a/docs/formatcaps.html.in b/docs/formatcaps.html.in
index 59d21a7..ff40f06 100644
--- a/docs/formatcaps.html.in
+++ b/docs/formatcaps.html.in
@@ -173,7 +173,7 @@
       &lt;/features&gt;
       &lt;model&gt;core2duo&lt;/model&gt;
       &lt;vendor&gt;Intel&lt;/vendor&gt;
-      &lt;topology sockets="1" dies="1" cores="2" threads="1"/&gt;
+      &lt;topology sockets="1" dies="1" clusters="1" cores="2" threads="1"/&gt;
       &lt;feature name="lahf_lm"/&gt;
       &lt;feature name='xtpr'/&gt;
       ...
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 5860ec9..6e51c3b 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -1470,7 +1470,7 @@
 &lt;cpu match='exact'&gt;
   &lt;model fallback='allow'&gt;core2duo&lt;/model&gt;
   &lt;vendor&gt;Intel&lt;/vendor&gt;
-  &lt;topology sockets='1' dies='1' cores='2' threads='1'/&gt;
+  &lt;topology sockets='1' dies='1' clusters="1" cores='2' threads='1'/&gt;
   &lt;cache level='3' mode='emulate'/&gt;
   &lt;feature policy='disable' name='lahf_lm'/&gt;
 &lt;/cpu&gt;
@@ -1479,7 +1479,7 @@
 <pre>
 &lt;cpu mode='host-model'&gt;
   &lt;model fallback='forbid'/&gt;
-  &lt;topology sockets='1' dies='1' cores='2' threads='1'/&gt;
+  &lt;topology sockets='1' dies='1' clusters='1' cores='2' threads='1'/&gt;
 &lt;/cpu&gt;
 ...</pre>
 
@@ -1498,7 +1498,7 @@
 <pre>
 ...
 &lt;cpu&gt;
-  &lt;topology sockets='1' dies='1' cores='2' threads='1'/&gt;
+  &lt;topology sockets='1' dies='1' clusters='1' cores='2' threads='1'/&gt;
 &lt;/cpu&gt;
 ...</pre>
 
@@ -1674,14 +1674,15 @@
       <dt><code>topology</code></dt>
       <dd>The <code>topology</code> element specifies requested topology of
         virtual CPU provided to the guest. Four attributes, <code>sockets</code>,
-        <code>dies</code>, <code>cores</code>, and <code>threads</code>,
-        accept non-zero positive integer values. They refer to the total number
-        of CPU sockets, number of dies per socket, number of cores per die, and
-        number of threads per core, respectively. The <code>dies</code>
-        attribute is optional and will default to 1 if omitted, while the other
-        attributes are all mandatory. Hypervisors may require that the maximum
-        number of vCPUs specified by the <code>cpus</code> element equals to
-        the number of vcpus resulting from the topology.</dd>
+        <code>dies</code>, <code>dies</code>, <code>cores</code>,
+        and <code>threads</code>, accept non-zero positive integer values. They
+        refer to the total number of CPU sockets, number of dies per socket,
+        number of clusters per die, number of cores per cluster, and number of
+        threads per core, respectively. The attribute <code>dies</code> and
+        <code>clusters</code> are optional and will default to 1 if omitted,
+        while the other attributes are all mandatory. Hypervisors may require
+        that the maximum number of vCPUs specified by the <code>cpus</code>
+        element equals to the number of vcpus resulting from the topology.</dd>
 
       <dt><code>feature</code></dt>
       <dd>The <code>cpu</code> element can contain zero or more
diff --git a/docs/schemas/cputypes.rng b/docs/schemas/cputypes.rng
index e2744ac..699fd05 100644
--- a/docs/schemas/cputypes.rng
+++ b/docs/schemas/cputypes.rng
@@ -91,6 +91,11 @@
           <ref name="positiveInteger"/>
         </attribute>
       </optional>
+      <optional>
+        <attribute name="clusters">
+          <ref name="positiveInteger"/>
+        </attribute>
+      </optional>
       <attribute name="cores">
         <ref name="positiveInteger"/>
       </attribute>
diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
index 989306b..3c2ee73 100644
--- a/src/conf/cpu_conf.c
+++ b/src/conf/cpu_conf.c
@@ -240,6 +240,7 @@ virCPUDefCopyWithoutModel(const virCPUDef *cpu)
     copy->fallback = cpu->fallback;
     copy->sockets = cpu->sockets;
     copy->dies = cpu->dies;
+    copy->clusters = cpu->clusters;
     copy->cores = cpu->cores;
     copy->threads = cpu->threads;
     copy->arch = cpu->arch;
@@ -547,6 +548,17 @@ virCPUDefParseXML(xmlXPathContextPtr ctxt,
             def->dies = 1;
         }
 
+        if (virXPathNode("./topology[1]/@clusters", ctxt)) {
+            if (virXPathULong("string(./topology[1]/@clusters)", ctxt, &ul) < 0) {
+                virReportError(VIR_ERR_XML_ERROR, "%s",
+                               _("Malformed 'clusters' attribute in CPU topology"));
+                goto cleanup;
+            }
+            def->clusters = (unsigned int) ul;
+        } else {
+            def->clusters = 1;
+        }
+
         if (virXPathULong("string(./topology[1]/@cores)", ctxt, &ul) < 0) {
             virReportError(VIR_ERR_XML_ERROR, "%s",
                            _("Missing 'cores' attribute in CPU topology"));
@@ -561,7 +573,8 @@ virCPUDefParseXML(xmlXPathContextPtr ctxt,
         }
         def->threads = (unsigned int) ul;
 
-        if (!def->sockets || !def->cores || !def->threads || !def->dies) {
+        if (!def->sockets || !def->cores || !def->threads || !def->dies ||
+            !def -> clusters) {
             virReportError(VIR_ERR_XML_ERROR, "%s",
                            _("Invalid CPU topology"));
             goto cleanup;
@@ -833,10 +846,12 @@ virCPUDefFormatBuf(virBufferPtr buf,
         virBufferAddLit(buf, "/>\n");
     }
 
-    if (def->sockets && def->dies && def->cores && def->threads) {
+    if (def->sockets && def->dies && def->clusters && def->cores &&
+        def->threads) {
         virBufferAddLit(buf, "<topology");
         virBufferAsprintf(buf, " sockets='%u'", def->sockets);
         virBufferAsprintf(buf, " dies='%u'", def->dies);
+        virBufferAsprintf(buf, " clusters='%u'", def->clusters);
         virBufferAsprintf(buf, " cores='%u'", def->cores);
         virBufferAsprintf(buf, " threads='%u'", def->threads);
         virBufferAddLit(buf, "/>\n");
@@ -1081,6 +1096,12 @@ virCPUDefIsEqual(virCPUDefPtr src,
         return false;
     }
 
+    if (src->clusters != dst->clusters) {
+        MISMATCH(_("Target CPU clusters %d does not match source %d"),
+                 dst->clusters, src->clusters);
+        return false;
+    }
+
     if (src->cores != dst->cores) {
         MISMATCH(_("Target CPU cores %d does not match source %d"),
                  dst->cores, src->cores);
diff --git a/src/conf/cpu_conf.h b/src/conf/cpu_conf.h
index 1b297ed..10a2252 100644
--- a/src/conf/cpu_conf.h
+++ b/src/conf/cpu_conf.h
@@ -134,6 +134,7 @@ struct _virCPUDef {
     unsigned int microcodeVersion;
     unsigned int sockets;
     unsigned int dies;
+    unsigned int clusters;
     unsigned int cores;
     unsigned int threads;
     size_t nfeatures;
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index b8cf1ad..7ae4034 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -2088,6 +2088,7 @@ virDomainDefGetVcpusTopology(const virDomainDef *def,
 
     /* multiplication of 32bit numbers fits into a 64bit variable */
     if ((tmp *= def->cpu->dies) > UINT_MAX ||
+        (tmp *= def->cpu->clusters) > UINT_MAX ||
         (tmp *= def->cpu->cores) > UINT_MAX ||
         (tmp *= def->cpu->threads) > UINT_MAX) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c
index df78a0d..27d26fc 100644
--- a/src/cpu/cpu.c
+++ b/src/cpu/cpu.c
@@ -426,6 +426,7 @@ virCPUGetHost(virArch arch,
     if (nodeInfo) {
         cpu->sockets = nodeInfo->sockets;
         cpu->dies = 1;
+        cpu->clusters = 1;
         cpu->cores = nodeInfo->cores;
         cpu->threads = nodeInfo->threads;
     }
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 5f7e847..85f95b4 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7335,6 +7335,11 @@ qemuBuildSmpCommandLine(virCommandPtr cmd,
                            _("Only 1 die per socket is supported"));
             return -1;
         }
+        if (def->cpu->clusters != 1) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                           _("Only 1 cluster per dies is supported"));
+            return -1;
+        }
         virBufferAsprintf(&buf, ",sockets=%u", def->cpu->sockets);
         if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_SMP_DIES))
             virBufferAsprintf(&buf, ",dies=%u", def->cpu->dies);
diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index 5f2ada6..76e5e66 100644
--- a/src/vmx/vmx.c
+++ b/src/vmx/vmx.c
@@ -1494,6 +1494,7 @@ virVMXParseConfig(virVMXContext *ctx,
             goto cleanup;
         }
         cpu->dies = 1;
+        cpu->clusters = 1;
         cpu->cores = coresPerSocket;
         cpu->threads = 1;
 
@@ -3222,6 +3223,12 @@ virVMXFormatConfig(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virDomainDe
             goto cleanup;
         }
 
+        if (def->cpu->clusters != 1) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                           _("Only 1 cluster per die is supported"));
+            goto cleanup;
+        }
+
         calculated_vcpus = def->cpu->sockets * def->cpu->cores;
         if (calculated_vcpus != maxvcpus) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
diff --git a/tests/cputestdata/x86_64-host+guest,model486-result.xml b/tests/cputestdata/x86_64-host+guest,model486-result.xml
index ea8e2d3..b533f22 100644
--- a/tests/cputestdata/x86_64-host+guest,model486-result.xml
+++ b/tests/cputestdata/x86_64-host+guest,model486-result.xml
@@ -1,6 +1,6 @@
 <cpu mode='custom' match='exact'>
   <model fallback='allow'>486</model>
-  <topology sockets='2' dies='1' cores='4' threads='1'/>
+  <topology sockets='2' dies='1' clusters='1' cores='4' threads='1'/>
   <feature policy='require' name='de'/>
   <feature policy='require' name='tsc'/>
   <feature policy='require' name='msr'/>
diff --git a/tests/cputestdata/x86_64-host+guest,models-result.xml b/tests/cputestdata/x86_64-host+guest,models-result.xml
index 0dd6955..f476022 100644
--- a/tests/cputestdata/x86_64-host+guest,models-result.xml
+++ b/tests/cputestdata/x86_64-host+guest,models-result.xml
@@ -1,6 +1,6 @@
 <cpu mode='custom' match='exact'>
   <model fallback='allow'>Nehalem</model>
-  <topology sockets='2' dies='1' cores='4' threads='1'/>
+  <topology sockets='2' dies='1' clusters='1' cores='4' threads='1'/>
   <feature policy='force' name='pbe'/>
   <feature policy='force' name='monitor'/>
   <feature policy='require' name='xtpr'/>
diff --git a/tests/cputestdata/x86_64-host+guest-result.xml b/tests/cputestdata/x86_64-host+guest-result.xml
index 28e3152..cf41b3f 100644
--- a/tests/cputestdata/x86_64-host+guest-result.xml
+++ b/tests/cputestdata/x86_64-host+guest-result.xml
@@ -1,6 +1,6 @@
 <cpu mode='custom' match='exact'>
   <model fallback='allow'>Penryn</model>
-  <topology sockets='2' dies='1' cores='4' threads='1'/>
+  <topology sockets='2' dies='1' clusters='1' cores='4' threads='1'/>
   <feature policy='require' name='dca'/>
   <feature policy='require' name='xtpr'/>
   <feature policy='disable' name='sse4.2'/>
diff --git a/tests/cputestdata/x86_64-host+guest.xml b/tests/cputestdata/x86_64-host+guest.xml
index 28e3152..cf41b3f 100644
--- a/tests/cputestdata/x86_64-host+guest.xml
+++ b/tests/cputestdata/x86_64-host+guest.xml
@@ -1,6 +1,6 @@
 <cpu mode='custom' match='exact'>
   <model fallback='allow'>Penryn</model>
-  <topology sockets='2' dies='1' cores='4' threads='1'/>
+  <topology sockets='2' dies='1' clusters='1' cores='4' threads='1'/>
   <feature policy='require' name='dca'/>
   <feature policy='require' name='xtpr'/>
   <feature policy='disable' name='sse4.2'/>
diff --git a/tests/cputestdata/x86_64-host+host-model-nofallback.xml b/tests/cputestdata/x86_64-host+host-model-nofallback.xml
index 16d6e1d..881eea7 100644
--- a/tests/cputestdata/x86_64-host+host-model-nofallback.xml
+++ b/tests/cputestdata/x86_64-host+host-model-nofallback.xml
@@ -1,7 +1,7 @@
 <cpu mode='custom' match='exact'>
   <model fallback='forbid'>Penryn</model>
   <vendor>Intel</vendor>
-  <topology sockets='1' dies='1' cores='2' threads='1'/>
+  <topology sockets='1' dies='1' clusters='1' cores='2' threads='1'/>
   <feature policy='require' name='dca'/>
   <feature policy='require' name='xtpr'/>
   <feature policy='require' name='tm2'/>
diff --git a/tests/cputestdata/x86_64-host-Haswell-noTSX+Haswell,haswell-result.xml b/tests/cputestdata/x86_64-host-Haswell-noTSX+Haswell,haswell-result.xml
index 8eda668..67994c6 100644
--- a/tests/cputestdata/x86_64-host-Haswell-noTSX+Haswell,haswell-result.xml
+++ b/tests/cputestdata/x86_64-host-Haswell-noTSX+Haswell,haswell-result.xml
@@ -1,6 +1,6 @@
 <cpu mode='custom' match='exact'>
   <model fallback='allow'>Haswell</model>
-  <topology sockets='1' dies='1' cores='2' threads='2'/>
+  <topology sockets='1' dies='1' clusters='1' cores='2' threads='2'/>
   <feature policy='disable' name='rtm'/>
   <feature policy='disable' name='hle'/>
 </cpu>
diff --git a/tests/cputestdata/x86_64-host-Haswell-noTSX+Haswell-noTSX,haswell-result.xml b/tests/cputestdata/x86_64-host-Haswell-noTSX+Haswell-noTSX,haswell-result.xml
index cb02449..4804c0b 100644
--- a/tests/cputestdata/x86_64-host-Haswell-noTSX+Haswell-noTSX,haswell-result.xml
+++ b/tests/cputestdata/x86_64-host-Haswell-noTSX+Haswell-noTSX,haswell-result.xml
@@ -1,6 +1,6 @@
 <cpu mode='custom' match='exact'>
   <model fallback='allow'>Haswell</model>
-  <topology sockets='1' dies='1' cores='2' threads='2'/>
+  <topology sockets='1' dies='1' clusters='1' cores='2' threads='2'/>
   <feature policy='disable' name='hle'/>
   <feature policy='disable' name='rtm'/>
 </cpu>
diff --git a/tests/cputestdata/x86_64-host-Haswell-noTSX+Haswell-noTSX-result.xml b/tests/cputestdata/x86_64-host-Haswell-noTSX+Haswell-noTSX-result.xml
index 7ee926a..c21b331 100644
--- a/tests/cputestdata/x86_64-host-Haswell-noTSX+Haswell-noTSX-result.xml
+++ b/tests/cputestdata/x86_64-host-Haswell-noTSX+Haswell-noTSX-result.xml
@@ -1,4 +1,4 @@
 <cpu mode='custom' match='exact'>
   <model fallback='allow'>Haswell-noTSX</model>
-  <topology sockets='1' dies='1' cores='2' threads='2'/>
+  <topology sockets='1' dies='1' clusters='1' cores='2' threads='2'/>
 </cpu>
diff --git a/tests/cputestdata/x86_64-host-worse+guest-result.xml b/tests/cputestdata/x86_64-host-worse+guest-result.xml
index 9d54c66..712c3ad 100644
--- a/tests/cputestdata/x86_64-host-worse+guest-result.xml
+++ b/tests/cputestdata/x86_64-host-worse+guest-result.xml
@@ -1,6 +1,6 @@
 <cpu mode='custom' match='exact'>
   <model fallback='allow'>Penryn</model>
-  <topology sockets='2' dies='1' cores='4' threads='1'/>
+  <topology sockets='2' dies='1' clusters='1' cores='4' threads='1'/>
   <feature policy='disable' name='dca'/>
   <feature policy='disable' name='xtpr'/>
   <feature policy='disable' name='sse4.2'/>
diff --git a/tests/qemuhotplugtestcpus/ppc64-modern-bulk-result-conf.xml b/tests/qemuhotplugtestcpus/ppc64-modern-bulk-result-conf.xml
index f80c436..e976c00 100644
--- a/tests/qemuhotplugtestcpus/ppc64-modern-bulk-result-conf.xml
+++ b/tests/qemuhotplugtestcpus/ppc64-modern-bulk-result-conf.xml
@@ -43,7 +43,7 @@
     <boot dev='network'/>
   </os>
   <cpu>
-    <topology sockets='1' dies='1' cores='4' threads='8'/>
+    <topology sockets='1' dies='1' clusters='1' cores='4' threads='8'/>
   </cpu>
   <clock offset='utc'/>
   <on_poweroff>destroy</on_poweroff>
diff --git a/tests/qemuhotplugtestcpus/ppc64-modern-bulk-result-live.xml b/tests/qemuhotplugtestcpus/ppc64-modern-bulk-result-live.xml
index 7998b97..21666a0 100644
--- a/tests/qemuhotplugtestcpus/ppc64-modern-bulk-result-live.xml
+++ b/tests/qemuhotplugtestcpus/ppc64-modern-bulk-result-live.xml
@@ -43,7 +43,7 @@
     <boot dev='network'/>
   </os>
   <cpu>
-    <topology sockets='1' dies='1' cores='4' threads='8'/>
+    <topology sockets='1' dies='1' clusters='1' cores='4' threads='8'/>
   </cpu>
   <clock offset='utc'/>
   <on_poweroff>destroy</on_poweroff>
diff --git a/tests/qemuhotplugtestcpus/ppc64-modern-individual-result-conf.xml b/tests/qemuhotplugtestcpus/ppc64-modern-individual-result-conf.xml
index 2a48a97..2740737 100644
--- a/tests/qemuhotplugtestcpus/ppc64-modern-individual-result-conf.xml
+++ b/tests/qemuhotplugtestcpus/ppc64-modern-individual-result-conf.xml
@@ -43,7 +43,7 @@
     <boot dev='network'/>
   </os>
   <cpu>
-    <topology sockets='1' dies='1' cores='4' threads='8'/>
+    <topology sockets='1' dies='1' clusters='1' cores='4' threads='8'/>
   </cpu>
   <clock offset='utc'/>
   <on_poweroff>destroy</on_poweroff>
diff --git a/tests/qemuhotplugtestcpus/ppc64-modern-individual-result-live.xml b/tests/qemuhotplugtestcpus/ppc64-modern-individual-result-live.xml
index 90518d1..b9e325d 100644
--- a/tests/qemuhotplugtestcpus/ppc64-modern-individual-result-live.xml
+++ b/tests/qemuhotplugtestcpus/ppc64-modern-individual-result-live.xml
@@ -43,7 +43,7 @@
     <boot dev='network'/>
   </os>
   <cpu>
-    <topology sockets='1' dies='1' cores='4' threads='8'/>
+    <topology sockets='1' dies='1' clusters='1' cores='4' threads='8'/>
   </cpu>
   <clock offset='utc'/>
   <on_poweroff>destroy</on_poweroff>
diff --git a/tests/qemuhotplugtestcpus/x86-modern-bulk-result-conf.xml b/tests/qemuhotplugtestcpus/x86-modern-bulk-result-conf.xml
index 0d622fc..0b86f3a 100644
--- a/tests/qemuhotplugtestcpus/x86-modern-bulk-result-conf.xml
+++ b/tests/qemuhotplugtestcpus/x86-modern-bulk-result-conf.xml
@@ -19,7 +19,7 @@
     <boot dev='network'/>
   </os>
   <cpu>
-    <topology sockets='4' dies='1' cores='2' threads='1'/>
+    <topology sockets='4' dies='1' clusters='1' cores='2' threads='1'/>
   </cpu>
   <clock offset='utc'/>
   <on_poweroff>destroy</on_poweroff>
diff --git a/tests/qemuhotplugtestcpus/x86-modern-bulk-result-live.xml b/tests/qemuhotplugtestcpus/x86-modern-bulk-result-live.xml
index ed9deae..c21b000 100644
--- a/tests/qemuhotplugtestcpus/x86-modern-bulk-result-live.xml
+++ b/tests/qemuhotplugtestcpus/x86-modern-bulk-result-live.xml
@@ -19,7 +19,7 @@
     <boot dev='network'/>
   </os>
   <cpu>
-    <topology sockets='4' dies='1' cores='2' threads='1'/>
+    <topology sockets='4' dies='1' clusters='1' cores='2' threads='1'/>
   </cpu>
   <clock offset='utc'/>
   <on_poweroff>destroy</on_poweroff>
diff --git a/tests/qemuhotplugtestcpus/x86-modern-individual-add-result-conf.xml b/tests/qemuhotplugtestcpus/x86-modern-individual-add-result-conf.xml
index 342f172..bef1189 100644
--- a/tests/qemuhotplugtestcpus/x86-modern-individual-add-result-conf.xml
+++ b/tests/qemuhotplugtestcpus/x86-modern-individual-add-result-conf.xml
@@ -19,7 +19,7 @@
     <boot dev='network'/>
   </os>
   <cpu>
-    <topology sockets='4' dies='1' cores='2' threads='1'/>
+    <topology sockets='4' dies='1' clusters='1' cores='2' threads='1'/>
   </cpu>
   <clock offset='utc'/>
   <on_poweroff>destroy</on_poweroff>
diff --git a/tests/qemuhotplugtestcpus/x86-modern-individual-add-result-live.xml b/tests/qemuhotplugtestcpus/x86-modern-individual-add-result-live.xml
index b8341c7..aa63e72 100644
--- a/tests/qemuhotplugtestcpus/x86-modern-individual-add-result-live.xml
+++ b/tests/qemuhotplugtestcpus/x86-modern-individual-add-result-live.xml
@@ -19,7 +19,7 @@
     <boot dev='network'/>
   </os>
   <cpu>
-    <topology sockets='4' dies='1' cores='2' threads='1'/>
+    <topology sockets='4' dies='1' clusters='1' cores='2' threads='1'/>
   </cpu>
   <clock offset='utc'/>
   <on_poweroff>destroy</on_poweroff>
diff --git a/tests/qemuhotplugtestcpus/x86-old-bulk-result-conf.xml b/tests/qemuhotplugtestcpus/x86-old-bulk-result-conf.xml
index 29da89f..2952fba 100644
--- a/tests/qemuhotplugtestcpus/x86-old-bulk-result-conf.xml
+++ b/tests/qemuhotplugtestcpus/x86-old-bulk-result-conf.xml
@@ -9,7 +9,7 @@
     <boot dev='network'/>
   </os>
   <cpu>
-    <topology sockets='4' dies='1' cores='2' threads='1'/>
+    <topology sockets='4' dies='1' clusters='1' cores='2' threads='1'/>
   </cpu>
   <clock offset='utc'/>
   <on_poweroff>destroy</on_poweroff>
diff --git a/tests/qemuhotplugtestcpus/x86-old-bulk-result-live.xml b/tests/qemuhotplugtestcpus/x86-old-bulk-result-live.xml
index f81194d..a5087a7 100644
--- a/tests/qemuhotplugtestcpus/x86-old-bulk-result-live.xml
+++ b/tests/qemuhotplugtestcpus/x86-old-bulk-result-live.xml
@@ -9,7 +9,7 @@
     <boot dev='network'/>
   </os>
   <cpu>
-    <topology sockets='4' dies='1' cores='2' threads='1'/>
+    <topology sockets='4' dies='1' clusters='1' cores='2' threads='1'/>
   </cpu>
   <clock offset='utc'/>
   <on_poweroff>destroy</on_poweroff>
diff --git a/tests/qemuxml2argvdata/fd-memory-no-numa-topology.xml b/tests/qemuxml2argvdata/fd-memory-no-numa-topology.xml
index 0749952..d9e20d4 100644
--- a/tests/qemuxml2argvdata/fd-memory-no-numa-topology.xml
+++ b/tests/qemuxml2argvdata/fd-memory-no-numa-topology.xml
@@ -14,7 +14,7 @@
     <boot dev='hd'/>
   </os>
   <cpu>
-    <topology sockets='8' dies='1' cores='1' threads='1'/>
+    <topology sockets='8' dies='1' clusters='1' cores='1' threads='1'/>
   </cpu>
   <clock offset='utc'/>
   <on_poweroff>destroy</on_poweroff>
diff --git a/tests/qemuxml2argvdata/fd-memory-numa-topology.xml b/tests/qemuxml2argvdata/fd-memory-numa-topology.xml
index 05ea164..7e082eb 100644
--- a/tests/qemuxml2argvdata/fd-memory-numa-topology.xml
+++ b/tests/qemuxml2argvdata/fd-memory-numa-topology.xml
@@ -14,7 +14,7 @@
     <boot dev='hd'/>
   </os>
   <cpu>
-    <topology sockets='1' dies='1' cores='8' threads='1'/>
+    <topology sockets='1' dies='1' clusters='1' cores='8' threads='1'/>
     <numa>
       <cell id='0' cpus='0-7' memory='14680064' unit='KiB'/>
     </numa>
diff --git a/tests/qemuxml2argvdata/fd-memory-numa-topology2.xml b/tests/qemuxml2argvdata/fd-memory-numa-topology2.xml
index 904e64f..919b30a 100644
--- a/tests/qemuxml2argvdata/fd-memory-numa-topology2.xml
+++ b/tests/qemuxml2argvdata/fd-memory-numa-topology2.xml
@@ -14,7 +14,7 @@
     <boot dev='hd'/>
   </os>
   <cpu>
-    <topology sockets='1' dies='1' cores='8' threads='1'/>
+    <topology sockets='1' dies='1' clusters='1' cores='8' threads='1'/>
     <numa>
       <cell id='0' cpus='0-7' memory='14680064' unit='KiB'/>
       <cell id='1' cpus='8-15' memory='14680064' unit='KiB' memAccess='shared'/>
diff --git a/tests/qemuxml2argvdata/fd-memory-numa-topology3.xml b/tests/qemuxml2argvdata/fd-memory-numa-topology3.xml
index 9785609..a429a27 100644
--- a/tests/qemuxml2argvdata/fd-memory-numa-topology3.xml
+++ b/tests/qemuxml2argvdata/fd-memory-numa-topology3.xml
@@ -14,7 +14,7 @@
     <boot dev='hd'/>
   </os>
   <cpu>
-    <topology sockets='1' dies='1' cores='24' threads='1'/>
+    <topology sockets='1' dies='1' clusters='1' cores='24' threads='1'/>
     <numa>
       <cell id='0' cpus='0-1' memory='14680064' unit='KiB'/>
       <cell id='1' cpus='2-3' memory='14680064' unit='KiB' memAccess='shared'/>
diff --git a/tests/qemuxml2argvdata/hugepages-nvdimm.xml b/tests/qemuxml2argvdata/hugepages-nvdimm.xml
index 144d02b..f8a5a2f 100644
--- a/tests/qemuxml2argvdata/hugepages-nvdimm.xml
+++ b/tests/qemuxml2argvdata/hugepages-nvdimm.xml
@@ -16,7 +16,7 @@
     <boot dev='hd'/>
   </os>
   <cpu>
-    <topology sockets='2' dies='1' cores='1' threads='1'/>
+    <topology sockets='2' dies='1' clusters='1' cores='1' threads='1'/>
     <numa>
       <cell id='0' cpus='0-1' memory='1048576' unit='KiB'/>
     </numa>
diff --git a/tests/qemuxml2argvdata/memfd-memory-default-hugepage.xml b/tests/qemuxml2argvdata/memfd-memory-default-hugepage.xml
index 69d27ef..f3e155a 100644
--- a/tests/qemuxml2argvdata/memfd-memory-default-hugepage.xml
+++ b/tests/qemuxml2argvdata/memfd-memory-default-hugepage.xml
@@ -18,7 +18,7 @@
     <boot dev='hd'/>
   </os>
   <cpu>
-    <topology sockets='1' dies='1' cores='8' threads='1'/>
+    <topology sockets='1' dies='1' clusters='1' cores='8' threads='1'/>
     <numa>
       <cell id='0' cpus='0-7' memory='14680064' unit='KiB'/>
     </numa>
diff --git a/tests/qemuxml2argvdata/memfd-memory-numa.xml b/tests/qemuxml2argvdata/memfd-memory-numa.xml
index e3d5d92..ed814a0 100644
--- a/tests/qemuxml2argvdata/memfd-memory-numa.xml
+++ b/tests/qemuxml2argvdata/memfd-memory-numa.xml
@@ -20,7 +20,7 @@
     <boot dev='hd'/>
   </os>
   <cpu>
-    <topology sockets='1' dies='1' cores='8' threads='1'/>
+    <topology sockets='1' dies='1' clusters='1' cores='8' threads='1'/>
     <numa>
       <cell id='0' cpus='0-7' memory='14680064' unit='KiB'/>
     </numa>
diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-access.xml b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-access.xml
index a1cc126..5e74f58 100644
--- a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-access.xml
+++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-access.xml
@@ -14,7 +14,7 @@
     <gid start='0' target='1000' count='10'/>
   </idmap>
   <cpu>
-    <topology sockets='2' dies='1' cores='1' threads='1'/>
+    <topology sockets='2' dies='1' clusters='1' cores='1' threads='1'/>
     <numa>
       <cell id='0' cpus='0-1' memory='219136' unit='KiB'/>
     </numa>
diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-align.xml b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-align.xml
index 018a693..c1de357 100644
--- a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-align.xml
+++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-align.xml
@@ -14,7 +14,7 @@
     <gid start='0' target='1000' count='10'/>
   </idmap>
   <cpu>
-    <topology sockets='2' dies='1' cores='1' threads='1'/>
+    <topology sockets='2' dies='1' clusters='1' cores='1' threads='1'/>
     <numa>
       <cell id='0' cpus='0-1' memory='219136' unit='KiB'/>
     </numa>
diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-label.xml b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-label.xml
index c9d54a6..db0d67e 100644
--- a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-label.xml
+++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-label.xml
@@ -14,7 +14,7 @@
     <gid start='0' target='1000' count='10'/>
   </idmap>
   <cpu>
-    <topology sockets='2' dies='1' cores='1' threads='1'/>
+    <topology sockets='2' dies='1' clusters='1' cores='1' threads='1'/>
     <numa>
       <cell id='0' cpus='0-1' memory='219136' unit='KiB'/>
     </numa>
diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-pmem.xml b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-pmem.xml
index 391d70f..bfa1589 100644
--- a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-pmem.xml
+++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-pmem.xml
@@ -14,7 +14,7 @@
     <gid start='0' target='1000' count='10'/>
   </idmap>
   <cpu>
-    <topology sockets='2' dies='1' cores='1' threads='1'/>
+    <topology sockets='2' dies='1' clusters='1' cores='1' threads='1'/>
     <numa>
       <cell id='0' cpus='0-1' memory='219136' unit='KiB'/>
     </numa>
diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-readonly.xml b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-readonly.xml
index 09b2c5c..bff89db 100644
--- a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-readonly.xml
+++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-readonly.xml
@@ -14,7 +14,7 @@
     <gid start='0' target='1000' count='10'/>
   </idmap>
   <cpu>
-    <topology sockets='2' dies='1' cores='1' threads='1'/>
+    <topology sockets='2' dies='1' clusters='1' cores='1' threads='1'/>
     <numa>
       <cell id='0' cpus='0-1' memory='219136' unit='KiB'/>
     </numa>
diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm.xml b/tests/qemuxml2argvdata/memory-hotplug-nvdimm.xml
index a32474d..827a7ca 100644
--- a/tests/qemuxml2argvdata/memory-hotplug-nvdimm.xml
+++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm.xml
@@ -14,7 +14,7 @@
     <gid start='0' target='1000' count='10'/>
   </idmap>
   <cpu>
-    <topology sockets='2' dies='1' cores='1' threads='1'/>
+    <topology sockets='2' dies='1' clusters='1' cores='1' threads='1'/>
     <numa>
       <cell id='0' cpus='0-1' memory='1048576' unit='KiB'/>
     </numa>
diff --git a/tests/qemuxml2xmloutdata/cpu-numa-disjoint.xml b/tests/qemuxml2xmloutdata/cpu-numa-disjoint.xml
index d7f5372..2e4c53c 100644
--- a/tests/qemuxml2xmloutdata/cpu-numa-disjoint.xml
+++ b/tests/qemuxml2xmloutdata/cpu-numa-disjoint.xml
@@ -9,7 +9,7 @@
     <boot dev='network'/>
   </os>
   <cpu>
-    <topology sockets='2' dies='1' cores='4' threads='2'/>
+    <topology sockets='2' dies='1' clusters='1' cores='4' threads='2'/>
     <numa>
       <cell id='0' cpus='0-3,8-11' memory='109550' unit='KiB'/>
       <cell id='1' cpus='4-7,12-15' memory='109550' unit='KiB'/>
diff --git a/tests/qemuxml2xmloutdata/cpu-numa-disordered.xml b/tests/qemuxml2xmloutdata/cpu-numa-disordered.xml
index 487ced1..e5979c3 100644
--- a/tests/qemuxml2xmloutdata/cpu-numa-disordered.xml
+++ b/tests/qemuxml2xmloutdata/cpu-numa-disordered.xml
@@ -9,7 +9,7 @@
     <boot dev='network'/>
   </os>
   <cpu>
-    <topology sockets='2' dies='1' cores='4' threads='2'/>
+    <topology sockets='2' dies='1' clusters='1' cores='4' threads='2'/>
     <numa>
       <cell id='0' cpus='0-5' memory='109550' unit='KiB'/>
       <cell id='1' cpus='11-15' memory='109550' unit='KiB'/>
diff --git a/tests/qemuxml2xmloutdata/cpu-numa-memshared.xml b/tests/qemuxml2xmloutdata/cpu-numa-memshared.xml
index f472bff..f4af5be 100644
--- a/tests/qemuxml2xmloutdata/cpu-numa-memshared.xml
+++ b/tests/qemuxml2xmloutdata/cpu-numa-memshared.xml
@@ -9,7 +9,7 @@
     <boot dev='network'/>
   </os>
   <cpu>
-    <topology sockets='2' dies='1' cores='4' threads='2'/>
+    <topology sockets='2' dies='1' clusters='1' cores='4' threads='2'/>
     <numa>
       <cell id='0' cpus='0-7' memory='109550' unit='KiB' memAccess='shared'/>
       <cell id='1' cpus='8-15' memory='109550' unit='KiB' memAccess='private'/>
diff --git a/tests/qemuxml2xmloutdata/cpu-numa-no-memory-element.xml b/tests/qemuxml2xmloutdata/cpu-numa-no-memory-element.xml
index 2ef7f84..d583f86 100644
--- a/tests/qemuxml2xmloutdata/cpu-numa-no-memory-element.xml
+++ b/tests/qemuxml2xmloutdata/cpu-numa-no-memory-element.xml
@@ -9,7 +9,7 @@
     <boot dev='network'/>
   </os>
   <cpu>
-    <topology sockets='2' dies='1' cores='4' threads='2'/>
+    <topology sockets='2' dies='1' clusters='1' cores='4' threads='2'/>
     <numa>
       <cell id='0' cpus='0-7' memory='109550' unit='KiB'/>
       <cell id='1' cpus='8-15' memory='109550' unit='KiB'/>
diff --git a/tests/qemuxml2xmloutdata/cpu-numa1.xml b/tests/qemuxml2xmloutdata/cpu-numa1.xml
index 2ef7f84..d583f86 100644
--- a/tests/qemuxml2xmloutdata/cpu-numa1.xml
+++ b/tests/qemuxml2xmloutdata/cpu-numa1.xml
@@ -9,7 +9,7 @@
     <boot dev='network'/>
   </os>
   <cpu>
-    <topology sockets='2' dies='1' cores='4' threads='2'/>
+    <topology sockets='2' dies='1' clusters='1' cores='4' threads='2'/>
     <numa>
       <cell id='0' cpus='0-7' memory='109550' unit='KiB'/>
       <cell id='1' cpus='8-15' memory='109550' unit='KiB'/>
diff --git a/tests/qemuxml2xmloutdata/cpu-numa2.xml b/tests/qemuxml2xmloutdata/cpu-numa2.xml
index 2ef7f84..d583f86 100644
--- a/tests/qemuxml2xmloutdata/cpu-numa2.xml
+++ b/tests/qemuxml2xmloutdata/cpu-numa2.xml
@@ -9,7 +9,7 @@
     <boot dev='network'/>
   </os>
   <cpu>
-    <topology sockets='2' dies='1' cores='4' threads='2'/>
+    <topology sockets='2' dies='1' clusters='1' cores='4' threads='2'/>
     <numa>
       <cell id='0' cpus='0-7' memory='109550' unit='KiB'/>
       <cell id='1' cpus='8-15' memory='109550' unit='KiB'/>
diff --git a/tests/qemuxml2xmloutdata/fd-memory-no-numa-topology.xml b/tests/qemuxml2xmloutdata/fd-memory-no-numa-topology.xml
index 0749952..d9e20d4 100644
--- a/tests/qemuxml2xmloutdata/fd-memory-no-numa-topology.xml
+++ b/tests/qemuxml2xmloutdata/fd-memory-no-numa-topology.xml
@@ -14,7 +14,7 @@
     <boot dev='hd'/>
   </os>
   <cpu>
-    <topology sockets='8' dies='1' cores='1' threads='1'/>
+    <topology sockets='8' dies='1' clusters='1' cores='1' threads='1'/>
   </cpu>
   <clock offset='utc'/>
   <on_poweroff>destroy</on_poweroff>
diff --git a/tests/qemuxml2xmloutdata/fd-memory-numa-topology.xml b/tests/qemuxml2xmloutdata/fd-memory-numa-topology.xml
index 05ea164..7e082eb 100644
--- a/tests/qemuxml2xmloutdata/fd-memory-numa-topology.xml
+++ b/tests/qemuxml2xmloutdata/fd-memory-numa-topology.xml
@@ -14,7 +14,7 @@
     <boot dev='hd'/>
   </os>
   <cpu>
-    <topology sockets='1' dies='1' cores='8' threads='1'/>
+    <topology sockets='1' dies='1' clusters='1' cores='8' threads='1'/>
     <numa>
       <cell id='0' cpus='0-7' memory='14680064' unit='KiB'/>
     </numa>
diff --git a/tests/qemuxml2xmloutdata/fd-memory-numa-topology2.xml b/tests/qemuxml2xmloutdata/fd-memory-numa-topology2.xml
index 904e64f..919b30a 100644
--- a/tests/qemuxml2xmloutdata/fd-memory-numa-topology2.xml
+++ b/tests/qemuxml2xmloutdata/fd-memory-numa-topology2.xml
@@ -14,7 +14,7 @@
     <boot dev='hd'/>
   </os>
   <cpu>
-    <topology sockets='1' dies='1' cores='8' threads='1'/>
+    <topology sockets='1' dies='1' clusters='1' cores='8' threads='1'/>
     <numa>
       <cell id='0' cpus='0-7' memory='14680064' unit='KiB'/>
       <cell id='1' cpus='8-15' memory='14680064' unit='KiB' memAccess='shared'/>
diff --git a/tests/qemuxml2xmloutdata/fd-memory-numa-topology3.xml b/tests/qemuxml2xmloutdata/fd-memory-numa-topology3.xml
index 9785609..a429a27 100644
--- a/tests/qemuxml2xmloutdata/fd-memory-numa-topology3.xml
+++ b/tests/qemuxml2xmloutdata/fd-memory-numa-topology3.xml
@@ -14,7 +14,7 @@
     <boot dev='hd'/>
   </os>
   <cpu>
-    <topology sockets='1' dies='1' cores='24' threads='1'/>
+    <topology sockets='1' dies='1' clusters='1' cores='24' threads='1'/>
     <numa>
       <cell id='0' cpus='0-1' memory='14680064' unit='KiB'/>
       <cell id='1' cpus='2-3' memory='14680064' unit='KiB' memAccess='shared'/>
diff --git a/tests/qemuxml2xmloutdata/graphics-spice-timeout.xml b/tests/qemuxml2xmloutdata/graphics-spice-timeout.xml
index 6e23652..f7a7c87 100644
--- a/tests/qemuxml2xmloutdata/graphics-spice-timeout.xml
+++ b/tests/qemuxml2xmloutdata/graphics-spice-timeout.xml
@@ -18,7 +18,7 @@
   <cpu mode='custom' match='exact' check='partial'>
     <model fallback='allow'>core2duo</model>
     <vendor>Intel</vendor>
-    <topology sockets='1' dies='1' cores='2' threads='1'/>
+    <topology sockets='1' dies='1' clusters='1' cores='2' threads='1'/>
     <feature policy='require' name='ds'/>
     <feature policy='require' name='acpi'/>
     <feature policy='require' name='ss'/>
diff --git a/tests/qemuxml2xmloutdata/hugepages-nvdimm.xml b/tests/qemuxml2xmloutdata/hugepages-nvdimm.xml
index 144d02b..f8a5a2f 100644
--- a/tests/qemuxml2xmloutdata/hugepages-nvdimm.xml
+++ b/tests/qemuxml2xmloutdata/hugepages-nvdimm.xml
@@ -16,7 +16,7 @@
     <boot dev='hd'/>
   </os>
   <cpu>
-    <topology sockets='2' dies='1' cores='1' threads='1'/>
+    <topology sockets='2' dies='1' clusters='1' cores='1' threads='1'/>
     <numa>
       <cell id='0' cpus='0-1' memory='1048576' unit='KiB'/>
     </numa>
diff --git a/tests/qemuxml2xmloutdata/memfd-memory-default-hugepage.xml b/tests/qemuxml2xmloutdata/memfd-memory-default-hugepage.xml
index 69d27ef..f3e155a 100644
--- a/tests/qemuxml2xmloutdata/memfd-memory-default-hugepage.xml
+++ b/tests/qemuxml2xmloutdata/memfd-memory-default-hugepage.xml
@@ -18,7 +18,7 @@
     <boot dev='hd'/>
   </os>
   <cpu>
-    <topology sockets='1' dies='1' cores='8' threads='1'/>
+    <topology sockets='1' dies='1' clusters='1' cores='8' threads='1'/>
     <numa>
       <cell id='0' cpus='0-7' memory='14680064' unit='KiB'/>
     </numa>
diff --git a/tests/qemuxml2xmloutdata/memfd-memory-numa.xml b/tests/qemuxml2xmloutdata/memfd-memory-numa.xml
index e3d5d92..ed814a0 100644
--- a/tests/qemuxml2xmloutdata/memfd-memory-numa.xml
+++ b/tests/qemuxml2xmloutdata/memfd-memory-numa.xml
@@ -20,7 +20,7 @@
     <boot dev='hd'/>
   </os>
   <cpu>
-    <topology sockets='1' dies='1' cores='8' threads='1'/>
+    <topology sockets='1' dies='1' clusters='1' cores='8' threads='1'/>
     <numa>
       <cell id='0' cpus='0-7' memory='14680064' unit='KiB'/>
     </numa>
diff --git a/tests/qemuxml2xmloutdata/memory-hotplug-dimm.xml b/tests/qemuxml2xmloutdata/memory-hotplug-dimm.xml
index 326b5c9..378b262 100644
--- a/tests/qemuxml2xmloutdata/memory-hotplug-dimm.xml
+++ b/tests/qemuxml2xmloutdata/memory-hotplug-dimm.xml
@@ -14,7 +14,7 @@
     <gid start='0' target='1000' count='10'/>
   </idmap>
   <cpu>
-    <topology sockets='2' dies='1' cores='1' threads='1'/>
+    <topology sockets='2' dies='1' clusters='1' cores='1' threads='1'/>
     <numa>
       <cell id='0' cpus='0-1' memory='219136' unit='KiB'/>
     </numa>
diff --git a/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-access.xml b/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-access.xml
index a1cc126..5e74f58 100644
--- a/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-access.xml
+++ b/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-access.xml
@@ -14,7 +14,7 @@
     <gid start='0' target='1000' count='10'/>
   </idmap>
   <cpu>
-    <topology sockets='2' dies='1' cores='1' threads='1'/>
+    <topology sockets='2' dies='1' clusters='1' cores='1' threads='1'/>
     <numa>
       <cell id='0' cpus='0-1' memory='219136' unit='KiB'/>
     </numa>
diff --git a/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-align.xml b/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-align.xml
index 018a693..c1de357 100644
--- a/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-align.xml
+++ b/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-align.xml
@@ -14,7 +14,7 @@
     <gid start='0' target='1000' count='10'/>
   </idmap>
   <cpu>
-    <topology sockets='2' dies='1' cores='1' threads='1'/>
+    <topology sockets='2' dies='1' clusters='1' cores='1' threads='1'/>
     <numa>
       <cell id='0' cpus='0-1' memory='219136' unit='KiB'/>
     </numa>
diff --git a/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-label.xml b/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-label.xml
index c9d54a6..db0d67e 100644
--- a/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-label.xml
+++ b/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-label.xml
@@ -14,7 +14,7 @@
     <gid start='0' target='1000' count='10'/>
   </idmap>
   <cpu>
-    <topology sockets='2' dies='1' cores='1' threads='1'/>
+    <topology sockets='2' dies='1' clusters='1' cores='1' threads='1'/>
     <numa>
       <cell id='0' cpus='0-1' memory='219136' unit='KiB'/>
     </numa>
diff --git a/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-pmem.xml b/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-pmem.xml
index 391d70f..bfa1589 100644
--- a/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-pmem.xml
+++ b/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-pmem.xml
@@ -14,7 +14,7 @@
     <gid start='0' target='1000' count='10'/>
   </idmap>
   <cpu>
-    <topology sockets='2' dies='1' cores='1' threads='1'/>
+    <topology sockets='2' dies='1' clusters='1' cores='1' threads='1'/>
     <numa>
       <cell id='0' cpus='0-1' memory='219136' unit='KiB'/>
     </numa>
diff --git a/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-ppc64.xml b/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-ppc64.xml
index ae5a17d..e90b462 100644
--- a/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-ppc64.xml
+++ b/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-ppc64.xml
@@ -10,7 +10,7 @@
     <boot dev='hd'/>
   </os>
   <cpu>
-    <topology sockets='2' dies='1' cores='1' threads='1'/>
+    <topology sockets='2' dies='1' clusters='1' cores='1' threads='1'/>
     <numa>
       <cell id='0' cpus='0-1' memory='1048576' unit='KiB'/>
     </numa>
diff --git a/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-readonly.xml b/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-readonly.xml
index 09b2c5c..bff89db 100644
--- a/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-readonly.xml
+++ b/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-readonly.xml
@@ -14,7 +14,7 @@
     <gid start='0' target='1000' count='10'/>
   </idmap>
   <cpu>
-    <topology sockets='2' dies='1' cores='1' threads='1'/>
+    <topology sockets='2' dies='1' clusters='1' cores='1' threads='1'/>
     <numa>
       <cell id='0' cpus='0-1' memory='219136' unit='KiB'/>
     </numa>
diff --git a/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm.xml b/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm.xml
index a32474d..827a7ca 100644
--- a/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm.xml
+++ b/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm.xml
@@ -14,7 +14,7 @@
     <gid start='0' target='1000' count='10'/>
   </idmap>
   <cpu>
-    <topology sockets='2' dies='1' cores='1' threads='1'/>
+    <topology sockets='2' dies='1' clusters='1' cores='1' threads='1'/>
     <numa>
       <cell id='0' cpus='0-1' memory='1048576' unit='KiB'/>
     </numa>
diff --git a/tests/qemuxml2xmloutdata/memory-hotplug.xml b/tests/qemuxml2xmloutdata/memory-hotplug.xml
index 0e5295d..547f613 100644
--- a/tests/qemuxml2xmloutdata/memory-hotplug.xml
+++ b/tests/qemuxml2xmloutdata/memory-hotplug.xml
@@ -10,7 +10,7 @@
     <boot dev='hd'/>
   </os>
   <cpu>
-    <topology sockets='2' dies='1' cores='1' threads='1'/>
+    <topology sockets='2' dies='1' clusters='1' cores='1' threads='1'/>
     <numa>
       <cell id='0' cpus='0-1' memory='219136' unit='KiB'/>
     </numa>
diff --git a/tests/qemuxml2xmloutdata/numad-auto-memory-vcpu-cpuset.xml b/tests/qemuxml2xmloutdata/numad-auto-memory-vcpu-cpuset.xml
index 841ea69..f438a7c 100644
--- a/tests/qemuxml2xmloutdata/numad-auto-memory-vcpu-cpuset.xml
+++ b/tests/qemuxml2xmloutdata/numad-auto-memory-vcpu-cpuset.xml
@@ -12,7 +12,7 @@
     <boot dev='hd'/>
   </os>
   <cpu>
-    <topology sockets='2' dies='1' cores='1' threads='1'/>
+    <topology sockets='2' dies='1' clusters='1' cores='1' threads='1'/>
   </cpu>
   <clock offset='utc'/>
   <on_poweroff>destroy</on_poweroff>
diff --git a/tests/qemuxml2xmloutdata/numad-auto-memory-vcpu-no-cpuset-and-placement.xml b/tests/qemuxml2xmloutdata/numad-auto-memory-vcpu-no-cpuset-and-placement.xml
index 2e3998e..4d37383 100644
--- a/tests/qemuxml2xmloutdata/numad-auto-memory-vcpu-no-cpuset-and-placement.xml
+++ b/tests/qemuxml2xmloutdata/numad-auto-memory-vcpu-no-cpuset-and-placement.xml
@@ -12,7 +12,7 @@
     <boot dev='hd'/>
   </os>
   <cpu>
-    <topology sockets='2' dies='1' cores='1' threads='1'/>
+    <topology sockets='2' dies='1' clusters='1' cores='1' threads='1'/>
   </cpu>
   <clock offset='utc'/>
   <on_poweroff>destroy</on_poweroff>
diff --git a/tests/qemuxml2xmloutdata/numad-auto-vcpu-no-numatune.xml b/tests/qemuxml2xmloutdata/numad-auto-vcpu-no-numatune.xml
index 7c1f18c..051606f 100644
--- a/tests/qemuxml2xmloutdata/numad-auto-vcpu-no-numatune.xml
+++ b/tests/qemuxml2xmloutdata/numad-auto-vcpu-no-numatune.xml
@@ -12,7 +12,7 @@
     <boot dev='hd'/>
   </os>
   <cpu>
-    <topology sockets='2' dies='1' cores='1' threads='1'/>
+    <topology sockets='2' dies='1' clusters='1' cores='1' threads='1'/>
   </cpu>
   <clock offset='utc'/>
   <on_poweroff>destroy</on_poweroff>
diff --git a/tests/qemuxml2xmloutdata/numad-static-vcpu-no-numatune.xml b/tests/qemuxml2xmloutdata/numad-static-vcpu-no-numatune.xml
index 3d05790..2479852 100644
--- a/tests/qemuxml2xmloutdata/numad-static-vcpu-no-numatune.xml
+++ b/tests/qemuxml2xmloutdata/numad-static-vcpu-no-numatune.xml
@@ -9,7 +9,7 @@
     <boot dev='hd'/>
   </os>
   <cpu>
-    <topology sockets='2' dies='1' cores='1' threads='1'/>
+    <topology sockets='2' dies='1' clusters='1' cores='1' threads='1'/>
   </cpu>
   <clock offset='utc'/>
   <on_poweroff>destroy</on_poweroff>
diff --git a/tests/qemuxml2xmloutdata/pci-expander-bus.xml b/tests/qemuxml2xmloutdata/pci-expander-bus.xml
index 60e4e4a..6f8103b 100644
--- a/tests/qemuxml2xmloutdata/pci-expander-bus.xml
+++ b/tests/qemuxml2xmloutdata/pci-expander-bus.xml
@@ -9,7 +9,7 @@
     <boot dev='hd'/>
   </os>
   <cpu>
-    <topology sockets='2' dies='1' cores='4' threads='2'/>
+    <topology sockets='2' dies='1' clusters='1' cores='4' threads='2'/>
     <numa>
       <cell id='0' cpus='0-7' memory='109550' unit='KiB'/>
       <cell id='1' cpus='8-15' memory='109550' unit='KiB'/>
diff --git a/tests/qemuxml2xmloutdata/pcie-expander-bus.xml b/tests/qemuxml2xmloutdata/pcie-expander-bus.xml
index 452d476..80d5ece 100644
--- a/tests/qemuxml2xmloutdata/pcie-expander-bus.xml
+++ b/tests/qemuxml2xmloutdata/pcie-expander-bus.xml
@@ -9,7 +9,7 @@
     <boot dev='hd'/>
   </os>
   <cpu>
-    <topology sockets='2' dies='1' cores='4' threads='2'/>
+    <topology sockets='2' dies='1' clusters='1' cores='4' threads='2'/>
     <numa>
       <cell id='0' cpus='0-7' memory='109550' unit='KiB'/>
       <cell id='1' cpus='8-15' memory='109550' unit='KiB'/>
diff --git a/tests/qemuxml2xmloutdata/pseries-phb-numa-node.xml b/tests/qemuxml2xmloutdata/pseries-phb-numa-node.xml
index b05ac33..35c0e18 100644
--- a/tests/qemuxml2xmloutdata/pseries-phb-numa-node.xml
+++ b/tests/qemuxml2xmloutdata/pseries-phb-numa-node.xml
@@ -13,7 +13,7 @@
     <boot dev='hd'/>
   </os>
   <cpu>
-    <topology sockets='2' dies='1' cores='1' threads='4'/>
+    <topology sockets='2' dies='1' clusters='1' cores='1' threads='4'/>
     <numa>
       <cell id='0' cpus='0-3' memory='1048576' unit='KiB'/>
       <cell id='1' cpus='4-7' memory='1048576' unit='KiB'/>
diff --git a/tests/qemuxml2xmloutdata/smp.xml b/tests/qemuxml2xmloutdata/smp.xml
index 3e00f57..0816d5f 100644
--- a/tests/qemuxml2xmloutdata/smp.xml
+++ b/tests/qemuxml2xmloutdata/smp.xml
@@ -9,7 +9,7 @@
     <boot dev='hd'/>
   </os>
   <cpu>
-    <topology sockets='2' dies='1' cores='1' threads='1'/>
+    <topology sockets='2' dies='1' clusters='1' cores='1' threads='1'/>
   </cpu>
   <clock offset='utc'/>
   <on_poweroff>destroy</on_poweroff>
diff --git a/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-8.xml b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-8.xml
index 2011bfb..4b1a9d1 100644
--- a/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-8.xml
+++ b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-8.xml
@@ -11,7 +11,7 @@
     <type arch='x86_64'>hvm</type>
   </os>
   <cpu>
-    <topology sockets='4' dies='1' cores='2' threads='1'/>
+    <topology sockets='4' dies='1' clusters='1' cores='2' threads='1'/>
   </cpu>
   <clock offset='utc'/>
   <on_poweroff>destroy</on_poweroff>
diff --git a/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-9.xml b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-9.xml
index fa428c1..f7b6eb6 100644
--- a/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-9.xml
+++ b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-9.xml
@@ -12,7 +12,7 @@
     <type arch='x86_64'>hvm</type>
   </os>
   <cpu>
-    <topology sockets='4' dies='1' cores='4' threads='1'/>
+    <topology sockets='4' dies='1' clusters='1' cores='4' threads='1'/>
   </cpu>
   <clock offset='utc'/>
   <on_poweroff>destroy</on_poweroff>
-- 
2.25.1

