import libvirt-8.0.0-5.module+el8.6.0+14480+c0a3aa0f

This commit is contained in:
CentOS Sources 2022-05-10 03:04:06 -04:00 committed by Stepan Oksanichenko
parent 8331a2073e
commit 9612d948f4
558 changed files with 2490 additions and 167593 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
SOURCES/libvirt-6.0.0.tar.xz
SOURCES/libvirt-8.0.0.tar.xz

View File

@ -1 +1 @@
9939a559e652d44b27e3404a26bcabe58988e4b4 SOURCES/libvirt-6.0.0.tar.xz
e440412e9b45d7e24f0ef492d8edf5cf2cbd3f4c SOURCES/libvirt-8.0.0.tar.xz

File diff suppressed because it is too large Load Diff

View File

@ -1,456 +0,0 @@
From 5f6723e71e3765d1d43bfa9ba1c66e0e05e11a48 Mon Sep 17 00:00:00 2001
Message-Id: <5f6723e71e3765d1d43bfa9ba1c66e0e05e11a48@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Mon, 9 Nov 2020 17:22:32 +0100
Subject: [PATCH] Allow NUMA nodes without vCPUs
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
QEMU allows creating NUMA nodes that have memory only.
These are somehow important for HMAT.
With check done in qemuValidateDomainDef() for QEMU 2.7 or newer
(checked via QEMU_CAPS_NUMA), we can be sure that the vCPUs are
fully assigned to NUMA nodes in domain XML.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
(cherry picked from commit a26f61ee0cffa421b87ef568002b684dd8025432)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1749518
Conflicts:
- src/qemu/qemu_validate.c: This file doesn't exist in downstream
yet, so I've moved the change that original patch would do to
qemu_domain.c where the validator lives.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Message-Id: <365508c75e579e9037ad555d6c372068ccd50c95.1604938867.git.mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
docs/formatdomain.html.in | 2 +
docs/schemas/cputypes.rng | 8 ++-
src/conf/numa_conf.c | 59 ++++++++++---------
src/libxl/xen_xl.c | 10 ++--
src/qemu/qemu_command.c | 26 ++++----
src/qemu/qemu_domain.c | 22 +++----
tests/qemuxml2argvdata/numatune-no-vcpu.args | 33 +++++++++++
tests/qemuxml2argvdata/numatune-no-vcpu.xml | 42 +++++++++++++
tests/qemuxml2argvtest.c | 1 +
tests/qemuxml2xmloutdata/numatune-no-vcpu.xml | 1 +
tests/qemuxml2xmltest.c | 1 +
11 files changed, 149 insertions(+), 56 deletions(-)
create mode 100644 tests/qemuxml2argvdata/numatune-no-vcpu.args
create mode 100644 tests/qemuxml2argvdata/numatune-no-vcpu.xml
create mode 120000 tests/qemuxml2xmloutdata/numatune-no-vcpu.xml
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 76799f5ffc..4b8d312596 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -1783,6 +1783,8 @@
<code>cpus</code> specifies the CPU or range of CPUs that are
part of the node. <code>memory</code> specifies the node memory
in kibibytes (i.e. blocks of 1024 bytes).
+ <span class="since">Since 6.6.0</span> the <code>cpus</code> attribute
+ is optional and if omitted a CPU-less NUMA node is created.
<span class="since">Since 1.2.11</span> one can use an additional <a
href="#elementsMemoryAllocation"><code>unit</code></a> attribute to
define units in which <code>memory</code> is specified.
diff --git a/docs/schemas/cputypes.rng b/docs/schemas/cputypes.rng
index e2744acad3..a1682a1003 100644
--- a/docs/schemas/cputypes.rng
+++ b/docs/schemas/cputypes.rng
@@ -115,9 +115,11 @@
<ref name="unsignedInt"/>
</attribute>
</optional>
- <attribute name="cpus">
- <ref name="cpuset"/>
- </attribute>
+ <optional>
+ <attribute name="cpus">
+ <ref name="cpuset"/>
+ </attribute>
+ </optional>
<attribute name="memory">
<ref name="memoryKB"/>
</attribute>
diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c
index c9cc8ac22e..a805336d16 100644
--- a/src/conf/numa_conf.c
+++ b/src/conf/numa_conf.c
@@ -889,32 +889,28 @@ virDomainNumaDefParseXML(virDomainNumaPtr def,
}
VIR_FREE(tmp);
- if (def->mem_nodes[cur_cell].cpumask) {
+ if (def->mem_nodes[cur_cell].mem) {
virReportError(VIR_ERR_XML_ERROR,
_("Duplicate NUMA cell info for cell id '%u'"),
cur_cell);
goto cleanup;
}
- if (!(tmp = virXMLPropString(nodes[i], "cpus"))) {
- virReportError(VIR_ERR_XML_ERROR, "%s",
- _("Missing 'cpus' attribute in NUMA cell"));
- goto cleanup;
- }
+ if ((tmp = virXMLPropString(nodes[i], "cpus"))) {
+ g_autoptr(virBitmap) cpumask = NULL;
- if (virBitmapParse(tmp, &def->mem_nodes[cur_cell].cpumask,
- VIR_DOMAIN_CPUMASK_LEN) < 0)
- goto cleanup;
+ if (virBitmapParse(tmp, &cpumask, VIR_DOMAIN_CPUMASK_LEN) < 0)
+ goto cleanup;
- if (virBitmapIsAllClear(def->mem_nodes[cur_cell].cpumask)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("NUMA cell %d has no vCPUs assigned"), cur_cell);
- goto cleanup;
+ if (!virBitmapIsAllClear(cpumask))
+ def->mem_nodes[cur_cell].cpumask = g_steal_pointer(&cpumask);
+ VIR_FREE(tmp);
}
- VIR_FREE(tmp);
for (j = 0; j < n; j++) {
- if (j == cur_cell || !def->mem_nodes[j].cpumask)
+ if (j == cur_cell ||
+ !def->mem_nodes[j].cpumask ||
+ !def->mem_nodes[cur_cell].cpumask)
continue;
if (virBitmapOverlaps(def->mem_nodes[j].cpumask,
@@ -976,7 +972,6 @@ virDomainNumaDefFormatXML(virBufferPtr buf,
{
virDomainMemoryAccess memAccess;
virTristateBool discard;
- char *cpustr;
size_t ncells = virDomainNumaGetNodeCount(def);
size_t i;
@@ -986,17 +981,22 @@ virDomainNumaDefFormatXML(virBufferPtr buf,
virBufferAddLit(buf, "<numa>\n");
virBufferAdjustIndent(buf, 2);
for (i = 0; i < ncells; i++) {
+ virBitmapPtr cpumask = virDomainNumaGetNodeCpumask(def, i);
int ndistances;
memAccess = virDomainNumaGetNodeMemoryAccessMode(def, i);
discard = virDomainNumaGetNodeDiscard(def, i);
- if (!(cpustr = virBitmapFormat(virDomainNumaGetNodeCpumask(def, i))))
- return -1;
-
virBufferAddLit(buf, "<cell");
virBufferAsprintf(buf, " id='%zu'", i);
- virBufferAsprintf(buf, " cpus='%s'", cpustr);
+
+ if (cpumask) {
+ g_autofree char *cpustr = virBitmapFormat(cpumask);
+
+ if (!cpustr)
+ return -1;
+ virBufferAsprintf(buf, " cpus='%s'", cpustr);
+ }
virBufferAsprintf(buf, " memory='%llu'",
virDomainNumaGetNodeMemorySize(def, i));
virBufferAddLit(buf, " unit='KiB'");
@@ -1032,8 +1032,6 @@ virDomainNumaDefFormatXML(virBufferPtr buf,
virBufferAdjustIndent(buf, -2);
virBufferAddLit(buf, "</cell>\n");
}
-
- VIR_FREE(cpustr);
}
virBufferAdjustIndent(buf, -2);
virBufferAddLit(buf, "</numa>\n");
@@ -1048,8 +1046,12 @@ virDomainNumaGetCPUCountTotal(virDomainNumaPtr numa)
size_t i;
unsigned int ret = 0;
- for (i = 0; i < numa->nmem_nodes; i++)
- ret += virBitmapCountBits(virDomainNumaGetNodeCpumask(numa, i));
+ for (i = 0; i < numa->nmem_nodes; i++) {
+ virBitmapPtr cpumask = virDomainNumaGetNodeCpumask(numa, i);
+
+ if (cpumask)
+ ret += virBitmapCountBits(cpumask);
+ }
return ret;
}
@@ -1061,11 +1063,14 @@ virDomainNumaGetMaxCPUID(virDomainNumaPtr numa)
unsigned int ret = 0;
for (i = 0; i < numa->nmem_nodes; i++) {
+ virBitmapPtr cpumask = virDomainNumaGetNodeCpumask(numa, i);
int bit;
- bit = virBitmapLastSetBit(virDomainNumaGetNodeCpumask(numa, i));
- if (bit > ret)
- ret = bit;
+ if (cpumask) {
+ bit = virBitmapLastSetBit(cpumask);
+ if (bit > ret)
+ ret = bit;
+ }
}
return ret;
diff --git a/src/libxl/xen_xl.c b/src/libxl/xen_xl.c
index edea30a86a..752fa925ec 100644
--- a/src/libxl/xen_xl.c
+++ b/src/libxl/xen_xl.c
@@ -1443,19 +1443,21 @@ xenFormatXLVnuma(virConfValuePtr list,
{
int ret = -1;
size_t i;
-
virBuffer buf = VIR_BUFFER_INITIALIZER;
virConfValuePtr numaVnode, tmp;
-
+ virBitmapPtr cpumask = virDomainNumaGetNodeCpumask(numa, node);
size_t nodeSize = virDomainNumaGetNodeMemorySize(numa, node) / 1024;
- char *nodeVcpus = virBitmapFormat(virDomainNumaGetNodeCpumask(numa, node));
+ g_autofree char *nodeVcpus = NULL;
- if (VIR_ALLOC(numaVnode) < 0)
+ if (!cpumask ||
+ VIR_ALLOC(numaVnode) < 0)
goto cleanup;
numaVnode->type = VIR_CONF_LIST;
numaVnode->list = NULL;
+ nodeVcpus = virBitmapFormat(cpumask);
+
/* pnode */
virBufferAsprintf(&buf, "pnode=%zu", node);
xenFormatXLVnode(numaVnode, &buf);
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 1a573c2817..ac63d18a42 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7364,8 +7364,6 @@ qemuBuildNumaCommandLine(virQEMUDriverConfigPtr cfg,
size_t i, j;
virQEMUCapsPtr qemuCaps = priv->qemuCaps;
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
- char *cpumask = NULL;
- char *tmpmask = NULL;
char *next = NULL;
virBufferPtr nodeBackends = NULL;
bool needBackend = false;
@@ -7400,9 +7398,7 @@ qemuBuildNumaCommandLine(virQEMUDriverConfigPtr cfg,
goto cleanup;
for (i = 0; i < ncells; i++) {
- VIR_FREE(cpumask);
- if (!(cpumask = virBitmapFormat(virDomainNumaGetNodeCpumask(def->numa, i))))
- goto cleanup;
+ virBitmapPtr cpumask = virDomainNumaGetNodeCpumask(def->numa, i);
if (needBackend) {
virCommandAddArg(cmd, "-object");
@@ -7412,11 +7408,19 @@ qemuBuildNumaCommandLine(virQEMUDriverConfigPtr cfg,
virCommandAddArg(cmd, "-numa");
virBufferAsprintf(&buf, "node,nodeid=%zu", i);
- for (tmpmask = cpumask; tmpmask; tmpmask = next) {
- if ((next = strchr(tmpmask, ',')))
- *(next++) = '\0';
- virBufferAddLit(&buf, ",cpus=");
- virBufferAdd(&buf, tmpmask, -1);
+ if (cpumask) {
+ g_autofree char *cpumaskStr = NULL;
+ char *tmpmask;
+
+ if (!(cpumaskStr = virBitmapFormat(cpumask)))
+ goto cleanup;
+
+ for (tmpmask = cpumaskStr; tmpmask; tmpmask = next) {
+ if ((next = strchr(tmpmask, ',')))
+ *(next++) = '\0';
+ virBufferAddLit(&buf, ",cpus=");
+ virBufferAdd(&buf, tmpmask, -1);
+ }
}
if (needBackend)
@@ -7447,8 +7451,6 @@ qemuBuildNumaCommandLine(virQEMUDriverConfigPtr cfg,
ret = 0;
cleanup:
- VIR_FREE(cpumask);
-
if (nodeBackends) {
for (i = 0; i < ncells; i++)
virBufferFreeAndReset(&nodeBackends[i]);
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 35b536868a..be25790f12 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -5373,7 +5373,7 @@ qemuDomainDefValidateNuma(const virDomainDef *def,
}
for (i = 0; i < ncells; i++) {
- g_autofree char * cpumask = NULL;
+ virBitmapPtr cpumask = virDomainNumaGetNodeCpumask(def->numa, i);
if (!hasMemoryCap &&
virDomainNumaGetNodeMemoryAccessMode(def->numa, i)) {
@@ -5383,17 +5383,19 @@ qemuDomainDefValidateNuma(const virDomainDef *def,
return -1;
}
- if (!(cpumask = virBitmapFormat(virDomainNumaGetNodeCpumask(def->numa, i))))
- return -1;
+ if (cpumask) {
+ g_autofree char * cpumaskStr = NULL;
+ if (!(cpumaskStr = virBitmapFormat(cpumask)))
+ return -1;
- if (strchr(cpumask, ',') &&
- !virQEMUCapsGet(qemuCaps, QEMU_CAPS_NUMA)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("disjoint NUMA cpu ranges are not supported "
- "with this QEMU"));
- return -1;
+ if (strchr(cpumaskStr, ',') &&
+ !virQEMUCapsGet(qemuCaps, QEMU_CAPS_NUMA)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("disjoint NUMA cpu ranges are not supported "
+ "with this QEMU"));
+ return -1;
+ }
}
-
}
if (virDomainNumaNodesDistancesAreBeingSet(def->numa) &&
diff --git a/tests/qemuxml2argvdata/numatune-no-vcpu.args b/tests/qemuxml2argvdata/numatune-no-vcpu.args
new file mode 100644
index 0000000000..a1f1ee044e
--- /dev/null
+++ b/tests/qemuxml2argvdata/numatune-no-vcpu.args
@@ -0,0 +1,33 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/tmp/lib/domain--1-QEMUGuest \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest/.local/share \
+XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest/.cache \
+XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest/.config \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-x86_64 \
+-name QEMUGuest \
+-S \
+-machine pc,accel=tcg,usb=off,dump-guest-core=off \
+-m 12288 \
+-realtime mlock=off \
+-smp 12,sockets=12,cores=1,threads=1 \
+-numa node,nodeid=0,cpus=0-3,mem=2048 \
+-numa node,nodeid=1,cpus=4-7,mem=2048 \
+-numa node,nodeid=2,cpus=8-11,mem=2048 \
+-numa node,nodeid=3,mem=2048 \
+-numa node,nodeid=4,mem=2048 \
+-numa node,nodeid=5,mem=2048 \
+-uuid c7a5fdb2-cdaf-9455-926a-d65c16db1809 \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest/monitor.sock,\
+server,nowait \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-usb \
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/numatune-no-vcpu.xml b/tests/qemuxml2argvdata/numatune-no-vcpu.xml
new file mode 100644
index 0000000000..f25a07d7ed
--- /dev/null
+++ b/tests/qemuxml2argvdata/numatune-no-vcpu.xml
@@ -0,0 +1,42 @@
+<domain type='qemu'>
+ <name>QEMUGuest</name>
+ <uuid>c7a5fdb2-cdaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>12582912</memory>
+ <currentMemory unit='KiB'>12582912</currentMemory>
+ <vcpu placement='static'>12</vcpu>
+ <os>
+ <type arch='x86_64' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <features>
+ <acpi/>
+ <apic/>
+ <pae/>
+ </features>
+ <cpu>
+ <numa>
+ <cell id='0' cpus='0-3' memory='2097152' unit='KiB'/>
+ <cell id='1' cpus='4-7' memory='2097152' unit='KiB'/>
+ <cell id='2' cpus='8-11' memory='2097152' unit='KiB'/>
+ <cell id='3' memory='2097152' unit='KiB'/>
+ <cell id='4' memory='2097152' unit='KiB'/>
+ <cell id='5' memory='2097152' unit='KiB'/>
+ </numa>
+ </cpu>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>restart</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-system-x86_64</emulator>
+ <controller type='usb' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+ </controller>
+ <controller type='pci' index='0' model='pci-root'/>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <memballoon model='virtio'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+ </memballoon>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index ff92af606d..49699e495d 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1812,6 +1812,7 @@ mymain(void)
DO_TEST_PARSE_ERROR("numatune-memnode-no-memory", NONE);
DO_TEST("numatune-distances", QEMU_CAPS_NUMA, QEMU_CAPS_NUMA_DIST);
+ DO_TEST("numatune-no-vcpu", NONE);
DO_TEST("numatune-auto-nodeset-invalid", NONE);
DO_TEST("numatune-auto-prefer", QEMU_CAPS_OBJECT_MEMORY_RAM,
diff --git a/tests/qemuxml2xmloutdata/numatune-no-vcpu.xml b/tests/qemuxml2xmloutdata/numatune-no-vcpu.xml
new file mode 120000
index 0000000000..f213032685
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/numatune-no-vcpu.xml
@@ -0,0 +1 @@
+../qemuxml2argvdata/numatune-no-vcpu.xml
\ No newline at end of file
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 6c3f5c4a9e..1ddeba30f0 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -1105,6 +1105,7 @@ mymain(void)
DO_TEST("numatune-memnode", QEMU_CAPS_NUMA, QEMU_CAPS_OBJECT_MEMORY_FILE);
DO_TEST("numatune-memnode-no-memory", QEMU_CAPS_OBJECT_MEMORY_FILE);
DO_TEST("numatune-distances", QEMU_CAPS_NUMA, QEMU_CAPS_NUMA_DIST);
+ DO_TEST("numatune-no-vcpu", QEMU_CAPS_NUMA);
DO_TEST("bios-nvram", NONE);
DO_TEST("bios-nvram-os-interleave", NONE);
--
2.29.2

View File

@ -1,5 +1,5 @@
From a04fcb5b463c90c47705ca0f28e40b73c00b6b72 Mon Sep 17 00:00:00 2001
Message-Id: <a04fcb5b463c90c47705ca0f28e40b73c00b6b72@dist-git>
From f0d0a6a9701522eee013682eb0ef566ef7cdac61 Mon Sep 17 00:00:00 2001
Message-Id: <f0d0a6a9701522eee013682eb0ef566ef7cdac61@dist-git>
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
Date: Mon, 22 Feb 2016 12:51:51 +0100
Subject: [PATCH] RHEL: Add rhel machine types to qemuDomainMachineNeedsFDC
@ -13,24 +13,35 @@ https://bugzilla.redhat.com/show_bug.cgi?id=1227880
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
src/qemu/qemu_domain.c | 4 ++++
1 file changed, 4 insertions(+)
src/qemu/qemu_domain.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index a6dde15bad..0edf316fff 100644
index a8401bac30..40fe9985e6 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -12631,6 +12631,10 @@ qemuDomainMachineNeedsFDC(const char *machine,
return false;
}
+ if (STRPREFIX(p, "rhel7.0.0") ||
+ STRPREFIX(p, "rhel7.1.0"))
@@ -8767,8 +8767,19 @@ qemuDomainHasBuiltinIDE(const virDomainDef *def)
bool
qemuDomainNeedsFDC(const virDomainDef *def)
{
- /* all supported Q35 machines need explicit FDC */
- return qemuDomainIsQ35(def);
+ const char *p;
+
+ /* all supported Q35 machines need explicit FDC except for old RHEL-7
+ * machine types */
+ if (!qemuDomainIsQ35(def))
+ return false;
+
return true;
+ if ((p = STRSKIP(def->os.machine, "pc-q35-")) &&
+ (STRPREFIX(p, "rhel7.0.0") ||
+ STRPREFIX(p, "rhel7.1.0")))
+ return false;
+
+ return true;
}
--
2.25.0
--
2.34.1

View File

@ -0,0 +1,257 @@
From b2529d5ff3a18a2b0022da75431cea5bf037819e Mon Sep 17 00:00:00 2001
Message-Id: <b2529d5ff3a18a2b0022da75431cea5bf037819e@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Wed, 28 Jul 2021 17:37:21 +0200
Subject: [PATCH] RHEL: Enable usage of x-blockdev-reopen
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
RHEL-only
Introduce a new capability QEMU_CAPS_BLOCKDEV_REOPEN_COM_REDHAT_AV_8_2_0_API
based on the presence of '__com.redhat_rhel-av-8_2_0-api' feature for
'x-blockdev-reopen' which states that reopen works for what libvirt
is going to use it and wire up code to call the x- prefixed command.
This implementation will become dormant once qemu starts supporting
upstream-stable blockdev-reopen.
https://bugzilla.redhat.com/show_bug.cgi?id=1799013
Starting with libvirt-7.6, upstream has adapted to the new format of
arguments so this patch was modified to support blockdev-reopen which
takes an array of nodes to reopen.
https://bugzilla.redhat.com/show_bug.cgi?id=1929765
Message-Id: <3fcde2fc6add36d5276ae224caf18adc8bca7d48.1627486352.git.pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/qemu/qemu_block.c | 24 +++++++++++++++---------
src/qemu/qemu_block.h | 3 ++-
src/qemu/qemu_capabilities.c | 13 +++++++++++++
src/qemu/qemu_capabilities.h | 3 +++
src/qemu/qemu_monitor.c | 5 +++--
src/qemu/qemu_monitor.h | 3 ++-
src/qemu/qemu_monitor_json.c | 12 +++++++++---
src/qemu/qemu_monitor_json.h | 3 ++-
tests/qemumonitorjsontest.c | 2 +-
9 files changed, 50 insertions(+), 18 deletions(-)
diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
index e5ff653a60..aa566d0097 100644
--- a/src/qemu/qemu_block.c
+++ b/src/qemu/qemu_block.c
@@ -3331,7 +3331,8 @@ qemuBlockBitmapsHandleCommitFinish(virStorageSource *topsrc,
int
qemuBlockReopenFormatMon(qemuMonitor *mon,
- virStorageSource *src)
+ virStorageSource *src,
+ bool downstream)
{
g_autoptr(virJSONValue) reopenprops = NULL;
g_autoptr(virJSONValue) srcprops = NULL;
@@ -3340,15 +3341,19 @@ qemuBlockReopenFormatMon(qemuMonitor *mon,
if (!(srcprops = qemuBlockStorageSourceGetBlockdevProps(src, src->backingStore)))
return -1;
- if (virJSONValueArrayAppend(reopenoptions, &srcprops) < 0)
- return -1;
+ if (downstream) {
+ reopenprops = g_steal_pointer(&srcprops);
+ } else {
+ if (virJSONValueArrayAppend(reopenoptions, &srcprops) < 0)
+ return -1;
- if (virJSONValueObjectAdd(&reopenprops,
- "a:options", &reopenoptions,
- NULL) < 0)
- return -1;
+ if (virJSONValueObjectAdd(&reopenprops,
+ "a:options", &reopenoptions,
+ NULL) < 0)
+ return -1;
+ }
- if (qemuMonitorBlockdevReopen(mon, &reopenprops) < 0)
+ if (qemuMonitorBlockdevReopen(mon, &reopenprops, downstream) < 0)
return -1;
return 0;
@@ -3372,6 +3377,7 @@ qemuBlockReopenFormat(virDomainObj *vm,
{
qemuDomainObjPrivate *priv = vm->privateData;
virQEMUDriver *driver = priv->driver;
+ bool downstream = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV_REOPEN_COM_REDHAT_AV_8_2_0_API);
int rc;
/* If we are lacking the object here, qemu might have opened an image with
@@ -3385,7 +3391,7 @@ qemuBlockReopenFormat(virDomainObj *vm,
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
return -1;
- rc = qemuBlockReopenFormatMon(priv->mon, src);
+ rc = qemuBlockReopenFormatMon(priv->mon, src, downstream);
qemuDomainObjExitMonitor(driver, vm);
if (rc < 0)
diff --git a/src/qemu/qemu_block.h b/src/qemu/qemu_block.h
index 184a549d5c..130cfcdefd 100644
--- a/src/qemu/qemu_block.h
+++ b/src/qemu/qemu_block.h
@@ -267,7 +267,8 @@ qemuBlockBitmapsHandleCommitFinish(virStorageSource *topsrc,
/* only for use in qemumonitorjsontest */
int
qemuBlockReopenFormatMon(qemuMonitor *mon,
- virStorageSource *src);
+ virStorageSource *src,
+ bool downstream);
int
qemuBlockReopenReadWrite(virDomainObj *vm,
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 5f1eb5014c..8ae80ef8d7 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -654,6 +654,9 @@ VIR_ENUM_IMPL(virQEMUCaps,
"rbd-encryption", /* QEMU_CAPS_RBD_ENCRYPTION */
"sev-guest-kernel-hashes", /* QEMU_CAPS_SEV_GUEST_KERNEL_HASHES */
"sev-inject-launch-secret", /* QEMU_CAPS_SEV_INJECT_LAUNCH_SECRET */
+
+ /* 420 */
+ "blockdev-reopen.__com.redhat_rhel-av-8_2_0-api", /* QEMU_CAPS_BLOCKDEV_REOPEN_COM_REDHAT_AV_8_2_0_API */
);
@@ -1540,6 +1543,7 @@ static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsVhostUserFS[] =
/* see documentation for virQEMUQAPISchemaPathGet for the query format */
static struct virQEMUCapsStringFlags virQEMUCapsQMPSchemaQueries[] = {
{ "block-commit/arg-type/*top", QEMU_CAPS_ACTIVE_COMMIT },
+ { "x-blockdev-reopen/$__com.redhat_rhel-av-8_2_0-api", QEMU_CAPS_BLOCKDEV_REOPEN_COM_REDHAT_AV_8_2_0_API },
{ "blockdev-add/arg-type/options/+gluster/debug-level", QEMU_CAPS_GLUSTER_DEBUG_LEVEL},
{ "blockdev-add/arg-type/+gluster/debug", QEMU_CAPS_GLUSTER_DEBUG_LEVEL},
{ "blockdev-add/arg-type/+vxhs", QEMU_CAPS_VXHS},
@@ -5235,6 +5239,15 @@ virQEMUCapsInitProcessCaps(virQEMUCaps *qemuCaps)
qemuCaps->arch == VIR_ARCH_MIPS)
virQEMUCapsSet(qemuCaps, QEMU_CAPS_SCSI_NCR53C90);
+ /* RHEL-only:
+ * - if upstream blockdev-reopen is enabled, clear the downstream flag
+ * - if the downstream flag is present but not the upstream, assert the upstream flag too
+ */
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV_REOPEN))
+ virQEMUCapsClear(qemuCaps, QEMU_CAPS_BLOCKDEV_REOPEN_COM_REDHAT_AV_8_2_0_API);
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV_REOPEN_COM_REDHAT_AV_8_2_0_API))
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_BLOCKDEV_REOPEN);
+
virQEMUCapsInitProcessCapsInterlock(qemuCaps);
}
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index e3a3ab4445..cde6c18b4c 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -634,6 +634,9 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */
QEMU_CAPS_SEV_GUEST_KERNEL_HASHES, /* sev-guest.kernel-hashes= */
QEMU_CAPS_SEV_INJECT_LAUNCH_SECRET, /* 'sev-inject-launch-secret' qmp command present */
+ /* 420 */
+ QEMU_CAPS_BLOCKDEV_REOPEN_COM_REDHAT_AV_8_2_0_API, /* downstream support for blockdev reopen in rhel-av-8.2.0 */
+
QEMU_CAPS_LAST /* this must always be the last item */
} virQEMUCapsFlags;
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index babf9e62fb..23638d3fe8 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -4247,14 +4247,15 @@ qemuMonitorBlockdevAdd(qemuMonitor *mon,
int
qemuMonitorBlockdevReopen(qemuMonitor *mon,
- virJSONValue **props)
+ virJSONValue **props,
+ bool downstream)
{
VIR_DEBUG("props=%p (node-name=%s)", *props,
NULLSTR(virJSONValueObjectGetString(*props, "node-name")));
QEMU_CHECK_MONITOR(mon);
- return qemuMonitorJSONBlockdevReopen(mon, props);
+ return qemuMonitorJSONBlockdevReopen(mon, props, downstream);
}
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 9b2e4e1421..d2037914be 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -1426,7 +1426,8 @@ int qemuMonitorBlockdevAdd(qemuMonitor *mon,
virJSONValue **props);
int qemuMonitorBlockdevReopen(qemuMonitor *mon,
- virJSONValue **props);
+ virJSONValue **props,
+ bool downstream);
int qemuMonitorBlockdevDel(qemuMonitor *mon,
const char *nodename);
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index b0b513683b..34a46b9b41 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -8051,13 +8051,19 @@ qemuMonitorJSONBlockdevAdd(qemuMonitor *mon,
int
qemuMonitorJSONBlockdevReopen(qemuMonitor *mon,
- virJSONValue **props)
+ virJSONValue **props,
+ bool downstream)
{
g_autoptr(virJSONValue) cmd = NULL;
g_autoptr(virJSONValue) reply = NULL;
- if (!(cmd = qemuMonitorJSONMakeCommandInternal("blockdev-reopen", props)))
- return -1;
+ if (downstream) {
+ if (!(cmd = qemuMonitorJSONMakeCommandInternal("x-blockdev-reopen", props)))
+ return -1;
+ } else {
+ if (!(cmd = qemuMonitorJSONMakeCommandInternal("blockdev-reopen", props)))
+ return -1;
+ }
if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
return -1;
diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h
index 64d9ebdaa3..15ce03d7af 100644
--- a/src/qemu/qemu_monitor_json.h
+++ b/src/qemu/qemu_monitor_json.h
@@ -748,7 +748,8 @@ qemuMonitorJSONBlockdevAdd(qemuMonitor *mon,
int
qemuMonitorJSONBlockdevReopen(qemuMonitor *mon,
- virJSONValue **props)
+ virJSONValue **props,
+ bool downstream)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
int
diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index 48e2a457ab..8624a547b5 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -2780,7 +2780,7 @@ testQemuMonitorJSONBlockdevReopen(const void *opaque)
if (qemuMonitorTestAddItem(test, "blockdev-reopen", "{\"return\":{}}") < 0)
return -1;
- if (qemuBlockReopenFormatMon(qemuMonitorTestGetMonitor(test), src) < 0)
+ if (qemuBlockReopenFormatMon(qemuMonitorTestGetMonitor(test), src, false) < 0)
return -1;
return 0;
--
2.34.1

View File

@ -1,5 +1,5 @@
From 3e50b013277c7fa05987ceba440f8c4583b6c634 Mon Sep 17 00:00:00 2001
Message-Id: <3e50b013277c7fa05987ceba440f8c4583b6c634@dist-git>
From 29eb7b77805cf5fb756c964cdbe7fb7fb2c01f5f Mon Sep 17 00:00:00 2001
Message-Id: <29eb7b77805cf5fb756c964cdbe7fb7fb2c01f5f@dist-git>
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
Date: Mon, 27 Aug 2018 13:09:38 +0200
Subject: [PATCH] RHEL: Fix virConnectGetMaxVcpus output
@ -26,10 +26,10 @@ Reviewed-by: Andrea Bolognani <abologna@redhat.com>
1 file changed, 5 insertions(+)
diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c
index 7f14340f49..256976cce1 100644
index a07c00a0e9..35f41daef2 100644
--- a/src/util/virhostcpu.c
+++ b/src/util/virhostcpu.c
@@ -1169,6 +1169,11 @@ virHostCPUGetKVMMaxVCPUs(void)
@@ -1166,6 +1166,11 @@ virHostCPUGetKVMMaxVCPUs(void)
return -1;
}
@ -42,5 +42,5 @@ index 7f14340f49..256976cce1 100644
/* at first try KVM_CAP_MAX_VCPUS to determine the maximum count */
if ((ret = ioctl(fd, KVM_CHECK_EXTENSION, KVM_CAP_MAX_VCPUS)) > 0)
--
2.25.0
2.34.1

View File

@ -1,5 +1,5 @@
From 0dd015e1aff1a56a4584824d1a97c9eacabf7f03 Mon Sep 17 00:00:00 2001
Message-Id: <0dd015e1aff1a56a4584824d1a97c9eacabf7f03@dist-git>
From 1d93a3944a200b7c955800faa598e0e11da098f8 Mon Sep 17 00:00:00 2001
Message-Id: <1d93a3944a200b7c955800faa598e0e11da098f8@dist-git>
From: Jiri Denemark <jdenemar@redhat.com>
Date: Fri, 27 Mar 2015 12:48:40 +0100
Subject: [PATCH] RHEL: Hack around changed Broadwell/Haswell CPUs
@ -18,34 +18,35 @@ https://bugzilla.redhat.com/show_bug.cgi?id=1199446
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
src/qemu/qemu_command.c | 21 +++++++++++++++++++
src/qemu/qemu_command.c | 22 +++++++++++++++++++
tests/qemuxml2argvdata/cpu-Haswell.args | 2 +-
.../qemuxml2argvdata/cpu-host-model-cmt.args | 2 +-
.../cpu-translation.x86_64-4.0.0.args | 4 ++--
.../cpu-translation.x86_64-latest.args | 4 ++--
tests/qemuxml2argvdata/cpu-tsc-frequency.args | 4 ++--
.../cpu-translation.x86_64-4.0.0.args | 2 +-
.../cpu-translation.x86_64-latest.args | 2 +-
tests/qemuxml2argvdata/cpu-tsc-frequency.args | 2 +-
tests/qemuxml2argvdata/q35-acpi-nouefi.args | 2 +-
tests/qemuxml2argvdata/q35-acpi-uefi.args | 2 +-
tests/qemuxml2argvdata/q35-noacpi-nouefi.args | 2 +-
9 files changed, 32 insertions(+), 11 deletions(-)
9 files changed, 30 insertions(+), 8 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 904d2beab5..e10cc7fc74 100644
index d822533ccb..6b4647a711 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -6469,6 +6469,8 @@ qemuBuildCpuModelArgStr(virQEMUDriverPtr driver,
@@ -6521,6 +6521,8 @@ qemuBuildCpuModelArgStr(virQEMUDriver *driver,
{
size_t i;
virCPUDefPtr cpu = def->cpu;
virCPUDef *cpu = def->cpu;
+ bool hle = false;
+ bool rtm = false;
switch ((virCPUMode) cpu->mode) {
case VIR_CPU_MODE_HOST_PASSTHROUGH:
@@ -6524,6 +6526,11 @@ qemuBuildCpuModelArgStr(virQEMUDriverPtr driver,
virBufferAsprintf(buf, ",vendor=%s", cpu->vendor_id);
@@ -6587,6 +6589,12 @@ qemuBuildCpuModelArgStr(virQEMUDriver *driver,
for (i = 0; i < cpu->nfeatures; i++) {
const char *featname =
virQEMUCapsCPUFeatureToQEMU(qemuCaps, cpu->features[i].name);
+
+ if (STREQ("rtm", cpu->features[i].name))
+ rtm = true;
+ if (STREQ("hle", cpu->features[i].name))
@ -54,7 +55,7 @@ index 904d2beab5..e10cc7fc74 100644
switch ((virCPUFeaturePolicy) cpu->features[i].policy) {
case VIR_CPU_FEATURE_FORCE:
case VIR_CPU_FEATURE_REQUIRE:
@@ -6541,6 +6548,20 @@ qemuBuildCpuModelArgStr(virQEMUDriverPtr driver,
@@ -6604,6 +6612,20 @@ qemuBuildCpuModelArgStr(virQEMUDriver *driver,
}
}
@ -67,124 +68,118 @@ index 904d2beab5..e10cc7fc74 100644
+ if (STREQ_NULLABLE(cpu->model, "Broadwell") ||
+ STREQ_NULLABLE(cpu->model, "Haswell")) {
+ if (!rtm)
+ qemuBuildCpuFeature(qemuCaps, buf, "rtm", true);
+ virBufferAddLit(buf, ",rtm=on");
+ if (!hle)
+ qemuBuildCpuFeature(qemuCaps, buf, "hle", true);
+ virBufferAddLit(buf, ",hle=on");
+ }
+
return 0;
}
diff --git a/tests/qemuxml2argvdata/cpu-Haswell.args b/tests/qemuxml2argvdata/cpu-Haswell.args
index a33b16f7ce..d35de5ea58 100644
index b57fdfddc5..965274c1f0 100644
--- a/tests/qemuxml2argvdata/cpu-Haswell.args
+++ b/tests/qemuxml2argvdata/cpu-Haswell.args
@@ -11,7 +11,7 @@ QEMU_AUDIO_DRV=none \
-name QEMUGuest1 \
-S \
-machine pc,accel=kvm,usb=off,dump-guest-core=off \
@@ -13,7 +13,7 @@ QEMU_AUDIO_DRV=none \
-object secret,id=masterKey0,format=raw,file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
-machine pc,usb=off,dump-guest-core=off \
-accel kvm \
--cpu Haswell \
+-cpu Haswell,+rtm,+hle \
+-cpu Haswell,rtm=on,hle=on \
-m 214 \
-realtime mlock=off \
-smp 6,sockets=6,cores=1,threads=1 \
diff --git a/tests/qemuxml2argvdata/cpu-host-model-cmt.args b/tests/qemuxml2argvdata/cpu-host-model-cmt.args
index 42f969fd62..c8795acb3e 100644
index 0de04e877d..602f70de86 100644
--- a/tests/qemuxml2argvdata/cpu-host-model-cmt.args
+++ b/tests/qemuxml2argvdata/cpu-host-model-cmt.args
@@ -12,7 +12,7 @@ QEMU_AUDIO_DRV=none \
-S \
-machine pc,accel=tcg,usb=off,dump-guest-core=off \
-cpu Haswell,+vme,+ds,+acpi,+ss,+ht,+tm,+pbe,+dtes64,+monitor,+ds_cpl,+vmx,\
-+smx,+est,+tm2,+xtpr,+pdcm,+f16c,+rdrand,+pdpe1gb,+abm,+lahf_lm \
++smx,+est,+tm2,+xtpr,+pdcm,+f16c,+rdrand,+pdpe1gb,+abm,+lahf_lm,+rtm,+hle \
@@ -13,7 +13,7 @@ QEMU_AUDIO_DRV=none \
-object secret,id=masterKey0,format=raw,file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
-machine pc,usb=off,dump-guest-core=off \
-accel tcg \
--cpu Haswell,vme=on,ds=on,acpi=on,ss=on,ht=on,tm=on,pbe=on,dtes64=on,monitor=on,ds-cpl=on,vmx=on,smx=on,est=on,tm2=on,xtpr=on,pdcm=on,f16c=on,rdrand=on,pdpe1gb=on,abm=on,lahf-lm=on \
+-cpu Haswell,vme=on,ds=on,acpi=on,ss=on,ht=on,tm=on,pbe=on,dtes64=on,monitor=on,ds-cpl=on,vmx=on,smx=on,est=on,tm2=on,xtpr=on,pdcm=on,f16c=on,rdrand=on,pdpe1gb=on,abm=on,lahf-lm=on,rtm=on,hle=on \
-m 214 \
-realtime mlock=off \
-smp 6,sockets=6,cores=1,threads=1 \
diff --git a/tests/qemuxml2argvdata/cpu-translation.x86_64-4.0.0.args b/tests/qemuxml2argvdata/cpu-translation.x86_64-4.0.0.args
index f8e19fca24..08c672fd2c 100644
index 09141106d5..ace08d5d76 100644
--- a/tests/qemuxml2argvdata/cpu-translation.x86_64-4.0.0.args
+++ b/tests/qemuxml2argvdata/cpu-translation.x86_64-4.0.0.args
@@ -14,8 +14,8 @@ QEMU_AUDIO_DRV=none \
file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
-machine pc-i440fx-4.0,accel=tcg,usb=off,dump-guest-core=off \
-cpu Haswell,pclmuldq=on,ds_cpl=on,tsc_adjust=on,fxsr_opt=on,lahf_lm=on,\
-cmp_legacy=on,nodeid_msr=on,perfctr_core=on,perfctr_nb=on,kvm_pv_eoi=on,\
-kvm_pv_unhalt=on \
+cmp_legacy=on,nodeid_msr=on,perfctr_core=on,perfctr_nb=on,rtm=on,hle=on,\
+kvm_pv_eoi=on,kvm_pv_unhalt=on \
@@ -13,7 +13,7 @@ QEMU_AUDIO_DRV=none \
-object secret,id=masterKey0,format=raw,file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
-machine pc-i440fx-4.0,usb=off,dump-guest-core=off \
-accel tcg \
--cpu Haswell,pclmulqdq=on,ds-cpl=on,tsc-adjust=on,fxsr-opt=on,lahf-lm=on,cmp-legacy=on,nodeid-msr=on,perfctr-core=on,perfctr-nb=on,kvm-pv-eoi=on,kvm-pv-unhalt=on \
+-cpu Haswell,pclmulqdq=on,ds-cpl=on,tsc-adjust=on,fxsr-opt=on,lahf-lm=on,cmp-legacy=on,nodeid-msr=on,perfctr-core=on,perfctr-nb=on,rtm=on,hle=on,kvm-pv-eoi=on,kvm-pv-unhalt=on \
-m 214 \
-overcommit mem-lock=off \
-smp 1,sockets=1,cores=1,threads=1 \
diff --git a/tests/qemuxml2argvdata/cpu-translation.x86_64-latest.args b/tests/qemuxml2argvdata/cpu-translation.x86_64-latest.args
index 9322b826f4..1dbfc9553b 100644
index 2dab572a6b..a9f7c4b910 100644
--- a/tests/qemuxml2argvdata/cpu-translation.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/cpu-translation.x86_64-latest.args
@@ -14,8 +14,8 @@ QEMU_AUDIO_DRV=none \
file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
-machine pc,accel=tcg,usb=off,dump-guest-core=off \
-cpu Haswell,pclmulqdq=on,ds-cpl=on,tsc-adjust=on,fxsr-opt=on,lahf-lm=on,\
-cmp-legacy=on,nodeid-msr=on,perfctr-core=on,perfctr-nb=on,kvm-pv-eoi=on,\
-kvm-pv-unhalt=on \
+cmp-legacy=on,nodeid-msr=on,perfctr-core=on,perfctr-nb=on,rtm=on,hle=on,\
+kvm-pv-eoi=on,kvm-pv-unhalt=on \
@@ -12,7 +12,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tmp/lib/domain--1-QEMUGuest1/master-key.aes"}' \
-machine pc,usb=off,dump-guest-core=off,memory-backend=pc.ram \
-accel tcg \
--cpu Haswell,pclmulqdq=on,ds-cpl=on,tsc-adjust=on,fxsr-opt=on,lahf-lm=on,cmp-legacy=on,nodeid-msr=on,perfctr-core=on,perfctr-nb=on,kvm-pv-eoi=on,kvm-pv-unhalt=on \
+-cpu Haswell,pclmulqdq=on,ds-cpl=on,tsc-adjust=on,fxsr-opt=on,lahf-lm=on,cmp-legacy=on,nodeid-msr=on,perfctr-core=on,perfctr-nb=on,rtm=on,hle=on,kvm-pv-eoi=on,kvm-pv-unhalt=on \
-m 214 \
-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}' \
-overcommit mem-lock=off \
-smp 1,sockets=1,cores=1,threads=1 \
diff --git a/tests/qemuxml2argvdata/cpu-tsc-frequency.args b/tests/qemuxml2argvdata/cpu-tsc-frequency.args
index 55b72b4404..45a777d468 100644
index 4a032f5d85..48fb75abcc 100644
--- a/tests/qemuxml2argvdata/cpu-tsc-frequency.args
+++ b/tests/qemuxml2argvdata/cpu-tsc-frequency.args
@@ -12,8 +12,8 @@ QEMU_AUDIO_DRV=none \
-S \
-machine pc,accel=kvm,usb=off,dump-guest-core=off \
-cpu Haswell,+vme,+ds,+acpi,+ss,+ht,+tm,+pbe,+dtes64,+monitor,+ds_cpl,+vmx,\
-+smx,+est,+tm2,+xtpr,+pdcm,+f16c,+rdrand,+pdpe1gb,+abm,+lahf_lm,+invtsc,\
-tsc-frequency=3504000000 \
++smx,+est,+tm2,+xtpr,+pdcm,+f16c,+rdrand,+pdpe1gb,+abm,+lahf_lm,+invtsc,+rtm,\
++hle,tsc-frequency=3504000000 \
@@ -13,7 +13,7 @@ QEMU_AUDIO_DRV=none \
-object secret,id=masterKey0,format=raw,file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
-machine pc,usb=off,dump-guest-core=off \
-accel kvm \
--cpu Haswell,vme=on,ds=on,acpi=on,ss=on,ht=on,tm=on,pbe=on,dtes64=on,monitor=on,ds-cpl=on,vmx=on,smx=on,est=on,tm2=on,xtpr=on,pdcm=on,f16c=on,rdrand=on,pdpe1gb=on,abm=on,lahf-lm=on,invtsc=on,tsc-frequency=4567890000 \
+-cpu Haswell,vme=on,ds=on,acpi=on,ss=on,ht=on,tm=on,pbe=on,dtes64=on,monitor=on,ds-cpl=on,vmx=on,smx=on,est=on,tm2=on,xtpr=on,pdcm=on,f16c=on,rdrand=on,pdpe1gb=on,abm=on,lahf-lm=on,invtsc=on,rtm=on,hle=on,tsc-frequency=4567890000 \
-m 214 \
-realtime mlock=off \
-smp 1,sockets=1,cores=1,threads=1 \
diff --git a/tests/qemuxml2argvdata/q35-acpi-nouefi.args b/tests/qemuxml2argvdata/q35-acpi-nouefi.args
index 09e06c96ea..aed56fb1fc 100644
index 3faee48c77..a1f742712d 100644
--- a/tests/qemuxml2argvdata/q35-acpi-nouefi.args
+++ b/tests/qemuxml2argvdata/q35-acpi-nouefi.args
@@ -11,7 +11,7 @@ QEMU_AUDIO_DRV=none \
-name guest \
-S \
-machine q35,accel=tcg,usb=off,dump-guest-core=off \
@@ -13,7 +13,7 @@ QEMU_AUDIO_DRV=none \
-object secret,id=masterKey0,format=raw,file=/tmp/lib/domain--1-guest/master-key.aes \
-machine q35,usb=off,dump-guest-core=off \
-accel tcg \
--cpu Haswell \
+-cpu Haswell,+rtm,+hle \
+-cpu Haswell,rtm=on,hle=on \
-m 1024 \
-realtime mlock=off \
-smp 1,sockets=1,cores=1,threads=1 \
diff --git a/tests/qemuxml2argvdata/q35-acpi-uefi.args b/tests/qemuxml2argvdata/q35-acpi-uefi.args
index d00fe5bc1d..1f4bfe7f87 100644
index 60da1e282a..620056223a 100644
--- a/tests/qemuxml2argvdata/q35-acpi-uefi.args
+++ b/tests/qemuxml2argvdata/q35-acpi-uefi.args
@@ -11,7 +11,7 @@ QEMU_AUDIO_DRV=none \
-name guest \
-S \
-machine q35,accel=tcg,usb=off,dump-guest-core=off \
@@ -13,7 +13,7 @@ QEMU_AUDIO_DRV=none \
-object secret,id=masterKey0,format=raw,file=/tmp/lib/domain--1-guest/master-key.aes \
-machine q35,usb=off,dump-guest-core=off \
-accel tcg \
--cpu Haswell \
+-cpu Haswell,+rtm,+hle \
-drive file=/usr/share/OVMF/OVMF_CODE.fd,if=pflash,format=raw,unit=0,\
readonly=on \
-drive file=/var/lib/libvirt/qemu/nvram/guest_VARS.fd,if=pflash,format=raw,\
+-cpu Haswell,rtm=on,hle=on \
-drive file=/usr/share/OVMF/OVMF_CODE.fd,if=pflash,format=raw,unit=0,readonly=on \
-drive file=/var/lib/libvirt/qemu/nvram/guest_VARS.fd,if=pflash,format=raw,unit=1 \
-m 1024 \
diff --git a/tests/qemuxml2argvdata/q35-noacpi-nouefi.args b/tests/qemuxml2argvdata/q35-noacpi-nouefi.args
index de34dff1cf..ccea7f91f9 100644
index 14e5bbc22a..ea66536c2a 100644
--- a/tests/qemuxml2argvdata/q35-noacpi-nouefi.args
+++ b/tests/qemuxml2argvdata/q35-noacpi-nouefi.args
@@ -11,7 +11,7 @@ QEMU_AUDIO_DRV=none \
-name guest \
-S \
-machine q35,accel=tcg,usb=off,dump-guest-core=off \
@@ -13,7 +13,7 @@ QEMU_AUDIO_DRV=none \
-object secret,id=masterKey0,format=raw,file=/tmp/lib/domain--1-guest/master-key.aes \
-machine q35,usb=off,dump-guest-core=off \
-accel tcg \
--cpu Haswell \
+-cpu Haswell,+rtm,+hle \
+-cpu Haswell,rtm=on,hle=on \
-m 1024 \
-realtime mlock=off \
-smp 1,sockets=1,cores=1,threads=1 \
--
2.25.0
2.34.1

View File

@ -0,0 +1,89 @@
From b550b671bace6d979a0763a837ce97ddf72e8fc8 Mon Sep 17 00:00:00 2001
Message-Id: <b550b671bace6d979a0763a837ce97ddf72e8fc8@dist-git>
From: Martin Kletzander <mkletzan@redhat.com>
Date: Fri, 28 Jan 2022 20:33:12 +0100
Subject: [PATCH] RHEL: Remove <glib-2.64.0 workaround for GSource race
https://bugzilla.redhat.com/show_bug.cgi?id=2045879
This is to accommodate for RHEL 8 downstream glib being fixed with a backport in
version 2.56.4-12 (Bug 1948988). Another reason for that is that our workaround
does not play nice with a fixed glib, leading to libvirt not properly
dereferencing the monitor socket, eventually leading to EMFILE: Too many open
files.
RHEL-only
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
---
src/util/glibcompat.c | 46 ++++++++-----------------------------------
1 file changed, 8 insertions(+), 38 deletions(-)
diff --git a/src/util/glibcompat.c b/src/util/glibcompat.c
index eb6dcc0111..bf890f10d2 100644
--- a/src/util/glibcompat.c
+++ b/src/util/glibcompat.c
@@ -212,51 +212,21 @@ vir_g_strdup_vprintf(const char *msg, va_list args)
return ret;
}
-
/*
- * If the last reference to a GSource is released in a non-main
- * thread we're exposed to a race condition that causes a
- * crash:
- *
- * https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1358
+ * This is a leftover of a hack that works around glib older than 2.64.0, but
+ * the fix in glib as backported in RHEL-8 to glib2-2.56.4-12 in BZ 1948988:
*
- * Thus we're using an idle func to release our ref...
+ * https://bugzilla.redhat.com/show_bug.cgi?id=1948988
*
- * ...but this imposes a significant performance penalty on
- * I/O intensive workloads which are sensitive to the iterations
- * of the event loop, so avoid the workaround if we know we have
- * new enough glib.
+ * and our workaround coupled with that glib fix started causing leaks, which
+ * surfaced with us not unreferencing the qemu monitor socket in BZ 2045879:
*
- * The function below is used from a header file definition.
+ * https://bugzilla.redhat.com/show_bug.cgi?id=2045879
*
- * Drop when min glib >= 2.64.0
+ * Keeping this wrapper makes it easier to follow with other backports without
+ * conflicts in callers due to the function name change.
*/
-#if GLIB_CHECK_VERSION(2, 64, 0)
void vir_g_source_unref(GSource *src, GMainContext *ctx G_GNUC_UNUSED)
{
g_source_unref(src);
}
-#else
-
-static gboolean
-virEventGLibSourceUnrefIdle(gpointer data)
-{
- GSource *src = data;
-
- g_source_unref(src);
-
- return FALSE;
-}
-
-void vir_g_source_unref(GSource *src, GMainContext *ctx)
-{
- GSource *idle = g_idle_source_new();
-
- g_source_set_callback(idle, virEventGLibSourceUnrefIdle, src, NULL);
-
- g_source_attach(idle, ctx);
-
- g_source_unref(idle);
-}
-
-#endif
--
2.35.1

View File

@ -1,5 +1,5 @@
From fce502cf5233d800479c2efcf7721ab895db8998 Mon Sep 17 00:00:00 2001
Message-Id: <fce502cf5233d800479c2efcf7721ab895db8998@dist-git>
From d6956a1aaa8757fab60132c3ee46c2bb199a78a8 Mon Sep 17 00:00:00 2001
Message-Id: <d6956a1aaa8757fab60132c3ee46c2bb199a78a8@dist-git>
From: John Ferlan <jferlan@redhat.com>
Date: Mon, 17 Dec 2018 20:42:30 -0500
Subject: [PATCH] RHEL: qemu: Add ability to set sgio values for hostdev
@ -15,27 +15,34 @@ Add necessary checks in order to allow setting sgio values for a scsi
host device
Signed-off-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
(cherry picked from commit f2cf0ae7bc371c75f6c0e79192711f2b1d201b10)
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/qemu/qemu_conf.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
src/qemu/qemu_conf.c | 25 ++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index b62dd1df52..ce7869e6be 100644
index 6077457ff4..ba85fc6e22 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -1810,6 +1810,7 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
virDomainDiskDefPtr disk = NULL;
virDomainHostdevDefPtr hostdev = NULL;
@@ -1841,8 +1841,9 @@ qemuSetUnprivSGIO(virDomainDeviceDef *dev)
virDomainDiskDef *disk = NULL;
virDomainHostdevDef *hostdev = NULL;
g_autofree char *sysfs_path = NULL;
+ g_autofree char *hostdev_path = NULL;
const char *path = NULL;
int val = -1;
- int val = -1;
+ int val = 0;
@@ -1830,14 +1831,10 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
if (!qemuIsSharedHostdev(hostdev))
/* "sgio" is only valid for block disk; cdrom
* and floopy disk can have empty source.
@@ -1858,17 +1859,14 @@ qemuSetUnprivSGIO(virDomainDeviceDef *dev)
} else if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV) {
hostdev = dev->data.hostdev;
- if (!qemuIsSharedHostdev(hostdev))
+ if (hostdev->source.subsys.u.scsi.protocol ==
+ VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI)
return 0;
- if (hostdev->source.subsys.u.scsi.sgio) {
@ -51,19 +58,24 @@ index b62dd1df52..ce7869e6be 100644
} else {
return 0;
}
@@ -1846,7 +1843,11 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
@@ -1877,7 +1875,16 @@ qemuSetUnprivSGIO(virDomainDeviceDef *dev)
return -1;
/* By default, filter the SG_IO commands, i.e. set unpriv_sgio to 0. */
- val = (disk->sgio == VIR_DOMAIN_DEVICE_SGIO_UNFILTERED);
+ if (dev->type == VIR_DOMAIN_DEVICE_DISK)
+ val = (disk->sgio == VIR_DOMAIN_DEVICE_SGIO_UNFILTERED);
+ else
+ val = (hostdev->source.subsys.u.scsi.sgio ==
+ VIR_DOMAIN_DEVICE_SGIO_UNFILTERED);
+ if (dev->type == VIR_DOMAIN_DEVICE_DISK) {
+ if (disk->sgio == VIR_DOMAIN_DEVICE_SGIO_UNFILTERED)
+ val = 1;
+ } else {
+ /* Only settable if <shareable/> was present for hostdev */
+ if (qemuIsSharedHostdev(hostdev) &&
+ hostdev->source.subsys.u.scsi.sgio ==
+ VIR_DOMAIN_DEVICE_SGIO_UNFILTERED)
+ val = 1;
+ }
/* Do not do anything if unpriv_sgio is not supported by the kernel and the
* whitelist is enabled. But if requesting unfiltered access, always call
--
2.25.0
2.34.1

View File

@ -1,5 +1,5 @@
From 5a192657ad4e08fc773fef90c6b07df3620fa1c2 Mon Sep 17 00:00:00 2001
Message-Id: <5a192657ad4e08fc773fef90c6b07df3620fa1c2@dist-git>
From f562b4c83d342002291f6bd7c5776eaecbd3147f Mon Sep 17 00:00:00 2001
Message-Id: <f562b4c83d342002291f6bd7c5776eaecbd3147f@dist-git>
From: John Ferlan <jferlan@redhat.com>
Date: Mon, 17 Dec 2018 20:42:31 -0500
Subject: [PATCH] RHEL: qemu: Add check for unpriv sgio for SCSI generic host
@ -19,23 +19,22 @@ This restores functionality removed by upstream commit id 'ce346623'
to remove sgio support for the SCSI generic host device.
Signed-off-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
(cherry picked from commit 712005bcf26190dc6fd1fe56283377987909cc4b)
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/qemu/qemu_conf.c | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index ce7869e6be..2a84972fd9 100644
index ba85fc6e22..28c334761b 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -1717,13 +1717,29 @@ qemuSharedHostdevAddRemoveInternal(virQEMUDriverPtr driver,
@@ -1749,13 +1749,29 @@ qemuSharedHostdevAddRemoveInternal(virQEMUDriver *driver,
{
g_autofree char *dev_path = NULL;
g_autofree char *key = NULL;
+ virDomainHostdevSubsysSCSIPtr scsisrc = &hostdev->source.subsys.u.scsi;
+ virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host;
+ virDomainHostdevSubsysSCSI *scsisrc = &hostdev->source.subsys.u.scsi;
+ virDomainHostdevSubsysSCSIHost *scsihostsrc = &scsisrc->u.host;
int ret = -1;
if (!qemuIsSharedHostdev(hostdev))
@ -63,5 +62,5 @@ index ce7869e6be..2a84972fd9 100644
qemuDriverLock(driver);
--
2.25.0
2.34.1

View File

@ -1,53 +0,0 @@
From e79d54ff8e760ac1a200a37fb05cc9aa758c48d3 Mon Sep 17 00:00:00 2001
Message-Id: <e79d54ff8e760ac1a200a37fb05cc9aa758c48d3@dist-git>
From: John Ferlan <jferlan@redhat.com>
Date: Mon, 17 Dec 2018 20:42:33 -0500
Subject: [PATCH] RHEL: qemu: Alter qemuSetUnprivSGIO hostdev shareable logic
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
https://bugzilla.redhat.com/show_bug.cgi?id=1656362 (RHEL8)
https://bugzilla.redhat.com/show_bug.cgi?id=1656360 (RHEL7)
RHEL-only
Fix the logic to handle the case where if the <shareable/> element
was removed from the domain <hostdev.../>, then we have to reset the
SGIO value back to 0. Without this patch the check for not shareable
and return 0 would bypass resetting the value back to 0.
Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/qemu/qemu_conf.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index faabc4d49f..590052b035 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -1844,9 +1844,6 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
} else if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV) {
hostdev = dev->data.hostdev;
- if (!qemuIsSharedHostdev(hostdev))
- return 0;
-
if (!(hostdev_path = qemuGetHostdevPath(hostdev)))
return -1;
@@ -1863,7 +1860,9 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
disk->sgio == VIR_DOMAIN_DEVICE_SGIO_UNFILTERED) {
val = 1;
} else {
- if (hostdev->source.subsys.u.scsi.sgio ==
+ /* Only settable if <shareable/> was present for hostdev */
+ if (qemuIsSharedHostdev(hostdev) &&
+ hostdev->source.subsys.u.scsi.sgio ==
VIR_DOMAIN_DEVICE_SGIO_UNFILTERED)
val = 1;
}
--
2.25.0

View File

@ -1,60 +0,0 @@
From fa46b5b4d5bb732462d0d5484cc010aa652d821b Mon Sep 17 00:00:00 2001
Message-Id: <fa46b5b4d5bb732462d0d5484cc010aa652d821b@dist-git>
From: John Ferlan <jferlan@redhat.com>
Date: Mon, 17 Dec 2018 20:42:32 -0500
Subject: [PATCH] RHEL: qemu: Alter @val usage in qemuSetUnprivSGIO
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
https://bugzilla.redhat.com/show_bug.cgi?id=1656362 (RHEL8)
https://bugzilla.redhat.com/show_bug.cgi?id=1656360 (RHEL7)
RHEL-only
Rather than initializing to -1 and then setting to the result
of a boolean check (either 0 or 1), let's just initialize @val
to 0 and then only change to 1 if conditions are "right".
Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/qemu/qemu_conf.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 2a84972fd9..faabc4d49f 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -1828,7 +1828,7 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
g_autofree char *sysfs_path = NULL;
g_autofree char *hostdev_path = NULL;
const char *path = NULL;
- int val = -1;
+ int val = 0;
/* "sgio" is only valid for block disk; cdrom
* and floopy disk can have empty source.
@@ -1859,11 +1859,14 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
return -1;
/* By default, filter the SG_IO commands, i.e. set unpriv_sgio to 0. */
- if (dev->type == VIR_DOMAIN_DEVICE_DISK)
- val = (disk->sgio == VIR_DOMAIN_DEVICE_SGIO_UNFILTERED);
- else
- val = (hostdev->source.subsys.u.scsi.sgio ==
- VIR_DOMAIN_DEVICE_SGIO_UNFILTERED);
+ if (dev->type == VIR_DOMAIN_DEVICE_DISK &&
+ disk->sgio == VIR_DOMAIN_DEVICE_SGIO_UNFILTERED) {
+ val = 1;
+ } else {
+ if (hostdev->source.subsys.u.scsi.sgio ==
+ VIR_DOMAIN_DEVICE_SGIO_UNFILTERED)
+ val = 1;
+ }
/* Do not do anything if unpriv_sgio is not supported by the kernel and the
* whitelist is enabled. But if requesting unfiltered access, always call
--
2.25.0

View File

@ -1,45 +0,0 @@
From 163740bff28c6f1a82663bc652f2cd5df39e4276 Mon Sep 17 00:00:00 2001
Message-Id: <163740bff28c6f1a82663bc652f2cd5df39e4276@dist-git>
From: John Ferlan <jferlan@redhat.com>
Date: Fri, 25 Jan 2019 12:19:12 -0500
Subject: [PATCH] RHEL: qemu: Fix crash trying to use iSCSI hostdev
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
https://bugzilla.redhat.com/show_bug.cgi?id=1669424
https://bugzilla.redhat.com/show_bug.cgi?id=1669966
RHEL-only
Commit 861a1a4d2 moved the qemuIsSharedHostdev filter in the
HOSTDEV half of the logic to allow calling qemuGetHostdevPath;
however, that neglected to check whether the SCSI hostdev was
using the iSCSI protocol which has a different overlayed struct
format (u.iscsi vs. u.host) resulting in attempted access of
u.host when calling virSCSIDeviceGetDevName.
Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/qemu/qemu_conf.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 0674292fab..3d2f0e7bbb 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -1844,6 +1844,10 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
} else if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV) {
hostdev = dev->data.hostdev;
+ if (hostdev->source.subsys.u.scsi.protocol ==
+ VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI)
+ return 0;
+
if (!(hostdev_path = qemuGetHostdevPath(hostdev)))
return -1;
--
2.25.0

View File

@ -1,59 +0,0 @@
From f6a05ac3cb33c473de8ed49b53d22910fc0140df Mon Sep 17 00:00:00 2001
Message-Id: <f6a05ac3cb33c473de8ed49b53d22910fc0140df@dist-git>
From: John Ferlan <jferlan@redhat.com>
Date: Wed, 16 Jan 2019 15:54:31 -0500
Subject: [PATCH] RHEL: qemu: Fix logic error in qemuSetUnprivSGIO
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
https://bugzilla.redhat.com/show_bug.cgi?id=1666605
RHEL-only
Commit c0f26a13c6 had a logic error with using both DISK and
sgio which resulted in a DISK that didn't have sgio set falling
into the else clause and trying to deref a NULL @hostdev resulting
in a libvirtd crash:
Thread 1 (Thread 0x7ffbc6353700 (LWP 12642)):
0 0x00007ffb958e7d7a in qemuSetUnprivSGIO
1 0x00007ffb958d9d92 in qemuDomainAttachDeviceDiskLive
2 0x00007ffb9594fce8 in qemuDomainAttachDeviceFlags
3 0x00007ffbde399d71 in virDomainAttachDevice
4 0x0000563b73ded4b2 in remoteDispatchDomainAttachDeviceHelper
for hotplug of XML:
<disk device="lun" type="block">
<source dev="/dev/sdb"/>
<driver name="qemu" type="raw"/>
<target bus="scsi" dev="sdb"/>
</disk>
Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/qemu/qemu_conf.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 590052b035..0674292fab 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -1856,9 +1856,9 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
return -1;
/* By default, filter the SG_IO commands, i.e. set unpriv_sgio to 0. */
- if (dev->type == VIR_DOMAIN_DEVICE_DISK &&
- disk->sgio == VIR_DOMAIN_DEVICE_SGIO_UNFILTERED) {
- val = 1;
+ if (dev->type == VIR_DOMAIN_DEVICE_DISK) {
+ if (disk->sgio == VIR_DOMAIN_DEVICE_SGIO_UNFILTERED)
+ val = 1;
} else {
/* Only settable if <shareable/> was present for hostdev */
if (qemuIsSharedHostdev(hostdev) &&
--
2.25.0

View File

@ -1,42 +0,0 @@
From ef5a82d50464478a302cb59804d03e4a3dada83e Mon Sep 17 00:00:00 2001
Message-Id: <ef5a82d50464478a302cb59804d03e4a3dada83e@dist-git>
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
Date: Fri, 6 Mar 2020 15:52:26 +0100
Subject: [PATCH] RHEL: qemuCheckUnprivSGIO: use @sysfs_path to get unpriv_sgio
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Downstream commit 65f4ff0e2c9a968b7ec65c8d751d4055cc212628
RHEL: qemuSetUnprivSGIO: Actually use calculated
@sysfs_path to set unpriv_sgio
removed the device_path -> sysfs_path conversion from
both virGetDeviceUnprivSGIO and virSetDeviceUnprivSGIO,
but only adjusted one of the callers.
https://bugzilla.redhat.com/show_bug.cgi?id=1808400
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Message-Id: <20200306145226.1610708-7-abologna@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
---
src/qemu/qemu_conf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index b61d7e59fa..6a22d78ac6 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -1430,7 +1430,7 @@ qemuCheckUnprivSGIO(virHashTablePtr sharedDevices,
if (!(virHashLookup(sharedDevices, key)))
return 0;
- if (virGetDeviceUnprivSGIO(device_path, &val) < 0)
+ if (virGetDeviceUnprivSGIO(sysfs_path, &val) < 0)
return -1;
/* Error message on failure needs to be handled in caller
--
2.25.1

View File

@ -1,170 +0,0 @@
From 717423e7a452b0715e95b492b15dc08983677d12 Mon Sep 17 00:00:00 2001
Message-Id: <717423e7a452b0715e95b492b15dc08983677d12@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Fri, 6 Mar 2020 15:52:25 +0100
Subject: [PATCH] RHEL: qemuSetUnprivSGIO: Actually use calculated @sysfs_path
to set unpriv_sgio
In previous commits I've attempted to make qemuSetUnprivSGIO()
construct a generic enough path for SCSI devices to set
unpriv_sgio. However, virSetDeviceUnprivSGIO() does not care
about that - it constructs the path on it's own again. This is
suboptimal in either case - we already have the path constructed.
https://bugzilla.redhat.com/show_bug.cgi?id=1808390
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Message-Id: <20200306145226.1610708-6-abologna@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
---
src/qemu/qemu_conf.c | 8 +++-----
src/util/virutil.c | 24 ++++++------------------
src/util/virutil.h | 2 --
3 files changed, 9 insertions(+), 25 deletions(-)
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 6d6feb97cd..b61d7e59fa 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -1430,7 +1430,7 @@ qemuCheckUnprivSGIO(virHashTablePtr sharedDevices,
if (!(virHashLookup(sharedDevices, key)))
return 0;
- if (virGetDeviceUnprivSGIO(device_path, NULL, &val) < 0)
+ if (virGetDeviceUnprivSGIO(device_path, &val) < 0)
return -1;
/* Error message on failure needs to be handled in caller
@@ -1789,7 +1789,6 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
virDomainDiskDefPtr disk = NULL;
virDomainHostdevDefPtr hostdev = NULL;
g_autofree char *sysfs_path = NULL;
- const char *path = NULL;
int val = 0;
/* "sgio" is only valid for block disk; cdrom
@@ -1797,13 +1796,12 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
*/
if (dev->type == VIR_DOMAIN_DEVICE_DISK) {
disk = dev->data.disk;
+ const char *path = virDomainDiskGetSource(disk);
if (disk->device != VIR_DOMAIN_DISK_DEVICE_LUN ||
!virStorageSourceIsBlockLocal(disk->src))
return 0;
- path = virDomainDiskGetSource(disk);
-
if (!(sysfs_path = virGetUnprivSGIOSysfsPath(path, NULL)))
return -1;
@@ -1843,7 +1841,7 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
* virSetDeviceUnprivSGIO, to report an error for unsupported unpriv_sgio.
*/
if ((virFileExists(sysfs_path) || val == 1) &&
- virSetDeviceUnprivSGIO(path, NULL, val) < 0)
+ virSetDeviceUnprivSGIO(sysfs_path, val) < 0)
return -1;
return 0;
diff --git a/src/util/virutil.c b/src/util/virutil.c
index f142951acf..4198473fce 100644
--- a/src/util/virutil.c
+++ b/src/util/virutil.c
@@ -1421,18 +1421,13 @@ virGetUnprivSGIOSysfsPath(const char *path,
int
virSetDeviceUnprivSGIO(const char *path,
- const char *sysfs_dir,
int unpriv_sgio)
{
- char *sysfs_path = NULL;
char *val = NULL;
int ret = -1;
int rc;
- if (!(sysfs_path = virGetUnprivSGIOSysfsPath(path, sysfs_dir)))
- return -1;
-
- if (!virFileExists(sysfs_path)) {
+ if (!virFileExists(path)) {
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("unpriv_sgio is not supported by this kernel"));
goto cleanup;
@@ -1440,38 +1435,32 @@ virSetDeviceUnprivSGIO(const char *path,
val = g_strdup_printf("%d", unpriv_sgio);
- if ((rc = virFileWriteStr(sysfs_path, val, 0)) < 0) {
- virReportSystemError(-rc, _("failed to set %s"), sysfs_path);
+ if ((rc = virFileWriteStr(path, val, 0)) < 0) {
+ virReportSystemError(-rc, _("failed to set %s"), path);
goto cleanup;
}
ret = 0;
cleanup:
- VIR_FREE(sysfs_path);
VIR_FREE(val);
return ret;
}
int
virGetDeviceUnprivSGIO(const char *path,
- const char *sysfs_dir,
int *unpriv_sgio)
{
- char *sysfs_path = NULL;
char *buf = NULL;
char *tmp = NULL;
int ret = -1;
- if (!(sysfs_path = virGetUnprivSGIOSysfsPath(path, sysfs_dir)))
- return -1;
-
- if (!virFileExists(sysfs_path)) {
+ if (!virFileExists(path)) {
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("unpriv_sgio is not supported by this kernel"));
goto cleanup;
}
- if (virFileReadAll(sysfs_path, 1024, &buf) < 0)
+ if (virFileReadAll(path, 1024, &buf) < 0)
goto cleanup;
if ((tmp = strchr(buf, '\n')))
@@ -1479,13 +1468,12 @@ virGetDeviceUnprivSGIO(const char *path,
if (virStrToLong_i(buf, NULL, 10, unpriv_sgio) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("failed to parse value of %s"), sysfs_path);
+ _("failed to parse value of %s"), path);
goto cleanup;
}
ret = 0;
cleanup:
- VIR_FREE(sysfs_path);
VIR_FREE(buf);
return ret;
}
diff --git a/src/util/virutil.h b/src/util/virutil.h
index 1a6ae1787a..a2530e21b5 100644
--- a/src/util/virutil.h
+++ b/src/util/virutil.h
@@ -124,10 +124,8 @@ int virGetDeviceID(const char *path,
int *maj,
int *min);
int virSetDeviceUnprivSGIO(const char *path,
- const char *sysfs_dir,
int unpriv_sgio);
int virGetDeviceUnprivSGIO(const char *path,
- const char *sysfs_dir,
int *unpriv_sgio);
char *virGetUnprivSGIOSysfsPath(const char *path,
const char *sysfs_dir);
--
2.25.1

View File

@ -1,5 +1,5 @@
From f66beef45382be2aed6d021a409e90f8114c8671 Mon Sep 17 00:00:00 2001
Message-Id: <f66beef45382be2aed6d021a409e90f8114c8671@dist-git>
From 9c5daeb8c99ca12a66387de448f585742887fd75 Mon Sep 17 00:00:00 2001
Message-Id: <9c5daeb8c99ca12a66387de448f585742887fd75@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Fri, 6 Mar 2020 15:52:21 +0100
Subject: [PATCH] RHEL: virscsi: Check device type before getting it's /dev
@ -16,20 +16,20 @@ Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Message-Id: <20200306145226.1610708-2-abologna@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
---
src/util/virscsi.c | 146 ++++++++++++++++++++++++++++++---
src/util/virscsi.c | 140 ++++++++++++++++++++++++++++++---
tests/virscsidata/0-0-0-0/type | 1 +
tests/virscsidata/1-0-0-0/type | 1 +
3 files changed, 137 insertions(+), 11 deletions(-)
3 files changed, 131 insertions(+), 11 deletions(-)
create mode 100644 tests/virscsidata/0-0-0-0/type
create mode 100644 tests/virscsidata/1-0-0-0/type
diff --git a/src/util/virscsi.c b/src/util/virscsi.c
index 06659c45c7..c40857977f 100644
index 6a90d9002f..770f727cac 100644
--- a/src/util/virscsi.c
+++ b/src/util/virscsi.c
@@ -50,6 +50,32 @@ struct _virUsedByInfo {
@@ -47,6 +47,32 @@ struct _virUsedByInfo {
};
typedef struct _virUsedByInfo virUsedByInfo;
typedef virUsedByInfo *virUsedByInfoPtr;
+
+/* Keep in sync with scsi/scsi_proto.h */
@ -60,8 +60,8 @@ index 06659c45c7..c40857977f 100644
struct _virSCSIDevice {
unsigned int adapter;
unsigned int bus;
@@ -134,6 +160,84 @@ virSCSIDeviceGetSgName(const char *sysfs_prefix,
return sg;
@@ -126,6 +152,78 @@ virSCSIDeviceGetSgName(const char *sysfs_prefix,
return NULL;
}
+
@ -119,40 +119,33 @@ index 06659c45c7..c40857977f 100644
+ unsigned int target,
+ unsigned long long unit)
+{
+ DIR *dir = NULL;
+ g_autoptr(DIR) dir = NULL;
+ struct dirent *entry;
+ g_autofree char *path = NULL;
+ char *name = NULL;
+
+ path = g_strdup_printf("%s/%d:%u:%u:%llu/block",
+ prefix, adapter, bus, target, unit);
+
+ if (virDirOpen(&dir, path) < 0)
+ goto cleanup;
+ return NULL;
+
+ while (virDirRead(dir, &entry, path) > 0) {
+ name = g_strdup(entry->d_name);
+ break;
+ }
+ if (virDirRead(dir, &entry, path) > 0)
+ return g_strdup(entry->d_name);
+
+ cleanup:
+ VIR_DIR_CLOSE(dir);
+
+ return name;
+ return NULL;
+}
+
+
/* Returns device name (e.g. "sdc") on success, or NULL
* on failure.
*/
@@ -144,32 +248,52 @@ virSCSIDeviceGetDevName(const char *sysfs_prefix,
@@ -136,25 +234,45 @@ virSCSIDeviceGetDevName(const char *sysfs_prefix,
unsigned int target,
unsigned long long unit)
{
- DIR *dir = NULL;
- g_autoptr(DIR) dir = NULL;
- struct dirent *entry;
- g_autofree char *path = NULL;
char *name = NULL;
unsigned int adapter_id;
+ virSCSIDeviceType type;
const char *prefix = sysfs_prefix ? sysfs_prefix : SYSFS_SCSI_DEVICES;
@ -162,19 +155,20 @@ index 06659c45c7..c40857977f 100644
- path = g_strdup_printf("%s/%d:%u:%u:%llu/block", prefix, adapter_id, bus,
- target, unit);
-
- if (virDirOpen(&dir, path) < 0)
+ if (virSCSIDeviceGetType(prefix, adapter_id,
+ bus, target, unit, &type) < 0)
+ return NULL;
return NULL;
- if (virDirOpen(&dir, path) < 0)
- goto cleanup;
- if (virDirRead(dir, &entry, path) > 0)
- return g_strdup(entry->d_name);
-
- return NULL;
+ switch (type) {
+ case VIR_SCSI_DEVICE_TYPE_DISK:
+ name = virSCSIDeviceGetDevNameBlock(prefix, adapter_id, bus, target, unit);
+ break;
- while (virDirRead(dir, &entry, path) > 0) {
- name = g_strdup(entry->d_name);
+ return virSCSIDeviceGetDevNameBlock(prefix, adapter_id, bus, target, unit);
+
+ case VIR_SCSI_DEVICE_TYPE_TAPE:
+ case VIR_SCSI_DEVICE_TYPE_PRINTER:
+ case VIR_SCSI_DEVICE_TYPE_PROCESSOR:
@ -197,18 +191,11 @@ index 06659c45c7..c40857977f 100644
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unsupported SCSI device type: %x"),
+ type);
break;
+ return NULL;
+ }
}
- cleanup:
- VIR_DIR_CLOSE(dir);
return name;
}
+
virSCSIDevicePtr
virSCSIDeviceNew(const char *sysfs_prefix,
const char *adapter,
virSCSIDevice *
diff --git a/tests/virscsidata/0-0-0-0/type b/tests/virscsidata/0-0-0-0/type
new file mode 100644
index 0000000000..573541ac97
@ -224,5 +211,5 @@ index 0000000000..573541ac97
@@ -0,0 +1 @@
+0
--
2.25.1
2.34.1

View File

@ -1,5 +1,5 @@
From c9fc757c867d197c17350b6a9cabc63cc08105d2 Mon Sep 17 00:00:00 2001
Message-Id: <c9fc757c867d197c17350b6a9cabc63cc08105d2@dist-git>
From 1ce4faffcd4616bbcea4d198c3f60cbcfddd784e Mon Sep 17 00:00:00 2001
Message-Id: <1ce4faffcd4616bbcea4d198c3f60cbcfddd784e@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Fri, 6 Mar 2020 15:52:23 +0100
Subject: [PATCH] RHEL: virscsi: Introduce and use
@ -22,16 +22,18 @@ Message-Id: <20200306145226.1610708-4-abologna@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
---
src/libvirt_private.syms | 1 +
src/qemu/qemu_conf.c | 18 +++++++++++-------
src/util/virscsi.c | 18 ++++++++++++++++++
src/qemu/qemu_conf.c | 31 +++++++++++++++++++------------
src/util/virscsi.c | 19 +++++++++++++++++++
src/util/virscsi.h | 5 +++++
4 files changed, 35 insertions(+), 7 deletions(-)
src/util/virutil.c | 24 ++++++------------------
src/util/virutil.h | 2 --
6 files changed, 50 insertions(+), 32 deletions(-)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 5dc99e03cf..1f97879faa 100644
index 5b76e66e61..2c42e2a5e8 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -2959,6 +2959,7 @@ virSCSIDeviceGetSgName;
@@ -3191,6 +3191,7 @@ virSCSIDeviceGetSgName;
virSCSIDeviceGetShareable;
virSCSIDeviceGetTarget;
virSCSIDeviceGetUnit;
@ -40,29 +42,50 @@ index 5dc99e03cf..1f97879faa 100644
virSCSIDeviceListAdd;
virSCSIDeviceListCount;
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 7aaf2862a4..6d6feb97cd 100644
index 28c334761b..a0b8076d6b 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -1789,7 +1789,6 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
virDomainDiskDefPtr disk = NULL;
virDomainHostdevDefPtr hostdev = NULL;
g_autofree char *sysfs_path = NULL;
- g_autofree char *hostdev_path = NULL;
const char *path = NULL;
int val = 0;
@@ -1804,24 +1803,29 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
@@ -1506,7 +1506,7 @@ qemuCheckUnprivSGIO(GHashTable *sharedDevices,
if (!(virHashLookup(sharedDevices, key)))
return 0;
path = virDomainDiskGetSource(disk);
- if (virGetDeviceUnprivSGIO(device_path, NULL, &val) < 0)
+ if (virGetDeviceUnprivSGIO(sysfs_path, &val) < 0)
return -1;
/* Error message on failure needs to be handled in caller
@@ -1857,39 +1857,46 @@ qemuSetUnprivSGIO(virDomainDeviceDef *dev)
virDomainDiskDef *disk = NULL;
virDomainHostdevDef *hostdev = NULL;
g_autofree char *sysfs_path = NULL;
- g_autofree char *hostdev_path = NULL;
- const char *path = NULL;
int val = 0;
/* "sgio" is only valid for block disk; cdrom
* and floopy disk can have empty source.
*/
if (dev->type == VIR_DOMAIN_DEVICE_DISK) {
+ const char *path;
+
disk = dev->data.disk;
+ path = virDomainDiskGetSource(disk);
if (disk->device != VIR_DOMAIN_DISK_DEVICE_LUN ||
!virStorageSourceIsBlockLocal(disk->src))
return 0;
- path = virDomainDiskGetSource(disk);
+ if (!(sysfs_path = virGetUnprivSGIOSysfsPath(path, NULL)))
+ return -1;
+
} else if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV) {
+ virDomainHostdevSubsysSCSI *scsisrc;
+ virDomainHostdevSubsysSCSIHost *scsihostsrc;
+
hostdev = dev->data.hostdev;
+ virDomainHostdevSubsysSCSIPtr scsisrc = &hostdev->source.subsys.u.scsi;
+ virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host;
+ scsisrc = &hostdev->source.subsys.u.scsi;
+ scsihostsrc = &scsisrc->u.host;
if (hostdev->source.subsys.u.scsi.protocol ==
VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI)
@ -87,14 +110,29 @@ index 7aaf2862a4..6d6feb97cd 100644
/* By default, filter the SG_IO commands, i.e. set unpriv_sgio to 0. */
if (dev->type == VIR_DOMAIN_DEVICE_DISK) {
if (disk->sgio == VIR_DOMAIN_DEVICE_SGIO_UNFILTERED)
@@ -1909,11 +1916,11 @@ qemuSetUnprivSGIO(virDomainDeviceDef *dev)
if (virFileExists(sysfs_path) || val == 1) {
int curr_val;
- if (virGetDeviceUnprivSGIO(path, NULL, &curr_val) < 0)
+ if (virGetDeviceUnprivSGIO(sysfs_path, &curr_val) < 0)
return -1;
if (curr_val != val &&
- virSetDeviceUnprivSGIO(path, NULL, val) < 0) {
+ virSetDeviceUnprivSGIO(sysfs_path, val) < 0) {
return -1;
}
}
diff --git a/src/util/virscsi.c b/src/util/virscsi.c
index 57958c06ea..1bba4051b6 100644
index 6165196423..b437fdcac0 100644
--- a/src/util/virscsi.c
+++ b/src/util/virscsi.c
@@ -322,6 +322,24 @@ virSCSIDeviceGetDevName(const char *sysfs_prefix,
@@ -302,6 +302,25 @@ virSCSIDeviceGetDevName(const char *sysfs_prefix,
}
}
+
+char *
+virSCSIDeviceGetUnprivSGIOSysfsPath(const char *sysfs_prefix,
+ const char *adapter,
@ -113,14 +151,14 @@ index 57958c06ea..1bba4051b6 100644
+}
+
+
virSCSIDevicePtr
virSCSIDevice *
virSCSIDeviceNew(const char *sysfs_prefix,
const char *adapter,
diff --git a/src/util/virscsi.h b/src/util/virscsi.h
index 51627e0c05..c040d76716 100644
index 65ad15ed76..5721985939 100644
--- a/src/util/virscsi.h
+++ b/src/util/virscsi.h
@@ -42,6 +42,11 @@ char *virSCSIDeviceGetDevName(const char *sysfs_prefix,
@@ -40,6 +40,11 @@ char *virSCSIDeviceGetDevName(const char *sysfs_prefix,
unsigned int bus,
unsigned int target,
unsigned long long unit);
@ -130,8 +168,105 @@ index 51627e0c05..c040d76716 100644
+ unsigned int target,
+ unsigned long long unit);
virSCSIDevicePtr virSCSIDeviceNew(const char *sysfs_prefix,
virSCSIDevice *virSCSIDeviceNew(const char *sysfs_prefix,
const char *adapter,
--
2.25.1
diff --git a/src/util/virutil.c b/src/util/virutil.c
index e04f1343d8..b1e37b45c5 100644
--- a/src/util/virutil.c
+++ b/src/util/virutil.c
@@ -1377,18 +1377,13 @@ virGetUnprivSGIOSysfsPath(const char *path,
int
virSetDeviceUnprivSGIO(const char *path,
- const char *sysfs_dir,
int unpriv_sgio)
{
- char *sysfs_path = NULL;
char *val = NULL;
int ret = -1;
int rc;
- if (!(sysfs_path = virGetUnprivSGIOSysfsPath(path, sysfs_dir)))
- return -1;
-
- if (!virFileExists(sysfs_path)) {
+ if (!virFileExists(path)) {
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("unpriv_sgio is not supported by this kernel"));
goto cleanup;
@@ -1396,38 +1391,32 @@ virSetDeviceUnprivSGIO(const char *path,
val = g_strdup_printf("%d", unpriv_sgio);
- if ((rc = virFileWriteStr(sysfs_path, val, 0)) < 0) {
- virReportSystemError(-rc, _("failed to set %s"), sysfs_path);
+ if ((rc = virFileWriteStr(path, val, 0)) < 0) {
+ virReportSystemError(-rc, _("failed to set %s"), path);
goto cleanup;
}
ret = 0;
cleanup:
- VIR_FREE(sysfs_path);
VIR_FREE(val);
return ret;
}
int
virGetDeviceUnprivSGIO(const char *path,
- const char *sysfs_dir,
int *unpriv_sgio)
{
- char *sysfs_path = NULL;
char *buf = NULL;
char *tmp = NULL;
int ret = -1;
- if (!(sysfs_path = virGetUnprivSGIOSysfsPath(path, sysfs_dir)))
- return -1;
-
- if (!virFileExists(sysfs_path)) {
+ if (!virFileExists(path)) {
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("unpriv_sgio is not supported by this kernel"));
goto cleanup;
}
- if (virFileReadAll(sysfs_path, 1024, &buf) < 0)
+ if (virFileReadAll(path, 1024, &buf) < 0)
goto cleanup;
if ((tmp = strchr(buf, '\n')))
@@ -1435,13 +1424,12 @@ virGetDeviceUnprivSGIO(const char *path,
if (virStrToLong_i(buf, NULL, 10, unpriv_sgio) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("failed to parse value of %s"), sysfs_path);
+ _("failed to parse value of %s"), path);
goto cleanup;
}
ret = 0;
cleanup:
- VIR_FREE(sysfs_path);
VIR_FREE(buf);
return ret;
}
diff --git a/src/util/virutil.h b/src/util/virutil.h
index 854b494890..da267c6446 100644
--- a/src/util/virutil.h
+++ b/src/util/virutil.h
@@ -120,10 +120,8 @@ int virGetDeviceID(const char *path,
int *maj,
int *min) G_GNUC_NO_INLINE;
int virSetDeviceUnprivSGIO(const char *path,
- const char *sysfs_dir,
int unpriv_sgio);
int virGetDeviceUnprivSGIO(const char *path,
- const char *sysfs_dir,
int *unpriv_sgio);
char *virGetUnprivSGIOSysfsPath(const char *path,
const char *sysfs_dir);
--
2.34.1

View File

@ -1,5 +1,5 @@
From c481bcacd1f515d2e93036dc452a25e9ff06f7ae Mon Sep 17 00:00:00 2001
Message-Id: <c481bcacd1f515d2e93036dc452a25e9ff06f7ae@dist-git>
From 5b96a8773d33af9822f6b6ccddc8f372841895a6 Mon Sep 17 00:00:00 2001
Message-Id: <5b96a8773d33af9822f6b6ccddc8f372841895a6@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Fri, 6 Mar 2020 15:52:22 +0100
Subject: [PATCH] RHEL: virscsi: Support TAPEs in virSCSIDeviceGetDevName()
@ -15,7 +15,7 @@ Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Message-Id: <20200306145226.1610708-3-abologna@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
---
src/util/virscsi.c | 28 +++++++++++++++
src/util/virscsi.c | 27 +++++++++++++++
tests/virscsidata/2-0-0-0/model | 1 +
tests/virscsidata/2-0-0-0/scsi_tape/st0/dev | 1 +
tests/virscsidata/2-0-0-0/sg3/dev | 1 +
@ -24,7 +24,7 @@ Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
tests/virscsidata/2-0-0-0/vendor | 1 +
tests/virscsidata/sg3 | 0
tests/virscsitest.c | 38 ++++++++++++++++++---
9 files changed, 67 insertions(+), 5 deletions(-)
9 files changed, 66 insertions(+), 5 deletions(-)
create mode 100644 tests/virscsidata/2-0-0-0/model
create mode 100644 tests/virscsidata/2-0-0-0/scsi_tape/st0/dev
create mode 100644 tests/virscsidata/2-0-0-0/sg3/dev
@ -34,10 +34,10 @@ Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
create mode 100644 tests/virscsidata/sg3
diff --git a/src/util/virscsi.c b/src/util/virscsi.c
index c40857977f..57958c06ea 100644
index 770f727cac..6165196423 100644
--- a/src/util/virscsi.c
+++ b/src/util/virscsi.c
@@ -238,6 +238,31 @@ virSCSIDeviceGetDevNameBlock(const char *prefix,
@@ -224,6 +224,31 @@ virSCSIDeviceGetDevNameBlock(const char *prefix,
}
@ -69,12 +69,11 @@ index c40857977f..57958c06ea 100644
/* Returns device name (e.g. "sdc") on success, or NULL
* on failure.
*/
@@ -266,6 +291,9 @@ virSCSIDeviceGetDevName(const char *sysfs_prefix,
break;
@@ -250,6 +275,8 @@ virSCSIDeviceGetDevName(const char *sysfs_prefix,
return virSCSIDeviceGetDevNameBlock(prefix, adapter_id, bus, target, unit);
case VIR_SCSI_DEVICE_TYPE_TAPE:
+ name = virSCSIDeviceGetDevNameTape(prefix, adapter_id, bus, target, unit);
+ break;
+ return virSCSIDeviceGetDevNameTape(prefix, adapter_id, bus, target, unit);
+
case VIR_SCSI_DEVICE_TYPE_PRINTER:
case VIR_SCSI_DEVICE_TYPE_PROCESSOR:
@ -126,10 +125,10 @@ diff --git a/tests/virscsidata/sg3 b/tests/virscsidata/sg3
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/virscsitest.c b/tests/virscsitest.c
index d5a0da4753..e501d6d041 100644
index c96699e157..924b77af08 100644
--- a/tests/virscsitest.c
+++ b/tests/virscsitest.c
@@ -32,18 +32,34 @@ VIR_LOG_INIT("tests.scsitest");
@@ -33,17 +33,33 @@ VIR_LOG_INIT("tests.scsitest");
static char *virscsi_prefix;
@ -146,8 +145,7 @@ index d5a0da4753..e501d6d041 100644
+testGetDevName(const void *opaque)
{
+ const testGetDevNameData *data = opaque;
char *name = NULL;
int ret = -1;
g_autofree char *name = NULL;
if (!(name = virSCSIDeviceGetDevName(virscsi_prefix,
- "scsi_host1", 0, 0, 0)))
@ -162,12 +160,12 @@ index d5a0da4753..e501d6d041 100644
+ fprintf(stderr,
+ "SCSI dev name mismatch, expected %s got %s",
+ data->expectedName, name);
goto cleanup;
return -1;
+ }
ret = 0;
cleanup:
@@ -212,15 +228,27 @@ mymain(void)
return 0;
}
@@ -200,15 +216,27 @@ mymain(void)
CREATE_SYMLINK("0-0-0-0", "0:0:0:0");
CREATE_SYMLINK("1-0-0-0", "1:0:0:0");
@ -198,5 +196,5 @@ index d5a0da4753..e501d6d041 100644
ret = -1;
--
2.25.1
2.34.1

View File

@ -1,5 +1,5 @@
From cd2640c256389b4041e4cd38fd72f77184bb4414 Mon Sep 17 00:00:00 2001
Message-Id: <cd2640c256389b4041e4cd38fd72f77184bb4414@dist-git>
From ac8357ab7dd676af82b971673f8d7e862ff07624 Mon Sep 17 00:00:00 2001
Message-Id: <ac8357ab7dd676af82b971673f8d7e862ff07624@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Fri, 6 Mar 2020 15:52:24 +0100
Subject: [PATCH] RHEL: virutil: Accept non-block devices in virGetDeviceID()
@ -19,10 +19,10 @@ Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
1 file changed, 3 deletions(-)
diff --git a/src/util/virutil.c b/src/util/virutil.c
index a0fd7618ee..f142951acf 100644
index b1e37b45c5..ced8493516 100644
--- a/src/util/virutil.c
+++ b/src/util/virutil.c
@@ -1379,9 +1379,6 @@ virGetDeviceID(const char *path, int *maj, int *min)
@@ -1333,9 +1333,6 @@ virGetDeviceID(const char *path, int *maj, int *min)
if (stat(path, &sb) < 0)
return -errno;
@ -33,5 +33,5 @@ index a0fd7618ee..f142951acf 100644
*maj = major(sb.st_rdev);
if (min)
--
2.25.1
2.34.1

View File

@ -1,63 +0,0 @@
From e37b1531942872a229b9f45524ea4679f3b1e8d6 Mon Sep 17 00:00:00 2001
Message-Id: <e37b1531942872a229b9f45524ea4679f3b1e8d6@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Mon, 9 Nov 2020 17:22:33 +0100
Subject: [PATCH] RNG: Allow interleaving of /domain/cpu/numa/cell children
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
So far, the <cell/> element can have two types of children
elements: <distances/> and <cache/> (which can be repeated more
times). However, there is no reason to require specific order in
input XML. Allow elements to be interleaved.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit fd2ad818b29ca56904dd228f0774f553f99c1157)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1749518
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Message-Id: <48b8e99ea6fbc6bcab0f7b3d17e7824ef1b232e2.1604938847.git.mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
docs/schemas/cputypes.rng | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/docs/schemas/cputypes.rng b/docs/schemas/cputypes.rng
index ba30dbf9ff..a1cae23161 100644
--- a/docs/schemas/cputypes.rng
+++ b/docs/schemas/cputypes.rng
@@ -146,16 +146,18 @@
<ref name="virYesNo"/>
</attribute>
</optional>
- <optional>
- <element name="distances">
- <oneOrMore>
- <ref name="numaDistance"/>
- </oneOrMore>
- </element>
- </optional>
- <zeroOrMore>
- <ref name="numaCache"/>
- </zeroOrMore>
+ <interleave>
+ <optional>
+ <element name="distances">
+ <oneOrMore>
+ <ref name="numaDistance"/>
+ </oneOrMore>
+ </element>
+ </optional>
+ <zeroOrMore>
+ <ref name="numaCache"/>
+ </zeroOrMore>
+ </interleave>
</element>
</define>
--
2.29.2

View File

@ -1,62 +0,0 @@
From ca7c7a8b07c31dc8bf96f7da6fb53af884e36ddb Mon Sep 17 00:00:00 2001
Message-Id: <ca7c7a8b07c31dc8bf96f7da6fb53af884e36ddb@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Tue, 4 Feb 2020 15:08:01 +0100
Subject: [PATCH] Remove checking of return value of virHashNew
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
There are two calls to virHashNew which check the return value. It's not
necessary any more as virHashNew always returns a valid pointer.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 6eab924daa243afa67f2cc20dcbdf521904bb62b)
https://bugzilla.redhat.com/show_bug.cgi?id=1793263
Message-Id: <08acb2e50b584a75c0131a628ee441f47e8fe823.1580824112.git.pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/conf/backup_conf.c | 6 +-----
src/qemu/qemu_monitor_json.c | 3 +--
2 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/src/conf/backup_conf.c b/src/conf/backup_conf.c
index b370b686f1..64c8f6cc09 100644
--- a/src/conf/backup_conf.c
+++ b/src/conf/backup_conf.c
@@ -439,15 +439,11 @@ virDomainBackupAlignDisks(virDomainBackupDefPtr def,
virDomainDefPtr dom,
const char *suffix)
{
- g_autoptr(virHashTable) disks = NULL;
+ g_autoptr(virHashTable) disks = virHashNew(NULL);
size_t i;
int ndisks;
bool backup_all = false;
-
- if (!(disks = virHashNew(NULL)))
- return -1;
-
/* Unlikely to have a guest without disks but technically possible. */
if (!dom->ndisks) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 5d8c7e9b5e..3fc0bcb80c 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -2992,8 +2992,7 @@ qemuMonitorJSONBlockGetNamedNodeDataJSON(virJSONValuePtr nodes)
{
g_autoptr(virHashTable) ret = NULL;
- if (!(ret = virHashNew((virHashDataFree) qemuMonitorJSONBlockNamedNodeDataFree)))
- return NULL;
+ ret = virHashNew((virHashDataFree) qemuMonitorJSONBlockNamedNodeDataFree);
if (virJSONValueArrayForeachSteal(nodes,
qemuMonitorJSONBlockGetNamedNodeDataWorker,
--
2.25.0

View File

@ -1,109 +0,0 @@
From 160863c5cac5519c287462439b9ce8abc6a8237e Mon Sep 17 00:00:00 2001
Message-Id: <160863c5cac5519c287462439b9ce8abc6a8237e@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Mon, 16 Mar 2020 22:11:48 +0100
Subject: [PATCH] Remove qemuDomainSecretInfoNew
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Replace it by a direct call to qemuDomainSecretAESSetupFromSecret.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit f742461389c11a7d4cc8bda941814c4128eadf94)
https://bugzilla.redhat.com/show_bug.cgi?id=1804750
Message-Id: <c14d98c90ae9d0e9c5e4fef6a8e5061411c43a78.1584391726.git.pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/qemu/qemu_domain.c | 53 +++++++++++-------------------------------
1 file changed, 13 insertions(+), 40 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index c286f50650..af23079d5d 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -1669,33 +1669,6 @@ qemuDomainSecretInfoNewPlain(virSecretUsageType usageType,
}
-/* qemuDomainSecretInfoNew:
- * @priv: pointer to domain private object
- * @srcAlias: Alias base to use for TLS object
- * @usageType: Secret usage type
- * @username: username
- * @looupDef: lookup def describing secret
- * @isLuks: boolean for luks lookup
- *
- * Helper function to create a secinfo to be used for secinfo consumers. This
- * sets up encrypted data to be used with qemu's 'secret' object.
- *
- * Returns @secinfo on success, NULL on failure. Caller is responsible
- * to eventually free @secinfo.
- */
-static qemuDomainSecretInfoPtr
-qemuDomainSecretInfoNew(qemuDomainObjPrivatePtr priv,
- const char *srcAlias,
- virSecretUsageType usageType,
- const char *username,
- virSecretLookupTypeDefPtr lookupDef,
- bool isLuks)
-{
- return qemuDomainSecretAESSetupFromSecret(priv, srcAlias, usageType, username,
- lookupDef, isLuks);
-}
-
-
/**
* qemuDomainSecretInfoTLSNew:
* @priv: pointer to domain private object
@@ -1722,9 +1695,9 @@ qemuDomainSecretInfoTLSNew(qemuDomainObjPrivatePtr priv,
}
seclookupdef.type = VIR_SECRET_LOOKUP_TYPE_UUID;
- return qemuDomainSecretInfoNew(priv, srcAlias,
- VIR_SECRET_USAGE_TYPE_TLS, NULL,
- &seclookupdef, false);
+ return qemuDomainSecretAESSetupFromSecret(priv, srcAlias,
+ VIR_SECRET_USAGE_TYPE_TLS,
+ NULL, &seclookupdef, false);
}
@@ -1814,11 +1787,11 @@ qemuDomainSecretStorageSourcePrepare(qemuDomainObjPrivatePtr priv,
src->auth->username,
&src->auth->seclookupdef);
} else {
- srcPriv->secinfo = qemuDomainSecretInfoNew(priv, authalias,
- usageType,
- src->auth->username,
- &src->auth->seclookupdef,
- false);
+ srcPriv->secinfo = qemuDomainSecretAESSetupFromSecret(priv, authalias,
+ usageType,
+ src->auth->username,
+ &src->auth->seclookupdef,
+ false);
}
if (!srcPriv->secinfo)
@@ -1826,11 +1799,11 @@ qemuDomainSecretStorageSourcePrepare(qemuDomainObjPrivatePtr priv,
}
if (hasEnc) {
- if (!(srcPriv->encinfo =
- qemuDomainSecretInfoNew(priv, encalias,
- VIR_SECRET_USAGE_TYPE_VOLUME, NULL,
- &src->encryption->secrets[0]->seclookupdef,
- true)))
+ if (!(srcPriv->encinfo = qemuDomainSecretAESSetupFromSecret(priv, encalias,
+ VIR_SECRET_USAGE_TYPE_VOLUME,
+ NULL,
+ &src->encryption->secrets[0]->seclookupdef,
+ true)))
return -1;
}
--
2.25.1

View File

@ -0,0 +1,103 @@
From 732113455fb7eadeea178c71cc77f0ffdf639f24 Mon Sep 17 00:00:00 2001
Message-Id: <732113455fb7eadeea178c71cc77f0ffdf639f24@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Tue, 18 Jan 2022 12:40:09 +0100
Subject: [PATCH] Revert "report error when virProcessGetStatInfo() is unable
to parse data"
This reverts commit 938382b60ae5bd1f83b5cb09e1ce68b9a88f679a.
Turns out, the commit did more harm than good. It changed
semantics on some public APIs. For instance, while
qemuDomainGetInfo() previously did not returned an error it does
now. While the calls to virProcessGetStatInfo() is guarded with
virDomainObjIsActive() it doesn't necessarily mean that QEMU's
PID is still alive. QEMU might be gone but we just haven't
realized it (e.g. because the eof handler thread is waiting for a
job).
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2041610
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
(cherry picked from commit 105dace22cc7b5b18d72a4dcad4a2cf386ce5c99)
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
src/ch/ch_driver.c | 2 ++
src/qemu/qemu_driver.c | 7 ++++++-
src/util/virprocess.c | 8 ++------
3 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/src/ch/ch_driver.c b/src/ch/ch_driver.c
index 3cbc668489..53e0872207 100644
--- a/src/ch/ch_driver.c
+++ b/src/ch/ch_driver.c
@@ -1073,6 +1073,8 @@ chDomainHelperGetVcpus(virDomainObj *vm,
if (virProcessGetStatInfo(&vcpuinfo->cpuTime,
&vcpuinfo->cpu, NULL,
vm->pid, vcpupid) < 0) {
+ virReportSystemError(errno, "%s",
+ _("cannot get vCPU placement & pCPU time"));
return -1;
}
}
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 65ac5ef367..d3d76c003f 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -1359,6 +1359,8 @@ qemuDomainHelperGetVcpus(virDomainObj *vm,
if (virProcessGetStatInfo(&vcpuinfo->cpuTime,
&vcpuinfo->cpu, NULL,
vm->pid, vcpupid) < 0) {
+ virReportSystemError(errno, "%s",
+ _("cannot get vCPU placement & pCPU time"));
return -1;
}
}
@@ -2519,6 +2521,8 @@ qemuDomainGetInfo(virDomainPtr dom,
if (virDomainObjIsActive(vm)) {
if (virProcessGetStatInfo(&(info->cpuTime), NULL, NULL,
vm->pid, 0) < 0) {
+ virReportError(VIR_ERR_OPERATION_FAILED, "%s",
+ _("cannot read cputime for domain"));
goto cleanup;
}
}
@@ -10526,7 +10530,8 @@ qemuDomainMemoryStatsInternal(virQEMUDriver *driver,
}
if (virProcessGetStatInfo(NULL, NULL, &rss, vm->pid, 0) < 0) {
- virResetLastError();
+ virReportError(VIR_ERR_OPERATION_FAILED, "%s",
+ _("cannot get RSS for domain"));
} else {
stats[ret].tag = VIR_DOMAIN_MEMORY_STAT_RSS;
stats[ret].val = rss;
diff --git a/src/util/virprocess.c b/src/util/virprocess.c
index 85d8c8e747..b559a4257e 100644
--- a/src/util/virprocess.c
+++ b/src/util/virprocess.c
@@ -1784,10 +1784,7 @@ virProcessGetStatInfo(unsigned long long *cpuTime,
virStrToLong_ullp(proc_stat[VIR_PROCESS_STAT_STIME], NULL, 10, &systime) < 0 ||
virStrToLong_l(proc_stat[VIR_PROCESS_STAT_RSS], NULL, 10, &rss) < 0 ||
virStrToLong_i(proc_stat[VIR_PROCESS_STAT_PROCESSOR], NULL, 10, &cpu) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("cannot parse process status data for pid '%d/%d'"),
- (int) pid, (int) tid);
- return -1;
+ VIR_WARN("cannot parse process status data");
}
/* We got jiffies
@@ -1884,8 +1881,7 @@ virProcessGetStatInfo(unsigned long long *cpuTime G_GNUC_UNUSED,
pid_t pid G_GNUC_UNUSED,
pid_t tid G_GNUC_UNUSED)
{
- virReportSystemError(ENOSYS, "%s",
- _("Process statistics data is not supported on this platform"));
+ errno = ENOSYS;
return -1;
}
--
2.35.0

View File

@ -1,45 +0,0 @@
From 0c1bec6a89f97c77ba9e0ed4146deb8606ea6f16 Mon Sep 17 00:00:00 2001
Message-Id: <0c1bec6a89f97c77ba9e0ed4146deb8606ea6f16@dist-git>
From: Jonathon Jongsma <jjongsma@redhat.com>
Date: Wed, 25 Mar 2020 11:21:19 -0500
Subject: [PATCH] api: disallow virDomainAgentSetResponseTimeout() on read-only
connections
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This function changes the amount of time that libvirt waits for a
response from the guest agent for all guest agent commands. Since this
is a configuration change, it should not be allowed on read-only
connections.
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 4cc90c2e62df653e909ad31fd810224bf8bcf913)
https://bugzilla.redhat.com/show_bug.cgi?id=1814508
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Message-Id: <20200325162119.9047-2-jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/libvirt-domain.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
index eb66999f07..3deee54e48 100644
--- a/src/libvirt-domain.c
+++ b/src/libvirt-domain.c
@@ -12554,6 +12554,8 @@ virDomainAgentSetResponseTimeout(virDomainPtr domain,
virCheckDomainReturn(domain, -1);
conn = domain->conn;
+ virCheckReadOnlyGoto(conn->flags, error);
+
if (conn->driver->domainAgentSetResponseTimeout) {
if (conn->driver->domainAgentSetResponseTimeout(domain, timeout, flags) < 0)
goto error;
--
2.26.0

View File

@ -1,146 +0,0 @@
From 8d08db00d403ddd17cb51d972842c6d13a122d57 Mon Sep 17 00:00:00 2001
Message-Id: <8d08db00d403ddd17cb51d972842c6d13a122d57@dist-git>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Thu, 4 Mar 2021 12:57:58 +0100
Subject: [PATCH] cgroup: use virCgroupSetCpuShares instead of
virCgroupSetupCpuShares
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Now that we enforce the cpu.shares range kernel will no longer silently
change the value that libvirt configures so there is no need to read
the value back to get the actual configuration.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit e95489d813cb7cc68b02905ce3ec059bc395b465)
Conflicts:
src/lxc/lxc_cgroup.c
src/lxc/lxc_driver.c
src/qemu/qemu_cgroup.c
src/qemu/qemu_driver.c
- downstream doesn't have virCgroupSetupCpuShares() function
so we just remove usage of virCgroupGetCpuShares()
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1798463
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Message-Id: <a7f8e3c0ce4bc22eccbaa25a434d5e72e74d8a65.1614858616.git.phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/lxc/lxc_cgroup.c | 5 -----
src/lxc/lxc_driver.c | 6 +-----
src/qemu/qemu_cgroup.c | 20 --------------------
src/qemu/qemu_driver.c | 8 ++------
4 files changed, 3 insertions(+), 36 deletions(-)
diff --git a/src/lxc/lxc_cgroup.c b/src/lxc/lxc_cgroup.c
index 7f3701593a..f785f50754 100644
--- a/src/lxc/lxc_cgroup.c
+++ b/src/lxc/lxc_cgroup.c
@@ -38,13 +38,8 @@ static int virLXCCgroupSetupCpuTune(virDomainDefPtr def,
virCgroupPtr cgroup)
{
if (def->cputune.sharesSpecified) {
- unsigned long long val;
if (virCgroupSetCpuShares(cgroup, def->cputune.shares) < 0)
return -1;
-
- if (virCgroupGetCpuShares(cgroup, &val) < 0)
- return -1;
- def->cputune.shares = val;
}
if (def->cputune.quota != 0 &&
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index a8c93dd228..853ddac8b9 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -1909,14 +1909,10 @@ lxcDomainSetSchedulerParametersFlags(virDomainPtr dom,
if (STREQ(param->field, VIR_DOMAIN_SCHEDULER_CPU_SHARES)) {
if (def) {
- unsigned long long val;
if (virCgroupSetCpuShares(priv->cgroup, params[i].value.ul) < 0)
goto endjob;
- if (virCgroupGetCpuShares(priv->cgroup, &val) < 0)
- goto endjob;
-
- def->cputune.shares = val;
+ def->cputune.shares = params[i].value.ul;
def->cputune.sharesSpecified = true;
}
diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index 3a62b4ac15..95ea5bed74 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -933,10 +933,6 @@ static int
qemuSetupCpuCgroup(virDomainObjPtr vm)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
- virObjectEventPtr event = NULL;
- virTypedParameterPtr eventParams = NULL;
- int eventNparams = 0;
- int eventMaxparams = 0;
if (!virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_CPU)) {
if (vm->def->cputune.sharesSpecified) {
@@ -949,24 +945,8 @@ qemuSetupCpuCgroup(virDomainObjPtr vm)
}
if (vm->def->cputune.sharesSpecified) {
- unsigned long long val;
if (virCgroupSetCpuShares(priv->cgroup, vm->def->cputune.shares) < 0)
return -1;
-
- if (virCgroupGetCpuShares(priv->cgroup, &val) < 0)
- return -1;
- if (vm->def->cputune.shares != val) {
- vm->def->cputune.shares = val;
- if (virTypedParamsAddULLong(&eventParams, &eventNparams,
- &eventMaxparams,
- VIR_DOMAIN_TUNABLE_CPU_CPU_SHARES,
- val) < 0)
- return -1;
-
- event = virDomainEventTunableNewFromObj(vm, eventParams, eventNparams);
- }
-
- virObjectEventStateQueue(priv->driver->domainEventState, event);
}
return 0;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index a1103a96dd..3914d3ff68 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -10625,20 +10625,16 @@ qemuDomainSetSchedulerParametersFlags(virDomainPtr dom,
if (STREQ(param->field, VIR_DOMAIN_SCHEDULER_CPU_SHARES)) {
if (def) {
- unsigned long long val;
if (virCgroupSetCpuShares(priv->cgroup, value_ul) < 0)
goto endjob;
- if (virCgroupGetCpuShares(priv->cgroup, &val) < 0)
- goto endjob;
-
- def->cputune.shares = val;
+ def->cputune.shares = value_ul;
def->cputune.sharesSpecified = true;
if (virTypedParamsAddULLong(&eventParams, &eventNparams,
&eventMaxNparams,
VIR_DOMAIN_TUNABLE_CPU_CPU_SHARES,
- val) < 0)
+ value_ul) < 0)
goto endjob;
}
--
2.30.0

View File

@ -1,77 +0,0 @@
From 5fe7795d5fa5061f0ba615472f9351f9d29abf48 Mon Sep 17 00:00:00 2001
Message-Id: <5fe7795d5fa5061f0ba615472f9351f9d29abf48@dist-git>
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
Date: Fri, 2 Oct 2020 13:44:44 +0200
Subject: [PATCH] check for NULL before calling g_regex_unref
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
g_regex_unref reports an error if called with a NULL argument.
We have two cases in the code where we (possibly) call it on a NULL
argument. The interesting one is in virDomainQemuMonitorEventCleanup.
Based on VIR_CONNECT_DOMAIN_QEMU_MONITOR_EVENT_REGISTER_REGEX, we unref
data->regex, which has two problems:
* On the client side, flags is -1 so the comparison is true even if no
regex was used, reproducible by:
$ virsh qemu-monitor-event --timeout 1
which results in an ugly error:
(process:1289846): GLib-CRITICAL **: 14:58:42.631: g_regex_unref: assertion 'regex != NULL' failed
* On the server side, we only create the regex if both the flag and the
string are present, so it's possible to trigger this message by:
$ virsh qemu-monitor-event --regex --timeout 1
Use a non-NULL comparison instead of the flag to decide whether we need
to unref the regex. And add a non-NULL check to the unref in the
VirtualBox test too.
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Fixes: 71efb59a4de7c51b1bc889a316f1796ebf55738f
https://bugzilla.redhat.com/show_bug.cgi?id=1876907
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit 92b252456ee6d6ffc6e39e62ce1ce6c50113e00e)
https://bugzilla.redhat.com/show_bug.cgi?id=1861176
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Message-Id: <7d3c84f6556d0d46ada037d5e56c831babba609f.1601639064.git.jtomko@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
---
src/conf/domain_event.c | 2 +-
tests/vboxsnapshotxmltest.c | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/conf/domain_event.c b/src/conf/domain_event.c
index 33fbf10406..d3acde0236 100644
--- a/src/conf/domain_event.c
+++ b/src/conf/domain_event.c
@@ -2194,7 +2194,7 @@ virDomainQemuMonitorEventCleanup(void *opaque)
virDomainQemuMonitorEventData *data = opaque;
VIR_FREE(data->event);
- if (data->flags & VIR_CONNECT_DOMAIN_QEMU_MONITOR_EVENT_REGISTER_REGEX)
+ if (data->regex)
g_regex_unref(data->regex);
if (data->freecb)
(data->freecb)(data->opaque);
diff --git a/tests/vboxsnapshotxmltest.c b/tests/vboxsnapshotxmltest.c
index d1a7522931..8577157020 100644
--- a/tests/vboxsnapshotxmltest.c
+++ b/tests/vboxsnapshotxmltest.c
@@ -134,7 +134,8 @@ mymain(void)
DO_TEST("2disks-3snap-brother");
cleanup:
- g_regex_unref(testSnapshotXMLVariableLineRegex);
+ if (testSnapshotXMLVariableLineRegex)
+ g_regex_unref(testSnapshotXMLVariableLineRegex);
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
--
2.28.0

View File

@ -1,449 +0,0 @@
From 4abdfae3b67295a0143f650768630e009d1b2798 Mon Sep 17 00:00:00 2001
Message-Id: <4abdfae3b67295a0143f650768630e009d1b2798@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Mon, 16 Mar 2020 22:11:57 +0100
Subject: [PATCH] conf: Add support for cookies for HTTP based disks
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Add possibility to specify one or more cookies for http based disks.
This patch adds the config parser, storage and validation of the
cookies.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit 3b076391befc3fe72deb0c244ac6c2b4c100b410)
https://bugzilla.redhat.com/show_bug.cgi?id=1804750
Message-Id: <3135a30f0d0a1a4bb8da02c49f10a1bcf3a394f4.1584391727.git.pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
docs/formatdomain.html.in | 10 ++
docs/schemas/domaincommon.rng | 24 ++++
src/conf/domain_conf.c | 82 +++++++++++++
src/libvirt_private.syms | 1 +
src/util/virstoragefile.c | 115 ++++++++++++++++++
src/util/virstoragefile.h | 15 +++
.../disk-network-http.xml | 8 ++
7 files changed, 255 insertions(+)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 2cce247958..5a10d64e83 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -2839,6 +2839,9 @@
&lt;driver name='qemu' type='raw'/&gt;
&lt;source protocol="http" name="url_path"&gt;
&lt;host name="hostname" port="80"/&gt;
+ &lt;cookies&gt;
+ &lt;cookie name="test"&gt;somevalue&lt;/cookie&gt;
+ &lt;/cookies&gt;
&lt;/source&gt;
&lt;target dev='hde' bus='ide' tray='open'/&gt;
&lt;readonly/&gt;
@@ -3382,6 +3385,13 @@
certificate validation. Supported values are <code>yes</code> and
<code>no</code>. <span class="since">Since 6.2.0</span>
</dd>
+ <dt><code>cookies</code></dt>
+ <dd>
+ For <code>http</code> and <code>https</code> accessed storage it's
+ possible to pass one or more cookies. The cookie name and value
+ must conform to the HTTP specification.
+ <span class="since">Since 6.2.0</span>
+ </dd>
</dl>
<p>
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 548601b61c..bdf35e64f6 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -1817,6 +1817,24 @@
</element>
</define>
+ <define name="diskSourceNetworkProtocolHTTPCookies">
+ <element name="cookies">
+ <oneOrMore>
+ <element name="cookie">
+ <attribute name="name">
+ <data type="string">
+ <param name="pattern">[!#$%&amp;'*+\-.0-9A-Z\^_`a-z|~]+</param>
+ </data>
+ </attribute>
+ <data type="string">
+ <param name="pattern">[!#$%&amp;'()*+\-./0-9:&gt;=&lt;?@A-Z\^_`\[\]a-z|~]+</param>
+ </data>
+ </element>
+ </oneOrMore>
+ <empty/>
+ </element>
+ </define>
+
<define name="diskSourceNetworkProtocolHTTPS">
<element name="source">
<attribute name="protocol">
@@ -1833,6 +1851,9 @@
<optional>
<ref name="diskSourceNetworkProtocolSSLVerify"/>
</optional>
+ <optional>
+ <ref name="diskSourceNetworkProtocolHTTPCookies"/>
+ </optional>
</element>
</define>
@@ -1849,6 +1870,9 @@
<optional>
<ref name="encryption"/>
</optional>
+ <optional>
+ <ref name="diskSourceNetworkProtocolHTTPCookies"/>
+ </optional>
</element>
</define>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 70bbc35bb3..d066d3aac1 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -9249,6 +9249,62 @@ virDomainDiskSourcePoolDefParse(xmlNodePtr node,
}
+static virStorageNetCookieDefPtr
+virDomainStorageNetCookieParse(xmlNodePtr node,
+ xmlXPathContextPtr ctxt)
+{
+ VIR_XPATH_NODE_AUTORESTORE(ctxt);
+ g_autoptr(virStorageNetCookieDef) cookie = NULL;
+
+ ctxt->node = node;
+
+ cookie = g_new0(virStorageNetCookieDef, 1);
+
+ if (!(cookie->name = virXPathString("string(./@name)", ctxt))) {
+ virReportError(VIR_ERR_XML_ERROR, "%s", _("missing cookie name"));
+ return NULL;
+ }
+
+ if (!(cookie->value = virXPathString("string(.)", ctxt))) {
+ virReportError(VIR_ERR_XML_ERROR, _("missing value for cookie '%s'"),
+ cookie->name);
+ return NULL;
+ }
+
+ return g_steal_pointer(&cookie);
+}
+
+
+static int
+virDomainStorageNetCookiesParse(xmlNodePtr node,
+ xmlXPathContextPtr ctxt,
+ virStorageSourcePtr src)
+{
+ VIR_XPATH_NODE_AUTORESTORE(ctxt);
+ g_autofree xmlNodePtr *nodes = NULL;
+ ssize_t nnodes;
+ size_t i;
+
+ ctxt->node = node;
+
+ if ((nnodes = virXPathNodeSet("./cookie", ctxt, &nodes)) < 0)
+ return -1;
+
+ src->cookies = g_new0(virStorageNetCookieDefPtr, nnodes);
+ src->ncookies = nnodes;
+
+ for (i = 0; i < nnodes; i++) {
+ if (!(src->cookies[i] = virDomainStorageNetCookieParse(nodes[i], ctxt)))
+ return -1;
+ }
+
+ if (virStorageSourceNetCookiesValidate(src) < 0)
+ return -1;
+
+ return 0;
+}
+
+
static int
virDomainDiskSourceNetworkParse(xmlNodePtr node,
xmlXPathContextPtr ctxt,
@@ -9260,6 +9316,7 @@ virDomainDiskSourceNetworkParse(xmlNodePtr node,
g_autofree char *haveTLS = NULL;
g_autofree char *tlsCfg = NULL;
g_autofree char *sslverifystr = NULL;
+ xmlNodePtr tmpnode;
if (!(protocol = virXMLPropString(node, "protocol"))) {
virReportError(VIR_ERR_XML_ERROR, "%s",
@@ -9345,6 +9402,13 @@ virDomainDiskSourceNetworkParse(xmlNodePtr node,
src->sslverify = verify;
}
+ if ((src->protocol == VIR_STORAGE_NET_PROTOCOL_HTTP ||
+ src->protocol == VIR_STORAGE_NET_PROTOCOL_HTTPS) &&
+ (tmpnode = virXPathNode("./cookies", ctxt))) {
+ if (virDomainStorageNetCookiesParse(tmpnode, ctxt, src) < 0)
+ return -1;
+ }
+
return 0;
}
@@ -24281,6 +24345,22 @@ virDomainSourceDefFormatSeclabel(virBufferPtr buf,
}
+static void
+virDomainDiskSourceFormatNetworkCookies(virBufferPtr buf,
+ virStorageSourcePtr src)
+{
+ g_auto(virBuffer) childBuf = VIR_BUFFER_INIT_CHILD(buf);
+ size_t i;
+
+ for (i = 0; i < src->ncookies; i++) {
+ virBufferEscapeString(&childBuf, "<cookie name='%s'>", src->cookies[i]->name);
+ virBufferEscapeString(&childBuf, "%s</cookie>\n", src->cookies[i]->value);
+ }
+
+ virXMLFormatElement(buf, "cookies", NULL, &childBuf);
+}
+
+
static int
virDomainDiskSourceFormatNetwork(virBufferPtr attrBuf,
virBufferPtr childBuf,
@@ -24331,6 +24411,8 @@ virDomainDiskSourceFormatNetwork(virBufferPtr attrBuf,
virTristateBoolTypeToString(src->sslverify));
}
+ virDomainDiskSourceFormatNetworkCookies(childBuf, src);
+
return 0;
}
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index dbbec0d567..ac5527ef01 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -3123,6 +3123,7 @@ virStorageSourceIsEmpty;
virStorageSourceIsLocalStorage;
virStorageSourceIsRelative;
virStorageSourceIsSameLocation;
+virStorageSourceNetCookiesValidate;
virStorageSourceNetworkAssignDefaultPorts;
virStorageSourceNew;
virStorageSourceNewFromBacking;
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index cfa77fccf8..6350168d73 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -2157,6 +2157,118 @@ virStorageSourceSeclabelsCopy(virStorageSourcePtr to,
}
+void
+virStorageNetCookieDefFree(virStorageNetCookieDefPtr def)
+{
+ if (!def)
+ return;
+
+ g_free(def->name);
+ g_free(def->value);
+
+ g_free(def);
+}
+
+
+static void
+virStorageSourceNetCookiesClear(virStorageSourcePtr src)
+{
+ size_t i;
+
+ if (!src || !src->cookies)
+ return;
+
+ for (i = 0; i < src->ncookies; i++)
+ virStorageNetCookieDefFree(src->cookies[i]);
+
+ g_clear_pointer(&src->cookies, g_free);
+ src->ncookies = 0;
+}
+
+
+static void
+virStorageSourceNetCookiesCopy(virStorageSourcePtr to,
+ const virStorageSource *from)
+{
+ size_t i;
+
+ if (from->ncookies == 0)
+ return;
+
+ to->cookies = g_new0(virStorageNetCookieDefPtr, from->ncookies);
+ to->ncookies = from->ncookies;
+
+ for (i = 0; i < from->ncookies; i++) {
+ to->cookies[i]->name = g_strdup(from->cookies[i]->name);
+ to->cookies[i]->value = g_strdup(from->cookies[i]->value);
+ }
+}
+
+
+/* see https://tools.ietf.org/html/rfc6265#section-4.1.1 */
+static const char virStorageSourceCookieValueInvalidChars[] =
+ "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F"
+ "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F"
+ " \",;\\";
+
+/* in addition cookie name can't contain these */
+static const char virStorageSourceCookieNameInvalidChars[] =
+ "()<>@:/[]?={}";
+
+static int
+virStorageSourceNetCookieValidate(virStorageNetCookieDefPtr def)
+{
+ /* name must have at least 1 character */
+ if (*(def->name) == '\0') {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("cookie name must not be empty"));
+ return -1;
+ }
+
+ /* check invalid characters in name */
+ if (virStringHasChars(def->name, virStorageSourceCookieValueInvalidChars) ||
+ virStringHasChars(def->name, virStorageSourceCookieNameInvalidChars)) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("cookie name '%s' contains invalid characters"),
+ def->name);
+ return -1;
+ }
+
+ /* check invalid characters in value */
+ if (virStringHasChars(def->value, virStorageSourceCookieValueInvalidChars)) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("value of cookie '%s' contains invalid characters"),
+ def->name);
+ return -1;
+ }
+
+ return 0;
+}
+
+
+int
+virStorageSourceNetCookiesValidate(virStorageSourcePtr src)
+{
+ size_t i;
+ size_t j;
+
+ for (i = 0; i < src->ncookies; i++) {
+ if (virStorageSourceNetCookieValidate(src->cookies[i]) < 0)
+ return -1;
+
+ for (j = i + 1; j < src->ncookies; j++) {
+ if (STREQ(src->cookies[i]->name, src->cookies[j]->name)) {
+ virReportError(VIR_ERR_XML_ERROR, _("duplicate cookie '%s'"),
+ src->cookies[i]->name);
+ return -1;
+ }
+ }
+ }
+
+ return 0;
+}
+
+
static virStorageTimestampsPtr
virStorageTimestampsCopy(const virStorageTimestamps *src)
{
@@ -2299,6 +2411,8 @@ virStorageSourceCopy(const virStorageSource *src,
def->nhosts = src->nhosts;
}
+ virStorageSourceNetCookiesCopy(def, src);
+
if (src->srcpool &&
!(def->srcpool = virStorageSourcePoolDefCopy(src->srcpool)))
return NULL;
@@ -2560,6 +2674,7 @@ virStorageSourceClear(virStorageSourcePtr def)
VIR_FREE(def->volume);
VIR_FREE(def->snapshot);
VIR_FREE(def->configFile);
+ virStorageSourceNetCookiesClear(def);
virStorageSourcePoolDefFree(def->srcpool);
virBitmapFree(def->features);
VIR_FREE(def->compat);
diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h
index fab4248c3d..1c7c046ad6 100644
--- a/src/util/virstoragefile.h
+++ b/src/util/virstoragefile.h
@@ -162,6 +162,17 @@ struct _virStorageNetHostDef {
char *socket; /* path to unix socket */
};
+typedef struct _virStorageNetCookieDef virStorageNetCookieDef;
+typedef virStorageNetCookieDef *virStorageNetCookieDefPtr;
+struct _virStorageNetCookieDef {
+ char *name;
+ char *value;
+};
+
+void virStorageNetCookieDefFree(virStorageNetCookieDefPtr def);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(virStorageNetCookieDef, virStorageNetCookieDefFree);
+
/* Information for a storage volume from a virStoragePool */
/*
@@ -276,6 +287,8 @@ struct _virStorageSource {
the source definition */
size_t nhosts;
virStorageNetHostDefPtr hosts;
+ size_t ncookies;
+ virStorageNetCookieDefPtr *cookies;
virStorageSourcePoolDefPtr srcpool;
virStorageAuthDefPtr auth;
bool authInherited;
@@ -477,6 +490,8 @@ int virStorageSourceUpdateCapacity(virStorageSourcePtr src,
int virStorageSourceNewFromBacking(virStorageSourcePtr parent,
virStorageSourcePtr *backing);
+int virStorageSourceNetCookiesValidate(virStorageSourcePtr src);
+
virStorageSourcePtr virStorageSourceCopy(const virStorageSource *src,
bool backingChain)
ATTRIBUTE_NONNULL(1);
diff --git a/tests/genericxml2xmlindata/disk-network-http.xml b/tests/genericxml2xmlindata/disk-network-http.xml
index bdcc1977f2..bafb77c8ec 100644
--- a/tests/genericxml2xmlindata/disk-network-http.xml
+++ b/tests/genericxml2xmlindata/disk-network-http.xml
@@ -33,6 +33,10 @@
<driver name='qemu' type='raw'/>
<source protocol='http' name='test3.img'>
<host name='example.org' port='1234'/>
+ <cookies>
+ <cookie name='test'>testcookievalue</cookie>
+ <cookie name='test2'>blurb</cookie>
+ </cookies>
</source>
<target dev='vdc' bus='virtio'/>
</disk>
@@ -41,6 +45,10 @@
<source protocol='https' name='test4.img'>
<host name='example.org' port='1234'/>
<ssl verify='yes'/>
+ <cookies>
+ <cookie name='test'>testcookievalue</cookie>
+ <cookie name='test2'>blurb</cookie>
+ </cookies>
</source>
<target dev='vdd' bus='virtio'/>
</disk>
--
2.25.1

View File

@ -1,160 +0,0 @@
From 45ecbd824c92bd05a46557bfcaff39196f701e6c Mon Sep 17 00:00:00 2001
Message-Id: <45ecbd824c92bd05a46557bfcaff39196f701e6c@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Mon, 30 Mar 2020 17:21:45 +0200
Subject: [PATCH] conf: Add support for http(s) query strings
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Add a new attribute for holding the query part for http(s) disks.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit 56368124728f0d65dde07244c741b459fcd6b939)
https://bugzilla.redhat.com/show_bug.cgi?id=1804750
Message-Id: <b60abcf1e7711e9e29175e1fdcfe2820d5694a17.1585581552.git.pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
---
docs/formatdomain.html.in | 7 ++++++-
docs/schemas/domaincommon.rng | 6 ++++++
src/conf/domain_conf.c | 5 +++++
src/util/virstoragefile.c | 2 ++
src/util/virstoragefile.h | 1 +
tests/qemuxml2argvdata/disk-network-http.xml | 2 +-
.../qemuxml2xmloutdata/disk-network-http.x86_64-latest.xml | 2 +-
7 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 143db21d4d..9c588185df 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -2837,7 +2837,7 @@
&lt;/disk&gt;
&lt;disk type='network' device='cdrom'&gt;
&lt;driver name='qemu' type='raw'/&gt;
- &lt;source protocol="http" name="url_path"&gt;
+ &lt;source protocol="http" name="url_path" query="foo=bar&amp;amp;baz=flurb&gt;
&lt;host name="hostname" port="80"/&gt;
&lt;cookies&gt;
&lt;cookie name="test"&gt;somevalue&lt;/cookie&gt;
@@ -3103,6 +3103,11 @@
('tls' <span class="since">Since 4.5.0</span>)
</p>
+ <p>For protocols <code>http</code> and <code>https</code> an
+ optional attribute <code>query</code> specifies the query string.
+ (<span class="since">Since 6.2.0</span>)
+ </p>
+
<p>For "iscsi" (<span class="since">since 1.0.4</span>), the
<code>name</code> attribute may include a logical unit number,
separated from the target's name by a slash (e.g.,
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index e17f7ff8c0..dd8f27243a 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -1869,6 +1869,9 @@
</choice>
</attribute>
<attribute name="name"/>
+ <optional>
+ <attribute name="query"/>
+ </optional>
<ref name="diskSourceCommon"/>
<ref name="diskSourceNetworkHost"/>
<optional>
@@ -1894,6 +1897,9 @@
</choice>
</attribute>
<attribute name="name"/>
+ <optional>
+ <attribute name="query"/>
+ </optional>
<ref name="diskSourceCommon"/>
<ref name="diskSourceNetworkHost"/>
<optional>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index e3755fa285..28160a2967 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -9382,6 +9382,10 @@ virDomainDiskSourceNetworkParse(xmlNodePtr node,
/* config file currently only works with remote disks */
src->configFile = virXPathString("string(./config/@file)", ctxt);
+ if (src->protocol == VIR_STORAGE_NET_PROTOCOL_HTTP ||
+ src->protocol == VIR_STORAGE_NET_PROTOCOL_HTTPS)
+ src->query = virXMLPropString(node, "query");
+
if (virDomainStorageNetworkParseHosts(node, &src->hosts, &src->nhosts) < 0)
return -1;
@@ -24390,6 +24394,7 @@ virDomainDiskSourceFormatNetwork(virBufferPtr attrBuf,
path = g_strdup_printf("%s/%s", src->volume, src->path);
virBufferEscapeString(attrBuf, " name='%s'", path ? path : src->path);
+ virBufferEscapeString(attrBuf, " query='%s'", src->query);
if (src->haveTLS != VIR_TRISTATE_BOOL_ABSENT &&
!(flags & VIR_DOMAIN_DEF_FORMAT_MIGRATABLE &&
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index f8d741f040..4082e3f5f7 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -2418,6 +2418,7 @@ virStorageSourceCopy(const virStorageSource *src,
def->compat = g_strdup(src->compat);
def->tlsAlias = g_strdup(src->tlsAlias);
def->tlsCertdir = g_strdup(src->tlsCertdir);
+ def->query = g_strdup(src->query);
if (src->sliceStorage)
def->sliceStorage = virStorageSourceSliceCopy(src->sliceStorage);
@@ -2696,6 +2697,7 @@ virStorageSourceClear(virStorageSourcePtr def)
VIR_FREE(def->volume);
VIR_FREE(def->snapshot);
VIR_FREE(def->configFile);
+ VIR_FREE(def->query);
virStorageSourceNetCookiesClear(def);
virStorageSourcePoolDefFree(def->srcpool);
virBitmapFree(def->features);
diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h
index 0230f44652..8089d1e07f 100644
--- a/src/util/virstoragefile.h
+++ b/src/util/virstoragefile.h
@@ -285,6 +285,7 @@ struct _virStorageSource {
char *snapshot; /* for storage systems supporting internal snapshots */
char *configFile; /* some storage systems use config file as part of
the source definition */
+ char *query; /* query string for HTTP based protocols */
size_t nhosts;
virStorageNetHostDefPtr hosts;
size_t ncookies;
diff --git a/tests/qemuxml2argvdata/disk-network-http.xml b/tests/qemuxml2argvdata/disk-network-http.xml
index 93e6617433..3abf499019 100644
--- a/tests/qemuxml2argvdata/disk-network-http.xml
+++ b/tests/qemuxml2argvdata/disk-network-http.xml
@@ -42,7 +42,7 @@
</disk>
<disk type='network' device='disk'>
<driver name='qemu' type='raw'/>
- <source protocol='https' name='test4.img'>
+ <source protocol='https' name='test4.img' query='par=val&amp;other=ble'>
<host name='example.org' port='1234'/>
<ssl verify='no'/>
<cookies>
diff --git a/tests/qemuxml2xmloutdata/disk-network-http.x86_64-latest.xml b/tests/qemuxml2xmloutdata/disk-network-http.x86_64-latest.xml
index 60073c227c..45b01841ec 100644
--- a/tests/qemuxml2xmloutdata/disk-network-http.x86_64-latest.xml
+++ b/tests/qemuxml2xmloutdata/disk-network-http.x86_64-latest.xml
@@ -46,7 +46,7 @@
</disk>
<disk type='network' device='disk'>
<driver name='qemu' type='raw'/>
- <source protocol='https' name='test4.img'>
+ <source protocol='https' name='test4.img' query='par=val&amp;other=ble'>
<host name='example.org' port='1234'/>
<ssl verify='no'/>
<cookies>
--
2.26.0

View File

@ -1,242 +0,0 @@
From ffe8028ca07eb049b12d5c152b3d66489378d731 Mon Sep 17 00:00:00 2001
Message-Id: <ffe8028ca07eb049b12d5c152b3d66489378d731@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Mon, 16 Mar 2020 22:11:56 +0100
Subject: [PATCH] conf: Add support for modifying ssl validation for https/ftps
disks
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
To allow turning off verification of SSL cerificates add a new element
<ssl> to the disk source XML which will allow configuring the validation
process using the 'verify' attribute.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit 25481e25b14108373bf2e5e95c04fe30bff96bb4)
https://bugzilla.redhat.com/show_bug.cgi?id=1804750
Message-Id: <ede13179128fc9ef05036a5408f4115132a2c12d.1584391727.git.pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
docs/formatdomain.html.in | 9 ++++
docs/schemas/domaincommon.rng | 51 ++++++++++++++++++-
src/conf/domain_conf.c | 19 +++++++
src/util/virstoragefile.c | 1 +
src/util/virstoragefile.h | 1 +
.../disk-network-http.xml | 9 ++++
6 files changed, 88 insertions(+), 2 deletions(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index e9830ab231..2cce247958 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -2847,6 +2847,7 @@
&lt;driver name='qemu' type='raw'/&gt;
&lt;source protocol="https" name="url_path"&gt;
&lt;host name="hostname" port="443"/&gt;
+ &lt;ssl verify="no"/&gt;
&lt;/source&gt;
&lt;target dev='hdf' bus='ide' tray='open'/&gt;
&lt;readonly/&gt;
@@ -3373,6 +3374,14 @@
The <code>offset</code> and <code>size</code> values are in bytes.
<span class="since">Since 6.1.0</span>
</dd>
+ <dt><code>ssl</code></dt>
+ <dd>
+ For <code>https</code> and <code>ftps</code> accessed storage it's
+ possible to tweak the SSL transport parameters with this element.
+ The <code>verify</code> attribute allows to turn on or off SSL
+ certificate validation. Supported values are <code>yes</code> and
+ <code>no</code>. <span class="since">Since 6.2.0</span>
+ </dd>
</dl>
<p>
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index aa70e340b9..548601b61c 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -1808,12 +1808,39 @@
</element>
</define>
+ <define name="diskSourceNetworkProtocolSSLVerify">
+ <element name="ssl">
+ <attribute name="verify">
+ <ref name="virYesNo"/>
+ </attribute>
+ <empty/>
+ </element>
+ </define>
+
+ <define name="diskSourceNetworkProtocolHTTPS">
+ <element name="source">
+ <attribute name="protocol">
+ <choice>
+ <value>https</value>
+ </choice>
+ </attribute>
+ <attribute name="name"/>
+ <ref name="diskSourceCommon"/>
+ <ref name="diskSourceNetworkHost"/>
+ <optional>
+ <ref name="encryption"/>
+ </optional>
+ <optional>
+ <ref name="diskSourceNetworkProtocolSSLVerify"/>
+ </optional>
+ </element>
+ </define>
+
<define name="diskSourceNetworkProtocolHTTP">
<element name="source">
<attribute name="protocol">
<choice>
<value>http</value>
- <value>https</value>
</choice>
</attribute>
<attribute name="name"/>
@@ -1825,13 +1852,31 @@
</element>
</define>
+ <define name="diskSourceNetworkProtocolFTPS">
+ <element name="source">
+ <attribute name="protocol">
+ <choice>
+ <value>ftps</value>
+ </choice>
+ </attribute>
+ <attribute name="name"/>
+ <ref name="diskSourceCommon"/>
+ <ref name="diskSourceNetworkHost"/>
+ <optional>
+ <ref name="encryption"/>
+ </optional>
+ <optional>
+ <ref name="diskSourceNetworkProtocolSSLVerify"/>
+ </optional>
+ </element>
+ </define>
+
<define name="diskSourceNetworkProtocolSimple">
<element name="source">
<attribute name="protocol">
<choice>
<value>sheepdog</value>
<value>ftp</value>
- <value>ftps</value>
<value>tftp</value>
</choice>
</attribute>
@@ -1909,6 +1954,8 @@
<ref name="diskSourceNetworkProtocolRBD"/>
<ref name="diskSourceNetworkProtocolISCSI"/>
<ref name="diskSourceNetworkProtocolHTTP"/>
+ <ref name="diskSourceNetworkProtocolHTTPS"/>
+ <ref name="diskSourceNetworkProtocolFTPS"/>
<ref name="diskSourceNetworkProtocolSimple"/>
<ref name="diskSourceNetworkProtocolVxHS"/>
</choice>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index b3c4084c38..70bbc35bb3 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -9259,6 +9259,7 @@ virDomainDiskSourceNetworkParse(xmlNodePtr node,
g_autofree char *protocol = NULL;
g_autofree char *haveTLS = NULL;
g_autofree char *tlsCfg = NULL;
+ g_autofree char *sslverifystr = NULL;
if (!(protocol = virXMLPropString(node, "protocol"))) {
virReportError(VIR_ERR_XML_ERROR, "%s",
@@ -9331,6 +9332,19 @@ virDomainDiskSourceNetworkParse(xmlNodePtr node,
virStorageSourceInitiatorParseXML(ctxt, &src->initiator);
+ if ((src->protocol == VIR_STORAGE_NET_PROTOCOL_HTTPS ||
+ src->protocol == VIR_STORAGE_NET_PROTOCOL_FTPS) &&
+ (sslverifystr = virXPathString("string(./ssl/@verify)", ctxt))) {
+ int verify;
+ if ((verify = virTristateBoolTypeFromString(sslverifystr)) < 0) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("invalid ssl verify mode '%s'"), sslverifystr);
+ return -1;
+ }
+
+ src->sslverify = verify;
+ }
+
return 0;
}
@@ -24312,6 +24326,11 @@ virDomainDiskSourceFormatNetwork(virBufferPtr attrBuf,
virStorageSourceInitiatorFormatXML(&src->initiator, childBuf);
+ if (src->sslverify != VIR_TRISTATE_BOOL_ABSENT) {
+ virBufferAsprintf(childBuf, "<ssl verify='%s'/>\n",
+ virTristateBoolTypeToString(src->sslverify));
+ }
+
return 0;
}
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index b88763b267..cfa77fccf8 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -2270,6 +2270,7 @@ virStorageSourceCopy(const virStorageSource *src,
def->cachemode = src->cachemode;
def->discard = src->discard;
def->detect_zeroes = src->detect_zeroes;
+ def->sslverify = src->sslverify;
/* storage driver metadata are not copied */
def->drv = NULL;
diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h
index 5b995d54ab..fab4248c3d 100644
--- a/src/util/virstoragefile.h
+++ b/src/util/virstoragefile.h
@@ -282,6 +282,7 @@ struct _virStorageSource {
virStorageEncryptionPtr encryption;
bool encryptionInherited;
virStoragePRDefPtr pr;
+ virTristateBool sslverify;
virStorageSourceNVMeDefPtr nvme; /* type == VIR_STORAGE_TYPE_NVME */
diff --git a/tests/genericxml2xmlindata/disk-network-http.xml b/tests/genericxml2xmlindata/disk-network-http.xml
index fde1222fd0..bdcc1977f2 100644
--- a/tests/genericxml2xmlindata/disk-network-http.xml
+++ b/tests/genericxml2xmlindata/disk-network-http.xml
@@ -25,6 +25,7 @@
<driver name='qemu' type='raw'/>
<source protocol='https' name='test2.img'>
<host name='example.org' port='443'/>
+ <ssl verify='no'/>
</source>
<target dev='vdb' bus='virtio'/>
</disk>
@@ -35,6 +36,14 @@
</source>
<target dev='vdc' bus='virtio'/>
</disk>
+ <disk type='network' device='disk'>
+ <driver name='qemu' type='raw'/>
+ <source protocol='https' name='test4.img'>
+ <host name='example.org' port='1234'/>
+ <ssl verify='yes'/>
+ </source>
+ <target dev='vdd' bus='virtio'/>
+ </disk>
<controller type='usb' index='0'/>
<controller type='pci' index='0' model='pci-root'/>
<input type='mouse' bus='ps2'/>
--
2.25.1

View File

@ -1,205 +0,0 @@
From 3050ddce41896311b8c3ad06f148bea358e597b8 Mon Sep 17 00:00:00 2001
Message-Id: <3050ddce41896311b8c3ad06f148bea358e597b8@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Mon, 16 Mar 2020 22:11:58 +0100
Subject: [PATCH] conf: Add support for setting timeout and readahead size for
network disks
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Some disk backends support configuring the readahead buffer or timeout
for requests. Add the knobs to the XML.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit 63fd46177367c6653c4c986558f6d0e4a700cfcc)
https://bugzilla.redhat.com/show_bug.cgi?id=1804750
Message-Id: <2694bc6f9a327f89d82da18320e7137152915ad3.1584391727.git.pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
docs/formatdomain.html.in | 16 +++++++++++++
docs/schemas/domaincommon.rng | 23 +++++++++++++++++++
src/conf/domain_conf.c | 19 +++++++++++++++
src/util/virstoragefile.c | 2 ++
src/util/virstoragefile.h | 3 +++
.../disk-network-http.xml | 2 ++
6 files changed, 65 insertions(+)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 5a10d64e83..2b8f9eabc2 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -2842,6 +2842,8 @@
&lt;cookies&gt;
&lt;cookie name="test"&gt;somevalue&lt;/cookie&gt;
&lt;/cookies&gt;
+ &lt;readahead size='65536'/&gt;
+ &lt;timeout seconds='6'/&gt;
&lt;/source&gt;
&lt;target dev='hde' bus='ide' tray='open'/&gt;
&lt;readonly/&gt;
@@ -3392,6 +3394,20 @@
must conform to the HTTP specification.
<span class="since">Since 6.2.0</span>
</dd>
+ <dt><code>readahead</code></dt>
+ <dd>
+ Specifies the size of the readahead buffer for protocols
+ which support it. (all 'curl' based drivers in qemu). The size
+ is in bytes. Note that '0' is considered as if the value is not
+ provided.
+ <span class="since">Since 6.2.0</span>
+ </dd>
+ <dt><code>timeout</code></dt>
+ <dd>
+ Specifies the connection timeout for protocols which support it.
+ Note that '0' is considered as if the value is not provided.
+ <span class="since">Since 6.2.0</span>
+ </dd>
</dl>
<p>
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index bdf35e64f6..3a0edbed97 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -1808,6 +1808,25 @@
</element>
</define>
+ <define name="diskSourceNetworkProtocolPropsCommon">
+ <optional>
+ <element name="readahead">
+ <attribute name="size">
+ <ref name="positiveInteger"/>
+ </attribute>
+ <empty/>
+ </element>
+ </optional>
+ <optional>
+ <element name="timeout">
+ <attribute name="seconds">
+ <ref name="positiveInteger"/>
+ </attribute>
+ <empty/>
+ </element>
+ </optional>
+ </define>
+
<define name="diskSourceNetworkProtocolSSLVerify">
<element name="ssl">
<attribute name="verify">
@@ -1854,6 +1873,7 @@
<optional>
<ref name="diskSourceNetworkProtocolHTTPCookies"/>
</optional>
+ <ref name="diskSourceNetworkProtocolPropsCommon"/>
</element>
</define>
@@ -1873,6 +1893,7 @@
<optional>
<ref name="diskSourceNetworkProtocolHTTPCookies"/>
</optional>
+ <ref name="diskSourceNetworkProtocolPropsCommon"/>
</element>
</define>
@@ -1892,6 +1913,7 @@
<optional>
<ref name="diskSourceNetworkProtocolSSLVerify"/>
</optional>
+ <ref name="diskSourceNetworkProtocolPropsCommon"/>
</element>
</define>
@@ -1910,6 +1932,7 @@
<optional>
<ref name="encryption"/>
</optional>
+ <ref name="diskSourceNetworkProtocolPropsCommon"/>
</element>
</define>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index d066d3aac1..8aec85e83c 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -9409,6 +9409,19 @@ virDomainDiskSourceNetworkParse(xmlNodePtr node,
return -1;
}
+ if (src->protocol == VIR_STORAGE_NET_PROTOCOL_HTTP ||
+ src->protocol == VIR_STORAGE_NET_PROTOCOL_HTTPS ||
+ src->protocol == VIR_STORAGE_NET_PROTOCOL_FTP ||
+ src->protocol == VIR_STORAGE_NET_PROTOCOL_FTPS) {
+
+ if (virXPathULongLong("string(./readahead/@size)", ctxt, &src->readahead) == -2 ||
+ virXPathULongLong("string(./timeout/@seconds)", ctxt, &src->timeout) == -2) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("invalid readahead size or timeout"));
+ return -1;
+ }
+ }
+
return 0;
}
@@ -24413,6 +24426,12 @@ virDomainDiskSourceFormatNetwork(virBufferPtr attrBuf,
virDomainDiskSourceFormatNetworkCookies(childBuf, src);
+ if (src->readahead)
+ virBufferAsprintf(childBuf, "<readahead size='%llu'/>\n", src->readahead);
+
+ if (src->timeout)
+ virBufferAsprintf(childBuf, "<timeout seconds='%llu'/>\n", src->timeout);
+
return 0;
}
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index 6350168d73..7893e054c3 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -2383,6 +2383,8 @@ virStorageSourceCopy(const virStorageSource *src,
def->discard = src->discard;
def->detect_zeroes = src->detect_zeroes;
def->sslverify = src->sslverify;
+ def->readahead = src->readahead;
+ def->timeout = src->timeout;
/* storage driver metadata are not copied */
def->drv = NULL;
diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h
index 1c7c046ad6..1abdaf89ce 100644
--- a/src/util/virstoragefile.h
+++ b/src/util/virstoragefile.h
@@ -296,6 +296,9 @@ struct _virStorageSource {
bool encryptionInherited;
virStoragePRDefPtr pr;
virTristateBool sslverify;
+ /* both values below have 0 as default value */
+ unsigned long long readahead; /* size of the readahead buffer in bytes */
+ unsigned long long timeout; /* connection timeout in seconds */
virStorageSourceNVMeDefPtr nvme; /* type == VIR_STORAGE_TYPE_NVME */
diff --git a/tests/genericxml2xmlindata/disk-network-http.xml b/tests/genericxml2xmlindata/disk-network-http.xml
index bafb77c8ec..a8430b8365 100644
--- a/tests/genericxml2xmlindata/disk-network-http.xml
+++ b/tests/genericxml2xmlindata/disk-network-http.xml
@@ -49,6 +49,8 @@
<cookie name='test'>testcookievalue</cookie>
<cookie name='test2'>blurb</cookie>
</cookies>
+ <readahead size='65536'/>
+ <timeout seconds='10'/>
</source>
<target dev='vdd' bus='virtio'/>
</disk>
--
2.25.1

View File

@ -1,58 +0,0 @@
From 898e0003ae21e9fbe49995980c8746e9d2ac9b8b Mon Sep 17 00:00:00 2001
Message-Id: <898e0003ae21e9fbe49995980c8746e9d2ac9b8b@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Tue, 23 Jun 2020 14:23:06 +0200
Subject: [PATCH] conf: Don't format http cookies unless
VIR_DOMAIN_DEF_FORMAT_SECURE is used
Starting with 3b076391befc3fe72deb0c244ac6c2b4c100b410
(v6.1.0-122-g3b076391be) we support http cookies. Since they may contain
somewhat sensitive information we should not format them into the XML
unless VIR_DOMAIN_DEF_FORMAT_SECURE is asserted.
Reported-by: Han Han <hhan@redhat.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
(cherry picked from commit a5b064bf4b17a9884d7d361733737fb614ad8979)
CVE-2020-14301
Message-Id: <592a0b594666f580e743b6bd2b4ddccbd1e0cc7c.1592914898.git.pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
---
src/conf/domain_conf.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index ed9ca0e9d8..60962ee7c1 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -24377,11 +24377,15 @@ virDomainSourceDefFormatSeclabel(virBufferPtr buf,
static void
virDomainDiskSourceFormatNetworkCookies(virBufferPtr buf,
- virStorageSourcePtr src)
+ virStorageSourcePtr src,
+ unsigned int flags)
{
g_auto(virBuffer) childBuf = VIR_BUFFER_INIT_CHILD(buf);
size_t i;
+ if (!(flags & VIR_DOMAIN_DEF_FORMAT_SECURE))
+ return;
+
for (i = 0; i < src->ncookies; i++) {
virBufferEscapeString(&childBuf, "<cookie name='%s'>", src->cookies[i]->name);
virBufferEscapeString(&childBuf, "%s</cookie>\n", src->cookies[i]->value);
@@ -24442,7 +24446,7 @@ virDomainDiskSourceFormatNetwork(virBufferPtr attrBuf,
virTristateBoolTypeToString(src->sslverify));
}
- virDomainDiskSourceFormatNetworkCookies(childBuf, src);
+ virDomainDiskSourceFormatNetworkCookies(childBuf, src, flags);
if (src->readahead)
virBufferAsprintf(childBuf, "<readahead size='%llu'/>\n", src->readahead);
--
2.27.0

View File

@ -1,97 +0,0 @@
From 3ff27fe469c36e5655231f6759150350b17de298 Mon Sep 17 00:00:00 2001
Message-Id: <3ff27fe469c36e5655231f6759150350b17de298@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Fri, 13 Mar 2020 13:08:09 +0100
Subject: [PATCH] conf: Don't generate machine names with a dot
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
According to the linked BZ, machined expects either valid
hostname or valid FQDN (see systemd commit
v239-3092-gd65652f1f2). While in case of multiple dots, a
trailing one doesn't violate FQDN, it does violate the rule in
case of something simple, like "domain.". But it's safe to remove
it in both cases.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1808499
Fixes: 45464db8ba502764cf37ec9335770248bdb3d9a8
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit 2695191a44eb7375225b4ad073825ed3563a172a)
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Message-Id: <355e05e31ec98522fa0e03a0c2c7af8ca097070d.1584101247.git.mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/conf/domain_conf.c | 14 +++++++-------
tests/virsystemdtest.c | 5 +++--
2 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 4b297c96bc..b3c4084c38 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -30688,20 +30688,20 @@ static void
virDomainMachineNameAppendValid(virBufferPtr buf,
const char *name)
{
- bool skip_dot = false;
+ bool skip = true;
for (; *name; name++) {
if (strlen(virBufferCurrentContent(buf)) >= 64)
break;
- if (*name == '.') {
- if (!skip_dot)
+ if (*name == '.' || *name == '-') {
+ if (!skip)
virBufferAddChar(buf, *name);
- skip_dot = true;
+ skip = true;
continue;
}
- skip_dot = false;
+ skip = false;
if (!strchr(HOSTNAME_CHARS, *name))
continue;
@@ -30709,8 +30709,8 @@ virDomainMachineNameAppendValid(virBufferPtr buf,
virBufferAddChar(buf, *name);
}
- /* trailing dashes are not allowed */
- virBufferTrimChars(buf, "-");
+ /* trailing dashes or dots are not allowed */
+ virBufferTrimChars(buf, "-.");
}
#undef HOSTNAME_CHARS
diff --git a/tests/virsystemdtest.c b/tests/virsystemdtest.c
index 26876850b8..eb510b40e4 100644
--- a/tests/virsystemdtest.c
+++ b/tests/virsystemdtest.c
@@ -733,7 +733,7 @@ mymain(void)
TEST_MACHINE("demo", 1, "qemu-1-demo");
TEST_MACHINE("demo-name", 2, "qemu-2-demo-name");
TEST_MACHINE("demo!name", 3, "qemu-3-demoname");
- TEST_MACHINE(".demo", 4, "qemu-4-.demo");
+ TEST_MACHINE(".demo", 4, "qemu-4-demo");
TEST_MACHINE("bull\U0001f4a9", 5, "qemu-5-bull");
TEST_MACHINE("demo..name", 6, "qemu-6-demo.name");
TEST_MACHINE("12345678901234567890123456789012345678901234567890123456789", 7,
@@ -743,7 +743,8 @@ mymain(void)
TEST_MACHINE("kstest-network-device-default-httpks_(c9eed63e-981e-48ec-acdc-56b3f8c5f678)", 100,
"qemu-100-kstest-network-device-default-httpksc9eed63e-981e-48ec");
TEST_MACHINE("kstest-network-device-default-httpks_(c9eed63e-981e-48ec--cdc-56b3f8c5f678)", 10,
- "qemu-10-kstest-network-device-default-httpksc9eed63e-981e-48ec");
+ "qemu-10-kstest-network-device-default-httpksc9eed63e-981e-48ec-c");
+ TEST_MACHINE("demo.-.test.", 11, "qemu-11-demo.test");
# define TESTS_PM_SUPPORT_HELPER(name, function) \
do { \
--
2.25.1

View File

@ -1,143 +0,0 @@
From 6d5174acd7530d554ac2651f3e6a5da9f69fe6e4 Mon Sep 17 00:00:00 2001
Message-Id: <6d5174acd7530d554ac2651f3e6a5da9f69fe6e4@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Wed, 19 Feb 2020 15:10:20 +0100
Subject: [PATCH] conf: Implement support for <slices> of disk source
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Implement parsing and formatting of the 'storage' slice.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit bbf5d05cfd003e33600009cac7ea98ef1539dd7c)
https://bugzilla.redhat.com/show_bug.cgi?id=1791788
Message-Id: <d31bb27ae30140c9deb696972ee76a90d7bcc610.1582120424.git.pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/conf/domain_conf.c | 86 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 86 insertions(+)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index b46b92aecf..5c11f49463 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -9441,6 +9441,57 @@ virDomainStorageSourceParseBase(const char *type,
}
+static virStorageSourceSlicePtr
+virDomainStorageSourceParseSlice(xmlNodePtr node,
+ xmlXPathContextPtr ctxt)
+{
+ VIR_XPATH_NODE_AUTORESTORE(ctxt);
+ g_autofree char *offset = NULL;
+ g_autofree char *size = NULL;
+ g_autofree virStorageSourceSlicePtr ret = g_new0(virStorageSourceSlice, 1);
+
+ ctxt->node = node;
+
+ if (!(offset = virXPathString("string(./@offset)", ctxt)) ||
+ !(size = virXPathString("string(./@size)", ctxt))) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("missing offset or size attribute of slice"));
+ return NULL;
+ }
+
+ if (virStrToLong_ullp(offset, NULL, 10, &ret->offset) < 0) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("malformed value '%s' of 'offset' attribute of slice"),
+ offset);
+ return NULL;
+ }
+
+ if (virStrToLong_ullp(size, NULL, 10, &ret->size) < 0) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("malformed value '%s' of 'size' attribute of slice"),
+ size);
+ return NULL;
+ }
+
+ return g_steal_pointer(&ret);
+}
+
+
+static int
+virDomainStorageSourceParseSlices(virStorageSourcePtr src,
+ xmlXPathContextPtr ctxt)
+{
+ xmlNodePtr node;
+
+ if ((node = virXPathNode("./slices/slice[@type='storage']", ctxt))) {
+ if (!(src->sliceStorage = virDomainStorageSourceParseSlice(node, ctxt)))
+ return -1;
+ }
+
+ return 0;
+}
+
+
/**
* virDomainStorageSourceParse:
* @node: XML node pointing to the source element to parse
@@ -9506,6 +9557,9 @@ virDomainStorageSourceParse(xmlNodePtr node,
if (virDomainDiskSourcePRParse(node, ctxt, &src->pr) < 0)
return -1;
+ if (virDomainStorageSourceParseSlices(src, ctxt) < 0)
+ return -1;
+
if (virSecurityDeviceLabelDefParseXML(&src->seclabels, &src->nseclabels,
ctxt, flags) < 0)
return -1;
@@ -24226,6 +24280,36 @@ virDomainDiskSourceFormatPrivateData(virBufferPtr buf,
}
+static void
+virDomainDiskSourceFormatSlice(virBufferPtr buf,
+ const char *slicetype,
+ virStorageSourceSlicePtr slice)
+{
+ g_auto(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
+
+ if (!slice)
+ return;
+
+ virBufferAsprintf(&attrBuf, " type='%s'", slicetype);
+ virBufferAsprintf(&attrBuf, " offset='%llu'", slice->offset);
+ virBufferAsprintf(&attrBuf, " size='%llu'", slice->size);
+
+ virXMLFormatElement(buf, "slice", &attrBuf, NULL);
+}
+
+
+static void
+virDomainDiskSourceFormatSlices(virBufferPtr buf,
+ virStorageSourcePtr src)
+{
+ g_auto(virBuffer) childBuf = VIR_BUFFER_INIT_CHILD(buf);
+
+ virDomainDiskSourceFormatSlice(&childBuf, "storage", src->sliceStorage);
+
+ virXMLFormatElement(buf, "slices", NULL, &childBuf);
+}
+
+
/**
* virDomainDiskSourceFormat:
* @buf: output buffer
@@ -24296,6 +24380,8 @@ virDomainDiskSourceFormat(virBufferPtr buf,
return -1;
}
+ virDomainDiskSourceFormatSlices(&childBuf, src);
+
if (src->type != VIR_STORAGE_TYPE_NETWORK)
virDomainSourceDefFormatSeclabel(&childBuf, src->nseclabels,
src->seclabels, flags);
--
2.25.0

View File

@ -1,129 +0,0 @@
From eb6bdf4798eea9bae5ddca1fdd13fb5ef6e99596 Mon Sep 17 00:00:00 2001
Message-Id: <eb6bdf4798eea9bae5ddca1fdd13fb5ef6e99596@dist-git>
From: Andrea Bolognani <abologna@redhat.com>
Date: Fri, 14 Feb 2020 13:12:35 +0100
Subject: [PATCH] conf: Introduce VIR_DOMAIN_TIMER_NAME_ARMVTIMER
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This new timer model will be used to control the behavior of the
virtual timer for KVM ARM/virt guests.
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit 3809e88a87e5898c9cf3a277cb32e20fca8fb2d0)
https://bugzilla.redhat.com/show_bug.cgi?id=1762634
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Message-Id: <20200214121237.623948-5-abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
docs/schemas/domaincommon.rng | 1 +
src/conf/domain_conf.c | 1 +
src/conf/domain_conf.h | 1 +
src/libxl/libxl_conf.c | 1 +
src/libxl/xen_common.c | 1 +
src/qemu/qemu_command.c | 2 ++
src/qemu/qemu_domain.c | 3 +++
7 files changed, 10 insertions(+)
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 026e753567..19476a2735 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -1239,6 +1239,7 @@
<choice>
<value>hpet</value>
<value>pit</value>
+ <value>armvtimer</value>
</choice>
</attribute>
<optional>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 58f72b3b0f..68d9ce9c4e 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -1062,6 +1062,7 @@ VIR_ENUM_IMPL(virDomainTimerName,
"tsc",
"kvmclock",
"hypervclock",
+ "armvtimer",
);
VIR_ENUM_IMPL(virDomainTimerTrack,
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index ee8eb3ddc0..ef2c1b80f7 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1989,6 +1989,7 @@ typedef enum {
VIR_DOMAIN_TIMER_NAME_TSC,
VIR_DOMAIN_TIMER_NAME_KVMCLOCK,
VIR_DOMAIN_TIMER_NAME_HYPERVCLOCK,
+ VIR_DOMAIN_TIMER_NAME_ARMVTIMER,
VIR_DOMAIN_TIMER_NAME_LAST
} virDomainTimerNameType;
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 2488bb9d32..ffac890262 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -361,6 +361,7 @@ libxlMakeDomBuildInfo(virDomainDefPtr def,
case VIR_DOMAIN_TIMER_NAME_HYPERVCLOCK:
case VIR_DOMAIN_TIMER_NAME_RTC:
case VIR_DOMAIN_TIMER_NAME_PIT:
+ case VIR_DOMAIN_TIMER_NAME_ARMVTIMER:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unsupported timer type (name) '%s'"),
virDomainTimerNameTypeToString(clock.timers[i]->name));
diff --git a/src/libxl/xen_common.c b/src/libxl/xen_common.c
index 415549a42c..9a385eba0d 100644
--- a/src/libxl/xen_common.c
+++ b/src/libxl/xen_common.c
@@ -2182,6 +2182,7 @@ xenFormatCPUFeatures(virConfPtr conf, virDomainDefPtr def)
case VIR_DOMAIN_TIMER_NAME_HYPERVCLOCK:
case VIR_DOMAIN_TIMER_NAME_RTC:
case VIR_DOMAIN_TIMER_NAME_PIT:
+ case VIR_DOMAIN_TIMER_NAME_ARMVTIMER:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unsupported timer type (name) '%s'"),
virDomainTimerNameTypeToString(def->clock.timers[i]->name));
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 0ad09baa1d..e1e19e0fcc 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -6200,6 +6200,7 @@ qemuBuildClockCommandLine(virCommandPtr cmd,
case VIR_DOMAIN_TIMER_NAME_TSC:
case VIR_DOMAIN_TIMER_NAME_KVMCLOCK:
case VIR_DOMAIN_TIMER_NAME_HYPERVCLOCK:
+ case VIR_DOMAIN_TIMER_NAME_ARMVTIMER:
/* Timers above are handled when building -cpu. */
case VIR_DOMAIN_TIMER_NAME_LAST:
break;
@@ -6631,6 +6632,7 @@ qemuBuildCpuCommandLine(virCommandPtr cmd,
if (timer->frequency > 0)
virBufferAsprintf(&buf, ",tsc-frequency=%lu", timer->frequency);
break;
+ case VIR_DOMAIN_TIMER_NAME_ARMVTIMER:
case VIR_DOMAIN_TIMER_NAME_PLATFORM:
case VIR_DOMAIN_TIMER_NAME_PIT:
case VIR_DOMAIN_TIMER_NAME_RTC:
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 846d1ecb29..4de4f9da53 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -5504,6 +5504,9 @@ qemuDomainDefValidateClockTimers(const virDomainDef *def,
return -1;
}
break;
+
+ case VIR_DOMAIN_TIMER_NAME_ARMVTIMER:
+ break;
}
}
--
2.25.0

View File

@ -1,357 +0,0 @@
From 0cee78aa69f5e3317b5e4853454a108e597228e5 Mon Sep 17 00:00:00 2001
Message-Id: <0cee78aa69f5e3317b5e4853454a108e597228e5@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Wed, 7 Oct 2020 18:45:33 +0200
Subject: [PATCH] conf: Move and rename virDomainParseScaledValue()
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
There is nothing domain specific about the function, thus it
should not have virDomain prefix. Also, the fact that it is a
static function makes it impossible to use from other files.
Move the function to virxml.c and drop the 'Domain' infix.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
(cherry picked from commit 04bd77a19f8312493151ce377da40577b1470a0b)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1749518
Conflicts:
- src/conf/domain_conf.c: Some context mismatch, and some areas
the original commit changes don't exist in this old libvirt yet
or the calls are in other places because of refactors.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Message-Id: <26a847deef5941fd90f892cf5fe1443cf3fc90ca.1602087923.git.mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/conf/domain_conf.c | 135 ++++++++++-----------------------------
src/libvirt_private.syms | 1 +
src/util/virxml.c | 72 +++++++++++++++++++++
src/util/virxml.h | 8 +++
4 files changed, 114 insertions(+), 102 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 306926b64c..484f3b4352 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -10644,75 +10644,6 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
goto cleanup;
}
-/**
- * virDomainParseScaledValue:
- * @xpath: XPath to memory amount
- * @units_xpath: XPath to units attribute
- * @ctxt: XPath context
- * @val: scaled value is stored here
- * @scale: default scale for @val
- * @max: maximal @val allowed
- * @required: is the value required?
- *
- * Parse a value located at @xpath within @ctxt, and store the
- * result into @val. The value is scaled by units located at
- * @units_xpath (or the 'unit' attribute under @xpath if
- * @units_xpath is NULL). If units are not present, the default
- * @scale is used. If @required is set, then the value must
- * exist; otherwise, the value is optional. The resulting value
- * is in bytes.
- *
- * Returns 1 on success,
- * 0 if the value was not present and !@required,
- * -1 on failure after issuing error.
- */
-static int
-virDomainParseScaledValue(const char *xpath,
- const char *units_xpath,
- xmlXPathContextPtr ctxt,
- unsigned long long *val,
- unsigned long long scale,
- unsigned long long max,
- bool required)
-{
- unsigned long long bytes;
- g_autofree char *xpath_full = NULL;
- g_autofree char *unit = NULL;
- g_autofree char *bytes_str = NULL;
-
- *val = 0;
- xpath_full = g_strdup_printf("string(%s)", xpath);
-
- bytes_str = virXPathString(xpath_full, ctxt);
- if (!bytes_str) {
- if (!required)
- return 0;
- virReportError(VIR_ERR_XML_ERROR,
- _("missing element or attribute '%s'"),
- xpath);
- return -1;
- }
- VIR_FREE(xpath_full);
-
- if (virStrToLong_ullp(bytes_str, NULL, 10, &bytes) < 0) {
- virReportError(VIR_ERR_XML_ERROR,
- _("Invalid value '%s' for element or attribute '%s'"),
- bytes_str, xpath);
- return -1;
- }
-
- if (units_xpath)
- xpath_full = g_strdup_printf("string(%s)", units_xpath);
- else
- xpath_full = g_strdup_printf("string(%s/@unit)", xpath);
- unit = virXPathString(xpath_full, ctxt);
-
- if (virScaleInteger(&bytes, unit, scale, max) < 0)
- return -1;
-
- *val = bytes;
- return 1;
-}
/**
@@ -10749,8 +10680,8 @@ virDomainParseMemory(const char *xpath,
max = virMemoryMaxValue(capped);
- if (virDomainParseScaledValue(xpath, units_xpath, ctxt,
- &bytes, 1024, max, required) < 0)
+ if (virParseScaledValue(xpath, units_xpath, ctxt,
+ &bytes, 1024, max, required) < 0)
return -1;
/* Yes, we really do use kibibytes for our internal sizing. */
@@ -10792,9 +10723,9 @@ virDomainParseMemoryLimit(const char *xpath,
int ret;
unsigned long long bytes;
- ret = virDomainParseScaledValue(xpath, units_xpath, ctxt, &bytes, 1024,
- VIR_DOMAIN_MEMORY_PARAM_UNLIMITED << 10,
- false);
+ ret = virParseScaledValue(xpath, units_xpath, ctxt, &bytes, 1024,
+ VIR_DOMAIN_MEMORY_PARAM_UNLIMITED << 10,
+ false);
if (ret < 0)
return -1;
@@ -11125,9 +11056,9 @@ virDomainControllerDefParseXML(virDomainXMLOptionPtr xmlopt,
"have an address"));
goto error;
}
- if ((rc = virDomainParseScaledValue("./pcihole64", NULL,
- ctxt, &bytes, 1024,
- 1024ULL * ULONG_MAX, false)) < 0)
+ if ((rc = virParseScaledValue("./pcihole64", NULL,
+ ctxt, &bytes, 1024,
+ 1024ULL * ULONG_MAX, false)) < 0)
goto error;
if (rc == 1)
@@ -11349,14 +11280,14 @@ virDomainFSDefParseXML(virDomainXMLOptionPtr xmlopt,
}
}
- if (virDomainParseScaledValue("./space_hard_limit[1]",
- NULL, ctxt, &def->space_hard_limit,
- 1, ULLONG_MAX, false) < 0)
+ if (virParseScaledValue("./space_hard_limit[1]",
+ NULL, ctxt, &def->space_hard_limit,
+ 1, ULLONG_MAX, false) < 0)
goto error;
- if (virDomainParseScaledValue("./space_soft_limit[1]",
- NULL, ctxt, &def->space_soft_limit,
- 1, ULLONG_MAX, false) < 0)
+ if (virParseScaledValue("./space_soft_limit[1]",
+ NULL, ctxt, &def->space_soft_limit,
+ 1, ULLONG_MAX, false) < 0)
goto error;
cur = node->children;
@@ -15205,8 +15136,8 @@ virDomainShmemDefParseXML(virDomainXMLOptionPtr xmlopt,
goto cleanup;
}
- if (virDomainParseScaledValue("./size[1]", NULL, ctxt,
- &def->size, 1, ULLONG_MAX, false) < 0)
+ if (virParseScaledValue("./size[1]", NULL, ctxt,
+ &def->size, 1, ULLONG_MAX, false) < 0)
goto cleanup;
if ((server = virXPathNode("./server[1]", ctxt))) {
@@ -19603,9 +19534,9 @@ virDomainCachetuneDefParseCache(xmlXPathContextPtr ctxt,
return -1;
}
- if (virDomainParseScaledValue("./@size", "./@unit",
- ctxt, &size, 1024,
- ULLONG_MAX, true) < 0)
+ if (virParseScaledValue("./@size", "./@unit",
+ ctxt, &size, 1024,
+ ULLONG_MAX, true) < 0)
return -1;
if (virResctrlAllocSetCacheSize(alloc, level, type, cache, size) < 0)
@@ -20712,13 +20643,13 @@ virDomainDefParseXML(xmlDocPtr xml,
VIR_FREE(tmp);
}
- if (virDomainParseScaledValue("./features/hpt/maxpagesize",
- NULL,
- ctxt,
- &def->hpt_maxpagesize,
- 1024,
- ULLONG_MAX,
- false) < 0) {
+ if (virParseScaledValue("./features/hpt/maxpagesize",
+ NULL,
+ ctxt,
+ &def->hpt_maxpagesize,
+ 1024,
+ ULLONG_MAX,
+ false) < 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
"%s",
_("Unable to parse HPT maxpagesize setting"));
@@ -20944,13 +20875,13 @@ virDomainDefParseXML(xmlDocPtr xml,
}
if (def->features[VIR_DOMAIN_FEATURE_SMM] == VIR_TRISTATE_SWITCH_ON) {
- int rv = virDomainParseScaledValue("string(./features/smm/tseg)",
- "string(./features/smm/tseg/@unit)",
- ctxt,
- &def->tseg_size,
- 1024 * 1024, /* Defaults to mebibytes */
- ULLONG_MAX,
- false);
+ int rv = virParseScaledValue("string(./features/smm/tseg)",
+ "string(./features/smm/tseg/@unit)",
+ ctxt,
+ &def->tseg_size,
+ 1024 * 1024, /* Defaults to mebibytes */
+ ULLONG_MAX,
+ false);
if (rv < 0)
goto error;
def->tseg_specified = rv;
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 130828706a..acb25eb8c8 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -3442,6 +3442,7 @@ virVsockSetGuestCid;
# util/virxml.h
+virParseScaledValue;
virXMLCheckIllegalChars;
virXMLChildElementCount;
virXMLExtractNamespaceXML;
diff --git a/src/util/virxml.c b/src/util/virxml.c
index 0e66d1623b..bae2e6aca5 100644
--- a/src/util/virxml.c
+++ b/src/util/virxml.c
@@ -33,6 +33,7 @@
#include "viralloc.h"
#include "virfile.h"
#include "virstring.h"
+#include "virutil.h"
#define VIR_FROM_THIS VIR_FROM_XML
@@ -1433,3 +1434,74 @@ virXMLNamespaceRegister(xmlXPathContextPtr ctxt,
return 0;
}
+
+
+/**
+ * virParseScaledValue:
+ * @xpath: XPath to memory amount
+ * @units_xpath: XPath to units attribute
+ * @ctxt: XPath context
+ * @val: scaled value is stored here
+ * @scale: default scale for @val
+ * @max: maximal @val allowed
+ * @required: is the value required?
+ *
+ * Parse a value located at @xpath within @ctxt, and store the
+ * result into @val. The value is scaled by units located at
+ * @units_xpath (or the 'unit' attribute under @xpath if
+ * @units_xpath is NULL). If units are not present, the default
+ * @scale is used. If @required is set, then the value must
+ * exist; otherwise, the value is optional. The resulting value
+ * is in bytes.
+ *
+ * Returns 1 on success,
+ * 0 if the value was not present and !@required,
+ * -1 on failure after issuing error.
+ */
+int
+virParseScaledValue(const char *xpath,
+ const char *units_xpath,
+ xmlXPathContextPtr ctxt,
+ unsigned long long *val,
+ unsigned long long scale,
+ unsigned long long max,
+ bool required)
+{
+ unsigned long long bytes;
+ g_autofree char *xpath_full = NULL;
+ g_autofree char *unit = NULL;
+ g_autofree char *bytes_str = NULL;
+
+ *val = 0;
+ xpath_full = g_strdup_printf("string(%s)", xpath);
+
+ bytes_str = virXPathString(xpath_full, ctxt);
+ if (!bytes_str) {
+ if (!required)
+ return 0;
+ virReportError(VIR_ERR_XML_ERROR,
+ _("missing element or attribute '%s'"),
+ xpath);
+ return -1;
+ }
+ VIR_FREE(xpath_full);
+
+ if (virStrToLong_ullp(bytes_str, NULL, 10, &bytes) < 0) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("Invalid value '%s' for element or attribute '%s'"),
+ bytes_str, xpath);
+ return -1;
+ }
+
+ if (units_xpath)
+ xpath_full = g_strdup_printf("string(%s)", units_xpath);
+ else
+ xpath_full = g_strdup_printf("string(%s/@unit)", xpath);
+ unit = virXPathString(xpath_full, ctxt);
+
+ if (virScaleInteger(&bytes, unit, scale, max) < 0)
+ return -1;
+
+ *val = bytes;
+ return 1;
+}
diff --git a/src/util/virxml.h b/src/util/virxml.h
index 26ab9f9c2d..39b261687a 100644
--- a/src/util/virxml.h
+++ b/src/util/virxml.h
@@ -269,3 +269,11 @@ virXMLNamespaceFormatNS(virBufferPtr buf,
int
virXMLNamespaceRegister(xmlXPathContextPtr ctxt,
virXMLNamespace const *ns);
+
+int virParseScaledValue(const char *xpath,
+ const char *units_xpath,
+ xmlXPathContextPtr ctxt,
+ unsigned long long *val,
+ unsigned long long scale,
+ unsigned long long max,
+ bool required);
--
2.29.2

View File

@ -1,877 +0,0 @@
From 17e9b949ec3876e74bcaa217810afbd46f297a65 Mon Sep 17 00:00:00 2001
Message-Id: <17e9b949ec3876e74bcaa217810afbd46f297a65@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Wed, 7 Oct 2020 18:45:39 +0200
Subject: [PATCH] conf: Parse and format HMAT
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
To cite ACPI specification:
Heterogeneous Memory Attribute Table describes the memory
attributes, such as memory side cache attributes and bandwidth
and latency details, related to the System Physical Address
(SPA) Memory Ranges. The software is expected to use this
information as hint for optimization.
According to our upstream discussion [1] this is exposed under
<numa/> as <cache/> under NUMA <cell/> and <latency> or
<bandwidth/> under numa/latencies.
1: https://www.redhat.com/archives/libvir-list/2020-January/msg00422.html
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
(cherry picked from commit a89bbbac86383a10be0cec5a93feb7ed820871eb)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1749518
Conflicts:
- src/conf/numa_conf.c: Context, because we're not using
VIR_XPATH_NODE_AUTORESTORE() everywhere in the old code.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Message-Id: <f5d9028ca8eff876c2bd471460629d0ef3b20630.1602087923.git.mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
docs/formatdomain.html.in | 107 +++++++
docs/schemas/cputypes.rng | 110 ++++++-
src/conf/numa_conf.c | 349 ++++++++++++++++++++-
src/conf/numa_conf.h | 33 ++
src/libvirt_private.syms | 6 +
tests/qemuxml2argvdata/numatune-hmat.xml | 52 +++
tests/qemuxml2xmloutdata/numatune-hmat.xml | 1 +
tests/qemuxml2xmltest.c | 1 +
8 files changed, 644 insertions(+), 15 deletions(-)
create mode 100644 tests/qemuxml2argvdata/numatune-hmat.xml
create mode 120000 tests/qemuxml2xmloutdata/numatune-hmat.xml
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 4b8d312596..bec753e37f 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -1874,6 +1874,113 @@
using 10 for local and 20 for remote distances.
</p>
+ <h4><a id="hmat">ACPI Heterogeneous Memory Attribute Table</a></h4>
+
+<pre>
+...
+&lt;cpu&gt;
+ ...
+ &lt;numa&gt;
+ &lt;cell id='0' cpus='0-3' memory='512000' unit='KiB' discard='yes'/&gt;
+ &lt;cell id='1' cpus='4-7' memory='512000' unit='KiB' memAccess='shared'/&gt;
+ &lt;cell id='3' cpus='0-3' memory='2097152' unit='KiB'&gt;
+ &lt;cache level='1' associativity='direct' policy='writeback'&gt;
+ &lt;size value='10' unit='KiB'/&gt;
+ &lt;line value='8' unit='B'/&gt;
+ &lt;/cache&gt;
+ &lt;/cell&gt;
+ &lt;interconnects&gt;
+ &lt;latency initiator='0' target='0' type='access' value='5'/&gt;
+ &lt;latency initiator='0' target='0' cache='1' type='access' value='10'/&gt;
+ &lt;bandwidth initiator='0' target='0' type='access' value='204800' unit='KiB'/&gt;
+ &lt;/interconnects&gt;
+ &lt;/numa&gt;
+ ...
+&lt;/cpu&gt;
+...</pre>
+
+ <p>
+ <span class='since'>Since 6.6.0</span> the <code>cell</code> element can
+ have a <code>cache</code> child element which describes memory side cache
+ for memory proximity domains. The <code>cache</code> element has a
+ <code>level</code> attribute describing the cache level and thus the
+ element can be repeated multiple times to describe different levels of
+ the cache.
+ </p>
+
+ <p>
+ The <code>cache</code> element then has following mandatory attributes:
+ </p>
+
+ <dl>
+ <dt><code>level</code></dt>
+ <dd>
+ Level of the cache this description refers to.
+ </dd>
+
+ <dt><code>associativity</code></dt>
+ <dd>
+ Describes cache associativity (accepted values are <code>none</code>,
+ <code>direct</code> and <code>full</code>).
+ </dd>
+
+ <dt><code>policy</code></dt>
+ <dd>
+ Describes cache write associativity (accepted values are
+ <code>none</code>, <code>writeback</code> and
+ <code>writethrough</code>).
+ </dd>
+ </dl>
+
+ <p>
+ The <code>cache</code> element has two mandatory child elements then:
+ <code>size</code> and <code>line</code> which describe cache size and
+ cache line size. Both elements accept two attributes: <code>value</code>
+ and <code>unit</code> which set the value of corresponding cache
+ attribute.
+ </p>
+
+ <p>
+ The NUMA description has an optional <code>interconnects</code> element that
+ describes the normalized memory read/write latency, read/write bandwidth
+ between Initiator Proximity Domains (Processor or I/O) and Target
+ Proximity Domains (Memory).
+ </p>
+
+ <p>
+ The <code>interconnects</code> element can have zero or more
+ <code>latency</code> child elements to describe latency between two
+ memory nodes and zero or more <code>bandwidth</code> child elements to
+ describe bandwidth between two memory nodes. Both these have the
+ following mandatory attributes:
+ </p>
+
+ <dl>
+ <dt><code>initiator</code></dt>
+ <dd>Refers to the source NUMA node</dd>
+
+ <dt><code>target</code></dt>
+ <dd>Refers to the target NUMA node</dd>
+
+ <dt><code>type</code></dt>
+ <dd>The type of the access. Accepted values: <code>access</code>,
+ <code>read</code>, <code>write</code></dd>
+
+ <dt><code>value</code></dt>
+ <dd>The actual value. For latency this is delay in nanoseconds, for
+ bandwidth this value is in kibibytes per second. Use additional
+ <code>unit</code> attribute to change the units.</dd>
+ </dl>
+
+ <p>
+ To describe latency from one NUMA node to a cache of another NUMA node
+ the <code>latency</code> element has optional <code>cache</code>
+ attribute which in combination with <code>target</code> attribute creates
+ full reference to distant NUMA node's cache level. For instance,
+ <code>target='0' cache='1'</code> refers to the first level cache of NUMA
+ node 0.
+ </p>
+
<h3><a id="elementsEvents">Events configuration</a></h3>
<p>
diff --git a/docs/schemas/cputypes.rng b/docs/schemas/cputypes.rng
index a1682a1003..ba30dbf9ff 100644
--- a/docs/schemas/cputypes.rng
+++ b/docs/schemas/cputypes.rng
@@ -102,9 +102,14 @@
<define name="cpuNuma">
<element name="numa">
- <oneOrMore>
- <ref name="numaCell"/>
- </oneOrMore>
+ <interleave>
+ <oneOrMore>
+ <ref name="numaCell"/>
+ </oneOrMore>
+ <optional>
+ <ref name="numaInterconnects"/>
+ </optional>
+ </interleave>
</element>
</define>
@@ -148,6 +153,9 @@
</oneOrMore>
</element>
</optional>
+ <zeroOrMore>
+ <ref name="numaCache"/>
+ </zeroOrMore>
</element>
</define>
@@ -162,6 +170,102 @@
</element>
</define>
+ <define name="numaCache">
+ <element name="cache">
+ <attribute name="level">
+ <ref name="unsignedInt"/>
+ </attribute>
+ <attribute name="associativity">
+ <choice>
+ <value>none</value>
+ <value>direct</value>
+ <value>full</value>
+ </choice>
+ </attribute>
+ <attribute name="policy">
+ <choice>
+ <value>none</value>
+ <value>writeback</value>
+ <value>writethrough</value>
+ </choice>
+ </attribute>
+ <interleave>
+ <element name="size">
+ <attribute name="value">
+ <ref name="unsignedInt"/>
+ </attribute>
+ <attribute name="unit">
+ <ref name="unit"/>
+ </attribute>
+ </element>
+ <element name="line">
+ <attribute name="value">
+ <ref name="unsignedInt"/>
+ </attribute>
+ <attribute name="unit">
+ <ref name="unit"/>
+ </attribute>
+ </element>
+ </interleave>
+ </element>
+ </define>
+
+ <define name="numaInterconnects">
+ <element name="interconnects">
+ <interleave>
+ <zeroOrMore>
+ <element name="latency">
+ <attribute name="initiator">
+ <ref name="unsignedInt"/>
+ </attribute>
+ <attribute name="target">
+ <ref name="unsignedInt"/>
+ </attribute>
+ <optional>
+ <attribute name="cache">
+ <ref name="unsignedInt"/>
+ </attribute>
+ </optional>
+ <attribute name="type">
+ <choice>
+ <value>access</value>
+ <value>read</value>
+ <value>write</value>
+ </choice>
+ </attribute>
+ <attribute name="value">
+ <ref name="unsignedInt"/>
+ </attribute>
+ <empty/>
+ </element>
+ </zeroOrMore>
+ <zeroOrMore>
+ <element name="bandwidth">
+ <attribute name="initiator">
+ <ref name="unsignedInt"/>
+ </attribute>
+ <attribute name="target">
+ <ref name="unsignedInt"/>
+ </attribute>
+ <attribute name="type">
+ <choice>
+ <value>access</value>
+ <value>read</value>
+ <value>write</value>
+ </choice>
+ </attribute>
+ <attribute name="value">
+ <ref name="unsignedInt"/>
+ </attribute>
+ <attribute name="unit">
+ <ref name="unit"/>
+ </attribute>
+ </element>
+ </zeroOrMore>
+ </interleave>
+ </element>
+ </define>
+
<!-- Memory as an attribute is in KiB, no way to express a unit -->
<define name="memoryKB">
<data type="unsignedLong"/>
diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c
index a805336d16..5c764190c3 100644
--- a/src/conf/numa_conf.c
+++ b/src/conf/numa_conf.c
@@ -59,9 +59,37 @@ VIR_ENUM_IMPL(virDomainMemoryAccess,
"private",
);
+VIR_ENUM_IMPL(virDomainCacheAssociativity,
+ VIR_DOMAIN_CACHE_ASSOCIATIVITY_LAST,
+ "none",
+ "direct",
+ "full",
+);
+
+VIR_ENUM_IMPL(virDomainCachePolicy,
+ VIR_DOMAIN_CACHE_POLICY_LAST,
+ "none",
+ "writeback",
+ "writethrough",
+);
+
+VIR_ENUM_IMPL(virDomainMemoryLatency,
+ VIR_DOMAIN_MEMORY_LATENCY_LAST,
+ "none",
+ "access",
+ "read",
+ "write"
+);
+
typedef struct _virDomainNumaDistance virDomainNumaDistance;
typedef virDomainNumaDistance *virDomainNumaDistancePtr;
+typedef struct _virDomainNumaCache virDomainNumaCache;
+typedef virDomainNumaCache *virDomainNumaCachePtr;
+
+typedef struct _virDomainNumaInterconnect virDomainNumaInterconnect;
+typedef virDomainNumaInterconnect *virDomainNumaInterconnectPtr;
+
typedef struct _virDomainNumaNode virDomainNumaNode;
typedef virDomainNumaNode *virDomainNumaNodePtr;
@@ -86,9 +114,30 @@ struct _virDomainNuma {
unsigned int cellid;
} *distances; /* remote node distances */
size_t ndistances;
+
+ struct _virDomainNumaCache {
+ unsigned int level; /* cache level */
+ unsigned int size; /* cache size */
+ unsigned int line; /* line size, !!! in bytes !!! */
+ virDomainCacheAssociativity associativity; /* cache associativity */
+ virDomainCachePolicy policy; /* cache policy */
+ } *caches;
+ size_t ncaches;
} *mem_nodes; /* guest node configuration */
size_t nmem_nodes;
+ struct _virDomainNumaInterconnect {
+ virDomainNumaInterconnectType type; /* whether structure describes latency
+ or bandwidth */
+ unsigned int initiator; /* the initiator NUMA node */
+ unsigned int target; /* the target NUMA node */
+ unsigned int cache; /* the target cache on @target; if 0 then the
+ memory on @target */
+ virDomainMemoryLatency accessType; /* what type of access is defined */
+ unsigned long value; /* value itself */
+ } *interconnects;
+ size_t ninterconnects;
+
/* Future NUMA tuning related stuff should go here. */
};
@@ -368,9 +417,13 @@ virDomainNumaFree(virDomainNumaPtr numa)
if (numa->mem_nodes[i].ndistances > 0)
VIR_FREE(numa->mem_nodes[i].distances);
+
+ VIR_FREE(numa->mem_nodes[i].caches);
}
VIR_FREE(numa->mem_nodes);
+ VIR_FREE(numa->interconnects);
+
VIR_FREE(numa);
}
@@ -841,6 +894,97 @@ virDomainNumaDefNodeDistanceParseXML(virDomainNumaPtr def,
return ret;
}
+
+static int
+virDomainNumaDefNodeCacheParseXML(virDomainNumaPtr def,
+ xmlXPathContextPtr ctxt,
+ unsigned int cur_cell)
+{
+ g_autofree xmlNodePtr *nodes = NULL;
+ int n;
+ size_t i;
+
+ if ((n = virXPathNodeSet("./cache", ctxt, &nodes)) < 0)
+ return -1;
+
+ def->mem_nodes[cur_cell].caches = g_new0(virDomainNumaCache, n);
+
+ for (i = 0; i < n; i++) {
+ VIR_XPATH_NODE_AUTORESTORE(ctxt);
+ virDomainNumaCachePtr cache = &def->mem_nodes[cur_cell].caches[i];
+ g_autofree char *tmp = NULL;
+ unsigned int level;
+ int associativity;
+ int policy;
+ unsigned long long size;
+ unsigned long long line;
+
+ if (!(tmp = virXMLPropString(nodes[i], "level"))) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("Missing 'level' attribute in cache "
+ "element for NUMA node %d"),
+ cur_cell);
+ return -1;
+ }
+
+ if (virStrToLong_uip(tmp, NULL, 10, &level) < 0 ||
+ level == 0) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("Invalid 'level' attribute in cache "
+ "element for NUMA node %d"),
+ cur_cell);
+ return -1;
+ }
+ VIR_FREE(tmp);
+
+ if (!(tmp = virXMLPropString(nodes[i], "associativity"))) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("Missing 'associativity' attribute in cache "
+ "element for NUMA node %d"),
+ cur_cell);
+ return -1;
+ }
+
+ if ((associativity = virDomainCacheAssociativityTypeFromString(tmp)) < 0) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("Invalid cache associativity '%s'"),
+ tmp);
+ return -1;
+ }
+ VIR_FREE(tmp);
+
+ if (!(tmp = virXMLPropString(nodes[i], "policy"))) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("Missing 'policy' attribute in cache "
+ "element for NUMA node %d"),
+ cur_cell);
+ }
+
+ if ((policy = virDomainCachePolicyTypeFromString(tmp)) < 0) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("Invalid cache policy '%s'"),
+ tmp);
+ return -1;
+ }
+ VIR_FREE(tmp);
+
+ ctxt->node = nodes[i];
+ if (virDomainParseMemory("./size/@value", "./size/unit",
+ ctxt, &size, true, false) < 0)
+ return -1;
+
+ if (virParseScaledValue("./line/@value", "./line/unit",
+ ctxt, &line, 1, ULLONG_MAX, true) < 0)
+ return -1;
+
+ *cache = (virDomainNumaCache){level, size, line, associativity, policy};
+ def->mem_nodes[cur_cell].ncaches++;
+ }
+
+ return 0;
+}
+
+
int
virDomainNumaDefParseXML(virDomainNumaPtr def,
xmlXPathContextPtr ctxt)
@@ -867,6 +1011,7 @@ virDomainNumaDefParseXML(virDomainNumaPtr def,
def->nmem_nodes = n;
for (i = 0; i < n; i++) {
+ VIR_XPATH_NODE_AUTORESTORE(ctxt);
int rc;
unsigned int cur_cell = i;
@@ -953,7 +1098,109 @@ virDomainNumaDefParseXML(virDomainNumaPtr def,
/* Parse NUMA distances info */
if (virDomainNumaDefNodeDistanceParseXML(def, ctxt, cur_cell) < 0)
+ goto cleanup;
+
+ /* Parse cache info */
+ if (virDomainNumaDefNodeCacheParseXML(def, ctxt, cur_cell) < 0)
+ goto cleanup;
+ }
+
+ VIR_FREE(nodes);
+ if ((n = virXPathNodeSet("./cpu/numa[1]/interconnects[1]/latency|"
+ "./cpu/numa[1]/interconnects[1]/bandwidth", ctxt, &nodes)) < 0)
+ goto cleanup;
+
+ def->interconnects = g_new0(virDomainNumaInterconnect, n);
+ for (i = 0; i < n; i++) {
+ virDomainNumaInterconnectType type;
+ unsigned int initiator;
+ unsigned int target;
+ unsigned int cache = 0;
+ int accessType;
+ unsigned long long value;
+
+ if (virXMLNodeNameEqual(nodes[i], "latency")) {
+ type = VIR_DOMAIN_NUMA_INTERCONNECT_TYPE_LATENCY;
+
+ if (!(tmp = virXMLPropString(nodes[i], "value"))) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("Missing 'value' attribute in NUMA interconnects"));
goto cleanup;
+ }
+
+ if (virStrToLong_ullp(tmp, NULL, 10, &value) < 0) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("Invalid 'value' attribute in NUMA interconnects"));
+ goto cleanup;
+ }
+ VIR_FREE(tmp);
+ } else if (virXMLNodeNameEqual(nodes[i], "bandwidth")) {
+ VIR_XPATH_NODE_AUTORESTORE(ctxt);
+ type = VIR_DOMAIN_NUMA_INTERCONNECT_TYPE_BANDWIDTH;
+
+ ctxt->node = nodes[i];
+
+ if (virDomainParseMemory("./@value", "./@unit", ctxt, &value, true, false) < 0)
+ goto cleanup;
+ } else {
+ /* Ignore yet unknown child elements. */
+ continue;
+ }
+
+ if (!(tmp = virXMLPropString(nodes[i], "initiator"))) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("Missing 'initiator' attribute in NUMA interconnects"));
+ goto cleanup;
+ }
+
+ if (virStrToLong_uip(tmp, NULL, 10, &initiator) < 0) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("Invalid 'initiator' attribute in NUMA interconnects"));
+ goto cleanup;
+ }
+ VIR_FREE(tmp);
+
+ if (!(tmp = virXMLPropString(nodes[i], "target"))) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("Missing 'target' attribute in NUMA interconnects"));
+ goto cleanup;
+ }
+
+ if (virStrToLong_uip(tmp, NULL, 10, &target) < 0) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("Invalid 'target' attribute in NUMA interconnects"));
+ goto cleanup;
+ }
+ VIR_FREE(tmp);
+
+
+ /* cache attribute is optional */
+ if ((tmp = virXMLPropString(nodes[i], "cache"))) {
+ if (virStrToLong_uip(tmp, NULL, 10, &cache) < 0 ||
+ cache == 0) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("Invalid 'cache' attribute in NUMA interconnects"));
+ goto cleanup;
+ }
+ }
+ VIR_FREE(tmp);
+
+ if (!(tmp = virXMLPropString(nodes[i], "type"))) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("Missing 'type' attribute in NUMA interconnects"));
+ goto cleanup;
+ }
+
+ if ((accessType = virDomainMemoryLatencyTypeFromString(tmp)) <= 0) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("Invalid 'type' attribute in NUMA interconnects"));
+ goto cleanup;
+ }
+ VIR_FREE(tmp);
+
+ def->interconnects[i] = (virDomainNumaInterconnect) {type, initiator, target,
+ cache, accessType, value};
+ def->ninterconnects++;
}
ret = 0;
@@ -983,6 +1230,7 @@ virDomainNumaDefFormatXML(virBufferPtr buf,
for (i = 0; i < ncells; i++) {
virBitmapPtr cpumask = virDomainNumaGetNodeCpumask(def, i);
int ndistances;
+ size_t ncaches;
memAccess = virDomainNumaGetNodeMemoryAccessMode(def, i);
discard = virDomainNumaGetNodeDiscard(def, i);
@@ -1009,30 +1257,107 @@ virDomainNumaDefFormatXML(virBufferPtr buf,
virTristateBoolTypeToString(discard));
ndistances = def->mem_nodes[i].ndistances;
- if (ndistances == 0) {
+ ncaches = def->mem_nodes[i].ncaches;
+ if (ndistances == 0 && ncaches == 0) {
virBufferAddLit(buf, "/>\n");
} else {
size_t j;
- virDomainNumaDistancePtr distances = def->mem_nodes[i].distances;
virBufferAddLit(buf, ">\n");
virBufferAdjustIndent(buf, 2);
- virBufferAddLit(buf, "<distances>\n");
- virBufferAdjustIndent(buf, 2);
- for (j = 0; j < ndistances; j++) {
- if (distances[j].value) {
- virBufferAddLit(buf, "<sibling");
- virBufferAsprintf(buf, " id='%d'", distances[j].cellid);
- virBufferAsprintf(buf, " value='%d'", distances[j].value);
- virBufferAddLit(buf, "/>\n");
+
+ if (ndistances) {
+ virDomainNumaDistancePtr distances = def->mem_nodes[i].distances;
+
+ virBufferAddLit(buf, "<distances>\n");
+ virBufferAdjustIndent(buf, 2);
+ for (j = 0; j < ndistances; j++) {
+ if (distances[j].value) {
+ virBufferAddLit(buf, "<sibling");
+ virBufferAsprintf(buf, " id='%d'", distances[j].cellid);
+ virBufferAsprintf(buf, " value='%d'", distances[j].value);
+ virBufferAddLit(buf, "/>\n");
+ }
}
+ virBufferAdjustIndent(buf, -2);
+ virBufferAddLit(buf, "</distances>\n");
+ }
+
+ for (j = 0; j < ncaches; j++) {
+ virDomainNumaCachePtr cache = &def->mem_nodes[i].caches[j];
+
+ virBufferAsprintf(buf, "<cache level='%u'", cache->level);
+ if (cache->associativity) {
+ virBufferAsprintf(buf, " associativity='%s'",
+ virDomainCacheAssociativityTypeToString(cache->associativity));
+ }
+
+ if (cache->policy) {
+ virBufferAsprintf(buf, " policy='%s'",
+ virDomainCachePolicyTypeToString(cache->policy));
+ }
+ virBufferAddLit(buf, ">\n");
+
+ virBufferAdjustIndent(buf, 2);
+ virBufferAsprintf(buf,
+ "<size value='%u' unit='KiB'/>\n",
+ cache->size);
+
+ if (cache->line) {
+ virBufferAsprintf(buf,
+ "<line value='%u' unit='B'/>\n",
+ cache->line);
+ }
+
+ virBufferAdjustIndent(buf, -2);
+ virBufferAddLit(buf, "</cache>\n");
}
- virBufferAdjustIndent(buf, -2);
- virBufferAddLit(buf, "</distances>\n");
virBufferAdjustIndent(buf, -2);
virBufferAddLit(buf, "</cell>\n");
}
}
+
+ if (def->ninterconnects) {
+ virBufferAddLit(buf, "<interconnects>\n");
+ virBufferAdjustIndent(buf, 2);
+ }
+
+ for (i = 0; i < def->ninterconnects; i++) {
+ virDomainNumaInterconnectPtr l = &def->interconnects[i];
+
+ switch (l->type) {
+ case VIR_DOMAIN_NUMA_INTERCONNECT_TYPE_LATENCY:
+ virBufferAddLit(buf, "<latency");
+ break;
+ case VIR_DOMAIN_NUMA_INTERCONNECT_TYPE_BANDWIDTH:
+ virBufferAddLit(buf, "<bandwidth");
+ }
+
+ virBufferAsprintf(buf,
+ " initiator='%u' target='%u'",
+ l->initiator, l->target);
+
+ if (l->cache > 0) {
+ virBufferAsprintf(buf,
+ " cache='%u'",
+ l->cache);
+ }
+
+ virBufferAsprintf(buf,
+ " type='%s' value='%lu'",
+ virDomainMemoryLatencyTypeToString(l->accessType),
+ l->value);
+
+ if (l->type == VIR_DOMAIN_NUMA_INTERCONNECT_TYPE_BANDWIDTH)
+ virBufferAddLit(buf, " unit='KiB'");
+ virBufferAddLit(buf, "/>\n");
+ }
+
+ if (def->ninterconnects) {
+ virBufferAdjustIndent(buf, -2);
+ virBufferAddLit(buf, "</interconnects>\n");
+ }
+
virBufferAdjustIndent(buf, -2);
virBufferAddLit(buf, "</numa>\n");
diff --git a/src/conf/numa_conf.h b/src/conf/numa_conf.h
index 6808439a7c..5043c5a6d4 100644
--- a/src/conf/numa_conf.h
+++ b/src/conf/numa_conf.h
@@ -52,6 +52,39 @@ typedef enum {
} virDomainMemoryAccess;
VIR_ENUM_DECL(virDomainMemoryAccess);
+typedef enum {
+ VIR_DOMAIN_CACHE_ASSOCIATIVITY_NONE, /* No associativity */
+ VIR_DOMAIN_CACHE_ASSOCIATIVITY_DIRECT, /* Direct mapped cache */
+ VIR_DOMAIN_CACHE_ASSOCIATIVITY_FULL, /* Fully associative cache */
+
+ VIR_DOMAIN_CACHE_ASSOCIATIVITY_LAST
+} virDomainCacheAssociativity;
+VIR_ENUM_DECL(virDomainCacheAssociativity);
+
+typedef enum {
+ VIR_DOMAIN_CACHE_POLICY_NONE, /* No policy */
+ VIR_DOMAIN_CACHE_POLICY_WRITEBACK, /* Write-back policy */
+ VIR_DOMAIN_CACHE_POLICY_WRITETHROUGH, /* Write-through policy */
+
+ VIR_DOMAIN_CACHE_POLICY_LAST
+} virDomainCachePolicy;
+VIR_ENUM_DECL(virDomainCachePolicy);
+
+typedef enum {
+ VIR_DOMAIN_NUMA_INTERCONNECT_TYPE_LATENCY,
+ VIR_DOMAIN_NUMA_INTERCONNECT_TYPE_BANDWIDTH,
+} virDomainNumaInterconnectType;
+
+typedef enum {
+ VIR_DOMAIN_MEMORY_LATENCY_NONE = 0, /* No memory latency defined */
+ VIR_DOMAIN_MEMORY_LATENCY_ACCESS, /* Access latency */
+ VIR_DOMAIN_MEMORY_LATENCY_READ, /* Read latency */
+ VIR_DOMAIN_MEMORY_LATENCY_WRITE, /* Write latency */
+
+ VIR_DOMAIN_MEMORY_LATENCY_LAST
+} virDomainMemoryLatency;
+VIR_ENUM_DECL(virDomainMemoryLatency);
+
virDomainNumaPtr virDomainNumaNew(void);
void virDomainNumaFree(virDomainNumaPtr numa);
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index acb25eb8c8..de95e3b116 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -808,8 +808,14 @@ virNodeDeviceDeleteVport;
virNodeDeviceGetParentName;
# conf/numa_conf.h
+virDomainCacheAssociativityTypeFromString;
+virDomainCacheAssociativityTypeToString;
+virDomainCachePolicyTypeFromString;
+virDomainCachePolicyTypeToString;
virDomainMemoryAccessTypeFromString;
virDomainMemoryAccessTypeToString;
+virDomainMemoryLatencyTypeFromString;
+virDomainMemoryLatencyTypeToString;
virDomainNumaCheckABIStability;
virDomainNumaEquals;
virDomainNumaFree;
diff --git a/tests/qemuxml2argvdata/numatune-hmat.xml b/tests/qemuxml2argvdata/numatune-hmat.xml
new file mode 100644
index 0000000000..83f0b56c9b
--- /dev/null
+++ b/tests/qemuxml2argvdata/numatune-hmat.xml
@@ -0,0 +1,52 @@
+<domain type='qemu'>
+ <name>QEMUGuest</name>
+ <uuid>c7a5fdb2-cdaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>8388608</memory>
+ <currentMemory unit='KiB'>8388608</currentMemory>
+ <vcpu placement='static'>12</vcpu>
+ <os>
+ <type arch='x86_64' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <features>
+ <acpi/>
+ <apic/>
+ <pae/>
+ </features>
+ <cpu>
+ <numa>
+ <cell id='0' cpus='0-3' memory='2097152' unit='KiB'>
+ <cache level='1' associativity='direct' policy='writeback'>
+ <size value='10' unit='KiB'/>
+ <line value='8' unit='B'/>
+ </cache>
+ </cell>
+ <cell id='1' cpus='4-7' memory='2097152' unit='KiB'/>
+ <cell id='2' cpus='8-11' memory='2097152' unit='KiB'/>
+ <cell id='3' memory='2097152' unit='KiB'/>
+ <cell id='4' memory='2097152' unit='KiB'/>
+ <cell id='5' memory='2097152' unit='KiB'/>
+ <interconnects>
+ <latency initiator='0' target='0' type='access' value='5'/>
+ <latency initiator='0' target='0' cache='1' type='access' value='10'/>
+ <bandwidth initiator='0' target='0' type='access' value='204800' unit='KiB'/>
+ </interconnects>
+ </numa>
+ </cpu>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>restart</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-system-x86_64</emulator>
+ <controller type='usb' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+ </controller>
+ <controller type='pci' index='0' model='pci-root'/>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <memballoon model='virtio'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+ </memballoon>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/numatune-hmat.xml b/tests/qemuxml2xmloutdata/numatune-hmat.xml
new file mode 120000
index 0000000000..6903a80ab1
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/numatune-hmat.xml
@@ -0,0 +1 @@
+../qemuxml2argvdata/numatune-hmat.xml
\ No newline at end of file
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 1ddeba30f0..de1d720e1d 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -1106,6 +1106,7 @@ mymain(void)
DO_TEST("numatune-memnode-no-memory", QEMU_CAPS_OBJECT_MEMORY_FILE);
DO_TEST("numatune-distances", QEMU_CAPS_NUMA, QEMU_CAPS_NUMA_DIST);
DO_TEST("numatune-no-vcpu", QEMU_CAPS_NUMA);
+ DO_TEST("numatune-hmat", NONE);
DO_TEST("bios-nvram", NONE);
DO_TEST("bios-nvram-os-interleave", NONE);
--
2.29.2

View File

@ -1,166 +0,0 @@
From 0ae283a1cb5224f3eb4fa32706e9b9c212577e51 Mon Sep 17 00:00:00 2001
Message-Id: <0ae283a1cb5224f3eb4fa32706e9b9c212577e51@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Wed, 7 Oct 2020 18:45:40 +0200
Subject: [PATCH] conf: Validate NUMA HMAT configuration
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
There are several restrictions, for instance @initiator and
@target have to refer to existing NUMA nodes (daa), @cache has to
refer to a defined cache level and so on.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
(cherry picked from commit f0611fe8830543d03d1871422f8c542453f0c8db)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1749518
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Message-Id: <e8488a2e49fa251dd0e2ab51f5ab627e3b265440.1602087923.git.mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/conf/domain_conf.c | 3 ++
src/conf/numa_conf.c | 99 ++++++++++++++++++++++++++++++++++++++++++
src/conf/numa_conf.h | 1 +
3 files changed, 103 insertions(+)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 3229d5ec95..f41559f33e 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -7144,6 +7144,9 @@ virDomainDefValidateInternal(const virDomainDef *def,
if (virDomainDefCputuneValidate(def) < 0)
return -1;
+ if (virDomainNumaDefValidate(def->numa) < 0)
+ return -1;
+
return 0;
}
diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c
index 5c764190c3..c90fb01bb6 100644
--- a/src/conf/numa_conf.c
+++ b/src/conf/numa_conf.c
@@ -1365,6 +1365,105 @@ virDomainNumaDefFormatXML(virBufferPtr buf,
}
+int
+virDomainNumaDefValidate(const virDomainNuma *def)
+{
+ size_t i;
+ size_t j;
+
+ if (!def)
+ return 0;
+
+ for (i = 0; i < def->nmem_nodes; i++) {
+ const virDomainNumaNode *node = &def->mem_nodes[i];
+ g_autoptr(virBitmap) levelsSeen = virBitmapNewEmpty();
+
+ for (j = 0; j < node->ncaches; j++) {
+ const virDomainNumaCache *cache = &node->caches[j];
+
+ /* Relax this if there's ever fourth layer of cache */
+ if (cache->level > 3) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("Ain't nobody heard of that much cache level"));
+ return -1;
+ }
+
+ if (virBitmapIsBitSet(levelsSeen, cache->level)) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("Cache level '%u' already defined"),
+ cache->level);
+ return -1;
+ }
+
+ if (virBitmapSetBitExpand(levelsSeen, cache->level))
+ return -1;
+ }
+ }
+
+ for (i = 0; i < def->ninterconnects; i++) {
+ const virDomainNumaInterconnect *l = &def->interconnects[i];
+
+ if (l->initiator >= def->nmem_nodes) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("'initiator' refers to a non-existent NUMA node"));
+ return -1;
+ }
+
+ if (l->target >= def->nmem_nodes) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("'target' refers to a non-existent NUMA node"));
+ return -1;
+ }
+
+ if (!def->mem_nodes[l->initiator].cpumask) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("NUMA nodes without CPUs can't be initiator"));
+ return -1;
+ }
+
+ if (l->cache > 0) {
+ for (j = 0; j < def->mem_nodes[l->target].ncaches; j++) {
+ const virDomainNumaCache *cache = def->mem_nodes[l->target].caches;
+
+ if (l->cache == cache->level)
+ break;
+ }
+
+ if (j == def->mem_nodes[l->target].ncaches) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("'cache' refers to a non-existent NUMA node cache"));
+ return -1;
+ }
+ }
+
+ for (j = 0; j < i; j++) {
+ const virDomainNumaInterconnect *ll = &def->interconnects[j];
+
+ if (l->type == ll->type &&
+ l->initiator == ll->initiator &&
+ l->target == ll->target &&
+ l->cache == ll->cache &&
+ l->accessType == ll->accessType) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("Duplicate info for NUMA latencies"));
+ return -1;
+ }
+
+
+ if (l->initiator != l->target &&
+ l->initiator == ll->target &&
+ l->target == ll->initiator) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("Link already defined"));
+ return -1;
+ }
+ }
+ }
+
+ return 0;
+}
+
+
unsigned int
virDomainNumaGetCPUCountTotal(virDomainNumaPtr numa)
{
diff --git a/src/conf/numa_conf.h b/src/conf/numa_conf.h
index 5043c5a6d4..2963004c94 100644
--- a/src/conf/numa_conf.h
+++ b/src/conf/numa_conf.h
@@ -217,5 +217,6 @@ bool virDomainNumatuneNodeSpecified(virDomainNumaPtr numatune,
int virDomainNumaDefParseXML(virDomainNumaPtr def, xmlXPathContextPtr ctxt);
int virDomainNumaDefFormatXML(virBufferPtr buf, virDomainNumaPtr def);
+int virDomainNumaDefValidate(const virDomainNuma *def);
unsigned int virDomainNumaGetCPUCountTotal(virDomainNumaPtr numa);
--
2.29.2

View File

@ -1,87 +0,0 @@
From 2780cb41f7682741be2bbe662d629dd1bd3b4f6e Mon Sep 17 00:00:00 2001
Message-Id: <2780cb41f7682741be2bbe662d629dd1bd3b4f6e@dist-git>
From: Laine Stump <laine@redhat.com>
Date: Sun, 26 Apr 2020 13:04:10 -0400
Subject: [PATCH] conf: add new PCI_CONNECT flag AUTOASSIGN
This new flag will be set for any controller that we decide can have
devices assigned to it automatically during PCI device assignment. In
the past PCI_CONNECT_TYPE_HOTPLUGGABLE was used for this purpose, but
that is overloading that flag, and no longer technically correct; what
we *really* want is to auto-assign devices to any pcie-root-port or
pcie-switch-downstream-port regardless of whether or not that
controller happens to have hotplug enabled.
This patch just adds the flag, but doesn't use it at all. Note that
the numbering of all the other flags was changed in order to insert
the new flag near the beginning of the list; that doesn't cause any
problem because the connect flags aren't stored anywhere between runs
of libvirtd.
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit c296a846ad7de3066a17404f4f407d3e1b6d7935)
https://bugzilla.redhat.com/1802592
Signed-off-by: Laine Stump <laine@redhat.com>
Message-Id: <20200426170415.18328-8-laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
---
src/conf/domain_addr.h | 41 +++++++++++++++++++++--------------------
1 file changed, 21 insertions(+), 20 deletions(-)
diff --git a/src/conf/domain_addr.h b/src/conf/domain_addr.h
index dcb90618f8..40738ddb72 100644
--- a/src/conf/domain_addr.h
+++ b/src/conf/domain_addr.h
@@ -32,26 +32,27 @@ typedef enum {
} virPCIDeviceAddressExtensionFlags;
typedef enum {
- VIR_PCI_CONNECT_HOTPLUGGABLE = 1 << 0, /* is hotplug needed/supported */
-
- /* set for devices that can share a single slot in auto-assignment
- * (by assigning one device to each of the 8 functions on the slot)
- */
- VIR_PCI_CONNECT_AGGREGATE_SLOT = 1 << 1,
-
- /* kinds of devices as a bitmap so they can be combined (some PCI
- * controllers permit connecting multiple types of devices)
- */
- VIR_PCI_CONNECT_TYPE_PCI_DEVICE = 1 << 2,
- VIR_PCI_CONNECT_TYPE_PCIE_DEVICE = 1 << 3,
- VIR_PCI_CONNECT_TYPE_PCIE_ROOT_PORT = 1 << 4,
- VIR_PCI_CONNECT_TYPE_PCIE_SWITCH_UPSTREAM_PORT = 1 << 5,
- VIR_PCI_CONNECT_TYPE_PCIE_SWITCH_DOWNSTREAM_PORT = 1 << 6,
- VIR_PCI_CONNECT_TYPE_DMI_TO_PCI_BRIDGE = 1 << 7,
- VIR_PCI_CONNECT_TYPE_PCI_EXPANDER_BUS = 1 << 8,
- VIR_PCI_CONNECT_TYPE_PCIE_EXPANDER_BUS = 1 << 9,
- VIR_PCI_CONNECT_TYPE_PCI_BRIDGE = 1 << 10,
- VIR_PCI_CONNECT_TYPE_PCIE_TO_PCI_BRIDGE = 1 << 11,
+ VIR_PCI_CONNECT_AUTOASSIGN = 1 << 0, /* okay to autoassign a device to this controller */
+ VIR_PCI_CONNECT_HOTPLUGGABLE = 1 << 1, /* is hotplug needed/supported */
+
+ /* set for devices that can share a single slot in auto-assignment
+ * (by assigning one device to each of the 8 functions on the slot)
+ */
+ VIR_PCI_CONNECT_AGGREGATE_SLOT = 1 << 2,
+
+ /* kinds of devices as a bitmap so they can be combined (some PCI
+ * controllers permit connecting multiple types of devices)
+ */
+ VIR_PCI_CONNECT_TYPE_PCI_DEVICE = 1 << 3,
+ VIR_PCI_CONNECT_TYPE_PCIE_DEVICE = 1 << 4,
+ VIR_PCI_CONNECT_TYPE_PCIE_ROOT_PORT = 1 << 5,
+ VIR_PCI_CONNECT_TYPE_PCIE_SWITCH_UPSTREAM_PORT = 1 << 6,
+ VIR_PCI_CONNECT_TYPE_PCIE_SWITCH_DOWNSTREAM_PORT = 1 << 7,
+ VIR_PCI_CONNECT_TYPE_DMI_TO_PCI_BRIDGE = 1 << 8,
+ VIR_PCI_CONNECT_TYPE_PCI_EXPANDER_BUS = 1 << 9,
+ VIR_PCI_CONNECT_TYPE_PCIE_EXPANDER_BUS = 1 << 10,
+ VIR_PCI_CONNECT_TYPE_PCI_BRIDGE = 1 << 11,
+ VIR_PCI_CONNECT_TYPE_PCIE_TO_PCI_BRIDGE = 1 << 12,
} virDomainPCIConnectFlags;
/* a combination of all bits that describe the type of connections
--
2.26.2

View File

@ -1,395 +0,0 @@
From c811bd72130364673dd4a0d2a997a1d8f675eb71 Mon Sep 17 00:00:00 2001
Message-Id: <c811bd72130364673dd4a0d2a997a1d8f675eb71@dist-git>
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
Date: Wed, 4 Mar 2020 12:42:42 +0100
Subject: [PATCH] conf: add virtiofs-related elements and attributes
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Add more elements for tuning the virtiofsd daemon
and the vhost-user-fs device:
<driver type='virtiofs' queue='1024' xattr='on'>
<binary path='/usr/libexec/virtiofsd'>
<cache mode='always'/>
<lock posix='off' flock='off'/>
</binary>
</driver>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Tested-by: Andrea Bolognani <abologna@redhat.com>
(cherry picked from commit 66079339847dc942b9b673e3040b56b055a8d8f5)
Signed-off-by: Ján Tomko <jtomko@redhat.com>
https://bugzilla.redhat.com/show_bug.cgi?id=1694166
Message-Id: <506d0532c6043a9b8c946bdc42c3d9c5529f6fb8.1583322090.git.jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
---
docs/formatdomain.html.in | 25 ++++-
docs/schemas/domaincommon.rng | 48 ++++++++
src/conf/domain_conf.c | 104 +++++++++++++++++-
src/conf/domain_conf.h | 15 +++
src/libvirt_private.syms | 1 +
.../vhost-user-fs-fd-memory.xml | 6 +-
.../vhost-user-fs-hugepages.xml | 1 +
7 files changed, 197 insertions(+), 3 deletions(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 337ab01316..e9830ab231 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -3936,7 +3936,11 @@
&lt;readonly/&gt;
&lt;/filesystem&gt;
&lt;filesystem type='mount' accessmode='passthrough'&gt;
- &lt;driver type='virtiofs'/&gt;
+ &lt;driver type='virtiofs queue='1024'/&gt;
+ &lt;binary path='/usr/libexec/virtiofsd' xattr='on'&gt;
+ &lt;cache mode='always'/&gt;
+ &lt;lock posix='on' flock='on'/&gt;
+ &lt;/binary&gt;
&lt;source dir='/path'/&gt;
&lt;target dir='mount_tag'/&gt;
&lt;/filesystem&gt;
@@ -4063,9 +4067,28 @@
<a href="#elementsVirtio">Virtio-specific options</a> can also be
set. (<span class="since">Since 3.5.0</span>)
</li>
+ <li>
+ For <code>virtiofs</code>, the <code>queue</code> attribute can be used
+ to specify the queue size (i.e. how many requests can the queue fit).
+ (<span class="since">Since 6.2.0</span>)
+ </li>
</ul>
</dd>
+ <dt><code>binary</code></dt>
+ <dd>
+ The optional <code>binary</code> element can tune the options for virtiofsd.
+ All of the following attributes and elements are optional.
+ The attribute <code>path</code> can be used to override the path to the daemon.
+ Attribute <code>xattr</code> enables the use of filesystem extended attributes.
+ Caching can be tuned via the <code>cache</code> element, possible <code>mode</code>
+ values being <code>none</code> and <code>always</code>.
+ Locking can be controlled via the <code>lock</code>
+ element - attributes <code>posix</code> and <code>flock</code> both accepting
+ values <code>on</code> or <code>off</code>.
+ (<span class="since">Since 6.2.0</span>)
+ </dd>
+
<dt><code>source</code></dt>
<dd>
The resource on the host that is being accessed in the guest. The
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 5a9291b443..aa70e340b9 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -2500,6 +2500,9 @@
<optional>
<ref name="fsDriver"/>
</optional>
+ <optional>
+ <ref name="fsBinary"/>
+ </optional>
<interleave>
<element name="source">
<attribute name="dir">
@@ -2649,12 +2652,57 @@
<attribute name="type">
<value>virtiofs</value>
</attribute>
+ <optional>
+ <attribute name="queue">
+ <ref name="unsignedInt"/>
+ </attribute>
+ </optional>
<ref name='virtioOptions'/>
</group>
<empty/>
</choice>
</element>
</define>
+ <define name="fsBinary">
+ <element name="binary">
+ <optional>
+ <attribute name="path">
+ <ref name="absFilePath"/>
+ </attribute>
+ </optional>
+ <optional>
+ <attribute name="xattr">
+ <ref name="virOnOff"/>
+ </attribute>
+ </optional>
+ <optional>
+ <element name="cache">
+ <optional>
+ <attribute name="mode">
+ <choice>
+ <value>none</value>
+ <value>always</value>
+ </choice>
+ </attribute>
+ </optional>
+ </element>
+ </optional>
+ <optional>
+ <element name="lock">
+ <optional>
+ <attribute name="posix">
+ <ref name="virOnOff"/>
+ </attribute>
+ </optional>
+ <optional>
+ <attribute name="flock">
+ <ref name="virOnOff"/>
+ </attribute>
+ </optional>
+ </element>
+ </optional>
+ </element>
+ </define>
<define name="interface-network-attributes">
<attribute name="network">
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 31d4828802..3a370e6b90 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -500,6 +500,14 @@ VIR_ENUM_IMPL(virDomainFSModel,
"virtio-non-transitional",
);
+VIR_ENUM_IMPL(virDomainFSCacheMode,
+ VIR_DOMAIN_FS_CACHE_MODE_LAST,
+ "default",
+ "none",
+ "always",
+);
+
+
VIR_ENUM_IMPL(virDomainNet,
VIR_DOMAIN_NET_TYPE_LAST,
"user",
@@ -2322,6 +2330,7 @@ void virDomainFSDefFree(virDomainFSDefPtr def)
virDomainDeviceInfoClear(&def->info);
VIR_FREE(def->virtio);
virObjectUnref(def->privateData);
+ VIR_FREE(def->binary);
VIR_FREE(def);
}
@@ -11293,6 +11302,63 @@ virDomainFSDefParseXML(virDomainXMLOptionPtr xmlopt,
}
}
+ if (def->fsdriver == VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS) {
+ g_autofree char *queue_size = virXPathString("string(./driver/@queue)", ctxt);
+ g_autofree char *binary = virXPathString("string(./binary/@path)", ctxt);
+ g_autofree char *xattr = virXPathString("string(./binary/@xattr)", ctxt);
+ g_autofree char *cache = virXPathString("string(./binary/cache/@mode)", ctxt);
+ g_autofree char *posix_lock = virXPathString("string(./binary/lock/@posix)", ctxt);
+ g_autofree char *flock = virXPathString("string(./binary/lock/@flock)", ctxt);
+ int val;
+
+ if (queue_size && virStrToLong_ull(queue_size, NULL, 10, &def->queue_size) < 0) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("cannot parse queue size '%s' for virtiofs"),
+ queue_size);
+ goto error;
+ }
+
+ if (binary)
+ def->binary = virFileSanitizePath(binary);
+
+ if (xattr) {
+ if ((val = virTristateSwitchTypeFromString(xattr)) <= 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unknown xattr value '%s'"), xattr);
+ goto error;
+ }
+ def->xattr = val;
+ }
+
+ if (cache) {
+ if ((val = virDomainFSCacheModeTypeFromString(cache)) <= 0) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("cannot parse cache mode '%s' for virtiofs"),
+ cache);
+ goto error;
+ }
+ def->cache = val;
+ }
+
+ if (posix_lock) {
+ if ((val = virTristateSwitchTypeFromString(posix_lock)) <= 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unknown posix lock value '%s'"), posix_lock);
+ goto error;
+ }
+ def->posix_lock = val;
+ }
+
+ if (flock) {
+ if ((val = virTristateSwitchTypeFromString(flock)) <= 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unknown flock value '%s'"), flock);
+ goto error;
+ }
+ def->flock = val;
+ }
+ }
+
if (format) {
if ((def->format = virStorageFileFormatTypeFromString(format)) <= 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
@@ -24994,6 +25060,9 @@ virDomainFSDefFormat(virBufferPtr buf,
const char *wrpolicy = virDomainFSWrpolicyTypeToString(def->wrpolicy);
const char *src = def->src->path;
g_auto(virBuffer) driverAttrBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) driverBuf = VIR_BUFFER_INIT_CHILD(buf);
+ g_auto(virBuffer) binaryAttrBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) binaryBuf = VIR_BUFFER_INIT_CHILD(buf);
if (!type) {
virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -25017,6 +25086,8 @@ virDomainFSDefFormat(virBufferPtr buf,
virBufferAddLit(buf, ">\n");
virBufferAdjustIndent(buf, 2);
+ virBufferAdjustIndent(&driverBuf, 2);
+ virBufferAdjustIndent(&binaryBuf, 2);
if (def->fsdriver) {
virBufferAsprintf(&driverAttrBuf, " type='%s'", fsdriver);
@@ -25028,11 +25099,42 @@ virDomainFSDefFormat(virBufferPtr buf,
if (def->wrpolicy)
virBufferAsprintf(&driverAttrBuf, " wrpolicy='%s'", wrpolicy);
+ if (def->queue_size)
+ virBufferAsprintf(&driverAttrBuf, " queue='%llu'", def->queue_size);
+
+ }
+
+ if (def->fsdriver == VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS) {
+ g_auto(virBuffer) lockAttrBuf = VIR_BUFFER_INITIALIZER;
+ virBufferEscapeString(&binaryAttrBuf, " path='%s'", def->binary);
+
+ if (def->xattr != VIR_TRISTATE_SWITCH_ABSENT) {
+ virBufferAsprintf(&binaryAttrBuf, " xattr='%s'",
+ virTristateSwitchTypeToString(def->xattr));
+ }
+
+ if (def->cache != VIR_DOMAIN_FS_CACHE_MODE_DEFAULT) {
+ virBufferAsprintf(&binaryBuf, "<cache mode='%s'/>\n",
+ virDomainFSCacheModeTypeToString(def->cache));
+ }
+
+ if (def->posix_lock != VIR_TRISTATE_SWITCH_ABSENT) {
+ virBufferAsprintf(&lockAttrBuf, " posix='%s'",
+ virTristateSwitchTypeToString(def->posix_lock));
+ }
+
+ if (def->flock != VIR_TRISTATE_SWITCH_ABSENT) {
+ virBufferAsprintf(&lockAttrBuf, " flock='%s'",
+ virTristateSwitchTypeToString(def->flock));
+ }
+
+ virXMLFormatElement(&binaryBuf, "lock", &lockAttrBuf, NULL);
}
virDomainVirtioOptionsFormat(&driverAttrBuf, def->virtio);
- virXMLFormatElement(buf, "driver", &driverAttrBuf, NULL);
+ virXMLFormatElement(buf, "driver", &driverAttrBuf, &driverBuf);
+ virXMLFormatElement(buf, "binary", &binaryAttrBuf, &binaryBuf);
switch (def->type) {
case VIR_DOMAIN_FS_TYPE_MOUNT:
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 921cc42a57..2a382ede72 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -802,6 +802,14 @@ typedef enum {
VIR_DOMAIN_FS_MODEL_LAST
} virDomainFSModel;
+typedef enum {
+ VIR_DOMAIN_FS_CACHE_MODE_DEFAULT = 0,
+ VIR_DOMAIN_FS_CACHE_MODE_NONE,
+ VIR_DOMAIN_FS_CACHE_MODE_ALWAYS,
+
+ VIR_DOMAIN_FS_CACHE_MODE_LAST
+} virDomainFSCacheMode;
+
struct _virDomainFSDef {
int type;
int fsdriver; /* enum virDomainFSDriverType */
@@ -817,6 +825,12 @@ struct _virDomainFSDef {
unsigned long long space_hard_limit; /* in bytes */
unsigned long long space_soft_limit; /* in bytes */
bool symlinksResolved;
+ char *binary;
+ unsigned long long queue_size;
+ virTristateSwitch xattr;
+ virDomainFSCacheMode cache;
+ virTristateSwitch posix_lock;
+ virTristateSwitch flock;
virDomainVirtioOptionsPtr virtio;
virObjectPtr privateData;
};
@@ -3437,6 +3451,7 @@ VIR_ENUM_DECL(virDomainFSDriver);
VIR_ENUM_DECL(virDomainFSAccessMode);
VIR_ENUM_DECL(virDomainFSWrpolicy);
VIR_ENUM_DECL(virDomainFSModel);
+VIR_ENUM_DECL(virDomainFSCacheMode);
VIR_ENUM_DECL(virDomainNet);
VIR_ENUM_DECL(virDomainNetBackend);
VIR_ENUM_DECL(virDomainNetVirtioTxMode);
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index bc2858fc00..5dc99e03cf 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -389,6 +389,7 @@ virDomainDiskSourceFormat;
virDomainDiskTranslateSourcePool;
virDomainFeatureTypeFromString;
virDomainFeatureTypeToString;
+virDomainFSCacheModeTypeToString;
virDomainFSDefFree;
virDomainFSDefNew;
virDomainFSDriverTypeToString;
diff --git a/tests/qemuxml2argvdata/vhost-user-fs-fd-memory.xml b/tests/qemuxml2argvdata/vhost-user-fs-fd-memory.xml
index a6b6279fb8..f6bb663e97 100644
--- a/tests/qemuxml2argvdata/vhost-user-fs-fd-memory.xml
+++ b/tests/qemuxml2argvdata/vhost-user-fs-fd-memory.xml
@@ -27,7 +27,11 @@
<controller type='usb' index='0' model='none'/>
<controller type='pci' index='0' model='pci-root'/>
<filesystem type='mount' accessmode='passthrough'>
- <driver type='virtiofs'/>
+ <driver type='virtiofs' queue='1024'/>
+ <binary path='/usr/libexec/virtiofsd' xattr='on'>
+ <cache mode='always'/>
+ <lock posix='off' flock='off'/>
+ </binary>
<source dir='/path'/>
<target dir='mount_tag'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
diff --git a/tests/qemuxml2argvdata/vhost-user-fs-hugepages.xml b/tests/qemuxml2argvdata/vhost-user-fs-hugepages.xml
index 70df7b890d..96b9774704 100644
--- a/tests/qemuxml2argvdata/vhost-user-fs-hugepages.xml
+++ b/tests/qemuxml2argvdata/vhost-user-fs-hugepages.xml
@@ -63,6 +63,7 @@
</controller>
<filesystem type='mount' accessmode='passthrough'>
<driver type='virtiofs'/>
+ <binary path='/usr/libexec/virtiofsd'/>
<source dir='/path'/>
<target dir='mount_tag'/>
<address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
--
2.25.1

View File

@ -1,146 +0,0 @@
From 100ae962cd0f4dbfd5270bc2d61f05ec1c524c0a Mon Sep 17 00:00:00 2001
Message-Id: <100ae962cd0f4dbfd5270bc2d61f05ec1c524c0a@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Tue, 4 Feb 2020 15:07:40 +0100
Subject: [PATCH] conf: backup: Allow configuration of names exported via NBD
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
If users wish to use different name for exported disks or bitmaps
the new fields allow to do so. Additionally they also document the
current settings.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
(cherry picked from commit 12ccd8d4db12d71a270d903701a8edb83d41f127)
https://bugzilla.redhat.com/show_bug.cgi?id=1207659
Message-Id: <8043f75d8d4b4ae7e7ae3671d71407f733e6a3cf.1580824112.git.pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
docs/formatbackup.html.in | 9 +++++++++
docs/schemas/domainbackup.rng | 8 ++++++++
src/conf/backup_conf.c | 10 ++++++++++
src/conf/backup_conf.h | 2 ++
tests/domainbackupxml2xmlin/backup-pull-seclabel.xml | 2 +-
tests/domainbackupxml2xmlout/backup-pull-seclabel.xml | 2 +-
6 files changed, 31 insertions(+), 2 deletions(-)
diff --git a/docs/formatbackup.html.in b/docs/formatbackup.html.in
index 1c690901c7..543d913072 100644
--- a/docs/formatbackup.html.in
+++ b/docs/formatbackup.html.in
@@ -85,6 +85,15 @@
<dd>Setting this attribute to <code>yes</code>(default) specifies
that the disk should take part in the backup and using
<code>no</code> excludes the disk from the backup.</dd>
+ <dt><code>exportname</code></dt>
+ <dd>Allows modification of the NBD export name for the given disk.
+ By default equal to disk target.
+ Valid only for pull mode backups.</dd>
+ <dt><code>exportbitmap</code></dt>
+ <dd>Allows modification of the name of the bitmap describing dirty
+ blocks for an incremental backup exported via NBD export name
+ for the given disk.
+ Valid only for pull mode backups.</dd>
<dt><code>type</code></dt>
<dd>A mandatory attribute to describe the type of the
disk, except when <code>backup='no'</code> is
diff --git a/docs/schemas/domainbackup.rng b/docs/schemas/domainbackup.rng
index c1e4d80302..395ea841f9 100644
--- a/docs/schemas/domainbackup.rng
+++ b/docs/schemas/domainbackup.rng
@@ -165,6 +165,14 @@
<attribute name='name'>
<ref name='diskTarget'/>
</attribute>
+ <optional>
+ <attribute name='exportname'>
+ <text/>
+ </attribute>
+ <attribute name='exportbitmap'>
+ <text/>
+ </attribute>
+ </optional>
<choice>
<group>
<attribute name='backup'>
diff --git a/src/conf/backup_conf.c b/src/conf/backup_conf.c
index 61dc8cd4b2..b370b686f1 100644
--- a/src/conf/backup_conf.c
+++ b/src/conf/backup_conf.c
@@ -71,6 +71,8 @@ virDomainBackupDefFree(virDomainBackupDefPtr def)
virDomainBackupDiskDefPtr disk = def->disks + i;
g_free(disk->name);
+ g_free(disk->exportname);
+ g_free(disk->exportbitmap);
virObjectUnref(disk->store);
}
@@ -124,6 +126,11 @@ virDomainBackupDiskDefParseXML(xmlNodePtr node,
if (def->backup == VIR_TRISTATE_BOOL_NO)
return 0;
+ if (!push) {
+ def->exportname = virXMLPropString(node, "exportname");
+ def->exportbitmap = virXMLPropString(node, "exportbitmap");
+ }
+
if (internal) {
if (!(state = virXMLPropString(node, "state")) ||
(tmp = virDomainBackupDiskStateTypeFromString(state)) < 0) {
@@ -333,6 +340,9 @@ virDomainBackupDiskDefFormat(virBufferPtr buf,
if (disk->backup == VIR_TRISTATE_BOOL_YES) {
virBufferAsprintf(&attrBuf, " type='%s'", virStorageTypeToString(disk->store->type));
+ virBufferEscapeString(&attrBuf, " exportname='%s'", disk->exportname);
+ virBufferEscapeString(&attrBuf, " exportbitmap='%s'", disk->exportbitmap);
+
if (disk->store->format > 0)
virBufferEscapeString(&childBuf, "<driver type='%s'/>\n",
virStorageFileFormatTypeToString(disk->store->format));
diff --git a/src/conf/backup_conf.h b/src/conf/backup_conf.h
index 7cf44245d4..672fd52ee7 100644
--- a/src/conf/backup_conf.h
+++ b/src/conf/backup_conf.h
@@ -51,6 +51,8 @@ typedef virDomainBackupDiskDef *virDomainBackupDiskDefPtr;
struct _virDomainBackupDiskDef {
char *name; /* name matching the <target dev='...' of the domain */
virTristateBool backup; /* whether backup is requested */
+ char *exportname; /* name of the NBD export for pull mode backup */
+ char *exportbitmap; /* name of the bitmap exposed in NBD for pull mode backup */
/* details of target for push-mode, or of the scratch file for pull-mode */
virStorageSourcePtr store;
diff --git a/tests/domainbackupxml2xmlin/backup-pull-seclabel.xml b/tests/domainbackupxml2xmlin/backup-pull-seclabel.xml
index a00d8758bb..4e6e602c19 100644
--- a/tests/domainbackupxml2xmlin/backup-pull-seclabel.xml
+++ b/tests/domainbackupxml2xmlin/backup-pull-seclabel.xml
@@ -2,7 +2,7 @@
<incremental>1525889631</incremental>
<server transport='tcp' name='localhost' port='10809'/>
<disks>
- <disk name='vda' type='file'>
+ <disk name='vda' type='file' exportname='test-vda' exportbitmap='blah'>
<driver type='qcow2'/>
<scratch file='/path/to/file'>
<seclabel model='dac' relabel='no'/>
diff --git a/tests/domainbackupxml2xmlout/backup-pull-seclabel.xml b/tests/domainbackupxml2xmlout/backup-pull-seclabel.xml
index c631c9b979..450f007d3a 100644
--- a/tests/domainbackupxml2xmlout/backup-pull-seclabel.xml
+++ b/tests/domainbackupxml2xmlout/backup-pull-seclabel.xml
@@ -2,7 +2,7 @@
<incremental>1525889631</incremental>
<server transport='tcp' name='localhost' port='10809'/>
<disks>
- <disk name='vda' backup='yes' type='file'>
+ <disk name='vda' backup='yes' type='file' exportname='test-vda' exportbitmap='blah'>
<driver type='qcow2'/>
<scratch file='/path/to/file'>
<seclabel model='dac' relabel='no'/>
--
2.25.0

View File

@ -1,67 +0,0 @@
From 7f5c44bfd2b6290e142380775b6a6205ccc43840 Mon Sep 17 00:00:00 2001
Message-Id: <7f5c44bfd2b6290e142380775b6a6205ccc43840@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Tue, 23 Jun 2020 12:23:37 +0200
Subject: [PATCH] conf: backup: Store incremental backup checkpoint name
per-disk
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
In preparation to allow heterogenous backups store the 'incremental'
field per-disk and fill it by default from the per-backup field.
Having this will be important once we'll want to allow incremental
backup working while hotplugging a new disk.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
(cherry picked from commit b8295160c36e555d8bcaef5015d0c1e3ae85fb17)
https://bugzilla.redhat.com/show_bug.cgi?id=1804593
Message-Id: <ee6c31ce5f3400523559793fe40e789656068f7c.1592906423.git.pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/conf/backup_conf.c | 8 ++++++++
src/conf/backup_conf.h | 1 +
2 files changed, 9 insertions(+)
diff --git a/src/conf/backup_conf.c b/src/conf/backup_conf.c
index 64c8f6cc09..58fb3ec759 100644
--- a/src/conf/backup_conf.c
+++ b/src/conf/backup_conf.c
@@ -71,6 +71,7 @@ virDomainBackupDefFree(virDomainBackupDefPtr def)
virDomainBackupDiskDefPtr disk = def->disks + i;
g_free(disk->name);
+ g_free(disk->incremental);
g_free(disk->exportname);
g_free(disk->exportbitmap);
virObjectUnref(disk->store);
@@ -503,5 +504,12 @@ virDomainBackupAlignDisks(virDomainBackupDefPtr def,
}
}
+ for (i = 0; i < def->ndisks; i++) {
+ virDomainBackupDiskDefPtr backupdisk = &def->disks[i];
+
+ if (def->incremental && !backupdisk->incremental)
+ backupdisk->incremental = g_strdup(def->incremental);
+ }
+
return 0;
}
diff --git a/src/conf/backup_conf.h b/src/conf/backup_conf.h
index 672fd52ee7..7ce7a46ad4 100644
--- a/src/conf/backup_conf.h
+++ b/src/conf/backup_conf.h
@@ -51,6 +51,7 @@ typedef virDomainBackupDiskDef *virDomainBackupDiskDefPtr;
struct _virDomainBackupDiskDef {
char *name; /* name matching the <target dev='...' of the domain */
virTristateBool backup; /* whether backup is requested */
+ char *incremental; /* name of the starting point checkpoint of an incremental backup */
char *exportname; /* name of the NBD export for pull mode backup */
char *exportbitmap; /* name of the bitmap exposed in NBD for pull mode backup */
--
2.27.0

View File

@ -1,51 +0,0 @@
From 28094095fe6e4b05b25e459a34d93d195b7afb62 Mon Sep 17 00:00:00 2001
Message-Id: <28094095fe6e4b05b25e459a34d93d195b7afb62@dist-git>
From: Laine Stump <laine@redhat.com>
Date: Sun, 26 Apr 2020 13:17:02 -0400
Subject: [PATCH] conf: check HOTPLUGGABLE connect flag when validating a PCI
address
The HOTPLUGGABLE flag is set for appropriates buses in a PCI address
set, and thnis patch updates virDomainPCIAddressFlagsCompatible() to
check the HOTPLUGGABLE flag when searching for a suitable bus/slot for
a device. No devices request HOTPLUGGABLE though (yet), so there is no
observable effect.
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit a283189f8c64882681ea99259ccfc8d1b8e524dd)
https://bugzilla.redhat.com/1802592
Signed-off-by: Laine Stump <laine@redhat.com>
Message-Id: <20200426171703.18808-2-laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
---
src/conf/domain_addr.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c
index cc45a0bbf1..ed41eca114 100644
--- a/src/conf/domain_addr.c
+++ b/src/conf/domain_addr.c
@@ -376,6 +376,18 @@ virDomainPCIAddressFlagsCompatible(virPCIDeviceAddressPtr addr,
return false;
}
+ if ((devFlags & VIR_PCI_CONNECT_HOTPLUGGABLE) &&
+ !(busFlags & VIR_PCI_CONNECT_HOTPLUGGABLE)) {
+ if (reportError) {
+ virReportError(errType,
+ _("The device at PCI address %s requires "
+ "hotplug capability, but the PCI controller "
+ "with index='%d' doesn't support hotplug"),
+ addrStr, addr->bus);
+ }
+ return false;
+ }
+
/* If this bus doesn't allow the type of connection (PCI
* vs. PCIe) required by the device, or if the device requires
* hot-plug and this bus doesn't have it, return false.
--
2.26.2

View File

@ -1,70 +0,0 @@
From f9fdeb29a61a98868d1a9f5284a85c57f826d6d1 Mon Sep 17 00:00:00 2001
Message-Id: <f9fdeb29a61a98868d1a9f5284a85c57f826d6d1@dist-git>
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
Date: Fri, 13 Mar 2020 13:08:08 +0100
Subject: [PATCH] conf: do not generate machine names ending with a dash
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
As of systemd commit:
commit d65652f1f21a4b0c59711320f34266c635393c89
Author: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
CommitDate: 2018-12-10 09:56:56 +0100
Partially unify hostname_is_valid() and dns_name_is_valid()
Dashes are no longer allowed at the end of machine names.
Trim the trailing dashes from the generated name before passing
it to machined.
Fedora: https://bugzilla.redhat.com/show_bug.cgi?id=1790409
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
(cherry picked from commit 45464db8ba502764cf37ec9335770248bdb3d9a8)
Prerequisite for: https://bugzilla.redhat.com/show_bug.cgi?id=1808499
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Message-Id: <ae17f80d69ee7772d32dd5c34c332be6b77e7afb.1584101247.git.mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/conf/domain_conf.c | 3 +++
tests/virsystemdtest.c | 4 ++++
2 files changed, 7 insertions(+)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 77e3d25a2d..4b297c96bc 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -30708,6 +30708,9 @@ virDomainMachineNameAppendValid(virBufferPtr buf,
virBufferAddChar(buf, *name);
}
+
+ /* trailing dashes are not allowed */
+ virBufferTrimChars(buf, "-");
}
#undef HOSTNAME_CHARS
diff --git a/tests/virsystemdtest.c b/tests/virsystemdtest.c
index 9b95ca6789..26876850b8 100644
--- a/tests/virsystemdtest.c
+++ b/tests/virsystemdtest.c
@@ -740,6 +740,10 @@ mymain(void)
"qemu-7-123456789012345678901234567890123456789012345678901234567");
TEST_MACHINE("123456789012345678901234567890123456789012345678901234567890", 8,
"qemu-8-123456789012345678901234567890123456789012345678901234567");
+ TEST_MACHINE("kstest-network-device-default-httpks_(c9eed63e-981e-48ec-acdc-56b3f8c5f678)", 100,
+ "qemu-100-kstest-network-device-default-httpksc9eed63e-981e-48ec");
+ TEST_MACHINE("kstest-network-device-default-httpks_(c9eed63e-981e-48ec--cdc-56b3f8c5f678)", 10,
+ "qemu-10-kstest-network-device-default-httpksc9eed63e-981e-48ec");
# define TESTS_PM_SUPPORT_HELPER(name, function) \
do { \
--
2.25.1

View File

@ -1,73 +0,0 @@
From 04792aa0715be4e779fca81fa8f7e9f2c5c1b71f Mon Sep 17 00:00:00 2001
Message-Id: <04792aa0715be4e779fca81fa8f7e9f2c5c1b71f@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Tue, 4 Feb 2020 15:08:00 +0100
Subject: [PATCH] conf: domain: Remove checking of return value of
virHashCreateFull
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This module has last two direct checks whether the value returned by
virHashCreateFull is NULL. Remove them so that static analyzers don't
get the false idea that checking the value is necessary.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 2a5ea0a0c1843c7c43e673b3d2082cc3abdef602)
https://bugzilla.redhat.com/show_bug.cgi?id=1793263
Message-Id: <2e310ad44b341511caba735608bc0bba4b072d6c.1580824112.git.pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/conf/domain_addr.c | 30 ++++++++++++------------------
1 file changed, 12 insertions(+), 18 deletions(-)
diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c
index 607ba56efd..f07b3d9725 100644
--- a/src/conf/domain_addr.c
+++ b/src/conf/domain_addr.c
@@ -1044,28 +1044,22 @@ virDomainPCIAddressSetExtensionAlloc(virDomainPCIAddressSetPtr addrs,
if (VIR_ALLOC(addrs->zpciIds) < 0)
return -1;
- if (!(addrs->zpciIds->uids = virHashCreateFull(10, NULL,
- virZPCIAddrKeyCode,
- virZPCIAddrKeyEqual,
- virZPCIAddrKeyCopy,
- virZPCIAddrKeyPrintHuman,
- virZPCIAddrKeyFree)))
- goto error;
+ addrs->zpciIds->uids = virHashCreateFull(10, NULL,
+ virZPCIAddrKeyCode,
+ virZPCIAddrKeyEqual,
+ virZPCIAddrKeyCopy,
+ virZPCIAddrKeyPrintHuman,
+ virZPCIAddrKeyFree);
- if (!(addrs->zpciIds->fids = virHashCreateFull(10, NULL,
- virZPCIAddrKeyCode,
- virZPCIAddrKeyEqual,
- virZPCIAddrKeyCopy,
- virZPCIAddrKeyPrintHuman,
- virZPCIAddrKeyFree)))
- goto error;
+ addrs->zpciIds->fids = virHashCreateFull(10, NULL,
+ virZPCIAddrKeyCode,
+ virZPCIAddrKeyEqual,
+ virZPCIAddrKeyCopy,
+ virZPCIAddrKeyPrintHuman,
+ virZPCIAddrKeyFree);
}
return 0;
-
- error:
- virDomainPCIAddressSetExtensionFree(addrs);
- return -1;
}
--
2.25.0

View File

@ -1,47 +0,0 @@
From 5ec240811e391f97378d0b6b726e0dee13ae8a40 Mon Sep 17 00:00:00 2001
Message-Id: <5ec240811e391f97378d0b6b726e0dee13ae8a40@dist-git>
From: Laine Stump <laine@redhat.com>
Date: Sun, 26 Apr 2020 13:17:03 -0400
Subject: [PATCH] conf: during PCI hotplug, require that the controller support
hotplug
Before this patch we would simply rely on QEMU failing to attach the
device. Since we have a flag in the address set telling us which
controllers support hotplug, we can fail the operation sooner.
This also assures that when hotplugging with no provided PCI address,
that we skip any controllers with hotplug='off', and attempt to assign
the device to a controller that not only supports hotplug, but also
has it enabled.
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 7118bdee1550b6022e7362402ca8204add4cf80b)
https://bugzilla.redhat.com/1802592
Signed-off-by: Laine Stump <laine@redhat.com>
Message-Id: <20200426171703.18808-3-laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
---
src/conf/domain_addr.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c
index ed41eca114..34ea7bc051 100644
--- a/src/conf/domain_addr.c
+++ b/src/conf/domain_addr.c
@@ -936,6 +936,11 @@ virDomainPCIAddressEnsureAddr(virDomainPCIAddressSetPtr addrs,
if (!flags)
return 0;
+ /* This function is only called during hotplug, so we require hotplug
+ * support from the controller.
+ */
+ flags |= VIR_PCI_CONNECT_HOTPLUGGABLE;
+
if (!(addrStr = virPCIDeviceAddressAsString(&dev->addr.pci)))
goto cleanup;
--
2.26.2

View File

@ -1,415 +0,0 @@
From 6f02748897062d40b411177ef752644505189a72 Mon Sep 17 00:00:00 2001
Message-Id: <6f02748897062d40b411177ef752644505189a72@dist-git>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Fri, 21 May 2021 14:16:11 +0200
Subject: [PATCH] conf: introduce support for firmware auto-selection feature
filtering
When the firmware auto-selection was introduced it always picked first
usable firmware based on the JSON descriptions on the host. It is
possible to add/remove/change the JSON files but it will always be for
the whole host.
This patch introduces support for configuring the auto-selection per VM
by adding users an option to limit what features they would like to have
available in the firmware.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit cff524af6c5e1ddc11149394ed7f985242ebea0f)
Conflicts:
docs/formatdomain.rst
- we still have formatdomain.html.in in downstream
src/conf/domain_conf.c
- missing following upstream commits:
0280fc72708b9d0f162a808bcc8d78137a68d58d
104dadcff6023da676df3905d1ed8688aea15e86
2d5f7a49ae0780143566932ab38215433982c89f
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1929357
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Message-Id: <631e05bc5363abb3e48d8b652a806324801cce16.1621599207.git.phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
---
docs/formatdomain.html.in | 58 +++++++++++++
docs/schemas/domaincommon.rng | 23 +++++
src/conf/domain_conf.c | 83 ++++++++++++++++++-
src/conf/domain_conf.h | 10 +++
...os-firmware-invalid-type.x86_64-latest.err | 1 +
.../os-firmware-invalid-type.xml | 28 +++++++
tests/qemuxml2argvtest.c | 1 +
...aarch64-os-firmware-efi.aarch64-latest.xml | 1 +
.../os-firmware-bios.x86_64-latest.xml | 1 +
.../os-firmware-efi-secboot.x86_64-latest.xml | 1 +
.../os-firmware-efi.x86_64-latest.xml | 1 +
tests/vmx2xmldata/vmx2xml-firmware-efi.xml | 1 +
12 files changed, 206 insertions(+), 3 deletions(-)
create mode 100644 tests/qemuxml2argvdata/os-firmware-invalid-type.x86_64-latest.err
create mode 100644 tests/qemuxml2argvdata/os-firmware-invalid-type.xml
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index a40bed347b..11f31618af 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -180,6 +180,64 @@
<code>ESX</code> and <code>VMWare</code> hypervisor drivers, however,
the <code>i686</code> arch will always be chosen even on an
<code>x86_64</code> host. <span class="since">Since 0.0.1</span></dd>
+ <dt><a id="elementFirmware"><code>firmware</code></a></dt>
+ <dd>
+ <p><span class="since">Since 7.2.0 QEMU/KVM only</span></p>
+ <p>
+ When used together with <code>firmware</code> attribute of
+ <code>os</code> element the <code>type</code> attribute must
+ have the same value.
+ </p>
+ <p>
+ List of mandatory attributes:
+ <ul>
+ <li>
+ <code>type</code> (accepted values are <code>bios</code>
+ and <code>efi</code>) same as the <code>firmware</code>
+ attribute of <code>os</code> element.
+ </li>
+ </ul>
+ </p>
+ <p>
+ When using firmware auto-selection there are different features
+ enabled in the firmwares. The list of features can be used to
+ limit what firmware should be automatically selected for the VM.
+ The list of features can be specified using zero or more
+ <code>feature</code> elements. Libvirt will take into consideration
+ only the listed features and ignore the rest when selecting the firmware.
+
+ <dl>
+ <dt><code>feature</code></dt>
+ <dd>
+ The list of mandatory attributes:
+
+ <ul>
+ <li>
+ <code>enabled</code> (accepted values are <code>yes</code>
+ and <code>no</code>) is used to tell libvirt if the feature
+ must be enabled or not in the automatically selected firmware
+ </li>
+ <li>
+ <code>name</code> the name of the feature, the list of the features:
+ <ul>
+ <li>
+ <code>enrolled-keys</code> whether the selected nvram template
+ has default certificate enrolled. Firmware with Secure Boot
+ feature but without enrolled keys will successfully boot
+ non-signed binaries as well. Valid only for firmwares with
+ Secure Boot feature.
+ </li>
+ <li>
+ <code>secure-boot</code> whether the firmware implements
+ UEFI Secure boot feature.
+ </li>
+ </ul>
+ </li>
+ </ul>
+ </dd>
+ </dl>
+ </p>
+ </dd>
<dt><a id="elementLoader"><code>loader</code></a></dt>
<dd>The optional <code>loader</code> tag refers to a firmware blob,
which is specified by absolute path,
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 6671ef3dfa..b7f6a6b494 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -268,6 +268,29 @@
</attribute>
</optional>
<ref name="ostypehvm"/>
+ <optional>
+ <element name="firmware">
+ <attribute name="type">
+ <choice>
+ <value>bios</value>
+ <value>efi</value>
+ </choice>
+ </attribute>
+ <zeroOrMore>
+ <element name="feature">
+ <attribute name="enabled">
+ <ref name="virYesNo"/>
+ </attribute>
+ <attribute name="name">
+ <choice>
+ <value>enrolled-keys</value>
+ <value>secure-boot</value>
+ </choice>
+ </attribute>
+ </element>
+ </zeroOrMore>
+ </element>
+ </optional>
<optional>
<element name="loader">
<optional>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 93a78f8277..28c8d0ecbd 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -1240,6 +1240,12 @@ VIR_ENUM_IMPL(virDomainOsDefFirmware,
"efi",
);
+VIR_ENUM_IMPL(virDomainOsDefFirmwareFeature,
+ VIR_DOMAIN_OS_DEF_FIRMWARE_FEATURE_LAST,
+ "enrolled-keys",
+ "secure-boot",
+);
+
/* Internal mapping: subset of block job types that can be present in
* <mirror> XML (remaining types are not two-phase). */
VIR_ENUM_DECL(virDomainBlockJob);
@@ -19382,22 +19388,67 @@ virDomainDefParseBootFirmwareOptions(virDomainDefPtr def,
xmlXPathContextPtr ctxt)
{
g_autofree char *firmware = virXPathString("string(./os/@firmware)", ctxt);
+ g_autofree char *type = virXPathString("string(./os/firmware/@type)", ctxt);
+ g_autofree xmlNodePtr *nodes = NULL;
+ g_autofree int *features = NULL;
int fw = 0;
+ int n = 0;
+ size_t i;
- if (!firmware)
+ if (!firmware && !type)
return 0;
- fw = virDomainOsDefFirmwareTypeFromString(firmware);
+ if (firmware && type && STRNEQ(firmware, type)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("firmware attribute and firmware type has to be the same"));
+ return -1;
+ }
+
+ if (!type)
+ type = g_steal_pointer(&firmware);
+
+ fw = virDomainOsDefFirmwareTypeFromString(type);
if (fw <= 0) {
virReportError(VIR_ERR_XML_ERROR,
_("unknown firmware value %s"),
- firmware);
+ type);
return -1;
}
def->os.firmware = fw;
+ if ((n = virXPathNodeSet("./os/firmware/feature", ctxt, &nodes)) < 0)
+ return -1;
+
+ if (n > 0)
+ features = g_new0(int, VIR_DOMAIN_OS_DEF_FIRMWARE_FEATURE_LAST);
+
+ for (i = 0; i < n; i++) {
+ g_autofree char *name = virXMLPropString(nodes[i], "name");
+ g_autofree char *enabled = virXMLPropString(nodes[i], "enabled");
+ int feature = virDomainOsDefFirmwareFeatureTypeFromString(name);
+ int val = virTristateBoolTypeFromString(enabled);
+
+ if (feature < 0) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("invalid firmware feature name '%s'"),
+ name);
+ return -1;
+ }
+
+ if (val < 0) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("invalid firmware feature enabled value '%s'"),
+ enabled);
+ return -1;
+ }
+
+ features[feature] = val;
+ }
+
+ def->os.firmwareFeatures = g_steal_pointer(&features);
+
return 0;
}
@@ -28987,6 +29038,32 @@ virDomainDefFormatInternalSetRootName(virDomainDefPtr def,
virBufferAsprintf(buf, ">%s</type>\n",
virDomainOSTypeToString(def->os.type));
+ if (def->os.firmware) {
+ virBufferAsprintf(buf, "<firmware type='%s'",
+ virDomainOsDefFirmwareTypeToString(def->os.firmware));
+
+ if (def->os.firmwareFeatures) {
+ virBufferAddLit(buf, ">\n");
+
+ virBufferAdjustIndent(buf, 2);
+
+ for (i = 0; i < VIR_DOMAIN_OS_DEF_FIRMWARE_FEATURE_LAST; i++) {
+ if (def->os.firmwareFeatures[i] == VIR_TRISTATE_BOOL_ABSENT)
+ continue;
+
+ virBufferAsprintf(buf, "<feature enabled='%s' name='%s'/>\n",
+ virTristateBoolTypeToString(def->os.firmwareFeatures[i]),
+ virDomainOsDefFirmwareFeatureTypeToString(i));
+ }
+
+ virBufferAdjustIndent(buf, -2);
+
+ virBufferAddLit(buf, "</firmware>\n");
+ } else {
+ virBufferAddLit(buf, "/>\n");
+ }
+ }
+
virBufferEscapeString(buf, "<init>%s</init>\n",
def->os.init);
for (i = 0; def->os.initargv && def->os.initargv[i]; i++)
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 3aed1fb22a..1ad77ecac6 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1967,9 +1967,19 @@ G_STATIC_ASSERT((int)VIR_DOMAIN_OS_DEF_FIRMWARE_LAST == (int)VIR_DOMAIN_LOADER_T
VIR_ENUM_DECL(virDomainOsDefFirmware);
+typedef enum {
+ VIR_DOMAIN_OS_DEF_FIRMWARE_FEATURE_ENROLLED_KEYS,
+ VIR_DOMAIN_OS_DEF_FIRMWARE_FEATURE_SECURE_BOOT,
+
+ VIR_DOMAIN_OS_DEF_FIRMWARE_FEATURE_LAST
+} virDomainOsDefFirmwareFeature;
+
+VIR_ENUM_DECL(virDomainOsDefFirmwareFeature);
+
struct _virDomainOSDef {
int type;
virDomainOsDefFirmware firmware;
+ int *firmwareFeatures;
virArch arch;
char *machine;
size_t nBootDevs;
diff --git a/tests/qemuxml2argvdata/os-firmware-invalid-type.x86_64-latest.err b/tests/qemuxml2argvdata/os-firmware-invalid-type.x86_64-latest.err
new file mode 100644
index 0000000000..c8174b1c8b
--- /dev/null
+++ b/tests/qemuxml2argvdata/os-firmware-invalid-type.x86_64-latest.err
@@ -0,0 +1 @@
+unsupported configuration: firmware attribute and firmware type has to be the same
diff --git a/tests/qemuxml2argvdata/os-firmware-invalid-type.xml b/tests/qemuxml2argvdata/os-firmware-invalid-type.xml
new file mode 100644
index 0000000000..41360df0f7
--- /dev/null
+++ b/tests/qemuxml2argvdata/os-firmware-invalid-type.xml
@@ -0,0 +1,28 @@
+<domain type='kvm'>
+ <name>fedora</name>
+ <uuid>63840878-0deb-4095-97e6-fc444d9bc9fa</uuid>
+ <memory unit='KiB'>8192</memory>
+ <currentMemory unit='KiB'>8192</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os firmware='efi'>
+ <type arch='x86_64' machine='pc-q35-4.0'>hvm</type>
+ <firmware type='bios'/>
+ <loader secure='no'/>
+ <nvram>/var/lib/libvirt/qemu/nvram/fedora_VARS.fd</nvram>
+ <boot dev='hd'/>
+ <bootmenu enable='yes'/>
+ </os>
+ <features>
+ <acpi/>
+ <apic/>
+ <pae/>
+ </features>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>restart</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-system-x86_64</emulator>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index a22e3ba157..bc04bea692 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -3094,6 +3094,7 @@ mymain(void)
DO_TEST_CAPS_LATEST("os-firmware-bios");
DO_TEST_CAPS_LATEST("os-firmware-efi");
DO_TEST_CAPS_LATEST("os-firmware-efi-secboot");
+ DO_TEST_CAPS_LATEST_PARSE_ERROR("os-firmware-invalid-type");
DO_TEST_CAPS_ARCH_LATEST("aarch64-os-firmware-efi", "aarch64");
DO_TEST_CAPS_LATEST("vhost-user-vga");
diff --git a/tests/qemuxml2xmloutdata/aarch64-os-firmware-efi.aarch64-latest.xml b/tests/qemuxml2xmloutdata/aarch64-os-firmware-efi.aarch64-latest.xml
index 1e51d55305..3cac8fc5c6 100644
--- a/tests/qemuxml2xmloutdata/aarch64-os-firmware-efi.aarch64-latest.xml
+++ b/tests/qemuxml2xmloutdata/aarch64-os-firmware-efi.aarch64-latest.xml
@@ -6,6 +6,7 @@
<vcpu placement='static'>1</vcpu>
<os firmware='efi'>
<type arch='aarch64' machine='virt-4.0'>hvm</type>
+ <firmware type='efi'/>
<kernel>/aarch64.kernel</kernel>
<initrd>/aarch64.initrd</initrd>
<cmdline>earlyprintk console=ttyAMA0,115200n8 rw root=/dev/vda rootwait</cmdline>
diff --git a/tests/qemuxml2xmloutdata/os-firmware-bios.x86_64-latest.xml b/tests/qemuxml2xmloutdata/os-firmware-bios.x86_64-latest.xml
index 60d3498765..ef24f2fece 100644
--- a/tests/qemuxml2xmloutdata/os-firmware-bios.x86_64-latest.xml
+++ b/tests/qemuxml2xmloutdata/os-firmware-bios.x86_64-latest.xml
@@ -6,6 +6,7 @@
<vcpu placement='static'>1</vcpu>
<os firmware='bios'>
<type arch='x86_64' machine='pc-q35-4.0'>hvm</type>
+ <firmware type='bios'/>
<loader secure='no'/>
<nvram>/var/lib/libvirt/qemu/nvram/fedora_VARS.fd</nvram>
<boot dev='hd'/>
diff --git a/tests/qemuxml2xmloutdata/os-firmware-efi-secboot.x86_64-latest.xml b/tests/qemuxml2xmloutdata/os-firmware-efi-secboot.x86_64-latest.xml
index 938da73711..3757191e8e 100644
--- a/tests/qemuxml2xmloutdata/os-firmware-efi-secboot.x86_64-latest.xml
+++ b/tests/qemuxml2xmloutdata/os-firmware-efi-secboot.x86_64-latest.xml
@@ -6,6 +6,7 @@
<vcpu placement='static'>1</vcpu>
<os firmware='efi'>
<type arch='x86_64' machine='pc-q35-4.0'>hvm</type>
+ <firmware type='efi'/>
<loader secure='yes'/>
<nvram>/var/lib/libvirt/qemu/nvram/fedora_VARS.fd</nvram>
<boot dev='hd'/>
diff --git a/tests/qemuxml2xmloutdata/os-firmware-efi.x86_64-latest.xml b/tests/qemuxml2xmloutdata/os-firmware-efi.x86_64-latest.xml
index 97ce8a75c7..f2e6b7f36d 100644
--- a/tests/qemuxml2xmloutdata/os-firmware-efi.x86_64-latest.xml
+++ b/tests/qemuxml2xmloutdata/os-firmware-efi.x86_64-latest.xml
@@ -6,6 +6,7 @@
<vcpu placement='static'>1</vcpu>
<os firmware='efi'>
<type arch='x86_64' machine='pc-q35-4.0'>hvm</type>
+ <firmware type='efi'/>
<loader secure='no'/>
<nvram>/var/lib/libvirt/qemu/nvram/fedora_VARS.fd</nvram>
<boot dev='hd'/>
diff --git a/tests/vmx2xmldata/vmx2xml-firmware-efi.xml b/tests/vmx2xmldata/vmx2xml-firmware-efi.xml
index e21158cebf..375c47d281 100644
--- a/tests/vmx2xmldata/vmx2xml-firmware-efi.xml
+++ b/tests/vmx2xmldata/vmx2xml-firmware-efi.xml
@@ -5,6 +5,7 @@
<vcpu placement='static'>1</vcpu>
<os firmware='efi'>
<type arch='i686'>hvm</type>
+ <firmware type='efi'/>
</os>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
--
2.31.1

View File

@ -1,124 +0,0 @@
From 7ba2905bfcab4dbe4a491ee8587dd4c9ef457c0b Mon Sep 17 00:00:00 2001
Message-Id: <7ba2905bfcab4dbe4a491ee8587dd4c9ef457c0b@dist-git>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Fri, 21 May 2021 14:16:09 +0200
Subject: [PATCH] conf: introduce virDomainDefParseBootAcpiOptions
Extract the code to it's own function.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 108cb29c1c7eec7b9089dd431e0bdcd82a0b07f1)
Conflicts:
src/conf/domain_conf.c
- missing upstream commit d293a556d710754d8aa8d5caac0bb01a365fcbd8
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1929357
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Message-Id: <5fb7ee0165340ff517b3f7f16ddc542813ac385d.1621599207.git.phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
---
src/conf/domain_conf.c | 71 ++++++++++++++++++++++++------------------
1 file changed, 41 insertions(+), 30 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 493700ed6b..f8d8d33245 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -19429,13 +19429,51 @@ virDomainDefParseBootLoaderOptions(virDomainDefPtr def,
static int
-virDomainDefParseBootOptions(virDomainDefPtr def,
- xmlXPathContextPtr ctxt)
+virDomainDefParseBootAcpiOptions(virDomainDefPtr def,
+ xmlXPathContextPtr ctxt)
{
int n;
g_autofree xmlNodePtr *nodes = NULL;
g_autofree char *tmp = NULL;
+ if ((n = virXPathNodeSet("./os/acpi/table", ctxt, &nodes)) < 0)
+ return -1;
+
+ if (n > 1) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("Only one acpi table is supported"));
+ return -1;
+ }
+
+ if (n == 1) {
+ tmp = virXMLPropString(nodes[0], "type");
+
+ if (!tmp) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("Missing acpi table type"));
+ return -1;
+ }
+
+ if (STREQ_NULLABLE(tmp, "slic")) {
+ VIR_FREE(tmp);
+ tmp = virXMLNodeContentString(nodes[0]);
+ def->os.slic_table = virFileSanitizePath(tmp);
+ } else {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("Unknown acpi table type: %s"),
+ tmp);
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
+
+static int
+virDomainDefParseBootOptions(virDomainDefPtr def,
+ xmlXPathContextPtr ctxt)
+{
/*
* Booting options for different OS types....
*
@@ -19467,36 +19505,9 @@ virDomainDefParseBootOptions(virDomainDefPtr def,
}
if (def->os.type == VIR_DOMAIN_OSTYPE_HVM) {
- if ((n = virXPathNodeSet("./os/acpi/table", ctxt, &nodes)) < 0)
+ if (virDomainDefParseBootAcpiOptions(def, ctxt) < 0)
return -1;
- if (n > 1) {
- virReportError(VIR_ERR_XML_ERROR, "%s",
- _("Only one acpi table is supported"));
- return -1;
- }
-
- if (n == 1) {
- tmp = virXMLPropString(nodes[0], "type");
-
- if (!tmp) {
- virReportError(VIR_ERR_XML_ERROR, "%s",
- _("Missing acpi table type"));
- return -1;
- }
-
- if (STREQ_NULLABLE(tmp, "slic")) {
- VIR_FREE(tmp);
- tmp = virXMLNodeContentString(nodes[0]);
- def->os.slic_table = virFileSanitizePath(tmp);
- } else {
- virReportError(VIR_ERR_XML_ERROR,
- _("Unknown acpi table type: %s"),
- tmp);
- return -1;
- }
- }
-
if (virDomainDefParseBootXML(ctxt, def) < 0)
return -1;
}
--
2.31.1

View File

@ -1,86 +0,0 @@
From 2a019bfa26e697c60893afd09fcc2f0c3218691b Mon Sep 17 00:00:00 2001
Message-Id: <2a019bfa26e697c60893afd09fcc2f0c3218691b@dist-git>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Fri, 21 May 2021 14:16:07 +0200
Subject: [PATCH] conf: introduce virDomainDefParseBootFirmwareOptions
Extract the code to it's own function.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit bcf97abfc6b45694f0d789ae2bdf87c8d082fddf)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1929357
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Message-Id: <9a090d9f2a43b261ed1b6db608779a01a7594f4a.1621599207.git.phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
---
src/conf/domain_conf.c | 39 +++++++++++++++++++++++++++------------
1 file changed, 27 insertions(+), 12 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 432ad938f9..bb484a57c6 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -19377,6 +19377,31 @@ virDomainDefParseBootKernelOptions(virDomainDefPtr def,
}
+static int
+virDomainDefParseBootFirmwareOptions(virDomainDefPtr def,
+ xmlXPathContextPtr ctxt)
+{
+ g_autofree char *firmware = virXPathString("string(./os/@firmware)", ctxt);
+ int fw = 0;
+
+ if (!firmware)
+ return 0;
+
+ fw = virDomainOsDefFirmwareTypeFromString(firmware);
+
+ if (fw <= 0) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("unknown firmware value %s"),
+ firmware);
+ return -1;
+ }
+
+ def->os.firmware = fw;
+
+ return 0;
+}
+
+
static int
virDomainDefParseBootOptions(virDomainDefPtr def,
xmlXPathContextPtr ctxt)
@@ -19403,23 +19428,13 @@ virDomainDefParseBootOptions(virDomainDefPtr def,
def->os.type == VIR_DOMAIN_OSTYPE_XENPVH ||
def->os.type == VIR_DOMAIN_OSTYPE_HVM ||
def->os.type == VIR_DOMAIN_OSTYPE_UML) {
- g_autofree char *firmware = NULL;
xmlNodePtr loader_node;
virDomainDefParseBootKernelOptions(def, ctxt);
- if (def->os.type == VIR_DOMAIN_OSTYPE_HVM &&
- (firmware = virXPathString("string(./os/@firmware)", ctxt))) {
- int fw = virDomainOsDefFirmwareTypeFromString(firmware);
-
- if (fw <= 0) {
- virReportError(VIR_ERR_XML_ERROR,
- _("unknown firmware value %s"),
- firmware);
+ if (def->os.type == VIR_DOMAIN_OSTYPE_HVM) {
+ if (virDomainDefParseBootFirmwareOptions(def, ctxt) < 0)
return -1;
- }
-
- def->os.firmware = fw;
}
if ((loader_node = virXPathNode("./os/loader[1]", ctxt))) {
--
2.31.1

View File

@ -1,173 +0,0 @@
From adafaa880b67f1025c64515352e5e851daa62ae9 Mon Sep 17 00:00:00 2001
Message-Id: <adafaa880b67f1025c64515352e5e851daa62ae9@dist-git>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Fri, 21 May 2021 14:16:05 +0200
Subject: [PATCH] conf: introduce virDomainDefParseBootInitOptions
Extract the code to it's own function.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit b07116438c96fddfa00bdb57878a707240574b42)
Conflicts:
src/conf/domain_conf.c
- using VIR_ALLOC in downstream instead of g_new0
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1929357
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Message-Id: <cb7f11437bdbc14b0791645c39c963118d0f9806.1621599207.git.phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
---
src/conf/domain_conf.c | 115 +++++++++++++++++++++++------------------
1 file changed, 64 insertions(+), 51 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 444657c9a1..9eb418c7c0 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -19302,76 +19302,89 @@ virDomainVcpuParse(virDomainDefPtr def,
static int
-virDomainDefParseBootOptions(virDomainDefPtr def,
- xmlXPathContextPtr ctxt)
+virDomainDefParseBootInitOptions(virDomainDefPtr def,
+ xmlXPathContextPtr ctxt)
{
char *name = NULL;
size_t i;
int n;
g_autofree xmlNodePtr *nodes = NULL;
- g_autofree char *tmp = NULL;
- /*
- * Booting options for different OS types....
- *
- * - A bootloader (and optional kernel+initrd) (xen)
- * - A kernel + initrd (xen)
- * - A boot device (and optional kernel+initrd) (hvm)
- * - An init script (exe)
- */
+ def->os.init = virXPathString("string(./os/init[1])", ctxt);
+ def->os.cmdline = virXPathString("string(./os/cmdline[1])", ctxt);
+ def->os.initdir = virXPathString("string(./os/initdir[1])", ctxt);
+ def->os.inituser = virXPathString("string(./os/inituser[1])", ctxt);
+ def->os.initgroup = virXPathString("string(./os/initgroup[1])", ctxt);
- if (def->os.type == VIR_DOMAIN_OSTYPE_EXE) {
- def->os.init = virXPathString("string(./os/init[1])", ctxt);
- def->os.cmdline = virXPathString("string(./os/cmdline[1])", ctxt);
- def->os.initdir = virXPathString("string(./os/initdir[1])", ctxt);
- def->os.inituser = virXPathString("string(./os/inituser[1])", ctxt);
- def->os.initgroup = virXPathString("string(./os/initgroup[1])", ctxt);
+ if ((n = virXPathNodeSet("./os/initarg", ctxt, &nodes)) < 0)
+ return -1;
- if ((n = virXPathNodeSet("./os/initarg", ctxt, &nodes)) < 0)
+ if (VIR_ALLOC_N(def->os.initargv, n+1) < 0)
+ return -1;
+ for (i = 0; i < n; i++) {
+ if (!nodes[i]->children ||
+ !nodes[i]->children->content) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("No data supplied for <initarg> element"));
return -1;
+ }
+ def->os.initargv[i] = g_strdup((const char *)nodes[i]->children->content);
+ }
+ def->os.initargv[n] = NULL;
+ VIR_FREE(nodes);
- if (VIR_ALLOC_N(def->os.initargv, n+1) < 0)
+ if ((n = virXPathNodeSet("./os/initenv", ctxt, &nodes)) < 0)
+ return -1;
+
+ if (VIR_ALLOC_N(def->os.initenv, n+1) < 0)
+ return -1;
+ for (i = 0; i < n; i++) {
+ if (!(name = virXMLPropString(nodes[i], "name"))) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("No name supplied for <initenv> element"));
return -1;
- for (i = 0; i < n; i++) {
- if (!nodes[i]->children ||
- !nodes[i]->children->content) {
- virReportError(VIR_ERR_XML_ERROR, "%s",
- _("No data supplied for <initarg> element"));
- return -1;
- }
- def->os.initargv[i] = g_strdup((const char *)nodes[i]->children->content);
}
- def->os.initargv[n] = NULL;
- VIR_FREE(nodes);
- if ((n = virXPathNodeSet("./os/initenv", ctxt, &nodes)) < 0)
+ if (!nodes[i]->children ||
+ !nodes[i]->children->content) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("No value supplied for <initenv name='%s'> element"),
+ name);
return -1;
+ }
- if (VIR_ALLOC_N(def->os.initenv, n+1) < 0)
+ if (VIR_ALLOC(def->os.initenv[i]) < 0)
return -1;
- for (i = 0; i < n; i++) {
- if (!(name = virXMLPropString(nodes[i], "name"))) {
- virReportError(VIR_ERR_XML_ERROR, "%s",
- _("No name supplied for <initenv> element"));
- return -1;
- }
- if (!nodes[i]->children ||
- !nodes[i]->children->content) {
- virReportError(VIR_ERR_XML_ERROR,
- _("No value supplied for <initenv name='%s'> element"),
- name);
- return -1;
- }
+ def->os.initenv[i]->name = name;
+ def->os.initenv[i]->value = g_strdup((const char *)nodes[i]->children->content);
+ }
+ def->os.initenv[n] = NULL;
- if (VIR_ALLOC(def->os.initenv[i]) < 0)
- return -1;
+ return 0;
+}
- def->os.initenv[i]->name = name;
- def->os.initenv[i]->value = g_strdup((const char *)nodes[i]->children->content);
- }
- def->os.initenv[n] = NULL;
- VIR_FREE(nodes);
+
+static int
+virDomainDefParseBootOptions(virDomainDefPtr def,
+ xmlXPathContextPtr ctxt)
+{
+ int n;
+ g_autofree xmlNodePtr *nodes = NULL;
+ g_autofree char *tmp = NULL;
+
+ /*
+ * Booting options for different OS types....
+ *
+ * - A bootloader (and optional kernel+initrd) (xen)
+ * - A kernel + initrd (xen)
+ * - A boot device (and optional kernel+initrd) (hvm)
+ * - An init script (exe)
+ */
+
+ if (def->os.type == VIR_DOMAIN_OSTYPE_EXE) {
+ if (virDomainDefParseBootInitOptions(def, ctxt) < 0)
+ return -1;
}
if (def->os.type == VIR_DOMAIN_OSTYPE_XEN ||
--
2.31.1

View File

@ -1,60 +0,0 @@
From a62075772680bd30ced25d7177048ab26db8ea09 Mon Sep 17 00:00:00 2001
Message-Id: <a62075772680bd30ced25d7177048ab26db8ea09@dist-git>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Fri, 21 May 2021 14:16:06 +0200
Subject: [PATCH] conf: introduce virDomainDefParseBootKernelOptions
Extract the code to it's own function.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit bf9b3f8e573092cc98ea647f25cf116e22bbfe3c)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1929357
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Message-Id: <936428a5fa6d4104361ac8080639a55111c14965.1621599207.git.phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
---
src/conf/domain_conf.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 9eb418c7c0..432ad938f9 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -19365,6 +19365,18 @@ virDomainDefParseBootInitOptions(virDomainDefPtr def,
}
+static void
+virDomainDefParseBootKernelOptions(virDomainDefPtr def,
+ xmlXPathContextPtr ctxt)
+{
+ def->os.kernel = virXPathString("string(./os/kernel[1])", ctxt);
+ def->os.initrd = virXPathString("string(./os/initrd[1])", ctxt);
+ def->os.cmdline = virXPathString("string(./os/cmdline[1])", ctxt);
+ def->os.dtb = virXPathString("string(./os/dtb[1])", ctxt);
+ def->os.root = virXPathString("string(./os/root[1])", ctxt);
+}
+
+
static int
virDomainDefParseBootOptions(virDomainDefPtr def,
xmlXPathContextPtr ctxt)
@@ -19394,11 +19406,7 @@ virDomainDefParseBootOptions(virDomainDefPtr def,
g_autofree char *firmware = NULL;
xmlNodePtr loader_node;
- def->os.kernel = virXPathString("string(./os/kernel[1])", ctxt);
- def->os.initrd = virXPathString("string(./os/initrd[1])", ctxt);
- def->os.cmdline = virXPathString("string(./os/cmdline[1])", ctxt);
- def->os.dtb = virXPathString("string(./os/dtb[1])", ctxt);
- def->os.root = virXPathString("string(./os/root[1])", ctxt);
+ virDomainDefParseBootKernelOptions(def, ctxt);
if (def->os.type == VIR_DOMAIN_OSTYPE_HVM &&
(firmware = virXPathString("string(./os/@firmware)", ctxt))) {
--
2.31.1

View File

@ -1,97 +0,0 @@
From 6891ef941e693d86ebbab9e529e908dacf4a7dc6 Mon Sep 17 00:00:00 2001
Message-Id: <6891ef941e693d86ebbab9e529e908dacf4a7dc6@dist-git>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Fri, 21 May 2021 14:16:08 +0200
Subject: [PATCH] conf: introduce virDomainDefParseBootLoaderOptions
Extract the code to it's own function.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit b8dd70db4ee2f3a5edcbbeb8515830db9652cb59)
Conflicts:
src/conf/domain_conf.c
- using VIR_ALLOC in downstream instead of g_new0
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1929357
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Message-Id: <e9d0f563b055b415deb7718d33f7661a797a48f1.1621599207.git.phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
---
src/conf/domain_conf.c | 44 +++++++++++++++++++++++++++---------------
1 file changed, 28 insertions(+), 16 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index bb484a57c6..493700ed6b 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -19402,6 +19402,32 @@ virDomainDefParseBootFirmwareOptions(virDomainDefPtr def,
}
+static int
+virDomainDefParseBootLoaderOptions(virDomainDefPtr def,
+ xmlXPathContextPtr ctxt)
+{
+ xmlNodePtr loader_node = virXPathNode("./os/loader[1]", ctxt);
+ const bool fwAutoSelect = def->os.firmware != VIR_DOMAIN_OS_DEF_FIRMWARE_NONE;
+
+ if (!loader_node)
+ return 0;
+
+ if (VIR_ALLOC(def->os.loader) < 0)
+ return -1;
+
+ if (virDomainLoaderDefParseXML(loader_node,
+ def->os.loader,
+ fwAutoSelect) < 0)
+ return -1;
+
+ def->os.loader->nvram = virXPathString("string(./os/nvram[1])", ctxt);
+ if (!fwAutoSelect)
+ def->os.loader->templt = virXPathString("string(./os/nvram[1]/@template)", ctxt);
+
+ return 0;
+}
+
+
static int
virDomainDefParseBootOptions(virDomainDefPtr def,
xmlXPathContextPtr ctxt)
@@ -19428,7 +19454,6 @@ virDomainDefParseBootOptions(virDomainDefPtr def,
def->os.type == VIR_DOMAIN_OSTYPE_XENPVH ||
def->os.type == VIR_DOMAIN_OSTYPE_HVM ||
def->os.type == VIR_DOMAIN_OSTYPE_UML) {
- xmlNodePtr loader_node;
virDomainDefParseBootKernelOptions(def, ctxt);
@@ -19437,21 +19462,8 @@ virDomainDefParseBootOptions(virDomainDefPtr def,
return -1;
}
- if ((loader_node = virXPathNode("./os/loader[1]", ctxt))) {
- const bool fwAutoSelect = def->os.firmware != VIR_DOMAIN_OS_DEF_FIRMWARE_NONE;
-
- if (VIR_ALLOC(def->os.loader) < 0)
- return -1;
-
- if (virDomainLoaderDefParseXML(loader_node,
- def->os.loader,
- fwAutoSelect) < 0)
- return -1;
-
- def->os.loader->nvram = virXPathString("string(./os/nvram[1])", ctxt);
- if (!fwAutoSelect)
- def->os.loader->templt = virXPathString("string(./os/nvram[1]/@template)", ctxt);
- }
+ if (virDomainDefParseBootLoaderOptions(def, ctxt) < 0)
+ return -1;
}
if (def->os.type == VIR_DOMAIN_OSTYPE_HVM) {
--
2.31.1

View File

@ -1,290 +0,0 @@
From 12892e0376be4dc07dc317b807f2ec86c27a94b2 Mon Sep 17 00:00:00 2001
Message-Id: <12892e0376be4dc07dc317b807f2ec86c27a94b2@dist-git>
From: Laine Stump <laine@redhat.com>
Date: Sun, 26 Apr 2020 13:04:07 -0400
Subject: [PATCH] conf: new attribute "hotplug" for pci controllers
a <controller type='pci'...> element can now have a "hotplug"
attribute in the <target> subelement. This is intended to control
whether or not the slot(s) of the controller support
hotplugging/unplugging a device:
<controller type='pci' model='pcie-root-port'>
<target hotplug='off'/>
</controller>
The default value of hotplug is "on".
Since support for configuring such an option is hypervisor-dependent
(and will vary among different types of PCI controllers even on a
single hypervisor), no validation is done in this patch - that
validation will be done in the patch that wires support for the
setting into the hypervisor.
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 78f4d5e6f188a9f0f8d6da6b1fe78b9f4172d9ad)
https://bugzilla.redhat.com/1802592
Signed-off-by: Laine Stump <laine@redhat.com>
Conflicts/Changes from upstread:
tests/qemuxml2xmloutdata/pcie-root-port-nohotplug.x86_64-latest.xml:
had to be modified to remove reference to the qemu64 CPU type.
Signed-off-by: Laine Stump <laine@redhat.com>
Message-Id: <20200426170415.18328-5-laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
---
docs/formatdomain.html.in | 11 +++
docs/schemas/domaincommon.rng | 5 ++
src/conf/domain_conf.c | 20 +++++-
src/conf/domain_conf.h | 1 +
.../pcie-root-port-nohotplug.xml | 35 ++++++++++
...pcie-root-port-nohotplug.x86_64-latest.xml | 67 +++++++++++++++++++
tests/qemuxml2xmltest.c | 2 +-
7 files changed, 139 insertions(+), 2 deletions(-)
create mode 100644 tests/qemuxml2argvdata/pcie-root-port-nohotplug.xml
create mode 100644 tests/qemuxml2xmloutdata/pcie-root-port-nohotplug.x86_64-latest.xml
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 9c588185df..76799f5ffc 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -4651,6 +4651,17 @@
which is visible to the virtual machine. If set, port must be
between 0 and 255.
</dd>
+ <dt><code>hotplug</code></dt>
+ <dd>
+ pcie-root-port and pcie-switch-downstream-port controllers can
+ also have a <code>hotplug</code> attribute in
+ the <code>&lt;target&gt;</code> subelement, which is used to
+ disable hotplug/unplug of devices on a particular
+ controller. The default setting of <code>hotplug</code>
+ is <code>on</code>; it should be set to <code>off</code> to
+ disable hotplug/unplug of devices on a particular controller.
+ <span class="since">Since 6.3.0</span>
+ </dd>
<dt><code>busNr</code></dt>
<dd>
pci-expander-bus and pcie-expander-bus controllers can have an
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index dd8f27243a..9fda5f17e0 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -2475,6 +2475,11 @@
<ref name='uint8'/>
</attribute>
</optional>
+ <optional>
+ <attribute name='hotplug'>
+ <ref name="virOnOff"/>
+ </attribute>
+ </optional>
<optional>
<element name='node'>
<ref name='unsignedInt'/>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 28160a2967..ed9ca0e9d8 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -10933,6 +10933,7 @@ virDomainControllerDefParseXML(virDomainXMLOptionPtr xmlopt,
g_autofree char *port = NULL;
g_autofree char *busNr = NULL;
g_autofree char *targetIndex = NULL;
+ g_autofree char *hotplug = NULL;
g_autofree char *ioeventfd = NULL;
g_autofree char *portsStr = NULL;
g_autofree char *iothread = NULL;
@@ -11004,6 +11005,7 @@ virDomainControllerDefParseXML(virDomainXMLOptionPtr xmlopt,
chassis = virXMLPropString(cur, "chassis");
port = virXMLPropString(cur, "port");
busNr = virXMLPropString(cur, "busNr");
+ hotplug = virXMLPropString(cur, "hotplug");
targetIndex = virXMLPropString(cur, "index");
processedTarget = true;
}
@@ -11240,6 +11242,17 @@ virDomainControllerDefParseXML(virDomainXMLOptionPtr xmlopt,
}
def->opts.pciopts.numaNode = numaNode;
}
+ if (hotplug) {
+ int val = virTristateSwitchTypeFromString(hotplug);
+
+ if (val <= 0) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("PCI controller unrecognized hotplug setting '%s'"),
+ hotplug);
+ goto error;
+ }
+ def->opts.pciopts.hotplug = val;
+ }
break;
case VIR_DOMAIN_CONTROLLER_TYPE_XENBUS: {
g_autofree char *gntframes = virXMLPropString(node, "maxGrantFrames");
@@ -25112,7 +25125,8 @@ virDomainControllerDefFormat(virBufferPtr buf,
def->opts.pciopts.port != -1 ||
def->opts.pciopts.busNr != -1 ||
def->opts.pciopts.targetIndex != -1 ||
- def->opts.pciopts.numaNode != -1) {
+ def->opts.pciopts.numaNode != -1 ||
+ def->opts.pciopts.hotplug != VIR_TRISTATE_SWITCH_ABSENT) {
virBufferAddLit(&childBuf, "<target");
if (def->opts.pciopts.chassisNr != -1)
virBufferAsprintf(&childBuf, " chassisNr='%d'",
@@ -25129,6 +25143,10 @@ virDomainControllerDefFormat(virBufferPtr buf,
if (def->opts.pciopts.targetIndex != -1)
virBufferAsprintf(&childBuf, " index='%d'",
def->opts.pciopts.targetIndex);
+ if (def->opts.pciopts.hotplug != VIR_TRISTATE_SWITCH_ABSENT) {
+ virBufferAsprintf(&childBuf, " hotplug='%s'",
+ virTristateSwitchTypeToString(def->opts.pciopts.hotplug));
+ }
if (def->opts.pciopts.numaNode == -1) {
virBufferAddLit(&childBuf, "/>\n");
} else {
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 2a382ede72..118077edaa 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -719,6 +719,7 @@ struct _virDomainPCIControllerOpts {
* item in memory target config) -1 == unspecified
*/
int numaNode;
+ virTristateSwitch hotplug; /* 'off' to prevent hotplug/unplug, default 'on' */
};
struct _virDomainUSBControllerOpts {
diff --git a/tests/qemuxml2argvdata/pcie-root-port-nohotplug.xml b/tests/qemuxml2argvdata/pcie-root-port-nohotplug.xml
new file mode 100644
index 0000000000..8a01494470
--- /dev/null
+++ b/tests/qemuxml2argvdata/pcie-root-port-nohotplug.xml
@@ -0,0 +1,35 @@
+<domain type='qemu'>
+ <name>guest</name>
+ <uuid>11dbdcdd-4c3b-482b-8903-9bdb8c0a2774</uuid>
+ <memory unit='KiB'>2097152</memory>
+ <currentMemory unit='KiB'>2097152</currentMemory>
+ <vcpu placement='static'>2</vcpu>
+ <os>
+ <type arch='x86_64' machine='q35'>hvm</type>
+ </os>
+ <devices>
+ <emulator>/usr/bin/qemu-system-x86_64</emulator>
+ <controller type='pci' index='0' model='pcie-root'/>
+ <controller type='pci' index='1' model='pcie-root-port'/>
+ <controller type='pci' index='2' model='pcie-root-port'>
+ <target hotplug='off'/>
+ </controller>
+ <controller type='pci' index='3' model='pcie-root-port'>
+ <model name='ioh3420'/>
+ <target hotplug='off'/>
+ </controller>
+ <controller type='pci' index='4' model='pcie-switch-upstream-port'/>
+ <controller type='pci' index='5' model='pcie-switch-downstream-port'>
+ <target hotplug='off'/>
+ </controller>
+ <controller type='pci' index='6' model='pcie-switch-downstream-port'>
+ <target hotplug='on'/>
+ </controller>
+ <controller type='pci' index='7' model='pcie-switch-downstream-port'/>
+ <controller type='pci' index='8' model='pcie-switch-downstream-port'>
+ <model name='xio3130-downstream'/>
+ <target chassis='30' port='0x27'/>
+ </controller>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/pcie-root-port-nohotplug.x86_64-latest.xml b/tests/qemuxml2xmloutdata/pcie-root-port-nohotplug.x86_64-latest.xml
new file mode 100644
index 0000000000..f7dbaccae9
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/pcie-root-port-nohotplug.x86_64-latest.xml
@@ -0,0 +1,67 @@
+<domain type='qemu'>
+ <name>guest</name>
+ <uuid>11dbdcdd-4c3b-482b-8903-9bdb8c0a2774</uuid>
+ <memory unit='KiB'>2097152</memory>
+ <currentMemory unit='KiB'>2097152</currentMemory>
+ <vcpu placement='static'>2</vcpu>
+ <os>
+ <type arch='x86_64' machine='q35'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-system-x86_64</emulator>
+ <controller type='pci' index='0' model='pcie-root'/>
+ <controller type='pci' index='1' model='pcie-root-port'>
+ <model name='pcie-root-port'/>
+ <target chassis='1' port='0x8'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0' multifunction='on'/>
+ </controller>
+ <controller type='pci' index='2' model='pcie-root-port'>
+ <model name='pcie-root-port'/>
+ <target chassis='2' port='0x9' hotplug='off'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+ </controller>
+ <controller type='pci' index='3' model='pcie-root-port'>
+ <model name='ioh3420'/>
+ <target chassis='3' port='0xa' hotplug='off'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+ </controller>
+ <controller type='pci' index='4' model='pcie-switch-upstream-port'>
+ <model name='x3130-upstream'/>
+ <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
+ </controller>
+ <controller type='pci' index='5' model='pcie-switch-downstream-port'>
+ <model name='xio3130-downstream'/>
+ <target chassis='5' port='0x0' hotplug='off'/>
+ <address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
+ </controller>
+ <controller type='pci' index='6' model='pcie-switch-downstream-port'>
+ <model name='xio3130-downstream'/>
+ <target chassis='6' port='0x1' hotplug='on'/>
+ <address type='pci' domain='0x0000' bus='0x04' slot='0x01' function='0x0'/>
+ </controller>
+ <controller type='pci' index='7' model='pcie-switch-downstream-port'>
+ <model name='xio3130-downstream'/>
+ <target chassis='7' port='0x2'/>
+ <address type='pci' domain='0x0000' bus='0x04' slot='0x02' function='0x0'/>
+ </controller>
+ <controller type='pci' index='8' model='pcie-switch-downstream-port'>
+ <model name='xio3130-downstream'/>
+ <target chassis='30' port='0x27'/>
+ <address type='pci' domain='0x0000' bus='0x04' slot='0x03' function='0x0'/>
+ </controller>
+ <controller type='usb' index='0' model='qemu-xhci'>
+ <address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
+ </controller>
+ <controller type='sata' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
+ </controller>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 15110dd104..c8218e423e 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -953,7 +953,7 @@ mymain(void)
QEMU_CAPS_DEVICE_IOH3420);
DO_TEST("pcie-root-port-model-ioh3420",
QEMU_CAPS_DEVICE_IOH3420);
-
+ DO_TEST_CAPS_LATEST("pcie-root-port-nohotplug");
DO_TEST("pcie-switch-upstream-port",
QEMU_CAPS_DEVICE_IOH3420,
QEMU_CAPS_DEVICE_X3130_UPSTREAM,
--
2.26.2

View File

@ -1,468 +0,0 @@
From 653245c4de76aba4e75131da8d40eed5b15ffd0d Mon Sep 17 00:00:00 2001
Message-Id: <653245c4de76aba4e75131da8d40eed5b15ffd0d@dist-git>
From: Laine Stump <laine@redhat.com>
Date: Thu, 30 Jan 2020 14:12:40 -0500
Subject: [PATCH] conf: parse/format <teaming> subelement of <interface>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The subelement <teaming> of <interface> devices is used to configure a
simple teaming association between two interfaces in a domain. Example:
<interface type='bridge'>
<source bridge='br0'/>
<model type='virtio'/>
<mac address='00:11:22:33:44:55'/>
<alias name='ua-backup0'/>
<teaming type='persistent'/>
</interface>
<interface type='hostdev'>
<source>
<address type='pci' bus='0x02' slot='0x10' function='0x4'/>
</source>
<mac address='00:11:22:33:44:55'/>
<teaming type='transient' persistent='ua-backup0'/>
</interface>
The interface with <teaming type='persistent'/> is assumed to always
be present, while the interface with type='transient' may be be
unplugged and later re-plugged; the persistent='blah' attribute (and
in the one currently available implementation, also the matching MAC
addresses) is what associates the two devices with each other. It is
up to the hypervisor and the guest network drivers to determine what
to do with this information.
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
(cherry picked from commit fb0509d06ac57434c2edbd81ee63deb32a0e598a)
https://bugzilla.redhat.com/1693587
Signed-off-by: Laine Stump <laine@redhat.com>
Message-Id: <20200130191244.24174-3-laine@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
---
docs/schemas/domaincommon.rng | 19 ++++++
src/conf/domain_conf.c | 47 +++++++++++++
src/conf/domain_conf.h | 14 ++++
.../net-virtio-teaming-network.xml | 37 +++++++++++
tests/qemuxml2argvdata/net-virtio-teaming.xml | 50 ++++++++++++++
.../net-virtio-teaming-network.xml | 51 ++++++++++++++
.../qemuxml2xmloutdata/net-virtio-teaming.xml | 66 +++++++++++++++++++
tests/qemuxml2xmltest.c | 6 ++
8 files changed, 290 insertions(+)
create mode 100644 tests/qemuxml2argvdata/net-virtio-teaming-network.xml
create mode 100644 tests/qemuxml2argvdata/net-virtio-teaming.xml
create mode 100644 tests/qemuxml2xmloutdata/net-virtio-teaming-network.xml
create mode 100644 tests/qemuxml2xmloutdata/net-virtio-teaming.xml
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 76d94b156f..026e753567 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -3158,6 +3158,25 @@
<optional>
<ref name="vlan"/>
</optional>
+ <optional>
+ <element name="teaming">
+ <choice>
+ <group>
+ <attribute name="type">
+ <value>persistent</value>
+ </attribute>
+ </group>
+ <group>
+ <attribute name="type">
+ <value>transient</value>
+ </attribute>
+ <attribute name="persistent">
+ <ref name="aliasName"/>
+ </attribute>
+ </group>
+ </choice>
+ </element>
+ </optional>
</interleave>
</define>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 0478914c69..58f72b3b0f 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -554,6 +554,13 @@ VIR_ENUM_IMPL(virDomainNetVirtioTxMode,
"timer",
);
+VIR_ENUM_IMPL(virDomainNetTeaming,
+ VIR_DOMAIN_NET_TEAMING_TYPE_LAST,
+ "none",
+ "persistent",
+ "transient",
+);
+
VIR_ENUM_IMPL(virDomainNetInterfaceLinkState,
VIR_DOMAIN_NET_INTERFACE_LINK_STATE_LAST,
"default",
@@ -6276,6 +6283,21 @@ virDomainNetDefValidate(const virDomainNetDef *net)
virDomainNetTypeToString(net->type));
return -1;
}
+
+ if (net->teaming.type == VIR_DOMAIN_NET_TEAMING_TYPE_TRANSIENT) {
+ if (!net->teaming.persistent) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("teaming persistent attribute must be set if teaming type is 'transient'"));
+ return -1;
+ }
+ } else {
+ if (net->teaming.persistent) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("teaming persistent attribute not allowed if teaming type is '%s'"),
+ virDomainNetTeamingTypeToString(net->teaming.type));
+ return -1;
+ }
+ }
return 0;
}
@@ -11574,6 +11596,8 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
g_autofree char *vhostuser_type = NULL;
g_autofree char *trustGuestRxFilters = NULL;
g_autofree char *vhost_path = NULL;
+ g_autofree char *teamingType = NULL;
+ g_autofree char *teamingPersistent = NULL;
const char *prefix = xmlopt ? xmlopt->config.netPrefix : NULL;
if (!(def = virDomainNetDefNew(xmlopt)))
@@ -11775,6 +11799,10 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
if (!vhost_path && (tmp = virXMLPropString(cur, "vhost")))
vhost_path = virFileSanitizePath(tmp);
VIR_FREE(tmp);
+ } else if (virXMLNodeNameEqual(cur, "teaming") &&
+ !teamingType && !teamingPersistent) {
+ teamingType = virXMLPropString(cur, "type");
+ teamingPersistent = virXMLPropString(cur, "persistent");
}
}
cur = cur->next;
@@ -12296,6 +12324,19 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
}
}
+ if (teamingType) {
+ int tmpTeaming;
+
+ if ((tmpTeaming = virDomainNetTeamingTypeFromString(teamingType)) <= 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unknown teaming type '%s'"),
+ teamingType);
+ goto error;
+ }
+ def->teaming.type = tmpTeaming;
+ }
+ def->teaming.persistent = g_steal_pointer(&teamingPersistent);
+
rv = virXPathULong("string(./tune/sndbuf)", ctxt, &def->tune.sndbuf);
if (rv >= 0) {
def->tune.sndbuf_specified = true;
@@ -25741,6 +25782,12 @@ virDomainNetDefFormat(virBufferPtr buf,
virBufferAddLit(buf, "</tune>\n");
}
+ if (def->teaming.type != VIR_DOMAIN_NET_TEAMING_TYPE_NONE) {
+ virBufferAsprintf(buf, "<teaming type='%s'",
+ virDomainNetTeamingTypeToString(def->teaming.type));
+ virBufferEscapeString(buf, " persistent='%s'", def->teaming.persistent);
+ virBufferAddLit(buf, "/>\n");
+ }
if (def->linkstate) {
virBufferAsprintf(buf, "<link state='%s'/>\n",
virDomainNetInterfaceLinkStateTypeToString(def->linkstate));
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 6ae89fa498..ee8eb3ddc0 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -884,6 +884,15 @@ typedef enum {
VIR_DOMAIN_NET_VIRTIO_TX_MODE_LAST
} virDomainNetVirtioTxModeType;
+/* the type of teaming device */
+typedef enum {
+ VIR_DOMAIN_NET_TEAMING_TYPE_NONE,
+ VIR_DOMAIN_NET_TEAMING_TYPE_PERSISTENT,
+ VIR_DOMAIN_NET_TEAMING_TYPE_TRANSIENT,
+
+ VIR_DOMAIN_NET_TEAMING_TYPE_LAST
+} virDomainNetTeamingType;
+
/* link interface states */
typedef enum {
VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DEFAULT = 0, /* Default link state (up) */
@@ -958,6 +967,10 @@ struct _virDomainNetDef {
char *tap;
char *vhost;
} backend;
+ struct {
+ virDomainNetTeamingType type;
+ char *persistent; /* alias name of persistent device */
+ } teaming;
union {
virDomainChrSourceDefPtr vhostuser;
struct {
@@ -3425,6 +3438,7 @@ VIR_ENUM_DECL(virDomainFSModel);
VIR_ENUM_DECL(virDomainNet);
VIR_ENUM_DECL(virDomainNetBackend);
VIR_ENUM_DECL(virDomainNetVirtioTxMode);
+VIR_ENUM_DECL(virDomainNetTeaming);
VIR_ENUM_DECL(virDomainNetInterfaceLinkState);
VIR_ENUM_DECL(virDomainNetModel);
VIR_ENUM_DECL(virDomainChrDevice);
diff --git a/tests/qemuxml2argvdata/net-virtio-teaming-network.xml b/tests/qemuxml2argvdata/net-virtio-teaming-network.xml
new file mode 100644
index 0000000000..edab52f3a1
--- /dev/null
+++ b/tests/qemuxml2argvdata/net-virtio-teaming-network.xml
@@ -0,0 +1,37 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219100</memory>
+ <currentMemory unit='KiB'>219100</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-system-i386</emulator>
+ <disk type='block' device='disk'>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='hda' bus='ide'/>
+ </disk>
+ <controller type='usb' index='0'/>
+ <interface type='network'>
+ <mac address='00:11:22:33:44:55'/>
+ <source network='mybridge'/>
+ <model type='virtio'/>
+ <teaming type='persistent'/>
+ <alias name='ua-backup0'/>
+ </interface>
+ <interface type='network'>
+ <mac address='00:11:22:33:44:55'/>
+ <source network='myhostdevpool'/>
+ <model type='virtio'/>
+ <teaming type='transient' persistent='ua-backup0'/>
+ </interface>
+ <memballoon model='virtio'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/net-virtio-teaming.xml b/tests/qemuxml2argvdata/net-virtio-teaming.xml
new file mode 100644
index 0000000000..830ce28524
--- /dev/null
+++ b/tests/qemuxml2argvdata/net-virtio-teaming.xml
@@ -0,0 +1,50 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219100</memory>
+ <currentMemory unit='KiB'>219100</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-system-i386</emulator>
+ <disk type='block' device='disk'>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='hda' bus='ide'/>
+ </disk>
+ <controller type='usb' index='0'/>
+ <interface type='user'>
+ <mac address='00:11:22:33:44:55'/>
+ <model type='virtio'/>
+ <teaming type='persistent'/>
+ <alias name='ua-backup0'/>
+ </interface>
+ <interface type='user'>
+ <mac address='66:44:33:22:11:00'/>
+ <model type='virtio'/>
+ <teaming type='persistent'/>
+ <alias name='ua-backup1'/>
+ </interface>
+ <interface type='hostdev' managed='yes'>
+ <mac address='00:11:22:33:44:55'/>
+ <source>
+ <address type='pci' domain='0x0000' bus='0x03' slot='0x07' function='0x1'/>
+ </source>
+ <teaming type='transient' persistent='ua-backup0'/>
+ </interface>
+ <interface type='hostdev' managed='yes'>
+ <mac address='66:44:33:22:11:00'/>
+ <source>
+ <address type='pci' domain='0x0000' bus='0x03' slot='0x07' function='0x2'/>
+ </source>
+ <teaming type='transient' persistent='ua-backup1'/>
+ </interface>
+ <memballoon model='virtio'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/net-virtio-teaming-network.xml b/tests/qemuxml2xmloutdata/net-virtio-teaming-network.xml
new file mode 100644
index 0000000000..e0dbeafe02
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/net-virtio-teaming-network.xml
@@ -0,0 +1,51 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219100</memory>
+ <currentMemory unit='KiB'>219100</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-system-i386</emulator>
+ <disk type='block' device='disk'>
+ <driver name='qemu' type='raw'/>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='hda' bus='ide'/>
+ <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+ </disk>
+ <controller type='usb' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+ </controller>
+ <controller type='pci' index='0' model='pci-root'/>
+ <controller type='ide' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+ </controller>
+ <interface type='network'>
+ <mac address='00:11:22:33:44:55'/>
+ <source network='mybridge'/>
+ <model type='virtio'/>
+ <teaming type='persistent'/>
+ <alias name='ua-backup0'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+ </interface>
+ <interface type='network'>
+ <mac address='00:11:22:33:44:55'/>
+ <source network='myhostdevpool'/>
+ <model type='virtio'/>
+ <teaming type='transient' persistent='ua-backup0'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+ </interface>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <memballoon model='virtio'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
+ </memballoon>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/net-virtio-teaming.xml b/tests/qemuxml2xmloutdata/net-virtio-teaming.xml
new file mode 100644
index 0000000000..5a5695794a
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/net-virtio-teaming.xml
@@ -0,0 +1,66 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219100</memory>
+ <currentMemory unit='KiB'>219100</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-system-i386</emulator>
+ <disk type='block' device='disk'>
+ <driver name='qemu' type='raw'/>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='hda' bus='ide'/>
+ <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+ </disk>
+ <controller type='usb' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+ </controller>
+ <controller type='pci' index='0' model='pci-root'/>
+ <controller type='ide' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+ </controller>
+ <interface type='user'>
+ <mac address='00:11:22:33:44:55'/>
+ <model type='virtio'/>
+ <teaming type='persistent'/>
+ <alias name='ua-backup0'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+ </interface>
+ <interface type='user'>
+ <mac address='66:44:33:22:11:00'/>
+ <model type='virtio'/>
+ <teaming type='persistent'/>
+ <alias name='ua-backup1'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+ </interface>
+ <interface type='hostdev' managed='yes'>
+ <mac address='00:11:22:33:44:55'/>
+ <source>
+ <address type='pci' domain='0x0000' bus='0x03' slot='0x07' function='0x1'/>
+ </source>
+ <teaming type='transient' persistent='ua-backup0'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
+ </interface>
+ <interface type='hostdev' managed='yes'>
+ <mac address='66:44:33:22:11:00'/>
+ <source>
+ <address type='pci' domain='0x0000' bus='0x03' slot='0x07' function='0x2'/>
+ </source>
+ <teaming type='transient' persistent='ua-backup1'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
+ </interface>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <memballoon model='virtio'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
+ </memballoon>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 3cefc64833..e54c540ef6 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -451,6 +451,12 @@ mymain(void)
DO_TEST("net-eth-unmanaged-tap", NONE);
DO_TEST("net-virtio-network-portgroup", NONE);
DO_TEST("net-virtio-rxtxqueuesize", NONE);
+ DO_TEST("net-virtio-teaming",
+ QEMU_CAPS_VIRTIO_NET_FAILOVER,
+ QEMU_CAPS_DEVICE_VFIO_PCI);
+ DO_TEST("net-virtio-teaming-network",
+ QEMU_CAPS_VIRTIO_NET_FAILOVER,
+ QEMU_CAPS_DEVICE_VFIO_PCI);
DO_TEST("net-hostdev", NONE);
DO_TEST("net-hostdev-bootorder", NONE);
DO_TEST("net-hostdev-vfio", QEMU_CAPS_DEVICE_VFIO_PCI);
--
2.25.0

View File

@ -1,117 +0,0 @@
From b2e0155b59ae9f038bcf21da7c6b7fb0a99a7b67 Mon Sep 17 00:00:00 2001
Message-Id: <b2e0155b59ae9f038bcf21da7c6b7fb0a99a7b67@dist-git>
From: Laine Stump <laine@redhat.com>
Date: Tue, 1 Dec 2020 22:01:00 -0500
Subject: [PATCH] conf: properly clear out autogenerated macvtap names when
formatting/parsing
Back when macvtap support was added in commit 315baab9443 in Feb. 2010
(libvirt-0.7.7), it was setup to autogenerate a name for the device if
one wasn't supplied, in the pattern "macvtap%d" (or "macvlan%d"),
similar to the way an unspecified standard tap device name will lead
to an autogenerated "vnet%d".
As a matter of fact, in commit ca1b7cc8e45 added in May 2010, the code
was changed to *always* ignore a supplied device name for macvtap
interfaces by deleting *any* name immediately during the <interface>
parsing (this was intended to prevent one domain which had failed to
completely start from deleting the macvtap device of another domain
which had subsequently been provided the same device name (this will
seem mildly ironic later). This was later fixed to only clear the
device name when inactive XML was being parsed. HOWEVER - this was
only done if the xml was <interface type='direct'> - autogenerated
names were not cleared for <interface type='network'> (which could
also result in a macvtap device).
Although the names of "vnetX" tap devices had always been
automatically cleared when parsing <interface> (see commit d1304583d
from July 2008 (!)), at the time macvtap support was added, both vnetX
and macvtapX device names were always included when formatting the
XML.
Then in commit a8be259d0cc (July 2011, libvirt-0.9.4), <interface>
formatting was changed to also clear out "vnetX" device names during
XML formatting as well. However the same treatment wasn't given to
"macvtapX".
Now in 2020, there has been a report that a failed migration leads to
the macvtap device of some other unrelated guest on the destination
host losing its network connectivity. It was determined that this was
due to the domain XML in the migration containing a macvtap device
name, e.g. "macvtap0", that was already in use by the other guest on
the destination. Normally this wouldn't be a problem, because libvirt
would see that the device was already in use, and then find a
different unused name. But in this case, other external problems were
causing the migration to fail prior to selecting a macvtap device and
successfully opening it, and during error recovery, qemuProcessStop()
was called, which went through all def->nets objects and (if they were
macvtap) deleted the device specified in net->ifname; since libvirt
hadn't gotten to the point of replacing the incoming "macvtap0" with
the name of a device it actually created for this guest, that meant
that "macvtap0" was deleted, *even though it was currently in use by a
different guest*!
Whew!
So, it turns out that when formatting "migratable" XML, "vnetX"
devices are omitted, just as when formatting "inactive" XML. By making
the code in both interface parsing and formatting consistent for
"vnetX", "macvtapX", and "macvlanX", we can thus make sure that the
autogenerated (and unneeded / completely *not* wanted) macvtap device
name will not be sent with the migration XML. This way when a
migration fails, net->ifname will be NULL, and libvirt won't have any
device to try and (erroneously) delete.
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
(cherry picked from commit 282d135ddbb7203565cd5527b451469b14953994)
https://bugzilla.redhat.com/1872610
Signed-off-by: Laine Stump <laine@redhat.com>
Message-Id: <20201202030100.458879-1-laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
---
src/conf/domain_conf.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index f41559f33e..cd5c15f297 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -12183,14 +12183,6 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
}
def->data.direct.linkdev = g_steal_pointer(&dev);
-
- if (ifname &&
- flags & VIR_DOMAIN_DEF_PARSE_INACTIVE &&
- (STRPREFIX(ifname, VIR_NET_GENERATED_MACVTAP_PREFIX) ||
- STRPREFIX(ifname, VIR_NET_GENERATED_MACVLAN_PREFIX))) {
- VIR_FREE(ifname);
- }
-
break;
case VIR_DOMAIN_NET_TYPE_HOSTDEV:
@@ -12238,6 +12230,8 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
if (def->managed_tap != VIR_TRISTATE_BOOL_NO && ifname &&
(flags & VIR_DOMAIN_DEF_PARSE_INACTIVE) &&
(STRPREFIX(ifname, VIR_NET_GENERATED_TAP_PREFIX) ||
+ STRPREFIX(ifname, VIR_NET_GENERATED_MACVTAP_PREFIX) ||
+ STRPREFIX(ifname, VIR_NET_GENERATED_MACVLAN_PREFIX) ||
(prefix && STRPREFIX(ifname, prefix)))) {
/* An auto-generated target name, blank it out */
VIR_FREE(ifname);
@@ -25996,6 +25990,8 @@ virDomainNetDefFormat(virBufferPtr buf,
(def->managed_tap == VIR_TRISTATE_BOOL_NO ||
!((flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE) &&
(STRPREFIX(def->ifname, VIR_NET_GENERATED_TAP_PREFIX) ||
+ STRPREFIX(def->ifname, VIR_NET_GENERATED_MACVTAP_PREFIX) ||
+ STRPREFIX(def->ifname, VIR_NET_GENERATED_MACVLAN_PREFIX) ||
(prefix && STRPREFIX(def->ifname, prefix)))))) {
/* Skip auto-generated target names for inactive config. */
virBufferEscapeString(&attrBuf, " dev='%s'", def->ifname);
--
2.29.2

View File

@ -1,327 +0,0 @@
From 2fce649fb569ab21c224f387456c996428f8a251 Mon Sep 17 00:00:00 2001
Message-Id: <2fce649fb569ab21c224f387456c996428f8a251@dist-git>
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
Date: Wed, 4 Mar 2020 12:42:41 +0100
Subject: [PATCH] conf: qemu: add virtiofs fsdriver type
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Introduce a new 'virtiofs' driver type for filesystem.
<filesystem type='mount' accessmode='passthrough'>
<driver type='virtiofs'/>
<source dir='/path'/>
<target dir='mount_tag'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</filesystem>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Tested-by: Andrea Bolognani <abologna@redhat.com>
(cherry picked from commit ecc6ad6b90ad674a903c95d2a637f8b1b5833be2)
Signed-off-by: Ján Tomko <jtomko@redhat.com>
https://bugzilla.redhat.com/show_bug.cgi?id=1694166
Message-Id: <abe26807f06ed14b2be3cbd098461afc307e88e3.1583322090.git.jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
---
docs/formatdomain.html.in | 12 ++-
docs/schemas/domaincommon.rng | 6 ++
src/conf/domain_conf.c | 1 +
src/conf/domain_conf.h | 1 +
src/qemu/qemu_command.c | 4 +
src/qemu/qemu_domain.c | 4 +
src/qemu/qemu_domain_address.c | 4 +
.../vhost-user-fs-fd-memory.xml | 39 ++++++++++
.../vhost-user-fs-hugepages.xml | 74 +++++++++++++++++++
.../vhost-user-fs-fd-memory.x86_64-latest.xml | 1 +
.../vhost-user-fs-hugepages.x86_64-latest.xml | 1 +
tests/qemuxml2xmltest.c | 3 +
12 files changed, 149 insertions(+), 1 deletion(-)
create mode 100644 tests/qemuxml2argvdata/vhost-user-fs-fd-memory.xml
create mode 100644 tests/qemuxml2argvdata/vhost-user-fs-hugepages.xml
create mode 120000 tests/qemuxml2xmloutdata/vhost-user-fs-fd-memory.x86_64-latest.xml
create mode 120000 tests/qemuxml2xmloutdata/vhost-user-fs-hugepages.x86_64-latest.xml
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 50914a5207..337ab01316 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -3935,6 +3935,11 @@
&lt;target dir='/import/from/host'/&gt;
&lt;readonly/&gt;
&lt;/filesystem&gt;
+ &lt;filesystem type='mount' accessmode='passthrough'&gt;
+ &lt;driver type='virtiofs'/&gt;
+ &lt;source dir='/path'/&gt;
+ &lt;target dir='mount_tag'/&gt;
+ &lt;/filesystem&gt;
...
&lt;/devices&gt;
...</pre>
@@ -3963,6 +3968,9 @@
while the value <code>immediate</code> means that a host writeback
is immediately triggered for all pages touched during a guest file
write operation <span class="since">(since 0.9.10)</span>.
+ <span class="since">Since 6.2.0</span>, <code>type='virtiofs'</code>
+ is also supported. Using virtiofs requires setting up shared memory,
+ see the guide: <a href="kbase/virtiofs.html">Virtio-FS</a>
</dd>
<dt><code>template</code></dt>
<dd>
@@ -3998,7 +4006,9 @@
The filesystem element has an optional attribute <code>accessmode</code>
which specifies the security mode for accessing the source
<span class="since">(since 0.8.5)</span>. Currently this only works
- with <code>type='mount'</code> for the QEMU/KVM driver. The possible
+ with <code>type='mount'</code> for the QEMU/KVM driver.
+ For driver type <code>virtiofs</code>, only <code>passthrough</code> is
+ supported. For other driver types, the possible
values are:
<dl>
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index bfd8786ea8..5a9291b443 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -2645,6 +2645,12 @@
</optional>
<ref name='virtioOptions'/>
</group>
+ <group>
+ <attribute name="type">
+ <value>virtiofs</value>
+ </attribute>
+ <ref name='virtioOptions'/>
+ </group>
<empty/>
</choice>
</element>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 990c5bcc1e..31d4828802 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -476,6 +476,7 @@ VIR_ENUM_IMPL(virDomainFSDriver,
"loop",
"nbd",
"ploop",
+ "virtiofs",
);
VIR_ENUM_IMPL(virDomainFSAccessMode,
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index ef2c1b80f7..921cc42a57 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -771,6 +771,7 @@ typedef enum {
VIR_DOMAIN_FS_DRIVER_TYPE_LOOP,
VIR_DOMAIN_FS_DRIVER_TYPE_NBD,
VIR_DOMAIN_FS_DRIVER_TYPE_PLOOP,
+ VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS,
VIR_DOMAIN_FS_DRIVER_TYPE_LAST
} virDomainFSDriverType;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 252809a8d7..7fdf58f067 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -2695,6 +2695,10 @@ qemuBuildFilesystemCommandLine(virCommandPtr cmd,
return -1;
break;
+ case VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS:
+ /* TODO: vhost-user-fs-pci */
+ break;
+
case VIR_DOMAIN_FS_DRIVER_TYPE_LOOP:
case VIR_DOMAIN_FS_DRIVER_TYPE_NBD:
case VIR_DOMAIN_FS_DRIVER_TYPE_PLOOP:
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index ed35260712..402b079b09 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -8361,6 +8361,10 @@ qemuDomainDeviceDefValidateFS(virDomainFSDefPtr fs,
_("Filesystem driver type not supported"));
return -1;
+ case VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS:
+ /* TODO: vhost-user-fs-pci */
+ return 0;
+
case VIR_DOMAIN_FS_DRIVER_TYPE_LAST:
default:
virReportEnumRangeError(virDomainFSDriverType, fs->fsdriver);
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index 9e3bcc434d..3c6ac62ff5 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -690,6 +690,10 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev,
}
break;
+ case VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS:
+ /* vhost-user-fs-pci */
+ return virtioFlags;
+
case VIR_DOMAIN_FS_DRIVER_TYPE_LOOP:
case VIR_DOMAIN_FS_DRIVER_TYPE_NBD:
case VIR_DOMAIN_FS_DRIVER_TYPE_PLOOP:
diff --git a/tests/qemuxml2argvdata/vhost-user-fs-fd-memory.xml b/tests/qemuxml2argvdata/vhost-user-fs-fd-memory.xml
new file mode 100644
index 0000000000..a6b6279fb8
--- /dev/null
+++ b/tests/qemuxml2argvdata/vhost-user-fs-fd-memory.xml
@@ -0,0 +1,39 @@
+<domain type='kvm'>
+ <name>guest</name>
+ <uuid>126f2720-6f8e-45ab-a886-ec9277079a67</uuid>
+ <memory unit='KiB'>14680064</memory>
+ <currentMemory unit='KiB'>14680064</currentMemory>
+ <memoryBacking>
+ <source type='file'/>
+ <access mode='shared'/>
+ </memoryBacking>
+ <vcpu placement='static'>2</vcpu>
+ <os>
+ <type arch='x86_64' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <cpu mode='custom' match='exact' check='none'>
+ <model fallback='forbid'>qemu64</model>
+ <numa>
+ <cell id='0' cpus='0-1' memory='14680064' unit='KiB' memAccess='shared'/>
+ </numa>
+ </cpu>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-system-x86_64</emulator>
+ <controller type='usb' index='0' model='none'/>
+ <controller type='pci' index='0' model='pci-root'/>
+ <filesystem type='mount' accessmode='passthrough'>
+ <driver type='virtiofs'/>
+ <source dir='/path'/>
+ <target dir='mount_tag'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+ </filesystem>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/vhost-user-fs-hugepages.xml b/tests/qemuxml2argvdata/vhost-user-fs-hugepages.xml
new file mode 100644
index 0000000000..70df7b890d
--- /dev/null
+++ b/tests/qemuxml2argvdata/vhost-user-fs-hugepages.xml
@@ -0,0 +1,74 @@
+<domain type='qemu'>
+ <name>guest</name>
+ <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid>
+ <memory unit='KiB'>4194304</memory>
+ <currentMemory unit='KiB'>4194304</currentMemory>
+ <memoryBacking>
+ <hugepages>
+ <page size='2048' unit='KiB'/>
+ </hugepages>
+ <access mode='shared'/>
+ </memoryBacking>
+ <vcpu placement='static'>2</vcpu>
+ <os>
+ <type arch='x86_64' machine='q35'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <features>
+ <acpi/>
+ <apic/>
+ </features>
+ <cpu mode='custom' match='exact' check='none'>
+ <model fallback='forbid'>qemu64</model>
+ <numa>
+ <cell id='0' cpus='0-1' memory='2097152' unit='KiB' memAccess='shared'/>
+ </numa>
+ </cpu>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-system-x86_64</emulator>
+ <disk type='file' device='disk'>
+ <driver name='qemu' type='qcow2'/>
+ <source file='/var/lib/libvirt/images/guest.qcow2'/>
+ <target dev='vda' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
+ </disk>
+ <controller type='usb' index='0' model='none'/>
+ <controller type='sata' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
+ </controller>
+ <controller type='pci' index='0' model='pcie-root'/>
+ <controller type='pci' index='1' model='pcie-root-port'>
+ <model name='pcie-root-port'/>
+ <target chassis='1' port='0x8'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0' multifunction='on'/>
+ </controller>
+ <controller type='pci' index='2' model='pcie-root-port'>
+ <model name='pcie-root-port'/>
+ <target chassis='2' port='0x9'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+ </controller>
+ <controller type='pci' index='3' model='pcie-root-port'>
+ <model name='pcie-root-port'/>
+ <target chassis='3' port='0xa'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+ </controller>
+ <controller type='pci' index='4' model='pcie-root-port'>
+ <model name='pcie-root-port'/>
+ <target chassis='4' port='0xb'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x3'/>
+ </controller>
+ <filesystem type='mount' accessmode='passthrough'>
+ <driver type='virtiofs'/>
+ <source dir='/path'/>
+ <target dir='mount_tag'/>
+ <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
+ </filesystem>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/vhost-user-fs-fd-memory.x86_64-latest.xml b/tests/qemuxml2xmloutdata/vhost-user-fs-fd-memory.x86_64-latest.xml
new file mode 120000
index 0000000000..fbc552ef94
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/vhost-user-fs-fd-memory.x86_64-latest.xml
@@ -0,0 +1 @@
+../qemuxml2argvdata/vhost-user-fs-fd-memory.xml
\ No newline at end of file
diff --git a/tests/qemuxml2xmloutdata/vhost-user-fs-hugepages.x86_64-latest.xml b/tests/qemuxml2xmloutdata/vhost-user-fs-hugepages.x86_64-latest.xml
new file mode 120000
index 0000000000..0c0f05b254
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/vhost-user-fs-hugepages.x86_64-latest.xml
@@ -0,0 +1 @@
+../qemuxml2argvdata/vhost-user-fs-hugepages.xml
\ No newline at end of file
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index d58259587b..f77f59fa3c 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -1428,6 +1428,9 @@ mymain(void)
DO_TEST("vhost-vsock-ccw-auto", QEMU_CAPS_DEVICE_VHOST_VSOCK,
QEMU_CAPS_CCW);
+ DO_TEST_CAPS_LATEST("vhost-user-fs-fd-memory");
+ DO_TEST_CAPS_LATEST("vhost-user-fs-hugepages");
+
DO_TEST("riscv64-virt",
QEMU_CAPS_DEVICE_VIRTIO_MMIO);
DO_TEST("riscv64-virt-pci",
--
2.25.1

View File

@ -1,161 +0,0 @@
From 4f2bf4edfb640c38281d63e54145433ce8a78d28 Mon Sep 17 00:00:00 2001
Message-Id: <4f2bf4edfb640c38281d63e54145433ce8a78d28@dist-git>
From: Laine Stump <laine@redhat.com>
Date: Sun, 26 Apr 2020 13:04:11 -0400
Subject: [PATCH] conf/qemu:
s/VIR_PCI_CONNECT_HOTPLUGGABLE/VIR_PCI_CONNECT_AUTOASSIGN/g
When the HOTPLUGGABLE flag was originally added, it was set for all
the PCI controllers that accepted hotplugged devices, and requested
for all devices that were auto-assigned to a controller. While we're
still autoassigning to the same list of controllers, those controllers
may or may not support hotplug, so let's use the flag that fits what
we're actually doing.
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 7c98f5e3652e19e4eb015d290c1eed2f1b58ee72)
https://bugzilla.redhat.com/1802592
Signed-off-by: Laine Stump <laine@redhat.com>
Message-Id: <20200426170415.18328-9-laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
---
src/conf/domain_addr.c | 18 +++++++++---------
src/qemu/qemu_domain_address.c | 14 +++++++-------
2 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c
index e0be655772..53be6cd34b 100644
--- a/src/conf/domain_addr.c
+++ b/src/conf/domain_addr.c
@@ -362,8 +362,8 @@ virDomainPCIAddressFlagsCompatible(virPCIDeviceAddressPtr addr,
* libvirt's assumptions about whether or not hotplug
* capability will be required.
*/
- if (devFlags & VIR_PCI_CONNECT_HOTPLUGGABLE)
- busFlags |= VIR_PCI_CONNECT_HOTPLUGGABLE;
+ if (devFlags & VIR_PCI_CONNECT_AUTOASSIGN)
+ busFlags |= VIR_PCI_CONNECT_AUTOASSIGN;
/* if the device is a pci-bridge, allow manually
* assigning to any bus that would also accept a
* standard PCI device.
@@ -419,8 +419,8 @@ virDomainPCIAddressFlagsCompatible(virPCIDeviceAddressPtr addr,
addrStr, addr->bus, connectStr);
return false;
}
- if ((devFlags & VIR_PCI_CONNECT_HOTPLUGGABLE) &&
- !(busFlags & VIR_PCI_CONNECT_HOTPLUGGABLE)) {
+ if ((devFlags & VIR_PCI_CONNECT_AUTOASSIGN) &&
+ !(busFlags & VIR_PCI_CONNECT_AUTOASSIGN)) {
if (reportError) {
virReportError(errType,
_("The device at PCI address %s requires "
@@ -509,7 +509,7 @@ virDomainPCIAddressBusSetModel(virDomainPCIAddressBusPtr bus,
*/
switch (model) {
case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT:
- bus->flags = (VIR_PCI_CONNECT_HOTPLUGGABLE |
+ bus->flags = (VIR_PCI_CONNECT_AUTOASSIGN |
VIR_PCI_CONNECT_TYPE_PCI_DEVICE |
VIR_PCI_CONNECT_TYPE_PCI_BRIDGE |
VIR_PCI_CONNECT_TYPE_PCI_EXPANDER_BUS);
@@ -517,14 +517,14 @@ virDomainPCIAddressBusSetModel(virDomainPCIAddressBusPtr bus,
bus->maxSlot = VIR_PCI_ADDRESS_SLOT_LAST;
break;
case VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE:
- bus->flags = (VIR_PCI_CONNECT_HOTPLUGGABLE |
+ bus->flags = (VIR_PCI_CONNECT_AUTOASSIGN |
VIR_PCI_CONNECT_TYPE_PCI_DEVICE |
VIR_PCI_CONNECT_TYPE_PCI_BRIDGE);
bus->minSlot = 1;
bus->maxSlot = VIR_PCI_ADDRESS_SLOT_LAST;
break;
case VIR_DOMAIN_CONTROLLER_MODEL_PCI_EXPANDER_BUS:
- bus->flags = (VIR_PCI_CONNECT_HOTPLUGGABLE |
+ bus->flags = (VIR_PCI_CONNECT_AUTOASSIGN |
VIR_PCI_CONNECT_TYPE_PCI_DEVICE |
VIR_PCI_CONNECT_TYPE_PCI_BRIDGE);
bus->minSlot = 0;
@@ -555,7 +555,7 @@ virDomainPCIAddressBusSetModel(virDomainPCIAddressBusPtr bus,
case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_TO_PCI_BRIDGE:
/* Same as pci-bridge: 32 hotpluggable traditional PCI slots (0-31),
* the first of which is not usable because of the SHPC */
- bus->flags = (VIR_PCI_CONNECT_HOTPLUGGABLE |
+ bus->flags = (VIR_PCI_CONNECT_AUTOASSIGN |
VIR_PCI_CONNECT_TYPE_PCI_DEVICE |
VIR_PCI_CONNECT_TYPE_PCI_BRIDGE);
bus->minSlot = 1;
@@ -566,7 +566,7 @@ virDomainPCIAddressBusSetModel(virDomainPCIAddressBusPtr bus,
/* provides one slot which is pcie, can be used by endpoint
* devices, pcie-switch-upstream-ports or pcie-to-pci-bridges,
* and is hotpluggable */
- bus->flags = (VIR_PCI_CONNECT_HOTPLUGGABLE |
+ bus->flags = (VIR_PCI_CONNECT_AUTOASSIGN |
VIR_PCI_CONNECT_TYPE_PCIE_DEVICE |
VIR_PCI_CONNECT_TYPE_PCIE_SWITCH_UPSTREAM_PORT |
VIR_PCI_CONNECT_TYPE_PCIE_TO_PCI_BRIDGE);
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index 3c6ac62ff5..e81585bc6c 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -571,7 +571,7 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev,
virDomainPCIConnectFlags virtioFlags)
{
virDomainPCIConnectFlags pciFlags = (VIR_PCI_CONNECT_TYPE_PCI_DEVICE |
- VIR_PCI_CONNECT_HOTPLUGGABLE);
+ VIR_PCI_CONNECT_AUTOASSIGN);
switch ((virDomainDeviceType)dev->type) {
case VIR_DOMAIN_DEVICE_CONTROLLER: {
@@ -1063,17 +1063,17 @@ qemuDomainFillDevicePCIConnectFlagsIterInit(virDomainDefPtr def,
if (qemuDomainHasPCIeRoot(def)) {
data->pcieFlags = (VIR_PCI_CONNECT_TYPE_PCIE_DEVICE |
- VIR_PCI_CONNECT_HOTPLUGGABLE);
+ VIR_PCI_CONNECT_AUTOASSIGN);
} else {
data->pcieFlags = (VIR_PCI_CONNECT_TYPE_PCI_DEVICE |
- VIR_PCI_CONNECT_HOTPLUGGABLE);
+ VIR_PCI_CONNECT_AUTOASSIGN);
}
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY)) {
data->virtioFlags = data->pcieFlags;
} else {
data->virtioFlags = (VIR_PCI_CONNECT_TYPE_PCI_DEVICE |
- VIR_PCI_CONNECT_HOTPLUGGABLE);
+ VIR_PCI_CONNECT_AUTOASSIGN);
}
}
@@ -1729,7 +1729,7 @@ qemuDomainValidateDevicePCISlotsPIIX3(virDomainDefPtr def,
virPCIDeviceAddress tmp_addr;
bool qemuDeviceVideoUsable = virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
g_autofree char *addrStr = NULL;
- virDomainPCIConnectFlags flags = (VIR_PCI_CONNECT_HOTPLUGGABLE
+ virDomainPCIConnectFlags flags = (VIR_PCI_CONNECT_AUTOASSIGN
| VIR_PCI_CONNECT_TYPE_PCI_DEVICE);
/* Verify that first IDE and USB controllers (if any) is on the PIIX3, fn 1 */
@@ -2666,7 +2666,7 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def,
* domain.
*/
virDomainDeviceInfo info = {
- .pciConnectFlags = (VIR_PCI_CONNECT_HOTPLUGGABLE |
+ .pciConnectFlags = (VIR_PCI_CONNECT_AUTOASSIGN |
VIR_PCI_CONNECT_TYPE_PCI_DEVICE),
.pciAddrExtFlags = VIR_PCI_ADDRESS_EXTENSION_NONE
};
@@ -2707,7 +2707,7 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def,
addrs->nbuses > max_idx + 1 &&
qemuDomainHasPCIeRoot(def)) {
virDomainDeviceInfo info = {
- .pciConnectFlags = (VIR_PCI_CONNECT_HOTPLUGGABLE |
+ .pciConnectFlags = (VIR_PCI_CONNECT_AUTOASSIGN |
VIR_PCI_CONNECT_TYPE_PCIE_DEVICE),
.pciAddrExtFlags = VIR_PCI_ADDRESS_EXTENSION_NONE
};
--
2.26.2

View File

@ -1,317 +0,0 @@
From 4ca3f2f590fb860b01f1eb5fec8929ceba702dc6 Mon Sep 17 00:00:00 2001
Message-Id: <4ca3f2f590fb860b01f1eb5fec8929ceba702dc6@dist-git>
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
Date: Fri, 21 May 2021 14:16:14 +0200
Subject: [PATCH] conf: remove duplicated firmware type attribute
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The
<os firmware='efi'>
<firmware type='efi'>
<feature enabled='no' name='enrolled-keys'/>
</firmware>
</os>
repeats the firmware attribute twice. This has no functional benefit, as
evidenced by fact that we use a single struct field to store both
attributes, while needlessly introducing an error scenario. The XML can
just be simplified to:
<os firmware='efi'>
<firmware>
<feature enabled='no' name='enrolled-keys'/>
</firmware>
</os>
which also means that we don't need to emit the empty element
<firmware type='efi'/> for all existing configs too.
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
(cherry picked from commit a9b1375d7d2f7d240dce09c5f8b62e568e386051)
Conflicts:
docs/formatdomain.rst
- we still have formatdomain.html.in in downstream
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1929357
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Message-Id: <299fd16fc3ce632bf25ca55cc4bb65a225437d61.1621599207.git.phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
---
docs/formatdomain.html.in | 15 ------
docs/schemas/domaincommon.rng | 10 +---
src/conf/domain_conf.c | 48 ++++++-------------
.../os-firmware-efi-no-enrolled-keys.xml | 2 +-
.../os-firmware-invalid-type.xml | 28 -----------
tests/qemuxml2argvtest.c | 1 -
...aarch64-os-firmware-efi.aarch64-latest.xml | 1 -
.../os-firmware-bios.x86_64-latest.xml | 1 -
.../os-firmware-efi-secboot.x86_64-latest.xml | 1 -
.../os-firmware-efi.x86_64-latest.xml | 1 -
tests/vmx2xmldata/vmx2xml-firmware-efi.xml | 1 -
11 files changed, 18 insertions(+), 91 deletions(-)
delete mode 100644 tests/qemuxml2argvdata/os-firmware-invalid-type.xml
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 11f31618af..79e2e51c54 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -183,21 +183,6 @@
<dt><a id="elementFirmware"><code>firmware</code></a></dt>
<dd>
<p><span class="since">Since 7.2.0 QEMU/KVM only</span></p>
- <p>
- When used together with <code>firmware</code> attribute of
- <code>os</code> element the <code>type</code> attribute must
- have the same value.
- </p>
- <p>
- List of mandatory attributes:
- <ul>
- <li>
- <code>type</code> (accepted values are <code>bios</code>
- and <code>efi</code>) same as the <code>firmware</code>
- attribute of <code>os</code> element.
- </li>
- </ul>
- </p>
<p>
When using firmware auto-selection there are different features
enabled in the firmwares. The list of features can be used to
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index b7f6a6b494..ec8167e588 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -270,13 +270,7 @@
<ref name="ostypehvm"/>
<optional>
<element name="firmware">
- <attribute name="type">
- <choice>
- <value>bios</value>
- <value>efi</value>
- </choice>
- </attribute>
- <zeroOrMore>
+ <oneOrMore>
<element name="feature">
<attribute name="enabled">
<ref name="virYesNo"/>
@@ -288,7 +282,7 @@
</choice>
</attribute>
</element>
- </zeroOrMore>
+ </oneOrMore>
</element>
</optional>
<optional>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 2ffa9c8a2a..6806064016 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -19389,31 +19389,21 @@ virDomainDefParseBootFirmwareOptions(virDomainDefPtr def,
xmlXPathContextPtr ctxt)
{
g_autofree char *firmware = virXPathString("string(./os/@firmware)", ctxt);
- g_autofree char *type = virXPathString("string(./os/firmware/@type)", ctxt);
g_autofree xmlNodePtr *nodes = NULL;
g_autofree int *features = NULL;
int fw = 0;
int n = 0;
size_t i;
- if (!firmware && !type)
+ if (!firmware)
return 0;
- if (firmware && type && STRNEQ(firmware, type)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("firmware attribute and firmware type has to be the same"));
- return -1;
- }
-
- if (!type)
- type = g_steal_pointer(&firmware);
-
- fw = virDomainOsDefFirmwareTypeFromString(type);
+ fw = virDomainOsDefFirmwareTypeFromString(firmware);
if (fw <= 0) {
virReportError(VIR_ERR_XML_ERROR,
_("unknown firmware value %s"),
- type);
+ firmware);
return -1;
}
@@ -29039,30 +29029,22 @@ virDomainDefFormatInternalSetRootName(virDomainDefPtr def,
virBufferAsprintf(buf, ">%s</type>\n",
virDomainOSTypeToString(def->os.type));
- if (def->os.firmware) {
- virBufferAsprintf(buf, "<firmware type='%s'",
- virDomainOsDefFirmwareTypeToString(def->os.firmware));
-
- if (def->os.firmwareFeatures) {
- virBufferAddLit(buf, ">\n");
-
- virBufferAdjustIndent(buf, 2);
+ if (def->os.firmwareFeatures) {
+ virBufferAddLit(buf, "<firmware>\n");
+ virBufferAdjustIndent(buf, 2);
- for (i = 0; i < VIR_DOMAIN_OS_DEF_FIRMWARE_FEATURE_LAST; i++) {
- if (def->os.firmwareFeatures[i] == VIR_TRISTATE_BOOL_ABSENT)
- continue;
+ for (i = 0; i < VIR_DOMAIN_OS_DEF_FIRMWARE_FEATURE_LAST; i++) {
+ if (def->os.firmwareFeatures[i] == VIR_TRISTATE_BOOL_ABSENT)
+ continue;
- virBufferAsprintf(buf, "<feature enabled='%s' name='%s'/>\n",
- virTristateBoolTypeToString(def->os.firmwareFeatures[i]),
- virDomainOsDefFirmwareFeatureTypeToString(i));
- }
+ virBufferAsprintf(buf, "<feature enabled='%s' name='%s'/>\n",
+ virTristateBoolTypeToString(def->os.firmwareFeatures[i]),
+ virDomainOsDefFirmwareFeatureTypeToString(i));
+ }
- virBufferAdjustIndent(buf, -2);
+ virBufferAdjustIndent(buf, -2);
- virBufferAddLit(buf, "</firmware>\n");
- } else {
- virBufferAddLit(buf, "/>\n");
- }
+ virBufferAddLit(buf, "</firmware>\n");
}
virBufferEscapeString(buf, "<init>%s</init>\n",
diff --git a/tests/qemuxml2argvdata/os-firmware-efi-no-enrolled-keys.xml b/tests/qemuxml2argvdata/os-firmware-efi-no-enrolled-keys.xml
index 7f8f57a859..4999c4f125 100644
--- a/tests/qemuxml2argvdata/os-firmware-efi-no-enrolled-keys.xml
+++ b/tests/qemuxml2argvdata/os-firmware-efi-no-enrolled-keys.xml
@@ -6,7 +6,7 @@
<vcpu placement='static'>1</vcpu>
<os firmware='efi'>
<type arch='x86_64' machine='pc-q35-4.0'>hvm</type>
- <firmware type='efi'>
+ <firmware>
<feature enabled='no' name='enrolled-keys'/>
</firmware>
<boot dev='hd'/>
diff --git a/tests/qemuxml2argvdata/os-firmware-invalid-type.xml b/tests/qemuxml2argvdata/os-firmware-invalid-type.xml
deleted file mode 100644
index 41360df0f7..0000000000
--- a/tests/qemuxml2argvdata/os-firmware-invalid-type.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<domain type='kvm'>
- <name>fedora</name>
- <uuid>63840878-0deb-4095-97e6-fc444d9bc9fa</uuid>
- <memory unit='KiB'>8192</memory>
- <currentMemory unit='KiB'>8192</currentMemory>
- <vcpu placement='static'>1</vcpu>
- <os firmware='efi'>
- <type arch='x86_64' machine='pc-q35-4.0'>hvm</type>
- <firmware type='bios'/>
- <loader secure='no'/>
- <nvram>/var/lib/libvirt/qemu/nvram/fedora_VARS.fd</nvram>
- <boot dev='hd'/>
- <bootmenu enable='yes'/>
- </os>
- <features>
- <acpi/>
- <apic/>
- <pae/>
- </features>
- <clock offset='utc'/>
- <on_poweroff>destroy</on_poweroff>
- <on_reboot>restart</on_reboot>
- <on_crash>restart</on_crash>
- <devices>
- <emulator>/usr/bin/qemu-system-x86_64</emulator>
- <memballoon model='none'/>
- </devices>
-</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 5e16d7fd31..be8054fa6a 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -3095,7 +3095,6 @@ mymain(void)
DO_TEST_CAPS_LATEST("os-firmware-efi");
DO_TEST_CAPS_LATEST("os-firmware-efi-secboot");
DO_TEST_CAPS_LATEST("os-firmware-efi-no-enrolled-keys");
- DO_TEST_CAPS_LATEST_PARSE_ERROR("os-firmware-invalid-type");
DO_TEST_CAPS_ARCH_LATEST("aarch64-os-firmware-efi", "aarch64");
DO_TEST_CAPS_LATEST("vhost-user-vga");
diff --git a/tests/qemuxml2xmloutdata/aarch64-os-firmware-efi.aarch64-latest.xml b/tests/qemuxml2xmloutdata/aarch64-os-firmware-efi.aarch64-latest.xml
index 3cac8fc5c6..1e51d55305 100644
--- a/tests/qemuxml2xmloutdata/aarch64-os-firmware-efi.aarch64-latest.xml
+++ b/tests/qemuxml2xmloutdata/aarch64-os-firmware-efi.aarch64-latest.xml
@@ -6,7 +6,6 @@
<vcpu placement='static'>1</vcpu>
<os firmware='efi'>
<type arch='aarch64' machine='virt-4.0'>hvm</type>
- <firmware type='efi'/>
<kernel>/aarch64.kernel</kernel>
<initrd>/aarch64.initrd</initrd>
<cmdline>earlyprintk console=ttyAMA0,115200n8 rw root=/dev/vda rootwait</cmdline>
diff --git a/tests/qemuxml2xmloutdata/os-firmware-bios.x86_64-latest.xml b/tests/qemuxml2xmloutdata/os-firmware-bios.x86_64-latest.xml
index ef24f2fece..60d3498765 100644
--- a/tests/qemuxml2xmloutdata/os-firmware-bios.x86_64-latest.xml
+++ b/tests/qemuxml2xmloutdata/os-firmware-bios.x86_64-latest.xml
@@ -6,7 +6,6 @@
<vcpu placement='static'>1</vcpu>
<os firmware='bios'>
<type arch='x86_64' machine='pc-q35-4.0'>hvm</type>
- <firmware type='bios'/>
<loader secure='no'/>
<nvram>/var/lib/libvirt/qemu/nvram/fedora_VARS.fd</nvram>
<boot dev='hd'/>
diff --git a/tests/qemuxml2xmloutdata/os-firmware-efi-secboot.x86_64-latest.xml b/tests/qemuxml2xmloutdata/os-firmware-efi-secboot.x86_64-latest.xml
index 3757191e8e..938da73711 100644
--- a/tests/qemuxml2xmloutdata/os-firmware-efi-secboot.x86_64-latest.xml
+++ b/tests/qemuxml2xmloutdata/os-firmware-efi-secboot.x86_64-latest.xml
@@ -6,7 +6,6 @@
<vcpu placement='static'>1</vcpu>
<os firmware='efi'>
<type arch='x86_64' machine='pc-q35-4.0'>hvm</type>
- <firmware type='efi'/>
<loader secure='yes'/>
<nvram>/var/lib/libvirt/qemu/nvram/fedora_VARS.fd</nvram>
<boot dev='hd'/>
diff --git a/tests/qemuxml2xmloutdata/os-firmware-efi.x86_64-latest.xml b/tests/qemuxml2xmloutdata/os-firmware-efi.x86_64-latest.xml
index f2e6b7f36d..97ce8a75c7 100644
--- a/tests/qemuxml2xmloutdata/os-firmware-efi.x86_64-latest.xml
+++ b/tests/qemuxml2xmloutdata/os-firmware-efi.x86_64-latest.xml
@@ -6,7 +6,6 @@
<vcpu placement='static'>1</vcpu>
<os firmware='efi'>
<type arch='x86_64' machine='pc-q35-4.0'>hvm</type>
- <firmware type='efi'/>
<loader secure='no'/>
<nvram>/var/lib/libvirt/qemu/nvram/fedora_VARS.fd</nvram>
<boot dev='hd'/>
diff --git a/tests/vmx2xmldata/vmx2xml-firmware-efi.xml b/tests/vmx2xmldata/vmx2xml-firmware-efi.xml
index 375c47d281..e21158cebf 100644
--- a/tests/vmx2xmldata/vmx2xml-firmware-efi.xml
+++ b/tests/vmx2xmldata/vmx2xml-firmware-efi.xml
@@ -5,7 +5,6 @@
<vcpu placement='static'>1</vcpu>
<os firmware='efi'>
<type arch='i686'>hvm</type>
- <firmware type='efi'/>
</os>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
--
2.31.1

View File

@ -1,88 +0,0 @@
From 6ece5388a7fb7fc3c703cd1bc9e214ad411451d8 Mon Sep 17 00:00:00 2001
Message-Id: <6ece5388a7fb7fc3c703cd1bc9e214ad411451d8@dist-git>
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
Date: Mon, 3 Feb 2020 18:07:23 +0000
Subject: [PATCH] conf: remove unused virCapabilitiesSetHostCPU method
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
(cherry picked from commit 2ce9474c2a6ba3df4977068dcee35d3fa5468749)
BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1785207
BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1785211
Message-Id: <20200203180726.2203691-3-berrange@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
---
src/conf/capabilities.c | 21 ---------------------
src/conf/capabilities.h | 6 ------
src/libvirt_private.syms | 1 -
3 files changed, 28 deletions(-)
diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c
index 9a39858280..bf1d9936ed 100644
--- a/src/conf/capabilities.c
+++ b/src/conf/capabilities.c
@@ -368,27 +368,6 @@ virCapabilitiesHostNUMAAddCell(virCapsHostNUMAPtr caps,
g_ptr_array_add(caps->cells, cell);
}
-
-/**
- * virCapabilitiesSetHostCPU:
- * @caps: capabilities to extend
- * @cpu: CPU definition
- *
- * Sets host CPU specification
- */
-int
-virCapabilitiesSetHostCPU(virCapsPtr caps,
- virCPUDefPtr cpu)
-{
- if (cpu == NULL)
- return -1;
-
- caps->host.cpu = cpu;
-
- return 0;
-}
-
-
/**
* virCapabilitiesAllocMachines:
* @machines: machine variants for emulator ('pc', or 'isapc', etc)
diff --git a/src/conf/capabilities.h b/src/conf/capabilities.h
index f604e7b95e..4a49e94aa5 100644
--- a/src/conf/capabilities.h
+++ b/src/conf/capabilities.h
@@ -258,12 +258,6 @@ virCapabilitiesHostNUMAAddCell(virCapsHostNUMAPtr caps,
int npageinfo,
virCapsHostNUMACellPageInfoPtr pageinfo);
-
-int
-virCapabilitiesSetHostCPU(virCapsPtr caps,
- virCPUDefPtr cpu);
-
-
virCapsGuestMachinePtr *
virCapabilitiesAllocMachines(const char *const *names,
int nnames);
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index b97906b852..afa7d4fcae 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -77,7 +77,6 @@ virCapabilitiesHostSecModelAddBaseLabel;
virCapabilitiesInitCaches;
virCapabilitiesInitPages;
virCapabilitiesNew;
-virCapabilitiesSetHostCPU;
virCapabilitiesSetNetPrefix;
--
2.25.0

View File

@ -1,144 +0,0 @@
From 9b070e02e7b5bb95728a1fcdc8b7dfaaacc5f30a Mon Sep 17 00:00:00 2001
Message-Id: <9b070e02e7b5bb95728a1fcdc8b7dfaaacc5f30a@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Tue, 24 Mar 2020 16:25:55 +0100
Subject: [PATCH] conf: rename 'namespace' property of struct
_virStorageSourceNVMeDef
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
While 'namespace' is not a reserved word in C, it is in C++. Our
compilers are happy with it but syntax-hilighting in some editors
hilights is as a keyword. Rename it to prevent confusion.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 5793b8baa75747860f6ba97470969047e60c8579)
https://bugzilla.redhat.com/show_bug.cgi?id=1804617
Message-Id: <bfe6cf10a95868ae56a91f362a1ea50667754027.1585063415.git.pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/conf/domain_conf.c | 12 ++++++------
src/qemu/qemu_block.c | 2 +-
src/util/virhostdev.c | 2 +-
src/util/virstoragefile.c | 4 ++--
src/util/virstoragefile.h | 2 +-
5 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 8aec85e83c..1e8518139c 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -6054,7 +6054,7 @@ virDomainDiskDefValidate(const virDomainDef *def,
if (disk->src->type == VIR_STORAGE_TYPE_NVME) {
/* NVMe namespaces start from 1 */
- if (disk->src->nvme->namespace == 0) {
+ if (disk->src->nvme->namespc == 0) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("NVMe namespace can't be zero"));
return -1;
@@ -9433,7 +9433,7 @@ virDomainDiskSourceNVMeParse(xmlNodePtr node,
{
g_autoptr(virStorageSourceNVMeDef) nvme = NULL;
g_autofree char *type = NULL;
- g_autofree char *namespace = NULL;
+ g_autofree char *namespc = NULL;
g_autofree char *managed = NULL;
xmlNodePtr address;
@@ -9452,16 +9452,16 @@ virDomainDiskSourceNVMeParse(xmlNodePtr node,
return -1;
}
- if (!(namespace = virXMLPropString(node, "namespace"))) {
+ if (!(namespc = virXMLPropString(node, "namespace"))) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("missing 'namespace' attribute to disk source"));
return -1;
}
- if (virStrToLong_ull(namespace, NULL, 10, &nvme->namespace) < 0) {
+ if (virStrToLong_ull(namespc, NULL, 10, &nvme->namespc) < 0) {
virReportError(VIR_ERR_XML_ERROR,
_("malformed namespace '%s'"),
- namespace);
+ namespc);
return -1;
}
@@ -24444,7 +24444,7 @@ virDomainDiskSourceNVMeFormat(virBufferPtr attrBuf,
virBufferAddLit(attrBuf, " type='pci'");
virBufferAsprintf(attrBuf, " managed='%s'",
virTristateBoolTypeToString(nvme->managed));
- virBufferAsprintf(attrBuf, " namespace='%llu'", nvme->namespace);
+ virBufferAsprintf(attrBuf, " namespace='%llu'", nvme->namespc);
virPCIDeviceAddressFormat(childBuf, nvme->pciAddr, false);
}
diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
index 73cb5ba4bc..5697d4fc73 100644
--- a/src/qemu/qemu_block.c
+++ b/src/qemu/qemu_block.c
@@ -1008,7 +1008,7 @@ qemuBlockStorageSourceGetNVMeProps(virStorageSourcePtr src)
ignore_value(virJSONValueObjectCreate(&ret,
"s:driver", "nvme",
"s:device", pciAddr,
- "U:namespace", nvme->namespace,
+ "U:namespace", nvme->namespc,
NULL));
return ret;
}
diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c
index 9b4ea30216..9596482146 100644
--- a/src/util/virhostdev.c
+++ b/src/util/virhostdev.c
@@ -2256,7 +2256,7 @@ virHostdevGetNVMeDeviceList(virNVMeDeviceListPtr nvmeDevices,
continue;
if (!(dev = virNVMeDeviceNew(&srcNVMe->pciAddr,
- srcNVMe->namespace,
+ srcNVMe->namespc,
srcNVMe->managed)))
return -1;
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index fa37840532..2e54620139 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -2052,7 +2052,7 @@ virStorageSourceNVMeDefCopy(const virStorageSourceNVMeDef *src)
ret = g_new0(virStorageSourceNVMeDef, 1);
- ret->namespace = src->namespace;
+ ret->namespc = src->namespc;
ret->managed = src->managed;
virPCIDeviceAddressCopy(&ret->pciAddr, &src->pciAddr);
return ret;
@@ -2069,7 +2069,7 @@ virStorageSourceNVMeDefIsEqual(const virStorageSourceNVMeDef *a,
if (!a || !b)
return false;
- if (a->namespace != b->namespace ||
+ if (a->namespc != b->namespc ||
a->managed != b->managed ||
!virPCIDeviceAddressEqual(&a->pciAddr, &b->pciAddr))
return false;
diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h
index c1430cadd1..0230f44652 100644
--- a/src/util/virstoragefile.h
+++ b/src/util/virstoragefile.h
@@ -246,7 +246,7 @@ struct _virStorageSourceInitiatorDef {
typedef struct _virStorageSourceNVMeDef virStorageSourceNVMeDef;
typedef virStorageSourceNVMeDef *virStorageSourceNVMeDefPtr;
struct _virStorageSourceNVMeDef {
- unsigned long long namespace;
+ unsigned long long namespc;
int managed; /* enum virTristateBool */
virPCIDeviceAddress pciAddr;
--
2.26.0

View File

@ -1,83 +0,0 @@
From f52197675b2babfafb1b89058e3fd01decebd8ab Mon Sep 17 00:00:00 2001
Message-Id: <f52197675b2babfafb1b89058e3fd01decebd8ab@dist-git>
From: Laine Stump <laine@redhat.com>
Date: Sun, 26 Apr 2020 13:04:12 -0400
Subject: [PATCH] conf: simplify logic when checking for AUTOASSIGN PCI
addresses
Old behavior: If the address was manually provided by config, copy
device AUTOASSIGN flag into the bus flag, and then later on in the
function *always* check for a match of the flags (which will always
match if the address came from config, since we just copied it).
New behavior: Don't mess with the bus flags - just directly check if
the AUTOASSIGN flag matches in bus and dev, but only make the check if
the address didn't come from config (i.e. it was auto-assigned by
libvirt).
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit fcdf87d3ef14de9dfb0acaf4b4445e1580dfc629)
https://bugzilla.redhat.com/1802592
Signed-off-by: Laine Stump <laine@redhat.com>
Message-Id: <20200426170415.18328-10-laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
---
src/conf/domain_addr.c | 27 ++++++++++-----------------
1 file changed, 10 insertions(+), 17 deletions(-)
diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c
index 53be6cd34b..05f036e3e6 100644
--- a/src/conf/domain_addr.c
+++ b/src/conf/domain_addr.c
@@ -358,18 +358,22 @@ virDomainPCIAddressFlagsCompatible(virPCIDeviceAddressPtr addr,
*/
if (busFlags & VIR_PCI_CONNECT_TYPES_ENDPOINT)
busFlags |= VIR_PCI_CONNECT_TYPES_ENDPOINT;
- /* Also allow manual specification of bus to override
- * libvirt's assumptions about whether or not hotplug
- * capability will be required.
- */
- if (devFlags & VIR_PCI_CONNECT_AUTOASSIGN)
- busFlags |= VIR_PCI_CONNECT_AUTOASSIGN;
/* if the device is a pci-bridge, allow manually
* assigning to any bus that would also accept a
* standard PCI device.
*/
if (devFlags & VIR_PCI_CONNECT_TYPE_PCI_BRIDGE)
devFlags |= VIR_PCI_CONNECT_TYPE_PCI_DEVICE;
+ } else if ((devFlags & VIR_PCI_CONNECT_AUTOASSIGN) &&
+ !(busFlags & VIR_PCI_CONNECT_AUTOASSIGN)) {
+ if (reportError) {
+ virReportError(errType,
+ _("The device at PCI address %s was auto-assigned "
+ "this address, but the PCI controller "
+ "with index='%d' doesn't allow auto-assignment"),
+ addrStr, addr->bus);
+ }
+ return false;
}
/* If this bus doesn't allow the type of connection (PCI
@@ -419,17 +423,6 @@ virDomainPCIAddressFlagsCompatible(virPCIDeviceAddressPtr addr,
addrStr, addr->bus, connectStr);
return false;
}
- if ((devFlags & VIR_PCI_CONNECT_AUTOASSIGN) &&
- !(busFlags & VIR_PCI_CONNECT_AUTOASSIGN)) {
- if (reportError) {
- virReportError(errType,
- _("The device at PCI address %s requires "
- "hotplug capability, but the PCI controller "
- "with index='%d' doesn't support hotplug"),
- addrStr, addr->bus);
- }
- return false;
- }
return true;
}
--
2.26.2

View File

@ -1,89 +0,0 @@
From 75470b7c297be9bdd712282b89c48465dbe8d400 Mon Sep 17 00:00:00 2001
Message-Id: <75470b7c297be9bdd712282b89c48465dbe8d400@dist-git>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Fri, 21 May 2021 14:16:10 +0200
Subject: [PATCH] conf: use switch in virDomainDefParseBootOptions
The original code used a lot of conditions and was not that obvious
when each XML bits are parsed.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 6330be1ba3af5c4d2150fe2b831f7bc5d87c6d2a)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1929357
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Message-Id: <900c870b1720688123ed7b69850548ae308ea9a8.1621599207.git.phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
---
src/conf/domain_conf.c | 42 ++++++++++++++++++++++++++----------------
1 file changed, 26 insertions(+), 16 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index f8d8d33245..93a78f8277 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -19483,33 +19483,43 @@ virDomainDefParseBootOptions(virDomainDefPtr def,
* - An init script (exe)
*/
- if (def->os.type == VIR_DOMAIN_OSTYPE_EXE) {
- if (virDomainDefParseBootInitOptions(def, ctxt) < 0)
- return -1;
- }
-
- if (def->os.type == VIR_DOMAIN_OSTYPE_XEN ||
- def->os.type == VIR_DOMAIN_OSTYPE_XENPVH ||
- def->os.type == VIR_DOMAIN_OSTYPE_HVM ||
- def->os.type == VIR_DOMAIN_OSTYPE_UML) {
-
+ switch ((virDomainOSType) def->os.type) {
+ case VIR_DOMAIN_OSTYPE_HVM:
virDomainDefParseBootKernelOptions(def, ctxt);
- if (def->os.type == VIR_DOMAIN_OSTYPE_HVM) {
- if (virDomainDefParseBootFirmwareOptions(def, ctxt) < 0)
- return -1;
- }
+ if (virDomainDefParseBootFirmwareOptions(def, ctxt) < 0)
+ return -1;
if (virDomainDefParseBootLoaderOptions(def, ctxt) < 0)
return -1;
- }
- if (def->os.type == VIR_DOMAIN_OSTYPE_HVM) {
if (virDomainDefParseBootAcpiOptions(def, ctxt) < 0)
return -1;
if (virDomainDefParseBootXML(ctxt, def) < 0)
return -1;
+
+ break;
+
+ case VIR_DOMAIN_OSTYPE_XEN:
+ case VIR_DOMAIN_OSTYPE_XENPVH:
+ case VIR_DOMAIN_OSTYPE_UML:
+ virDomainDefParseBootKernelOptions(def, ctxt);
+
+ if (virDomainDefParseBootLoaderOptions(def, ctxt) < 0)
+ return -1;
+
+ break;
+
+ case VIR_DOMAIN_OSTYPE_EXE:
+ if (virDomainDefParseBootInitOptions(def, ctxt) < 0)
+ return -1;
+
+ break;
+
+ case VIR_DOMAIN_OSTYPE_LINUX:
+ case VIR_DOMAIN_OSTYPE_LAST:
+ break;
}
return 0;
--
2.31.1

View File

@ -1,70 +0,0 @@
From d77f180068dab8747f5e2c098a9c59213ce19108 Mon Sep 17 00:00:00 2001
Message-Id: <d77f180068dab8747f5e2c098a9c59213ce19108@dist-git>
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
Date: Wed, 4 Mar 2020 12:42:29 +0100
Subject: [PATCH] conf: use virXMLFormatElement in virDomainFSDefFormat
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Use the virXMLFormatElement helper to format the driver element
to simplify adding further sub-elements.
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
(cherry picked from commit 3efdbae5bf054d1a2bdc98fdccff0273abe54c88)
Signed-off-by: Ján Tomko <jtomko@redhat.com>
https://bugzilla.redhat.com/show_bug.cgi?id=1694166
Message-Id: <966ad0eebcb1ae5f20f59fc6cc84008bbfa6426f.1583322090.git.jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
---
src/conf/domain_conf.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 8a5f14d6cb..88117187c8 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -24991,7 +24991,7 @@ virDomainFSDefFormat(virBufferPtr buf,
const char *fsdriver = virDomainFSDriverTypeToString(def->fsdriver);
const char *wrpolicy = virDomainFSWrpolicyTypeToString(def->wrpolicy);
const char *src = def->src->path;
- g_auto(virBuffer) driverBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) driverAttrBuf = VIR_BUFFER_INITIALIZER;
if (!type) {
virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -25016,25 +25016,21 @@ virDomainFSDefFormat(virBufferPtr buf,
virBufferAdjustIndent(buf, 2);
if (def->fsdriver) {
- virBufferAsprintf(&driverBuf, " type='%s'", fsdriver);
+ virBufferAsprintf(&driverAttrBuf, " type='%s'", fsdriver);
if (def->format)
- virBufferAsprintf(&driverBuf, " format='%s'",
+ virBufferAsprintf(&driverAttrBuf, " format='%s'",
virStorageFileFormatTypeToString(def->format));
/* Don't generate anything if wrpolicy is set to default */
if (def->wrpolicy)
- virBufferAsprintf(&driverBuf, " wrpolicy='%s'", wrpolicy);
+ virBufferAsprintf(&driverAttrBuf, " wrpolicy='%s'", wrpolicy);
}
- virDomainVirtioOptionsFormat(&driverBuf, def->virtio);
+ virDomainVirtioOptionsFormat(&driverAttrBuf, def->virtio);
- if (virBufferUse(&driverBuf)) {
- virBufferAddLit(buf, "<driver");
- virBufferAddBuffer(buf, &driverBuf);
- virBufferAddLit(buf, "/>\n");
- }
+ virXMLFormatElement(buf, "driver", &driverAttrBuf, NULL);
switch (def->type) {
case VIR_DOMAIN_FS_TYPE_MOUNT:
--
2.25.1

View File

@ -1,53 +0,0 @@
From 2145d7b6f4370dfcd7dadae7daf544767cde0392 Mon Sep 17 00:00:00 2001
Message-Id: <2145d7b6f4370dfcd7dadae7daf544767cde0392@dist-git>
From: Jiri Denemark <jdenemar@redhat.com>
Date: Tue, 26 May 2020 10:58:51 +0200
Subject: [PATCH] cpu: Change control flow in virCPUUpdateLive
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The updateLive CPU sub-driver function is supposed to be called only for
a subset of CPU definitions. Let's make it more obvious by turning a
negative test and return into a positive check.
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit 68c0b85ecb07c8cefcf4f4a2ffc28e123baa9e8c)
https://bugzilla.redhat.com/show_bug.cgi?id=1839999
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Message-Id: <2633727669ca50970bd10abe9b045e24b76028d1.1590483392.git.jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/cpu/cpu.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c
index ae3a0acc10..1cb2dd04f4 100644
--- a/src/cpu/cpu.c
+++ b/src/cpu/cpu.c
@@ -647,13 +647,14 @@ virCPUUpdateLive(virArch arch,
if (!driver->updateLive)
return 1;
- if (cpu->mode != VIR_CPU_MODE_CUSTOM)
- return 1;
+ if (cpu->mode == VIR_CPU_MODE_CUSTOM) {
+ if (driver->updateLive(cpu, dataEnabled, dataDisabled) < 0)
+ return -1;
- if (driver->updateLive(cpu, dataEnabled, dataDisabled) < 0)
- return -1;
+ return 0;
+ }
- return 0;
+ return 1;
}
--
2.26.2

View File

@ -1,100 +0,0 @@
From 781e82d0330afe60ab1c366e43dfe8292fcf68eb Mon Sep 17 00:00:00 2001
Message-Id: <781e82d0330afe60ab1c366e43dfe8292fcf68eb@dist-git>
From: Jiri Denemark <jdenemar@redhat.com>
Date: Tue, 26 May 2020 10:58:53 +0200
Subject: [PATCH] cpu: Honor check='full' for host-passthrough CPUs
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The check attribute was completely ignored for host-passthrough CPUs
even if they explicitly requested some features to be enabled. For
example, a domain with the following CPU definition
<cpu mode='host-passthrough' check='full'>
<feature policy='require' name='svm'/>
</cpu>
would happily start even when 'svm' cannot be enabled.
Let's call virCPUArchUpdateLive for host-passthrough CPUs with
VIR_CPU_CHECK_FULL to make sure the architecture specific code can
validate the provided virtual CPU against the desired definition.
https://bugzilla.redhat.com/show_bug.cgi?id=1515677
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit ac36a824641862dcac057c6403b27ab1e91874f5)
https://bugzilla.redhat.com/show_bug.cgi?id=1839999
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Message-Id: <b8d30055a0df31c423d6c1832ca0bfbf3eafd222.1590483392.git.jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/cpu/cpu.c | 3 ++-
src/cpu/cpu_x86.c | 10 +++++++++-
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c
index 1cb2dd04f4..f2a0f560f6 100644
--- a/src/cpu/cpu.c
+++ b/src/cpu/cpu.c
@@ -647,7 +647,8 @@ virCPUUpdateLive(virArch arch,
if (!driver->updateLive)
return 1;
- if (cpu->mode == VIR_CPU_MODE_CUSTOM) {
+ if (cpu->mode == VIR_CPU_MODE_CUSTOM ||
+ cpu->check == VIR_CPU_CHECK_FULL) {
if (driver->updateLive(cpu, dataEnabled, dataDisabled) < 0)
return -1;
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index 9e686a86d2..8c865bdaa4 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -3009,8 +3009,10 @@ virCPUx86UpdateLive(virCPUDefPtr cpu,
virCPUDataPtr dataEnabled,
virCPUDataPtr dataDisabled)
{
+ bool hostPassthrough = cpu->mode == VIR_CPU_MODE_HOST_PASSTHROUGH;
virCPUx86MapPtr map;
virCPUx86ModelPtr model = NULL;
+ virCPUx86ModelPtr modelDisabled = NULL;
virCPUx86Data enabled = VIR_CPU_X86_DATA_INIT;
virCPUx86Data disabled = VIR_CPU_X86_DATA_INIT;
virBuffer bufAdded = VIR_BUFFER_INITIALIZER;
@@ -3026,6 +3028,10 @@ virCPUx86UpdateLive(virCPUDefPtr cpu,
if (!(model = x86ModelFromCPU(cpu, map, -1)))
goto cleanup;
+ if (hostPassthrough &&
+ !(modelDisabled = x86ModelFromCPU(cpu, map, VIR_CPU_FEATURE_DISABLE)))
+ goto cleanup;
+
if (dataEnabled &&
x86DataCopy(&enabled, &dataEnabled->data.x86) < 0)
goto cleanup;
@@ -3040,7 +3046,8 @@ virCPUx86UpdateLive(virCPUDefPtr cpu,
if (x86DataIsSubset(&model->data, &feature->data))
expected = VIR_CPU_FEATURE_REQUIRE;
- else
+ else if (!hostPassthrough ||
+ x86DataIsSubset(&modelDisabled->data, &feature->data))
expected = VIR_CPU_FEATURE_DISABLE;
if (expected == VIR_CPU_FEATURE_DISABLE &&
@@ -3101,6 +3108,7 @@ virCPUx86UpdateLive(virCPUDefPtr cpu,
cleanup:
x86ModelFree(model);
+ x86ModelFree(modelDisabled);
virCPUx86DataClear(&enabled);
virCPUx86DataClear(&disabled);
VIR_FREE(added);
--
2.26.2

View File

@ -1,41 +0,0 @@
From 4b8dbdb81eb6a755dc58b359e65b769ee1dc3f86 Mon Sep 17 00:00:00 2001
Message-Id: <4b8dbdb81eb6a755dc58b359e65b769ee1dc3f86@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Fri, 24 Jan 2020 15:05:49 +0100
Subject: [PATCH] cpu.c: Check properly for virCapabilitiesGetNodeInfo() retval
The virCapabilitiesGetNodeInfo() function has the usual return
value semantics for integeres: a negative value means an error,
zero or a positive value means success. However, the function
call done in virCPUProbeHost() doesn't check for the return value
accordingly.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
(cherry picked from commit 609acf1f5d5d666148355719346c8ee05f911e33)
https://bugzilla.redhat.com/show_bug.cgi?id=1794691
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Message-Id: <033f07f79bc9fa26f669c83f9aa790bfaef25b93.1579874719.git.mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
---
src/cpu/cpu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c
index a2ae5b8c07..d99466472b 100644
--- a/src/cpu/cpu.c
+++ b/src/cpu/cpu.c
@@ -455,7 +455,7 @@ virCPUProbeHost(virArch arch)
{
virNodeInfo nodeinfo;
- if (virCapabilitiesGetNodeInfo(&nodeinfo))
+ if (virCapabilitiesGetNodeInfo(&nodeinfo) < 0)
return NULL;
return virCPUGetHost(arch, VIR_CPU_TYPE_HOST, &nodeinfo, NULL);
--
2.25.0

View File

@ -1,80 +0,0 @@
From 37b27a297ecb87e65f41c212aaabde7311b042d6 Mon Sep 17 00:00:00 2001
Message-Id: <37b27a297ecb87e65f41c212aaabde7311b042d6@dist-git>
From: Jiri Denemark <jdenemar@redhat.com>
Date: Thu, 20 Feb 2020 09:08:05 +0100
Subject: [PATCH] cpu_conf: Format vendor_id for host-model CPUs
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
In commit v5.9.0-400-gaf8e39921a I removed printing model's fallback and
vendor_id attributes when no model is specified. However, vendor_id
makes sense even without a specific CPU model (for host-model CPUs).
https://bugzilla.redhat.com/show_bug.cgi?id=1804549
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit 0905f222f1bfd9d741e94a8d653e05bb174846d3)
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Message-Id: <0b46ae9e26d1c7dbaa7f2dd58fd1156db237a853.1582186015.git.jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/conf/cpu_conf.c | 14 +++++++++-----
tests/qemuxml2xmloutdata/cpu-host-model-vendor.xml | 4 +++-
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
index 837d77581c..1a2948ce11 100644
--- a/src/conf/cpu_conf.c
+++ b/src/conf/cpu_conf.c
@@ -791,10 +791,10 @@ virCPUDefFormatBuf(virBufferPtr buf,
return -1;
}
- if (formatModel && def->model) {
+ if (formatModel && (def->model || def->vendor_id)) {
virBufferAddLit(buf, "<model");
- if (def->type == VIR_CPU_TYPE_GUEST) {
+ if (def->type == VIR_CPU_TYPE_GUEST && def->model) {
const char *fallback;
fallback = virCPUFallbackTypeToString(def->fallback);
@@ -805,11 +805,15 @@ virCPUDefFormatBuf(virBufferPtr buf,
return -1;
}
virBufferAsprintf(buf, " fallback='%s'", fallback);
- if (def->vendor_id)
- virBufferEscapeString(buf, " vendor_id='%s'", def->vendor_id);
}
- virBufferEscapeString(buf, ">%s</model>\n", def->model);
+ if (def->type == VIR_CPU_TYPE_GUEST)
+ virBufferEscapeString(buf, " vendor_id='%s'", def->vendor_id);
+
+ if (def->model)
+ virBufferEscapeString(buf, ">%s</model>\n", def->model);
+ else
+ virBufferAddLit(buf, "/>\n");
}
if (formatModel && def->vendor)
diff --git a/tests/qemuxml2xmloutdata/cpu-host-model-vendor.xml b/tests/qemuxml2xmloutdata/cpu-host-model-vendor.xml
index d2447ccd10..2a7d0246cc 100644
--- a/tests/qemuxml2xmloutdata/cpu-host-model-vendor.xml
+++ b/tests/qemuxml2xmloutdata/cpu-host-model-vendor.xml
@@ -8,7 +8,9 @@
<type arch='x86_64' machine='pc'>hvm</type>
<boot dev='network'/>
</os>
- <cpu mode='host-model' check='partial'/>
+ <cpu mode='host-model' check='partial'>
+ <model vendor_id='Libvirt QEMU'/>
+ </cpu>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
--
2.25.0

View File

@ -1,289 +0,0 @@
From 1c8af21807f2cdaaa24651808f6dfeebfbcf75bb Mon Sep 17 00:00:00 2001
Message-Id: <1c8af21807f2cdaaa24651808f6dfeebfbcf75bb@dist-git>
From: Jiri Denemark <jdenemar@redhat.com>
Date: Tue, 26 May 2020 10:59:40 +0200
Subject: [PATCH] cpu_map: Add Cooperlake x86 CPU model
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The stepping range (10-11) is likely incomplete. QEMU uses 10 and the
CPUID data for Cooperlake show 11. We will update the range if needed
once more details about he CPU are available.
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
(cherry picked from commit 3944f6855b9d4df73754bb6e5c8023d77399879b)
https://bugzilla.redhat.com/show_bug.cgi?id=1781878
Conflicts:
tests/domaincapsdata/qemu_5.1.0-q35.x86_64.xml
tests/domaincapsdata/qemu_5.1.0-tcg.x86_64.xml
tests/domaincapsdata/qemu_5.1.0.x86_64.xml
- test data files do not exist downstream
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Message-Id: <62f2fa3e2ecab2026c41e93430b4e2b695c674f0.1590483392.git.jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/cpu_map/index.xml | 1 +
src/cpu_map/x86_Cooperlake.xml | 90 +++++++++++++++++++
.../x86_64-cpuid-Cooperlake-guest.xml | 13 +--
.../x86_64-cpuid-Cooperlake-host.xml | 13 +--
.../x86_64-cpuid-Cooperlake-json.xml | 13 +--
.../domaincapsdata/qemu_5.0.0-q35.x86_64.xml | 1 +
.../domaincapsdata/qemu_5.0.0-tcg.x86_64.xml | 1 +
tests/domaincapsdata/qemu_5.0.0.x86_64.xml | 1 +
8 files changed, 100 insertions(+), 33 deletions(-)
create mode 100644 src/cpu_map/x86_Cooperlake.xml
diff --git a/src/cpu_map/index.xml b/src/cpu_map/index.xml
index 50b030de29..ff1da2e677 100644
--- a/src/cpu_map/index.xml
+++ b/src/cpu_map/index.xml
@@ -54,6 +54,7 @@
<include filename="x86_Icelake-Client-noTSX.xml"/>
<include filename="x86_Icelake-Server.xml"/>
<include filename="x86_Icelake-Server-noTSX.xml"/>
+ <include filename="x86_Cooperlake.xml"/>
<!-- AMD CPUs -->
<include filename="x86_athlon.xml"/>
diff --git a/src/cpu_map/x86_Cooperlake.xml b/src/cpu_map/x86_Cooperlake.xml
new file mode 100644
index 0000000000..41bd210638
--- /dev/null
+++ b/src/cpu_map/x86_Cooperlake.xml
@@ -0,0 +1,90 @@
+<cpus>
+ <model name='Cooperlake'>
+ <decode host='on' guest='on'/>
+ <signature family='6' model='85' stepping='10-11'/> <!-- 05065b -->
+ <vendor name='Intel'/>
+ <feature name="3dnowprefetch"/>
+ <feature name="abm"/>
+ <feature name="adx"/>
+ <feature name="aes"/>
+ <feature name="apic"/>
+ <feature name="arat"/>
+ <feature name="arch-capabilities"/>
+ <feature name="avx"/>
+ <feature name="avx2"/>
+ <feature name="avx512-bf16"/>
+ <feature name="avx512bw"/>
+ <feature name="avx512cd"/>
+ <feature name="avx512dq"/>
+ <feature name="avx512f"/>
+ <feature name="avx512vl"/>
+ <feature name="avx512vnni"/>
+ <feature name="bmi1"/>
+ <feature name="bmi2"/>
+ <feature name="clflush"/>
+ <feature name="clflushopt"/>
+ <feature name="clwb"/>
+ <feature name="cmov"/>
+ <feature name="cx16"/>
+ <feature name="cx8"/>
+ <feature name="de"/>
+ <feature name="erms"/>
+ <feature name="f16c"/>
+ <feature name="fma"/>
+ <feature name="fpu"/>
+ <feature name="fsgsbase"/>
+ <feature name="fxsr"/>
+ <feature name="hle"/>
+ <feature name="ibrs-all"/>
+ <feature name="invpcid"/>
+ <feature name="lahf_lm"/>
+ <feature name="lm"/>
+ <feature name="mca"/>
+ <feature name="mce"/>
+ <feature name="mds-no"/>
+ <feature name="mmx"/>
+ <feature name="movbe"/>
+ <feature name="msr"/>
+ <feature name="mtrr"/>
+ <feature name="nx"/>
+ <feature name="pae"/>
+ <feature name="pat"/>
+ <feature name="pcid"/>
+ <feature name="pclmuldq"/>
+ <feature name="pdpe1gb"/>
+ <feature name="pge"/>
+ <feature name="pku"/>
+ <feature name="pni"/>
+ <feature name="popcnt"/>
+ <feature name="pschange-mc-no"/>
+ <feature name="pse"/>
+ <feature name="pse36"/>
+ <feature name="rdctl-no"/>
+ <feature name="rdrand"/>
+ <feature name="rdseed"/>
+ <feature name="rdtscp"/>
+ <feature name="rtm"/>
+ <feature name="sep"/>
+ <feature name="skip-l1dfl-vmentry"/>
+ <feature name="smap"/>
+ <feature name="smep"/>
+ <feature name="spec-ctrl"/>
+ <feature name="ssbd"/>
+ <feature name="sse"/>
+ <feature name="sse2"/>
+ <feature name="sse4.1"/>
+ <feature name="sse4.2"/>
+ <feature name="ssse3"/>
+ <feature name="stibp"/>
+ <feature name="syscall"/>
+ <feature name="taa-no"/>
+ <feature name="tsc"/>
+ <feature name="tsc-deadline"/>
+ <feature name="vme"/>
+ <feature name="x2apic"/>
+ <feature name="xgetbv1"/>
+ <feature name="xsave"/>
+ <feature name="xsavec"/>
+ <feature name="xsaveopt"/>
+ </model>
+</cpus>
diff --git a/tests/cputestdata/x86_64-cpuid-Cooperlake-guest.xml b/tests/cputestdata/x86_64-cpuid-Cooperlake-guest.xml
index db5598740c..f169458399 100644
--- a/tests/cputestdata/x86_64-cpuid-Cooperlake-guest.xml
+++ b/tests/cputestdata/x86_64-cpuid-Cooperlake-guest.xml
@@ -1,5 +1,5 @@
<cpu mode='custom' match='exact'>
- <model fallback='forbid'>Cascadelake-Server</model>
+ <model fallback='forbid'>Cooperlake</model>
<vendor>Intel</vendor>
<feature policy='require' name='ds'/>
<feature policy='require' name='acpi'/>
@@ -20,22 +20,13 @@
<feature policy='require' name='osxsave'/>
<feature policy='require' name='tsc_adjust'/>
<feature policy='require' name='cmt'/>
+ <feature policy='require' name='mpx'/>
<feature policy='require' name='intel-pt'/>
- <feature policy='require' name='pku'/>
<feature policy='require' name='ospke'/>
<feature policy='require' name='md-clear'/>
- <feature policy='require' name='stibp'/>
- <feature policy='require' name='arch-capabilities'/>
- <feature policy='require' name='avx512-bf16'/>
<feature policy='require' name='xsaves'/>
<feature policy='require' name='mbm_total'/>
<feature policy='require' name='mbm_local'/>
<feature policy='require' name='invtsc'/>
- <feature policy='require' name='rdctl-no'/>
- <feature policy='require' name='ibrs-all'/>
- <feature policy='require' name='skip-l1dfl-vmentry'/>
- <feature policy='require' name='mds-no'/>
- <feature policy='require' name='pschange-mc-no'/>
<feature policy='require' name='tsx-ctrl'/>
- <feature policy='require' name='taa-no'/>
</cpu>
diff --git a/tests/cputestdata/x86_64-cpuid-Cooperlake-host.xml b/tests/cputestdata/x86_64-cpuid-Cooperlake-host.xml
index 6926b7c975..b0777181bb 100644
--- a/tests/cputestdata/x86_64-cpuid-Cooperlake-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Cooperlake-host.xml
@@ -1,6 +1,6 @@
<cpu>
<arch>x86_64</arch>
- <model>Cascadelake-Server</model>
+ <model>Cooperlake</model>
<vendor>Intel</vendor>
<feature name='ds'/>
<feature name='acpi'/>
@@ -21,22 +21,13 @@
<feature name='osxsave'/>
<feature name='tsc_adjust'/>
<feature name='cmt'/>
+ <feature name='mpx'/>
<feature name='intel-pt'/>
- <feature name='pku'/>
<feature name='ospke'/>
<feature name='md-clear'/>
- <feature name='stibp'/>
- <feature name='arch-capabilities'/>
- <feature name='avx512-bf16'/>
<feature name='xsaves'/>
<feature name='mbm_total'/>
<feature name='mbm_local'/>
<feature name='invtsc'/>
- <feature name='rdctl-no'/>
- <feature name='ibrs-all'/>
- <feature name='skip-l1dfl-vmentry'/>
- <feature name='mds-no'/>
- <feature name='pschange-mc-no'/>
<feature name='tsx-ctrl'/>
- <feature name='taa-no'/>
</cpu>
diff --git a/tests/cputestdata/x86_64-cpuid-Cooperlake-json.xml b/tests/cputestdata/x86_64-cpuid-Cooperlake-json.xml
index fc52805b2f..fb319d547c 100644
--- a/tests/cputestdata/x86_64-cpuid-Cooperlake-json.xml
+++ b/tests/cputestdata/x86_64-cpuid-Cooperlake-json.xml
@@ -1,24 +1,15 @@
<cpu mode='custom' match='exact'>
- <model fallback='forbid'>Cascadelake-Server</model>
+ <model fallback='forbid'>Cooperlake</model>
<vendor>Intel</vendor>
<feature policy='require' name='ss'/>
<feature policy='require' name='vmx'/>
<feature policy='require' name='hypervisor'/>
<feature policy='require' name='tsc_adjust'/>
+ <feature policy='require' name='mpx'/>
<feature policy='require' name='umip'/>
- <feature policy='require' name='pku'/>
<feature policy='require' name='md-clear'/>
- <feature policy='require' name='stibp'/>
- <feature policy='require' name='arch-capabilities'/>
- <feature policy='require' name='avx512-bf16'/>
<feature policy='require' name='xsaves'/>
<feature policy='require' name='ibpb'/>
<feature policy='require' name='amd-ssbd'/>
- <feature policy='require' name='rdctl-no'/>
- <feature policy='require' name='ibrs-all'/>
- <feature policy='require' name='skip-l1dfl-vmentry'/>
- <feature policy='require' name='mds-no'/>
- <feature policy='require' name='pschange-mc-no'/>
<feature policy='require' name='tsx-ctrl'/>
- <feature policy='require' name='taa-no'/>
</cpu>
diff --git a/tests/domaincapsdata/qemu_5.0.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_5.0.0-q35.x86_64.xml
index b7e2c8a4fe..7bfd786ff6 100644
--- a/tests/domaincapsdata/qemu_5.0.0-q35.x86_64.xml
+++ b/tests/domaincapsdata/qemu_5.0.0-q35.x86_64.xml
@@ -93,6 +93,7 @@
<model usable='no'>EPYC-IBPB</model>
<model usable='no'>EPYC</model>
<model usable='no'>Dhyana</model>
+ <model usable='no'>Cooperlake</model>
<model usable='yes'>Conroe</model>
<model usable='no'>Cascadelake-Server-noTSX</model>
<model usable='no'>Cascadelake-Server</model>
diff --git a/tests/domaincapsdata/qemu_5.0.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_5.0.0-tcg.x86_64.xml
index d634803b29..0a4bb16a89 100644
--- a/tests/domaincapsdata/qemu_5.0.0-tcg.x86_64.xml
+++ b/tests/domaincapsdata/qemu_5.0.0-tcg.x86_64.xml
@@ -101,6 +101,7 @@
<model usable='no'>EPYC-IBPB</model>
<model usable='no'>EPYC</model>
<model usable='no'>Dhyana</model>
+ <model usable='no'>Cooperlake</model>
<model usable='yes'>Conroe</model>
<model usable='no'>Cascadelake-Server-noTSX</model>
<model usable='no'>Cascadelake-Server</model>
diff --git a/tests/domaincapsdata/qemu_5.0.0.x86_64.xml b/tests/domaincapsdata/qemu_5.0.0.x86_64.xml
index d2741375b4..d6ee66ab60 100644
--- a/tests/domaincapsdata/qemu_5.0.0.x86_64.xml
+++ b/tests/domaincapsdata/qemu_5.0.0.x86_64.xml
@@ -92,6 +92,7 @@
<model usable='no'>EPYC-IBPB</model>
<model usable='no'>EPYC</model>
<model usable='no'>Dhyana</model>
+ <model usable='no'>Cooperlake</model>
<model usable='yes'>Conroe</model>
<model usable='no'>Cascadelake-Server-noTSX</model>
<model usable='no'>Cascadelake-Server</model>
--
2.26.2

View File

@ -1,145 +0,0 @@
From b5716d1b191eb52cd88d7b94cb9bf0186f3e427b Mon Sep 17 00:00:00 2001
Message-Id: <b5716d1b191eb52cd88d7b94cb9bf0186f3e427b@dist-git>
From: Jiri Denemark <jdenemar@redhat.com>
Date: Wed, 3 Mar 2021 11:11:54 +0100
Subject: [PATCH] cpu_map: Add EPYC-Milan x86 CPU model
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Introduced in QEMU 6.0.0 by 623972ceae091b31331ae4a1dc94fe5cbb891937
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit f321a4822e9fa6542e48a78611989ecd9acaa83a)
https://bugzilla.redhat.com/show_bug.cgi?id=1926864
Conflicts:
src/cpu_map/index.xml
- context: commit 82bebba1803c63a733e17f5ab2618e020e4abd8d
"cpu_map: Unify apostrophe and quotation mark usage" was
not backported
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Message-Id: <715abc0f90faafb7daa193dd24bad65046c36de0.1614766279.git.jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/cpu_map/index.xml | 1 +
src/cpu_map/x86_EPYC-Milan.xml | 92 ++++++++++++++++++++++++++++++++++
2 files changed, 93 insertions(+)
create mode 100644 src/cpu_map/x86_EPYC-Milan.xml
diff --git a/src/cpu_map/index.xml b/src/cpu_map/index.xml
index 2f58261e6d..c3dda794b1 100644
--- a/src/cpu_map/index.xml
+++ b/src/cpu_map/index.xml
@@ -68,6 +68,7 @@
<include filename="x86_EPYC.xml"/>
<include filename="x86_EPYC-IBPB.xml"/>
<include filename="x86_EPYC-Rome.xml"/>
+ <include filename='x86_EPYC-Milan.xml'/>
<!-- Hygon CPU models -->
<include filename="x86_Dhyana.xml"/>
diff --git a/src/cpu_map/x86_EPYC-Milan.xml b/src/cpu_map/x86_EPYC-Milan.xml
new file mode 100644
index 0000000000..53f0cd6aac
--- /dev/null
+++ b/src/cpu_map/x86_EPYC-Milan.xml
@@ -0,0 +1,92 @@
+<cpus>
+ <model name='EPYC-Milan'>
+ <decode host='on' guest='on'/>
+ <signature family='25' model='1'/>
+ <vendor name='AMD'/>
+ <feature name='3dnowprefetch'/>
+ <feature name='abm'/>
+ <feature name='adx'/>
+ <feature name='aes'/>
+ <feature name='amd-ssbd'/>
+ <feature name='amd-stibp'/>
+ <feature name='apic'/>
+ <feature name='arat'/>
+ <feature name='avx'/>
+ <feature name='avx2'/>
+ <feature name='bmi1'/>
+ <feature name='bmi2'/>
+ <feature name='clflush'/>
+ <feature name='clflushopt'/>
+ <feature name='clwb'/>
+ <feature name='clzero'/>
+ <feature name='cmov'/>
+ <feature name='cr8legacy'/>
+ <feature name='cx16'/>
+ <feature name='cx8'/>
+ <feature name='de'/>
+ <feature name='erms'/>
+ <feature name='f16c'/>
+ <feature name='fma'/>
+ <feature name='fpu'/>
+ <feature name='fsgsbase'/>
+ <feature name='fsrm'/>
+ <feature name='fxsr'/>
+ <feature name='fxsr_opt'/>
+ <feature name='ibpb'/>
+ <feature name='ibrs'/>
+ <feature name='invpcid'/>
+ <feature name='lahf_lm'/>
+ <feature name='lm'/>
+ <feature name='mca'/>
+ <feature name='mce'/>
+ <feature name='misalignsse'/>
+ <feature name='mmx'/>
+ <feature name='mmxext'/>
+ <feature name='movbe'/>
+ <feature name='msr'/>
+ <feature name='mtrr'/>
+ <feature name='npt'/>
+ <feature name='nrip-save'/>
+ <feature name='nx'/>
+ <feature name='osvw'/>
+ <feature name='pae'/>
+ <feature name='pat'/>
+ <feature name='pcid'/>
+ <feature name='pclmuldq'/>
+ <feature name='pdpe1gb'/>
+ <feature name='perfctr_core'/>
+ <feature name='pge'/>
+ <feature name='pku'/>
+ <feature name='pni'/>
+ <feature name='popcnt'/>
+ <feature name='pse'/>
+ <feature name='pse36'/>
+ <feature name='rdpid'/>
+ <feature name='rdrand'/>
+ <feature name='rdseed'/>
+ <feature name='rdtscp'/>
+ <feature name='sep'/>
+ <feature name='sha-ni'/>
+ <feature name='smap'/>
+ <feature name='smep'/>
+ <feature name='sse'/>
+ <feature name='sse2'/>
+ <feature name='sse4.1'/>
+ <feature name='sse4.2'/>
+ <feature name='sse4a'/>
+ <feature name='ssse3'/>
+ <feature name='svm'/>
+ <feature name='svme-addr-check'/>
+ <feature name='syscall'/>
+ <feature name='tsc'/>
+ <feature name='umip'/>
+ <feature name='vme'/>
+ <feature name='wbnoinvd'/>
+ <feature name='xgetbv1'/>
+ <feature name='xsave'/>
+ <feature name='xsavec'/>
+ <feature name='xsaveerptr'/>
+ <feature name='xsaveopt'/>
+ <feature name='xsaves'/>
+ </model>
+</cpus>
--
2.30.0

View File

@ -1,749 +0,0 @@
From 4658a565f5536002c3a65e942eed0d877cd1d070 Mon Sep 17 00:00:00 2001
Message-Id: <4658a565f5536002c3a65e942eed0d877cd1d070@dist-git>
From: Jiri Denemark <jdenemar@redhat.com>
Date: Tue, 26 May 2020 10:58:56 +0200
Subject: [PATCH] cpu_map: Add <decode> element to x86 CPU model definitions
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The element specifies whether a particular CPU model can be used when
creating a CPU definition from raw CPUID/MSR data. The @host attribute
determines whether the CPU model can be used (host='on') for creating
CPU definition for host capabilities. Usability of the model for domain
capabilities and host-model CPU definitions is controlled by the @guest
attribute.
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Tested-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
(cherry picked from commit f4914045c2bff46b120c6c2af80066d24e48b609)
https://bugzilla.redhat.com/show_bug.cgi?id=1840008
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Message-Id: <3097db79eff1e45257ef12f891e8f9243bc8580f.1590483392.git.jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/cpu/cpu_x86.c | 43 +++++++++++++++++++
src/cpu_map/x86_486.xml | 1 +
src/cpu_map/x86_Broadwell-IBRS.xml | 1 +
src/cpu_map/x86_Broadwell-noTSX-IBRS.xml | 1 +
src/cpu_map/x86_Broadwell-noTSX.xml | 1 +
src/cpu_map/x86_Broadwell.xml | 1 +
src/cpu_map/x86_Cascadelake-Server-noTSX.xml | 1 +
src/cpu_map/x86_Cascadelake-Server.xml | 1 +
src/cpu_map/x86_Conroe.xml | 1 +
src/cpu_map/x86_Dhyana.xml | 1 +
src/cpu_map/x86_EPYC-IBPB.xml | 1 +
src/cpu_map/x86_EPYC.xml | 1 +
src/cpu_map/x86_Haswell-IBRS.xml | 1 +
src/cpu_map/x86_Haswell-noTSX-IBRS.xml | 1 +
src/cpu_map/x86_Haswell-noTSX.xml | 1 +
src/cpu_map/x86_Haswell.xml | 1 +
src/cpu_map/x86_Icelake-Client-noTSX.xml | 1 +
src/cpu_map/x86_Icelake-Client.xml | 1 +
src/cpu_map/x86_Icelake-Server-noTSX.xml | 1 +
src/cpu_map/x86_Icelake-Server.xml | 1 +
src/cpu_map/x86_IvyBridge-IBRS.xml | 1 +
src/cpu_map/x86_IvyBridge.xml | 1 +
src/cpu_map/x86_Nehalem-IBRS.xml | 1 +
src/cpu_map/x86_Nehalem.xml | 1 +
src/cpu_map/x86_Opteron_G1.xml | 1 +
src/cpu_map/x86_Opteron_G2.xml | 1 +
src/cpu_map/x86_Opteron_G3.xml | 1 +
src/cpu_map/x86_Opteron_G4.xml | 1 +
src/cpu_map/x86_Opteron_G5.xml | 1 +
src/cpu_map/x86_Penryn.xml | 1 +
src/cpu_map/x86_SandyBridge-IBRS.xml | 1 +
src/cpu_map/x86_SandyBridge.xml | 1 +
src/cpu_map/x86_Skylake-Client-IBRS.xml | 1 +
src/cpu_map/x86_Skylake-Client-noTSX-IBRS.xml | 1 +
src/cpu_map/x86_Skylake-Client.xml | 1 +
src/cpu_map/x86_Skylake-Server-IBRS.xml | 1 +
src/cpu_map/x86_Skylake-Server-noTSX-IBRS.xml | 1 +
src/cpu_map/x86_Skylake-Server.xml | 1 +
src/cpu_map/x86_Westmere-IBRS.xml | 1 +
src/cpu_map/x86_Westmere.xml | 1 +
src/cpu_map/x86_athlon.xml | 1 +
src/cpu_map/x86_core2duo.xml | 1 +
src/cpu_map/x86_coreduo.xml | 1 +
src/cpu_map/x86_cpu64-rhel5.xml | 1 +
src/cpu_map/x86_cpu64-rhel6.xml | 1 +
src/cpu_map/x86_kvm32.xml | 1 +
src/cpu_map/x86_kvm64.xml | 1 +
src/cpu_map/x86_n270.xml | 1 +
src/cpu_map/x86_pentium.xml | 1 +
src/cpu_map/x86_pentium2.xml | 1 +
src/cpu_map/x86_pentium3.xml | 1 +
src/cpu_map/x86_pentiumpro.xml | 1 +
src/cpu_map/x86_phenom.xml | 1 +
src/cpu_map/x86_qemu32.xml | 1 +
src/cpu_map/x86_qemu64.xml | 1 +
55 files changed, 97 insertions(+)
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index 8c865bdaa4..7fbb4c9a6c 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -125,6 +125,8 @@ typedef struct _virCPUx86Model virCPUx86Model;
typedef virCPUx86Model *virCPUx86ModelPtr;
struct _virCPUx86Model {
char *name;
+ bool decodeHost;
+ bool decodeGuest;
virCPUx86VendorPtr vendor;
size_t nsignatures;
uint32_t *signatures;
@@ -1347,6 +1349,44 @@ x86ModelCompare(virCPUx86ModelPtr model1,
}
+static int
+x86ModelParseDecode(virCPUx86ModelPtr model,
+ xmlXPathContextPtr ctxt)
+{
+ g_autofree char *host = NULL;
+ g_autofree char *guest = NULL;
+ int val;
+
+ if ((host = virXPathString("string(./decode/@host)", ctxt)))
+ val = virTristateSwitchTypeFromString(host);
+ else
+ val = VIR_TRISTATE_SWITCH_ABSENT;
+
+ if (val <= 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("invalid or missing decode/host attribute in CPU model %s"),
+ model->name);
+ return -1;
+ }
+ model->decodeHost = val == VIR_TRISTATE_SWITCH_ON;
+
+ if ((guest = virXPathString("string(./decode/@guest)", ctxt)))
+ val = virTristateSwitchTypeFromString(guest);
+ else
+ val = VIR_TRISTATE_SWITCH_ABSENT;
+
+ if (val <= 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("invalid or missing decode/guest attribute in CPU model %s"),
+ model->name);
+ return -1;
+ }
+ model->decodeGuest = val == VIR_TRISTATE_SWITCH_ON;
+
+ return 0;
+}
+
+
static int
x86ModelParseAncestor(virCPUx86ModelPtr model,
xmlXPathContextPtr ctxt,
@@ -1521,6 +1561,9 @@ x86ModelParse(xmlXPathContextPtr ctxt,
model->name = g_strdup(name);
+ if (x86ModelParseDecode(model, ctxt) < 0)
+ goto cleanup;
+
if (x86ModelParseAncestor(model, ctxt, map) < 0)
goto cleanup;
diff --git a/src/cpu_map/x86_486.xml b/src/cpu_map/x86_486.xml
index 61fa3797e8..d05b277392 100644
--- a/src/cpu_map/x86_486.xml
+++ b/src/cpu_map/x86_486.xml
@@ -1,5 +1,6 @@
<cpus>
<model name='486'>
+ <decode host='on' guest='on'/>
<feature name='fpu'/>
<feature name='pse'/>
<feature name='vme'/>
diff --git a/src/cpu_map/x86_Broadwell-IBRS.xml b/src/cpu_map/x86_Broadwell-IBRS.xml
index 4600cacec0..9033d5fcd5 100644
--- a/src/cpu_map/x86_Broadwell-IBRS.xml
+++ b/src/cpu_map/x86_Broadwell-IBRS.xml
@@ -1,5 +1,6 @@
<cpus>
<model name='Broadwell-IBRS'>
+ <decode host='on' guest='on'/>
<signature family='6' model='61'/> <!-- 0306d0 -->
<signature family='6' model='71'/> <!-- 040670 -->
<signature family='6' model='79'/> <!-- 0406f0 -->
diff --git a/src/cpu_map/x86_Broadwell-noTSX-IBRS.xml b/src/cpu_map/x86_Broadwell-noTSX-IBRS.xml
index b3fc0b726a..c044b60e36 100644
--- a/src/cpu_map/x86_Broadwell-noTSX-IBRS.xml
+++ b/src/cpu_map/x86_Broadwell-noTSX-IBRS.xml
@@ -1,5 +1,6 @@
<cpus>
<model name='Broadwell-noTSX-IBRS'>
+ <decode host='on' guest='on'/>
<signature family='6' model='61'/> <!-- 0306d0 -->
<signature family='6' model='71'/> <!-- 040670 -->
<signature family='6' model='79'/> <!-- 0406f0 -->
diff --git a/src/cpu_map/x86_Broadwell-noTSX.xml b/src/cpu_map/x86_Broadwell-noTSX.xml
index ad932d0853..637f29ba1c 100644
--- a/src/cpu_map/x86_Broadwell-noTSX.xml
+++ b/src/cpu_map/x86_Broadwell-noTSX.xml
@@ -1,5 +1,6 @@
<cpus>
<model name='Broadwell-noTSX'>
+ <decode host='on' guest='on'/>
<signature family='6' model='61'/> <!-- 0306d0 -->
<signature family='6' model='71'/> <!-- 040670 -->
<signature family='6' model='79'/> <!-- 0406f0 -->
diff --git a/src/cpu_map/x86_Broadwell.xml b/src/cpu_map/x86_Broadwell.xml
index 6de9227322..82939a4509 100644
--- a/src/cpu_map/x86_Broadwell.xml
+++ b/src/cpu_map/x86_Broadwell.xml
@@ -1,5 +1,6 @@
<cpus>
<model name='Broadwell'>
+ <decode host='on' guest='on'/>
<signature family='6' model='61'/> <!-- 0306d0 -->
<signature family='6' model='71'/> <!-- 040670 -->
<signature family='6' model='79'/> <!-- 0406f0 -->
diff --git a/src/cpu_map/x86_Cascadelake-Server-noTSX.xml b/src/cpu_map/x86_Cascadelake-Server-noTSX.xml
index d24415ebce..5adea664e9 100644
--- a/src/cpu_map/x86_Cascadelake-Server-noTSX.xml
+++ b/src/cpu_map/x86_Cascadelake-Server-noTSX.xml
@@ -1,5 +1,6 @@
<cpus>
<model name='Cascadelake-Server-noTSX'>
+ <decode host='on' guest='on'/>
<signature family='6' model='85'/> <!-- 050654 -->
<vendor name='Intel'/>
<feature name='3dnowprefetch'/>
diff --git a/src/cpu_map/x86_Cascadelake-Server.xml b/src/cpu_map/x86_Cascadelake-Server.xml
index b69ac198b6..d7ec42f57e 100644
--- a/src/cpu_map/x86_Cascadelake-Server.xml
+++ b/src/cpu_map/x86_Cascadelake-Server.xml
@@ -1,5 +1,6 @@
<cpus>
<model name='Cascadelake-Server'>
+ <decode host='on' guest='on'/>
<signature family='6' model='85'/> <!-- 050654 -->
<vendor name='Intel'/>
<feature name='3dnowprefetch'/>
diff --git a/src/cpu_map/x86_Conroe.xml b/src/cpu_map/x86_Conroe.xml
index 89fe0ad2cf..4cacee6142 100644
--- a/src/cpu_map/x86_Conroe.xml
+++ b/src/cpu_map/x86_Conroe.xml
@@ -1,5 +1,6 @@
<cpus>
<model name='Conroe'>
+ <decode host='on' guest='on'/>
<signature family='6' model='15'/> <!-- 0006f0 -->
<signature family='6' model='22'/> <!-- 010660 -->
<vendor name='Intel'/>
diff --git a/src/cpu_map/x86_Dhyana.xml b/src/cpu_map/x86_Dhyana.xml
index cbc8020a94..689daf8649 100644
--- a/src/cpu_map/x86_Dhyana.xml
+++ b/src/cpu_map/x86_Dhyana.xml
@@ -1,5 +1,6 @@
<cpus>
<model name='Dhyana'>
+ <decode host='on' guest='on'/>
<signature family='24' model='0'/> <!-- 900f00 -->
<vendor name='Hygon'/>
<feature name='3dnowprefetch'/>
diff --git a/src/cpu_map/x86_EPYC-IBPB.xml b/src/cpu_map/x86_EPYC-IBPB.xml
index 283697ebd1..983c5f4445 100644
--- a/src/cpu_map/x86_EPYC-IBPB.xml
+++ b/src/cpu_map/x86_EPYC-IBPB.xml
@@ -1,5 +1,6 @@
<cpus>
<model name='EPYC-IBPB'>
+ <decode host='on' guest='on'/>
<signature family='23' model='1'/> <!-- 800f10 -->
<vendor name='AMD'/>
<feature name='3dnowprefetch'/>
diff --git a/src/cpu_map/x86_EPYC.xml b/src/cpu_map/x86_EPYC.xml
index f0601392fd..3ebba9f4ed 100644
--- a/src/cpu_map/x86_EPYC.xml
+++ b/src/cpu_map/x86_EPYC.xml
@@ -1,5 +1,6 @@
<cpus>
<model name='EPYC'>
+ <decode host='on' guest='on'/>
<signature family='23' model='1'/> <!-- 800f10 -->
<vendor name='AMD'/>
<feature name='3dnowprefetch'/>
diff --git a/src/cpu_map/x86_Haswell-IBRS.xml b/src/cpu_map/x86_Haswell-IBRS.xml
index 4f86db838f..0ffe2bae0d 100644
--- a/src/cpu_map/x86_Haswell-IBRS.xml
+++ b/src/cpu_map/x86_Haswell-IBRS.xml
@@ -1,5 +1,6 @@
<cpus>
<model name='Haswell-IBRS'>
+ <decode host='on' guest='on'/>
<signature family='6' model='60'/> <!-- 0306c0 -->
<signature family='6' model='63'/> <!-- 0306f0 -->
<signature family='6' model='69'/> <!-- 040650 -->
diff --git a/src/cpu_map/x86_Haswell-noTSX-IBRS.xml b/src/cpu_map/x86_Haswell-noTSX-IBRS.xml
index 47318be6d5..75d709c009 100644
--- a/src/cpu_map/x86_Haswell-noTSX-IBRS.xml
+++ b/src/cpu_map/x86_Haswell-noTSX-IBRS.xml
@@ -1,5 +1,6 @@
<cpus>
<model name='Haswell-noTSX-IBRS'>
+ <decode host='on' guest='on'/>
<signature family='6' model='60'/> <!-- 0306c0 -->
<signature family='6' model='63'/> <!-- 0306f0 -->
<signature family='6' model='69'/> <!-- 040650 -->
diff --git a/src/cpu_map/x86_Haswell-noTSX.xml b/src/cpu_map/x86_Haswell-noTSX.xml
index efd10c47de..b0a0faa856 100644
--- a/src/cpu_map/x86_Haswell-noTSX.xml
+++ b/src/cpu_map/x86_Haswell-noTSX.xml
@@ -1,5 +1,6 @@
<cpus>
<model name='Haswell-noTSX'>
+ <decode host='on' guest='on'/>
<signature family='6' model='60'/> <!-- 0306c0 -->
<signature family='6' model='63'/> <!-- 0306f0 -->
<signature family='6' model='69'/> <!-- 040650 -->
diff --git a/src/cpu_map/x86_Haswell.xml b/src/cpu_map/x86_Haswell.xml
index ac358d7967..ee16b30f19 100644
--- a/src/cpu_map/x86_Haswell.xml
+++ b/src/cpu_map/x86_Haswell.xml
@@ -1,5 +1,6 @@
<cpus>
<model name='Haswell'>
+ <decode host='on' guest='on'/>
<signature family='6' model='60'/> <!-- 0306c0 -->
<signature family='6' model='63'/> <!-- 0306f0 -->
<signature family='6' model='69'/> <!-- 040650 -->
diff --git a/src/cpu_map/x86_Icelake-Client-noTSX.xml b/src/cpu_map/x86_Icelake-Client-noTSX.xml
index cd51881f40..540732af6f 100644
--- a/src/cpu_map/x86_Icelake-Client-noTSX.xml
+++ b/src/cpu_map/x86_Icelake-Client-noTSX.xml
@@ -1,5 +1,6 @@
<cpus>
<model name='Icelake-Client-noTSX'>
+ <decode host='on' guest='on'/>
<signature family='6' model='126'/> <!-- 0706e0 -->
<vendor name='Intel'/>
<feature name='3dnowprefetch'/>
diff --git a/src/cpu_map/x86_Icelake-Client.xml b/src/cpu_map/x86_Icelake-Client.xml
index fbd53bbe11..5cf32e91fa 100644
--- a/src/cpu_map/x86_Icelake-Client.xml
+++ b/src/cpu_map/x86_Icelake-Client.xml
@@ -1,5 +1,6 @@
<cpus>
<model name='Icelake-Client'>
+ <decode host='on' guest='on'/>
<signature family='6' model='126'/> <!-- 0706e0 -->
<vendor name='Intel'/>
<feature name='3dnowprefetch'/>
diff --git a/src/cpu_map/x86_Icelake-Server-noTSX.xml b/src/cpu_map/x86_Icelake-Server-noTSX.xml
index 538c656712..5a53da23c7 100644
--- a/src/cpu_map/x86_Icelake-Server-noTSX.xml
+++ b/src/cpu_map/x86_Icelake-Server-noTSX.xml
@@ -1,5 +1,6 @@
<cpus>
<model name='Icelake-Server-noTSX'>
+ <decode host='on' guest='on'/>
<signature family='6' model='134'/> <!-- 080660 -->
<vendor name='Intel'/>
<feature name='3dnowprefetch'/>
diff --git a/src/cpu_map/x86_Icelake-Server.xml b/src/cpu_map/x86_Icelake-Server.xml
index a565371977..367ade7240 100644
--- a/src/cpu_map/x86_Icelake-Server.xml
+++ b/src/cpu_map/x86_Icelake-Server.xml
@@ -1,5 +1,6 @@
<cpus>
<model name='Icelake-Server'>
+ <decode host='on' guest='on'/>
<signature family='6' model='134'/> <!-- 080660 -->
<vendor name='Intel'/>
<feature name='3dnowprefetch'/>
diff --git a/src/cpu_map/x86_IvyBridge-IBRS.xml b/src/cpu_map/x86_IvyBridge-IBRS.xml
index e0f2adfa82..430bc3232d 100644
--- a/src/cpu_map/x86_IvyBridge-IBRS.xml
+++ b/src/cpu_map/x86_IvyBridge-IBRS.xml
@@ -1,5 +1,6 @@
<cpus>
<model name='IvyBridge-IBRS'>
+ <decode host='on' guest='on'/>
<signature family='6' model='58'/> <!-- 0306a0 -->
<signature family='6' model='62'/> <!-- 0306e0 -->
<vendor name='Intel'/>
diff --git a/src/cpu_map/x86_IvyBridge.xml b/src/cpu_map/x86_IvyBridge.xml
index 16213dbc62..eaf5d02e82 100644
--- a/src/cpu_map/x86_IvyBridge.xml
+++ b/src/cpu_map/x86_IvyBridge.xml
@@ -1,5 +1,6 @@
<cpus>
<model name='IvyBridge'>
+ <decode host='on' guest='on'/>
<signature family='6' model='58'/> <!-- 0306a0 -->
<signature family='6' model='62'/> <!-- 0306e0 -->
<vendor name='Intel'/>
diff --git a/src/cpu_map/x86_Nehalem-IBRS.xml b/src/cpu_map/x86_Nehalem-IBRS.xml
index 8cc19eff03..00d0d2fe51 100644
--- a/src/cpu_map/x86_Nehalem-IBRS.xml
+++ b/src/cpu_map/x86_Nehalem-IBRS.xml
@@ -1,5 +1,6 @@
<cpus>
<model name='Nehalem-IBRS'>
+ <decode host='on' guest='on'/>
<signature family='6' model='26'/> <!-- 0106a0 -->
<signature family='6' model='30'/> <!-- 0106e0 -->
<signature family='6' model='31'/> <!-- 0106f0 -->
diff --git a/src/cpu_map/x86_Nehalem.xml b/src/cpu_map/x86_Nehalem.xml
index 530e5e8a0d..9968001fe7 100644
--- a/src/cpu_map/x86_Nehalem.xml
+++ b/src/cpu_map/x86_Nehalem.xml
@@ -1,5 +1,6 @@
<cpus>
<model name='Nehalem'>
+ <decode host='on' guest='on'/>
<signature family='6' model='26'/> <!-- 0106a0 -->
<signature family='6' model='30'/> <!-- 0106e0 -->
<signature family='6' model='31'/> <!-- 0106f0 -->
diff --git a/src/cpu_map/x86_Opteron_G1.xml b/src/cpu_map/x86_Opteron_G1.xml
index 73cf1de71e..57648ca93f 100644
--- a/src/cpu_map/x86_Opteron_G1.xml
+++ b/src/cpu_map/x86_Opteron_G1.xml
@@ -1,5 +1,6 @@
<cpus>
<model name='Opteron_G1'>
+ <decode host='on' guest='on'/>
<signature family='15' model='6'/> <!-- 100e60 -->
<vendor name='AMD'/>
<feature name='apic'/>
diff --git a/src/cpu_map/x86_Opteron_G2.xml b/src/cpu_map/x86_Opteron_G2.xml
index 342105730e..db961b0067 100644
--- a/src/cpu_map/x86_Opteron_G2.xml
+++ b/src/cpu_map/x86_Opteron_G2.xml
@@ -1,5 +1,6 @@
<cpus>
<model name='Opteron_G2'>
+ <decode host='on' guest='on'/>
<signature family='15' model='6'/> <!-- 100e60 -->
<vendor name='AMD'/>
<feature name='apic'/>
diff --git a/src/cpu_map/x86_Opteron_G3.xml b/src/cpu_map/x86_Opteron_G3.xml
index 7fbf8ac9e9..dab59d4f82 100644
--- a/src/cpu_map/x86_Opteron_G3.xml
+++ b/src/cpu_map/x86_Opteron_G3.xml
@@ -1,5 +1,6 @@
<cpus>
<model name='Opteron_G3'>
+ <decode host='on' guest='on'/>
<signature family='15' model='6'/> <!-- 100e60 -->
<vendor name='AMD'/>
<feature name='abm'/>
diff --git a/src/cpu_map/x86_Opteron_G4.xml b/src/cpu_map/x86_Opteron_G4.xml
index 463b3676a0..a7fc8d5828 100644
--- a/src/cpu_map/x86_Opteron_G4.xml
+++ b/src/cpu_map/x86_Opteron_G4.xml
@@ -1,5 +1,6 @@
<cpus>
<model name='Opteron_G4'>
+ <decode host='on' guest='on'/>
<signature family='21' model='1'/> <!-- 600f10 -->
<vendor name='AMD'/>
<feature name='3dnowprefetch'/>
diff --git a/src/cpu_map/x86_Opteron_G5.xml b/src/cpu_map/x86_Opteron_G5.xml
index 0f8fe32c87..ff775bdcef 100644
--- a/src/cpu_map/x86_Opteron_G5.xml
+++ b/src/cpu_map/x86_Opteron_G5.xml
@@ -1,5 +1,6 @@
<cpus>
<model name='Opteron_G5'>
+ <decode host='on' guest='on'/>
<signature family='21' model='2'/> <!-- 600f20 -->
<vendor name='AMD'/>
<feature name='3dnowprefetch'/>
diff --git a/src/cpu_map/x86_Penryn.xml b/src/cpu_map/x86_Penryn.xml
index 279bb05570..29d4cd635b 100644
--- a/src/cpu_map/x86_Penryn.xml
+++ b/src/cpu_map/x86_Penryn.xml
@@ -1,5 +1,6 @@
<cpus>
<model name='Penryn'>
+ <decode host='on' guest='on'/>
<signature family='6' model='23'/> <!-- 010670 -->
<signature family='6' model='29'/> <!-- 0106d0 -->
<vendor name='Intel'/>
diff --git a/src/cpu_map/x86_SandyBridge-IBRS.xml b/src/cpu_map/x86_SandyBridge-IBRS.xml
index 7d1342ec6f..fbdb4f2bf6 100644
--- a/src/cpu_map/x86_SandyBridge-IBRS.xml
+++ b/src/cpu_map/x86_SandyBridge-IBRS.xml
@@ -1,5 +1,6 @@
<cpus>
<model name='SandyBridge-IBRS'>
+ <decode host='on' guest='on'/>
<signature family='6' model='42'/> <!-- 0206a0 -->
<signature family='6' model='45'/> <!-- 0206d0 -->
<vendor name='Intel'/>
diff --git a/src/cpu_map/x86_SandyBridge.xml b/src/cpu_map/x86_SandyBridge.xml
index 48e4ac8082..7c85ed42df 100644
--- a/src/cpu_map/x86_SandyBridge.xml
+++ b/src/cpu_map/x86_SandyBridge.xml
@@ -1,5 +1,6 @@
<cpus>
<model name='SandyBridge'>
+ <decode host='on' guest='on'/>
<signature family='6' model='42'/> <!-- 0206a0 -->
<signature family='6' model='45'/> <!-- 0206d0 -->
<vendor name='Intel'/>
diff --git a/src/cpu_map/x86_Skylake-Client-IBRS.xml b/src/cpu_map/x86_Skylake-Client-IBRS.xml
index 4440313fc4..5709e7c2f9 100644
--- a/src/cpu_map/x86_Skylake-Client-IBRS.xml
+++ b/src/cpu_map/x86_Skylake-Client-IBRS.xml
@@ -1,5 +1,6 @@
<cpus>
<model name='Skylake-Client-IBRS'>
+ <decode host='on' guest='on'/>
<signature family='6' model='94'/> <!-- 0506e0 -->
<signature family='6' model='78'/> <!-- 0406e0 -->
<!-- These are Kaby Lake and Coffee Lake successors to Skylake,
diff --git a/src/cpu_map/x86_Skylake-Client-noTSX-IBRS.xml b/src/cpu_map/x86_Skylake-Client-noTSX-IBRS.xml
index 3d2976692f..0c2f1e6ac4 100644
--- a/src/cpu_map/x86_Skylake-Client-noTSX-IBRS.xml
+++ b/src/cpu_map/x86_Skylake-Client-noTSX-IBRS.xml
@@ -1,5 +1,6 @@
<cpus>
<model name='Skylake-Client-noTSX-IBRS'>
+ <decode host='on' guest='on'/>
<signature family='6' model='94'/> <!-- 0506e0 -->
<signature family='6' model='78'/> <!-- 0406e0 -->
<!-- These are Kaby Lake and Coffee Lake successors to Skylake,
diff --git a/src/cpu_map/x86_Skylake-Client.xml b/src/cpu_map/x86_Skylake-Client.xml
index 1053fa4a04..14cd57e176 100644
--- a/src/cpu_map/x86_Skylake-Client.xml
+++ b/src/cpu_map/x86_Skylake-Client.xml
@@ -1,5 +1,6 @@
<cpus>
<model name='Skylake-Client'>
+ <decode host='on' guest='on'/>
<signature family='6' model='94'/> <!-- 0506e0 -->
<signature family='6' model='78'/> <!-- 0406e0 -->
<!-- These are Kaby Lake and Coffee Lake successors to Skylake,
diff --git a/src/cpu_map/x86_Skylake-Server-IBRS.xml b/src/cpu_map/x86_Skylake-Server-IBRS.xml
index 71179f9f74..bd6b6457ad 100644
--- a/src/cpu_map/x86_Skylake-Server-IBRS.xml
+++ b/src/cpu_map/x86_Skylake-Server-IBRS.xml
@@ -1,5 +1,6 @@
<cpus>
<model name='Skylake-Server-IBRS'>
+ <decode host='on' guest='on'/>
<signature family='6' model='85'/> <!-- 050654 -->
<vendor name='Intel'/>
<feature name='3dnowprefetch'/>
diff --git a/src/cpu_map/x86_Skylake-Server-noTSX-IBRS.xml b/src/cpu_map/x86_Skylake-Server-noTSX-IBRS.xml
index 455a072119..91a206f575 100644
--- a/src/cpu_map/x86_Skylake-Server-noTSX-IBRS.xml
+++ b/src/cpu_map/x86_Skylake-Server-noTSX-IBRS.xml
@@ -1,5 +1,6 @@
<cpus>
<model name='Skylake-Server-noTSX-IBRS'>
+ <decode host='on' guest='on'/>
<signature family='6' model='85'/> <!-- 050654 -->
<vendor name='Intel'/>
<feature name='3dnowprefetch'/>
diff --git a/src/cpu_map/x86_Skylake-Server.xml b/src/cpu_map/x86_Skylake-Server.xml
index 2da69e0dfc..f96875a85f 100644
--- a/src/cpu_map/x86_Skylake-Server.xml
+++ b/src/cpu_map/x86_Skylake-Server.xml
@@ -1,5 +1,6 @@
<cpus>
<model name='Skylake-Server'>
+ <decode host='on' guest='on'/>
<signature family='6' model='85'/> <!-- 050654 -->
<vendor name='Intel'/>
<feature name='3dnowprefetch'/>
diff --git a/src/cpu_map/x86_Westmere-IBRS.xml b/src/cpu_map/x86_Westmere-IBRS.xml
index 3baf56f47a..c7898f0c22 100644
--- a/src/cpu_map/x86_Westmere-IBRS.xml
+++ b/src/cpu_map/x86_Westmere-IBRS.xml
@@ -1,5 +1,6 @@
<cpus>
<model name='Westmere-IBRS'>
+ <decode host='on' guest='on'/>
<signature family='6' model='44'/> <!-- 0206c0 -->
<vendor name='Intel'/>
<feature name='aes'/>
diff --git a/src/cpu_map/x86_Westmere.xml b/src/cpu_map/x86_Westmere.xml
index 95c1d690c8..16e4ad6c30 100644
--- a/src/cpu_map/x86_Westmere.xml
+++ b/src/cpu_map/x86_Westmere.xml
@@ -1,5 +1,6 @@
<cpus>
<model name='Westmere'>
+ <decode host='on' guest='on'/>
<signature family='6' model='44'/> <!-- 0206c0 -->
<signature family='6' model='47'/> <!-- 0206f0 -->
<signature family='6' model='37'/> <!-- 020650 -->
diff --git a/src/cpu_map/x86_athlon.xml b/src/cpu_map/x86_athlon.xml
index 0d44508e20..81c43c81e8 100644
--- a/src/cpu_map/x86_athlon.xml
+++ b/src/cpu_map/x86_athlon.xml
@@ -1,5 +1,6 @@
<cpus>
<model name='athlon'>
+ <decode host='on' guest='on'/>
<vendor name='AMD'/>
<feature name='3dnow'/>
<feature name='3dnowext'/>
diff --git a/src/cpu_map/x86_core2duo.xml b/src/cpu_map/x86_core2duo.xml
index 3c9a148f3c..412039fe55 100644
--- a/src/cpu_map/x86_core2duo.xml
+++ b/src/cpu_map/x86_core2duo.xml
@@ -1,5 +1,6 @@
<cpus>
<model name='core2duo'>
+ <decode host='on' guest='on'/>
<vendor name='Intel'/>
<feature name='apic'/>
<feature name='clflush'/>
diff --git a/src/cpu_map/x86_coreduo.xml b/src/cpu_map/x86_coreduo.xml
index 676e846920..e2fda9a1d4 100644
--- a/src/cpu_map/x86_coreduo.xml
+++ b/src/cpu_map/x86_coreduo.xml
@@ -1,5 +1,6 @@
<cpus>
<model name='coreduo'>
+ <decode host='on' guest='on'/>
<vendor name='Intel'/>
<feature name='apic'/>
<feature name='clflush'/>
diff --git a/src/cpu_map/x86_cpu64-rhel5.xml b/src/cpu_map/x86_cpu64-rhel5.xml
index 670a92f274..be6bcdb7a6 100644
--- a/src/cpu_map/x86_cpu64-rhel5.xml
+++ b/src/cpu_map/x86_cpu64-rhel5.xml
@@ -1,5 +1,6 @@
<cpus>
<model name='cpu64-rhel5'>
+ <decode host='on' guest='on'/>
<feature name='apic'/>
<feature name='clflush'/>
<feature name='cmov'/>
diff --git a/src/cpu_map/x86_cpu64-rhel6.xml b/src/cpu_map/x86_cpu64-rhel6.xml
index 3cae0f00c2..c62b1b5575 100644
--- a/src/cpu_map/x86_cpu64-rhel6.xml
+++ b/src/cpu_map/x86_cpu64-rhel6.xml
@@ -1,5 +1,6 @@
<cpus>
<model name='cpu64-rhel6'>
+ <decode host='on' guest='on'/>
<feature name='apic'/>
<feature name='clflush'/>
<feature name='cmov'/>
diff --git a/src/cpu_map/x86_kvm32.xml b/src/cpu_map/x86_kvm32.xml
index 5f08a5e7fc..9dd96d5b56 100644
--- a/src/cpu_map/x86_kvm32.xml
+++ b/src/cpu_map/x86_kvm32.xml
@@ -1,5 +1,6 @@
<cpus>
<model name='kvm32'>
+ <decode host='on' guest='on'/>
<feature name='apic'/>
<feature name='clflush'/>
<feature name='cmov'/>
diff --git a/src/cpu_map/x86_kvm64.xml b/src/cpu_map/x86_kvm64.xml
index 80b24e2a49..185af06f78 100644
--- a/src/cpu_map/x86_kvm64.xml
+++ b/src/cpu_map/x86_kvm64.xml
@@ -1,5 +1,6 @@
<cpus>
<model name='kvm64'>
+ <decode host='on' guest='on'/>
<feature name='apic'/>
<feature name='clflush'/>
<feature name='cmov'/>
diff --git a/src/cpu_map/x86_n270.xml b/src/cpu_map/x86_n270.xml
index cb359d968e..5507d2ea3b 100644
--- a/src/cpu_map/x86_n270.xml
+++ b/src/cpu_map/x86_n270.xml
@@ -1,5 +1,6 @@
<cpus>
<model name='n270'>
+ <decode host='on' guest='on'/>
<vendor name='Intel'/>
<feature name='apic'/>
<feature name='clflush'/>
diff --git a/src/cpu_map/x86_pentium.xml b/src/cpu_map/x86_pentium.xml
index d44c1399b0..f0a8982115 100644
--- a/src/cpu_map/x86_pentium.xml
+++ b/src/cpu_map/x86_pentium.xml
@@ -1,5 +1,6 @@
<cpus>
<model name='pentium'>
+ <decode host='on' guest='on'/>
<feature name='cx8'/>
<feature name='de'/>
<feature name='fpu'/>
diff --git a/src/cpu_map/x86_pentium2.xml b/src/cpu_map/x86_pentium2.xml
index 0d772bad2f..aeba082297 100644
--- a/src/cpu_map/x86_pentium2.xml
+++ b/src/cpu_map/x86_pentium2.xml
@@ -1,5 +1,6 @@
<cpus>
<model name='pentium2'>
+ <decode host='on' guest='on'/>
<feature name='cmov'/>
<feature name='cx8'/>
<feature name='de'/>
diff --git a/src/cpu_map/x86_pentium3.xml b/src/cpu_map/x86_pentium3.xml
index 24eb227c28..ab85d2967f 100644
--- a/src/cpu_map/x86_pentium3.xml
+++ b/src/cpu_map/x86_pentium3.xml
@@ -1,5 +1,6 @@
<cpus>
<model name='pentium3'>
+ <decode host='on' guest='on'/>
<feature name='cmov'/>
<feature name='cx8'/>
<feature name='de'/>
diff --git a/src/cpu_map/x86_pentiumpro.xml b/src/cpu_map/x86_pentiumpro.xml
index 9f7a610a87..b6e061187c 100644
--- a/src/cpu_map/x86_pentiumpro.xml
+++ b/src/cpu_map/x86_pentiumpro.xml
@@ -1,5 +1,6 @@
<cpus>
<model name='pentiumpro'>
+ <decode host='on' guest='on'/>
<feature name='apic'/>
<feature name='cmov'/>
<feature name='cx8'/>
diff --git a/src/cpu_map/x86_phenom.xml b/src/cpu_map/x86_phenom.xml
index 71f004057b..f0f8ece57a 100644
--- a/src/cpu_map/x86_phenom.xml
+++ b/src/cpu_map/x86_phenom.xml
@@ -1,5 +1,6 @@
<cpus>
<model name='phenom'>
+ <decode host='on' guest='on'/>
<vendor name='AMD'/>
<feature name='3dnow'/>
<feature name='3dnowext'/>
diff --git a/src/cpu_map/x86_qemu32.xml b/src/cpu_map/x86_qemu32.xml
index 3c9cdec981..f3fb1959be 100644
--- a/src/cpu_map/x86_qemu32.xml
+++ b/src/cpu_map/x86_qemu32.xml
@@ -1,5 +1,6 @@
<cpus>
<model name='qemu32'>
+ <decode host='on' guest='on'/>
<feature name='apic'/>
<feature name='cmov'/>
<feature name='cx8'/>
diff --git a/src/cpu_map/x86_qemu64.xml b/src/cpu_map/x86_qemu64.xml
index a8e8dfe58d..0fe207a2b4 100644
--- a/src/cpu_map/x86_qemu64.xml
+++ b/src/cpu_map/x86_qemu64.xml
@@ -1,5 +1,6 @@
<cpus>
<model name='qemu64'>
+ <decode host='on' guest='on'/>
<!-- These are supported only by TCG. KVM supports them only if the
host does. So we leave them out:
--
2.26.2

View File

@ -1,896 +0,0 @@
From 5936216b6e32392d785979bfd6ccafc5174ec519 Mon Sep 17 00:00:00 2001
Message-Id: <5936216b6e32392d785979bfd6ccafc5174ec519@dist-git>
From: Jiri Denemark <jdenemar@redhat.com>
Date: Thu, 8 Oct 2020 18:01:23 +0200
Subject: [PATCH] cpu_map: Add missing AMD SVM features
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
(cherry picked from commit 96a39aad705f8e37950109d11636085b212af790)
https://bugzilla.redhat.com/show_bug.cgi?id=1861506
Conflicts:
tests/cputestdata/x86_64-cpuid-Ryzen-9-3900X-12-Core-disabled.xml
tests/cputestdata/x86_64-cpuid-Ryzen-9-3900X-12-Core-enabled.xml
tests/cputestdata/x86_64-cpuid-Ryzen-9-3900X-12-Core-guest.xml
tests/cputestdata/x86_64-cpuid-Ryzen-9-3900X-12-Core-host.xml
tests/cputestdata/x86_64-cpuid-Ryzen-9-3900X-12-Core-json.xml
tests/domaincapsdata/qemu_5.1.0-q35.x86_64.xml
tests/domaincapsdata/qemu_5.1.0-tcg.x86_64.xml
tests/domaincapsdata/qemu_5.1.0.x86_64.xml
- not present downstream
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Message-Id: <d55a2ddfc9aefcc833d3a370c7d70dfb2c0b7554.1602172344.git.jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/cpu_map/x86_features.xml | 32 +++++++++++++++++++
.../x86_64-cpuid-A10-5800K-disabled.xml | 1 +
.../x86_64-cpuid-A10-5800K-enabled.xml | 1 +
.../x86_64-cpuid-A10-5800K-guest.xml | 10 ++++++
.../x86_64-cpuid-A10-5800K-host.xml | 10 ++++++
.../x86_64-cpuid-A10-5800K-json.xml | 2 ++
...86_64-cpuid-EPYC-7601-32-Core-disabled.xml | 1 +
...x86_64-cpuid-EPYC-7601-32-Core-enabled.xml | 1 +
.../x86_64-cpuid-EPYC-7601-32-Core-guest.xml | 10 ++++++
.../x86_64-cpuid-EPYC-7601-32-Core-host.xml | 10 ++++++
...-cpuid-EPYC-7601-32-Core-ibpb-disabled.xml | 1 +
...4-cpuid-EPYC-7601-32-Core-ibpb-enabled.xml | 1 +
..._64-cpuid-EPYC-7601-32-Core-ibpb-guest.xml | 10 ++++++
...6_64-cpuid-EPYC-7601-32-Core-ibpb-host.xml | 10 ++++++
...6_64-cpuid-EPYC-7601-32-Core-ibpb-json.xml | 2 ++
.../x86_64-cpuid-EPYC-7601-32-Core-json.xml | 2 ++
.../x86_64-cpuid-FX-8150-guest.xml | 10 ++++++
.../cputestdata/x86_64-cpuid-FX-8150-host.xml | 10 ++++++
...-cpuid-Hygon-C86-7185-32-core-disabled.xml | 1 +
...4-cpuid-Hygon-C86-7185-32-core-enabled.xml | 1 +
..._64-cpuid-Hygon-C86-7185-32-core-guest.xml | 10 ++++++
...6_64-cpuid-Hygon-C86-7185-32-core-host.xml | 10 ++++++
...6_64-cpuid-Hygon-C86-7185-32-core-json.xml | 2 ++
.../x86_64-cpuid-Opteron-1352-guest.xml | 3 ++
.../x86_64-cpuid-Opteron-1352-host.xml | 3 ++
.../x86_64-cpuid-Opteron-2350-disabled.xml | 1 +
.../x86_64-cpuid-Opteron-2350-enabled.xml | 1 +
.../x86_64-cpuid-Opteron-2350-guest.xml | 3 ++
.../x86_64-cpuid-Opteron-2350-host.xml | 3 ++
.../x86_64-cpuid-Opteron-2350-json.xml | 1 +
.../x86_64-cpuid-Opteron-6234-disabled.xml | 1 +
.../x86_64-cpuid-Opteron-6234-enabled.xml | 1 +
.../x86_64-cpuid-Opteron-6234-guest.xml | 10 ++++++
.../x86_64-cpuid-Opteron-6234-host.xml | 10 ++++++
.../x86_64-cpuid-Opteron-6234-json.xml | 2 ++
.../x86_64-cpuid-Opteron-6282-guest.xml | 10 ++++++
.../x86_64-cpuid-Opteron-6282-host.xml | 10 ++++++
.../x86_64-cpuid-Phenom-B95-disabled.xml | 1 +
.../x86_64-cpuid-Phenom-B95-enabled.xml | 1 +
.../x86_64-cpuid-Phenom-B95-guest.xml | 4 +++
.../x86_64-cpuid-Phenom-B95-host.xml | 4 +++
.../x86_64-cpuid-Phenom-B95-json.xml | 2 ++
...puid-Ryzen-7-1800X-Eight-Core-disabled.xml | 1 +
...cpuid-Ryzen-7-1800X-Eight-Core-enabled.xml | 1 +
...4-cpuid-Ryzen-7-1800X-Eight-Core-guest.xml | 10 ++++++
...64-cpuid-Ryzen-7-1800X-Eight-Core-host.xml | 10 ++++++
...64-cpuid-Ryzen-7-1800X-Eight-Core-json.xml | 2 ++
.../domaincapsdata/qemu_3.0.0-tcg.x86_64.xml | 1 +
.../domaincapsdata/qemu_3.1.0-tcg.x86_64.xml | 1 +
.../domaincapsdata/qemu_4.0.0-tcg.x86_64.xml | 2 ++
.../domaincapsdata/qemu_4.1.0-tcg.x86_64.xml | 2 ++
.../domaincapsdata/qemu_4.2.0-tcg.x86_64.xml | 2 ++
.../domaincapsdata/qemu_5.0.0-tcg.x86_64.xml | 2 ++
.../cpu-host-model-cmt.x86_64-4.0.0.args | 6 ++--
54 files changed, 256 insertions(+), 3 deletions(-)
diff --git a/src/cpu_map/x86_features.xml b/src/cpu_map/x86_features.xml
index 5265b2989b..30d1375437 100644
--- a/src/cpu_map/x86_features.xml
+++ b/src/cpu_map/x86_features.xml
@@ -508,6 +508,38 @@
<cpuid eax_in='0x80000008' ebx='0x04000000'/>
</feature>
+ <!-- SVM features -->
+ <feature name='npt'>
+ <cpuid eax_in='0x8000000a' edx='0x00000001'/>
+ </feature>
+ <feature name='lbrv'>
+ <cpuid eax_in='0x8000000a' edx='0x00000002'/>
+ </feature>
+ <feature name='svm-lock'>
+ <cpuid eax_in='0x8000000a' edx='0x00000004'/>
+ </feature>
+ <feature name='nrip-save'>
+ <cpuid eax_in='0x8000000a' edx='0x00000008'/>
+ </feature>
+ <feature name='tsc-scale'>
+ <cpuid eax_in='0x8000000a' edx='0x00000010'/>
+ </feature>
+ <feature name='vmcb-clean'>
+ <cpuid eax_in='0x8000000a' edx='0x00000020'/>
+ </feature>
+ <feature name='flushbyasid'>
+ <cpuid eax_in='0x8000000a' edx='0x00000040'/>
+ </feature>
+ <feature name='decodeassists'>
+ <cpuid eax_in='0x8000000a' edx='0x00000080'/>
+ </feature>
+ <feature name='pause-filter'>
+ <cpuid eax_in='0x8000000a' edx='0x00000400'/>
+ </feature>
+ <feature name='pfthreshold'>
+ <cpuid eax_in='0x8000000a' edx='0x00001000'/>
+ </feature>
+
<!-- IA32_ARCH_CAPABILITIES features -->
<feature name='rdctl-no'>
<msr index='0x10a' edx='0x00000000' eax='0x00000001'/>
diff --git a/tests/cputestdata/x86_64-cpuid-A10-5800K-disabled.xml b/tests/cputestdata/x86_64-cpuid-A10-5800K-disabled.xml
index 6ed5b3573b..3bacf2cf95 100644
--- a/tests/cputestdata/x86_64-cpuid-A10-5800K-disabled.xml
+++ b/tests/cputestdata/x86_64-cpuid-A10-5800K-disabled.xml
@@ -3,4 +3,5 @@
<cpuid eax_in='0x00000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x08000008' edx='0x10000000'/>
<cpuid eax_in='0x80000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x01cab40c' edx='0x08000000'/>
<cpuid eax_in='0x80000007' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000100'/>
+ <cpuid eax_in='0x8000000a' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x000014f6'/>
</cpudata>
diff --git a/tests/cputestdata/x86_64-cpuid-A10-5800K-enabled.xml b/tests/cputestdata/x86_64-cpuid-A10-5800K-enabled.xml
index 5cae0b7130..f6afbe2cb3 100644
--- a/tests/cputestdata/x86_64-cpuid-A10-5800K-enabled.xml
+++ b/tests/cputestdata/x86_64-cpuid-A10-5800K-enabled.xml
@@ -3,4 +3,5 @@
<cpuid eax_in='0x00000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0xb6b83203' edx='0x078bfbff'/>
<cpuid eax_in='0x00000007' ecx_in='0x00' eax='0x00000000' ebx='0x0000000a' ecx='0x00000000' edx='0x00000000'/>
<cpuid eax_in='0x80000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00210bf3' edx='0x26500800'/>
+ <cpuid eax_in='0x8000000a' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000009'/>
</cpudata>
diff --git a/tests/cputestdata/x86_64-cpuid-A10-5800K-guest.xml b/tests/cputestdata/x86_64-cpuid-A10-5800K-guest.xml
index 98a95e1c41..8401e53d30 100644
--- a/tests/cputestdata/x86_64-cpuid-A10-5800K-guest.xml
+++ b/tests/cputestdata/x86_64-cpuid-A10-5800K-guest.xml
@@ -22,4 +22,14 @@
<feature policy='require' name='perfctr_core'/>
<feature policy='require' name='perfctr_nb'/>
<feature policy='require' name='invtsc'/>
+ <feature policy='require' name='npt'/>
+ <feature policy='require' name='lbrv'/>
+ <feature policy='require' name='svm-lock'/>
+ <feature policy='require' name='nrip-save'/>
+ <feature policy='require' name='tsc-scale'/>
+ <feature policy='require' name='vmcb-clean'/>
+ <feature policy='require' name='flushbyasid'/>
+ <feature policy='require' name='decodeassists'/>
+ <feature policy='require' name='pause-filter'/>
+ <feature policy='require' name='pfthreshold'/>
</cpu>
diff --git a/tests/cputestdata/x86_64-cpuid-A10-5800K-host.xml b/tests/cputestdata/x86_64-cpuid-A10-5800K-host.xml
index cb90c967a3..2430adbfbc 100644
--- a/tests/cputestdata/x86_64-cpuid-A10-5800K-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-A10-5800K-host.xml
@@ -23,4 +23,14 @@
<feature name='perfctr_core'/>
<feature name='perfctr_nb'/>
<feature name='invtsc'/>
+ <feature name='npt'/>
+ <feature name='lbrv'/>
+ <feature name='svm-lock'/>
+ <feature name='nrip-save'/>
+ <feature name='tsc-scale'/>
+ <feature name='vmcb-clean'/>
+ <feature name='flushbyasid'/>
+ <feature name='decodeassists'/>
+ <feature name='pause-filter'/>
+ <feature name='pfthreshold'/>
</cpu>
diff --git a/tests/cputestdata/x86_64-cpuid-A10-5800K-json.xml b/tests/cputestdata/x86_64-cpuid-A10-5800K-json.xml
index fa61b7b60b..51e6d2b660 100644
--- a/tests/cputestdata/x86_64-cpuid-A10-5800K-json.xml
+++ b/tests/cputestdata/x86_64-cpuid-A10-5800K-json.xml
@@ -11,6 +11,8 @@
<feature policy='require' name='cmp_legacy'/>
<feature policy='require' name='cr8legacy'/>
<feature policy='require' name='osvw'/>
+ <feature policy='require' name='npt'/>
+ <feature policy='require' name='nrip-save'/>
<feature policy='disable' name='rdtscp'/>
<feature policy='disable' name='svm'/>
</cpu>
diff --git a/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-disabled.xml b/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-disabled.xml
index c26c9c7be3..25ef2d3314 100644
--- a/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-disabled.xml
+++ b/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-disabled.xml
@@ -5,4 +5,5 @@
<cpuid eax_in='0x80000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x01c2300c' edx='0x00000000'/>
<cpuid eax_in='0x80000007' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000100'/>
<cpuid eax_in='0x80000008' ecx_in='0x00' eax='0x00000000' ebx='0x00000005' ecx='0x00000000' edx='0x00000000'/>
+ <cpuid eax_in='0x8000000a' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x000014f6'/>
</cpudata>
diff --git a/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-enabled.xml b/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-enabled.xml
index 70b75f7115..e46908e981 100644
--- a/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-enabled.xml
+++ b/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-enabled.xml
@@ -5,4 +5,5 @@
<cpuid eax_in='0x00000007' ecx_in='0x00' eax='0x00000000' ebx='0x209c01ab' ecx='0x00000000' edx='0x00000000'/>
<cpuid eax_in='0x0000000d' ecx_in='0x01' eax='0x00000007' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
<cpuid eax_in='0x80000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x000003f3' edx='0x2e500800'/>
+ <cpuid eax_in='0x8000000a' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000009'/>
</cpudata>
diff --git a/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-guest.xml b/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-guest.xml
index 612e571609..0053913327 100644
--- a/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-guest.xml
+++ b/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-guest.xml
@@ -15,4 +15,14 @@
<feature policy='require' name='invtsc'/>
<feature policy='require' name='clzero'/>
<feature policy='require' name='xsaveerptr'/>
+ <feature policy='require' name='npt'/>
+ <feature policy='require' name='lbrv'/>
+ <feature policy='require' name='svm-lock'/>
+ <feature policy='require' name='nrip-save'/>
+ <feature policy='require' name='tsc-scale'/>
+ <feature policy='require' name='vmcb-clean'/>
+ <feature policy='require' name='flushbyasid'/>
+ <feature policy='require' name='decodeassists'/>
+ <feature policy='require' name='pause-filter'/>
+ <feature policy='require' name='pfthreshold'/>
</cpu>
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 7498d924e2..7acab0a999 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
@@ -16,4 +16,14 @@
<feature name='invtsc'/>
<feature name='clzero'/>
<feature name='xsaveerptr'/>
+ <feature name='npt'/>
+ <feature name='lbrv'/>
+ <feature name='svm-lock'/>
+ <feature name='nrip-save'/>
+ <feature name='tsc-scale'/>
+ <feature name='vmcb-clean'/>
+ <feature name='flushbyasid'/>
+ <feature name='decodeassists'/>
+ <feature name='pause-filter'/>
+ <feature name='pfthreshold'/>
</cpu>
diff --git a/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-ibpb-disabled.xml b/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-ibpb-disabled.xml
index a7f4fa3f01..f4d92cf034 100644
--- a/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-ibpb-disabled.xml
+++ b/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-ibpb-disabled.xml
@@ -5,4 +5,5 @@
<cpuid eax_in='0x80000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x01c2300c' edx='0x08000000'/>
<cpuid eax_in='0x80000007' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000100'/>
<cpuid eax_in='0x80000008' ecx_in='0x00' eax='0x00000000' ebx='0x00000005' ecx='0x00000000' edx='0x00000000'/>
+ <cpuid eax_in='0x8000000a' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x000014f6'/>
</cpudata>
diff --git a/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-ibpb-enabled.xml b/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-ibpb-enabled.xml
index 772456f947..910491c7f6 100644
--- a/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-ibpb-enabled.xml
+++ b/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-ibpb-enabled.xml
@@ -6,4 +6,5 @@
<cpuid eax_in='0x0000000d' ecx_in='0x01' eax='0x00000007' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
<cpuid eax_in='0x80000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x000003f3' edx='0x26500800'/>
<cpuid eax_in='0x80000008' ecx_in='0x00' eax='0x00000000' ebx='0x00001000' ecx='0x00000000' edx='0x00000000'/>
+ <cpuid eax_in='0x8000000a' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000009'/>
</cpudata>
diff --git a/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-ibpb-guest.xml b/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-ibpb-guest.xml
index 96fdea306f..9164987bbd 100644
--- a/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-ibpb-guest.xml
+++ b/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-ibpb-guest.xml
@@ -15,5 +15,15 @@
<feature policy='require' name='invtsc'/>
<feature policy='require' name='clzero'/>
<feature policy='require' name='xsaveerptr'/>
+ <feature policy='require' name='npt'/>
+ <feature policy='require' name='lbrv'/>
+ <feature policy='require' name='svm-lock'/>
+ <feature policy='require' name='nrip-save'/>
+ <feature policy='require' name='tsc-scale'/>
+ <feature policy='require' name='vmcb-clean'/>
+ <feature policy='require' name='flushbyasid'/>
+ <feature policy='require' name='decodeassists'/>
+ <feature policy='require' name='pause-filter'/>
+ <feature policy='require' name='pfthreshold'/>
<feature policy='disable' name='rdtscp'/>
</cpu>
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 4fff74f3aa..2fa8861e44 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
@@ -16,4 +16,14 @@
<feature name='invtsc'/>
<feature name='clzero'/>
<feature name='xsaveerptr'/>
+ <feature name='npt'/>
+ <feature name='lbrv'/>
+ <feature name='svm-lock'/>
+ <feature name='nrip-save'/>
+ <feature name='tsc-scale'/>
+ <feature name='vmcb-clean'/>
+ <feature name='flushbyasid'/>
+ <feature name='decodeassists'/>
+ <feature name='pause-filter'/>
+ <feature name='pfthreshold'/>
</cpu>
diff --git a/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-ibpb-json.xml b/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-ibpb-json.xml
index c4e34a0fa1..af1e7f2f32 100644
--- a/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-ibpb-json.xml
+++ b/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-ibpb-json.xml
@@ -6,6 +6,8 @@
<feature policy='require' name='hypervisor'/>
<feature policy='require' name='tsc_adjust'/>
<feature policy='require' name='cmp_legacy'/>
+ <feature policy='require' name='npt'/>
+ <feature policy='require' name='nrip-save'/>
<feature policy='disable' name='monitor'/>
<feature policy='disable' name='rdtscp'/>
<feature policy='disable' name='svm'/>
diff --git a/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-json.xml b/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-json.xml
index 7bf2d1b852..4450a40f61 100644
--- a/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-json.xml
+++ b/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-json.xml
@@ -6,6 +6,8 @@
<feature policy='require' name='hypervisor'/>
<feature policy='require' name='tsc_adjust'/>
<feature policy='require' name='cmp_legacy'/>
+ <feature policy='require' name='npt'/>
+ <feature policy='require' name='nrip-save'/>
<feature policy='disable' name='monitor'/>
<feature policy='disable' name='svm'/>
</cpu>
diff --git a/tests/cputestdata/x86_64-cpuid-FX-8150-guest.xml b/tests/cputestdata/x86_64-cpuid-FX-8150-guest.xml
index 6bd032bbcb..ee34ea8547 100644
--- a/tests/cputestdata/x86_64-cpuid-FX-8150-guest.xml
+++ b/tests/cputestdata/x86_64-cpuid-FX-8150-guest.xml
@@ -20,4 +20,14 @@
<feature policy='require' name='perfctr_core'/>
<feature policy='require' name='perfctr_nb'/>
<feature policy='require' name='invtsc'/>
+ <feature policy='require' name='npt'/>
+ <feature policy='require' name='lbrv'/>
+ <feature policy='require' name='svm-lock'/>
+ <feature policy='require' name='nrip-save'/>
+ <feature policy='require' name='tsc-scale'/>
+ <feature policy='require' name='vmcb-clean'/>
+ <feature policy='require' name='flushbyasid'/>
+ <feature policy='require' name='decodeassists'/>
+ <feature policy='require' name='pause-filter'/>
+ <feature policy='require' name='pfthreshold'/>
</cpu>
diff --git a/tests/cputestdata/x86_64-cpuid-FX-8150-host.xml b/tests/cputestdata/x86_64-cpuid-FX-8150-host.xml
index ec670c612e..75595c02af 100644
--- a/tests/cputestdata/x86_64-cpuid-FX-8150-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-FX-8150-host.xml
@@ -21,4 +21,14 @@
<feature name='perfctr_core'/>
<feature name='perfctr_nb'/>
<feature name='invtsc'/>
+ <feature name='npt'/>
+ <feature name='lbrv'/>
+ <feature name='svm-lock'/>
+ <feature name='nrip-save'/>
+ <feature name='tsc-scale'/>
+ <feature name='vmcb-clean'/>
+ <feature name='flushbyasid'/>
+ <feature name='decodeassists'/>
+ <feature name='pause-filter'/>
+ <feature name='pfthreshold'/>
</cpu>
diff --git a/tests/cputestdata/x86_64-cpuid-Hygon-C86-7185-32-core-disabled.xml b/tests/cputestdata/x86_64-cpuid-Hygon-C86-7185-32-core-disabled.xml
index c26c9c7be3..25ef2d3314 100644
--- a/tests/cputestdata/x86_64-cpuid-Hygon-C86-7185-32-core-disabled.xml
+++ b/tests/cputestdata/x86_64-cpuid-Hygon-C86-7185-32-core-disabled.xml
@@ -5,4 +5,5 @@
<cpuid eax_in='0x80000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x01c2300c' edx='0x00000000'/>
<cpuid eax_in='0x80000007' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000100'/>
<cpuid eax_in='0x80000008' ecx_in='0x00' eax='0x00000000' ebx='0x00000005' ecx='0x00000000' edx='0x00000000'/>
+ <cpuid eax_in='0x8000000a' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x000014f6'/>
</cpudata>
diff --git a/tests/cputestdata/x86_64-cpuid-Hygon-C86-7185-32-core-enabled.xml b/tests/cputestdata/x86_64-cpuid-Hygon-C86-7185-32-core-enabled.xml
index fcefcf73c8..9181c3a9fe 100644
--- a/tests/cputestdata/x86_64-cpuid-Hygon-C86-7185-32-core-enabled.xml
+++ b/tests/cputestdata/x86_64-cpuid-Hygon-C86-7185-32-core-enabled.xml
@@ -6,4 +6,5 @@
<cpuid eax_in='0x0000000d' ecx_in='0x01' eax='0x00000007' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
<cpuid eax_in='0x80000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x000003f3' edx='0x2e500800'/>
<cpuid eax_in='0x80000008' ecx_in='0x00' eax='0x00000000' ebx='0x02001000' ecx='0x00000000' edx='0x00000000'/>
+ <cpuid eax_in='0x8000000a' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000009'/>
</cpudata>
diff --git a/tests/cputestdata/x86_64-cpuid-Hygon-C86-7185-32-core-guest.xml b/tests/cputestdata/x86_64-cpuid-Hygon-C86-7185-32-core-guest.xml
index 844b8b9d4f..08c574255e 100644
--- a/tests/cputestdata/x86_64-cpuid-Hygon-C86-7185-32-core-guest.xml
+++ b/tests/cputestdata/x86_64-cpuid-Hygon-C86-7185-32-core-guest.xml
@@ -15,4 +15,14 @@
<feature policy='require' name='invtsc'/>
<feature policy='require' name='clzero'/>
<feature policy='require' name='xsaveerptr'/>
+ <feature policy='require' name='npt'/>
+ <feature policy='require' name='lbrv'/>
+ <feature policy='require' name='svm-lock'/>
+ <feature policy='require' name='nrip-save'/>
+ <feature policy='require' name='tsc-scale'/>
+ <feature policy='require' name='vmcb-clean'/>
+ <feature policy='require' name='flushbyasid'/>
+ <feature policy='require' name='decodeassists'/>
+ <feature policy='require' name='pause-filter'/>
+ <feature policy='require' name='pfthreshold'/>
</cpu>
diff --git a/tests/cputestdata/x86_64-cpuid-Hygon-C86-7185-32-core-host.xml b/tests/cputestdata/x86_64-cpuid-Hygon-C86-7185-32-core-host.xml
index 3d1b143eba..f1cddb6a19 100644
--- a/tests/cputestdata/x86_64-cpuid-Hygon-C86-7185-32-core-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Hygon-C86-7185-32-core-host.xml
@@ -16,4 +16,14 @@
<feature name='invtsc'/>
<feature name='clzero'/>
<feature name='xsaveerptr'/>
+ <feature name='npt'/>
+ <feature name='lbrv'/>
+ <feature name='svm-lock'/>
+ <feature name='nrip-save'/>
+ <feature name='tsc-scale'/>
+ <feature name='vmcb-clean'/>
+ <feature name='flushbyasid'/>
+ <feature name='decodeassists'/>
+ <feature name='pause-filter'/>
+ <feature name='pfthreshold'/>
</cpu>
diff --git a/tests/cputestdata/x86_64-cpuid-Hygon-C86-7185-32-core-json.xml b/tests/cputestdata/x86_64-cpuid-Hygon-C86-7185-32-core-json.xml
index d3003b6965..0fdd934c08 100644
--- a/tests/cputestdata/x86_64-cpuid-Hygon-C86-7185-32-core-json.xml
+++ b/tests/cputestdata/x86_64-cpuid-Hygon-C86-7185-32-core-json.xml
@@ -7,6 +7,8 @@
<feature policy='require' name='tsc_adjust'/>
<feature policy='require' name='cmp_legacy'/>
<feature policy='require' name='virt-ssbd'/>
+ <feature policy='require' name='npt'/>
+ <feature policy='require' name='nrip-save'/>
<feature policy='disable' name='monitor'/>
<feature policy='disable' name='svm'/>
</cpu>
diff --git a/tests/cputestdata/x86_64-cpuid-Opteron-1352-guest.xml b/tests/cputestdata/x86_64-cpuid-Opteron-1352-guest.xml
index 652f1e4333..a52c4cd303 100644
--- a/tests/cputestdata/x86_64-cpuid-Opteron-1352-guest.xml
+++ b/tests/cputestdata/x86_64-cpuid-Opteron-1352-guest.xml
@@ -15,4 +15,7 @@
<feature policy='require' name='osvw'/>
<feature policy='require' name='ibs'/>
<feature policy='require' name='invtsc'/>
+ <feature policy='require' name='npt'/>
+ <feature policy='require' name='lbrv'/>
+ <feature policy='require' name='svm-lock'/>
</cpu>
diff --git a/tests/cputestdata/x86_64-cpuid-Opteron-1352-host.xml b/tests/cputestdata/x86_64-cpuid-Opteron-1352-host.xml
index 399398eb3a..800b092f14 100644
--- a/tests/cputestdata/x86_64-cpuid-Opteron-1352-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Opteron-1352-host.xml
@@ -16,4 +16,7 @@
<feature name='osvw'/>
<feature name='ibs'/>
<feature name='invtsc'/>
+ <feature name='npt'/>
+ <feature name='lbrv'/>
+ <feature name='svm-lock'/>
</cpu>
diff --git a/tests/cputestdata/x86_64-cpuid-Opteron-2350-disabled.xml b/tests/cputestdata/x86_64-cpuid-Opteron-2350-disabled.xml
index 8ec1b12582..3f6fe54055 100644
--- a/tests/cputestdata/x86_64-cpuid-Opteron-2350-disabled.xml
+++ b/tests/cputestdata/x86_64-cpuid-Opteron-2350-disabled.xml
@@ -3,4 +3,5 @@
<cpuid eax_in='0x00000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000008' edx='0x10000000'/>
<cpuid eax_in='0x80000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000408' edx='0x08000000'/>
<cpuid eax_in='0x80000007' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000100'/>
+ <cpuid eax_in='0x8000000a' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000006'/>
</cpudata>
diff --git a/tests/cputestdata/x86_64-cpuid-Opteron-2350-enabled.xml b/tests/cputestdata/x86_64-cpuid-Opteron-2350-enabled.xml
index 913980f15f..5fd0d6066d 100644
--- a/tests/cputestdata/x86_64-cpuid-Opteron-2350-enabled.xml
+++ b/tests/cputestdata/x86_64-cpuid-Opteron-2350-enabled.xml
@@ -2,4 +2,5 @@
<cpudata arch='x86'>
<cpuid eax_in='0x00000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x81a02001' edx='0x078bfbff'/>
<cpuid eax_in='0x80000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x000003f7' edx='0xe6500800'/>
+ <cpuid eax_in='0x8000000a' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000001'/>
</cpudata>
diff --git a/tests/cputestdata/x86_64-cpuid-Opteron-2350-guest.xml b/tests/cputestdata/x86_64-cpuid-Opteron-2350-guest.xml
index 652f1e4333..a52c4cd303 100644
--- a/tests/cputestdata/x86_64-cpuid-Opteron-2350-guest.xml
+++ b/tests/cputestdata/x86_64-cpuid-Opteron-2350-guest.xml
@@ -15,4 +15,7 @@
<feature policy='require' name='osvw'/>
<feature policy='require' name='ibs'/>
<feature policy='require' name='invtsc'/>
+ <feature policy='require' name='npt'/>
+ <feature policy='require' name='lbrv'/>
+ <feature policy='require' name='svm-lock'/>
</cpu>
diff --git a/tests/cputestdata/x86_64-cpuid-Opteron-2350-host.xml b/tests/cputestdata/x86_64-cpuid-Opteron-2350-host.xml
index 399398eb3a..800b092f14 100644
--- a/tests/cputestdata/x86_64-cpuid-Opteron-2350-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Opteron-2350-host.xml
@@ -16,4 +16,7 @@
<feature name='osvw'/>
<feature name='ibs'/>
<feature name='invtsc'/>
+ <feature name='npt'/>
+ <feature name='lbrv'/>
+ <feature name='svm-lock'/>
</cpu>
diff --git a/tests/cputestdata/x86_64-cpuid-Opteron-2350-json.xml b/tests/cputestdata/x86_64-cpuid-Opteron-2350-json.xml
index 741757aeb2..d128553c13 100644
--- a/tests/cputestdata/x86_64-cpuid-Opteron-2350-json.xml
+++ b/tests/cputestdata/x86_64-cpuid-Opteron-2350-json.xml
@@ -14,6 +14,7 @@
<feature policy='require' name='cr8legacy'/>
<feature policy='require' name='3dnowprefetch'/>
<feature policy='require' name='osvw'/>
+ <feature policy='require' name='npt'/>
<feature policy='disable' name='monitor'/>
<feature policy='disable' name='rdtscp'/>
</cpu>
diff --git a/tests/cputestdata/x86_64-cpuid-Opteron-6234-disabled.xml b/tests/cputestdata/x86_64-cpuid-Opteron-6234-disabled.xml
index 88124d1745..4dcd74103b 100644
--- a/tests/cputestdata/x86_64-cpuid-Opteron-6234-disabled.xml
+++ b/tests/cputestdata/x86_64-cpuid-Opteron-6234-disabled.xml
@@ -3,4 +3,5 @@
<cpuid eax_in='0x00000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x08000008' edx='0x10000000'/>
<cpuid eax_in='0x80000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x01c8b40c' edx='0x08000000'/>
<cpuid eax_in='0x80000007' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000100'/>
+ <cpuid eax_in='0x8000000a' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x000014f6'/>
</cpudata>
diff --git a/tests/cputestdata/x86_64-cpuid-Opteron-6234-enabled.xml b/tests/cputestdata/x86_64-cpuid-Opteron-6234-enabled.xml
index 38d716449d..890b5df060 100644
--- a/tests/cputestdata/x86_64-cpuid-Opteron-6234-enabled.xml
+++ b/tests/cputestdata/x86_64-cpuid-Opteron-6234-enabled.xml
@@ -4,4 +4,5 @@
<cpuid eax_in='0x00000006' ecx_in='0x00' eax='0x00000004' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
<cpuid eax_in='0x00000007' ecx_in='0x00' eax='0x00000000' ebx='0x00000002' ecx='0x00000000' edx='0x00000000'/>
<cpuid eax_in='0x80000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00010bf3' edx='0x26500800'/>
+ <cpuid eax_in='0x8000000a' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000009'/>
</cpudata>
diff --git a/tests/cputestdata/x86_64-cpuid-Opteron-6234-guest.xml b/tests/cputestdata/x86_64-cpuid-Opteron-6234-guest.xml
index 6bd032bbcb..ee34ea8547 100644
--- a/tests/cputestdata/x86_64-cpuid-Opteron-6234-guest.xml
+++ b/tests/cputestdata/x86_64-cpuid-Opteron-6234-guest.xml
@@ -20,4 +20,14 @@
<feature policy='require' name='perfctr_core'/>
<feature policy='require' name='perfctr_nb'/>
<feature policy='require' name='invtsc'/>
+ <feature policy='require' name='npt'/>
+ <feature policy='require' name='lbrv'/>
+ <feature policy='require' name='svm-lock'/>
+ <feature policy='require' name='nrip-save'/>
+ <feature policy='require' name='tsc-scale'/>
+ <feature policy='require' name='vmcb-clean'/>
+ <feature policy='require' name='flushbyasid'/>
+ <feature policy='require' name='decodeassists'/>
+ <feature policy='require' name='pause-filter'/>
+ <feature policy='require' name='pfthreshold'/>
</cpu>
diff --git a/tests/cputestdata/x86_64-cpuid-Opteron-6234-host.xml b/tests/cputestdata/x86_64-cpuid-Opteron-6234-host.xml
index ec670c612e..75595c02af 100644
--- a/tests/cputestdata/x86_64-cpuid-Opteron-6234-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Opteron-6234-host.xml
@@ -21,4 +21,14 @@
<feature name='perfctr_core'/>
<feature name='perfctr_nb'/>
<feature name='invtsc'/>
+ <feature name='npt'/>
+ <feature name='lbrv'/>
+ <feature name='svm-lock'/>
+ <feature name='nrip-save'/>
+ <feature name='tsc-scale'/>
+ <feature name='vmcb-clean'/>
+ <feature name='flushbyasid'/>
+ <feature name='decodeassists'/>
+ <feature name='pause-filter'/>
+ <feature name='pfthreshold'/>
</cpu>
diff --git a/tests/cputestdata/x86_64-cpuid-Opteron-6234-json.xml b/tests/cputestdata/x86_64-cpuid-Opteron-6234-json.xml
index 2ad3c98a5a..abfc8db290 100644
--- a/tests/cputestdata/x86_64-cpuid-Opteron-6234-json.xml
+++ b/tests/cputestdata/x86_64-cpuid-Opteron-6234-json.xml
@@ -12,6 +12,8 @@
<feature policy='require' name='cmp_legacy'/>
<feature policy='require' name='cr8legacy'/>
<feature policy='require' name='osvw'/>
+ <feature policy='require' name='npt'/>
+ <feature policy='require' name='nrip-save'/>
<feature policy='disable' name='rdtscp'/>
<feature policy='disable' name='svm'/>
</cpu>
diff --git a/tests/cputestdata/x86_64-cpuid-Opteron-6282-guest.xml b/tests/cputestdata/x86_64-cpuid-Opteron-6282-guest.xml
index 6bd032bbcb..ee34ea8547 100644
--- a/tests/cputestdata/x86_64-cpuid-Opteron-6282-guest.xml
+++ b/tests/cputestdata/x86_64-cpuid-Opteron-6282-guest.xml
@@ -20,4 +20,14 @@
<feature policy='require' name='perfctr_core'/>
<feature policy='require' name='perfctr_nb'/>
<feature policy='require' name='invtsc'/>
+ <feature policy='require' name='npt'/>
+ <feature policy='require' name='lbrv'/>
+ <feature policy='require' name='svm-lock'/>
+ <feature policy='require' name='nrip-save'/>
+ <feature policy='require' name='tsc-scale'/>
+ <feature policy='require' name='vmcb-clean'/>
+ <feature policy='require' name='flushbyasid'/>
+ <feature policy='require' name='decodeassists'/>
+ <feature policy='require' name='pause-filter'/>
+ <feature policy='require' name='pfthreshold'/>
</cpu>
diff --git a/tests/cputestdata/x86_64-cpuid-Opteron-6282-host.xml b/tests/cputestdata/x86_64-cpuid-Opteron-6282-host.xml
index ec670c612e..75595c02af 100644
--- a/tests/cputestdata/x86_64-cpuid-Opteron-6282-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Opteron-6282-host.xml
@@ -21,4 +21,14 @@
<feature name='perfctr_core'/>
<feature name='perfctr_nb'/>
<feature name='invtsc'/>
+ <feature name='npt'/>
+ <feature name='lbrv'/>
+ <feature name='svm-lock'/>
+ <feature name='nrip-save'/>
+ <feature name='tsc-scale'/>
+ <feature name='vmcb-clean'/>
+ <feature name='flushbyasid'/>
+ <feature name='decodeassists'/>
+ <feature name='pause-filter'/>
+ <feature name='pfthreshold'/>
</cpu>
diff --git a/tests/cputestdata/x86_64-cpuid-Phenom-B95-disabled.xml b/tests/cputestdata/x86_64-cpuid-Phenom-B95-disabled.xml
index d8d4e8a5f9..3910eb6e57 100644
--- a/tests/cputestdata/x86_64-cpuid-Phenom-B95-disabled.xml
+++ b/tests/cputestdata/x86_64-cpuid-Phenom-B95-disabled.xml
@@ -3,4 +3,5 @@
<cpuid eax_in='0x00000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000008' edx='0x10000000'/>
<cpuid eax_in='0x80000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x0000340c' edx='0x08000000'/>
<cpuid eax_in='0x80000007' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000100'/>
+ <cpuid eax_in='0x8000000a' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000006'/>
</cpudata>
diff --git a/tests/cputestdata/x86_64-cpuid-Phenom-B95-enabled.xml b/tests/cputestdata/x86_64-cpuid-Phenom-B95-enabled.xml
index d15e625087..2a090a04d8 100644
--- a/tests/cputestdata/x86_64-cpuid-Phenom-B95-enabled.xml
+++ b/tests/cputestdata/x86_64-cpuid-Phenom-B95-enabled.xml
@@ -2,4 +2,5 @@
<cpudata arch='x86'>
<cpuid eax_in='0x00000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x80a02001' edx='0x078bfbff'/>
<cpuid eax_in='0x80000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x000003f3' edx='0xe6400800'/>
+ <cpuid eax_in='0x8000000a' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000009'/>
</cpudata>
diff --git a/tests/cputestdata/x86_64-cpuid-Phenom-B95-guest.xml b/tests/cputestdata/x86_64-cpuid-Phenom-B95-guest.xml
index d7a06108bc..ab0e99f97d 100644
--- a/tests/cputestdata/x86_64-cpuid-Phenom-B95-guest.xml
+++ b/tests/cputestdata/x86_64-cpuid-Phenom-B95-guest.xml
@@ -17,5 +17,9 @@
<feature policy='require' name='skinit'/>
<feature policy='require' name='wdt'/>
<feature policy='require' name='invtsc'/>
+ <feature policy='require' name='npt'/>
+ <feature policy='require' name='lbrv'/>
+ <feature policy='require' name='svm-lock'/>
+ <feature policy='require' name='nrip-save'/>
<feature policy='disable' name='nx'/>
</cpu>
diff --git a/tests/cputestdata/x86_64-cpuid-Phenom-B95-host.xml b/tests/cputestdata/x86_64-cpuid-Phenom-B95-host.xml
index 127b047854..95875918c9 100644
--- a/tests/cputestdata/x86_64-cpuid-Phenom-B95-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Phenom-B95-host.xml
@@ -28,4 +28,8 @@
<feature name='skinit'/>
<feature name='wdt'/>
<feature name='invtsc'/>
+ <feature name='npt'/>
+ <feature name='lbrv'/>
+ <feature name='svm-lock'/>
+ <feature name='nrip-save'/>
</cpu>
diff --git a/tests/cputestdata/x86_64-cpuid-Phenom-B95-json.xml b/tests/cputestdata/x86_64-cpuid-Phenom-B95-json.xml
index 7ce56ac8e7..d161709981 100644
--- a/tests/cputestdata/x86_64-cpuid-Phenom-B95-json.xml
+++ b/tests/cputestdata/x86_64-cpuid-Phenom-B95-json.xml
@@ -13,6 +13,8 @@
<feature policy='require' name='cr8legacy'/>
<feature policy='require' name='3dnowprefetch'/>
<feature policy='require' name='osvw'/>
+ <feature policy='require' name='npt'/>
+ <feature policy='require' name='nrip-save'/>
<feature policy='disable' name='monitor'/>
<feature policy='disable' name='nx'/>
<feature policy='disable' name='rdtscp'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Ryzen-7-1800X-Eight-Core-disabled.xml b/tests/cputestdata/x86_64-cpuid-Ryzen-7-1800X-Eight-Core-disabled.xml
index 0358ecf478..a63cd5c4b4 100644
--- a/tests/cputestdata/x86_64-cpuid-Ryzen-7-1800X-Eight-Core-disabled.xml
+++ b/tests/cputestdata/x86_64-cpuid-Ryzen-7-1800X-Eight-Core-disabled.xml
@@ -6,4 +6,5 @@
<cpuid eax_in='0x80000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x01c23008' edx='0x00000000'/>
<cpuid eax_in='0x80000007' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000100'/>
<cpuid eax_in='0x80000008' ecx_in='0x00' eax='0x00000000' ebx='0x00000005' ecx='0x00000000' edx='0x00000000'/>
+ <cpuid eax_in='0x8000000a' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x000014f6'/>
</cpudata>
diff --git a/tests/cputestdata/x86_64-cpuid-Ryzen-7-1800X-Eight-Core-enabled.xml b/tests/cputestdata/x86_64-cpuid-Ryzen-7-1800X-Eight-Core-enabled.xml
index a212679fba..f1a0ad3315 100644
--- a/tests/cputestdata/x86_64-cpuid-Ryzen-7-1800X-Eight-Core-enabled.xml
+++ b/tests/cputestdata/x86_64-cpuid-Ryzen-7-1800X-Eight-Core-enabled.xml
@@ -5,4 +5,5 @@
<cpuid eax_in='0x00000007' ecx_in='0x00' eax='0x00000000' ebx='0x009c01ab' ecx='0x00000000' edx='0x00000000'/>
<cpuid eax_in='0x0000000d' ecx_in='0x01' eax='0x00000007' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
<cpuid eax_in='0x80000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x000003f7' edx='0x2e500800'/>
+ <cpuid eax_in='0x8000000a' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000009'/>
</cpudata>
diff --git a/tests/cputestdata/x86_64-cpuid-Ryzen-7-1800X-Eight-Core-guest.xml b/tests/cputestdata/x86_64-cpuid-Ryzen-7-1800X-Eight-Core-guest.xml
index 612e571609..0053913327 100644
--- a/tests/cputestdata/x86_64-cpuid-Ryzen-7-1800X-Eight-Core-guest.xml
+++ b/tests/cputestdata/x86_64-cpuid-Ryzen-7-1800X-Eight-Core-guest.xml
@@ -15,4 +15,14 @@
<feature policy='require' name='invtsc'/>
<feature policy='require' name='clzero'/>
<feature policy='require' name='xsaveerptr'/>
+ <feature policy='require' name='npt'/>
+ <feature policy='require' name='lbrv'/>
+ <feature policy='require' name='svm-lock'/>
+ <feature policy='require' name='nrip-save'/>
+ <feature policy='require' name='tsc-scale'/>
+ <feature policy='require' name='vmcb-clean'/>
+ <feature policy='require' name='flushbyasid'/>
+ <feature policy='require' name='decodeassists'/>
+ <feature policy='require' name='pause-filter'/>
+ <feature policy='require' name='pfthreshold'/>
</cpu>
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 7498d924e2..7acab0a999 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
@@ -16,4 +16,14 @@
<feature name='invtsc'/>
<feature name='clzero'/>
<feature name='xsaveerptr'/>
+ <feature name='npt'/>
+ <feature name='lbrv'/>
+ <feature name='svm-lock'/>
+ <feature name='nrip-save'/>
+ <feature name='tsc-scale'/>
+ <feature name='vmcb-clean'/>
+ <feature name='flushbyasid'/>
+ <feature name='decodeassists'/>
+ <feature name='pause-filter'/>
+ <feature name='pfthreshold'/>
</cpu>
diff --git a/tests/cputestdata/x86_64-cpuid-Ryzen-7-1800X-Eight-Core-json.xml b/tests/cputestdata/x86_64-cpuid-Ryzen-7-1800X-Eight-Core-json.xml
index 32064548c7..aecc335c1e 100644
--- a/tests/cputestdata/x86_64-cpuid-Ryzen-7-1800X-Eight-Core-json.xml
+++ b/tests/cputestdata/x86_64-cpuid-Ryzen-7-1800X-Eight-Core-json.xml
@@ -6,6 +6,8 @@
<feature policy='require' name='hypervisor'/>
<feature policy='require' name='tsc_adjust'/>
<feature policy='require' name='cmp_legacy'/>
+ <feature policy='require' name='npt'/>
+ <feature policy='require' name='nrip-save'/>
<feature policy='disable' name='monitor'/>
<feature policy='disable' name='sha-ni'/>
</cpu>
diff --git a/tests/domaincapsdata/qemu_3.0.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_3.0.0-tcg.x86_64.xml
index d369fa827a..d3211e7a13 100644
--- a/tests/domaincapsdata/qemu_3.0.0-tcg.x86_64.xml
+++ b/tests/domaincapsdata/qemu_3.0.0-tcg.x86_64.xml
@@ -43,6 +43,7 @@
<feature policy='require' name='la57'/>
<feature policy='require' name='3dnowext'/>
<feature policy='require' name='3dnow'/>
+ <feature policy='require' name='npt'/>
<feature policy='disable' name='vme'/>
<feature policy='disable' name='fma'/>
<feature policy='disable' name='avx'/>
diff --git a/tests/domaincapsdata/qemu_3.1.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_3.1.0-tcg.x86_64.xml
index 444d90504e..756b28034e 100644
--- a/tests/domaincapsdata/qemu_3.1.0-tcg.x86_64.xml
+++ b/tests/domaincapsdata/qemu_3.1.0-tcg.x86_64.xml
@@ -43,6 +43,7 @@
<feature policy='require' name='la57'/>
<feature policy='require' name='3dnowext'/>
<feature policy='require' name='3dnow'/>
+ <feature policy='require' name='npt'/>
<feature policy='disable' name='vme'/>
<feature policy='disable' name='fma'/>
<feature policy='disable' name='avx'/>
diff --git a/tests/domaincapsdata/qemu_4.0.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_4.0.0-tcg.x86_64.xml
index 463f0db390..0aa8aa18be 100644
--- a/tests/domaincapsdata/qemu_4.0.0-tcg.x86_64.xml
+++ b/tests/domaincapsdata/qemu_4.0.0-tcg.x86_64.xml
@@ -43,6 +43,7 @@
<feature policy='require' name='la57'/>
<feature policy='require' name='3dnowext'/>
<feature policy='require' name='3dnow'/>
+ <feature policy='require' name='npt'/>
<feature policy='disable' name='vme'/>
<feature policy='disable' name='fma'/>
<feature policy='disable' name='avx'/>
@@ -57,6 +58,7 @@
<feature policy='disable' name='3dnowprefetch'/>
<feature policy='disable' name='osvw'/>
<feature policy='disable' name='topoext'/>
+ <feature policy='disable' name='nrip-save'/>
</mode>
<mode name='custom' supported='yes'>
<model usable='yes'>qemu64</model>
diff --git a/tests/domaincapsdata/qemu_4.1.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_4.1.0-tcg.x86_64.xml
index 5bfd065986..d6265ce243 100644
--- a/tests/domaincapsdata/qemu_4.1.0-tcg.x86_64.xml
+++ b/tests/domaincapsdata/qemu_4.1.0-tcg.x86_64.xml
@@ -43,6 +43,7 @@
<feature policy='require' name='la57'/>
<feature policy='require' name='3dnowext'/>
<feature policy='require' name='3dnow'/>
+ <feature policy='require' name='npt'/>
<feature policy='disable' name='vme'/>
<feature policy='disable' name='fma'/>
<feature policy='disable' name='avx'/>
@@ -57,6 +58,7 @@
<feature policy='disable' name='osvw'/>
<feature policy='disable' name='topoext'/>
<feature policy='disable' name='ibpb'/>
+ <feature policy='disable' name='nrip-save'/>
</mode>
<mode name='custom' supported='yes'>
<model usable='yes'>qemu64</model>
diff --git a/tests/domaincapsdata/qemu_4.2.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_4.2.0-tcg.x86_64.xml
index c762b0b600..bcaf9afd6f 100644
--- a/tests/domaincapsdata/qemu_4.2.0-tcg.x86_64.xml
+++ b/tests/domaincapsdata/qemu_4.2.0-tcg.x86_64.xml
@@ -43,6 +43,7 @@
<feature policy='require' name='la57'/>
<feature policy='require' name='3dnowext'/>
<feature policy='require' name='3dnow'/>
+ <feature policy='require' name='npt'/>
<feature policy='disable' name='vme'/>
<feature policy='disable' name='fma'/>
<feature policy='disable' name='avx'/>
@@ -57,6 +58,7 @@
<feature policy='disable' name='osvw'/>
<feature policy='disable' name='topoext'/>
<feature policy='disable' name='ibpb'/>
+ <feature policy='disable' name='nrip-save'/>
</mode>
<mode name='custom' supported='yes'>
<model usable='yes'>qemu64</model>
diff --git a/tests/domaincapsdata/qemu_5.0.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_5.0.0-tcg.x86_64.xml
index 0a4bb16a89..eb456dea28 100644
--- a/tests/domaincapsdata/qemu_5.0.0-tcg.x86_64.xml
+++ b/tests/domaincapsdata/qemu_5.0.0-tcg.x86_64.xml
@@ -43,6 +43,7 @@
<feature policy='require' name='la57'/>
<feature policy='require' name='3dnowext'/>
<feature policy='require' name='3dnow'/>
+ <feature policy='require' name='npt'/>
<feature policy='disable' name='vme'/>
<feature policy='disable' name='fma'/>
<feature policy='disable' name='avx'/>
@@ -56,6 +57,7 @@
<feature policy='disable' name='3dnowprefetch'/>
<feature policy='disable' name='osvw'/>
<feature policy='disable' name='topoext'/>
+ <feature policy='disable' name='nrip-save'/>
</mode>
<mode name='custom' supported='yes'>
<model usable='yes'>qemu64</model>
diff --git a/tests/qemuxml2argvdata/cpu-host-model-cmt.x86_64-4.0.0.args b/tests/qemuxml2argvdata/cpu-host-model-cmt.x86_64-4.0.0.args
index b44dc2ec48..6ee7bed18e 100644
--- a/tests/qemuxml2argvdata/cpu-host-model-cmt.x86_64-4.0.0.args
+++ b/tests/qemuxml2argvdata/cpu-host-model-cmt.x86_64-4.0.0.args
@@ -14,9 +14,9 @@ QEMU_AUDIO_DRV=none \
file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
-machine pc-i440fx-4.0,accel=tcg,usb=off,dump-guest-core=off \
-cpu EPYC,acpi=on,ss=on,hypervisor=on,erms=on,mpx=on,pcommit=on,clwb=on,pku=on,\
-la57=on,3dnowext=on,3dnow=on,vme=off,fma=off,avx=off,f16c=off,rdrand=off,\
-avx2=off,rdseed=off,sha-ni=off,xsavec=off,fxsr_opt=off,misalignsse=off,\
-3dnowprefetch=off,osvw=off,topoext=off \
+la57=on,3dnowext=on,3dnow=on,npt=on,vme=off,fma=off,avx=off,f16c=off,\
+rdrand=off,avx2=off,rdseed=off,sha-ni=off,xsavec=off,fxsr_opt=off,\
+misalignsse=off,3dnowprefetch=off,osvw=off,topoext=off,nrip-save=off \
-m 214 \
-overcommit mem-lock=off \
-smp 6,sockets=6,cores=1,threads=1 \
--
2.29.2

View File

@ -1,107 +0,0 @@
From cff220056e78bad15a8addf9739f8a556b7a6ea2 Mon Sep 17 00:00:00 2001
Message-Id: <cff220056e78bad15a8addf9739f8a556b7a6ea2@dist-git>
From: Jiri Denemark <jdenemar@redhat.com>
Date: Thu, 8 Oct 2020 18:01:21 +0200
Subject: [PATCH] cpu_map: Add missing x86 features in 0x7 CPUID leaf
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
(cherry picked from commit 6ea3bb19c6fed39429c95eb284487b849cb12e2a)
https://bugzilla.redhat.com/show_bug.cgi?id=1861506
Conflicts:
tests/cputestdata/x86_64-cpuid-Ryzen-9-3900X-12-Core-enabled.xml
tests/cputestdata/x86_64-cpuid-Ryzen-9-3900X-12-Core-guest.xml
tests/cputestdata/x86_64-cpuid-Ryzen-9-3900X-12-Core-host.xml
tests/cputestdata/x86_64-cpuid-Ryzen-9-3900X-12-Core-json.xml
tests/domaincapsdata/qemu_5.1.0-q35.x86_64.xml
tests/domaincapsdata/qemu_5.1.0.x86_64.xml
- not present downstream
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Message-Id: <04da640b0fbbbcec9be63e552a3029f983bf879a.1602172344.git.jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/cpu_map/x86_features.xml | 12 ++++++++++++
.../x86_64-cpuid-Ice-Lake-Server-disabled.xml | 2 +-
.../x86_64-cpuid-Ice-Lake-Server-guest.xml | 1 +
.../x86_64-cpuid-Ice-Lake-Server-host.xml | 1 +
4 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/src/cpu_map/x86_features.xml b/src/cpu_map/x86_features.xml
index 8525ae0fa5..364e45fb32 100644
--- a/src/cpu_map/x86_features.xml
+++ b/src/cpu_map/x86_features.xml
@@ -286,6 +286,9 @@
<feature name='ospke'>
<cpuid eax_in='0x07' ecx_in='0x00' ecx='0x00000010'/>
</feature>
+ <feature name='waitpkg'>
+ <cpuid eax_in='0x07' ecx_in='0x00' ecx='0x00000020'/>
+ </feature>
<feature name='avx512vbmi2'>
<cpuid eax_in='0x07' ecx_in='0x00' ecx='0x00000040'/>
</feature>
@@ -310,9 +313,18 @@
<feature name='la57'>
<cpuid eax_in='0x07' ecx_in='0x00' ecx='0x00010000'/>
</feature>
+ <feature name='rdpid'>
+ <cpuid eax_in='0x07' ecx_in='0x00' ecx='0x00400000'/>
+ </feature>
<feature name='cldemote'>
<cpuid eax_in='0x07' ecx_in='0x00' ecx='0x02000000'/>
</feature>
+ <feature name='movdiri'>
+ <cpuid eax_in='0x07' ecx_in='0x00' ecx='0x08000000'/>
+ </feature>
+ <feature name='movdir64b'>
+ <cpuid eax_in='0x07' ecx_in='0x00' ecx='0x10000000'/>
+ </feature>
<feature name='avx512-4vnniw'>
<cpuid eax_in='0x07' ecx_in='0x00' edx='0x00000004'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Ice-Lake-Server-disabled.xml b/tests/cputestdata/x86_64-cpuid-Ice-Lake-Server-disabled.xml
index 62c6bad612..ce65579bcc 100644
--- a/tests/cputestdata/x86_64-cpuid-Ice-Lake-Server-disabled.xml
+++ b/tests/cputestdata/x86_64-cpuid-Ice-Lake-Server-disabled.xml
@@ -1,7 +1,7 @@
<!-- Features disabled by QEMU -->
<cpudata arch='x86'>
<cpuid eax_in='0x00000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x0804c1fc' edx='0xb0600000'/>
- <cpuid eax_in='0x00000007' ecx_in='0x00' eax='0x00000000' ebx='0x02001000' ecx='0x00000010' edx='0x00000000'/>
+ <cpuid eax_in='0x00000007' ecx_in='0x00' eax='0x00000000' ebx='0x02001000' ecx='0x00400010' edx='0x00000000'/>
<cpuid eax_in='0x0000000f' ecx_in='0x01' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000006'/>
<cpuid eax_in='0x80000007' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000100'/>
</cpudata>
diff --git a/tests/cputestdata/x86_64-cpuid-Ice-Lake-Server-guest.xml b/tests/cputestdata/x86_64-cpuid-Ice-Lake-Server-guest.xml
index 4676f3aa7d..9b75ace710 100644
--- a/tests/cputestdata/x86_64-cpuid-Ice-Lake-Server-guest.xml
+++ b/tests/cputestdata/x86_64-cpuid-Ice-Lake-Server-guest.xml
@@ -23,6 +23,7 @@
<feature policy='require' name='avx512ifma'/>
<feature policy='require' name='sha-ni'/>
<feature policy='require' name='ospke'/>
+ <feature policy='require' name='rdpid'/>
<feature policy='require' name='stibp'/>
<feature policy='require' name='arch-capabilities'/>
<feature policy='require' name='xsaves'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Ice-Lake-Server-host.xml b/tests/cputestdata/x86_64-cpuid-Ice-Lake-Server-host.xml
index 35b9e39629..efbf9d363b 100644
--- a/tests/cputestdata/x86_64-cpuid-Ice-Lake-Server-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Ice-Lake-Server-host.xml
@@ -24,6 +24,7 @@
<feature name='avx512ifma'/>
<feature name='sha-ni'/>
<feature name='ospke'/>
+ <feature name='rdpid'/>
<feature name='stibp'/>
<feature name='arch-capabilities'/>
<feature name='xsaves'/>
--
2.29.2

View File

@ -1,224 +0,0 @@
From 1d6a30efa98fc0cf39725792efae1a151797589f Mon Sep 17 00:00:00 2001
Message-Id: <1d6a30efa98fc0cf39725792efae1a151797589f@dist-git>
From: Jiri Denemark <jdenemar@redhat.com>
Date: Thu, 8 Oct 2020 18:01:22 +0200
Subject: [PATCH] cpu_map: Add missing x86 features in 0x80000008 CPUID leaf
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
(cherry picked from commit 892b7c70f66abc511e1251382c9183493024f253)
https://bugzilla.redhat.com/show_bug.cgi?id=1861506
Conflicts:
tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-disabled.xml
tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-ibpb-disabled.xml
tests/cputestdata/x86_64-cpuid-Hygon-C86-7185-32-core-disabled.xml
tests/cputestdata/x86_64-cpuid-Ryzen-7-1800X-Eight-Core-disabled.xml
- commit df69263c26 (cpu_map: Request test files update when
adding x86 features) not backported
tests/cputestdata/x86_64-cpuid-Ryzen-9-3900X-12-Core-disabled.xml
tests/cputestdata/x86_64-cpuid-Ryzen-9-3900X-12-Core-enabled.xml
tests/cputestdata/x86_64-cpuid-Ryzen-9-3900X-12-Core-guest.xml
tests/cputestdata/x86_64-cpuid-Ryzen-9-3900X-12-Core-host.xml
tests/cputestdata/x86_64-cpuid-Ryzen-9-3900X-12-Core-json.xml
tests/domaincapsdata/qemu_5.1.0-q35.x86_64.xml
tests/domaincapsdata/qemu_5.1.0.x86_64.xml
- not present downstream
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Message-Id: <27effeb5e12252982411796bd72e078d3afe49cb.1602172344.git.jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/cpu_map/x86_features.xml | 6 ++++++
tests/cputestdata/x86_64-cpuid-Cooperlake-enabled.xml | 2 +-
tests/cputestdata/x86_64-cpuid-Cooperlake-json.xml | 1 +
.../cputestdata/x86_64-cpuid-EPYC-7601-32-Core-disabled.xml | 1 +
tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-guest.xml | 1 +
tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-host.xml | 1 +
.../x86_64-cpuid-EPYC-7601-32-Core-ibpb-disabled.xml | 1 +
.../x86_64-cpuid-EPYC-7601-32-Core-ibpb-guest.xml | 1 +
.../x86_64-cpuid-EPYC-7601-32-Core-ibpb-host.xml | 1 +
.../x86_64-cpuid-Hygon-C86-7185-32-core-disabled.xml | 1 +
.../x86_64-cpuid-Hygon-C86-7185-32-core-guest.xml | 1 +
.../x86_64-cpuid-Hygon-C86-7185-32-core-host.xml | 1 +
.../x86_64-cpuid-Ryzen-7-1800X-Eight-Core-disabled.xml | 1 +
.../x86_64-cpuid-Ryzen-7-1800X-Eight-Core-guest.xml | 1 +
.../x86_64-cpuid-Ryzen-7-1800X-Eight-Core-host.xml | 1 +
15 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/src/cpu_map/x86_features.xml b/src/cpu_map/x86_features.xml
index 364e45fb32..5265b2989b 100644
--- a/src/cpu_map/x86_features.xml
+++ b/src/cpu_map/x86_features.xml
@@ -486,12 +486,18 @@
<feature name='clzero'>
<cpuid eax_in='0x80000008' ebx='0x00000001'/>
</feature>
+ <feature name='xsaveerptr'>
+ <cpuid eax_in='0x80000008' ebx='0x00000004'/>
+ </feature>
<feature name='wbnoinvd'>
<cpuid eax_in='0x80000008' ebx='0x00000200'/>
</feature>
<feature name='ibpb'>
<cpuid eax_in='0x80000008' ebx='0x00001000'/>
</feature>
+ <feature name='amd-stibp'>
+ <cpuid eax_in='0x80000008' ebx='0x00008000'/>
+ </feature>
<feature name='amd-ssbd'>
<cpuid eax_in='0x80000008' ebx='0x01000000'/>
</feature>
diff --git a/tests/cputestdata/x86_64-cpuid-Cooperlake-enabled.xml b/tests/cputestdata/x86_64-cpuid-Cooperlake-enabled.xml
index 2d7f83c80f..1d91c3efa8 100644
--- a/tests/cputestdata/x86_64-cpuid-Cooperlake-enabled.xml
+++ b/tests/cputestdata/x86_64-cpuid-Cooperlake-enabled.xml
@@ -6,6 +6,6 @@
<cpuid eax_in='0x00000007' ecx_in='0x01' eax='0x00000020' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
<cpuid eax_in='0x0000000d' ecx_in='0x01' eax='0x0000000f' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
<cpuid eax_in='0x80000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000121' edx='0x2c100800'/>
- <cpuid eax_in='0x80000008' ecx_in='0x00' eax='0x00000000' ebx='0x01001000' ecx='0x00000000' edx='0x00000000'/>
+ <cpuid eax_in='0x80000008' ecx_in='0x00' eax='0x00000000' ebx='0x01009000' ecx='0x00000000' edx='0x00000000'/>
<msr index='0x10a' edx='0x00000000' eax='0x000001eb'/>
</cpudata>
diff --git a/tests/cputestdata/x86_64-cpuid-Cooperlake-json.xml b/tests/cputestdata/x86_64-cpuid-Cooperlake-json.xml
index fb319d547c..c89e0e5350 100644
--- a/tests/cputestdata/x86_64-cpuid-Cooperlake-json.xml
+++ b/tests/cputestdata/x86_64-cpuid-Cooperlake-json.xml
@@ -10,6 +10,7 @@
<feature policy='require' name='md-clear'/>
<feature policy='require' name='xsaves'/>
<feature policy='require' name='ibpb'/>
+ <feature policy='require' name='amd-stibp'/>
<feature policy='require' name='amd-ssbd'/>
<feature policy='require' name='tsx-ctrl'/>
</cpu>
diff --git a/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-disabled.xml b/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-disabled.xml
index 747d725acf..c26c9c7be3 100644
--- a/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-disabled.xml
+++ b/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-disabled.xml
@@ -4,4 +4,5 @@
<cpuid eax_in='0x0000000d' ecx_in='0x01' eax='0x00000008' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
<cpuid eax_in='0x80000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x01c2300c' edx='0x00000000'/>
<cpuid eax_in='0x80000007' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000100'/>
+ <cpuid eax_in='0x80000008' ecx_in='0x00' eax='0x00000000' ebx='0x00000005' ecx='0x00000000' edx='0x00000000'/>
</cpudata>
diff --git a/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-guest.xml b/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-guest.xml
index b75196aac5..612e571609 100644
--- a/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-guest.xml
+++ b/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-guest.xml
@@ -14,4 +14,5 @@
<feature policy='require' name='perfctr_nb'/>
<feature policy='require' name='invtsc'/>
<feature policy='require' name='clzero'/>
+ <feature policy='require' name='xsaveerptr'/>
</cpu>
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 fd84b526db..7498d924e2 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
@@ -15,4 +15,5 @@
<feature name='perfctr_nb'/>
<feature name='invtsc'/>
<feature name='clzero'/>
+ <feature name='xsaveerptr'/>
</cpu>
diff --git a/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-ibpb-disabled.xml b/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-ibpb-disabled.xml
index af43fca98d..a7f4fa3f01 100644
--- a/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-ibpb-disabled.xml
+++ b/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-ibpb-disabled.xml
@@ -4,4 +4,5 @@
<cpuid eax_in='0x0000000d' ecx_in='0x01' eax='0x00000008' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
<cpuid eax_in='0x80000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x01c2300c' edx='0x08000000'/>
<cpuid eax_in='0x80000007' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000100'/>
+ <cpuid eax_in='0x80000008' ecx_in='0x00' eax='0x00000000' ebx='0x00000005' ecx='0x00000000' edx='0x00000000'/>
</cpudata>
diff --git a/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-ibpb-guest.xml b/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-ibpb-guest.xml
index 5044c8cc35..96fdea306f 100644
--- a/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-ibpb-guest.xml
+++ b/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-ibpb-guest.xml
@@ -14,5 +14,6 @@
<feature policy='require' name='perfctr_nb'/>
<feature policy='require' name='invtsc'/>
<feature policy='require' name='clzero'/>
+ <feature policy='require' name='xsaveerptr'/>
<feature policy='disable' name='rdtscp'/>
</cpu>
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 d7d5ce88d9..4fff74f3aa 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
@@ -15,4 +15,5 @@
<feature name='perfctr_nb'/>
<feature name='invtsc'/>
<feature name='clzero'/>
+ <feature name='xsaveerptr'/>
</cpu>
diff --git a/tests/cputestdata/x86_64-cpuid-Hygon-C86-7185-32-core-disabled.xml b/tests/cputestdata/x86_64-cpuid-Hygon-C86-7185-32-core-disabled.xml
index 747d725acf..c26c9c7be3 100644
--- a/tests/cputestdata/x86_64-cpuid-Hygon-C86-7185-32-core-disabled.xml
+++ b/tests/cputestdata/x86_64-cpuid-Hygon-C86-7185-32-core-disabled.xml
@@ -4,4 +4,5 @@
<cpuid eax_in='0x0000000d' ecx_in='0x01' eax='0x00000008' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
<cpuid eax_in='0x80000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x01c2300c' edx='0x00000000'/>
<cpuid eax_in='0x80000007' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000100'/>
+ <cpuid eax_in='0x80000008' ecx_in='0x00' eax='0x00000000' ebx='0x00000005' ecx='0x00000000' edx='0x00000000'/>
</cpudata>
diff --git a/tests/cputestdata/x86_64-cpuid-Hygon-C86-7185-32-core-guest.xml b/tests/cputestdata/x86_64-cpuid-Hygon-C86-7185-32-core-guest.xml
index 75c71233c6..844b8b9d4f 100644
--- a/tests/cputestdata/x86_64-cpuid-Hygon-C86-7185-32-core-guest.xml
+++ b/tests/cputestdata/x86_64-cpuid-Hygon-C86-7185-32-core-guest.xml
@@ -14,4 +14,5 @@
<feature policy='require' name='perfctr_nb'/>
<feature policy='require' name='invtsc'/>
<feature policy='require' name='clzero'/>
+ <feature policy='require' name='xsaveerptr'/>
</cpu>
diff --git a/tests/cputestdata/x86_64-cpuid-Hygon-C86-7185-32-core-host.xml b/tests/cputestdata/x86_64-cpuid-Hygon-C86-7185-32-core-host.xml
index 82f28067c4..3d1b143eba 100644
--- a/tests/cputestdata/x86_64-cpuid-Hygon-C86-7185-32-core-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Hygon-C86-7185-32-core-host.xml
@@ -15,4 +15,5 @@
<feature name='perfctr_nb'/>
<feature name='invtsc'/>
<feature name='clzero'/>
+ <feature name='xsaveerptr'/>
</cpu>
diff --git a/tests/cputestdata/x86_64-cpuid-Ryzen-7-1800X-Eight-Core-disabled.xml b/tests/cputestdata/x86_64-cpuid-Ryzen-7-1800X-Eight-Core-disabled.xml
index b085050618..0358ecf478 100644
--- a/tests/cputestdata/x86_64-cpuid-Ryzen-7-1800X-Eight-Core-disabled.xml
+++ b/tests/cputestdata/x86_64-cpuid-Ryzen-7-1800X-Eight-Core-disabled.xml
@@ -5,4 +5,5 @@
<cpuid eax_in='0x0000000d' ecx_in='0x01' eax='0x00000008' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
<cpuid eax_in='0x80000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x01c23008' edx='0x00000000'/>
<cpuid eax_in='0x80000007' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000100'/>
+ <cpuid eax_in='0x80000008' ecx_in='0x00' eax='0x00000000' ebx='0x00000005' ecx='0x00000000' edx='0x00000000'/>
</cpudata>
diff --git a/tests/cputestdata/x86_64-cpuid-Ryzen-7-1800X-Eight-Core-guest.xml b/tests/cputestdata/x86_64-cpuid-Ryzen-7-1800X-Eight-Core-guest.xml
index b75196aac5..612e571609 100644
--- a/tests/cputestdata/x86_64-cpuid-Ryzen-7-1800X-Eight-Core-guest.xml
+++ b/tests/cputestdata/x86_64-cpuid-Ryzen-7-1800X-Eight-Core-guest.xml
@@ -14,4 +14,5 @@
<feature policy='require' name='perfctr_nb'/>
<feature policy='require' name='invtsc'/>
<feature policy='require' name='clzero'/>
+ <feature policy='require' name='xsaveerptr'/>
</cpu>
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 fd84b526db..7498d924e2 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
@@ -15,4 +15,5 @@
<feature name='perfctr_nb'/>
<feature name='invtsc'/>
<feature name='clzero'/>
+ <feature name='xsaveerptr'/>
</cpu>
--
2.29.2

View File

@ -1,831 +0,0 @@
From 59287d64100517e89dbd3a88af6fec4755ceab42 Mon Sep 17 00:00:00 2001
Message-Id: <59287d64100517e89dbd3a88af6fec4755ceab42@dist-git>
From: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Date: Tue, 26 May 2020 10:58:55 +0200
Subject: [PATCH] cpu_map: Add more -noTSX x86 CPU models
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
One of the mitigation methods for TAA[1] is to disable TSX
support on the host system. Linux added a mechanism to disable
TSX globally through the kernel command line, and many Linux
distributions now default to tsx=off. This makes existing CPU
models that have HLE and RTM enabled not usable anymore.
Add new versions of all CPU models that have the HLE and RTM
features enabled, that can be used when TSX is disabled in the
host system.
On systems disabling the features without those types defined
in cpu-maps users end up without modern CPU types in the list
of usable CPUs to use in the likes of virsh domcapabilities
or tools higher in the stack like virt-manager.
This adds:
-Cascadelake-Server-noTSX
-Icelake-Client-noTSX
-Icelake-Server-noTSX
-Skylake-Server-noTSX-IBRS
-Skylake-Client-noTSX-IBRS
Introduced in QEMU by commit v4.2.0-rc2-3-g9ab2237f19 (function)
and commit v4.2.0-rc2-4-g02fa60d101 (names)
References:
[1] TAA, TSX asynchronous Abort:
https://software.intel.com/security-software-guidance/insights/deep-dive-intel-transactional-synchronization-extensions-intel-tsx-asynchronous-abort
https://www.kernel.org/doc/html/latest/admin-guide/hw-vuln/tsx_async_abort.html
Fixes: https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1853200
Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Message-Id: <20200310104806.2723-2-christian.ehrhardt@canonical.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
(cherry picked from commit dd17a4eba8618aeb0144f268f2222f65a85425fc)
https://bugzilla.redhat.com/show_bug.cgi?id=1840008
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Message-Id: <ab2edc2c9107c87dfa7153b6c54ddd1401c82a4b.1590483392.git.jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/cpu_map/Makefile.inc.am | 5 ++
src/cpu_map/index.xml | 5 ++
src/cpu_map/x86_Cascadelake-Server-noTSX.xml | 78 ++++++++++++++++
src/cpu_map/x86_Icelake-Client-noTSX.xml | 81 +++++++++++++++++
src/cpu_map/x86_Icelake-Server-noTSX.xml | 90 +++++++++++++++++++
src/cpu_map/x86_Skylake-Client-noTSX-IBRS.xml | 73 +++++++++++++++
src/cpu_map/x86_Skylake-Server-noTSX-IBRS.xml | 75 ++++++++++++++++
.../x86_64-cpuid-Core-i7-8550U-guest.xml | 4 +-
.../x86_64-cpuid-Core-i7-8550U-host.xml | 11 +--
.../x86_64-cpuid-Core-i7-8550U-json.xml | 4 +-
.../domaincapsdata/qemu_4.2.0-q35.x86_64.xml | 5 ++
.../domaincapsdata/qemu_4.2.0-tcg.x86_64.xml | 5 ++
tests/domaincapsdata/qemu_4.2.0.x86_64.xml | 5 ++
.../domaincapsdata/qemu_5.0.0-q35.x86_64.xml | 5 ++
.../domaincapsdata/qemu_5.0.0-tcg.x86_64.xml | 5 ++
tests/domaincapsdata/qemu_5.0.0.x86_64.xml | 5 ++
16 files changed, 440 insertions(+), 16 deletions(-)
create mode 100644 src/cpu_map/x86_Cascadelake-Server-noTSX.xml
create mode 100644 src/cpu_map/x86_Icelake-Client-noTSX.xml
create mode 100644 src/cpu_map/x86_Icelake-Server-noTSX.xml
create mode 100644 src/cpu_map/x86_Skylake-Client-noTSX-IBRS.xml
create mode 100644 src/cpu_map/x86_Skylake-Server-noTSX-IBRS.xml
diff --git a/src/cpu_map/Makefile.inc.am b/src/cpu_map/Makefile.inc.am
index e935178304..be64c9a0d4 100644
--- a/src/cpu_map/Makefile.inc.am
+++ b/src/cpu_map/Makefile.inc.am
@@ -20,6 +20,7 @@ cpumap_DATA = \
cpu_map/x86_Broadwell-noTSX.xml \
cpu_map/x86_Broadwell-noTSX-IBRS.xml \
cpu_map/x86_Cascadelake-Server.xml \
+ cpu_map/x86_Cascadelake-Server-noTSX.xml \
cpu_map/x86_Conroe.xml \
cpu_map/x86_core2duo.xml \
cpu_map/x86_coreduo.xml \
@@ -33,7 +34,9 @@ cpumap_DATA = \
cpu_map/x86_Haswell-noTSX.xml \
cpu_map/x86_Haswell-noTSX-IBRS.xml \
cpu_map/x86_Icelake-Client.xml \
+ cpu_map/x86_Icelake-Client-noTSX.xml \
cpu_map/x86_Icelake-Server.xml \
+ cpu_map/x86_Icelake-Server-noTSX.xml \
cpu_map/x86_IvyBridge.xml \
cpu_map/x86_IvyBridge-IBRS.xml \
cpu_map/x86_kvm32.xml \
@@ -58,8 +61,10 @@ cpumap_DATA = \
cpu_map/x86_SandyBridge-IBRS.xml \
cpu_map/x86_Skylake-Client.xml \
cpu_map/x86_Skylake-Client-IBRS.xml \
+ cpu_map/x86_Skylake-Client-noTSX-IBRS.xml \
cpu_map/x86_Skylake-Server.xml \
cpu_map/x86_Skylake-Server-IBRS.xml \
+ cpu_map/x86_Skylake-Server-noTSX-IBRS.xml \
cpu_map/x86_Westmere.xml \
cpu_map/x86_Westmere-IBRS.xml \
$(NULL)
diff --git a/src/cpu_map/index.xml b/src/cpu_map/index.xml
index ffb2f6fe1b..50b030de29 100644
--- a/src/cpu_map/index.xml
+++ b/src/cpu_map/index.xml
@@ -44,11 +44,16 @@
<include filename="x86_Broadwell-IBRS.xml"/>
<include filename="x86_Skylake-Client.xml"/>
<include filename="x86_Skylake-Client-IBRS.xml"/>
+ <include filename="x86_Skylake-Client-noTSX-IBRS.xml"/>
<include filename="x86_Skylake-Server.xml"/>
<include filename="x86_Skylake-Server-IBRS.xml"/>
+ <include filename="x86_Skylake-Server-noTSX-IBRS.xml"/>
<include filename="x86_Cascadelake-Server.xml"/>
+ <include filename="x86_Cascadelake-Server-noTSX.xml"/>
<include filename="x86_Icelake-Client.xml"/>
+ <include filename="x86_Icelake-Client-noTSX.xml"/>
<include filename="x86_Icelake-Server.xml"/>
+ <include filename="x86_Icelake-Server-noTSX.xml"/>
<!-- AMD CPUs -->
<include filename="x86_athlon.xml"/>
diff --git a/src/cpu_map/x86_Cascadelake-Server-noTSX.xml b/src/cpu_map/x86_Cascadelake-Server-noTSX.xml
new file mode 100644
index 0000000000..d24415ebce
--- /dev/null
+++ b/src/cpu_map/x86_Cascadelake-Server-noTSX.xml
@@ -0,0 +1,78 @@
+<cpus>
+ <model name='Cascadelake-Server-noTSX'>
+ <signature family='6' model='85'/> <!-- 050654 -->
+ <vendor name='Intel'/>
+ <feature name='3dnowprefetch'/>
+ <feature name='abm'/>
+ <feature name='adx'/>
+ <feature name='aes'/>
+ <feature name='apic'/>
+ <feature name='arat'/>
+ <feature name='avx'/>
+ <feature name='avx2'/>
+ <feature name='avx512bw'/>
+ <feature name='avx512cd'/>
+ <feature name='avx512dq'/>
+ <feature name='avx512f'/>
+ <feature name='avx512vl'/>
+ <feature name='avx512vnni'/>
+ <feature name='bmi1'/>
+ <feature name='bmi2'/>
+ <feature name='clflush'/>
+ <feature name='clflushopt'/>
+ <feature name='clwb'/>
+ <feature name='cmov'/>
+ <feature name='cx16'/>
+ <feature name='cx8'/>
+ <feature name='de'/>
+ <feature name='erms'/>
+ <feature name='f16c'/>
+ <feature name='fma'/>
+ <feature name='fpu'/>
+ <feature name='fsgsbase'/>
+ <feature name='fxsr'/>
+ <feature name='invpcid'/>
+ <feature name='lahf_lm'/>
+ <feature name='lm'/>
+ <feature name='mca'/>
+ <feature name='mce'/>
+ <feature name='mmx'/>
+ <feature name='movbe'/>
+ <feature name='mpx'/>
+ <feature name='msr'/>
+ <feature name='mtrr'/>
+ <feature name='nx'/>
+ <feature name='pae'/>
+ <feature name='pat'/>
+ <feature name='pcid'/>
+ <feature name='pclmuldq'/>
+ <feature name='pdpe1gb'/>
+ <feature name='pge'/>
+ <feature name='pni'/>
+ <feature name='popcnt'/>
+ <feature name='pse'/>
+ <feature name='pse36'/>
+ <feature name='rdrand'/>
+ <feature name='rdseed'/>
+ <feature name='rdtscp'/>
+ <feature name='sep'/>
+ <feature name='smap'/>
+ <feature name='smep'/>
+ <feature name='spec-ctrl'/>
+ <feature name='ssbd'/>
+ <feature name='sse'/>
+ <feature name='sse2'/>
+ <feature name='sse4.1'/>
+ <feature name='sse4.2'/>
+ <feature name='ssse3'/>
+ <feature name='syscall'/>
+ <feature name='tsc'/>
+ <feature name='tsc-deadline'/>
+ <feature name='vme'/>
+ <feature name='x2apic'/>
+ <feature name='xgetbv1'/>
+ <feature name='xsave'/>
+ <feature name='xsavec'/>
+ <feature name='xsaveopt'/>
+ </model>
+</cpus>
diff --git a/src/cpu_map/x86_Icelake-Client-noTSX.xml b/src/cpu_map/x86_Icelake-Client-noTSX.xml
new file mode 100644
index 0000000000..cd51881f40
--- /dev/null
+++ b/src/cpu_map/x86_Icelake-Client-noTSX.xml
@@ -0,0 +1,81 @@
+<cpus>
+ <model name='Icelake-Client-noTSX'>
+ <signature family='6' model='126'/> <!-- 0706e0 -->
+ <vendor name='Intel'/>
+ <feature name='3dnowprefetch'/>
+ <feature name='abm'/>
+ <feature name='adx'/>
+ <feature name='aes'/>
+ <feature name='apic'/>
+ <feature name='arat'/>
+ <feature name='avx'/>
+ <feature name='avx2'/>
+ <feature name='avx512-vpopcntdq'/>
+ <feature name='avx512bitalg'/>
+ <feature name='avx512vbmi'/>
+ <feature name='avx512vbmi2'/>
+ <feature name='avx512vnni'/>
+ <feature name='bmi1'/>
+ <feature name='bmi2'/>
+ <feature name='clflush'/>
+ <feature name='cmov'/>
+ <feature name='cx16'/>
+ <feature name='cx8'/>
+ <feature name='de'/>
+ <feature name='erms'/>
+ <feature name='f16c'/>
+ <feature name='fma'/>
+ <feature name='fpu'/>
+ <feature name='fsgsbase'/>
+ <feature name='fxsr'/>
+ <feature name='gfni'/>
+ <feature name='intel-pt'/>
+ <feature name='invpcid'/>
+ <feature name='lahf_lm'/>
+ <feature name='lm'/>
+ <feature name='mca'/>
+ <feature name='mce'/>
+ <feature name='mmx'/>
+ <feature name='movbe'/>
+ <feature name='mpx'/>
+ <feature name='msr'/>
+ <feature name='mtrr'/>
+ <feature name='nx'/>
+ <feature name='pae'/>
+ <feature name='pat'/>
+ <feature name='pcid'/>
+ <feature name='pclmuldq'/>
+ <feature name='pge'/>
+ <feature name='pku'/>
+ <feature name='pni'/>
+ <feature name='popcnt'/>
+ <feature name='pse'/>
+ <feature name='pse36'/>
+ <feature name='rdrand'/>
+ <feature name='rdseed'/>
+ <feature name='rdtscp'/>
+ <feature name='sep'/>
+ <feature name='smap'/>
+ <feature name='smep'/>
+ <feature name='spec-ctrl'/>
+ <feature name='ssbd'/>
+ <feature name='sse'/>
+ <feature name='sse2'/>
+ <feature name='sse4.1'/>
+ <feature name='sse4.2'/>
+ <feature name='ssse3'/>
+ <feature name='syscall'/>
+ <feature name='tsc'/>
+ <feature name='tsc-deadline'/>
+ <feature name='umip'/>
+ <feature name='vaes'/>
+ <feature name='vme'/>
+ <feature name='vpclmulqdq'/>
+ <feature name='wbnoinvd'/>
+ <feature name='x2apic'/>
+ <feature name='xgetbv1'/>
+ <feature name='xsave'/>
+ <feature name='xsavec'/>
+ <feature name='xsaveopt'/>
+ </model>
+</cpus>
diff --git a/src/cpu_map/x86_Icelake-Server-noTSX.xml b/src/cpu_map/x86_Icelake-Server-noTSX.xml
new file mode 100644
index 0000000000..538c656712
--- /dev/null
+++ b/src/cpu_map/x86_Icelake-Server-noTSX.xml
@@ -0,0 +1,90 @@
+<cpus>
+ <model name='Icelake-Server-noTSX'>
+ <signature family='6' model='134'/> <!-- 080660 -->
+ <vendor name='Intel'/>
+ <feature name='3dnowprefetch'/>
+ <feature name='abm'/>
+ <feature name='adx'/>
+ <feature name='aes'/>
+ <feature name='apic'/>
+ <feature name='arat'/>
+ <feature name='avx'/>
+ <feature name='avx2'/>
+ <feature name='avx512-vpopcntdq'/>
+ <feature name='avx512bitalg'/>
+ <feature name='avx512bw'/>
+ <feature name='avx512cd'/>
+ <feature name='avx512dq'/>
+ <feature name='avx512f'/>
+ <feature name='avx512vbmi'/>
+ <feature name='avx512vbmi2'/>
+ <feature name='avx512vl'/>
+ <feature name='avx512vnni'/>
+ <feature name='bmi1'/>
+ <feature name='bmi2'/>
+ <feature name='clflush'/>
+ <feature name='clflushopt'/>
+ <feature name='clwb'/>
+ <feature name='cmov'/>
+ <feature name='cx16'/>
+ <feature name='cx8'/>
+ <feature name='de'/>
+ <feature name='erms'/>
+ <feature name='f16c'/>
+ <feature name='fma'/>
+ <feature name='fpu'/>
+ <feature name='fsgsbase'/>
+ <feature name='fxsr'/>
+ <feature name='gfni'/>
+ <feature name='intel-pt'/>
+ <feature name='invpcid'/>
+ <feature name='la57'/>
+ <feature name='lahf_lm'/>
+ <feature name='lm'/>
+ <feature name='mca'/>
+ <feature name='mce'/>
+ <feature name='mmx'/>
+ <feature name='movbe'/>
+ <feature name='mpx'/>
+ <feature name='msr'/>
+ <feature name='mtrr'/>
+ <feature name='nx'/>
+ <feature name='pae'/>
+ <feature name='pat'/>
+ <feature name='pcid'/>
+ <feature name='pclmuldq'/>
+ <feature name='pdpe1gb'/>
+ <feature name='pge'/>
+ <feature name='pku'/>
+ <feature name='pni'/>
+ <feature name='popcnt'/>
+ <feature name='pse'/>
+ <feature name='pse36'/>
+ <feature name='rdrand'/>
+ <feature name='rdseed'/>
+ <feature name='rdtscp'/>
+ <feature name='sep'/>
+ <feature name='smap'/>
+ <feature name='smep'/>
+ <feature name='spec-ctrl'/>
+ <feature name='ssbd'/>
+ <feature name='sse'/>
+ <feature name='sse2'/>
+ <feature name='sse4.1'/>
+ <feature name='sse4.2'/>
+ <feature name='ssse3'/>
+ <feature name='syscall'/>
+ <feature name='tsc'/>
+ <feature name='tsc-deadline'/>
+ <feature name='umip'/>
+ <feature name='vaes'/>
+ <feature name='vme'/>
+ <feature name='vpclmulqdq'/>
+ <feature name='wbnoinvd'/>
+ <feature name='x2apic'/>
+ <feature name='xgetbv1'/>
+ <feature name='xsave'/>
+ <feature name='xsavec'/>
+ <feature name='xsaveopt'/>
+ </model>
+</cpus>
diff --git a/src/cpu_map/x86_Skylake-Client-noTSX-IBRS.xml b/src/cpu_map/x86_Skylake-Client-noTSX-IBRS.xml
new file mode 100644
index 0000000000..3d2976692f
--- /dev/null
+++ b/src/cpu_map/x86_Skylake-Client-noTSX-IBRS.xml
@@ -0,0 +1,73 @@
+<cpus>
+ <model name='Skylake-Client-noTSX-IBRS'>
+ <signature family='6' model='94'/> <!-- 0506e0 -->
+ <signature family='6' model='78'/> <!-- 0406e0 -->
+ <!-- These are Kaby Lake and Coffee Lake successors to Skylake,
+ but we don't have specific models for them. -->
+ <signature family='6' model='142'/> <!-- 0806e0 -->
+ <signature family='6' model='158'/> <!-- 0906e0 -->
+ <vendor name='Intel'/>
+ <feature name='3dnowprefetch'/>
+ <feature name='abm'/>
+ <feature name='adx'/>
+ <feature name='aes'/>
+ <feature name='apic'/>
+ <feature name='arat'/>
+ <feature name='avx'/>
+ <feature name='avx2'/>
+ <feature name='bmi1'/>
+ <feature name='bmi2'/>
+ <feature name='clflush'/>
+ <feature name='cmov'/>
+ <feature name='cx16'/>
+ <feature name='cx8'/>
+ <feature name='de'/>
+ <feature name='erms'/>
+ <feature name='f16c'/>
+ <feature name='fma'/>
+ <feature name='fpu'/>
+ <feature name='fsgsbase'/>
+ <feature name='fxsr'/>
+ <feature name='invpcid'/>
+ <feature name='lahf_lm'/>
+ <feature name='lm'/>
+ <feature name='mca'/>
+ <feature name='mce'/>
+ <feature name='mmx'/>
+ <feature name='movbe'/>
+ <feature name='mpx'/>
+ <feature name='msr'/>
+ <feature name='mtrr'/>
+ <feature name='nx'/>
+ <feature name='pae'/>
+ <feature name='pat'/>
+ <feature name='pcid'/>
+ <feature name='pclmuldq'/>
+ <feature name='pge'/>
+ <feature name='pni'/>
+ <feature name='popcnt'/>
+ <feature name='pse'/>
+ <feature name='pse36'/>
+ <feature name='rdrand'/>
+ <feature name='rdseed'/>
+ <feature name='rdtscp'/>
+ <feature name='sep'/>
+ <feature name='smap'/>
+ <feature name='smep'/>
+ <feature name='spec-ctrl'/>
+ <feature name='sse'/>
+ <feature name='sse2'/>
+ <feature name='sse4.1'/>
+ <feature name='sse4.2'/>
+ <feature name='ssse3'/>
+ <feature name='syscall'/>
+ <feature name='tsc'/>
+ <feature name='tsc-deadline'/>
+ <feature name='vme'/>
+ <feature name='x2apic'/>
+ <feature name='xgetbv1'/>
+ <feature name='xsave'/>
+ <feature name='xsavec'/>
+ <feature name='xsaveopt'/>
+ </model>
+</cpus>
diff --git a/src/cpu_map/x86_Skylake-Server-noTSX-IBRS.xml b/src/cpu_map/x86_Skylake-Server-noTSX-IBRS.xml
new file mode 100644
index 0000000000..455a072119
--- /dev/null
+++ b/src/cpu_map/x86_Skylake-Server-noTSX-IBRS.xml
@@ -0,0 +1,75 @@
+<cpus>
+ <model name='Skylake-Server-noTSX-IBRS'>
+ <signature family='6' model='85'/> <!-- 050654 -->
+ <vendor name='Intel'/>
+ <feature name='3dnowprefetch'/>
+ <feature name='abm'/>
+ <feature name='adx'/>
+ <feature name='aes'/>
+ <feature name='apic'/>
+ <feature name='arat'/>
+ <feature name='avx'/>
+ <feature name='avx2'/>
+ <feature name='avx512bw'/>
+ <feature name='avx512cd'/>
+ <feature name='avx512dq'/>
+ <feature name='avx512f'/>
+ <feature name='avx512vl'/>
+ <feature name='bmi1'/>
+ <feature name='bmi2'/>
+ <feature name='clflush'/>
+ <feature name='clwb'/>
+ <feature name='cmov'/>
+ <feature name='cx16'/>
+ <feature name='cx8'/>
+ <feature name='de'/>
+ <feature name='erms'/>
+ <feature name='f16c'/>
+ <feature name='fma'/>
+ <feature name='fpu'/>
+ <feature name='fsgsbase'/>
+ <feature name='fxsr'/>
+ <feature name='invpcid'/>
+ <feature name='lahf_lm'/>
+ <feature name='lm'/>
+ <feature name='mca'/>
+ <feature name='mce'/>
+ <feature name='mmx'/>
+ <feature name='movbe'/>
+ <feature name='mpx'/>
+ <feature name='msr'/>
+ <feature name='mtrr'/>
+ <feature name='nx'/>
+ <feature name='pae'/>
+ <feature name='pat'/>
+ <feature name='pcid'/>
+ <feature name='pclmuldq'/>
+ <feature name='pdpe1gb'/>
+ <feature name='pge'/>
+ <feature name='pni'/>
+ <feature name='popcnt'/>
+ <feature name='pse'/>
+ <feature name='pse36'/>
+ <feature name='rdrand'/>
+ <feature name='rdseed'/>
+ <feature name='rdtscp'/>
+ <feature name='sep'/>
+ <feature name='smap'/>
+ <feature name='smep'/>
+ <feature name='spec-ctrl'/>
+ <feature name='sse'/>
+ <feature name='sse2'/>
+ <feature name='sse4.1'/>
+ <feature name='sse4.2'/>
+ <feature name='ssse3'/>
+ <feature name='syscall'/>
+ <feature name='tsc'/>
+ <feature name='tsc-deadline'/>
+ <feature name='vme'/>
+ <feature name='x2apic'/>
+ <feature name='xgetbv1'/>
+ <feature name='xsave'/>
+ <feature name='xsavec'/>
+ <feature name='xsaveopt'/>
+ </model>
+</cpus>
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-8550U-guest.xml b/tests/cputestdata/x86_64-cpuid-Core-i7-8550U-guest.xml
index 92404e4d03..e03c4a06ba 100644
--- a/tests/cputestdata/x86_64-cpuid-Core-i7-8550U-guest.xml
+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-8550U-guest.xml
@@ -1,5 +1,5 @@
<cpu mode='custom' match='exact'>
- <model fallback='forbid'>Skylake-Client-IBRS</model>
+ <model fallback='forbid'>Skylake-Client-noTSX-IBRS</model>
<vendor>Intel</vendor>
<feature policy='require' name='ds'/>
<feature policy='require' name='acpi'/>
@@ -26,6 +26,4 @@
<feature policy='require' name='pdpe1gb'/>
<feature policy='require' name='invtsc'/>
<feature policy='require' name='skip-l1dfl-vmentry'/>
- <feature policy='disable' name='hle'/>
- <feature policy='disable' name='rtm'/>
</cpu>
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 808a8ff969..7f6fe2eac3 100644
--- a/tests/cputestdata/x86_64-cpuid-Core-i7-8550U-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-8550U-host.xml
@@ -1,8 +1,7 @@
<cpu>
<arch>x86_64</arch>
- <model>Broadwell-noTSX-IBRS</model>
+ <model>Skylake-Client-noTSX-IBRS</model>
<vendor>Intel</vendor>
- <feature name='vme'/>
<feature name='ds'/>
<feature name='acpi'/>
<feature name='ss'/>
@@ -18,22 +17,14 @@
<feature name='xtpr'/>
<feature name='pdcm'/>
<feature name='osxsave'/>
- <feature name='f16c'/>
- <feature name='rdrand'/>
- <feature name='arat'/>
<feature name='tsc_adjust'/>
- <feature name='mpx'/>
<feature name='clflushopt'/>
<feature name='intel-pt'/>
<feature name='md-clear'/>
<feature name='stibp'/>
<feature name='ssbd'/>
- <feature name='xsaveopt'/>
- <feature name='xsavec'/>
- <feature name='xgetbv1'/>
<feature name='xsaves'/>
<feature name='pdpe1gb'/>
- <feature name='abm'/>
<feature name='invtsc'/>
<feature name='skip-l1dfl-vmentry'/>
</cpu>
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-8550U-json.xml b/tests/cputestdata/x86_64-cpuid-Core-i7-8550U-json.xml
index 645c0934c2..3d8e6775bf 100644
--- a/tests/cputestdata/x86_64-cpuid-Core-i7-8550U-json.xml
+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-8550U-json.xml
@@ -1,5 +1,5 @@
<cpu mode='custom' match='exact'>
- <model fallback='forbid'>Skylake-Client-IBRS</model>
+ <model fallback='forbid'>Skylake-Client-noTSX-IBRS</model>
<vendor>Intel</vendor>
<feature policy='require' name='ss'/>
<feature policy='require' name='vmx'/>
@@ -14,6 +14,4 @@
<feature policy='require' name='xsaves'/>
<feature policy='require' name='pdpe1gb'/>
<feature policy='require' name='skip-l1dfl-vmentry'/>
- <feature policy='disable' name='hle'/>
- <feature policy='disable' name='rtm'/>
</cpu>
diff --git a/tests/domaincapsdata/qemu_4.2.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_4.2.0-q35.x86_64.xml
index c4c6bfb564..e257657981 100644
--- a/tests/domaincapsdata/qemu_4.2.0-q35.x86_64.xml
+++ b/tests/domaincapsdata/qemu_4.2.0-q35.x86_64.xml
@@ -63,8 +63,10 @@
<model usable='no'>athlon</model>
<model usable='yes'>Westmere-IBRS</model>
<model usable='yes'>Westmere</model>
+ <model usable='no'>Skylake-Server-noTSX-IBRS</model>
<model usable='no'>Skylake-Server-IBRS</model>
<model usable='no'>Skylake-Server</model>
+ <model usable='yes'>Skylake-Client-noTSX-IBRS</model>
<model usable='yes'>Skylake-Client-IBRS</model>
<model usable='yes'>Skylake-Client</model>
<model usable='yes'>SandyBridge-IBRS</model>
@@ -79,7 +81,9 @@
<model usable='yes'>Nehalem</model>
<model usable='yes'>IvyBridge-IBRS</model>
<model usable='yes'>IvyBridge</model>
+ <model usable='no'>Icelake-Server-noTSX</model>
<model usable='no'>Icelake-Server</model>
+ <model usable='no'>Icelake-Client-noTSX</model>
<model usable='no'>Icelake-Client</model>
<model usable='yes'>Haswell-noTSX-IBRS</model>
<model usable='yes'>Haswell-noTSX</model>
@@ -89,6 +93,7 @@
<model usable='no'>EPYC</model>
<model usable='no'>Dhyana</model>
<model usable='yes'>Conroe</model>
+ <model usable='no'>Cascadelake-Server-noTSX</model>
<model usable='no'>Cascadelake-Server</model>
<model usable='yes'>Broadwell-noTSX-IBRS</model>
<model usable='yes'>Broadwell-noTSX</model>
diff --git a/tests/domaincapsdata/qemu_4.2.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_4.2.0-tcg.x86_64.xml
index a7f8d9c5ee..c762b0b600 100644
--- a/tests/domaincapsdata/qemu_4.2.0-tcg.x86_64.xml
+++ b/tests/domaincapsdata/qemu_4.2.0-tcg.x86_64.xml
@@ -73,8 +73,10 @@
<model usable='yes'>athlon</model>
<model usable='no'>Westmere-IBRS</model>
<model usable='no'>Westmere</model>
+ <model usable='no'>Skylake-Server-noTSX-IBRS</model>
<model usable='no'>Skylake-Server-IBRS</model>
<model usable='no'>Skylake-Server</model>
+ <model usable='no'>Skylake-Client-noTSX-IBRS</model>
<model usable='no'>Skylake-Client-IBRS</model>
<model usable='no'>Skylake-Client</model>
<model usable='no'>SandyBridge-IBRS</model>
@@ -89,7 +91,9 @@
<model usable='no'>Nehalem</model>
<model usable='no'>IvyBridge-IBRS</model>
<model usable='no'>IvyBridge</model>
+ <model usable='no'>Icelake-Server-noTSX</model>
<model usable='no'>Icelake-Server</model>
+ <model usable='no'>Icelake-Client-noTSX</model>
<model usable='no'>Icelake-Client</model>
<model usable='no'>Haswell-noTSX-IBRS</model>
<model usable='no'>Haswell-noTSX</model>
@@ -99,6 +103,7 @@
<model usable='no'>EPYC</model>
<model usable='no'>Dhyana</model>
<model usable='yes'>Conroe</model>
+ <model usable='no'>Cascadelake-Server-noTSX</model>
<model usable='no'>Cascadelake-Server</model>
<model usable='no'>Broadwell-noTSX-IBRS</model>
<model usable='no'>Broadwell-noTSX</model>
diff --git a/tests/domaincapsdata/qemu_4.2.0.x86_64.xml b/tests/domaincapsdata/qemu_4.2.0.x86_64.xml
index f0e0f182a4..2918ba9715 100644
--- a/tests/domaincapsdata/qemu_4.2.0.x86_64.xml
+++ b/tests/domaincapsdata/qemu_4.2.0.x86_64.xml
@@ -62,8 +62,10 @@
<model usable='no'>athlon</model>
<model usable='yes'>Westmere-IBRS</model>
<model usable='yes'>Westmere</model>
+ <model usable='no'>Skylake-Server-noTSX-IBRS</model>
<model usable='no'>Skylake-Server-IBRS</model>
<model usable='no'>Skylake-Server</model>
+ <model usable='yes'>Skylake-Client-noTSX-IBRS</model>
<model usable='yes'>Skylake-Client-IBRS</model>
<model usable='yes'>Skylake-Client</model>
<model usable='yes'>SandyBridge-IBRS</model>
@@ -78,7 +80,9 @@
<model usable='yes'>Nehalem</model>
<model usable='yes'>IvyBridge-IBRS</model>
<model usable='yes'>IvyBridge</model>
+ <model usable='no'>Icelake-Server-noTSX</model>
<model usable='no'>Icelake-Server</model>
+ <model usable='no'>Icelake-Client-noTSX</model>
<model usable='no'>Icelake-Client</model>
<model usable='yes'>Haswell-noTSX-IBRS</model>
<model usable='yes'>Haswell-noTSX</model>
@@ -88,6 +92,7 @@
<model usable='no'>EPYC</model>
<model usable='no'>Dhyana</model>
<model usable='yes'>Conroe</model>
+ <model usable='no'>Cascadelake-Server-noTSX</model>
<model usable='no'>Cascadelake-Server</model>
<model usable='yes'>Broadwell-noTSX-IBRS</model>
<model usable='yes'>Broadwell-noTSX</model>
diff --git a/tests/domaincapsdata/qemu_5.0.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_5.0.0-q35.x86_64.xml
index b635d573ef..7b2a929738 100644
--- a/tests/domaincapsdata/qemu_5.0.0-q35.x86_64.xml
+++ b/tests/domaincapsdata/qemu_5.0.0-q35.x86_64.xml
@@ -63,8 +63,10 @@
<model usable='no'>athlon</model>
<model usable='yes'>Westmere-IBRS</model>
<model usable='yes'>Westmere</model>
+ <model usable='no'>Skylake-Server-noTSX-IBRS</model>
<model usable='no'>Skylake-Server-IBRS</model>
<model usable='no'>Skylake-Server</model>
+ <model usable='yes'>Skylake-Client-noTSX-IBRS</model>
<model usable='yes'>Skylake-Client-IBRS</model>
<model usable='yes'>Skylake-Client</model>
<model usable='yes'>SandyBridge-IBRS</model>
@@ -79,7 +81,9 @@
<model usable='yes'>Nehalem</model>
<model usable='yes'>IvyBridge-IBRS</model>
<model usable='yes'>IvyBridge</model>
+ <model usable='no'>Icelake-Server-noTSX</model>
<model usable='no'>Icelake-Server</model>
+ <model usable='no'>Icelake-Client-noTSX</model>
<model usable='no'>Icelake-Client</model>
<model usable='yes'>Haswell-noTSX-IBRS</model>
<model usable='yes'>Haswell-noTSX</model>
@@ -89,6 +93,7 @@
<model usable='no'>EPYC</model>
<model usable='no'>Dhyana</model>
<model usable='yes'>Conroe</model>
+ <model usable='no'>Cascadelake-Server-noTSX</model>
<model usable='no'>Cascadelake-Server</model>
<model usable='yes'>Broadwell-noTSX-IBRS</model>
<model usable='yes'>Broadwell-noTSX</model>
diff --git a/tests/domaincapsdata/qemu_5.0.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_5.0.0-tcg.x86_64.xml
index 0fbc632267..d634803b29 100644
--- a/tests/domaincapsdata/qemu_5.0.0-tcg.x86_64.xml
+++ b/tests/domaincapsdata/qemu_5.0.0-tcg.x86_64.xml
@@ -72,8 +72,10 @@
<model usable='yes'>athlon</model>
<model usable='no'>Westmere-IBRS</model>
<model usable='yes'>Westmere</model>
+ <model usable='no'>Skylake-Server-noTSX-IBRS</model>
<model usable='no'>Skylake-Server-IBRS</model>
<model usable='no'>Skylake-Server</model>
+ <model usable='no'>Skylake-Client-noTSX-IBRS</model>
<model usable='no'>Skylake-Client-IBRS</model>
<model usable='no'>Skylake-Client</model>
<model usable='no'>SandyBridge-IBRS</model>
@@ -88,7 +90,9 @@
<model usable='yes'>Nehalem</model>
<model usable='no'>IvyBridge-IBRS</model>
<model usable='no'>IvyBridge</model>
+ <model usable='no'>Icelake-Server-noTSX</model>
<model usable='no'>Icelake-Server</model>
+ <model usable='no'>Icelake-Client-noTSX</model>
<model usable='no'>Icelake-Client</model>
<model usable='no'>Haswell-noTSX-IBRS</model>
<model usable='no'>Haswell-noTSX</model>
@@ -98,6 +102,7 @@
<model usable='no'>EPYC</model>
<model usable='no'>Dhyana</model>
<model usable='yes'>Conroe</model>
+ <model usable='no'>Cascadelake-Server-noTSX</model>
<model usable='no'>Cascadelake-Server</model>
<model usable='no'>Broadwell-noTSX-IBRS</model>
<model usable='no'>Broadwell-noTSX</model>
diff --git a/tests/domaincapsdata/qemu_5.0.0.x86_64.xml b/tests/domaincapsdata/qemu_5.0.0.x86_64.xml
index 27f76a8a5e..7609d49020 100644
--- a/tests/domaincapsdata/qemu_5.0.0.x86_64.xml
+++ b/tests/domaincapsdata/qemu_5.0.0.x86_64.xml
@@ -62,8 +62,10 @@
<model usable='no'>athlon</model>
<model usable='yes'>Westmere-IBRS</model>
<model usable='yes'>Westmere</model>
+ <model usable='no'>Skylake-Server-noTSX-IBRS</model>
<model usable='no'>Skylake-Server-IBRS</model>
<model usable='no'>Skylake-Server</model>
+ <model usable='yes'>Skylake-Client-noTSX-IBRS</model>
<model usable='yes'>Skylake-Client-IBRS</model>
<model usable='yes'>Skylake-Client</model>
<model usable='yes'>SandyBridge-IBRS</model>
@@ -78,7 +80,9 @@
<model usable='yes'>Nehalem</model>
<model usable='yes'>IvyBridge-IBRS</model>
<model usable='yes'>IvyBridge</model>
+ <model usable='no'>Icelake-Server-noTSX</model>
<model usable='no'>Icelake-Server</model>
+ <model usable='no'>Icelake-Client-noTSX</model>
<model usable='no'>Icelake-Client</model>
<model usable='yes'>Haswell-noTSX-IBRS</model>
<model usable='yes'>Haswell-noTSX</model>
@@ -88,6 +92,7 @@
<model usable='no'>EPYC</model>
<model usable='no'>Dhyana</model>
<model usable='yes'>Conroe</model>
+ <model usable='no'>Cascadelake-Server-noTSX</model>
<model usable='no'>Cascadelake-Server</model>
<model usable='yes'>Broadwell-noTSX-IBRS</model>
<model usable='yes'>Broadwell-noTSX</model>
--
2.26.2

View File

@ -1,212 +0,0 @@
From 7d0790fb5061cb956390ce5f7a2b92ac9702ada6 Mon Sep 17 00:00:00 2001
Message-Id: <7d0790fb5061cb956390ce5f7a2b92ac9702ada6@dist-git>
From: Jiri Denemark <jdenemar@redhat.com>
Date: Tue, 26 May 2020 10:59:39 +0200
Subject: [PATCH] cpu_map: Add pschange-mc-no bit in IA32_ARCH_CAPABILITIES MSR
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
(cherry picked from commit 12eb0c9496e802bad9e5ec71cde888b8fdb1b0b4)
https://bugzilla.redhat.com/show_bug.cgi?id=1781878
Conflicts:
tests/cputestdata/x86_64-cpuid-Ryzen-9-3900X-12-Core-enabled.xml
tests/cputestdata/x86_64-cpuid-Ryzen-9-3900X-12-Core-guest.xml
tests/cputestdata/x86_64-cpuid-Ryzen-9-3900X-12-Core-host.xml
tests/cputestdata/x86_64-cpuid-Ryzen-9-3900X-12-Core-json.xml
tests/domaincapsdata/qemu_5.1.0-q35.x86_64.xml
tests/domaincapsdata/qemu_5.1.0.x86_64.xml
- test data files do not exist downstream
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Message-Id: <d106df21f8423a9acff9eb5bf75ab25611c1de1f.1590483392.git.jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/cpu_map/x86_features.xml | 3 +++
tests/cputestdata/x86_64-cpuid-Cooperlake-guest.xml | 1 +
tests/cputestdata/x86_64-cpuid-Cooperlake-host.xml | 1 +
tests/cputestdata/x86_64-cpuid-Cooperlake-json.xml | 1 +
tests/cputestdata/x86_64-cpuid-Core-i7-8550U-enabled.xml | 2 +-
tests/cputestdata/x86_64-cpuid-Core-i7-8550U-guest.xml | 1 +
tests/cputestdata/x86_64-cpuid-Core-i7-8550U-host.xml | 1 +
tests/cputestdata/x86_64-cpuid-Core-i7-8550U-json.xml | 1 +
tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-enabled.xml | 2 +-
tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-json.xml | 1 +
tests/domaincapsdata/qemu_4.2.0-q35.x86_64.xml | 1 +
tests/domaincapsdata/qemu_4.2.0.x86_64.xml | 1 +
tests/domaincapsdata/qemu_5.0.0-q35.x86_64.xml | 1 +
tests/domaincapsdata/qemu_5.0.0.x86_64.xml | 1 +
14 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/src/cpu_map/x86_features.xml b/src/cpu_map/x86_features.xml
index 2c4c29dc99..8525ae0fa5 100644
--- a/src/cpu_map/x86_features.xml
+++ b/src/cpu_map/x86_features.xml
@@ -509,6 +509,9 @@
<feature name='mds-no'>
<msr index='0x10a' edx='0x00000000' eax='0x00000020'/>
</feature>
+ <feature name='pschange-mc-no'>
+ <msr index='0x10a' edx='0x00000000' eax='0x00000040'/>
+ </feature>
<feature name='tsx-ctrl'>
<msr index='0x10a' edx='0x00000000' eax='0x00000080'/>
</feature>
diff --git a/tests/cputestdata/x86_64-cpuid-Cooperlake-guest.xml b/tests/cputestdata/x86_64-cpuid-Cooperlake-guest.xml
index b5137e3c03..db5598740c 100644
--- a/tests/cputestdata/x86_64-cpuid-Cooperlake-guest.xml
+++ b/tests/cputestdata/x86_64-cpuid-Cooperlake-guest.xml
@@ -35,6 +35,7 @@
<feature policy='require' name='ibrs-all'/>
<feature policy='require' name='skip-l1dfl-vmentry'/>
<feature policy='require' name='mds-no'/>
+ <feature policy='require' name='pschange-mc-no'/>
<feature policy='require' name='tsx-ctrl'/>
<feature policy='require' name='taa-no'/>
</cpu>
diff --git a/tests/cputestdata/x86_64-cpuid-Cooperlake-host.xml b/tests/cputestdata/x86_64-cpuid-Cooperlake-host.xml
index 52b352f4f1..6926b7c975 100644
--- a/tests/cputestdata/x86_64-cpuid-Cooperlake-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Cooperlake-host.xml
@@ -36,6 +36,7 @@
<feature name='ibrs-all'/>
<feature name='skip-l1dfl-vmentry'/>
<feature name='mds-no'/>
+ <feature name='pschange-mc-no'/>
<feature name='tsx-ctrl'/>
<feature name='taa-no'/>
</cpu>
diff --git a/tests/cputestdata/x86_64-cpuid-Cooperlake-json.xml b/tests/cputestdata/x86_64-cpuid-Cooperlake-json.xml
index e323d6205e..fc52805b2f 100644
--- a/tests/cputestdata/x86_64-cpuid-Cooperlake-json.xml
+++ b/tests/cputestdata/x86_64-cpuid-Cooperlake-json.xml
@@ -18,6 +18,7 @@
<feature policy='require' name='ibrs-all'/>
<feature policy='require' name='skip-l1dfl-vmentry'/>
<feature policy='require' name='mds-no'/>
+ <feature policy='require' name='pschange-mc-no'/>
<feature policy='require' name='tsx-ctrl'/>
<feature policy='require' name='taa-no'/>
</cpu>
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-8550U-enabled.xml b/tests/cputestdata/x86_64-cpuid-Core-i7-8550U-enabled.xml
index 6c480eeacf..57f8ebabba 100644
--- a/tests/cputestdata/x86_64-cpuid-Core-i7-8550U-enabled.xml
+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-8550U-enabled.xml
@@ -5,5 +5,5 @@
<cpuid eax_in='0x00000007' ecx_in='0x00' eax='0x00000000' ebx='0x009c47ab' ecx='0x00000004' edx='0xac000400'/>
<cpuid eax_in='0x0000000d' ecx_in='0x01' eax='0x0000000f' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
<cpuid eax_in='0x80000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000121' edx='0x2c100800'/>
- <msr index='0x10a' edx='0x00000000' eax='0x00000008'/>
+ <msr index='0x10a' edx='0x00000000' eax='0x00000048'/>
</cpudata>
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-8550U-guest.xml b/tests/cputestdata/x86_64-cpuid-Core-i7-8550U-guest.xml
index 92404e4d03..ed06515e99 100644
--- a/tests/cputestdata/x86_64-cpuid-Core-i7-8550U-guest.xml
+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-8550U-guest.xml
@@ -26,6 +26,7 @@
<feature policy='require' name='pdpe1gb'/>
<feature policy='require' name='invtsc'/>
<feature policy='require' name='skip-l1dfl-vmentry'/>
+ <feature policy='require' name='pschange-mc-no'/>
<feature policy='disable' name='hle'/>
<feature policy='disable' name='rtm'/>
</cpu>
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 7f6fe2eac3..7681c94649 100644
--- a/tests/cputestdata/x86_64-cpuid-Core-i7-8550U-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-8550U-host.xml
@@ -27,4 +27,5 @@
<feature name='pdpe1gb'/>
<feature name='invtsc'/>
<feature name='skip-l1dfl-vmentry'/>
+ <feature name='pschange-mc-no'/>
</cpu>
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-8550U-json.xml b/tests/cputestdata/x86_64-cpuid-Core-i7-8550U-json.xml
index 645c0934c2..4774d39c7e 100644
--- a/tests/cputestdata/x86_64-cpuid-Core-i7-8550U-json.xml
+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-8550U-json.xml
@@ -14,6 +14,7 @@
<feature policy='require' name='xsaves'/>
<feature policy='require' name='pdpe1gb'/>
<feature policy='require' name='skip-l1dfl-vmentry'/>
+ <feature policy='require' name='pschange-mc-no'/>
<feature policy='disable' name='hle'/>
<feature policy='disable' name='rtm'/>
</cpu>
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-enabled.xml b/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-enabled.xml
index 43c3a93a16..cd082feffe 100644
--- a/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-enabled.xml
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-enabled.xml
@@ -6,5 +6,5 @@
<cpuid eax_in='0x0000000d' ecx_in='0x01' eax='0x0000000f' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
<cpuid eax_in='0x80000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000121' edx='0x2c100800'/>
<cpuid eax_in='0x80000008' ecx_in='0x00' eax='0x00000000' ebx='0x01001000' ecx='0x00000000' edx='0x00000000'/>
- <msr index='0x10a' edx='0x00000000' eax='0x000000ab'/>
+ <msr index='0x10a' edx='0x00000000' eax='0x000000eb'/>
</cpudata>
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-json.xml b/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-json.xml
index 36e95029be..10c256ee1e 100644
--- a/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-json.xml
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-json.xml
@@ -17,5 +17,6 @@
<feature policy='require' name='ibrs-all'/>
<feature policy='require' name='skip-l1dfl-vmentry'/>
<feature policy='require' name='mds-no'/>
+ <feature policy='require' name='pschange-mc-no'/>
<feature policy='require' name='tsx-ctrl'/>
</cpu>
diff --git a/tests/domaincapsdata/qemu_4.2.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_4.2.0-q35.x86_64.xml
index e257657981..4d9616cb69 100644
--- a/tests/domaincapsdata/qemu_4.2.0-q35.x86_64.xml
+++ b/tests/domaincapsdata/qemu_4.2.0-q35.x86_64.xml
@@ -47,6 +47,7 @@
<feature policy='require' name='pdpe1gb'/>
<feature policy='require' name='invtsc'/>
<feature policy='require' name='skip-l1dfl-vmentry'/>
+ <feature policy='require' name='pschange-mc-no'/>
</mode>
<mode name='custom' supported='yes'>
<model usable='yes'>qemu64</model>
diff --git a/tests/domaincapsdata/qemu_4.2.0.x86_64.xml b/tests/domaincapsdata/qemu_4.2.0.x86_64.xml
index 2918ba9715..5210c917aa 100644
--- a/tests/domaincapsdata/qemu_4.2.0.x86_64.xml
+++ b/tests/domaincapsdata/qemu_4.2.0.x86_64.xml
@@ -46,6 +46,7 @@
<feature policy='require' name='pdpe1gb'/>
<feature policy='require' name='invtsc'/>
<feature policy='require' name='skip-l1dfl-vmentry'/>
+ <feature policy='require' name='pschange-mc-no'/>
</mode>
<mode name='custom' supported='yes'>
<model usable='yes'>qemu64</model>
diff --git a/tests/domaincapsdata/qemu_5.0.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_5.0.0-q35.x86_64.xml
index 7b2a929738..b7e2c8a4fe 100644
--- a/tests/domaincapsdata/qemu_5.0.0-q35.x86_64.xml
+++ b/tests/domaincapsdata/qemu_5.0.0-q35.x86_64.xml
@@ -47,6 +47,7 @@
<feature policy='require' name='pdpe1gb'/>
<feature policy='require' name='invtsc'/>
<feature policy='require' name='skip-l1dfl-vmentry'/>
+ <feature policy='require' name='pschange-mc-no'/>
</mode>
<mode name='custom' supported='yes'>
<model usable='yes'>qemu64</model>
diff --git a/tests/domaincapsdata/qemu_5.0.0.x86_64.xml b/tests/domaincapsdata/qemu_5.0.0.x86_64.xml
index 7609d49020..d2741375b4 100644
--- a/tests/domaincapsdata/qemu_5.0.0.x86_64.xml
+++ b/tests/domaincapsdata/qemu_5.0.0.x86_64.xml
@@ -46,6 +46,7 @@
<feature policy='require' name='pdpe1gb'/>
<feature policy='require' name='invtsc'/>
<feature policy='require' name='skip-l1dfl-vmentry'/>
+ <feature policy='require' name='pschange-mc-no'/>
</mode>
<mode name='custom' supported='yes'>
<model usable='yes'>qemu64</model>
--
2.26.2

View File

@ -1,76 +0,0 @@
From 287c112945dda0837c31348dc3c07ad7ed19596f Mon Sep 17 00:00:00 2001
Message-Id: <287c112945dda0837c31348dc3c07ad7ed19596f@dist-git>
From: Tim Wiederhake <twiederh@redhat.com>
Date: Fri, 15 Jan 2021 15:17:20 +0100
Subject: [PATCH] cpu_map: Add support for core-capability CPU feature
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
(cherry picked from commit e06dd56032acf904da1aedfc097fa0cae7cb0b0f)
https://bugzilla.redhat.com/show_bug.cgi?id=1537734
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Message-Id: <20210115141722.14986-5-twiederh@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
---
src/cpu_map/x86_features.xml | 3 +++
tests/cputestdata/x86_64-cpuid-Atom-P5362-disabled.xml | 2 +-
tests/cputestdata/x86_64-cpuid-Atom-P5362-guest.xml | 1 +
tests/cputestdata/x86_64-cpuid-Atom-P5362-host.xml | 1 +
4 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/cpu_map/x86_features.xml b/src/cpu_map/x86_features.xml
index 70e1c7b3fc..f8c0b9046c 100644
--- a/src/cpu_map/x86_features.xml
+++ b/src/cpu_map/x86_features.xml
@@ -350,6 +350,9 @@
<feature name='arch-capabilities'> <!-- arch_capabilities, arch-facilities -->
<cpuid eax_in='0x07' ecx_in='0x00' edx='0x20000000'/>
</feature>
+ <feature name='core-capability'>
+ <cpuid eax_in='0x07' ecx_in='0x00' edx='0x40000000'/>
+ </feature>
<feature name='ssbd'>
<cpuid eax_in='0x07' ecx_in='0x00' edx='0x80000000'/>
</feature>
diff --git a/tests/cputestdata/x86_64-cpuid-Atom-P5362-disabled.xml b/tests/cputestdata/x86_64-cpuid-Atom-P5362-disabled.xml
index 842c7b4a2a..50e8084140 100644
--- a/tests/cputestdata/x86_64-cpuid-Atom-P5362-disabled.xml
+++ b/tests/cputestdata/x86_64-cpuid-Atom-P5362-disabled.xml
@@ -1,7 +1,7 @@
<!-- Features disabled by QEMU -->
<cpudata arch='x86'>
<cpuid eax_in='0x00000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x080041dc' edx='0xb0600000'/>
- <cpuid eax_in='0x00000007' ecx_in='0x00' eax='0x00000000' ebx='0x02001000' ecx='0x00000020' edx='0x00000000'/>
+ <cpuid eax_in='0x00000007' ecx_in='0x00' eax='0x00000000' ebx='0x02001000' ecx='0x00000020' edx='0x40000000'/>
<cpuid eax_in='0x0000000f' ecx_in='0x01' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000006'/>
<cpuid eax_in='0x80000007' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000100'/>
<msr index='0x10a' edx='0x00000000' eax='0x00000100'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Atom-P5362-guest.xml b/tests/cputestdata/x86_64-cpuid-Atom-P5362-guest.xml
index 0f3e2e506e..4ad95f06b4 100644
--- a/tests/cputestdata/x86_64-cpuid-Atom-P5362-guest.xml
+++ b/tests/cputestdata/x86_64-cpuid-Atom-P5362-guest.xml
@@ -37,6 +37,7 @@
<feature policy='require' name='md-clear'/>
<feature policy='require' name='stibp'/>
<feature policy='require' name='arch-capabilities'/>
+ <feature policy='require' name='core-capability'/>
<feature policy='require' name='ssbd'/>
<feature policy='require' name='xsaveopt'/>
<feature policy='require' name='xsavec'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Atom-P5362-host.xml b/tests/cputestdata/x86_64-cpuid-Atom-P5362-host.xml
index 3bd009c1da..cc2b208e6a 100644
--- a/tests/cputestdata/x86_64-cpuid-Atom-P5362-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Atom-P5362-host.xml
@@ -47,6 +47,7 @@
<feature name='md-clear'/>
<feature name='stibp'/>
<feature name='arch-capabilities'/>
+ <feature name='core-capability'/>
<feature name='ssbd'/>
<feature name='xsaveopt'/>
<feature name='xsavec'/>
--
2.30.0

View File

@ -1,76 +0,0 @@
From 7de3eaba72cecf596c732d12485e4f1a6115bf2f Mon Sep 17 00:00:00 2001
Message-Id: <7de3eaba72cecf596c732d12485e4f1a6115bf2f@dist-git>
From: Tim Wiederhake <twiederh@redhat.com>
Date: Fri, 15 Jan 2021 15:17:19 +0100
Subject: [PATCH] cpu_map: Add support for fsrm CPU feature
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
(cherry picked from commit 8c5c660b99101544d8cfcb8edbe48688c04bee25)
https://bugzilla.redhat.com/show_bug.cgi?id=1537734
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Message-Id: <20210115141722.14986-4-twiederh@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
---
src/cpu_map/x86_features.xml | 3 +++
tests/cputestdata/x86_64-cpuid-Ice-Lake-Server-disabled.xml | 2 +-
tests/cputestdata/x86_64-cpuid-Ice-Lake-Server-guest.xml | 1 +
tests/cputestdata/x86_64-cpuid-Ice-Lake-Server-host.xml | 1 +
4 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/cpu_map/x86_features.xml b/src/cpu_map/x86_features.xml
index 30d1375437..70e1c7b3fc 100644
--- a/src/cpu_map/x86_features.xml
+++ b/src/cpu_map/x86_features.xml
@@ -332,6 +332,9 @@
<feature name='avx512-4fmaps'>
<cpuid eax_in='0x07' ecx_in='0x00' edx='0x00000008'/>
</feature>
+ <feature name='fsrm'>
+ <cpuid eax_in='0x07' ecx_in='0x00' edx='0x00000010'/>
+ </feature>
<feature name='md-clear'> <!-- md_clear -->
<cpuid eax_in='0x07' ecx_in='0x00' edx='0x00000400'/>
</feature>
diff --git a/tests/cputestdata/x86_64-cpuid-Ice-Lake-Server-disabled.xml b/tests/cputestdata/x86_64-cpuid-Ice-Lake-Server-disabled.xml
index ce65579bcc..33bd1013f0 100644
--- a/tests/cputestdata/x86_64-cpuid-Ice-Lake-Server-disabled.xml
+++ b/tests/cputestdata/x86_64-cpuid-Ice-Lake-Server-disabled.xml
@@ -1,7 +1,7 @@
<!-- Features disabled by QEMU -->
<cpudata arch='x86'>
<cpuid eax_in='0x00000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x0804c1fc' edx='0xb0600000'/>
- <cpuid eax_in='0x00000007' ecx_in='0x00' eax='0x00000000' ebx='0x02001000' ecx='0x00400010' edx='0x00000000'/>
+ <cpuid eax_in='0x00000007' ecx_in='0x00' eax='0x00000000' ebx='0x02001000' ecx='0x00400010' edx='0x00000010'/>
<cpuid eax_in='0x0000000f' ecx_in='0x01' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000006'/>
<cpuid eax_in='0x80000007' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000100'/>
</cpudata>
diff --git a/tests/cputestdata/x86_64-cpuid-Ice-Lake-Server-guest.xml b/tests/cputestdata/x86_64-cpuid-Ice-Lake-Server-guest.xml
index 9b75ace710..3a71b28cfb 100644
--- a/tests/cputestdata/x86_64-cpuid-Ice-Lake-Server-guest.xml
+++ b/tests/cputestdata/x86_64-cpuid-Ice-Lake-Server-guest.xml
@@ -24,6 +24,7 @@
<feature policy='require' name='sha-ni'/>
<feature policy='require' name='ospke'/>
<feature policy='require' name='rdpid'/>
+ <feature policy='require' name='fsrm'/>
<feature policy='require' name='stibp'/>
<feature policy='require' name='arch-capabilities'/>
<feature policy='require' name='xsaves'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Ice-Lake-Server-host.xml b/tests/cputestdata/x86_64-cpuid-Ice-Lake-Server-host.xml
index efbf9d363b..1582de0422 100644
--- a/tests/cputestdata/x86_64-cpuid-Ice-Lake-Server-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Ice-Lake-Server-host.xml
@@ -25,6 +25,7 @@
<feature name='sha-ni'/>
<feature name='ospke'/>
<feature name='rdpid'/>
+ <feature name='fsrm'/>
<feature name='stibp'/>
<feature name='arch-capabilities'/>
<feature name='xsaves'/>
--
2.30.0

View File

@ -1,72 +0,0 @@
From 4b6dd39819e82b0775e0f324b0b4efa537882878 Mon Sep 17 00:00:00 2001
Message-Id: <4b6dd39819e82b0775e0f324b0b4efa537882878@dist-git>
From: Tim Wiederhake <twiederh@redhat.com>
Date: Fri, 15 Jan 2021 15:17:21 +0100
Subject: [PATCH] cpu_map: Add support for split-lock-detect CPU feature
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
(cherry picked from commit 13db542cf3099f7955438e208dbe4b2b4e58067e)
https://bugzilla.redhat.com/show_bug.cgi?id=1537734
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Message-Id: <20210115141722.14986-6-twiederh@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
---
src/cpu_map/x86_features.xml | 5 +++++
tests/cputestdata/x86_64-cpuid-Atom-P5362-disabled.xml | 1 +
tests/cputestdata/x86_64-cpuid-Atom-P5362-guest.xml | 1 +
tests/cputestdata/x86_64-cpuid-Atom-P5362-host.xml | 1 +
4 files changed, 8 insertions(+)
diff --git a/src/cpu_map/x86_features.xml b/src/cpu_map/x86_features.xml
index f8c0b9046c..83d8e641a8 100644
--- a/src/cpu_map/x86_features.xml
+++ b/src/cpu_map/x86_features.xml
@@ -574,4 +574,9 @@
<feature name='taa-no'>
<msr index='0x10a' edx='0x00000000' eax='0x00000100'/>
</feature>
+
+ <!-- IA32_CORE_CAPABILITIES features -->
+ <feature name='split-lock-detect'>
+ <msr index='0xcf' edx='0x00000000' eax='0x00000020'/>
+ </feature>
</cpus>
diff --git a/tests/cputestdata/x86_64-cpuid-Atom-P5362-disabled.xml b/tests/cputestdata/x86_64-cpuid-Atom-P5362-disabled.xml
index 50e8084140..81ffa7bfd3 100644
--- a/tests/cputestdata/x86_64-cpuid-Atom-P5362-disabled.xml
+++ b/tests/cputestdata/x86_64-cpuid-Atom-P5362-disabled.xml
@@ -4,5 +4,6 @@
<cpuid eax_in='0x00000007' ecx_in='0x00' eax='0x00000000' ebx='0x02001000' ecx='0x00000020' edx='0x40000000'/>
<cpuid eax_in='0x0000000f' ecx_in='0x01' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000006'/>
<cpuid eax_in='0x80000007' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000100'/>
+ <msr index='0xcf' edx='0x00000000' eax='0x00000020'/>
<msr index='0x10a' edx='0x00000000' eax='0x00000100'/>
</cpudata>
diff --git a/tests/cputestdata/x86_64-cpuid-Atom-P5362-guest.xml b/tests/cputestdata/x86_64-cpuid-Atom-P5362-guest.xml
index 4ad95f06b4..2eeff136c4 100644
--- a/tests/cputestdata/x86_64-cpuid-Atom-P5362-guest.xml
+++ b/tests/cputestdata/x86_64-cpuid-Atom-P5362-guest.xml
@@ -53,6 +53,7 @@
<feature policy='require' name='mds-no'/>
<feature policy='require' name='pschange-mc-no'/>
<feature policy='require' name='taa-no'/>
+ <feature policy='require' name='split-lock-detect'/>
<feature policy='disable' name='avx'/>
<feature policy='disable' name='f16c'/>
</cpu>
diff --git a/tests/cputestdata/x86_64-cpuid-Atom-P5362-host.xml b/tests/cputestdata/x86_64-cpuid-Atom-P5362-host.xml
index cc2b208e6a..b3e9d5c1ff 100644
--- a/tests/cputestdata/x86_64-cpuid-Atom-P5362-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Atom-P5362-host.xml
@@ -64,4 +64,5 @@
<feature name='mds-no'/>
<feature name='pschange-mc-no'/>
<feature name='taa-no'/>
+ <feature name='split-lock-detect'/>
</cpu>
--
2.30.0

View File

@ -1,373 +0,0 @@
From b177f66b37d0c64216ec579a5211461609a96ea8 Mon Sep 17 00:00:00 2001
Message-Id: <b177f66b37d0c64216ec579a5211461609a96ea8@dist-git>
From: Tim Wiederhake <twiederh@redhat.com>
Date: Fri, 15 Jan 2021 15:17:22 +0100
Subject: [PATCH] cpu_map: Define and enable Snowridge model
Due to missing pdpe1gb support in the host CPU data, the CPU is still
incorrectly detected as Westmere-IBRS for host capabilities because we
don't have the option to disable features included in the base model
there.
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
(cherry picked from commit f0a5cf4b8a8b5a68348df5e8b197f30dd90b3c34)
https://bugzilla.redhat.com/show_bug.cgi?id=1537734
Conflicts:
- src/cpu_map/index.xml: Context
- src/cpu_map/meson.build: Not present downstream
- tests/domaincapsdata/qemu_5.1.0-q35.x86_64.xml: Not present downstream
- tests/domaincapsdata/qemu_5.1.0-tcg.x86_64.xml: Not present downstream
- tests/domaincapsdata/qemu_5.1.0.x86_64.xml: Not present downstream
- tests/domaincapsdata/qemu_5.2.0-q35.x86_64.xml: Not present downstream
- tests/domaincapsdata/qemu_5.2.0-tcg.x86_64.xml: Not present downstream
- tests/domaincapsdata/qemu_5.2.0.x86_64.xml: Not present downstream
Additions:
- src/cpu_map/Makefile.inc.am: Replaces upstream change of "meson.build"
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Message-Id: <20210115141722.14986-7-twiederh@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
---
src/cpu_map/Makefile.inc.am | 1 +
src/cpu_map/index.xml | 1 +
src/cpu_map/x86_Snowridge.xml | 71 +++++++++++++++++++
.../x86_64-cpuid-Atom-P5362-guest.xml | 28 ++------
.../x86_64-cpuid-Atom-P5362-json.xml | 26 ++-----
.../domaincapsdata/qemu_4.1.0-q35.x86_64.xml | 1 +
.../domaincapsdata/qemu_4.1.0-tcg.x86_64.xml | 1 +
tests/domaincapsdata/qemu_4.1.0.x86_64.xml | 1 +
.../domaincapsdata/qemu_4.2.0-q35.x86_64.xml | 1 +
.../domaincapsdata/qemu_4.2.0-tcg.x86_64.xml | 1 +
tests/domaincapsdata/qemu_4.2.0.x86_64.xml | 1 +
.../domaincapsdata/qemu_5.0.0-q35.x86_64.xml | 1 +
.../domaincapsdata/qemu_5.0.0-tcg.x86_64.xml | 1 +
tests/domaincapsdata/qemu_5.0.0.x86_64.xml | 1 +
14 files changed, 92 insertions(+), 44 deletions(-)
create mode 100644 src/cpu_map/x86_Snowridge.xml
diff --git a/src/cpu_map/Makefile.inc.am b/src/cpu_map/Makefile.inc.am
index aad4b410f9..1dd78c6715 100644
--- a/src/cpu_map/Makefile.inc.am
+++ b/src/cpu_map/Makefile.inc.am
@@ -67,6 +67,7 @@ cpumap_DATA = \
cpu_map/x86_Skylake-Server.xml \
cpu_map/x86_Skylake-Server-IBRS.xml \
cpu_map/x86_Skylake-Server-noTSX-IBRS.xml \
+ cpu_map/x86_Snowridge.xml \
cpu_map/x86_Westmere.xml \
cpu_map/x86_Westmere-IBRS.xml \
$(NULL)
diff --git a/src/cpu_map/index.xml b/src/cpu_map/index.xml
index 633b017a93..2f58261e6d 100644
--- a/src/cpu_map/index.xml
+++ b/src/cpu_map/index.xml
@@ -55,6 +55,7 @@
<include filename="x86_Icelake-Server.xml"/>
<include filename="x86_Icelake-Server-noTSX.xml"/>
<include filename="x86_Cooperlake.xml"/>
+ <include filename='x86_Snowridge.xml'/>
<!-- AMD CPUs -->
<include filename="x86_athlon.xml"/>
diff --git a/src/cpu_map/x86_Snowridge.xml b/src/cpu_map/x86_Snowridge.xml
new file mode 100644
index 0000000000..383a24d367
--- /dev/null
+++ b/src/cpu_map/x86_Snowridge.xml
@@ -0,0 +1,71 @@
+<cpus>
+ <model name='Snowridge'>
+ <decode host='on' guest='on'/>
+ <signature family='6' model='134'/> <!-- 080665 -->
+ <vendor name='Intel'/>
+ <feature name='3dnowprefetch'/>
+ <feature name='aes'/>
+ <feature name='apic'/>
+ <feature name='arat'/>
+ <feature name='arch-capabilities'/>
+ <feature name='cldemote'/>
+ <feature name='clflush'/>
+ <feature name='clflushopt'/>
+ <feature name='clwb'/>
+ <feature name='cmov'/>
+ <feature name='core-capability'/>
+ <feature name='cx16'/>
+ <feature name='cx8'/>
+ <feature name='de'/>
+ <feature name='erms'/>
+ <feature name='fpu'/>
+ <feature name='fsgsbase'/>
+ <feature name='fxsr'/>
+ <feature name='gfni'/>
+ <feature name='lahf_lm'/>
+ <feature name='lm'/>
+ <feature name='mca'/>
+ <feature name='mce'/>
+ <feature name='mmx'/>
+ <feature name='movbe'/>
+ <feature name='movdir64b'/>
+ <feature name='movdiri'/>
+ <feature name='msr'/>
+ <feature name='mtrr'/>
+ <feature name='nx'/>
+ <feature name='pae'/>
+ <feature name='pat'/>
+ <feature name='pclmuldq'/>
+ <feature name='pdpe1gb'/>
+ <feature name='pge'/>
+ <feature name='pni'/>
+ <feature name='popcnt'/>
+ <feature name='pse'/>
+ <feature name='pse36'/>
+ <feature name='rdrand'/>
+ <feature name='rdseed'/>
+ <feature name='rdtscp'/>
+ <feature name='sep'/>
+ <feature name='sha-ni'/>
+ <feature name='smap'/>
+ <feature name='smep'/>
+ <feature name='spec-ctrl'/>
+ <feature name='split-lock-detect'/>
+ <feature name='ssbd'/>
+ <feature name='sse'/>
+ <feature name='sse2'/>
+ <feature name='sse4.1'/>
+ <feature name='sse4.2'/>
+ <feature name='ssse3'/>
+ <feature name='syscall'/>
+ <feature name='tsc'/>
+ <feature name='tsc-deadline'/>
+ <feature name='umip'/>
+ <feature name='vme'/>
+ <feature name='x2apic'/>
+ <feature name='xgetbv1'/>
+ <feature name='xsave'/>
+ <feature name='xsavec'/>
+ <feature name='xsaveopt'/>
+ </model>
+</cpus>
diff --git a/tests/cputestdata/x86_64-cpuid-Atom-P5362-guest.xml b/tests/cputestdata/x86_64-cpuid-Atom-P5362-guest.xml
index 2eeff136c4..f28e70b9e0 100644
--- a/tests/cputestdata/x86_64-cpuid-Atom-P5362-guest.xml
+++ b/tests/cputestdata/x86_64-cpuid-Atom-P5362-guest.xml
@@ -1,5 +1,5 @@
<cpu mode='custom' match='exact'>
- <model fallback='forbid'>IvyBridge-IBRS</model>
+ <model fallback='forbid'>Snowridge</model>
<vendor>Intel</vendor>
<feature policy='require' name='ds'/>
<feature policy='require' name='acpi'/>
@@ -16,36 +16,17 @@
<feature policy='require' name='tm2'/>
<feature policy='require' name='xtpr'/>
<feature policy='require' name='pdcm'/>
- <feature policy='require' name='movbe'/>
<feature policy='require' name='osxsave'/>
- <feature policy='require' name='arat'/>
<feature policy='require' name='tsc_adjust'/>
<feature policy='require' name='cmt'/>
- <feature policy='require' name='rdseed'/>
- <feature policy='require' name='smap'/>
- <feature policy='require' name='clflushopt'/>
- <feature policy='require' name='clwb'/>
<feature policy='require' name='intel-pt'/>
- <feature policy='require' name='sha-ni'/>
- <feature policy='require' name='umip'/>
<feature policy='require' name='waitpkg'/>
- <feature policy='require' name='gfni'/>
<feature policy='require' name='rdpid'/>
- <feature policy='require' name='cldemote'/>
- <feature policy='require' name='movdiri'/>
- <feature policy='require' name='movdir64b'/>
<feature policy='require' name='md-clear'/>
<feature policy='require' name='stibp'/>
- <feature policy='require' name='arch-capabilities'/>
- <feature policy='require' name='core-capability'/>
- <feature policy='require' name='ssbd'/>
- <feature policy='require' name='xsaveopt'/>
- <feature policy='require' name='xsavec'/>
- <feature policy='require' name='xgetbv1'/>
<feature policy='require' name='xsaves'/>
<feature policy='require' name='mbm_total'/>
<feature policy='require' name='mbm_local'/>
- <feature policy='require' name='3dnowprefetch'/>
<feature policy='require' name='invtsc'/>
<feature policy='require' name='rdctl-no'/>
<feature policy='require' name='ibrs-all'/>
@@ -53,7 +34,8 @@
<feature policy='require' name='mds-no'/>
<feature policy='require' name='pschange-mc-no'/>
<feature policy='require' name='taa-no'/>
- <feature policy='require' name='split-lock-detect'/>
- <feature policy='disable' name='avx'/>
- <feature policy='disable' name='f16c'/>
+ <feature policy='disable' name='mpx'/>
+ <feature policy='disable' name='core-capability'/>
+ <feature policy='disable' name='pdpe1gb'/>
+ <feature policy='disable' name='split-lock-detect'/>
</cpu>
diff --git a/tests/cputestdata/x86_64-cpuid-Atom-P5362-json.xml b/tests/cputestdata/x86_64-cpuid-Atom-P5362-json.xml
index ca685d2f80..bbe0919706 100644
--- a/tests/cputestdata/x86_64-cpuid-Atom-P5362-json.xml
+++ b/tests/cputestdata/x86_64-cpuid-Atom-P5362-json.xml
@@ -1,33 +1,15 @@
<cpu mode='custom' match='exact'>
- <model fallback='forbid'>IvyBridge-IBRS</model>
+ <model fallback='forbid'>Snowridge</model>
<vendor>Intel</vendor>
<feature policy='require' name='ss'/>
<feature policy='require' name='vmx'/>
<feature policy='require' name='pdcm'/>
- <feature policy='require' name='movbe'/>
<feature policy='require' name='hypervisor'/>
- <feature policy='require' name='arat'/>
<feature policy='require' name='tsc_adjust'/>
- <feature policy='require' name='rdseed'/>
- <feature policy='require' name='smap'/>
- <feature policy='require' name='clflushopt'/>
- <feature policy='require' name='clwb'/>
- <feature policy='require' name='sha-ni'/>
- <feature policy='require' name='umip'/>
- <feature policy='require' name='gfni'/>
<feature policy='require' name='rdpid'/>
- <feature policy='require' name='cldemote'/>
- <feature policy='require' name='movdiri'/>
- <feature policy='require' name='movdir64b'/>
<feature policy='require' name='md-clear'/>
<feature policy='require' name='stibp'/>
- <feature policy='require' name='arch-capabilities'/>
- <feature policy='require' name='ssbd'/>
- <feature policy='require' name='xsaveopt'/>
- <feature policy='require' name='xsavec'/>
- <feature policy='require' name='xgetbv1'/>
<feature policy='require' name='xsaves'/>
- <feature policy='require' name='3dnowprefetch'/>
<feature policy='require' name='ibpb'/>
<feature policy='require' name='amd-stibp'/>
<feature policy='require' name='amd-ssbd'/>
@@ -36,6 +18,8 @@
<feature policy='require' name='skip-l1dfl-vmentry'/>
<feature policy='require' name='mds-no'/>
<feature policy='require' name='pschange-mc-no'/>
- <feature policy='disable' name='avx'/>
- <feature policy='disable' name='f16c'/>
+ <feature policy='disable' name='mpx'/>
+ <feature policy='disable' name='core-capability'/>
+ <feature policy='disable' name='pdpe1gb'/>
+ <feature policy='disable' name='split-lock-detect'/>
</cpu>
diff --git a/tests/domaincapsdata/qemu_4.1.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_4.1.0-q35.x86_64.xml
index f4ddb66e38..228acde33b 100644
--- a/tests/domaincapsdata/qemu_4.1.0-q35.x86_64.xml
+++ b/tests/domaincapsdata/qemu_4.1.0-q35.x86_64.xml
@@ -63,6 +63,7 @@
<model usable='no'>athlon</model>
<model usable='yes'>Westmere-IBRS</model>
<model usable='yes'>Westmere</model>
+ <model usable='no'>Snowridge</model>
<model usable='no'>Skylake-Server-IBRS</model>
<model usable='no'>Skylake-Server</model>
<model usable='yes'>Skylake-Client-IBRS</model>
diff --git a/tests/domaincapsdata/qemu_4.1.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_4.1.0-tcg.x86_64.xml
index d6265ce243..bda1aba8ed 100644
--- a/tests/domaincapsdata/qemu_4.1.0-tcg.x86_64.xml
+++ b/tests/domaincapsdata/qemu_4.1.0-tcg.x86_64.xml
@@ -75,6 +75,7 @@
<model usable='yes'>athlon</model>
<model usable='no'>Westmere-IBRS</model>
<model usable='no'>Westmere</model>
+ <model usable='no'>Snowridge</model>
<model usable='no'>Skylake-Server-IBRS</model>
<model usable='no'>Skylake-Server</model>
<model usable='no'>Skylake-Client-IBRS</model>
diff --git a/tests/domaincapsdata/qemu_4.1.0.x86_64.xml b/tests/domaincapsdata/qemu_4.1.0.x86_64.xml
index bcc8bbcc7a..bb53138712 100644
--- a/tests/domaincapsdata/qemu_4.1.0.x86_64.xml
+++ b/tests/domaincapsdata/qemu_4.1.0.x86_64.xml
@@ -62,6 +62,7 @@
<model usable='no'>athlon</model>
<model usable='yes'>Westmere-IBRS</model>
<model usable='yes'>Westmere</model>
+ <model usable='no'>Snowridge</model>
<model usable='no'>Skylake-Server-IBRS</model>
<model usable='no'>Skylake-Server</model>
<model usable='yes'>Skylake-Client-IBRS</model>
diff --git a/tests/domaincapsdata/qemu_4.2.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_4.2.0-q35.x86_64.xml
index 4d9616cb69..0a3f3ef564 100644
--- a/tests/domaincapsdata/qemu_4.2.0-q35.x86_64.xml
+++ b/tests/domaincapsdata/qemu_4.2.0-q35.x86_64.xml
@@ -64,6 +64,7 @@
<model usable='no'>athlon</model>
<model usable='yes'>Westmere-IBRS</model>
<model usable='yes'>Westmere</model>
+ <model usable='no'>Snowridge</model>
<model usable='no'>Skylake-Server-noTSX-IBRS</model>
<model usable='no'>Skylake-Server-IBRS</model>
<model usable='no'>Skylake-Server</model>
diff --git a/tests/domaincapsdata/qemu_4.2.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_4.2.0-tcg.x86_64.xml
index bcaf9afd6f..e64b647f51 100644
--- a/tests/domaincapsdata/qemu_4.2.0-tcg.x86_64.xml
+++ b/tests/domaincapsdata/qemu_4.2.0-tcg.x86_64.xml
@@ -75,6 +75,7 @@
<model usable='yes'>athlon</model>
<model usable='no'>Westmere-IBRS</model>
<model usable='no'>Westmere</model>
+ <model usable='no'>Snowridge</model>
<model usable='no'>Skylake-Server-noTSX-IBRS</model>
<model usable='no'>Skylake-Server-IBRS</model>
<model usable='no'>Skylake-Server</model>
diff --git a/tests/domaincapsdata/qemu_4.2.0.x86_64.xml b/tests/domaincapsdata/qemu_4.2.0.x86_64.xml
index 5210c917aa..5525758a48 100644
--- a/tests/domaincapsdata/qemu_4.2.0.x86_64.xml
+++ b/tests/domaincapsdata/qemu_4.2.0.x86_64.xml
@@ -63,6 +63,7 @@
<model usable='no'>athlon</model>
<model usable='yes'>Westmere-IBRS</model>
<model usable='yes'>Westmere</model>
+ <model usable='no'>Snowridge</model>
<model usable='no'>Skylake-Server-noTSX-IBRS</model>
<model usable='no'>Skylake-Server-IBRS</model>
<model usable='no'>Skylake-Server</model>
diff --git a/tests/domaincapsdata/qemu_5.0.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_5.0.0-q35.x86_64.xml
index b2a7087a0e..4cb4bf6cce 100644
--- a/tests/domaincapsdata/qemu_5.0.0-q35.x86_64.xml
+++ b/tests/domaincapsdata/qemu_5.0.0-q35.x86_64.xml
@@ -64,6 +64,7 @@
<model usable='no'>athlon</model>
<model usable='yes'>Westmere-IBRS</model>
<model usable='yes'>Westmere</model>
+ <model usable='no'>Snowridge</model>
<model usable='no'>Skylake-Server-noTSX-IBRS</model>
<model usable='no'>Skylake-Server-IBRS</model>
<model usable='no'>Skylake-Server</model>
diff --git a/tests/domaincapsdata/qemu_5.0.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_5.0.0-tcg.x86_64.xml
index 39b11fb634..b5986404ae 100644
--- a/tests/domaincapsdata/qemu_5.0.0-tcg.x86_64.xml
+++ b/tests/domaincapsdata/qemu_5.0.0-tcg.x86_64.xml
@@ -74,6 +74,7 @@
<model usable='yes'>athlon</model>
<model usable='no'>Westmere-IBRS</model>
<model usable='yes'>Westmere</model>
+ <model usable='no'>Snowridge</model>
<model usable='no'>Skylake-Server-noTSX-IBRS</model>
<model usable='no'>Skylake-Server-IBRS</model>
<model usable='no'>Skylake-Server</model>
diff --git a/tests/domaincapsdata/qemu_5.0.0.x86_64.xml b/tests/domaincapsdata/qemu_5.0.0.x86_64.xml
index 3a1ee23302..0297ce600b 100644
--- a/tests/domaincapsdata/qemu_5.0.0.x86_64.xml
+++ b/tests/domaincapsdata/qemu_5.0.0.x86_64.xml
@@ -63,6 +63,7 @@
<model usable='no'>athlon</model>
<model usable='yes'>Westmere-IBRS</model>
<model usable='yes'>Westmere</model>
+ <model usable='no'>Snowridge</model>
<model usable='no'>Skylake-Server-noTSX-IBRS</model>
<model usable='no'>Skylake-Server-IBRS</model>
<model usable='no'>Skylake-Server</model>
--
2.30.0

View File

@ -1,310 +0,0 @@
From f441299f1b589a60199156a217c5f49fc9de954d Mon Sep 17 00:00:00 2001
Message-Id: <f441299f1b589a60199156a217c5f49fc9de954d@dist-git>
From: Markus Schade <markus.schade@hetzner.com>
Date: Thu, 8 Oct 2020 18:01:25 +0200
Subject: [PATCH] cpu_map: Defined and enable EPYC-Rome model
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Markus Schade <markus.schade@hetzner.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
(cherry picked from commit f941639f86f4bc66c106eb1291f1b58cf9e24680)
https://bugzilla.redhat.com/show_bug.cgi?id=1861506
Conflicts:
src/cpu_map/meson.build
- the corresponding change was applied to Makefile.inc.am as
downstream still uses autotools
tests/cputest.c
tests/cputestdata/x86_64-cpuid-Ryzen-9-3900X-12-Core-host.xml
- test data for Ryzen 9 3900X are not present downstream
tests/domaincapsdata/qemu_5.1.0-q35.x86_64.xml
tests/domaincapsdata/qemu_5.1.0-tcg.x86_64.xml
tests/domaincapsdata/qemu_5.1.0.x86_64.xml
tests/domaincapsdata/qemu_5.2.0-q35.x86_64.xml
tests/domaincapsdata/qemu_5.2.0-tcg.x86_64.xml
tests/domaincapsdata/qemu_5.2.0.x86_64.xml
- not present downstream
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Message-Id: <bc87b8a0b0c408f380792eaf63ff07551185d3a5.1602172344.git.jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/cpu_map/Makefile.inc.am | 1 +
src/cpu_map/index.xml | 1 +
src/cpu_map/x86_EPYC-Rome.xml | 84 +++++++++++++++++++
.../x86_64-cpuid-EPYC-7502-32-Core-guest.xml | 12 +--
.../x86_64-cpuid-EPYC-7502-32-Core-host.xml | 12 +--
.../x86_64-cpuid-EPYC-7502-32-Core-json.xml | 12 +--
.../domaincapsdata/qemu_5.0.0-q35.x86_64.xml | 1 +
.../domaincapsdata/qemu_5.0.0-tcg.x86_64.xml | 1 +
tests/domaincapsdata/qemu_5.0.0.x86_64.xml | 1 +
9 files changed, 92 insertions(+), 33 deletions(-)
create mode 100644 src/cpu_map/x86_EPYC-Rome.xml
diff --git a/src/cpu_map/Makefile.inc.am b/src/cpu_map/Makefile.inc.am
index b949cb0bea..aad4b410f9 100644
--- a/src/cpu_map/Makefile.inc.am
+++ b/src/cpu_map/Makefile.inc.am
@@ -30,6 +30,7 @@ cpumap_DATA = \
cpu_map/x86_Dhyana.xml \
cpu_map/x86_EPYC.xml \
cpu_map/x86_EPYC-IBPB.xml \
+ cpu_map/x86_EPYC-Rome.xml \
cpu_map/x86_Haswell.xml \
cpu_map/x86_Haswell-IBRS.xml \
cpu_map/x86_Haswell-noTSX.xml \
diff --git a/src/cpu_map/index.xml b/src/cpu_map/index.xml
index ff1da2e677..633b017a93 100644
--- a/src/cpu_map/index.xml
+++ b/src/cpu_map/index.xml
@@ -66,6 +66,7 @@
<include filename="x86_Opteron_G5.xml"/>
<include filename="x86_EPYC.xml"/>
<include filename="x86_EPYC-IBPB.xml"/>
+ <include filename="x86_EPYC-Rome.xml"/>
<!-- Hygon CPU models -->
<include filename="x86_Dhyana.xml"/>
diff --git a/src/cpu_map/x86_EPYC-Rome.xml b/src/cpu_map/x86_EPYC-Rome.xml
new file mode 100644
index 0000000000..99fc015fdd
--- /dev/null
+++ b/src/cpu_map/x86_EPYC-Rome.xml
@@ -0,0 +1,84 @@
+<cpus>
+ <model name='EPYC-Rome'>
+ <decode host='on' guest='on'/>
+ <signature family='23' model='49'/>
+ <vendor name='AMD'/>
+ <feature name='3dnowprefetch'/>
+ <feature name='abm'/>
+ <feature name='adx'/>
+ <feature name='aes'/>
+ <feature name='amd-stibp'/>
+ <feature name='apic'/>
+ <feature name='arat'/>
+ <feature name='avx'/>
+ <feature name='avx2'/>
+ <feature name='bmi1'/>
+ <feature name='bmi2'/>
+ <feature name='clflush'/>
+ <feature name='clflushopt'/>
+ <feature name='clwb'/>
+ <feature name='clzero'/>
+ <feature name='cmov'/>
+ <feature name='cr8legacy'/>
+ <feature name='cx16'/>
+ <feature name='cx8'/>
+ <feature name='de'/>
+ <feature name='f16c'/>
+ <feature name='fma'/>
+ <feature name='fpu'/>
+ <feature name='fsgsbase'/>
+ <feature name='fxsr'/>
+ <feature name='fxsr_opt'/>
+ <feature name='ibpb'/>
+ <feature name='lahf_lm'/>
+ <feature name='lm'/>
+ <feature name='mca'/>
+ <feature name='mce'/>
+ <feature name='misalignsse'/>
+ <feature name='mmx'/>
+ <feature name='mmxext'/>
+ <feature name='monitor'/>
+ <feature name='movbe'/>
+ <feature name='msr'/>
+ <feature name='mtrr'/>
+ <feature name='npt'/>
+ <feature name='nrip-save'/>
+ <feature name='nx'/>
+ <feature name='osvw'/>
+ <feature name='pae'/>
+ <feature name='pat'/>
+ <feature name='pclmuldq'/>
+ <feature name='pdpe1gb'/>
+ <feature name='perfctr_core'/>
+ <feature name='pge'/>
+ <feature name='pni'/>
+ <feature name='popcnt'/>
+ <feature name='pse'/>
+ <feature name='pse36'/>
+ <feature name='rdpid'/>
+ <feature name='rdrand'/>
+ <feature name='rdseed'/>
+ <feature name='rdtscp'/>
+ <feature name='sep'/>
+ <feature name='sha-ni'/>
+ <feature name='smap'/>
+ <feature name='smep'/>
+ <feature name='sse'/>
+ <feature name='sse2'/>
+ <feature name='sse4.1'/>
+ <feature name='sse4.2'/>
+ <feature name='sse4a'/>
+ <feature name='ssse3'/>
+ <feature name='svm'/>
+ <feature name='syscall'/>
+ <feature name='tsc'/>
+ <feature name='umip'/>
+ <feature name='vme'/>
+ <feature name='wbnoinvd'/>
+ <feature name='xgetbv1'/>
+ <feature name='xsave'/>
+ <feature name='xsavec'/>
+ <feature name='xsaveerptr'/>
+ <feature name='xsaveopt'/>
+ </model>
+</cpus>
diff --git a/tests/cputestdata/x86_64-cpuid-EPYC-7502-32-Core-guest.xml b/tests/cputestdata/x86_64-cpuid-EPYC-7502-32-Core-guest.xml
index 1320f65a58..cb2caab6f5 100644
--- a/tests/cputestdata/x86_64-cpuid-EPYC-7502-32-Core-guest.xml
+++ b/tests/cputestdata/x86_64-cpuid-EPYC-7502-32-Core-guest.xml
@@ -1,12 +1,9 @@
<cpu mode='custom' match='exact'>
- <model fallback='forbid'>EPYC-IBPB</model>
+ <model fallback='forbid'>EPYC-Rome</model>
<vendor>AMD</vendor>
<feature policy='require' name='ht'/>
<feature policy='require' name='osxsave'/>
<feature policy='require' name='cmt'/>
- <feature policy='require' name='clwb'/>
- <feature policy='require' name='umip'/>
- <feature policy='require' name='rdpid'/>
<feature policy='require' name='xsaves'/>
<feature policy='require' name='mbm_total'/>
<feature policy='require' name='mbm_local'/>
@@ -17,18 +14,11 @@
<feature policy='require' name='wdt'/>
<feature policy='require' name='tce'/>
<feature policy='require' name='topoext'/>
- <feature policy='require' name='perfctr_core'/>
<feature policy='require' name='perfctr_nb'/>
<feature policy='require' name='invtsc'/>
- <feature policy='require' name='clzero'/>
- <feature policy='require' name='xsaveerptr'/>
- <feature policy='require' name='wbnoinvd'/>
- <feature policy='require' name='amd-stibp'/>
<feature policy='require' name='amd-ssbd'/>
- <feature policy='require' name='npt'/>
<feature policy='require' name='lbrv'/>
<feature policy='require' name='svm-lock'/>
- <feature policy='require' name='nrip-save'/>
<feature policy='require' name='tsc-scale'/>
<feature policy='require' name='vmcb-clean'/>
<feature policy='require' name='flushbyasid'/>
diff --git a/tests/cputestdata/x86_64-cpuid-EPYC-7502-32-Core-host.xml b/tests/cputestdata/x86_64-cpuid-EPYC-7502-32-Core-host.xml
index 37905ec812..b6784f9eba 100644
--- a/tests/cputestdata/x86_64-cpuid-EPYC-7502-32-Core-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-EPYC-7502-32-Core-host.xml
@@ -1,13 +1,10 @@
<cpu>
<arch>x86_64</arch>
- <model>EPYC-IBPB</model>
+ <model>EPYC-Rome</model>
<vendor>AMD</vendor>
<feature name='ht'/>
<feature name='osxsave'/>
<feature name='cmt'/>
- <feature name='clwb'/>
- <feature name='umip'/>
- <feature name='rdpid'/>
<feature name='xsaves'/>
<feature name='mbm_total'/>
<feature name='mbm_local'/>
@@ -18,18 +15,11 @@
<feature name='wdt'/>
<feature name='tce'/>
<feature name='topoext'/>
- <feature name='perfctr_core'/>
<feature name='perfctr_nb'/>
<feature name='invtsc'/>
- <feature name='clzero'/>
- <feature name='xsaveerptr'/>
- <feature name='wbnoinvd'/>
- <feature name='amd-stibp'/>
<feature name='amd-ssbd'/>
- <feature name='npt'/>
<feature name='lbrv'/>
<feature name='svm-lock'/>
- <feature name='nrip-save'/>
<feature name='tsc-scale'/>
<feature name='vmcb-clean'/>
<feature name='flushbyasid'/>
diff --git a/tests/cputestdata/x86_64-cpuid-EPYC-7502-32-Core-json.xml b/tests/cputestdata/x86_64-cpuid-EPYC-7502-32-Core-json.xml
index 225cf63852..86466c0547 100644
--- a/tests/cputestdata/x86_64-cpuid-EPYC-7502-32-Core-json.xml
+++ b/tests/cputestdata/x86_64-cpuid-EPYC-7502-32-Core-json.xml
@@ -1,28 +1,18 @@
<cpu mode='custom' match='exact'>
- <model fallback='forbid'>EPYC-IBPB</model>
+ <model fallback='forbid'>EPYC-Rome</model>
<vendor>AMD</vendor>
<feature policy='require' name='x2apic'/>
<feature policy='require' name='tsc-deadline'/>
<feature policy='require' name='hypervisor'/>
<feature policy='require' name='tsc_adjust'/>
- <feature policy='require' name='clwb'/>
- <feature policy='require' name='umip'/>
- <feature policy='require' name='rdpid'/>
<feature policy='require' name='spec-ctrl'/>
<feature policy='require' name='stibp'/>
<feature policy='require' name='arch-capabilities'/>
<feature policy='require' name='ssbd'/>
<feature policy='require' name='xsaves'/>
<feature policy='require' name='cmp_legacy'/>
- <feature policy='require' name='perfctr_core'/>
- <feature policy='require' name='clzero'/>
- <feature policy='require' name='xsaveerptr'/>
- <feature policy='require' name='wbnoinvd'/>
- <feature policy='require' name='amd-stibp'/>
<feature policy='require' name='amd-ssbd'/>
<feature policy='require' name='virt-ssbd'/>
- <feature policy='require' name='npt'/>
- <feature policy='require' name='nrip-save'/>
<feature policy='require' name='rdctl-no'/>
<feature policy='require' name='skip-l1dfl-vmentry'/>
<feature policy='require' name='mds-no'/>
diff --git a/tests/domaincapsdata/qemu_5.0.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_5.0.0-q35.x86_64.xml
index 7bfd786ff6..b2a7087a0e 100644
--- a/tests/domaincapsdata/qemu_5.0.0-q35.x86_64.xml
+++ b/tests/domaincapsdata/qemu_5.0.0-q35.x86_64.xml
@@ -90,6 +90,7 @@
<model usable='yes'>Haswell-noTSX</model>
<model usable='yes'>Haswell-IBRS</model>
<model usable='yes'>Haswell</model>
+ <model usable='no'>EPYC-Rome</model>
<model usable='no'>EPYC-IBPB</model>
<model usable='no'>EPYC</model>
<model usable='no'>Dhyana</model>
diff --git a/tests/domaincapsdata/qemu_5.0.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_5.0.0-tcg.x86_64.xml
index eb456dea28..39b11fb634 100644
--- a/tests/domaincapsdata/qemu_5.0.0-tcg.x86_64.xml
+++ b/tests/domaincapsdata/qemu_5.0.0-tcg.x86_64.xml
@@ -100,6 +100,7 @@
<model usable='no'>Haswell-noTSX</model>
<model usable='no'>Haswell-IBRS</model>
<model usable='no'>Haswell</model>
+ <model usable='no'>EPYC-Rome</model>
<model usable='no'>EPYC-IBPB</model>
<model usable='no'>EPYC</model>
<model usable='no'>Dhyana</model>
diff --git a/tests/domaincapsdata/qemu_5.0.0.x86_64.xml b/tests/domaincapsdata/qemu_5.0.0.x86_64.xml
index d6ee66ab60..3a1ee23302 100644
--- a/tests/domaincapsdata/qemu_5.0.0.x86_64.xml
+++ b/tests/domaincapsdata/qemu_5.0.0.x86_64.xml
@@ -89,6 +89,7 @@
<model usable='yes'>Haswell-noTSX</model>
<model usable='yes'>Haswell-IBRS</model>
<model usable='yes'>Haswell</model>
+ <model usable='no'>EPYC-Rome</model>
<model usable='no'>EPYC-IBPB</model>
<model usable='no'>EPYC</model>
<model usable='no'>Dhyana</model>
--
2.29.2

View File

@ -1,154 +0,0 @@
From f1926a0cb9147ce54484858f5e0f7376ee9ac648 Mon Sep 17 00:00:00 2001
Message-Id: <f1926a0cb9147ce54484858f5e0f7376ee9ac648@dist-git>
From: Jiri Denemark <jdenemar@redhat.com>
Date: Tue, 26 May 2020 10:59:37 +0200
Subject: [PATCH] cpu_map: Distinguish Cascadelake-Server from Skylake-Server
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The signatures of these two CPU model differ only in stepping as both
report family 6 and model 85. Skylake-Server uses stepping 4 or less and
Cascadelake-Server uses stepping 5..7.
https://bugzilla.redhat.com/show_bug.cgi?id=1761678
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit 5d6059f8ec16d64f240dc5e6413ca55a3b46b3f7)
https://bugzilla.redhat.com/show_bug.cgi?id=1840010
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Message-Id: <8711c401083e2605e7d8734764a5fe1b092749b0.1590483392.git.jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/cpu_map/x86_Cascadelake-Server-noTSX.xml | 2 +-
src/cpu_map/x86_Cascadelake-Server.xml | 2 +-
src/cpu_map/x86_Skylake-Server-IBRS.xml | 2 +-
src/cpu_map/x86_Skylake-Server-noTSX-IBRS.xml | 2 +-
src/cpu_map/x86_Skylake-Server.xml | 2 +-
tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-guest.xml | 5 +++--
tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-json.xml | 5 +++--
7 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/src/cpu_map/x86_Cascadelake-Server-noTSX.xml b/src/cpu_map/x86_Cascadelake-Server-noTSX.xml
index 459174a30d..bfd4629836 100644
--- a/src/cpu_map/x86_Cascadelake-Server-noTSX.xml
+++ b/src/cpu_map/x86_Cascadelake-Server-noTSX.xml
@@ -1,7 +1,7 @@
<cpus>
<model name='Cascadelake-Server-noTSX'>
<decode host='on' guest='off'/>
- <signature family='6' model='85'/> <!-- 050654 -->
+ <signature family='6' model='85' stepping='5-7'/> <!-- 050654 -->
<vendor name='Intel'/>
<feature name='3dnowprefetch'/>
<feature name='abm'/>
diff --git a/src/cpu_map/x86_Cascadelake-Server.xml b/src/cpu_map/x86_Cascadelake-Server.xml
index d7ec42f57e..335e9cb584 100644
--- a/src/cpu_map/x86_Cascadelake-Server.xml
+++ b/src/cpu_map/x86_Cascadelake-Server.xml
@@ -1,7 +1,7 @@
<cpus>
<model name='Cascadelake-Server'>
<decode host='on' guest='on'/>
- <signature family='6' model='85'/> <!-- 050654 -->
+ <signature family='6' model='85' stepping='5-7'/> <!-- 050654 -->
<vendor name='Intel'/>
<feature name='3dnowprefetch'/>
<feature name='abm'/>
diff --git a/src/cpu_map/x86_Skylake-Server-IBRS.xml b/src/cpu_map/x86_Skylake-Server-IBRS.xml
index bd6b6457ad..9fb3488809 100644
--- a/src/cpu_map/x86_Skylake-Server-IBRS.xml
+++ b/src/cpu_map/x86_Skylake-Server-IBRS.xml
@@ -1,7 +1,7 @@
<cpus>
<model name='Skylake-Server-IBRS'>
<decode host='on' guest='on'/>
- <signature family='6' model='85'/> <!-- 050654 -->
+ <signature family='6' model='85' stepping='0-4'/> <!-- 050654 -->
<vendor name='Intel'/>
<feature name='3dnowprefetch'/>
<feature name='abm'/>
diff --git a/src/cpu_map/x86_Skylake-Server-noTSX-IBRS.xml b/src/cpu_map/x86_Skylake-Server-noTSX-IBRS.xml
index c2b7de40e8..c162c0acc3 100644
--- a/src/cpu_map/x86_Skylake-Server-noTSX-IBRS.xml
+++ b/src/cpu_map/x86_Skylake-Server-noTSX-IBRS.xml
@@ -1,7 +1,7 @@
<cpus>
<model name='Skylake-Server-noTSX-IBRS'>
<decode host='on' guest='off'/>
- <signature family='6' model='85'/> <!-- 050654 -->
+ <signature family='6' model='85' stepping='0-4'/> <!-- 050654 -->
<vendor name='Intel'/>
<feature name='3dnowprefetch'/>
<feature name='abm'/>
diff --git a/src/cpu_map/x86_Skylake-Server.xml b/src/cpu_map/x86_Skylake-Server.xml
index f96875a85f..e022d94c84 100644
--- a/src/cpu_map/x86_Skylake-Server.xml
+++ b/src/cpu_map/x86_Skylake-Server.xml
@@ -1,7 +1,7 @@
<cpus>
<model name='Skylake-Server'>
<decode host='on' guest='on'/>
- <signature family='6' model='85'/> <!-- 050654 -->
+ <signature family='6' model='85' stepping='0-4'/> <!-- 050654 -->
<vendor name='Intel'/>
<feature name='3dnowprefetch'/>
<feature name='abm'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-guest.xml b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-guest.xml
index cfb0eb982d..c21cb1e600 100644
--- a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-guest.xml
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-guest.xml
@@ -1,5 +1,5 @@
<cpu mode='custom' match='exact'>
- <model fallback='forbid'>Cascadelake-Server</model>
+ <model fallback='forbid'>Skylake-Server-IBRS</model>
<vendor>Intel</vendor>
<feature policy='require' name='ds'/>
<feature policy='require' name='acpi'/>
@@ -20,14 +20,15 @@
<feature policy='require' name='osxsave'/>
<feature policy='require' name='tsc_adjust'/>
<feature policy='require' name='cmt'/>
+ <feature policy='require' name='clflushopt'/>
<feature policy='require' name='intel-pt'/>
<feature policy='require' name='pku'/>
<feature policy='require' name='ospke'/>
<feature policy='require' name='md-clear'/>
<feature policy='require' name='stibp'/>
+ <feature policy='require' name='ssbd'/>
<feature policy='require' name='xsaves'/>
<feature policy='require' name='mbm_total'/>
<feature policy='require' name='mbm_local'/>
<feature policy='require' name='invtsc'/>
- <feature policy='disable' name='avx512vnni'/>
</cpu>
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-json.xml b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-json.xml
index 968d904557..b482043ccf 100644
--- a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-json.xml
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-json.xml
@@ -1,16 +1,17 @@
<cpu mode='custom' match='exact'>
- <model fallback='forbid'>Cascadelake-Server</model>
+ <model fallback='forbid'>Skylake-Server-IBRS</model>
<vendor>Intel</vendor>
<feature policy='require' name='ss'/>
<feature policy='require' name='vmx'/>
<feature policy='require' name='hypervisor'/>
<feature policy='require' name='tsc_adjust'/>
+ <feature policy='require' name='clflushopt'/>
<feature policy='require' name='umip'/>
<feature policy='require' name='pku'/>
<feature policy='require' name='md-clear'/>
<feature policy='require' name='stibp'/>
<feature policy='require' name='arch-capabilities'/>
+ <feature policy='require' name='ssbd'/>
<feature policy='require' name='xsaves'/>
<feature policy='require' name='skip-l1dfl-vmentry'/>
- <feature policy='disable' name='avx512vnni'/>
</cpu>
--
2.26.2

View File

@ -1,37 +0,0 @@
From a48703c3f77054ba1bdfa1adf3aa8277814874d1 Mon Sep 17 00:00:00 2001
Message-Id: <a48703c3f77054ba1bdfa1adf3aa8277814874d1@dist-git>
From: Jiri Denemark <jdenemar@redhat.com>
Date: Thu, 28 May 2020 09:50:05 +0200
Subject: [PATCH] cpu_map: Distribute x86_Cooperlake.xml
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
(cherry picked from commit 1c425857fb9f652c7811f075f3d31ff561b95632)
https://bugzilla.redhat.com/show_bug.cgi?id=1781878
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Message-Id: <98b6a65536435b8130694e50adc9f39ff3110d90.1590652079.git.jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/cpu_map/Makefile.inc.am | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/cpu_map/Makefile.inc.am b/src/cpu_map/Makefile.inc.am
index be64c9a0d4..b949cb0bea 100644
--- a/src/cpu_map/Makefile.inc.am
+++ b/src/cpu_map/Makefile.inc.am
@@ -22,6 +22,7 @@ cpumap_DATA = \
cpu_map/x86_Cascadelake-Server.xml \
cpu_map/x86_Cascadelake-Server-noTSX.xml \
cpu_map/x86_Conroe.xml \
+ cpu_map/x86_Cooperlake.xml \
cpu_map/x86_core2duo.xml \
cpu_map/x86_coreduo.xml \
cpu_map/x86_cpu64-rhel5.xml \
--
2.26.2

View File

@ -1,137 +0,0 @@
From 2268a9862c16c87007bfbae117d345268f8420e4 Mon Sep 17 00:00:00 2001
Message-Id: <2268a9862c16c87007bfbae117d345268f8420e4@dist-git>
From: Jiri Denemark <jdenemar@redhat.com>
Date: Tue, 26 May 2020 10:58:58 +0200
Subject: [PATCH] cpu_map: Don't use new noTSX models for host-model CPUs
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Host-model CPU definitions (and domain capabilities) will use the
original CPU models (without noTSX in their name) and explicitly disable
hle and rtm features. This way domains with host-model CPUs will be
migratable even to older versions of libvirt which do not support the
noTSX model variants.
The new models will be advertised in host capabilities and they may
be used explicitly with custom CPUs.
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Tested-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
(cherry picked from commit 17cdefe5f197030c70a0d250f3c5387b41663516)
https://bugzilla.redhat.com/show_bug.cgi?id=1840008
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Message-Id: <d27a0adb8f142f053fbd830947f03bad04eff264.1590483392.git.jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/cpu_map/x86_Cascadelake-Server-noTSX.xml | 2 +-
src/cpu_map/x86_Icelake-Client-noTSX.xml | 2 +-
src/cpu_map/x86_Icelake-Server-noTSX.xml | 2 +-
src/cpu_map/x86_Skylake-Client-noTSX-IBRS.xml | 2 +-
src/cpu_map/x86_Skylake-Server-noTSX-IBRS.xml | 2 +-
tests/cputestdata/x86_64-cpuid-Core-i7-8550U-guest.xml | 4 +++-
tests/cputestdata/x86_64-cpuid-Core-i7-8550U-json.xml | 4 +++-
7 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/src/cpu_map/x86_Cascadelake-Server-noTSX.xml b/src/cpu_map/x86_Cascadelake-Server-noTSX.xml
index 5adea664e9..459174a30d 100644
--- a/src/cpu_map/x86_Cascadelake-Server-noTSX.xml
+++ b/src/cpu_map/x86_Cascadelake-Server-noTSX.xml
@@ -1,6 +1,6 @@
<cpus>
<model name='Cascadelake-Server-noTSX'>
- <decode host='on' guest='on'/>
+ <decode host='on' guest='off'/>
<signature family='6' model='85'/> <!-- 050654 -->
<vendor name='Intel'/>
<feature name='3dnowprefetch'/>
diff --git a/src/cpu_map/x86_Icelake-Client-noTSX.xml b/src/cpu_map/x86_Icelake-Client-noTSX.xml
index 540732af6f..65e648ae21 100644
--- a/src/cpu_map/x86_Icelake-Client-noTSX.xml
+++ b/src/cpu_map/x86_Icelake-Client-noTSX.xml
@@ -1,6 +1,6 @@
<cpus>
<model name='Icelake-Client-noTSX'>
- <decode host='on' guest='on'/>
+ <decode host='on' guest='off'/>
<signature family='6' model='126'/> <!-- 0706e0 -->
<vendor name='Intel'/>
<feature name='3dnowprefetch'/>
diff --git a/src/cpu_map/x86_Icelake-Server-noTSX.xml b/src/cpu_map/x86_Icelake-Server-noTSX.xml
index 5a53da23c7..2fd6906406 100644
--- a/src/cpu_map/x86_Icelake-Server-noTSX.xml
+++ b/src/cpu_map/x86_Icelake-Server-noTSX.xml
@@ -1,6 +1,6 @@
<cpus>
<model name='Icelake-Server-noTSX'>
- <decode host='on' guest='on'/>
+ <decode host='on' guest='off'/>
<signature family='6' model='134'/> <!-- 080660 -->
<vendor name='Intel'/>
<feature name='3dnowprefetch'/>
diff --git a/src/cpu_map/x86_Skylake-Client-noTSX-IBRS.xml b/src/cpu_map/x86_Skylake-Client-noTSX-IBRS.xml
index 0c2f1e6ac4..ffba34502a 100644
--- a/src/cpu_map/x86_Skylake-Client-noTSX-IBRS.xml
+++ b/src/cpu_map/x86_Skylake-Client-noTSX-IBRS.xml
@@ -1,6 +1,6 @@
<cpus>
<model name='Skylake-Client-noTSX-IBRS'>
- <decode host='on' guest='on'/>
+ <decode host='on' guest='off'/>
<signature family='6' model='94'/> <!-- 0506e0 -->
<signature family='6' model='78'/> <!-- 0406e0 -->
<!-- These are Kaby Lake and Coffee Lake successors to Skylake,
diff --git a/src/cpu_map/x86_Skylake-Server-noTSX-IBRS.xml b/src/cpu_map/x86_Skylake-Server-noTSX-IBRS.xml
index 91a206f575..c2b7de40e8 100644
--- a/src/cpu_map/x86_Skylake-Server-noTSX-IBRS.xml
+++ b/src/cpu_map/x86_Skylake-Server-noTSX-IBRS.xml
@@ -1,6 +1,6 @@
<cpus>
<model name='Skylake-Server-noTSX-IBRS'>
- <decode host='on' guest='on'/>
+ <decode host='on' guest='off'/>
<signature family='6' model='85'/> <!-- 050654 -->
<vendor name='Intel'/>
<feature name='3dnowprefetch'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-8550U-guest.xml b/tests/cputestdata/x86_64-cpuid-Core-i7-8550U-guest.xml
index e03c4a06ba..92404e4d03 100644
--- a/tests/cputestdata/x86_64-cpuid-Core-i7-8550U-guest.xml
+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-8550U-guest.xml
@@ -1,5 +1,5 @@
<cpu mode='custom' match='exact'>
- <model fallback='forbid'>Skylake-Client-noTSX-IBRS</model>
+ <model fallback='forbid'>Skylake-Client-IBRS</model>
<vendor>Intel</vendor>
<feature policy='require' name='ds'/>
<feature policy='require' name='acpi'/>
@@ -26,4 +26,6 @@
<feature policy='require' name='pdpe1gb'/>
<feature policy='require' name='invtsc'/>
<feature policy='require' name='skip-l1dfl-vmentry'/>
+ <feature policy='disable' name='hle'/>
+ <feature policy='disable' name='rtm'/>
</cpu>
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-8550U-json.xml b/tests/cputestdata/x86_64-cpuid-Core-i7-8550U-json.xml
index 3d8e6775bf..645c0934c2 100644
--- a/tests/cputestdata/x86_64-cpuid-Core-i7-8550U-json.xml
+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-8550U-json.xml
@@ -1,5 +1,5 @@
<cpu mode='custom' match='exact'>
- <model fallback='forbid'>Skylake-Client-noTSX-IBRS</model>
+ <model fallback='forbid'>Skylake-Client-IBRS</model>
<vendor>Intel</vendor>
<feature policy='require' name='ss'/>
<feature policy='require' name='vmx'/>
@@ -14,4 +14,6 @@
<feature policy='require' name='xsaves'/>
<feature policy='require' name='pdpe1gb'/>
<feature policy='require' name='skip-l1dfl-vmentry'/>
+ <feature policy='disable' name='hle'/>
+ <feature policy='disable' name='rtm'/>
</cpu>
--
2.26.2

View File

@ -1,52 +0,0 @@
From a6293a2b28a65f3c9ae0dcf387b222ebd242fa63 Mon Sep 17 00:00:00 2001
Message-Id: <a6293a2b28a65f3c9ae0dcf387b222ebd242fa63@dist-git>
From: Tim Wiederhake <twiederh@redhat.com>
Date: Fri, 15 Jan 2021 15:17:17 +0100
Subject: [PATCH] cpu_map: Fix Icelake Server model number
See arch/x86/include/asm/intel-family.h in the Kernel:
#define INTEL_FAM6_ICELAKE_X 0x6A
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
(cherry picked from commit 1278ac6265589cd83cc2e661056c860e98105507)
https://bugzilla.redhat.com/show_bug.cgi?id=1537734
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Message-Id: <20210115141722.14986-2-twiederh@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
---
src/cpu_map/x86_Icelake-Server-noTSX.xml | 2 +-
src/cpu_map/x86_Icelake-Server.xml | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/cpu_map/x86_Icelake-Server-noTSX.xml b/src/cpu_map/x86_Icelake-Server-noTSX.xml
index 2fd6906406..34a0f7c18c 100644
--- a/src/cpu_map/x86_Icelake-Server-noTSX.xml
+++ b/src/cpu_map/x86_Icelake-Server-noTSX.xml
@@ -1,7 +1,7 @@
<cpus>
<model name='Icelake-Server-noTSX'>
<decode host='on' guest='off'/>
- <signature family='6' model='134'/> <!-- 080660 -->
+ <signature family='6' model='106'/> <!-- 0606A5 -->
<vendor name='Intel'/>
<feature name='3dnowprefetch'/>
<feature name='abm'/>
diff --git a/src/cpu_map/x86_Icelake-Server.xml b/src/cpu_map/x86_Icelake-Server.xml
index 367ade7240..1ee4ea9cd4 100644
--- a/src/cpu_map/x86_Icelake-Server.xml
+++ b/src/cpu_map/x86_Icelake-Server.xml
@@ -1,7 +1,7 @@
<cpus>
<model name='Icelake-Server'>
<decode host='on' guest='on'/>
- <signature family='6' model='134'/> <!-- 080660 -->
+ <signature family='6' model='106'/> <!-- 0606A5 -->
<vendor name='Intel'/>
<feature name='3dnowprefetch'/>
<feature name='abm'/>
--
2.30.0

View File

@ -1,59 +0,0 @@
From a7fb45c4e5a807a7b437a91cfc96c8c811351578 Mon Sep 17 00:00:00 2001
Message-Id: <a7fb45c4e5a807a7b437a91cfc96c8c811351578@dist-git>
From: Jiri Denemark <jdenemar@redhat.com>
Date: Thu, 4 Mar 2021 09:41:53 +0100
Subject: [PATCH] cpu_map: Fix spelling of svme-addr-chk feature
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Commit a208176ca1d9eedf8aa6bf12fde6a7a9579ab549 introduced this feature
with an incorrect "svme-addr-check" spelling.
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
(cherry picked from commit b5abf9a192248b1005f63a7102d2627375d70fe5)
https://bugzilla.redhat.com/show_bug.cgi?id=1926864
Conflicts:
src/cpu_map/sync_qemu_i386.py
- the original change to this file was not backported
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Message-Id: <75071287f9fc55f4bec82916726fcb8f31c1e014.1614847231.git.jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/cpu_map/x86_EPYC-Milan.xml | 2 +-
src/cpu_map/x86_features.xml | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/cpu_map/x86_EPYC-Milan.xml b/src/cpu_map/x86_EPYC-Milan.xml
index 53f0cd6aac..3055e175fa 100644
--- a/src/cpu_map/x86_EPYC-Milan.xml
+++ b/src/cpu_map/x86_EPYC-Milan.xml
@@ -76,7 +76,7 @@
<feature name='sse4a'/>
<feature name='ssse3'/>
<feature name='svm'/>
- <feature name='svme-addr-check'/>
+ <feature name='svme-addr-chk'/>
<feature name='syscall'/>
<feature name='tsc'/>
<feature name='umip'/>
diff --git a/src/cpu_map/x86_features.xml b/src/cpu_map/x86_features.xml
index 8acd42f796..ba23f553c3 100644
--- a/src/cpu_map/x86_features.xml
+++ b/src/cpu_map/x86_features.xml
@@ -548,7 +548,7 @@
<feature name='pfthreshold'>
<cpuid eax_in='0x8000000a' edx='0x00001000'/>
</feature>
- <feature name='svme-addr-check'>
+ <feature name='svme-addr-chk'>
<cpuid eax_in='0x8000000a' edx='0x10000000'/>
</feature>
--
2.30.0

View File

@ -1,41 +0,0 @@
From 8b1e1aa7cb9dc428a36b549a73286ec7040864ed Mon Sep 17 00:00:00 2001
Message-Id: <8b1e1aa7cb9dc428a36b549a73286ec7040864ed@dist-git>
From: Jiri Denemark <jdenemar@redhat.com>
Date: Wed, 3 Mar 2021 11:11:55 +0100
Subject: [PATCH] cpu_map: Install x86_EPYC-Milan.xml
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
(cherry picked from commit d3de79dbfc20dc4dfc19154b16079861c542b71e)
https://bugzilla.redhat.com/show_bug.cgi?id=1926864
Conflicts:
src/cpu_map/meson.build
- change goes to Makefile.inc.am instead
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Message-Id: <77cf69a7222fd9fc5ef0f1c25f0534090c29865f.1614766279.git.jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/cpu_map/Makefile.inc.am | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/cpu_map/Makefile.inc.am b/src/cpu_map/Makefile.inc.am
index 1dd78c6715..45dbe9e216 100644
--- a/src/cpu_map/Makefile.inc.am
+++ b/src/cpu_map/Makefile.inc.am
@@ -30,6 +30,7 @@ cpumap_DATA = \
cpu_map/x86_Dhyana.xml \
cpu_map/x86_EPYC.xml \
cpu_map/x86_EPYC-IBPB.xml \
+ cpu_map/x86_EPYC-Milan.xml \
cpu_map/x86_EPYC-Rome.xml \
cpu_map/x86_Haswell.xml \
cpu_map/x86_Haswell-IBRS.xml \
--
2.30.0

View File

@ -1,90 +0,0 @@
From b91bb231645300a29ab82994a003ba22835ee994 Mon Sep 17 00:00:00 2001
Message-Id: <b91bb231645300a29ab82994a003ba22835ee994@dist-git>
From: Jiri Denemark <jdenemar@redhat.com>
Date: Thu, 8 Oct 2020 18:01:26 +0200
Subject: [PATCH] cpu_map: Remove monitor feature from EPYC-Rome
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The feature is filtered by KVM and never automatically enabled. So even
though QEMU definition of EPYC-Rome contains this feature, the guest
won't see it. Also domain capabilities will show it as disabled for KVM
domains. Thus the feature should not really be included in our
definition of EPYC-Rome.
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
(cherry picked from commit 3bf6f9fe22dfbd3c1dcc614b31f2f4fe8b71a2f2)
https://bugzilla.redhat.com/show_bug.cgi?id=1861506
Conflicts:
tests/cputestdata/x86_64-cpuid-Ryzen-9-3900X-12-Core-guest.xml
tests/cputestdata/x86_64-cpuid-Ryzen-9-3900X-12-Core-host.xml
tests/cputestdata/x86_64-cpuid-Ryzen-9-3900X-12-Core-json.xml
tests/domaincapsdata/qemu_5.1.0-q35.x86_64.xml
tests/domaincapsdata/qemu_5.1.0.x86_64.xml
tests/domaincapsdata/qemu_5.2.0-q35.x86_64.xml
tests/domaincapsdata/qemu_5.2.0.x86_64.xml
- not present downstream
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Message-Id: <74b9257f49925312b025a99dd934a9613ca295d4.1602172344.git.jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/cpu_map/x86_EPYC-Rome.xml | 1 -
tests/cputestdata/x86_64-cpuid-EPYC-7502-32-Core-guest.xml | 1 +
tests/cputestdata/x86_64-cpuid-EPYC-7502-32-Core-host.xml | 1 +
tests/cputestdata/x86_64-cpuid-EPYC-7502-32-Core-json.xml | 1 -
4 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/cpu_map/x86_EPYC-Rome.xml b/src/cpu_map/x86_EPYC-Rome.xml
index 99fc015fdd..e54d0a48d8 100644
--- a/src/cpu_map/x86_EPYC-Rome.xml
+++ b/src/cpu_map/x86_EPYC-Rome.xml
@@ -37,7 +37,6 @@
<feature name='misalignsse'/>
<feature name='mmx'/>
<feature name='mmxext'/>
- <feature name='monitor'/>
<feature name='movbe'/>
<feature name='msr'/>
<feature name='mtrr'/>
diff --git a/tests/cputestdata/x86_64-cpuid-EPYC-7502-32-Core-guest.xml b/tests/cputestdata/x86_64-cpuid-EPYC-7502-32-Core-guest.xml
index cb2caab6f5..6d95b508b2 100644
--- a/tests/cputestdata/x86_64-cpuid-EPYC-7502-32-Core-guest.xml
+++ b/tests/cputestdata/x86_64-cpuid-EPYC-7502-32-Core-guest.xml
@@ -2,6 +2,7 @@
<model fallback='forbid'>EPYC-Rome</model>
<vendor>AMD</vendor>
<feature policy='require' name='ht'/>
+ <feature policy='require' name='monitor'/>
<feature policy='require' name='osxsave'/>
<feature policy='require' name='cmt'/>
<feature policy='require' name='xsaves'/>
diff --git a/tests/cputestdata/x86_64-cpuid-EPYC-7502-32-Core-host.xml b/tests/cputestdata/x86_64-cpuid-EPYC-7502-32-Core-host.xml
index b6784f9eba..65eaeabdd0 100644
--- a/tests/cputestdata/x86_64-cpuid-EPYC-7502-32-Core-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-EPYC-7502-32-Core-host.xml
@@ -3,6 +3,7 @@
<model>EPYC-Rome</model>
<vendor>AMD</vendor>
<feature name='ht'/>
+ <feature name='monitor'/>
<feature name='osxsave'/>
<feature name='cmt'/>
<feature name='xsaves'/>
diff --git a/tests/cputestdata/x86_64-cpuid-EPYC-7502-32-Core-json.xml b/tests/cputestdata/x86_64-cpuid-EPYC-7502-32-Core-json.xml
index 86466c0547..febfdfcf2b 100644
--- a/tests/cputestdata/x86_64-cpuid-EPYC-7502-32-Core-json.xml
+++ b/tests/cputestdata/x86_64-cpuid-EPYC-7502-32-Core-json.xml
@@ -17,5 +17,4 @@
<feature policy='require' name='skip-l1dfl-vmentry'/>
<feature policy='require' name='mds-no'/>
<feature policy='require' name='pschange-mc-no'/>
- <feature policy='disable' name='monitor'/>
</cpu>
--
2.29.2

View File

@ -1,183 +0,0 @@
From 51290a9442c1b9347c43b2fec34b7aa979d26c77 Mon Sep 17 00:00:00 2001
Message-Id: <51290a9442c1b9347c43b2fec34b7aa979d26c77@dist-git>
From: Jiri Denemark <jdenemar@redhat.com>
Date: Tue, 26 May 2020 10:59:34 +0200
Subject: [PATCH] cpu_x86: Add support for stepping part of CPU signature
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
CPU models defined in the cpu_map can use signature/@stepping attribute
to match a limited set of stepping numbers. The value is a bitmap for
bits 0..15 each corresponding to a single stepping value. For example,
stepping='4-6,9' will match 4, 5, 6, and 9. Omitting the attribute is
equivalent to stepping='0-15'.
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit c7a27949954d78dc95459758e329fb9c580361bb)
https://bugzilla.redhat.com/show_bug.cgi?id=1840010
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Message-Id: <20bd9df72a22a004bb665409ddba20ff89a5b66d.1590483392.git.jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/cpu/cpu_x86.c | 60 +++++++++++++++++++++++++++++++++++++++--------
1 file changed, 50 insertions(+), 10 deletions(-)
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index 45a073c1d0..0d81f3d2ae 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -125,6 +125,7 @@ typedef struct _virCPUx86Signature virCPUx86Signature;
struct _virCPUx86Signature {
unsigned int family;
unsigned int model;
+ virBitmapPtr stepping;
};
typedef struct _virCPUx86Signatures virCPUx86Signatures;
@@ -732,7 +733,17 @@ x86MakeSignature(unsigned int family,
static uint32_t
virCPUx86SignatureToCPUID(virCPUx86Signature *sig)
{
- return x86MakeSignature(sig->family, sig->model, 0);
+ unsigned int stepping = 0;
+
+ if (sig->stepping) {
+ ssize_t firstBit;
+
+ firstBit = virBitmapNextSetBit(sig->stepping, -1);
+ if (firstBit >= 0)
+ stepping = firstBit;
+ }
+
+ return x86MakeSignature(sig->family, sig->model, stepping);
}
@@ -767,8 +778,8 @@ x86DataToSignatureFull(const virCPUx86Data *data,
}
-/* Mask out irrelevant bits (R and Step) from processor signature. */
-#define SIGNATURE_MASK 0x0fff3ff0
+/* Mask out reserved bits from processor signature. */
+#define SIGNATURE_MASK 0x0fff3fff
static uint32_t
x86DataToSignature(const virCPUx86Data *data)
@@ -1134,9 +1145,14 @@ virCPUx86SignaturesNew(size_t count)
static void
virCPUx86SignaturesFree(virCPUx86SignaturesPtr sigs)
{
+ size_t i;
+
if (!sigs)
return;
+ for (i = 0; i < sigs->count; i++)
+ virBitmapFree(sigs->items[i].stepping);
+
g_free(sigs->items);
g_free(sigs);
}
@@ -1153,8 +1169,12 @@ virCPUx86SignaturesCopy(virCPUx86SignaturesPtr src)
dst = virCPUx86SignaturesNew(src->count);
- for (i = 0; i < src->count; i++)
- dst->items[i] = src->items[i];
+ for (i = 0; i < src->count; i++) {
+ dst->items[i].family = src->items[i].family;
+ dst->items[i].model = src->items[i].model;
+ if (src->items[i].stepping)
+ dst->items[i].stepping = virBitmapNewCopy(src->items[i].stepping);
+ }
return dst;
}
@@ -1176,7 +1196,9 @@ virCPUx86SignaturesMatch(virCPUx86SignaturesPtr sigs,
for (i = 0; i < sigs->count; i++) {
if (sigs->items[i].family == family &&
- sigs->items[i].model == model)
+ sigs->items[i].model == model &&
+ (!sigs->items[i].stepping ||
+ virBitmapIsBitSet(sigs->items[i].stepping, stepping)))
return true;
}
@@ -1194,9 +1216,15 @@ virCPUx86SignaturesFormat(virCPUx86SignaturesPtr sigs)
return virBufferContentAndReset(&buf);
for (i = 0; i < sigs->count; i++) {
- virBufferAsprintf(&buf, "(%u,%u,0), ",
+ g_autofree char *stepping = NULL;
+
+ if (sigs->items[i].stepping)
+ stepping = virBitmapFormat(sigs->items[i].stepping);
+
+ virBufferAsprintf(&buf, "(%u,%u,%s), ",
sigs->items[i].family,
- sigs->items[i].model);
+ sigs->items[i].model,
+ stepping ? stepping : "0-15");
}
virBufferTrim(&buf, ", ", -1);
@@ -1473,6 +1501,7 @@ x86ModelParseSignatures(virCPUx86ModelPtr model,
for (i = 0; i < n; i++) {
virCPUx86Signature *sig = &model->signatures->items[i];
+ g_autofree char *stepping = NULL;
int rc;
ctxt->node = nodes[i];
@@ -1492,6 +1521,11 @@ x86ModelParseSignatures(virCPUx86ModelPtr model,
model->name);
return -1;
}
+
+ stepping = virXPathString("string(@stepping)", ctxt);
+ /* stepping corresponds to 4 bits in 32b signature, see above */
+ if (stepping && virBitmapParse(stepping, &sig->stepping, 16) < 0)
+ return -1;
}
ctxt->node = root;
@@ -2090,6 +2124,9 @@ x86Decode(virCPUDefPtr cpu,
virDomainCapsCPUModelPtr hvModel = NULL;
g_autofree char *sigs = NULL;
uint32_t signature;
+ unsigned int sigFamily;
+ unsigned int sigModel;
+ unsigned int sigStepping;
ssize_t i;
int rc;
@@ -2103,6 +2140,7 @@ x86Decode(virCPUDefPtr cpu,
vendor = x86DataToVendor(&data, map);
signature = x86DataToSignature(&data);
+ virCPUx86SignatureFromCPUID(signature, &sigFamily, &sigModel, &sigStepping);
x86DataFilterTSX(&data, vendor, map);
@@ -2184,8 +2222,10 @@ x86Decode(virCPUDefPtr cpu,
sigs = virCPUx86SignaturesFormat(model->signatures);
- VIR_DEBUG("Using CPU model %s (signatures %s) for CPU with signature %06lx",
- model->name, NULLSTR(sigs), (unsigned long)signature);
+ VIR_DEBUG("Using CPU model %s with signatures [%s] for "
+ "CPU with signature (%u,%u,%u)",
+ model->name, NULLSTR(sigs),
+ sigFamily, sigModel, sigStepping);
cpu->model = g_steal_pointer(&cpuModel->model);
cpu->features = g_steal_pointer(&cpuModel->features);
--
2.26.2

View File

@ -1,74 +0,0 @@
From 8a18e258633c347eb421904c63c2265ed59d61b5 Mon Sep 17 00:00:00 2001
Message-Id: <8a18e258633c347eb421904c63c2265ed59d61b5@dist-git>
From: Jiri Denemark <jdenemar@redhat.com>
Date: Tue, 26 May 2020 10:59:33 +0200
Subject: [PATCH] cpu_x86: Don't check return value of x86ModelCopy
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Thanks to glib allocation functions which abort on OOM the function
cannot ever return NULL.
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit 70f3041d39802e53a19901bee040ff33850cd5e0)
https://bugzilla.redhat.com/show_bug.cgi?id=1840010
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Message-Id: <3db9e891cf44e608a45504b120a5c276ead3ea8d.1590483392.git.jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/cpu/cpu_x86.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index b87e3753da..45a073c1d0 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -1287,9 +1287,6 @@ x86ModelFromCPU(const virCPUDef *cpu,
model = g_new0(virCPUx86Model, 1);
}
- if (!model)
- return NULL;
-
for (i = 0; i < cpu->nfeatures; i++) {
virCPUx86FeaturePtr feature;
virCPUFeaturePolicy fpol;
@@ -1869,9 +1866,7 @@ x86Compute(virCPUDefPtr host,
return VIR_CPU_COMPARE_INCOMPATIBLE;
}
- if (!(diff = x86ModelCopy(host_model)))
- return VIR_CPU_COMPARE_ERROR;
-
+ diff = x86ModelCopy(host_model);
x86DataSubtract(&diff->data, &cpu_optional->data);
x86DataSubtract(&diff->data, &cpu_require->data);
x86DataSubtract(&diff->data, &cpu_disable->data);
@@ -1892,8 +1887,7 @@ x86Compute(virCPUDefPtr host,
}
if (guest) {
- if (!(guest_model = x86ModelCopy(host_model)))
- return VIR_CPU_COMPARE_ERROR;
+ guest_model = x86ModelCopy(host_model);
if (cpu->vendor && host_model->vendor &&
virCPUx86DataAddItem(&guest_model->data,
@@ -3131,8 +3125,8 @@ virCPUx86ExpandFeatures(virCPUDefPtr cpu)
return -1;
}
- if (!(model = x86ModelCopy(model)) ||
- x86DataToCPUFeatures(expanded, host ? -1 : VIR_CPU_FEATURE_REQUIRE,
+ model = x86ModelCopy(model);
+ if (x86DataToCPUFeatures(expanded, host ? -1 : VIR_CPU_FEATURE_REQUIRE,
&model->data, map) < 0)
return -1;
--
2.26.2

View File

@ -1,102 +0,0 @@
From 882e0241f82b5bcbe239cf00134950e141de642a Mon Sep 17 00:00:00 2001
Message-Id: <882e0241f82b5bcbe239cf00134950e141de642a@dist-git>
From: Jiri Denemark <jdenemar@redhat.com>
Date: Tue, 26 May 2020 10:58:59 +0200
Subject: [PATCH] cpu_x86: Drop noTSX hint for incompatible CPUs
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The hint was introduced a long time ago when broken TSX implementation
was found in Haswell and Broadwell CPUs. Since then many more CPUs with
TSX were introduced and and disabled due to TAA vulnerability.
Thus the hint is not very useful and I think removing it is a better
choice then updating it to cover all current noTSX models.
This partially reverts:
commit 7f127ded657b24e0e55cd5f3539ef5b2dc935908
cpu: Rework cpuCompare* APIs
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit 8452779049ef785b1d2e373b4d42633d4a929a60)
https://bugzilla.redhat.com/show_bug.cgi?id=1840010
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Message-Id: <1126fcc8a0e18f0eed38c182013429fd7266c274.1590483392.git.jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/cpu/cpu_x86.c | 44 ++++++--------------------------------------
1 file changed, 6 insertions(+), 38 deletions(-)
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index b4d5c795f7..1b388ec1b2 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -1937,8 +1937,6 @@ virCPUx86Compare(virCPUDefPtr host,
bool failIncompatible)
{
virCPUCompareResult ret = VIR_CPU_COMPARE_ERROR;
- virCPUx86MapPtr map;
- virCPUx86ModelPtr model = NULL;
char *message = NULL;
if (!host || !host->model) {
@@ -1954,46 +1952,16 @@ virCPUx86Compare(virCPUDefPtr host,
ret = x86Compute(host, cpu, NULL, &message);
- if (ret == VIR_CPU_COMPARE_INCOMPATIBLE) {
- bool noTSX = false;
-
- if (STREQ_NULLABLE(cpu->model, "Haswell") ||
- STREQ_NULLABLE(cpu->model, "Broadwell")) {
- if (!(map = virCPUx86GetMap()))
- goto cleanup;
-
- if (!(model = x86ModelFromCPU(cpu, map, -1)))
- goto cleanup;
-
- noTSX = !x86FeatureInData("hle", &model->data, map) ||
- !x86FeatureInData("rtm", &model->data, map);
- }
-
- if (failIncompatible) {
- ret = VIR_CPU_COMPARE_ERROR;
- if (message) {
- if (noTSX) {
- virReportError(VIR_ERR_CPU_INCOMPATIBLE,
- _("%s; try using '%s-noTSX' CPU model"),
- message, cpu->model);
- } else {
- virReportError(VIR_ERR_CPU_INCOMPATIBLE, "%s", message);
- }
- } else {
- if (noTSX) {
- virReportError(VIR_ERR_CPU_INCOMPATIBLE,
- _("try using '%s-noTSX' CPU model"),
- cpu->model);
- } else {
- virReportError(VIR_ERR_CPU_INCOMPATIBLE, NULL);
- }
- }
- }
+ if (ret == VIR_CPU_COMPARE_INCOMPATIBLE && failIncompatible) {
+ ret = VIR_CPU_COMPARE_ERROR;
+ if (message)
+ virReportError(VIR_ERR_CPU_INCOMPATIBLE, "%s", message);
+ else
+ virReportError(VIR_ERR_CPU_INCOMPATIBLE, NULL);
}
cleanup:
VIR_FREE(message);
- x86ModelFree(model);
return ret;
}
--
2.26.2

View File

@ -1,67 +0,0 @@
From ba2f2a8c39f2e7fe5684d9b84a0a832be482a3ab Mon Sep 17 00:00:00 2001
Message-Id: <ba2f2a8c39f2e7fe5684d9b84a0a832be482a3ab@dist-git>
From: Jiri Denemark <jdenemar@redhat.com>
Date: Tue, 26 May 2020 10:58:57 +0200
Subject: [PATCH] cpu_x86: Honor CPU models' <decode> element
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Tested-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
(cherry picked from commit 7cd896ef31d33f78d40df918a33fe3867e251509)
https://bugzilla.redhat.com/show_bug.cgi?id=1840008
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Message-Id: <15f1eedf2c0df29a3942b4b28bc4575fa51ca19a.1590483392.git.jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/cpu/cpu_x86.c | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index 7fbb4c9a6c..b4d5c795f7 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -2044,10 +2044,23 @@ x86DecodeUseCandidate(virCPUx86ModelPtr current,
virCPUx86ModelPtr candidate,
virCPUDefPtr cpuCandidate,
uint32_t signature,
- const char *preferred,
- bool checkPolicy)
+ const char *preferred)
{
- if (checkPolicy) {
+ if (cpuCandidate->type == VIR_CPU_TYPE_HOST &&
+ !candidate->decodeHost) {
+ VIR_DEBUG("%s is not supposed to be used for host CPU definition",
+ cpuCandidate->model);
+ return 0;
+ }
+
+ if (cpuCandidate->type == VIR_CPU_TYPE_GUEST &&
+ !candidate->decodeGuest) {
+ VIR_DEBUG("%s is not supposed to be used for guest CPU definition",
+ cpuCandidate->model);
+ return 0;
+ }
+
+ if (cpuCandidate->type == VIR_CPU_TYPE_HOST) {
size_t i;
for (i = 0; i < cpuCandidate->nfeatures; i++) {
if (cpuCandidate->features[i].policy == VIR_CPU_FEATURE_DISABLE)
@@ -2209,8 +2222,7 @@ x86Decode(virCPUDefPtr cpu,
if ((rc = x86DecodeUseCandidate(model, cpuModel,
candidate, cpuCandidate,
- signature, preferred,
- cpu->type == VIR_CPU_TYPE_HOST))) {
+ signature, preferred))) {
virCPUDefFree(cpuModel);
cpuModel = cpuCandidate;
model = candidate;
--
2.26.2

View File

@ -1,71 +0,0 @@
From 48e546c1097a61c806412efe53e216fbc8beafca Mon Sep 17 00:00:00 2001
Message-Id: <48e546c1097a61c806412efe53e216fbc8beafca@dist-git>
From: Jiri Denemark <jdenemar@redhat.com>
Date: Tue, 26 May 2020 10:59:31 +0200
Subject: [PATCH] cpu_x86: Introduce virCPUx86SignatureFromCPUID
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
It can be used for separating family, model, and stepping numbers from a
single 32b integer as reported by CPUID.
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit 3b474c1f8f3c1f124fab303625733ea79047660c)
https://bugzilla.redhat.com/show_bug.cgi?id=1840010
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Message-Id: <1fe352bfb7cf40b5b8e24eea3bf4e476269adb92.1590483392.git.jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/cpu/cpu_x86.c | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index ed2090b0c6..dad3bceff0 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -717,6 +717,18 @@ x86MakeSignature(unsigned int family,
}
+static void
+virCPUx86SignatureFromCPUID(uint32_t sig,
+ unsigned int *family,
+ unsigned int *model,
+ unsigned int *stepping)
+{
+ *family = ((sig >> 20) & 0xff) + ((sig >> 8) & 0xf);
+ *model = ((sig >> 12) & 0xf0) + ((sig >> 4) & 0xf);
+ *stepping = sig & 0xf;
+}
+
+
static void
x86DataToSignatureFull(const virCPUx86Data *data,
unsigned int *family,
@@ -725,17 +737,14 @@ x86DataToSignatureFull(const virCPUx86Data *data,
{
virCPUx86DataItem leaf1 = CPUID(.eax_in = 0x1);
virCPUx86DataItemPtr item;
- virCPUx86CPUIDPtr cpuid;
*family = *model = *stepping = 0;
if (!(item = virCPUx86DataGet(data, &leaf1)))
return;
- cpuid = &item->data.cpuid;
- *family = ((cpuid->eax >> 20) & 0xff) + ((cpuid->eax >> 8) & 0xf);
- *model = ((cpuid->eax >> 12) & 0xf0) + ((cpuid->eax >> 4) & 0xf);
- *stepping = cpuid->eax & 0xf;
+ virCPUx86SignatureFromCPUID(item->data.cpuid.eax,
+ family, model, stepping);
}
--
2.26.2

View File

@ -1,64 +0,0 @@
From 75afc6d9dc443666e1207ef6f1c968abdfec712a Mon Sep 17 00:00:00 2001
Message-Id: <75afc6d9dc443666e1207ef6f1c968abdfec712a@dist-git>
From: Jiri Denemark <jdenemar@redhat.com>
Date: Tue, 26 May 2020 10:59:30 +0200
Subject: [PATCH] cpu_x86: Introduce virCPUx86SignaturesFree
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The function will be used for freeing virCPUx86Signatures structure
introduced later in this series.
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit 372b2cf1ca3f4361546732a3f5f9c0c0be2591e9)
https://bugzilla.redhat.com/show_bug.cgi?id=1840010
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Message-Id: <163ef39d14ce5457272e7508172f64d58d22a56b.1590483392.git.jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/cpu/cpu_x86.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index 9248403eff..ed2090b0c6 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -1090,6 +1090,13 @@ x86FeatureParse(xmlXPathContextPtr ctxt,
}
+static void
+virCPUx86SignaturesFree(uint32_t *signatures)
+{
+ g_free(signatures);
+}
+
+
static int
virCPUx86SignaturesCopy(virCPUx86ModelPtr dst,
virCPUx86ModelPtr src)
@@ -1149,7 +1156,7 @@ x86ModelFree(virCPUx86ModelPtr model)
return;
g_free(model->name);
- g_free(model->signatures);
+ virCPUx86SignaturesFree(model->signatures);
virCPUx86DataClear(&model->data);
g_free(model);
}
@@ -1414,7 +1421,7 @@ x86ModelParseSignatures(virCPUx86ModelPtr model,
return n;
/* Remove inherited signatures. */
- VIR_FREE(model->signatures);
+ virCPUx86SignaturesFree(model->signatures);
model->nsignatures = n;
if (VIR_ALLOC_N(model->signatures, n) < 0)
--
2.26.2

View File

@ -1,97 +0,0 @@
From 2b76e3009c224c0d03a4d951e0686aad6f6dc577 Mon Sep 17 00:00:00 2001
Message-Id: <2b76e3009c224c0d03a4d951e0686aad6f6dc577@dist-git>
From: Jiri Denemark <jdenemar@redhat.com>
Date: Tue, 26 May 2020 10:59:29 +0200
Subject: [PATCH] cpu_x86: Move and rename x86FormatSignatures
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Later in this series the function will work on a newly introduced
virCPUx86Signatures structure. Let's move it to the place where all
related functions will be added and rename the function as
virCPUx86SignaturesFormat for easier review of the virCPUx86Signatures
patch.
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit 7e0d351fa69c468906533b2ac9b24212df13a370)
https://bugzilla.redhat.com/show_bug.cgi?id=1840010
Conflicts:
src/cpu/cpu_x86.c
- v6.0.0-264-g0a125c7144 which removes the third argument
from virBufferTrim was not backported
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Message-Id: <fd16284339dd71e9f99b57bb7682014065e5d0ec.1590483392.git.jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/cpu/cpu_x86.c | 36 ++++++++++++++++++------------------
1 file changed, 18 insertions(+), 18 deletions(-)
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index 65a99876a9..9248403eff 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -1125,6 +1125,23 @@ virCPUx86SignaturesMatch(virCPUx86ModelPtr model,
}
+static char *
+virCPUx86SignaturesFormat(virCPUx86ModelPtr model)
+{
+ virBuffer buf = VIR_BUFFER_INITIALIZER;
+ size_t i;
+
+ for (i = 0; i < model->nsignatures; i++) {
+ virBufferAsprintf(&buf, "%06lx,",
+ (unsigned long)model->signatures[i]);
+ }
+
+ virBufferTrim(&buf, ",", -1);
+
+ return virBufferContentAndReset(&buf);
+}
+
+
static void
x86ModelFree(virCPUx86ModelPtr model)
{
@@ -1890,23 +1907,6 @@ virCPUx86Compare(virCPUDefPtr host,
}
-static char *
-x86FormatSignatures(virCPUx86ModelPtr model)
-{
- virBuffer buf = VIR_BUFFER_INITIALIZER;
- size_t i;
-
- for (i = 0; i < model->nsignatures; i++) {
- virBufferAsprintf(&buf, "%06lx,",
- (unsigned long)model->signatures[i]);
- }
-
- virBufferTrim(&buf, ",", -1);
-
- return virBufferContentAndReset(&buf);
-}
-
-
/*
* Checks whether a candidate model is a better fit for the CPU data than the
* current model.
@@ -2134,7 +2134,7 @@ x86Decode(virCPUDefPtr cpu,
if (vendor)
cpu->vendor = g_strdup(vendor->name);
- sigs = x86FormatSignatures(model);
+ sigs = virCPUx86SignaturesFormat(model);
VIR_DEBUG("Using CPU model %s (signatures %s) for CPU with signature %06lx",
model->name, NULLSTR(sigs), (unsigned long)signature);
--
2.26.2

View File

@ -1,100 +0,0 @@
From 33cac9bcf27a885febf12e094cb2579f16a421b6 Mon Sep 17 00:00:00 2001
Message-Id: <33cac9bcf27a885febf12e094cb2579f16a421b6@dist-git>
From: Jiri Denemark <jdenemar@redhat.com>
Date: Tue, 26 May 2020 10:59:27 +0200
Subject: [PATCH] cpu_x86: Move and rename x86ModelCopySignatures
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Later in this series the function will work on a newly introduced
virCPUx86Signatures structure. Let's move it to the place were all
related functions will be added and rename the function as
virCPUx86SignaturesCopy for easier review of the virCPUx86Signatures
patch.
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit a8ec1d746ed41ac76df2e28cbc5683b3e37b9a60)
https://bugzilla.redhat.com/show_bug.cgi?id=1840010
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Message-Id: <0d4f902805cd5534eadedd2ec61385e9798c8b40.1590483392.git.jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/cpu/cpu_x86.c | 36 ++++++++++++++++++------------------
1 file changed, 18 insertions(+), 18 deletions(-)
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index b4b1b475d6..16e6aa73d2 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -1090,23 +1090,9 @@ x86FeatureParse(xmlXPathContextPtr ctxt,
}
-static void
-x86ModelFree(virCPUx86ModelPtr model)
-{
- if (!model)
- return;
-
- g_free(model->name);
- g_free(model->signatures);
- virCPUx86DataClear(&model->data);
- g_free(model);
-}
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUx86Model, x86ModelFree);
-
-
static int
-x86ModelCopySignatures(virCPUx86ModelPtr dst,
- virCPUx86ModelPtr src)
+virCPUx86SignaturesCopy(virCPUx86ModelPtr dst,
+ virCPUx86ModelPtr src)
{
size_t i;
@@ -1124,6 +1110,20 @@ x86ModelCopySignatures(virCPUx86ModelPtr dst,
}
+static void
+x86ModelFree(virCPUx86ModelPtr model)
+{
+ if (!model)
+ return;
+
+ g_free(model->name);
+ g_free(model->signatures);
+ virCPUx86DataClear(&model->data);
+ g_free(model);
+}
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUx86Model, x86ModelFree);
+
+
static virCPUx86ModelPtr
x86ModelCopy(virCPUx86ModelPtr model)
{
@@ -1132,7 +1132,7 @@ x86ModelCopy(virCPUx86ModelPtr model)
copy = g_new0(virCPUx86Model, 1);
copy->name = g_strdup(model->name);
- if (x86ModelCopySignatures(copy, model) < 0) {
+ if (virCPUx86SignaturesCopy(copy, model) < 0) {
x86ModelFree(copy);
return NULL;
}
@@ -1360,7 +1360,7 @@ x86ModelParseAncestor(virCPUx86ModelPtr model,
}
model->vendor = ancestor->vendor;
- if (x86ModelCopySignatures(model, ancestor) < 0)
+ if (virCPUx86SignaturesCopy(model, ancestor) < 0)
return -1;
x86DataCopy(&model->data, &ancestor->data);
--
2.26.2

View File

@ -1,101 +0,0 @@
From 693d01f00b9608a4f4cac3b91e38b5537eff754f Mon Sep 17 00:00:00 2001
Message-Id: <693d01f00b9608a4f4cac3b91e38b5537eff754f@dist-git>
From: Jiri Denemark <jdenemar@redhat.com>
Date: Tue, 26 May 2020 10:59:28 +0200
Subject: [PATCH] cpu_x86: Move and rename x86ModelHasSignature
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Later in this series the function will work on a newly introduced
virCPUx86Signatures structure. Let's move it to the place were all
related functions will be added and rename the function as
virCPUx86SignaturesMatch for easier review of the virCPUx86Signatures
patch.
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit 782be9f0af2e02e725fca45b7674e8b2f008dc6c)
https://bugzilla.redhat.com/show_bug.cgi?id=1840010
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Message-Id: <7662ee03449ae588a5381c546eb7e8a3b64cadb3.1590483392.git.jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/cpu/cpu_x86.c | 38 +++++++++++++++++++-------------------
1 file changed, 19 insertions(+), 19 deletions(-)
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index 16e6aa73d2..65a99876a9 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -1110,6 +1110,21 @@ virCPUx86SignaturesCopy(virCPUx86ModelPtr dst,
}
+static bool
+virCPUx86SignaturesMatch(virCPUx86ModelPtr model,
+ uint32_t signature)
+{
+ size_t i;
+
+ for (i = 0; i < model->nsignatures; i++) {
+ if (model->signatures[i] == signature)
+ return true;
+ }
+
+ return false;
+}
+
+
static void
x86ModelFree(virCPUx86ModelPtr model)
{
@@ -1875,21 +1890,6 @@ virCPUx86Compare(virCPUDefPtr host,
}
-static bool
-x86ModelHasSignature(virCPUx86ModelPtr model,
- uint32_t signature)
-{
- size_t i;
-
- for (i = 0; i < model->nsignatures; i++) {
- if (model->signatures[i] == signature)
- return true;
- }
-
- return false;
-}
-
-
static char *
x86FormatSignatures(virCPUx86ModelPtr model)
{
@@ -1961,8 +1961,8 @@ x86DecodeUseCandidate(virCPUx86ModelPtr current,
* consider candidates with matching family/model.
*/
if (signature &&
- x86ModelHasSignature(current, signature) &&
- !x86ModelHasSignature(candidate, signature)) {
+ virCPUx86SignaturesMatch(current, signature) &&
+ !virCPUx86SignaturesMatch(candidate, signature)) {
VIR_DEBUG("%s differs in signature from matching %s",
cpuCandidate->model, cpuCurrent->model);
return 0;
@@ -1978,8 +1978,8 @@ x86DecodeUseCandidate(virCPUx86ModelPtr current,
* result in longer list of features.
*/
if (signature &&
- x86ModelHasSignature(candidate, signature) &&
- !x86ModelHasSignature(current, signature)) {
+ virCPUx86SignaturesMatch(candidate, signature) &&
+ !virCPUx86SignaturesMatch(current, signature)) {
VIR_DEBUG("%s provides matching signature", cpuCandidate->model);
return 1;
}
--
2.26.2

View File

@ -1,59 +0,0 @@
From 760e248164be819bebc03893ace58e0ddae7e440 Mon Sep 17 00:00:00 2001
Message-Id: <760e248164be819bebc03893ace58e0ddae7e440@dist-git>
From: Jiri Denemark <jdenemar@redhat.com>
Date: Tue, 26 May 2020 10:58:52 +0200
Subject: [PATCH] cpu_x86: Prepare virCPUx86UpdateLive for easier extension
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Adding more checks into the existing if statements would turn them into
an unreadable mess.
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit 8dc791b5d3b20552cc0b8d6c04e34dd0f3ebe2ff)
https://bugzilla.redhat.com/show_bug.cgi?id=1839999
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Message-Id: <169ed0334144715b52575ca3f7e67ce3170ba91a.1590483392.git.jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/cpu/cpu_x86.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index 9b7981d574..9e686a86d2 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -3036,9 +3036,15 @@ virCPUx86UpdateLive(virCPUDefPtr cpu,
for (i = 0; i < map->nfeatures; i++) {
virCPUx86FeaturePtr feature = map->features[i];
+ virCPUFeaturePolicy expected = VIR_CPU_FEATURE_LAST;
- if (x86DataIsSubset(&enabled, &feature->data) &&
- !x86DataIsSubset(&model->data, &feature->data)) {
+ if (x86DataIsSubset(&model->data, &feature->data))
+ expected = VIR_CPU_FEATURE_REQUIRE;
+ else
+ expected = VIR_CPU_FEATURE_DISABLE;
+
+ if (expected == VIR_CPU_FEATURE_DISABLE &&
+ x86DataIsSubset(&enabled, &feature->data)) {
VIR_DEBUG("Feature '%s' enabled by the hypervisor", feature->name);
if (cpu->check == VIR_CPU_CHECK_FULL)
virBufferAsprintf(&bufAdded, "%s,", feature->name);
@@ -3048,7 +3054,7 @@ virCPUx86UpdateLive(virCPUDefPtr cpu,
}
if (x86DataIsSubset(&disabled, &feature->data) ||
- (x86DataIsSubset(&model->data, &feature->data) &&
+ (expected == VIR_CPU_FEATURE_REQUIRE &&
!x86DataIsSubset(&enabled, &feature->data))) {
VIR_DEBUG("Feature '%s' disabled by the hypervisor", feature->name);
if (cpu->check == VIR_CPU_CHECK_FULL)
--
2.26.2

View File

@ -1,325 +0,0 @@
From 22fecd96659495908f37e1c33c1ed52be5fb2d44 Mon Sep 17 00:00:00 2001
Message-Id: <22fecd96659495908f37e1c33c1ed52be5fb2d44@dist-git>
From: Jiri Denemark <jdenemar@redhat.com>
Date: Tue, 26 May 2020 10:59:32 +0200
Subject: [PATCH] cpu_x86: Replace 32b signatures in virCPUx86Model with a
struct
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The CPU models in our cpu_map define their signatures using separate
family and model numbers. Let's store the signatures in the same way in
our runtime representation of the cpu_map.
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit 22bded201ffc91661e44065203dcb987e51084ca)
https://bugzilla.redhat.com/show_bug.cgi?id=1840010
Conflicts:
src/cpu/cpu_x86.c
- v6.0.0-264-g0a125c7144 which removes the third argument
from virBufferTrim was not backported
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Message-Id: <21c1eee9c7bb3811f43aa044bb97fa373a159e26.1590483392.git.jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/cpu/cpu_x86.c | 149 +++++++++++++++++++++++++++++-----------------
1 file changed, 95 insertions(+), 54 deletions(-)
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index dad3bceff0..b87e3753da 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -121,6 +121,19 @@ static virCPUx86Feature x86_kvm_features[] =
KVM_FEATURE(VIR_CPU_x86_HV_STIMER_DIRECT),
};
+typedef struct _virCPUx86Signature virCPUx86Signature;
+struct _virCPUx86Signature {
+ unsigned int family;
+ unsigned int model;
+};
+
+typedef struct _virCPUx86Signatures virCPUx86Signatures;
+typedef virCPUx86Signatures *virCPUx86SignaturesPtr;
+struct _virCPUx86Signatures {
+ size_t count;
+ virCPUx86Signature *items;
+};
+
typedef struct _virCPUx86Model virCPUx86Model;
typedef virCPUx86Model *virCPUx86ModelPtr;
struct _virCPUx86Model {
@@ -128,8 +141,7 @@ struct _virCPUx86Model {
bool decodeHost;
bool decodeGuest;
virCPUx86VendorPtr vendor;
- size_t nsignatures;
- uint32_t *signatures;
+ virCPUx86SignaturesPtr signatures;
virCPUx86Data data;
};
@@ -717,6 +729,13 @@ x86MakeSignature(unsigned int family,
}
+static uint32_t
+virCPUx86SignatureToCPUID(virCPUx86Signature *sig)
+{
+ return x86MakeSignature(sig->family, sig->model, 0);
+}
+
+
static void
virCPUx86SignatureFromCPUID(uint32_t sig,
unsigned int *family,
@@ -1099,41 +1118,65 @@ x86FeatureParse(xmlXPathContextPtr ctxt,
}
+static virCPUx86SignaturesPtr
+virCPUx86SignaturesNew(size_t count)
+{
+ virCPUx86SignaturesPtr sigs;
+
+ sigs = g_new0(virCPUx86Signatures, 1);
+ sigs->items = g_new0(virCPUx86Signature, count);
+ sigs->count = count;
+
+ return sigs;
+}
+
+
static void
-virCPUx86SignaturesFree(uint32_t *signatures)
+virCPUx86SignaturesFree(virCPUx86SignaturesPtr sigs)
{
- g_free(signatures);
+ if (!sigs)
+ return;
+
+ g_free(sigs->items);
+ g_free(sigs);
}
-static int
-virCPUx86SignaturesCopy(virCPUx86ModelPtr dst,
- virCPUx86ModelPtr src)
+static virCPUx86SignaturesPtr
+virCPUx86SignaturesCopy(virCPUx86SignaturesPtr src)
{
+ virCPUx86SignaturesPtr dst;
size_t i;
- if (src->nsignatures == 0)
- return 0;
+ if (!src || src->count == 0)
+ return NULL;
- if (VIR_ALLOC_N(dst->signatures, src->nsignatures) < 0)
- return -1;
+ dst = virCPUx86SignaturesNew(src->count);
- dst->nsignatures = src->nsignatures;
- for (i = 0; i < src->nsignatures; i++)
- dst->signatures[i] = src->signatures[i];
+ for (i = 0; i < src->count; i++)
+ dst->items[i] = src->items[i];
- return 0;
+ return dst;
}
static bool
-virCPUx86SignaturesMatch(virCPUx86ModelPtr model,
+virCPUx86SignaturesMatch(virCPUx86SignaturesPtr sigs,
uint32_t signature)
{
size_t i;
+ unsigned int family;
+ unsigned int model;
+ unsigned int stepping;
- for (i = 0; i < model->nsignatures; i++) {
- if (model->signatures[i] == signature)
+ if (!sigs)
+ return false;
+
+ virCPUx86SignatureFromCPUID(signature, &family, &model, &stepping);
+
+ for (i = 0; i < sigs->count; i++) {
+ if (sigs->items[i].family == family &&
+ sigs->items[i].model == model)
return true;
}
@@ -1142,17 +1185,21 @@ virCPUx86SignaturesMatch(virCPUx86ModelPtr model,
static char *
-virCPUx86SignaturesFormat(virCPUx86ModelPtr model)
+virCPUx86SignaturesFormat(virCPUx86SignaturesPtr sigs)
{
virBuffer buf = VIR_BUFFER_INITIALIZER;
size_t i;
- for (i = 0; i < model->nsignatures; i++) {
- virBufferAsprintf(&buf, "%06lx,",
- (unsigned long)model->signatures[i]);
+ if (!sigs)
+ return virBufferContentAndReset(&buf);
+
+ for (i = 0; i < sigs->count; i++) {
+ virBufferAsprintf(&buf, "(%u,%u,0), ",
+ sigs->items[i].family,
+ sigs->items[i].model);
}
- virBufferTrim(&buf, ",", -1);
+ virBufferTrim(&buf, ", ", -1);
return virBufferContentAndReset(&buf);
}
@@ -1179,16 +1226,11 @@ x86ModelCopy(virCPUx86ModelPtr model)
copy = g_new0(virCPUx86Model, 1);
copy->name = g_strdup(model->name);
-
- if (virCPUx86SignaturesCopy(copy, model) < 0) {
- x86ModelFree(copy);
- return NULL;
- }
+ copy->signatures = virCPUx86SignaturesCopy(model->signatures);
x86DataCopy(&copy->data, &model->data);
-
copy->vendor = model->vendor;
- return copy;
+ return g_steal_pointer(&copy);
}
@@ -1408,9 +1450,7 @@ x86ModelParseAncestor(virCPUx86ModelPtr model,
}
model->vendor = ancestor->vendor;
- if (virCPUx86SignaturesCopy(model, ancestor) < 0)
- return -1;
-
+ model->signatures = virCPUx86SignaturesCopy(ancestor->signatures);
x86DataCopy(&model->data, &ancestor->data);
return 0;
@@ -1432,34 +1472,29 @@ x86ModelParseSignatures(virCPUx86ModelPtr model,
/* Remove inherited signatures. */
virCPUx86SignaturesFree(model->signatures);
- model->nsignatures = n;
- if (VIR_ALLOC_N(model->signatures, n) < 0)
- return -1;
+ model->signatures = virCPUx86SignaturesNew(n);
for (i = 0; i < n; i++) {
- unsigned int sigFamily = 0;
- unsigned int sigModel = 0;
+ virCPUx86Signature *sig = &model->signatures->items[i];
int rc;
ctxt->node = nodes[i];
- rc = virXPathUInt("string(@family)", ctxt, &sigFamily);
- if (rc < 0 || sigFamily == 0) {
+ rc = virXPathUInt("string(@family)", ctxt, &sig->family);
+ if (rc < 0 || sig->family == 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Invalid CPU signature family in model %s"),
model->name);
return -1;
}
- rc = virXPathUInt("string(@model)", ctxt, &sigModel);
+ rc = virXPathUInt("string(@model)", ctxt, &sig->model);
if (rc < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Invalid CPU signature model in model %s"),
model->name);
return -1;
}
-
- model->signatures[i] = x86MakeSignature(sigFamily, sigModel, 0);
}
ctxt->node = root;
@@ -1865,9 +1900,12 @@ x86Compute(virCPUDefPtr host,
&host_model->vendor->data) < 0)
return VIR_CPU_COMPARE_ERROR;
- if (host_model->signatures &&
- x86DataAddSignature(&guest_model->data, *host_model->signatures) < 0)
- return VIR_CPU_COMPARE_ERROR;
+ if (host_model->signatures && host_model->signatures->count > 0) {
+ virCPUx86Signature *sig = &host_model->signatures->items[0];
+ if (x86DataAddSignature(&guest_model->data,
+ virCPUx86SignatureToCPUID(sig)) < 0)
+ return VIR_CPU_COMPARE_ERROR;
+ }
if (cpu->type == VIR_CPU_TYPE_GUEST
&& cpu->match == VIR_CPU_MATCH_EXACT)
@@ -1977,8 +2015,8 @@ x86DecodeUseCandidate(virCPUx86ModelPtr current,
* consider candidates with matching family/model.
*/
if (signature &&
- virCPUx86SignaturesMatch(current, signature) &&
- !virCPUx86SignaturesMatch(candidate, signature)) {
+ virCPUx86SignaturesMatch(current->signatures, signature) &&
+ !virCPUx86SignaturesMatch(candidate->signatures, signature)) {
VIR_DEBUG("%s differs in signature from matching %s",
cpuCandidate->model, cpuCurrent->model);
return 0;
@@ -1994,8 +2032,8 @@ x86DecodeUseCandidate(virCPUx86ModelPtr current,
* result in longer list of features.
*/
if (signature &&
- virCPUx86SignaturesMatch(candidate, signature) &&
- !virCPUx86SignaturesMatch(current, signature)) {
+ virCPUx86SignaturesMatch(candidate->signatures, signature) &&
+ !virCPUx86SignaturesMatch(current->signatures, signature)) {
VIR_DEBUG("%s provides matching signature", cpuCandidate->model);
return 1;
}
@@ -2150,7 +2188,7 @@ x86Decode(virCPUDefPtr cpu,
if (vendor)
cpu->vendor = g_strdup(vendor->name);
- sigs = virCPUx86SignaturesFormat(model);
+ sigs = virCPUx86SignaturesFormat(model->signatures);
VIR_DEBUG("Using CPU model %s (signatures %s) for CPU with signature %06lx",
model->name, NULLSTR(sigs), (unsigned long)signature);
@@ -3046,9 +3084,12 @@ virCPUx86Translate(virCPUDefPtr cpu,
virCPUx86DataAddItem(&model->data, &model->vendor->data) < 0)
return -1;
- if (model->signatures &&
- x86DataAddSignature(&model->data, model->signatures[0]) < 0)
- return -1;
+ if (model->signatures && model->signatures->count > 0) {
+ virCPUx86Signature *sig = &model->signatures->items[0];
+ if (x86DataAddSignature(&model->data,
+ virCPUx86SignatureToCPUID(sig)) < 0)
+ return -1;
+ }
if (!(translated = virCPUDefCopyWithoutModel(cpu)))
return -1;
--
2.26.2

Some files were not shown because too many files have changed in this diff Show More