import libvirt-4.5.0-42.module+el8.2.0+6024+15a2423f
This commit is contained in:
commit
ffdd260aa7
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
SOURCES/libvirt-4.5.0.tar.xz
|
1
.libvirt.metadata
Normal file
1
.libvirt.metadata
Normal file
@ -0,0 +1 @@
|
||||
5f097d246c0fba04d18ac7ec951ad56ffa1a8958 SOURCES/libvirt-4.5.0.tar.xz
|
@ -0,0 +1,56 @@
|
||||
From e75abae126f9fcaf1e8478f0780ecae736f7d3e1 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <e75abae126f9fcaf1e8478f0780ecae736f7d3e1@dist-git>
|
||||
From: "Allen, John" <John.Allen@amd.com>
|
||||
Date: Tue, 2 Jul 2019 17:05:34 +0200
|
||||
Subject: [PATCH] Handle copying bitmaps to larger data buffers
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
If a bitmap of a shorter length than the data buffer is passed to
|
||||
virBitmapToDataBuf, it will read off the end of the bitmap and copy junk
|
||||
into the returned buffer. Add a check to only copy the length of the
|
||||
bitmap to the buffer.
|
||||
|
||||
The problem can be observed after setting a vcpu affinity using the vcpupin
|
||||
command on a system with a large number of cores:
|
||||
# virsh vcpupin example_domain 0 0
|
||||
# virsh vcpupin example_domain 0
|
||||
VCPU CPU Affinity
|
||||
---------------------------
|
||||
0 0,192,197-198,202
|
||||
|
||||
Signed-off-by: John Allen <john.allen@amd.com>
|
||||
(cherry picked from commit 51f9f80d350e633adf479c6a9b3c55f82ca9cbd4)
|
||||
|
||||
https: //bugzilla.redhat.com/show_bug.cgi?id=1703160
|
||||
Signed-off-by: Erik Skultety <eskultet@redhat.com>
|
||||
Message-Id: <1a487c4f1ba9725eb7325debeeff2861d7047890.1562079635.git.eskultet@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
src/util/virbitmap.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/src/util/virbitmap.c b/src/util/virbitmap.c
|
||||
index 49e542a4e6..7df0a2d4f3 100644
|
||||
--- a/src/util/virbitmap.c
|
||||
+++ b/src/util/virbitmap.c
|
||||
@@ -831,11 +831,15 @@ virBitmapToDataBuf(virBitmapPtr bitmap,
|
||||
unsigned char *bytes,
|
||||
size_t len)
|
||||
{
|
||||
+ size_t nbytes = bitmap->map_len * (VIR_BITMAP_BITS_PER_UNIT / CHAR_BIT);
|
||||
unsigned long *l;
|
||||
size_t i, j;
|
||||
|
||||
memset(bytes, 0, len);
|
||||
|
||||
+ /* If bitmap and buffer differ in size, only fill to the smaller length */
|
||||
+ len = MIN(len, nbytes);
|
||||
+
|
||||
/* htole64 is not provided by gnulib, so we do the conversion by hand */
|
||||
l = bitmap->map;
|
||||
for (i = j = 0; i < len; i++, j++) {
|
||||
--
|
||||
2.22.0
|
||||
|
@ -0,0 +1,183 @@
|
||||
From 5347b12008842b5c86f766e391c6f3756afbff7d Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <5347b12008842b5c86f766e391c6f3756afbff7d@dist-git>
|
||||
From: Daniel Henrique Barboza <danielhb413@gmail.com>
|
||||
Date: Fri, 3 May 2019 13:54:53 +0200
|
||||
Subject: [PATCH] PPC64 support for NVIDIA V100 GPU with NVLink2 passthrough
|
||||
|
||||
The NVIDIA V100 GPU has an onboard RAM that is mapped into the
|
||||
host memory and accessible as normal RAM via an NVLink2 bridge. When
|
||||
passed through in a guest, QEMU puts the NVIDIA RAM window in a
|
||||
non-contiguous area, above the PCI MMIO area that starts at 32TiB.
|
||||
This means that the NVIDIA RAM window starts at 64TiB and go all the
|
||||
way to 128TiB.
|
||||
|
||||
This means that the guest might request a 64-bit window, for each PCI
|
||||
Host Bridge, that goes all the way to 128TiB. However, the NVIDIA RAM
|
||||
window isn't counted as regular RAM, thus this window is considered
|
||||
only for the allocation of the Translation and Control Entry (TCE).
|
||||
For more information about how NVLink2 support works in QEMU,
|
||||
refer to the accepted implementation [1].
|
||||
|
||||
This memory layout differs from the existing VFIO case, requiring its
|
||||
own formula. This patch changes the PPC64 code of
|
||||
@qemuDomainGetMemLockLimitBytes to:
|
||||
|
||||
- detect if we have a NVLink2 bridge being passed through to the
|
||||
guest. This is done by using the @ppc64VFIODeviceIsNV2Bridge function
|
||||
added in the previous patch. The existence of the NVLink2 bridge in
|
||||
the guest means that we are dealing with the NVLink2 memory layout;
|
||||
|
||||
- if an IBM NVLink2 bridge exists, passthroughLimit is calculated in a
|
||||
different way to account for the extra memory the TCE table can alloc.
|
||||
The 64TiB..128TiB window is more than enough to fit all possible
|
||||
GPUs, thus the memLimit is the same regardless of passing through 1 or
|
||||
multiple V100 GPUs.
|
||||
|
||||
Further reading explaining the background
|
||||
[1] https://lists.gnu.org/archive/html/qemu-devel/2019-03/msg03700.html
|
||||
[2] https://www.redhat.com/archives/libvir-list/2019-March/msg00660.html
|
||||
[3] https://www.redhat.com/archives/libvir-list/2019-April/msg00527.html
|
||||
|
||||
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
|
||||
Reviewed-by: Erik Skultety <eskultet@redhat.com>
|
||||
(cherry picked from commit 1a922648f67f56c4374d647feebf2adb9a642f96)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1505998
|
||||
|
||||
Conflicts:
|
||||
The upstream commit relied on:
|
||||
- v4.7.0-37-gb72183223f
|
||||
- v4.7.0-38-ga14f597266
|
||||
which were not backported so virPCIDeviceAddressAsString had to
|
||||
swapped for the former virDomainPCIAddressAsString in order to
|
||||
compile.
|
||||
|
||||
Signed-off-by: Erik Skultety <eskultet@redhat.com>
|
||||
Message-Id: <03c00ebf46d85b0615134ef8655e67a4c909b7da.1556884443.git.eskultet@redhat.com>
|
||||
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
|
||||
---
|
||||
src/qemu/qemu_domain.c | 80 ++++++++++++++++++++++++++++++++----------
|
||||
1 file changed, 61 insertions(+), 19 deletions(-)
|
||||
|
||||
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
|
||||
index a8bc618389..21f0722495 100644
|
||||
--- a/src/qemu/qemu_domain.c
|
||||
+++ b/src/qemu/qemu_domain.c
|
||||
@@ -9813,7 +9813,7 @@ qemuDomainUpdateCurrentMemorySize(virQEMUDriverPtr driver,
|
||||
* such as '0004:04:00.0', and tells if the device is a NVLink2
|
||||
* bridge.
|
||||
*/
|
||||
-static ATTRIBUTE_UNUSED bool
|
||||
+static bool
|
||||
ppc64VFIODeviceIsNV2Bridge(const char *device)
|
||||
{
|
||||
const char *nvlink2Files[] = {"ibm,gpu", "ibm,nvlink",
|
||||
@@ -9851,7 +9851,9 @@ getPPC64MemLockLimitBytes(virDomainDefPtr def)
|
||||
unsigned long long maxMemory = 0;
|
||||
unsigned long long passthroughLimit = 0;
|
||||
size_t i, nPCIHostBridges = 0;
|
||||
+ virPCIDeviceAddressPtr pciAddr;
|
||||
bool usesVFIO = false;
|
||||
+ bool nvlink2Capable = false;
|
||||
|
||||
for (i = 0; i < def->ncontrollers; i++) {
|
||||
virDomainControllerDefPtr cont = def->controllers[i];
|
||||
@@ -9869,7 +9871,17 @@ getPPC64MemLockLimitBytes(virDomainDefPtr def)
|
||||
dev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI &&
|
||||
dev->source.subsys.u.pci.backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO) {
|
||||
usesVFIO = true;
|
||||
- break;
|
||||
+
|
||||
+ pciAddr = &dev->source.subsys.u.pci.addr;
|
||||
+ if (virPCIDeviceAddressIsValid(pciAddr, false)) {
|
||||
+ VIR_AUTOFREE(char *) pciAddrStr = NULL;
|
||||
+
|
||||
+ pciAddrStr = virDomainPCIAddressAsString(pciAddr);
|
||||
+ if (ppc64VFIODeviceIsNV2Bridge(pciAddrStr)) {
|
||||
+ nvlink2Capable = true;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9896,29 +9908,59 @@ getPPC64MemLockLimitBytes(virDomainDefPtr def)
|
||||
4096 * nPCIHostBridges +
|
||||
8192;
|
||||
|
||||
- /* passthroughLimit := max( 2 GiB * #PHBs, (c)
|
||||
- * memory (d)
|
||||
- * + memory * 1/512 * #PHBs + 8 MiB ) (e)
|
||||
+ /* NVLink2 support in QEMU is a special case of the passthrough
|
||||
+ * mechanics explained in the usesVFIO case below. The GPU RAM
|
||||
+ * is placed with a gap after maxMemory. The current QEMU
|
||||
+ * implementation puts the NVIDIA RAM above the PCI MMIO, which
|
||||
+ * starts at 32TiB and is the MMIO reserved for the guest main RAM.
|
||||
*
|
||||
- * (c) is the pre-DDW VFIO DMA window accounting. We're allowing 2 GiB
|
||||
- * rather than 1 GiB
|
||||
+ * This window ends at 64TiB, and this is where the GPUs are being
|
||||
+ * placed. The next available window size is at 128TiB, and
|
||||
+ * 64TiB..128TiB will fit all possible NVIDIA GPUs.
|
||||
*
|
||||
- * (d) is the with-DDW (and memory pre-registration and related
|
||||
- * features) DMA window accounting - assuming that we only account RAM
|
||||
- * once, even if mapped to multiple PHBs
|
||||
+ * The same assumption as the most common case applies here:
|
||||
+ * the guest will request a 64-bit DMA window, per PHB, that is
|
||||
+ * big enough to map all its RAM, which is now at 128TiB due
|
||||
+ * to the GPUs.
|
||||
*
|
||||
- * (e) is the with-DDW userspace view and overhead for the 64-bit DMA
|
||||
- * window. This is based a bit on expected guest behaviour, but there
|
||||
- * really isn't a way to completely avoid that. We assume the guest
|
||||
- * requests a 64-bit DMA window (per PHB) just big enough to map all
|
||||
- * its RAM. 4 kiB page size gives the 1/512; it will be less with 64
|
||||
- * kiB pages, less still if the guest is mapped with hugepages (unlike
|
||||
- * the default 32-bit DMA window, DDW windows can use large IOMMU
|
||||
- * pages). 8 MiB is for second and further level overheads, like (b) */
|
||||
- if (usesVFIO)
|
||||
+ * Note that the NVIDIA RAM window must be accounted for the TCE
|
||||
+ * table size, but *not* for the main RAM (maxMemory). This gives
|
||||
+ * us the following passthroughLimit for the NVLink2 case:
|
||||
+ *
|
||||
+ * passthroughLimit = maxMemory +
|
||||
+ * 128TiB/512KiB * #PHBs + 8 MiB */
|
||||
+ if (nvlink2Capable) {
|
||||
+ passthroughLimit = maxMemory +
|
||||
+ 128 * (1ULL<<30) / 512 * nPCIHostBridges +
|
||||
+ 8192;
|
||||
+ } else if (usesVFIO) {
|
||||
+ /* For regular (non-NVLink2 present) VFIO passthrough, the value
|
||||
+ * of passthroughLimit is:
|
||||
+ *
|
||||
+ * passthroughLimit := max( 2 GiB * #PHBs, (c)
|
||||
+ * memory (d)
|
||||
+ * + memory * 1/512 * #PHBs + 8 MiB ) (e)
|
||||
+ *
|
||||
+ * (c) is the pre-DDW VFIO DMA window accounting. We're allowing 2
|
||||
+ * GiB rather than 1 GiB
|
||||
+ *
|
||||
+ * (d) is the with-DDW (and memory pre-registration and related
|
||||
+ * features) DMA window accounting - assuming that we only account
|
||||
+ * RAM once, even if mapped to multiple PHBs
|
||||
+ *
|
||||
+ * (e) is the with-DDW userspace view and overhead for the 64-bit
|
||||
+ * DMA window. This is based a bit on expected guest behaviour, but
|
||||
+ * there really isn't a way to completely avoid that. We assume the
|
||||
+ * guest requests a 64-bit DMA window (per PHB) just big enough to
|
||||
+ * map all its RAM. 4 kiB page size gives the 1/512; it will be
|
||||
+ * less with 64 kiB pages, less still if the guest is mapped with
|
||||
+ * hugepages (unlike the default 32-bit DMA window, DDW windows
|
||||
+ * can use large IOMMU pages). 8 MiB is for second and further level
|
||||
+ * overheads, like (b) */
|
||||
passthroughLimit = MAX(2 * 1024 * 1024 * nPCIHostBridges,
|
||||
memory +
|
||||
memory / 512 * nPCIHostBridges + 8192);
|
||||
+ }
|
||||
|
||||
memKB = baseLimit + passthroughLimit;
|
||||
|
||||
--
|
||||
2.21.0
|
||||
|
@ -0,0 +1,35 @@
|
||||
From 74b69d4a7240c601fcd12c18d5e8d95d641ae922 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <74b69d4a7240c601fcd12c18d5e8d95d641ae922@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
|
||||
|
||||
RHEL-only.
|
||||
|
||||
pc-q35-rhel7.0.0 and pc-q35-rhel7.1.0 do not need an explicit
|
||||
isa-fdc controller.
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1227880
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
---
|
||||
src/qemu/qemu_domain.c | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
|
||||
index 4c15d5a36a..4c2a162b85 100644
|
||||
--- a/src/qemu/qemu_domain.c
|
||||
+++ b/src/qemu/qemu_domain.c
|
||||
@@ -9239,6 +9239,9 @@ qemuDomainMachineNeedsFDC(const char *machine)
|
||||
STRPREFIX(p, "2.2") ||
|
||||
STRPREFIX(p, "2.3"))
|
||||
return false;
|
||||
+ if (STRPREFIX(p, "rhel7.0.0") ||
|
||||
+ STRPREFIX(p, "rhel7.1.0"))
|
||||
+ return false;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
--
|
||||
2.18.0
|
||||
|
46
SOURCES/libvirt-RHEL-Fix-virConnectGetMaxVcpus-output.patch
Normal file
46
SOURCES/libvirt-RHEL-Fix-virConnectGetMaxVcpus-output.patch
Normal file
@ -0,0 +1,46 @@
|
||||
From 72c5455c00fcec50bae3e71a6fbd6330e524be0a Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <72c5455c00fcec50bae3e71a6fbd6330e524be0a@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
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1092363
|
||||
|
||||
RHEL-only.
|
||||
|
||||
Ignore the maximum vcpu limit (KVM_CAP_MAX_VCPUS) on RHEL,
|
||||
since RHEL QEMU treats the recommended limit (KVM_CAP_NR_VCPUS)
|
||||
as the maximum, see:
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=998708
|
||||
|
||||
(cherry picked from commit 7dff909fa34bdd93ad200dbffe70c0c1ee931925)
|
||||
Signed-off-by: Ján Tomko <jtomko@redhat.com>
|
||||
|
||||
https: //bugzilla.redhat.com/show_bug.cgi?id=1582222
|
||||
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
|
||||
---
|
||||
src/util/virhostcpu.c | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c
|
||||
index 1e31be5900..effe04ca3a 100644
|
||||
--- a/src/util/virhostcpu.c
|
||||
+++ b/src/util/virhostcpu.c
|
||||
@@ -1186,6 +1186,11 @@ virHostCPUGetKVMMaxVCPUs(void)
|
||||
return -1;
|
||||
}
|
||||
|
||||
+/* Ignore KVM_CAP_MAX_VCPUS on RHEL - the recommended maximum
|
||||
+ * is treated as a hard limit.
|
||||
+ */
|
||||
+# undef KVM_CAP_MAX_VCPUS
|
||||
+
|
||||
# ifdef KVM_CAP_MAX_VCPUS
|
||||
/* 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.18.0
|
||||
|
@ -0,0 +1,165 @@
|
||||
From 498389f6b88547c352add4b209d61896a5143c00 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <498389f6b88547c352add4b209d61896a5143c00@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
|
||||
|
||||
RHEL-only
|
||||
|
||||
Upstream tried to solve the change of Broadwell and Haswell CPUs by
|
||||
removing rtm and hle features from the corresponding CPU models for new
|
||||
machine types. Then they reverted this and introduced new *-noTSX models
|
||||
instead. However, the original fix was backported to RHEL.
|
||||
|
||||
This patch makes sure Broadwell and Haswell will always contain rtm and
|
||||
hle features regardless on RHEL version or machine type used.
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1199446
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
---
|
||||
src/qemu/qemu_command.c | 29 +++++++++++++++++++
|
||||
tests/qemuxml2argvdata/cpu-Haswell.args | 2 +-
|
||||
.../qemuxml2argvdata/cpu-host-model-cmt.args | 3 +-
|
||||
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 +-
|
||||
7 files changed, 36 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
|
||||
index 4fc3176ad3..c1eefca639 100644
|
||||
--- a/src/qemu/qemu_command.c
|
||||
+++ b/src/qemu/qemu_command.c
|
||||
@@ -6677,6 +6677,8 @@ qemuBuildCpuModelArgStr(virQEMUDriverPtr driver,
|
||||
size_t i;
|
||||
virCapsPtr caps = NULL;
|
||||
virCPUDefPtr cpu = def->cpu;
|
||||
+ bool hle = false;
|
||||
+ bool rtm = false;
|
||||
|
||||
if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
|
||||
goto cleanup;
|
||||
@@ -6734,6 +6736,11 @@ qemuBuildCpuModelArgStr(virQEMUDriverPtr driver,
|
||||
virBufferAsprintf(buf, ",vendor=%s", cpu->vendor_id);
|
||||
|
||||
for (i = 0; i < cpu->nfeatures; i++) {
|
||||
+ if (STREQ("rtm", cpu->features[i].name))
|
||||
+ rtm = true;
|
||||
+ if (STREQ("hle", cpu->features[i].name))
|
||||
+ hle = true;
|
||||
+
|
||||
switch ((virCPUFeaturePolicy) cpu->features[i].policy) {
|
||||
case VIR_CPU_FEATURE_FORCE:
|
||||
case VIR_CPU_FEATURE_REQUIRE:
|
||||
@@ -6757,6 +6764,28 @@ qemuBuildCpuModelArgStr(virQEMUDriverPtr driver,
|
||||
}
|
||||
}
|
||||
|
||||
+ /* Some versions of qemu-kvm in RHEL provide Broadwell and Haswell CPU
|
||||
+ * models which lack rtm and hle features when used with some machine
|
||||
+ * types. Let's make sure Broadwell and Haswell will always have these
|
||||
+ * features. But only if the features were not explicitly mentioned in
|
||||
+ * the guest CPU definition.
|
||||
+ */
|
||||
+ if (STREQ_NULLABLE(cpu->model, "Broadwell") ||
|
||||
+ STREQ_NULLABLE(cpu->model, "Haswell")) {
|
||||
+ if (!rtm) {
|
||||
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION))
|
||||
+ virBufferAddLit(buf, ",rtm=on");
|
||||
+ else
|
||||
+ virBufferAddLit(buf, ",+rtm");
|
||||
+ }
|
||||
+ if (!hle) {
|
||||
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION))
|
||||
+ virBufferAddLit(buf, ",hle=on");
|
||||
+ else
|
||||
+ virBufferAddLit(buf, ",+hle");
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
ret = 0;
|
||||
cleanup:
|
||||
virObjectUnref(caps);
|
||||
diff --git a/tests/qemuxml2argvdata/cpu-Haswell.args b/tests/qemuxml2argvdata/cpu-Haswell.args
|
||||
index c7ce396d05..6f20359524 100644
|
||||
--- a/tests/qemuxml2argvdata/cpu-Haswell.args
|
||||
+++ b/tests/qemuxml2argvdata/cpu-Haswell.args
|
||||
@@ -8,7 +8,7 @@ QEMU_AUDIO_DRV=none \
|
||||
-name QEMUGuest1 \
|
||||
-S \
|
||||
-machine pc,accel=kvm,usb=off,dump-guest-core=off \
|
||||
--cpu Haswell \
|
||||
+-cpu Haswell,+rtm,+hle \
|
||||
-m 214 \
|
||||
-smp 6,sockets=6,cores=1,threads=1 \
|
||||
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
|
||||
diff --git a/tests/qemuxml2argvdata/cpu-host-model-cmt.args b/tests/qemuxml2argvdata/cpu-host-model-cmt.args
|
||||
index 8767278d11..d236aa9e09 100644
|
||||
--- a/tests/qemuxml2argvdata/cpu-host-model-cmt.args
|
||||
+++ b/tests/qemuxml2argvdata/cpu-host-model-cmt.args
|
||||
@@ -9,7 +9,8 @@ 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,+osxsave,+f16c,+rdrand,+pdpe1gb,+abm,+lahf_lm \
|
||||
++smx,+est,+tm2,+xtpr,+pdcm,+osxsave,+f16c,+rdrand,+pdpe1gb,+abm,+lahf_lm,+rtm,\
|
||||
++hle \
|
||||
-m 214 \
|
||||
-smp 6,sockets=6,cores=1,threads=1 \
|
||||
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
|
||||
diff --git a/tests/qemuxml2argvdata/cpu-tsc-frequency.args b/tests/qemuxml2argvdata/cpu-tsc-frequency.args
|
||||
index 7824dea96f..216fd43014 100644
|
||||
--- a/tests/qemuxml2argvdata/cpu-tsc-frequency.args
|
||||
+++ b/tests/qemuxml2argvdata/cpu-tsc-frequency.args
|
||||
@@ -10,7 +10,7 @@ QEMU_AUDIO_DRV=none \
|
||||
-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,+osxsave,+f16c,+rdrand,+pdpe1gb,+abm,+lahf_lm,\
|
||||
-+invtsc,tsc-frequency=3504000000 \
|
||||
++invtsc,+rtm,+hle,tsc-frequency=3504000000 \
|
||||
-m 214 \
|
||||
-smp 1,sockets=1,cores=1,threads=1 \
|
||||
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
|
||||
diff --git a/tests/qemuxml2argvdata/q35-acpi-nouefi.args b/tests/qemuxml2argvdata/q35-acpi-nouefi.args
|
||||
index caef49ea16..a9375a35db 100644
|
||||
--- a/tests/qemuxml2argvdata/q35-acpi-nouefi.args
|
||||
+++ b/tests/qemuxml2argvdata/q35-acpi-nouefi.args
|
||||
@@ -8,7 +8,7 @@ QEMU_AUDIO_DRV=none \
|
||||
-name guest \
|
||||
-S \
|
||||
-machine q35,accel=tcg,usb=off,dump-guest-core=off \
|
||||
--cpu Haswell \
|
||||
+-cpu Haswell,+rtm,+hle \
|
||||
-m 1024 \
|
||||
-smp 1,sockets=1,cores=1,threads=1 \
|
||||
-uuid 496d7ea8-9739-544b-4ebd-ef08be936e8b \
|
||||
diff --git a/tests/qemuxml2argvdata/q35-acpi-uefi.args b/tests/qemuxml2argvdata/q35-acpi-uefi.args
|
||||
index a3293aeb9d..8e3368b9e9 100644
|
||||
--- a/tests/qemuxml2argvdata/q35-acpi-uefi.args
|
||||
+++ b/tests/qemuxml2argvdata/q35-acpi-uefi.args
|
||||
@@ -8,7 +8,7 @@ QEMU_AUDIO_DRV=none \
|
||||
-name guest \
|
||||
-S \
|
||||
-machine q35,accel=tcg,usb=off,dump-guest-core=off \
|
||||
--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,\
|
||||
diff --git a/tests/qemuxml2argvdata/q35-noacpi-nouefi.args b/tests/qemuxml2argvdata/q35-noacpi-nouefi.args
|
||||
index fab2a6fcb0..0dd61840ef 100644
|
||||
--- a/tests/qemuxml2argvdata/q35-noacpi-nouefi.args
|
||||
+++ b/tests/qemuxml2argvdata/q35-noacpi-nouefi.args
|
||||
@@ -8,7 +8,7 @@ QEMU_AUDIO_DRV=none \
|
||||
-name guest \
|
||||
-S \
|
||||
-machine q35,accel=tcg,usb=off,dump-guest-core=off \
|
||||
--cpu Haswell \
|
||||
+-cpu Haswell,+rtm,+hle \
|
||||
-m 1024 \
|
||||
-smp 1,sockets=1,cores=1,threads=1 \
|
||||
-uuid 496d7ea8-9739-544b-4ebd-ef08be936e8b \
|
||||
--
|
||||
2.18.0
|
||||
|
@ -0,0 +1,146 @@
|
||||
From 54e270d7fb68b41002654374d395e4f260a24add Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <54e270d7fb68b41002654374d395e4f260a24add@dist-git>
|
||||
From: Laine Stump <laine@redhat.com>
|
||||
Date: Mon, 15 Oct 2018 20:31:02 -0400
|
||||
Subject: [PATCH] RHEL: network: regain guest network connectivity after
|
||||
firewalld switch to nftables
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This is a DOWNSTREAM ONLY patch to temporarily get back guest network
|
||||
connectivity while still allowing the firewalld backend to use
|
||||
nftables (which is the default with RHEL8).
|
||||
|
||||
The circumstances that cause the problem:
|
||||
|
||||
In the past (when both libvirt and firewalld used iptables), if either
|
||||
libvirt's rules *OR* firewalld's rules accepted a packet, it would be
|
||||
accepted.
|
||||
|
||||
But now firewalld uses nftables for its backend, while libvirt's
|
||||
firewall rules are still using iptables; iptables rules are still
|
||||
processed, but at a different time during packet processing than the
|
||||
firewalld nftables hooks. The result is that a packet must be accepted
|
||||
by *BOTH* the libvirt iptables rules *AND* the firewalld nftable rules
|
||||
in order to be accepted.
|
||||
|
||||
This causes pain for two types of traffic:
|
||||
|
||||
1) libvirt always adds rules to permit DNS and DHCP (and sometimes
|
||||
TFTP) from guests to the host. But libvirt's bridges are in
|
||||
firewalld's "default" zone (which is usually the zone called
|
||||
"public"). The public zone allows ssh, but doesn't allow DNS, DHCP, or
|
||||
TFTP. So guests connected to libvirt's bridges can't acquire an IP
|
||||
address from DHCP, nor can they make DNS queries to the DNS server
|
||||
libvirt has setup on the host.
|
||||
|
||||
2) firewalld's higher level "rich rules" don't yet have the ability to
|
||||
configure the acceptance of forwarded traffic (traffic that is going
|
||||
somewhere beyond the host), so any traffic that needs to be forwarded
|
||||
is rejected.
|
||||
|
||||
libvirt can't send "direct" nftables rules (firewalld only supports
|
||||
that for iptables), so we can't solve this problem by just sending
|
||||
direct nftables rules instead of iptables rules.
|
||||
|
||||
However, we can take advantage of a quirk in firewalld zones that have
|
||||
a default policy of accept (meaning any packet that doesn't match a
|
||||
specific rule in the zone will be accepted) - this default accept will
|
||||
also accept forwarded traffic (not just traffic destined for the host).
|
||||
|
||||
So, as a temporary solution to get all network traffic flowing, this
|
||||
patch creates a new firewalld zone called "libvirt" which is setup to
|
||||
include interfaces named virbr0-virbr9, and has a default policy of
|
||||
accept. With this zone installed, libvirt networks that use the names
|
||||
virbr0-virbr9 will have *all* their traffic accepted, both to the host
|
||||
and to/from the rest of the network.
|
||||
|
||||
firewalld zones can't normally be added to the runtime config of
|
||||
firewalld, so we have to reload all of the permanent config for it to
|
||||
be recognized. This is done with a call to "firewall-cmd --reload"
|
||||
during postinstall and postuninstall. In the case that firewalld is
|
||||
inactive, firewall-cmd exits without doing anything (i.e. it doesn't
|
||||
start up firewalld.service if it's not already started).
|
||||
|
||||
This obviously can't be a permanent solution, since it allows guests
|
||||
to have access to *all* services on the host. However, it doesn't
|
||||
allow QE and beta testers to test firewalld with an nftables backend
|
||||
(which is important for firewalld and nftables devs) without breaking
|
||||
network connectivity for libvirt managed virtual machines (so testing
|
||||
of those can also take place.
|
||||
|
||||
Resolves: https://bugzilla.redhat.com/1638864
|
||||
|
||||
This problem is discussed in more detail in this message thread:
|
||||
|
||||
https://post-office.corp.redhat.com/mailman/private/virt-devel/2018-September/msg00145.html
|
||||
https://post-office.corp.redhat.com/mailman/private/virt-devel/2018-October/msg00042.html
|
||||
|
||||
and in the BZ assigned to firewalld: https://bugzilla.redhat.com/1623841
|
||||
|
||||
Signed-off-by: Laine Stump <laine@laine.org>
|
||||
Acked-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
---
|
||||
libvirt.spec.in | 14 ++++++++++++++
|
||||
src/network/Makefile.inc.am | 10 +++++++++-
|
||||
src/network/libvirt.zone | 15 +++++++++++++++
|
||||
3 files changed, 38 insertions(+), 1 deletion(-)
|
||||
create mode 100644 src/network/libvirt.zone
|
||||
|
||||
diff --git a/src/network/Makefile.inc.am b/src/network/Makefile.inc.am
|
||||
index 508c8c0422..20d899e699 100644
|
||||
--- a/src/network/Makefile.inc.am
|
||||
+++ b/src/network/Makefile.inc.am
|
||||
@@ -87,6 +87,11 @@ install-data-network:
|
||||
( cd $(DESTDIR)$(confdir)/qemu/networks/autostart && \
|
||||
rm -f default.xml && \
|
||||
$(LN_S) ../default.xml default.xml )
|
||||
+if HAVE_FIREWALLD
|
||||
+ $(MKDIR_P) "$(DESTDIR)$(prefix)/lib/firewalld/zones"
|
||||
+ $(INSTALL_DATA) $(srcdir)/network/libvirt.zone \
|
||||
+ $(DESTDIR)$(prefix)/lib/firewalld/zones/libvirt.xml
|
||||
+endif HAVE_FIREWALLD
|
||||
|
||||
uninstall-data-network:
|
||||
rm -f $(DESTDIR)$(confdir)/qemu/networks/autostart/default.xml
|
||||
@@ -95,10 +100,13 @@ uninstall-data-network:
|
||||
rmdir "$(DESTDIR)$(confdir)/qemu/networks" || :
|
||||
rmdir "$(DESTDIR)$(localstatedir)/lib/libvirt/network" ||:
|
||||
rmdir "$(DESTDIR)$(localstatedir)/run/libvirt/network" ||:
|
||||
+if HAVE_FIREWALLD
|
||||
+ rm -f $(DESTDIR)$(prefix)/lib/firewalld/zones/libvirt.xml
|
||||
+endif HAVE_FIREWALLD
|
||||
|
||||
endif WITH_NETWORK
|
||||
|
||||
-EXTRA_DIST += network/default.xml
|
||||
+EXTRA_DIST += network/default.xml network/libvirt.zone
|
||||
|
||||
.PHONY: \
|
||||
install-data-network \
|
||||
diff --git a/src/network/libvirt.zone b/src/network/libvirt.zone
|
||||
new file mode 100644
|
||||
index 0000000000..355a70b4da
|
||||
--- /dev/null
|
||||
+++ b/src/network/libvirt.zone
|
||||
@@ -0,0 +1,15 @@
|
||||
+<?xml version="1.0" encoding="utf-8"?>
|
||||
+<zone target="ACCEPT">
|
||||
+ <short>libvirt</short>
|
||||
+ <description>All network connections are accepted. This also permits packets to/from interfaces in the zone to be forwarded. This zone is intended to be used only by libvirt virtual networks.</description>
|
||||
+ <interface name="virbr0"/>
|
||||
+ <interface name="virbr1"/>
|
||||
+ <interface name="virbr2"/>
|
||||
+ <interface name="virbr3"/>
|
||||
+ <interface name="virbr4"/>
|
||||
+ <interface name="virbr5"/>
|
||||
+ <interface name="virbr6"/>
|
||||
+ <interface name="virbr7"/>
|
||||
+ <interface name="virbr8"/>
|
||||
+ <interface name="virbr9"/>
|
||||
+</zone>
|
||||
--
|
||||
2.19.1
|
||||
|
@ -0,0 +1,77 @@
|
||||
From 2d4b19613c462e876ee1327d600f5cbbb998c540 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <2d4b19613c462e876ee1327d600f5cbbb998c540@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
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1582424
|
||||
|
||||
RHEL-only
|
||||
|
||||
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: Jiri Denemark <jdenemar@redhat.com>
|
||||
(cherry picked from commit f2cf0ae7bc371c75f6c0e79192711f2b1d201b10)
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
src/qemu/qemu_conf.c | 16 +++++++++-------
|
||||
1 file changed, 9 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
|
||||
index a4f545ef92..3ea9784854 100644
|
||||
--- a/src/qemu/qemu_conf.c
|
||||
+++ b/src/qemu/qemu_conf.c
|
||||
@@ -1633,6 +1633,7 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
|
||||
virDomainDiskDefPtr disk = NULL;
|
||||
virDomainHostdevDefPtr hostdev = NULL;
|
||||
char *sysfs_path = NULL;
|
||||
+ char *hostdev_path = NULL;
|
||||
const char *path = NULL;
|
||||
int val = -1;
|
||||
int ret = -1;
|
||||
@@ -1654,14 +1655,10 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
|
||||
if (!qemuIsSharedHostdev(hostdev))
|
||||
return 0;
|
||||
|
||||
- if (hostdev->source.subsys.u.scsi.sgio) {
|
||||
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
- _("'sgio' is not supported for SCSI "
|
||||
- "generic device yet "));
|
||||
+ if (!(hostdev_path = qemuGetHostdevPath(hostdev)))
|
||||
goto cleanup;
|
||||
- }
|
||||
|
||||
- return 0;
|
||||
+ path = hostdev_path;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
@@ -1670,7 +1667,11 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
|
||||
goto cleanup;
|
||||
|
||||
/* 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);
|
||||
|
||||
/* 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
|
||||
@@ -1683,6 +1684,7 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
+ VIR_FREE(hostdev_path);
|
||||
VIR_FREE(sysfs_path);
|
||||
return ret;
|
||||
}
|
||||
--
|
||||
2.20.1
|
||||
|
@ -0,0 +1,64 @@
|
||||
From c39257f41ccb22272c6161777bf71390676bf7f0 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <c39257f41ccb22272c6161777bf71390676bf7f0@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
|
||||
device
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1582424
|
||||
|
||||
RHEL-only
|
||||
|
||||
Check if the hostdev has set the sgio filtered/unfiltered and handle
|
||||
appropriately.
|
||||
|
||||
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: Jiri Denemark <jdenemar@redhat.com>
|
||||
(cherry picked from commit 712005bcf26190dc6fd1fe56283377987909cc4b)
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
src/qemu/qemu_conf.c | 15 +++++++++++++++
|
||||
1 file changed, 15 insertions(+)
|
||||
|
||||
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
|
||||
index 3ea9784854..7d15af9c0b 100644
|
||||
--- a/src/qemu/qemu_conf.c
|
||||
+++ b/src/qemu/qemu_conf.c
|
||||
@@ -1473,6 +1473,8 @@ qemuAddSharedHostdev(virQEMUDriverPtr driver,
|
||||
{
|
||||
char *dev_path = NULL;
|
||||
char *key = NULL;
|
||||
+ virDomainHostdevSubsysSCSIPtr scsisrc = &hostdev->source.subsys.u.scsi;
|
||||
+ virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host;
|
||||
int ret = -1;
|
||||
|
||||
if (!qemuIsSharedHostdev(hostdev))
|
||||
@@ -1481,6 +1483,19 @@ qemuAddSharedHostdev(virQEMUDriverPtr driver,
|
||||
if (!(dev_path = qemuGetHostdevPath(hostdev)))
|
||||
goto cleanup;
|
||||
|
||||
+ if ((ret = qemuCheckUnprivSGIO(driver->sharedDevices, dev_path,
|
||||
+ scsisrc->sgio)) < 0) {
|
||||
+ if (ret == -2) {
|
||||
+ virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
+ _("sgio of shared scsi host device '%s-%u-%u-%llu' "
|
||||
+ "conflicts with other active domains"),
|
||||
+ scsihostsrc->adapter, scsihostsrc->bus,
|
||||
+ scsihostsrc->target, scsihostsrc->unit);
|
||||
+ ret = -1;
|
||||
+ }
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+
|
||||
if (!(key = qemuGetSharedDeviceKey(dev_path)))
|
||||
goto cleanup;
|
||||
|
||||
--
|
||||
2.20.1
|
||||
|
@ -0,0 +1,45 @@
|
||||
From 11bfd4f26c090b95a100aaf056ecfa799dfce979 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <11bfd4f26c090b95a100aaf056ecfa799dfce979@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 768e9d8308..a81298326f 100644
|
||||
--- a/src/qemu/qemu_conf.c
|
||||
+++ b/src/qemu/qemu_conf.c
|
||||
@@ -1667,6 +1667,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)))
|
||||
goto cleanup;
|
||||
|
||||
--
|
||||
2.20.1
|
||||
|
@ -0,0 +1,42 @@
|
||||
From 825720316c0f63b029673f883c79a45e49e0f8ab Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <825720316c0f63b029673f883c79a45e49e0f8ab@dist-git>
|
||||
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
|
||||
Date: Fri, 6 Mar 2020 15:51:49 +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=1808399
|
||||
|
||||
Signed-off-by: Ján Tomko <jtomko@redhat.com>
|
||||
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
|
||||
Message-Id: <20200306145149.1610286-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 5788354444..a86e340013 100644
|
||||
--- a/src/qemu/qemu_conf.c
|
||||
+++ b/src/qemu/qemu_conf.c
|
||||
@@ -1255,7 +1255,7 @@ qemuCheckUnprivSGIO(virHashTablePtr sharedDevices,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
- if (virGetDeviceUnprivSGIO(device_path, &val) < 0)
|
||||
+ if (virGetDeviceUnprivSGIO(sysfs_path, &val) < 0)
|
||||
goto cleanup;
|
||||
|
||||
/* Error message on failure needs to be handled in caller
|
||||
--
|
||||
2.25.1
|
||||
|
@ -0,0 +1,170 @@
|
||||
From 785d2dd780b472bf857dd962d910addd9ff7b07f Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <785d2dd780b472bf857dd962d910addd9ff7b07f@dist-git>
|
||||
From: Michal Privoznik <mprivozn@redhat.com>
|
||||
Date: Fri, 6 Mar 2020 15:51:48 +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=1808388
|
||||
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
|
||||
Message-Id: <20200306145149.1610286-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 5636277888..5788354444 100644
|
||||
--- a/src/qemu/qemu_conf.c
|
||||
+++ b/src/qemu/qemu_conf.c
|
||||
@@ -1255,7 +1255,7 @@ qemuCheckUnprivSGIO(virHashTablePtr sharedDevices,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
- if (virGetDeviceUnprivSGIO(device_path, NULL, &val) < 0)
|
||||
+ if (virGetDeviceUnprivSGIO(device_path, &val) < 0)
|
||||
goto cleanup;
|
||||
|
||||
/* Error message on failure needs to be handled in caller
|
||||
@@ -1648,7 +1648,6 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
|
||||
virDomainDiskDefPtr disk = NULL;
|
||||
virDomainHostdevDefPtr hostdev = NULL;
|
||||
char *sysfs_path = NULL;
|
||||
- const char *path = NULL;
|
||||
int val = 0;
|
||||
int ret = -1;
|
||||
|
||||
@@ -1657,13 +1656,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)))
|
||||
goto cleanup;
|
||||
|
||||
@@ -1703,7 +1701,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)
|
||||
goto cleanup;
|
||||
|
||||
ret = 0;
|
||||
diff --git a/src/util/virutil.c b/src/util/virutil.c
|
||||
index 2448eba073..ad2b8cb3a2 100644
|
||||
--- a/src/util/virutil.c
|
||||
+++ b/src/util/virutil.c
|
||||
@@ -1736,18 +1736,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;
|
||||
@@ -1756,38 +1751,32 @@ virSetDeviceUnprivSGIO(const char *path,
|
||||
if (virAsprintf(&val, "%d", unpriv_sgio) < 0)
|
||||
goto cleanup;
|
||||
|
||||
- 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')))
|
||||
@@ -1795,13 +1784,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 1ba9635bd9..1a1313cfa3 100644
|
||||
--- a/src/util/virutil.h
|
||||
+++ b/src/util/virutil.h
|
||||
@@ -160,10 +160,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
|
||||
|
@ -0,0 +1,232 @@
|
||||
From 521a2285cfee3d2fdd59cb7a3270e9ef91bcc14f Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <521a2285cfee3d2fdd59cb7a3270e9ef91bcc14f@dist-git>
|
||||
From: Michal Privoznik <mprivozn@redhat.com>
|
||||
Date: Fri, 6 Mar 2020 15:51:44 +0100
|
||||
Subject: [PATCH] RHEL: virscsi: Check device type before getting it's /dev
|
||||
node name
|
||||
|
||||
Not all SCSI devices are block devices, therefore
|
||||
/sys/bus/scsi/devices/X:X:X:X/block/ directory does not always
|
||||
exist. Check if the SCSI device is a block device beforehand.
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1808388
|
||||
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
|
||||
Message-Id: <20200306145149.1610286-2-abologna@redhat.com>
|
||||
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
---
|
||||
src/util/virscsi.c | 149 ++++++++++++++++++++++++++++++---
|
||||
tests/virscsidata/0-0-0-0/type | 1 +
|
||||
tests/virscsidata/1-0-0-0/type | 1 +
|
||||
3 files changed, 138 insertions(+), 13 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 b51103a86d..af908107d9 100644
|
||||
--- a/src/util/virscsi.c
|
||||
+++ b/src/util/virscsi.c
|
||||
@@ -56,6 +56,32 @@ struct _virUsedByInfo {
|
||||
};
|
||||
typedef struct _virUsedByInfo *virUsedByInfoPtr;
|
||||
|
||||
+
|
||||
+/* Keep in sync with scsi/scsi_proto.h */
|
||||
+typedef enum {
|
||||
+ VIR_SCSI_DEVICE_TYPE_NONE = -1,
|
||||
+ VIR_SCSI_DEVICE_TYPE_DISK = 0x00,
|
||||
+ VIR_SCSI_DEVICE_TYPE_TAPE = 0x01,
|
||||
+ VIR_SCSI_DEVICE_TYPE_PRINTER = 0x02,
|
||||
+ VIR_SCSI_DEVICE_TYPE_PROCESSOR = 0x03,
|
||||
+ VIR_SCSI_DEVICE_TYPE_WORM = 0x04,
|
||||
+ VIR_SCSI_DEVICE_TYPE_ROM = 0x05,
|
||||
+ VIR_SCSI_DEVICE_TYPE_SCANNER = 0x06,
|
||||
+ VIR_SCSI_DEVICE_TYPE_MOD = 0x07,
|
||||
+ VIR_SCSI_DEVICE_TYPE_MEDIUM_CHANGER = 0x08,
|
||||
+ VIR_SCSI_DEVICE_TYPE_COMM = 0x09,
|
||||
+ VIR_SCSI_DEVICE_TYPE_RAID = 0x0c,
|
||||
+ VIR_SCSI_DEVICE_TYPE_ENCLOSURE = 0x0d,
|
||||
+ VIR_SCSI_DEVICE_TYPE_RBC = 0x0e,
|
||||
+ VIR_SCSI_DEVICE_TYPE_OSD = 0x11,
|
||||
+ VIR_SCSI_DEVICE_TYPE_ZBC = 0x14,
|
||||
+ VIR_SCSI_DEVICE_TYPE_WLUN = 0x1e,
|
||||
+ VIR_SCSI_DEVICE_TYPE_NO_LUN = 0x7f,
|
||||
+
|
||||
+ VIR_SCSI_DEVICE_TYPE_LAST,
|
||||
+} virSCSIDeviceType;
|
||||
+
|
||||
+
|
||||
struct _virSCSIDevice {
|
||||
unsigned int adapter;
|
||||
unsigned int bus;
|
||||
@@ -143,6 +169,86 @@ virSCSIDeviceGetSgName(const char *sysfs_prefix,
|
||||
return sg;
|
||||
}
|
||||
|
||||
+
|
||||
+static int
|
||||
+virSCSIDeviceGetType(const char *prefix,
|
||||
+ unsigned int adapter,
|
||||
+ unsigned int bus,
|
||||
+ unsigned int target,
|
||||
+ unsigned long long unit,
|
||||
+ virSCSIDeviceType *type)
|
||||
+{
|
||||
+ int intType;
|
||||
+
|
||||
+ if (virFileReadValueInt(&intType,
|
||||
+ "%s/%d:%u:%u:%llu/type",
|
||||
+ prefix, adapter, bus, target, unit) < 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ switch (intType) {
|
||||
+ case VIR_SCSI_DEVICE_TYPE_DISK:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_TAPE:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_PRINTER:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_PROCESSOR:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_WORM:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_ROM:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_SCANNER:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_MOD:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_MEDIUM_CHANGER:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_COMM:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_RAID:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_ENCLOSURE:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_RBC:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_OSD:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_ZBC:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_WLUN:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_NO_LUN:
|
||||
+ *type = intType;
|
||||
+ break;
|
||||
+
|
||||
+ default:
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
+ _("unknown SCSI device type: %x"),
|
||||
+ intType);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static char *
|
||||
+virSCSIDeviceGetDevNameBlock(const char *prefix,
|
||||
+ unsigned int adapter,
|
||||
+ unsigned int bus,
|
||||
+ unsigned int target,
|
||||
+ unsigned long long unit)
|
||||
+{
|
||||
+ DIR *dir = NULL;
|
||||
+ struct dirent *entry;
|
||||
+ char *path = NULL;
|
||||
+ char *name = NULL;
|
||||
+
|
||||
+ if (virAsprintf(&path,
|
||||
+ "%s/%d:%u:%u:%llu/block",
|
||||
+ prefix, adapter, bus, target, unit) < 0)
|
||||
+ return NULL;
|
||||
+
|
||||
+ if (virDirOpen(&dir, path) < 0)
|
||||
+ goto cleanup;
|
||||
+
|
||||
+ while (virDirRead(dir, &entry, path) > 0) {
|
||||
+ ignore_value(VIR_STRDUP(name, entry->d_name));
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ cleanup:
|
||||
+ VIR_DIR_CLOSE(dir);
|
||||
+ VIR_FREE(path);
|
||||
+ return name;
|
||||
+}
|
||||
+
|
||||
+
|
||||
/* Returns device name (e.g. "sdc") on success, or NULL
|
||||
* on failure.
|
||||
*/
|
||||
@@ -153,35 +259,52 @@ virSCSIDeviceGetDevName(const char *sysfs_prefix,
|
||||
unsigned int target,
|
||||
unsigned long long unit)
|
||||
{
|
||||
- DIR *dir = NULL;
|
||||
- struct dirent *entry;
|
||||
- char *path = NULL;
|
||||
char *name = NULL;
|
||||
unsigned int adapter_id;
|
||||
+ virSCSIDeviceType type;
|
||||
const char *prefix = sysfs_prefix ? sysfs_prefix : SYSFS_SCSI_DEVICES;
|
||||
|
||||
if (virSCSIDeviceGetAdapterId(adapter, &adapter_id) < 0)
|
||||
return NULL;
|
||||
|
||||
- if (virAsprintf(&path,
|
||||
- "%s/%d:%u:%u:%llu/block",
|
||||
- prefix, adapter_id, bus, target, unit) < 0)
|
||||
+ if (virSCSIDeviceGetType(prefix, adapter_id,
|
||||
+ bus, target, unit, &type) < 0)
|
||||
return NULL;
|
||||
|
||||
- if (virDirOpen(&dir, path) < 0)
|
||||
- goto cleanup;
|
||||
+ switch (type) {
|
||||
+ case VIR_SCSI_DEVICE_TYPE_DISK:
|
||||
+ name = virSCSIDeviceGetDevNameBlock(prefix, adapter_id, bus, target, unit);
|
||||
+ break;
|
||||
|
||||
- while (virDirRead(dir, &entry, path) > 0) {
|
||||
- ignore_value(VIR_STRDUP(name, entry->d_name));
|
||||
+ case VIR_SCSI_DEVICE_TYPE_TAPE:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_PRINTER:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_PROCESSOR:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_WORM:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_ROM:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_SCANNER:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_MOD:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_MEDIUM_CHANGER:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_COMM:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_RAID:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_ENCLOSURE:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_RBC:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_OSD:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_ZBC:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_WLUN:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_NO_LUN:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_NONE:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_LAST:
|
||||
+ default:
|
||||
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
+ _("unsupported SCSI device type: %x"),
|
||||
+ type);
|
||||
break;
|
||||
}
|
||||
|
||||
- cleanup:
|
||||
- VIR_DIR_CLOSE(dir);
|
||||
- VIR_FREE(path);
|
||||
return name;
|
||||
}
|
||||
|
||||
+
|
||||
virSCSIDevicePtr
|
||||
virSCSIDeviceNew(const char *sysfs_prefix,
|
||||
const char *adapter,
|
||||
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
|
||||
--- /dev/null
|
||||
+++ b/tests/virscsidata/0-0-0-0/type
|
||||
@@ -0,0 +1 @@
|
||||
+0
|
||||
diff --git a/tests/virscsidata/1-0-0-0/type b/tests/virscsidata/1-0-0-0/type
|
||||
new file mode 100644
|
||||
index 0000000000..573541ac97
|
||||
--- /dev/null
|
||||
+++ b/tests/virscsidata/1-0-0-0/type
|
||||
@@ -0,0 +1 @@
|
||||
+0
|
||||
--
|
||||
2.25.1
|
||||
|
@ -0,0 +1,148 @@
|
||||
From 6dfdc50564c3d2147f36c4cf6c252cad7a0e9381 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <6dfdc50564c3d2147f36c4cf6c252cad7a0e9381@dist-git>
|
||||
From: Michal Privoznik <mprivozn@redhat.com>
|
||||
Date: Fri, 6 Mar 2020 15:51:46 +0100
|
||||
Subject: [PATCH] RHEL: virscsi: Introduce and use
|
||||
virSCSIDeviceGetUnprivSGIOSysfsPath()
|
||||
|
||||
When constructing a path to the 'unpriv_sgio' file of given SCSI
|
||||
device we don't need to go through /dev/* and major() + minor()
|
||||
path. The generated path points to
|
||||
/sys/dev/block/MAJ:MIN/queue/unpriv_sgio which is wrong if the
|
||||
SCSI device in question is not a block device. We can generate a
|
||||
different path: /sys/bus/scsi/devices/X:X:X:X/unpriv_sgio where
|
||||
the file is directly accessible regardless of the SCSI device
|
||||
type.
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1808388
|
||||
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
|
||||
Message-Id: <20200306145149.1610286-4-abologna@redhat.com>
|
||||
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
---
|
||||
src/libvirt_private.syms | 1 +
|
||||
src/qemu/qemu_conf.c | 19 +++++++++++--------
|
||||
src/util/virscsi.c | 21 +++++++++++++++++++++
|
||||
src/util/virscsi.h | 5 +++++
|
||||
4 files changed, 38 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
|
||||
index 2ad21a68bc..5e1d73c148 100644
|
||||
--- a/src/libvirt_private.syms
|
||||
+++ b/src/libvirt_private.syms
|
||||
@@ -2727,6 +2727,7 @@ virSCSIDeviceGetSgName;
|
||||
virSCSIDeviceGetShareable;
|
||||
virSCSIDeviceGetTarget;
|
||||
virSCSIDeviceGetUnit;
|
||||
+virSCSIDeviceGetUnprivSGIOSysfsPath;
|
||||
virSCSIDeviceIsAvailable;
|
||||
virSCSIDeviceListAdd;
|
||||
virSCSIDeviceListCount;
|
||||
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
|
||||
index a81298326f..5636277888 100644
|
||||
--- a/src/qemu/qemu_conf.c
|
||||
+++ b/src/qemu/qemu_conf.c
|
||||
@@ -1648,7 +1648,6 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
|
||||
virDomainDiskDefPtr disk = NULL;
|
||||
virDomainHostdevDefPtr hostdev = NULL;
|
||||
char *sysfs_path = NULL;
|
||||
- char *hostdev_path = NULL;
|
||||
const char *path = NULL;
|
||||
int val = 0;
|
||||
int ret = -1;
|
||||
@@ -1664,24 +1663,29 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
|
||||
return 0;
|
||||
|
||||
path = virDomainDiskGetSource(disk);
|
||||
+
|
||||
+ if (!(sysfs_path = virGetUnprivSGIOSysfsPath(path, NULL)))
|
||||
+ goto cleanup;
|
||||
+
|
||||
} else if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV) {
|
||||
hostdev = dev->data.hostdev;
|
||||
+ virDomainHostdevSubsysSCSIPtr scsisrc = &hostdev->source.subsys.u.scsi;
|
||||
+ virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host;
|
||||
|
||||
if (hostdev->source.subsys.u.scsi.protocol ==
|
||||
VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI)
|
||||
return 0;
|
||||
|
||||
- if (!(hostdev_path = qemuGetHostdevPath(hostdev)))
|
||||
+ if (!(sysfs_path = virSCSIDeviceGetUnprivSGIOSysfsPath(NULL,
|
||||
+ scsihostsrc->adapter,
|
||||
+ scsihostsrc->bus,
|
||||
+ scsihostsrc->target,
|
||||
+ scsihostsrc->unit)))
|
||||
goto cleanup;
|
||||
-
|
||||
- path = hostdev_path;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
- if (!(sysfs_path = virGetUnprivSGIOSysfsPath(path, NULL)))
|
||||
- goto cleanup;
|
||||
-
|
||||
/* 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)
|
||||
@@ -1705,7 +1709,6 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
- VIR_FREE(hostdev_path);
|
||||
VIR_FREE(sysfs_path);
|
||||
return ret;
|
||||
}
|
||||
diff --git a/src/util/virscsi.c b/src/util/virscsi.c
|
||||
index 6c3fd8a562..5aab43fc88 100644
|
||||
--- a/src/util/virscsi.c
|
||||
+++ b/src/util/virscsi.c
|
||||
@@ -342,6 +342,27 @@ virSCSIDeviceGetDevName(const char *sysfs_prefix,
|
||||
}
|
||||
|
||||
|
||||
+char *
|
||||
+virSCSIDeviceGetUnprivSGIOSysfsPath(const char *sysfs_prefix,
|
||||
+ const char *adapter,
|
||||
+ unsigned int bus,
|
||||
+ unsigned int target,
|
||||
+ unsigned long long unit)
|
||||
+{
|
||||
+ char *path = NULL;
|
||||
+ unsigned int adapter_id;
|
||||
+ const char *prefix = sysfs_prefix ? sysfs_prefix : SYSFS_SCSI_DEVICES;
|
||||
+
|
||||
+ if (virSCSIDeviceGetAdapterId(adapter, &adapter_id) < 0)
|
||||
+ return NULL;
|
||||
+
|
||||
+ ignore_value(virAsprintf(&path,
|
||||
+ "%s/%d:%u:%u:%llu/unpriv_sgio",
|
||||
+ prefix, adapter_id, bus, target, unit));
|
||||
+ return path;
|
||||
+}
|
||||
+
|
||||
+
|
||||
virSCSIDevicePtr
|
||||
virSCSIDeviceNew(const char *sysfs_prefix,
|
||||
const char *adapter,
|
||||
diff --git a/src/util/virscsi.h b/src/util/virscsi.h
|
||||
index 9f8b3ecf1e..5dea2a9f5d 100644
|
||||
--- a/src/util/virscsi.h
|
||||
+++ b/src/util/virscsi.h
|
||||
@@ -43,6 +43,11 @@ char *virSCSIDeviceGetDevName(const char *sysfs_prefix,
|
||||
unsigned int bus,
|
||||
unsigned int target,
|
||||
unsigned long long unit);
|
||||
+char *virSCSIDeviceGetUnprivSGIOSysfsPath(const char *sysfs_prefix,
|
||||
+ const char *adapter,
|
||||
+ unsigned int bus,
|
||||
+ unsigned int target,
|
||||
+ unsigned long long unit);
|
||||
|
||||
virSCSIDevicePtr virSCSIDeviceNew(const char *sysfs_prefix,
|
||||
const char *adapter,
|
||||
--
|
||||
2.25.1
|
||||
|
@ -0,0 +1,219 @@
|
||||
From 41480c7a787cc776e64d2ab7b737c3e8d6a84bd2 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <41480c7a787cc776e64d2ab7b737c3e8d6a84bd2@dist-git>
|
||||
From: Michal Privoznik <mprivozn@redhat.com>
|
||||
Date: Fri, 6 Mar 2020 15:51:45 +0100
|
||||
Subject: [PATCH] RHEL: virscsi: Support TAPEs in virSCSIDeviceGetDevName()
|
||||
|
||||
If the SCSI device we want to get /dev node name for is TAPE
|
||||
device we need to look at 'tape' symlink in the sysfs dir
|
||||
corresponding to the device.
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1808388
|
||||
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
|
||||
Message-Id: <20200306145149.1610286-3-abologna@redhat.com>
|
||||
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
---
|
||||
src/util/virscsi.c | 37 ++++++++++++++++++++
|
||||
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 +
|
||||
tests/virscsidata/2-0-0-0/tape | 1 +
|
||||
tests/virscsidata/2-0-0-0/type | 1 +
|
||||
tests/virscsidata/2-0-0-0/vendor | 1 +
|
||||
tests/virscsidata/sg3 | 0
|
||||
tests/virscsitest.c | 38 ++++++++++++++++++---
|
||||
9 files changed, 76 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
|
||||
create mode 120000 tests/virscsidata/2-0-0-0/tape
|
||||
create mode 100644 tests/virscsidata/2-0-0-0/type
|
||||
create mode 100644 tests/virscsidata/2-0-0-0/vendor
|
||||
create mode 100644 tests/virscsidata/sg3
|
||||
|
||||
diff --git a/src/util/virscsi.c b/src/util/virscsi.c
|
||||
index af908107d9..6c3fd8a562 100644
|
||||
--- a/src/util/virscsi.c
|
||||
+++ b/src/util/virscsi.c
|
||||
@@ -42,6 +42,7 @@
|
||||
#include "virutil.h"
|
||||
#include "virstring.h"
|
||||
#include "virerror.h"
|
||||
+#include "dirname.h"
|
||||
|
||||
#define SYSFS_SCSI_DEVICES "/sys/bus/scsi/devices"
|
||||
|
||||
@@ -249,6 +250,39 @@ virSCSIDeviceGetDevNameBlock(const char *prefix,
|
||||
}
|
||||
|
||||
|
||||
+static char *
|
||||
+virSCSIDeviceGetDevNameTape(const char *prefix,
|
||||
+ unsigned int adapter,
|
||||
+ unsigned int bus,
|
||||
+ unsigned int target,
|
||||
+ unsigned long long unit)
|
||||
+{
|
||||
+ char *path = NULL;
|
||||
+ char *resolvedPath = NULL;
|
||||
+ char *name = NULL;
|
||||
+
|
||||
+ if (virAsprintf(&path,
|
||||
+ "%s/%d:%u:%u:%llu/tape",
|
||||
+ prefix, adapter, bus, target, unit) < 0)
|
||||
+ return NULL;
|
||||
+
|
||||
+ if (virFileReadLink(path, &resolvedPath) < 0) {
|
||||
+ virReportSystemError(errno,
|
||||
+ _("Unable to read link: %s"),
|
||||
+ path);
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+
|
||||
+ if (VIR_STRDUP(name, last_component(resolvedPath)) < 0)
|
||||
+ goto cleanup;
|
||||
+
|
||||
+ cleanup:
|
||||
+ VIR_FREE(resolvedPath);
|
||||
+ VIR_FREE(path);
|
||||
+ return name;
|
||||
+}
|
||||
+
|
||||
+
|
||||
/* Returns device name (e.g. "sdc") on success, or NULL
|
||||
* on failure.
|
||||
*/
|
||||
@@ -277,6 +311,9 @@ virSCSIDeviceGetDevName(const char *sysfs_prefix,
|
||||
break;
|
||||
|
||||
case VIR_SCSI_DEVICE_TYPE_TAPE:
|
||||
+ name = virSCSIDeviceGetDevNameTape(prefix, adapter_id, bus, target, unit);
|
||||
+ break;
|
||||
+
|
||||
case VIR_SCSI_DEVICE_TYPE_PRINTER:
|
||||
case VIR_SCSI_DEVICE_TYPE_PROCESSOR:
|
||||
case VIR_SCSI_DEVICE_TYPE_WORM:
|
||||
diff --git a/tests/virscsidata/2-0-0-0/model b/tests/virscsidata/2-0-0-0/model
|
||||
new file mode 100644
|
||||
index 0000000000..d2ab4715c3
|
||||
--- /dev/null
|
||||
+++ b/tests/virscsidata/2-0-0-0/model
|
||||
@@ -0,0 +1 @@
|
||||
+scsi_debug
|
||||
diff --git a/tests/virscsidata/2-0-0-0/scsi_tape/st0/dev b/tests/virscsidata/2-0-0-0/scsi_tape/st0/dev
|
||||
new file mode 100644
|
||||
index 0000000000..3dd777e840
|
||||
--- /dev/null
|
||||
+++ b/tests/virscsidata/2-0-0-0/scsi_tape/st0/dev
|
||||
@@ -0,0 +1 @@
|
||||
+9:0
|
||||
diff --git a/tests/virscsidata/2-0-0-0/sg3/dev b/tests/virscsidata/2-0-0-0/sg3/dev
|
||||
new file mode 100644
|
||||
index 0000000000..b369a59b3e
|
||||
--- /dev/null
|
||||
+++ b/tests/virscsidata/2-0-0-0/sg3/dev
|
||||
@@ -0,0 +1 @@
|
||||
+21:3
|
||||
diff --git a/tests/virscsidata/2-0-0-0/tape b/tests/virscsidata/2-0-0-0/tape
|
||||
new file mode 120000
|
||||
index 0000000000..6ca7f77539
|
||||
--- /dev/null
|
||||
+++ b/tests/virscsidata/2-0-0-0/tape
|
||||
@@ -0,0 +1 @@
|
||||
+scsi_tape/st0
|
||||
\ No newline at end of file
|
||||
diff --git a/tests/virscsidata/2-0-0-0/type b/tests/virscsidata/2-0-0-0/type
|
||||
new file mode 100644
|
||||
index 0000000000..d00491fd7e
|
||||
--- /dev/null
|
||||
+++ b/tests/virscsidata/2-0-0-0/type
|
||||
@@ -0,0 +1 @@
|
||||
+1
|
||||
diff --git a/tests/virscsidata/2-0-0-0/vendor b/tests/virscsidata/2-0-0-0/vendor
|
||||
new file mode 100644
|
||||
index 0000000000..9b075671ea
|
||||
--- /dev/null
|
||||
+++ b/tests/virscsidata/2-0-0-0/vendor
|
||||
@@ -0,0 +1 @@
|
||||
+Linux
|
||||
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 1215adbfab..880fa22ca8 100644
|
||||
--- a/tests/virscsitest.c
|
||||
+++ b/tests/virscsitest.c
|
||||
@@ -36,18 +36,34 @@ VIR_LOG_INIT("tests.scsitest");
|
||||
static const char *abs_top_srcdir;
|
||||
static char *virscsi_prefix;
|
||||
|
||||
+typedef struct {
|
||||
+ const char *adapter;
|
||||
+ unsigned int bus;
|
||||
+ unsigned int target;
|
||||
+ unsigned int unit;
|
||||
+ const char *expectedName;
|
||||
+} testGetDevNameData;
|
||||
+
|
||||
static int
|
||||
-test1(const void *data ATTRIBUTE_UNUSED)
|
||||
+testGetDevName(const void *opaque)
|
||||
{
|
||||
+ const testGetDevNameData *data = opaque;
|
||||
char *name = NULL;
|
||||
int ret = -1;
|
||||
|
||||
if (!(name = virSCSIDeviceGetDevName(virscsi_prefix,
|
||||
- "scsi_host1", 0, 0, 0)))
|
||||
+ data->adapter,
|
||||
+ data->bus,
|
||||
+ data->target,
|
||||
+ data->unit)))
|
||||
return -1;
|
||||
|
||||
- if (STRNEQ(name, "sdh"))
|
||||
+ if (STRNEQ(name, data->expectedName)) {
|
||||
+ fprintf(stderr,
|
||||
+ "SCSI dev name mismatch, expected %s got %s",
|
||||
+ data->expectedName, name);
|
||||
goto cleanup;
|
||||
+ }
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
@@ -225,7 +241,9 @@ mymain(void)
|
||||
|
||||
CREATE_SYMLINK("0-0-0-0", "0:0:0:0");
|
||||
CREATE_SYMLINK("1-0-0-0", "1:0:0:0");
|
||||
+ CREATE_SYMLINK("2-0-0-0", "2:0:0:0");
|
||||
CREATE_SYMLINK("sg0", "sg0");
|
||||
+ CREATE_SYMLINK("sg3", "sg3");
|
||||
CREATE_SYMLINK("sg8", "sg8");
|
||||
|
||||
VIR_FREE(virscsi_prefix);
|
||||
@@ -235,8 +253,18 @@ mymain(void)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
- if (virTestRun("test1", test1, NULL) < 0)
|
||||
- ret = -1;
|
||||
+#define TEST_GET_DEV_NAME(adapter, bus, target, unit, expectedName) \
|
||||
+ do { \
|
||||
+ testGetDevNameData data = {adapter, bus, target, unit, expectedName}; \
|
||||
+ if (virTestRun("test getDevname " expectedName, \
|
||||
+ testGetDevName, &data) < 0) \
|
||||
+ ret = -1; \
|
||||
+ } while (0)
|
||||
+
|
||||
+ TEST_GET_DEV_NAME("scsi_host0", 0, 0, 0, "sda");
|
||||
+ TEST_GET_DEV_NAME("scsi_host1", 0, 0, 0, "sdh");
|
||||
+ TEST_GET_DEV_NAME("scsi_host2", 0, 0, 0, "st0");
|
||||
+
|
||||
if (virTestRun("test2", test2, NULL) < 0)
|
||||
ret = -1;
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
@ -0,0 +1,37 @@
|
||||
From f4d9b6252bd2b2b5a3c70a3869ce49a3a9e1a9cc Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <f4d9b6252bd2b2b5a3c70a3869ce49a3a9e1a9cc@dist-git>
|
||||
From: Michal Privoznik <mprivozn@redhat.com>
|
||||
Date: Fri, 6 Mar 2020 15:51:47 +0100
|
||||
Subject: [PATCH] RHEL: virutil: Accept non-block devices in virGetDeviceID()
|
||||
|
||||
If a caller wants to learn major or minor number for a device,
|
||||
let them. There's no need to check if the device is a block
|
||||
device here.
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1808388
|
||||
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
|
||||
Message-Id: <20200306145149.1610286-5-abologna@redhat.com>
|
||||
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
---
|
||||
src/util/virutil.c | 3 ---
|
||||
1 file changed, 3 deletions(-)
|
||||
|
||||
diff --git a/src/util/virutil.c b/src/util/virutil.c
|
||||
index cd67f54bc2..2448eba073 100644
|
||||
--- a/src/util/virutil.c
|
||||
+++ b/src/util/virutil.c
|
||||
@@ -1693,9 +1693,6 @@ virGetDeviceID(const char *path, int *maj, int *min)
|
||||
if (stat(path, &sb) < 0)
|
||||
return -errno;
|
||||
|
||||
- if (!S_ISBLK(sb.st_mode))
|
||||
- return -EINVAL;
|
||||
-
|
||||
if (maj)
|
||||
*maj = major(sb.st_rdev);
|
||||
if (min)
|
||||
--
|
||||
2.25.1
|
||||
|
@ -0,0 +1,84 @@
|
||||
From 195908ad66fc52643d94eca0f45e5740f25e3e78 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <195908ad66fc52643d94eca0f45e5740f25e3e78@dist-git>
|
||||
From: Laine Stump <laine@laine.org>
|
||||
Date: Fri, 1 Feb 2019 20:29:26 -0500
|
||||
Subject: [PATCH] Revert "RHEL: network: regain guest network connectivity
|
||||
after firewalld switch to nftables"
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This reverts commit 54e270d7fb68b41002654374d395e4f260a24add.
|
||||
|
||||
This patch appeared in libvirt-4.5.0-11.el8 (RHEL git commit id
|
||||
2fb53957). It was a downstream-only temporary fix to the networking
|
||||
issues resulting from firewalld's switch to using nftables. Now that
|
||||
there is a permanent fix upstream we can revert this patch and use the
|
||||
upstream patches instead.
|
||||
|
||||
https://bugzilla.redhat.com/1650320
|
||||
|
||||
Signed-off-by: Laine Stump <laine@laine.org>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
libvirt.spec.in | 14 --------------
|
||||
src/network/Makefile.inc.am | 10 +---------
|
||||
src/network/libvirt.zone | 15 ---------------
|
||||
3 files changed, 1 insertion(+), 38 deletions(-)
|
||||
delete mode 100644 src/network/libvirt.zone
|
||||
|
||||
diff --git a/src/network/Makefile.inc.am b/src/network/Makefile.inc.am
|
||||
index 20d899e699..508c8c0422 100644
|
||||
--- a/src/network/Makefile.inc.am
|
||||
+++ b/src/network/Makefile.inc.am
|
||||
@@ -87,11 +87,6 @@ install-data-network:
|
||||
( cd $(DESTDIR)$(confdir)/qemu/networks/autostart && \
|
||||
rm -f default.xml && \
|
||||
$(LN_S) ../default.xml default.xml )
|
||||
-if HAVE_FIREWALLD
|
||||
- $(MKDIR_P) "$(DESTDIR)$(prefix)/lib/firewalld/zones"
|
||||
- $(INSTALL_DATA) $(srcdir)/network/libvirt.zone \
|
||||
- $(DESTDIR)$(prefix)/lib/firewalld/zones/libvirt.xml
|
||||
-endif HAVE_FIREWALLD
|
||||
|
||||
uninstall-data-network:
|
||||
rm -f $(DESTDIR)$(confdir)/qemu/networks/autostart/default.xml
|
||||
@@ -100,13 +95,10 @@ uninstall-data-network:
|
||||
rmdir "$(DESTDIR)$(confdir)/qemu/networks" || :
|
||||
rmdir "$(DESTDIR)$(localstatedir)/lib/libvirt/network" ||:
|
||||
rmdir "$(DESTDIR)$(localstatedir)/run/libvirt/network" ||:
|
||||
-if HAVE_FIREWALLD
|
||||
- rm -f $(DESTDIR)$(prefix)/lib/firewalld/zones/libvirt.xml
|
||||
-endif HAVE_FIREWALLD
|
||||
|
||||
endif WITH_NETWORK
|
||||
|
||||
-EXTRA_DIST += network/default.xml network/libvirt.zone
|
||||
+EXTRA_DIST += network/default.xml
|
||||
|
||||
.PHONY: \
|
||||
install-data-network \
|
||||
diff --git a/src/network/libvirt.zone b/src/network/libvirt.zone
|
||||
deleted file mode 100644
|
||||
index 355a70b4da..0000000000
|
||||
--- a/src/network/libvirt.zone
|
||||
+++ /dev/null
|
||||
@@ -1,15 +0,0 @@
|
||||
-<?xml version="1.0" encoding="utf-8"?>
|
||||
-<zone target="ACCEPT">
|
||||
- <short>libvirt</short>
|
||||
- <description>All network connections are accepted. This also permits packets to/from interfaces in the zone to be forwarded. This zone is intended to be used only by libvirt virtual networks.</description>
|
||||
- <interface name="virbr0"/>
|
||||
- <interface name="virbr1"/>
|
||||
- <interface name="virbr2"/>
|
||||
- <interface name="virbr3"/>
|
||||
- <interface name="virbr4"/>
|
||||
- <interface name="virbr5"/>
|
||||
- <interface name="virbr6"/>
|
||||
- <interface name="virbr7"/>
|
||||
- <interface name="virbr8"/>
|
||||
- <interface name="virbr9"/>
|
||||
-</zone>
|
||||
--
|
||||
2.20.1
|
||||
|
@ -0,0 +1,93 @@
|
||||
From 8069bb50b2548acd3f2176499ede205e6099c067 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <8069bb50b2548acd3f2176499ede205e6099c067@dist-git>
|
||||
From: Michal Privoznik <mprivozn@redhat.com>
|
||||
Date: Thu, 27 Jun 2019 15:18:17 +0200
|
||||
Subject: [PATCH] Revert "Separate out StateAutoStart from StateInitialize"
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This reverts commit e4a969092bda5b3b952963fdf6658895165040b7.
|
||||
|
||||
Now that drivers may call virConnectOpen() on secondary drivers, it
|
||||
doesn't make much sense to have autostart separated from driver
|
||||
initialization callback. In fact, it creates a problem because one
|
||||
driver during its initialization might try to fetch an object from
|
||||
another driver but since the object is yet to be autostarted the fetch
|
||||
fails. This has been observed in reality: qemu driver performs
|
||||
qemuProcessReconnect() during qemu's stateInitialize phase which may
|
||||
call virDomainDiskTranslateSourcePool() which connects to the storage
|
||||
driver to look up the volume. But the storage driver did not autostart
|
||||
its pools yet therefore volume lookup fails and the domain is killed.
|
||||
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit 07a9c8bae8b80ef1650e6d05869cbf55c6aea837)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1685151
|
||||
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Message-Id: <4ed5f8f4edd0053cc14f4bb579a945b606b36f5a.1561641375.git.mprivozn@redhat.com>
|
||||
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
---
|
||||
src/driver-state.h | 4 ----
|
||||
src/libvirt.c | 14 +-------------
|
||||
2 files changed, 1 insertion(+), 17 deletions(-)
|
||||
|
||||
diff --git a/src/driver-state.h b/src/driver-state.h
|
||||
index 1cb3e4faf3..e1e060bcc5 100644
|
||||
--- a/src/driver-state.h
|
||||
+++ b/src/driver-state.h
|
||||
@@ -30,9 +30,6 @@ typedef int
|
||||
virStateInhibitCallback callback,
|
||||
void *opaque);
|
||||
|
||||
-typedef void
|
||||
-(*virDrvStateAutoStart)(void);
|
||||
-
|
||||
typedef int
|
||||
(*virDrvStateCleanup)(void);
|
||||
|
||||
@@ -48,7 +45,6 @@ typedef virStateDriver *virStateDriverPtr;
|
||||
struct _virStateDriver {
|
||||
const char *name;
|
||||
virDrvStateInitialize stateInitialize;
|
||||
- virDrvStateAutoStart stateAutoStart;
|
||||
virDrvStateCleanup stateCleanup;
|
||||
virDrvStateReload stateReload;
|
||||
virDrvStateStop stateStop;
|
||||
diff --git a/src/libvirt.c b/src/libvirt.c
|
||||
index 52f4dd2808..c9e5f47fd4 100644
|
||||
--- a/src/libvirt.c
|
||||
+++ b/src/libvirt.c
|
||||
@@ -637,11 +637,7 @@ virRegisterStateDriver(virStateDriverPtr driver)
|
||||
* @callback: callback to invoke to inhibit shutdown of the daemon
|
||||
* @opaque: data to pass to @callback
|
||||
*
|
||||
- * Initialize all virtualization drivers. Accomplished in two phases,
|
||||
- * the first being state and structure initialization followed by any
|
||||
- * auto start supported by the driver. This is done to ensure dependencies
|
||||
- * that some drivers may have on another driver having been initialized
|
||||
- * will exist, such as the storage driver's need to use the secret driver.
|
||||
+ * Initialize all virtualization drivers.
|
||||
*
|
||||
* Returns 0 if all succeed, -1 upon any failure.
|
||||
*/
|
||||
@@ -669,14 +665,6 @@ virStateInitialize(bool privileged,
|
||||
}
|
||||
}
|
||||
}
|
||||
-
|
||||
- for (i = 0; i < virStateDriverTabCount; i++) {
|
||||
- if (virStateDriverTab[i]->stateAutoStart) {
|
||||
- VIR_DEBUG("Running global auto start for %s state driver",
|
||||
- virStateDriverTab[i]->name);
|
||||
- virStateDriverTab[i]->stateAutoStart();
|
||||
- }
|
||||
- }
|
||||
return 0;
|
||||
}
|
||||
|
||||
--
|
||||
2.22.0
|
||||
|
@ -0,0 +1,163 @@
|
||||
From 6af885a53e425b88c7d9c123f64bbc4f8517b8a8 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <6af885a53e425b88c7d9c123f64bbc4f8517b8a8@dist-git>
|
||||
From: John Ferlan <jferlan@redhat.com>
|
||||
Date: Thu, 15 Nov 2018 06:43:58 -0500
|
||||
Subject: [PATCH] Revert "access: Modify the VIR_ERR_ACCESS_DENIED to include
|
||||
driverName"
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1631608 (RHEL8)
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1631606 (RHEL7)
|
||||
|
||||
This reverts commit ccc72d5cbdd85f66cb737134b3be40aac1df03ef.
|
||||
|
||||
Based on upstream comment to a follow-up patch, this didn't take the
|
||||
right approach and the right thing to do is revert and rework.
|
||||
|
||||
Signed-off-by: John Ferlan <jferlan@redhat.com>
|
||||
(cherry picked from commit b08396a5feab02fb3bb595603c888ee733aa178e)
|
||||
Reviewed-by: Erik Skultety <eskultet@redhat.com>
|
||||
---
|
||||
src/access/viraccessmanager.c | 25 ++++++++++++-------------
|
||||
src/rpc/gendispatch.pl | 2 +-
|
||||
src/util/virerror.c | 4 ++--
|
||||
3 files changed, 15 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/src/access/viraccessmanager.c b/src/access/viraccessmanager.c
|
||||
index 1dfff32b9d..e7b5bf38da 100644
|
||||
--- a/src/access/viraccessmanager.c
|
||||
+++ b/src/access/viraccessmanager.c
|
||||
@@ -196,12 +196,11 @@ static void virAccessManagerDispose(void *object)
|
||||
* should the admin need to debug things
|
||||
*/
|
||||
static int
|
||||
-virAccessManagerSanitizeError(int ret,
|
||||
- const char *driverName)
|
||||
+virAccessManagerSanitizeError(int ret)
|
||||
{
|
||||
if (ret < 0) {
|
||||
virResetLastError();
|
||||
- virAccessError(VIR_ERR_ACCESS_DENIED, driverName, NULL);
|
||||
+ virAccessError(VIR_ERR_ACCESS_DENIED, NULL);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -218,7 +217,7 @@ int virAccessManagerCheckConnect(virAccessManagerPtr manager,
|
||||
if (manager->drv->checkConnect)
|
||||
ret = manager->drv->checkConnect(manager, driverName, perm);
|
||||
|
||||
- return virAccessManagerSanitizeError(ret, driverName);
|
||||
+ return virAccessManagerSanitizeError(ret);
|
||||
}
|
||||
|
||||
|
||||
@@ -234,7 +233,7 @@ int virAccessManagerCheckDomain(virAccessManagerPtr manager,
|
||||
if (manager->drv->checkDomain)
|
||||
ret = manager->drv->checkDomain(manager, driverName, domain, perm);
|
||||
|
||||
- return virAccessManagerSanitizeError(ret, driverName);
|
||||
+ return virAccessManagerSanitizeError(ret);
|
||||
}
|
||||
|
||||
int virAccessManagerCheckInterface(virAccessManagerPtr manager,
|
||||
@@ -249,7 +248,7 @@ int virAccessManagerCheckInterface(virAccessManagerPtr manager,
|
||||
if (manager->drv->checkInterface)
|
||||
ret = manager->drv->checkInterface(manager, driverName, iface, perm);
|
||||
|
||||
- return virAccessManagerSanitizeError(ret, driverName);
|
||||
+ return virAccessManagerSanitizeError(ret);
|
||||
}
|
||||
|
||||
int virAccessManagerCheckNetwork(virAccessManagerPtr manager,
|
||||
@@ -264,7 +263,7 @@ int virAccessManagerCheckNetwork(virAccessManagerPtr manager,
|
||||
if (manager->drv->checkNetwork)
|
||||
ret = manager->drv->checkNetwork(manager, driverName, network, perm);
|
||||
|
||||
- return virAccessManagerSanitizeError(ret, driverName);
|
||||
+ return virAccessManagerSanitizeError(ret);
|
||||
}
|
||||
|
||||
int virAccessManagerCheckNodeDevice(virAccessManagerPtr manager,
|
||||
@@ -279,7 +278,7 @@ int virAccessManagerCheckNodeDevice(virAccessManagerPtr manager,
|
||||
if (manager->drv->checkNodeDevice)
|
||||
ret = manager->drv->checkNodeDevice(manager, driverName, nodedev, perm);
|
||||
|
||||
- return virAccessManagerSanitizeError(ret, driverName);
|
||||
+ return virAccessManagerSanitizeError(ret);
|
||||
}
|
||||
|
||||
int virAccessManagerCheckNWFilter(virAccessManagerPtr manager,
|
||||
@@ -294,7 +293,7 @@ int virAccessManagerCheckNWFilter(virAccessManagerPtr manager,
|
||||
if (manager->drv->checkNWFilter)
|
||||
ret = manager->drv->checkNWFilter(manager, driverName, nwfilter, perm);
|
||||
|
||||
- return virAccessManagerSanitizeError(ret, driverName);
|
||||
+ return virAccessManagerSanitizeError(ret);
|
||||
}
|
||||
|
||||
int virAccessManagerCheckNWFilterBinding(virAccessManagerPtr manager,
|
||||
@@ -309,7 +308,7 @@ int virAccessManagerCheckNWFilterBinding(virAccessManagerPtr manager,
|
||||
if (manager->drv->checkNWFilterBinding)
|
||||
ret = manager->drv->checkNWFilterBinding(manager, driverName, binding, perm);
|
||||
|
||||
- return virAccessManagerSanitizeError(ret, driverName);
|
||||
+ return virAccessManagerSanitizeError(ret);
|
||||
}
|
||||
|
||||
int virAccessManagerCheckSecret(virAccessManagerPtr manager,
|
||||
@@ -324,7 +323,7 @@ int virAccessManagerCheckSecret(virAccessManagerPtr manager,
|
||||
if (manager->drv->checkSecret)
|
||||
ret = manager->drv->checkSecret(manager, driverName, secret, perm);
|
||||
|
||||
- return virAccessManagerSanitizeError(ret, driverName);
|
||||
+ return virAccessManagerSanitizeError(ret);
|
||||
}
|
||||
|
||||
int virAccessManagerCheckStoragePool(virAccessManagerPtr manager,
|
||||
@@ -339,7 +338,7 @@ int virAccessManagerCheckStoragePool(virAccessManagerPtr manager,
|
||||
if (manager->drv->checkStoragePool)
|
||||
ret = manager->drv->checkStoragePool(manager, driverName, pool, perm);
|
||||
|
||||
- return virAccessManagerSanitizeError(ret, driverName);
|
||||
+ return virAccessManagerSanitizeError(ret);
|
||||
}
|
||||
|
||||
int virAccessManagerCheckStorageVol(virAccessManagerPtr manager,
|
||||
@@ -355,5 +354,5 @@ int virAccessManagerCheckStorageVol(virAccessManagerPtr manager,
|
||||
if (manager->drv->checkStorageVol)
|
||||
ret = manager->drv->checkStorageVol(manager, driverName, pool, vol, perm);
|
||||
|
||||
- return virAccessManagerSanitizeError(ret, driverName);
|
||||
+ return virAccessManagerSanitizeError(ret);
|
||||
}
|
||||
diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl
|
||||
index f599002056..0c4648c0fb 100755
|
||||
--- a/src/rpc/gendispatch.pl
|
||||
+++ b/src/rpc/gendispatch.pl
|
||||
@@ -2199,7 +2199,7 @@ elsif ($mode eq "client") {
|
||||
print " virObjectUnref(mgr);\n";
|
||||
if ($action eq "Ensure") {
|
||||
print " if (rv == 0)\n";
|
||||
- print " virReportError(VIR_ERR_ACCESS_DENIED, conn->driver->name, NULL);\n";
|
||||
+ print " virReportError(VIR_ERR_ACCESS_DENIED, NULL);\n";
|
||||
print " return $fail;\n";
|
||||
} else {
|
||||
print " virResetLastError();\n";
|
||||
diff --git a/src/util/virerror.c b/src/util/virerror.c
|
||||
index 5f50fa0349..f198f27957 100644
|
||||
--- a/src/util/virerror.c
|
||||
+++ b/src/util/virerror.c
|
||||
@@ -1439,9 +1439,9 @@ virErrorMsg(virErrorNumber error, const char *info)
|
||||
break;
|
||||
case VIR_ERR_ACCESS_DENIED:
|
||||
if (info == NULL)
|
||||
- errmsg = _("access denied from '%s'");
|
||||
+ errmsg = _("access denied");
|
||||
else
|
||||
- errmsg = _("access denied from '%s': %s");
|
||||
+ errmsg = _("access denied: %s");
|
||||
break;
|
||||
case VIR_ERR_DBUS_SERVICE:
|
||||
if (info == NULL)
|
||||
--
|
||||
2.19.2
|
||||
|
@ -0,0 +1,108 @@
|
||||
From 2395bf301cf76ffa863a3c2e125d52345cfbf6b5 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <2395bf301cf76ffa863a3c2e125d52345cfbf6b5@dist-git>
|
||||
From: Pavel Hrdina <phrdina@redhat.com>
|
||||
Date: Mon, 1 Jul 2019 17:08:23 +0200
|
||||
Subject: [PATCH] Revert "util: vircgroup: pass parent cgroup into
|
||||
virCgroupDetectControllersCB"
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This reverts commit 7bca1c9bdc85247446129f856e27c80a32819e17.
|
||||
|
||||
As it turns out it's not a good idea on systemd hosts. The root
|
||||
cgroup can have all controllers enabled but they don't have to be
|
||||
enabled for sub-cgroups.
|
||||
|
||||
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit d117431143d5b6dcfc8fae4a6b3fae23881d0937)
|
||||
|
||||
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1689297
|
||||
|
||||
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
|
||||
Message-Id: <754b0ac5a0f1bd21e79eaeb71f6d2ab811446168.1561993100.git.phrdina@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
src/util/vircgroup.c | 2 +-
|
||||
src/util/vircgroupbackend.h | 3 +--
|
||||
src/util/vircgroupv1.c | 3 +--
|
||||
src/util/vircgroupv2.c | 17 ++++++-----------
|
||||
4 files changed, 9 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
|
||||
index ff2a0b75b5..a7fb595bce 100644
|
||||
--- a/src/util/vircgroup.c
|
||||
+++ b/src/util/vircgroup.c
|
||||
@@ -412,7 +412,7 @@ virCgroupDetect(virCgroupPtr group,
|
||||
|
||||
for (i = 0; i < VIR_CGROUP_BACKEND_TYPE_LAST; i++) {
|
||||
if (group->backends[i]) {
|
||||
- int rc = group->backends[i]->detectControllers(group, controllers, parent);
|
||||
+ int rc = group->backends[i]->detectControllers(group, controllers);
|
||||
if (rc < 0)
|
||||
return -1;
|
||||
controllersAvailable |= rc;
|
||||
diff --git a/src/util/vircgroupbackend.h b/src/util/vircgroupbackend.h
|
||||
index 05af118ec1..a825dc4be7 100644
|
||||
--- a/src/util/vircgroupbackend.h
|
||||
+++ b/src/util/vircgroupbackend.h
|
||||
@@ -96,8 +96,7 @@ typedef char *
|
||||
|
||||
typedef int
|
||||
(*virCgroupDetectControllersCB)(virCgroupPtr group,
|
||||
- int controllers,
|
||||
- virCgroupPtr parent);
|
||||
+ int controllers);
|
||||
|
||||
typedef bool
|
||||
(*virCgroupHasControllerCB)(virCgroupPtr cgroup,
|
||||
diff --git a/src/util/vircgroupv1.c b/src/util/vircgroupv1.c
|
||||
index 5b218c7f78..58bd20d636 100644
|
||||
--- a/src/util/vircgroupv1.c
|
||||
+++ b/src/util/vircgroupv1.c
|
||||
@@ -419,8 +419,7 @@ virCgroupV1StealPlacement(virCgroupPtr group)
|
||||
|
||||
static int
|
||||
virCgroupV1DetectControllers(virCgroupPtr group,
|
||||
- int controllers,
|
||||
- virCgroupPtr parent ATTRIBUTE_UNUSED)
|
||||
+ int controllers)
|
||||
{
|
||||
size_t i;
|
||||
size_t j;
|
||||
diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c
|
||||
index bdeab397a3..b0ed889cc8 100644
|
||||
--- a/src/util/vircgroupv2.c
|
||||
+++ b/src/util/vircgroupv2.c
|
||||
@@ -285,21 +285,16 @@ virCgroupV2ParseControllersFile(virCgroupPtr group)
|
||||
|
||||
static int
|
||||
virCgroupV2DetectControllers(virCgroupPtr group,
|
||||
- int controllers,
|
||||
- virCgroupPtr parent)
|
||||
+ int controllers)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
- if (parent) {
|
||||
- group->unified.controllers = parent->unified.controllers;
|
||||
- } else {
|
||||
- if (virCgroupV2ParseControllersFile(group) < 0)
|
||||
- return -1;
|
||||
+ if (virCgroupV2ParseControllersFile(group) < 0)
|
||||
+ return -1;
|
||||
|
||||
- /* In cgroup v2 there is no cpuacct controller, the cpu.stat file always
|
||||
- * exists with usage stats. */
|
||||
- group->unified.controllers |= 1 << VIR_CGROUP_CONTROLLER_CPUACCT;
|
||||
- }
|
||||
+ /* In cgroup v2 there is no cpuacct controller, the cpu.stat file always
|
||||
+ * exists with usage stats. */
|
||||
+ group->unified.controllers |= 1 << VIR_CGROUP_CONTROLLER_CPUACCT;
|
||||
|
||||
if (controllers >= 0)
|
||||
group->unified.controllers &= controllers;
|
||||
--
|
||||
2.22.0
|
||||
|
@ -0,0 +1,295 @@
|
||||
From 799c9dd37390878a54be303b3e3e27445049bf2b Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <799c9dd37390878a54be303b3e3e27445049bf2b@dist-git>
|
||||
From: Michal Privoznik <mprivozn@redhat.com>
|
||||
Date: Thu, 27 Jun 2019 15:18:16 +0200
|
||||
Subject: [PATCH] Revert "virStateDriver - Separate AutoStart from Initialize"
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This reverts commit cefb97fb815c81fc882da752f45effd23bcb9b4b.
|
||||
|
||||
The stateAutoStart callback will be removed in the next commit.
|
||||
Therefore move autostarting of domains, networks and storage
|
||||
pools back into stateInitialize callbacks.
|
||||
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit fc380c2e018ae15347d4c281a7e74896c48cac4a)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1685151
|
||||
|
||||
The difference to the upstream commit is uml driver change. In
|
||||
upstream, the uml driver was dropped, but it's still kept around
|
||||
in downstream.
|
||||
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Message-Id: <a8e69f65b397c81c2a68597cca6c8ac04df24153.1561641375.git.mprivozn@redhat.com>
|
||||
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
---
|
||||
src/libxl/libxl_driver.c | 14 +++-----------
|
||||
src/lxc/lxc_driver.c | 16 ++--------------
|
||||
src/network/bridge_driver.c | 22 ++++------------------
|
||||
src/qemu/qemu_driver.c | 17 ++---------------
|
||||
src/storage/storage_driver.c | 19 ++-----------------
|
||||
src/uml/uml_driver.c | 17 ++---------------
|
||||
6 files changed, 15 insertions(+), 90 deletions(-)
|
||||
|
||||
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
|
||||
index 5a5e792957..99bb010af4 100644
|
||||
--- a/src/libxl/libxl_driver.c
|
||||
+++ b/src/libxl/libxl_driver.c
|
||||
@@ -773,6 +773,9 @@ libxlStateInitialize(bool privileged,
|
||||
NULL, NULL) < 0)
|
||||
goto error;
|
||||
|
||||
+ virDomainObjListForEach(libxl_driver->domains, libxlAutostartDomain,
|
||||
+ libxl_driver);
|
||||
+
|
||||
virDomainObjListForEach(libxl_driver->domains, libxlDomainManagedSaveLoad,
|
||||
libxl_driver);
|
||||
|
||||
@@ -784,16 +787,6 @@ libxlStateInitialize(bool privileged,
|
||||
return -1;
|
||||
}
|
||||
|
||||
-static void
|
||||
-libxlStateAutoStart(void)
|
||||
-{
|
||||
- if (!libxl_driver)
|
||||
- return;
|
||||
-
|
||||
- virDomainObjListForEach(libxl_driver->domains, libxlAutostartDomain,
|
||||
- libxl_driver);
|
||||
-}
|
||||
-
|
||||
static int
|
||||
libxlStateReload(void)
|
||||
{
|
||||
@@ -6479,7 +6472,6 @@ static virConnectDriver libxlConnectDriver = {
|
||||
static virStateDriver libxlStateDriver = {
|
||||
.name = "LIBXL",
|
||||
.stateInitialize = libxlStateInitialize,
|
||||
- .stateAutoStart = libxlStateAutoStart,
|
||||
.stateCleanup = libxlStateCleanup,
|
||||
.stateReload = libxlStateReload,
|
||||
};
|
||||
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
|
||||
index f9794e0655..527fa72083 100644
|
||||
--- a/src/lxc/lxc_driver.c
|
||||
+++ b/src/lxc/lxc_driver.c
|
||||
@@ -1646,6 +1646,8 @@ static int lxcStateInitialize(bool privileged,
|
||||
NULL, NULL) < 0)
|
||||
goto cleanup;
|
||||
|
||||
+ virLXCProcessAutostartAll(lxc_driver);
|
||||
+
|
||||
virObjectUnref(caps);
|
||||
return 0;
|
||||
|
||||
@@ -1655,19 +1657,6 @@ static int lxcStateInitialize(bool privileged,
|
||||
return -1;
|
||||
}
|
||||
|
||||
-/**
|
||||
- * lxcStateAutoStart:
|
||||
- *
|
||||
- * Function to autostart the LXC daemons
|
||||
- */
|
||||
-static void lxcStateAutoStart(void)
|
||||
-{
|
||||
- if (!lxc_driver)
|
||||
- return;
|
||||
-
|
||||
- virLXCProcessAutostartAll(lxc_driver);
|
||||
-}
|
||||
-
|
||||
static void lxcNotifyLoadDomain(virDomainObjPtr vm, int newVM, void *opaque)
|
||||
{
|
||||
virLXCDriverPtr driver = opaque;
|
||||
@@ -5550,7 +5539,6 @@ static virConnectDriver lxcConnectDriver = {
|
||||
static virStateDriver lxcStateDriver = {
|
||||
.name = LXC_DRIVER_NAME,
|
||||
.stateInitialize = lxcStateInitialize,
|
||||
- .stateAutoStart = lxcStateAutoStart,
|
||||
.stateCleanup = lxcStateCleanup,
|
||||
.stateReload = lxcStateReload,
|
||||
};
|
||||
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
|
||||
index d153a8cdb6..a60d7db685 100644
|
||||
--- a/src/network/bridge_driver.c
|
||||
+++ b/src/network/bridge_driver.c
|
||||
@@ -755,6 +755,10 @@ networkStateInitialize(bool privileged,
|
||||
networkReloadFirewallRules(network_driver);
|
||||
networkRefreshDaemons(network_driver);
|
||||
|
||||
+ virNetworkObjListForEach(network_driver->networks,
|
||||
+ networkAutostartConfig,
|
||||
+ network_driver);
|
||||
+
|
||||
network_driver->networkEventState = virObjectEventStateNew();
|
||||
|
||||
#ifdef WITH_FIREWALLD
|
||||
@@ -794,23 +798,6 @@ networkStateInitialize(bool privileged,
|
||||
}
|
||||
|
||||
|
||||
-/**
|
||||
- * networkStateAutoStart:
|
||||
- *
|
||||
- * Function to AutoStart the bridge configs
|
||||
- */
|
||||
-static void
|
||||
-networkStateAutoStart(void)
|
||||
-{
|
||||
- if (!network_driver)
|
||||
- return;
|
||||
-
|
||||
- virNetworkObjListForEach(network_driver->networks,
|
||||
- networkAutostartConfig,
|
||||
- network_driver);
|
||||
-}
|
||||
-
|
||||
-
|
||||
/**
|
||||
* networkStateReload:
|
||||
*
|
||||
@@ -5616,7 +5603,6 @@ static virConnectDriver networkConnectDriver = {
|
||||
static virStateDriver networkStateDriver = {
|
||||
.name = "bridge",
|
||||
.stateInitialize = networkStateInitialize,
|
||||
- .stateAutoStart = networkStateAutoStart,
|
||||
.stateCleanup = networkStateCleanup,
|
||||
.stateReload = networkStateReload,
|
||||
};
|
||||
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
|
||||
index 2da87992fd..056d324a62 100644
|
||||
--- a/src/qemu/qemu_driver.c
|
||||
+++ b/src/qemu/qemu_driver.c
|
||||
@@ -911,6 +911,8 @@ qemuStateInitialize(bool privileged,
|
||||
|
||||
qemuProcessReconnectAll(qemu_driver);
|
||||
|
||||
+ qemuAutostartDomains(qemu_driver);
|
||||
+
|
||||
return 0;
|
||||
|
||||
error:
|
||||
@@ -921,20 +923,6 @@ qemuStateInitialize(bool privileged,
|
||||
return -1;
|
||||
}
|
||||
|
||||
-/**
|
||||
- * qemuStateAutoStart:
|
||||
- *
|
||||
- * Function to auto start the QEMU daemons
|
||||
- */
|
||||
-static void
|
||||
-qemuStateAutoStart(void)
|
||||
-{
|
||||
- if (!qemu_driver)
|
||||
- return;
|
||||
-
|
||||
- qemuAutostartDomains(qemu_driver);
|
||||
-}
|
||||
-
|
||||
static void qemuNotifyLoadDomain(virDomainObjPtr vm, int newVM, void *opaque)
|
||||
{
|
||||
virQEMUDriverPtr driver = opaque;
|
||||
@@ -21846,7 +21834,6 @@ static virConnectDriver qemuConnectDriver = {
|
||||
static virStateDriver qemuStateDriver = {
|
||||
.name = QEMU_DRIVER_NAME,
|
||||
.stateInitialize = qemuStateInitialize,
|
||||
- .stateAutoStart = qemuStateAutoStart,
|
||||
.stateCleanup = qemuStateCleanup,
|
||||
.stateReload = qemuStateReload,
|
||||
.stateStop = qemuStateStop,
|
||||
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
|
||||
index 254818e308..f61fb074e6 100644
|
||||
--- a/src/storage/storage_driver.c
|
||||
+++ b/src/storage/storage_driver.c
|
||||
@@ -291,6 +291,8 @@ storageStateInitialize(bool privileged,
|
||||
|
||||
storagePoolUpdateAllState();
|
||||
|
||||
+ storageDriverAutostart();
|
||||
+
|
||||
driver->storageEventState = virObjectEventStateNew();
|
||||
|
||||
storageDriverUnlock();
|
||||
@@ -307,22 +309,6 @@ storageStateInitialize(bool privileged,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
-/**
|
||||
- * storageStateAutoStart:
|
||||
- *
|
||||
- * Function to auto start the storage driver
|
||||
- */
|
||||
-static void
|
||||
-storageStateAutoStart(void)
|
||||
-{
|
||||
- if (!driver)
|
||||
- return;
|
||||
-
|
||||
- storageDriverLock();
|
||||
- storageDriverAutostart();
|
||||
- storageDriverUnlock();
|
||||
-}
|
||||
-
|
||||
/**
|
||||
* storageStateReload:
|
||||
*
|
||||
@@ -2843,7 +2829,6 @@ static virConnectDriver storageConnectDriver = {
|
||||
static virStateDriver stateDriver = {
|
||||
.name = "storage",
|
||||
.stateInitialize = storageStateInitialize,
|
||||
- .stateAutoStart = storageStateAutoStart,
|
||||
.stateCleanup = storageStateCleanup,
|
||||
.stateReload = storageStateReload,
|
||||
};
|
||||
diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
|
||||
index c77988f01e..296adf55d1 100644
|
||||
--- a/src/uml/uml_driver.c
|
||||
+++ b/src/uml/uml_driver.c
|
||||
@@ -575,6 +575,8 @@ umlStateInitialize(bool privileged,
|
||||
|
||||
umlDriverUnlock(uml_driver);
|
||||
|
||||
+ umlAutostartConfigs(uml_driver);
|
||||
+
|
||||
VIR_FREE(userdir);
|
||||
|
||||
return 0;
|
||||
@@ -590,20 +592,6 @@ umlStateInitialize(bool privileged,
|
||||
return -1;
|
||||
}
|
||||
|
||||
-/**
|
||||
- * umlStateAutoStart:
|
||||
- *
|
||||
- * Function to autostart the Uml daemons
|
||||
- */
|
||||
-static void
|
||||
-umlStateAutoStart(void)
|
||||
-{
|
||||
- if (!uml_driver)
|
||||
- return;
|
||||
-
|
||||
- umlAutostartConfigs(uml_driver);
|
||||
-}
|
||||
-
|
||||
static void umlNotifyLoadDomain(virDomainObjPtr vm, int newVM, void *opaque)
|
||||
{
|
||||
struct uml_driver *driver = opaque;
|
||||
@@ -2826,7 +2814,6 @@ static virConnectDriver umlConnectDriver = {
|
||||
static virStateDriver umlStateDriver = {
|
||||
.name = "UML",
|
||||
.stateInitialize = umlStateInitialize,
|
||||
- .stateAutoStart = umlStateAutoStart,
|
||||
.stateCleanup = umlStateCleanup,
|
||||
.stateReload = umlStateReload,
|
||||
};
|
||||
--
|
||||
2.22.0
|
||||
|
@ -0,0 +1,83 @@
|
||||
From ddea95c1c2e32c6454c89aa83d78b26a83564cd4 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <ddea95c1c2e32c6454c89aa83d78b26a83564cd4@dist-git>
|
||||
From: Pavel Hrdina <phrdina@redhat.com>
|
||||
Date: Mon, 1 Jul 2019 17:07:11 +0200
|
||||
Subject: [PATCH] Revert "vircgroup: cleanup controllers not managed by systemd
|
||||
on error"
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This reverts commit 1602aa28f820ada66f707cef3e536e8572fbda1e.
|
||||
|
||||
There is no need to call virCgroupRemove() nor virCgroupFree() if
|
||||
virCgroupEnableMissingControllers() fails because it will not modify
|
||||
'group' at all.
|
||||
|
||||
The cleanup of directories is done in virCgroupMakeGroup().
|
||||
|
||||
Reviewed-by: John Ferlan <jferlan@redhat.com>
|
||||
Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
|
||||
Reviewed-by: Marc Hartmayer <mhartmay@linux.ibm.com>
|
||||
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
|
||||
(cherry picked from commit 199eee6aae7af3d813fbe98660c7e0fa1a8ae7b7)
|
||||
|
||||
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1689297
|
||||
|
||||
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
|
||||
Message-Id: <53288dd310e0305ac3179693e64684eb8b3a31ab.1561993100.git.phrdina@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
src/util/vircgroup.c | 25 ++++++++++---------------
|
||||
1 file changed, 10 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
|
||||
index a376b9b89a..7ec1399bc6 100644
|
||||
--- a/src/util/vircgroup.c
|
||||
+++ b/src/util/vircgroup.c
|
||||
@@ -1059,7 +1059,6 @@ virCgroupNewMachineSystemd(const char *name,
|
||||
int rv;
|
||||
virCgroupPtr init;
|
||||
VIR_AUTOFREE(char *) path = NULL;
|
||||
- virErrorPtr saved = NULL;
|
||||
|
||||
VIR_DEBUG("Trying to setup machine '%s' via systemd", name);
|
||||
if ((rv = virSystemdCreateMachine(name,
|
||||
@@ -1092,24 +1091,20 @@ virCgroupNewMachineSystemd(const char *name,
|
||||
|
||||
if (virCgroupEnableMissingControllers(path, pidleader,
|
||||
controllers, group) < 0) {
|
||||
- goto error;
|
||||
+ return -1;
|
||||
}
|
||||
|
||||
- if (virCgroupAddProcess(*group, pidleader) < 0)
|
||||
- goto error;
|
||||
+ if (virCgroupAddProcess(*group, pidleader) < 0) {
|
||||
+ virErrorPtr saved = virSaveLastError();
|
||||
+ virCgroupRemove(*group);
|
||||
+ virCgroupFree(group);
|
||||
+ if (saved) {
|
||||
+ virSetError(saved);
|
||||
+ virFreeError(saved);
|
||||
+ }
|
||||
+ }
|
||||
|
||||
return 0;
|
||||
-
|
||||
- error:
|
||||
- saved = virSaveLastError();
|
||||
- virCgroupRemove(*group);
|
||||
- virCgroupFree(group);
|
||||
- if (saved) {
|
||||
- virSetError(saved);
|
||||
- virFreeError(saved);
|
||||
- }
|
||||
-
|
||||
- return -1;
|
||||
}
|
||||
|
||||
|
||||
--
|
||||
2.22.0
|
||||
|
@ -0,0 +1,60 @@
|
||||
From 254da75ea1a9c2cade909534153f444bb8981c2a Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <254da75ea1a9c2cade909534153f444bb8981c2a@dist-git>
|
||||
From: John Ferlan <jferlan@redhat.com>
|
||||
Date: Mon, 27 Aug 2018 08:27:47 -0400
|
||||
Subject: [PATCH] access: Fix nwfilter-binding ACL access API name generation
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1611320
|
||||
|
||||
Generation of the ACL API policy is a "automated process"
|
||||
based on this perl script which "worked" with the changes to
|
||||
add nwfilter binding API's because they had the "nwfilter"
|
||||
prefix; however, the generated output name was incorrect
|
||||
based on the remote protocol algorithm which expected to
|
||||
generate names such as 'nwfilter-binding.action' instead
|
||||
of 'nwfilter.binding-action'.
|
||||
|
||||
This effectively changes src/access/org.libvirt.api.policy entries:
|
||||
|
||||
org.libvirt.api.nwfilter.binding-create ==>
|
||||
org.libvirt.api.nwfilter-binding.create
|
||||
|
||||
org.libvirt.api.nwfilter.binding-delete ==>
|
||||
org.libvirt.api.nwfilter-binding.delete
|
||||
|
||||
org.libvirt.api.nwfilter.binding-getattr ==>
|
||||
org.libvirt.api.nwfilter-binding.getattr
|
||||
|
||||
org.libvirt.api.nwfilter.binding-read ==>
|
||||
org.libvirt.api.nwfilter-binding.read
|
||||
|
||||
Signed-off-by: John Ferlan <jferlan@redhat.com>
|
||||
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||
(cherry picked from commit 6ef65e3c96d5d1f16a16daca83b81b818d461e64)
|
||||
https: //bugzilla.redhat.com/show_bug.cgi?id=1622540
|
||||
Reviewed-by: Erik Skultety <eskultet@redhat.com>
|
||||
---
|
||||
src/access/genpolkit.pl | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/access/genpolkit.pl b/src/access/genpolkit.pl
|
||||
index 968cb8c55c..e074c90eb6 100755
|
||||
--- a/src/access/genpolkit.pl
|
||||
+++ b/src/access/genpolkit.pl
|
||||
@@ -22,8 +22,8 @@ use warnings;
|
||||
|
||||
my @objects = (
|
||||
"CONNECT", "DOMAIN", "INTERFACE",
|
||||
- "NETWORK","NODE_DEVICE", "NWFILTER",
|
||||
- "SECRET", "STORAGE_POOL", "STORAGE_VOL",
|
||||
+ "NETWORK","NODE_DEVICE", "NWFILTER_BINDING", "NWFILTER",
|
||||
+ "SECRET", "STORAGE_POOL", "STORAGE_VOL",
|
||||
);
|
||||
|
||||
my $objects = join ("|", @objects);
|
||||
--
|
||||
2.18.0
|
||||
|
@ -0,0 +1,173 @@
|
||||
From 85750b0466aa3719d3d2447abaab2e87db92f552 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <85750b0466aa3719d3d2447abaab2e87db92f552@dist-git>
|
||||
From: John Ferlan <jferlan@redhat.com>
|
||||
Date: Mon, 5 Nov 2018 07:48:37 -0500
|
||||
Subject: [PATCH] access: Modify the VIR_ERR_ACCESS_DENIED to include
|
||||
driverName
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1631608 (RHEL 8.0)
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1631606 (RHEL 7.7)
|
||||
|
||||
Changes made to manage and utilize a secondary connection
|
||||
driver to APIs outside the scope of the primary connection
|
||||
driver have resulted in some confusion processing polkit rules
|
||||
since the simple "access denied" error message doesn't provide
|
||||
enough of a clue when combined with the "authentication failed:
|
||||
access denied by policy" as to which connection driver refused
|
||||
or failed the ACL check.
|
||||
|
||||
In order to provide some context, let's modify the existing
|
||||
"access denied" error returne from the various vir*EnsureACL
|
||||
API's to provide the connection driver name that is causing
|
||||
the failure. This should provide the context for writing the
|
||||
polkit rules that would allow access via the driver.
|
||||
|
||||
Signed-off-by: John Ferlan <jferlan@redhat.com>
|
||||
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
(cherry picked from commit ccc72d5cbdd85f66cb737134b3be40aac1df03ef)
|
||||
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
---
|
||||
src/access/viraccessmanager.c | 25 +++++++++++++------------
|
||||
src/rpc/gendispatch.pl | 2 +-
|
||||
src/util/virerror.c | 4 ++--
|
||||
3 files changed, 16 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/src/access/viraccessmanager.c b/src/access/viraccessmanager.c
|
||||
index e7b5bf38da..1dfff32b9d 100644
|
||||
--- a/src/access/viraccessmanager.c
|
||||
+++ b/src/access/viraccessmanager.c
|
||||
@@ -196,11 +196,12 @@ static void virAccessManagerDispose(void *object)
|
||||
* should the admin need to debug things
|
||||
*/
|
||||
static int
|
||||
-virAccessManagerSanitizeError(int ret)
|
||||
+virAccessManagerSanitizeError(int ret,
|
||||
+ const char *driverName)
|
||||
{
|
||||
if (ret < 0) {
|
||||
virResetLastError();
|
||||
- virAccessError(VIR_ERR_ACCESS_DENIED, NULL);
|
||||
+ virAccessError(VIR_ERR_ACCESS_DENIED, driverName, NULL);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -217,7 +218,7 @@ int virAccessManagerCheckConnect(virAccessManagerPtr manager,
|
||||
if (manager->drv->checkConnect)
|
||||
ret = manager->drv->checkConnect(manager, driverName, perm);
|
||||
|
||||
- return virAccessManagerSanitizeError(ret);
|
||||
+ return virAccessManagerSanitizeError(ret, driverName);
|
||||
}
|
||||
|
||||
|
||||
@@ -233,7 +234,7 @@ int virAccessManagerCheckDomain(virAccessManagerPtr manager,
|
||||
if (manager->drv->checkDomain)
|
||||
ret = manager->drv->checkDomain(manager, driverName, domain, perm);
|
||||
|
||||
- return virAccessManagerSanitizeError(ret);
|
||||
+ return virAccessManagerSanitizeError(ret, driverName);
|
||||
}
|
||||
|
||||
int virAccessManagerCheckInterface(virAccessManagerPtr manager,
|
||||
@@ -248,7 +249,7 @@ int virAccessManagerCheckInterface(virAccessManagerPtr manager,
|
||||
if (manager->drv->checkInterface)
|
||||
ret = manager->drv->checkInterface(manager, driverName, iface, perm);
|
||||
|
||||
- return virAccessManagerSanitizeError(ret);
|
||||
+ return virAccessManagerSanitizeError(ret, driverName);
|
||||
}
|
||||
|
||||
int virAccessManagerCheckNetwork(virAccessManagerPtr manager,
|
||||
@@ -263,7 +264,7 @@ int virAccessManagerCheckNetwork(virAccessManagerPtr manager,
|
||||
if (manager->drv->checkNetwork)
|
||||
ret = manager->drv->checkNetwork(manager, driverName, network, perm);
|
||||
|
||||
- return virAccessManagerSanitizeError(ret);
|
||||
+ return virAccessManagerSanitizeError(ret, driverName);
|
||||
}
|
||||
|
||||
int virAccessManagerCheckNodeDevice(virAccessManagerPtr manager,
|
||||
@@ -278,7 +279,7 @@ int virAccessManagerCheckNodeDevice(virAccessManagerPtr manager,
|
||||
if (manager->drv->checkNodeDevice)
|
||||
ret = manager->drv->checkNodeDevice(manager, driverName, nodedev, perm);
|
||||
|
||||
- return virAccessManagerSanitizeError(ret);
|
||||
+ return virAccessManagerSanitizeError(ret, driverName);
|
||||
}
|
||||
|
||||
int virAccessManagerCheckNWFilter(virAccessManagerPtr manager,
|
||||
@@ -293,7 +294,7 @@ int virAccessManagerCheckNWFilter(virAccessManagerPtr manager,
|
||||
if (manager->drv->checkNWFilter)
|
||||
ret = manager->drv->checkNWFilter(manager, driverName, nwfilter, perm);
|
||||
|
||||
- return virAccessManagerSanitizeError(ret);
|
||||
+ return virAccessManagerSanitizeError(ret, driverName);
|
||||
}
|
||||
|
||||
int virAccessManagerCheckNWFilterBinding(virAccessManagerPtr manager,
|
||||
@@ -308,7 +309,7 @@ int virAccessManagerCheckNWFilterBinding(virAccessManagerPtr manager,
|
||||
if (manager->drv->checkNWFilterBinding)
|
||||
ret = manager->drv->checkNWFilterBinding(manager, driverName, binding, perm);
|
||||
|
||||
- return virAccessManagerSanitizeError(ret);
|
||||
+ return virAccessManagerSanitizeError(ret, driverName);
|
||||
}
|
||||
|
||||
int virAccessManagerCheckSecret(virAccessManagerPtr manager,
|
||||
@@ -323,7 +324,7 @@ int virAccessManagerCheckSecret(virAccessManagerPtr manager,
|
||||
if (manager->drv->checkSecret)
|
||||
ret = manager->drv->checkSecret(manager, driverName, secret, perm);
|
||||
|
||||
- return virAccessManagerSanitizeError(ret);
|
||||
+ return virAccessManagerSanitizeError(ret, driverName);
|
||||
}
|
||||
|
||||
int virAccessManagerCheckStoragePool(virAccessManagerPtr manager,
|
||||
@@ -338,7 +339,7 @@ int virAccessManagerCheckStoragePool(virAccessManagerPtr manager,
|
||||
if (manager->drv->checkStoragePool)
|
||||
ret = manager->drv->checkStoragePool(manager, driverName, pool, perm);
|
||||
|
||||
- return virAccessManagerSanitizeError(ret);
|
||||
+ return virAccessManagerSanitizeError(ret, driverName);
|
||||
}
|
||||
|
||||
int virAccessManagerCheckStorageVol(virAccessManagerPtr manager,
|
||||
@@ -354,5 +355,5 @@ int virAccessManagerCheckStorageVol(virAccessManagerPtr manager,
|
||||
if (manager->drv->checkStorageVol)
|
||||
ret = manager->drv->checkStorageVol(manager, driverName, pool, vol, perm);
|
||||
|
||||
- return virAccessManagerSanitizeError(ret);
|
||||
+ return virAccessManagerSanitizeError(ret, driverName);
|
||||
}
|
||||
diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl
|
||||
index 0c4648c0fb..f599002056 100755
|
||||
--- a/src/rpc/gendispatch.pl
|
||||
+++ b/src/rpc/gendispatch.pl
|
||||
@@ -2199,7 +2199,7 @@ elsif ($mode eq "client") {
|
||||
print " virObjectUnref(mgr);\n";
|
||||
if ($action eq "Ensure") {
|
||||
print " if (rv == 0)\n";
|
||||
- print " virReportError(VIR_ERR_ACCESS_DENIED, NULL);\n";
|
||||
+ print " virReportError(VIR_ERR_ACCESS_DENIED, conn->driver->name, NULL);\n";
|
||||
print " return $fail;\n";
|
||||
} else {
|
||||
print " virResetLastError();\n";
|
||||
diff --git a/src/util/virerror.c b/src/util/virerror.c
|
||||
index f198f27957..5f50fa0349 100644
|
||||
--- a/src/util/virerror.c
|
||||
+++ b/src/util/virerror.c
|
||||
@@ -1439,9 +1439,9 @@ virErrorMsg(virErrorNumber error, const char *info)
|
||||
break;
|
||||
case VIR_ERR_ACCESS_DENIED:
|
||||
if (info == NULL)
|
||||
- errmsg = _("access denied");
|
||||
+ errmsg = _("access denied from '%s'");
|
||||
else
|
||||
- errmsg = _("access denied: %s");
|
||||
+ errmsg = _("access denied from '%s': %s");
|
||||
break;
|
||||
case VIR_ERR_DBUS_SERVICE:
|
||||
if (info == NULL)
|
||||
--
|
||||
2.19.1
|
||||
|
@ -0,0 +1,159 @@
|
||||
From 541a154e0f98604f63cb22356287dfa3858748c9 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <541a154e0f98604f63cb22356287dfa3858748c9@dist-git>
|
||||
From: John Ferlan <jferlan@redhat.com>
|
||||
Date: Thu, 15 Nov 2018 06:43:59 -0500
|
||||
Subject: [PATCH] access: Modify the VIR_ERR_ACCESS_DENIED to include
|
||||
driverName
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1631608 (RHEL8)
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1631606 (RHEL7)
|
||||
|
||||
Changes made to manage and utilize a secondary connection
|
||||
driver to APIs outside the scope of the primary connection
|
||||
driver have resulted in some confusion processing polkit rules
|
||||
since the simple "access denied" error message doesn't provide
|
||||
enough of a clue when combined with the "authentication failed:
|
||||
access denied by policy" as to which connection driver refused
|
||||
or failed the ACL check.
|
||||
|
||||
In order to provide some context, let's modify the existing
|
||||
"access denied" error returned from the various vir*EnsureACL
|
||||
API's to provide the connection driver name that is causing
|
||||
the failure. This should provide the context for writing the
|
||||
polkit rules that would allow access via the driver, but yet
|
||||
still adhere to the virAccessManagerSanitizeError commentary
|
||||
regarding not telling the user why access was denied.
|
||||
|
||||
Signed-off-by: John Ferlan <jferlan@redhat.com>
|
||||
(cherry picked from commit 605496be609e153526fcdd3e98df8cf5244bc8fa)
|
||||
Reviewed-by: Erik Skultety <eskultet@redhat.com>
|
||||
---
|
||||
src/access/viraccessmanager.c | 26 ++++++++++++++------------
|
||||
src/rpc/gendispatch.pl | 3 ++-
|
||||
2 files changed, 16 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/src/access/viraccessmanager.c b/src/access/viraccessmanager.c
|
||||
index e7b5bf38da..f5d62604cf 100644
|
||||
--- a/src/access/viraccessmanager.c
|
||||
+++ b/src/access/viraccessmanager.c
|
||||
@@ -196,11 +196,13 @@ static void virAccessManagerDispose(void *object)
|
||||
* should the admin need to debug things
|
||||
*/
|
||||
static int
|
||||
-virAccessManagerSanitizeError(int ret)
|
||||
+virAccessManagerSanitizeError(int ret,
|
||||
+ const char *driverName)
|
||||
{
|
||||
if (ret < 0) {
|
||||
virResetLastError();
|
||||
- virAccessError(VIR_ERR_ACCESS_DENIED, NULL);
|
||||
+ virAccessError(VIR_ERR_ACCESS_DENIED,
|
||||
+ _("'%s' denied access"), driverName);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -217,7 +219,7 @@ int virAccessManagerCheckConnect(virAccessManagerPtr manager,
|
||||
if (manager->drv->checkConnect)
|
||||
ret = manager->drv->checkConnect(manager, driverName, perm);
|
||||
|
||||
- return virAccessManagerSanitizeError(ret);
|
||||
+ return virAccessManagerSanitizeError(ret, driverName);
|
||||
}
|
||||
|
||||
|
||||
@@ -233,7 +235,7 @@ int virAccessManagerCheckDomain(virAccessManagerPtr manager,
|
||||
if (manager->drv->checkDomain)
|
||||
ret = manager->drv->checkDomain(manager, driverName, domain, perm);
|
||||
|
||||
- return virAccessManagerSanitizeError(ret);
|
||||
+ return virAccessManagerSanitizeError(ret, driverName);
|
||||
}
|
||||
|
||||
int virAccessManagerCheckInterface(virAccessManagerPtr manager,
|
||||
@@ -248,7 +250,7 @@ int virAccessManagerCheckInterface(virAccessManagerPtr manager,
|
||||
if (manager->drv->checkInterface)
|
||||
ret = manager->drv->checkInterface(manager, driverName, iface, perm);
|
||||
|
||||
- return virAccessManagerSanitizeError(ret);
|
||||
+ return virAccessManagerSanitizeError(ret, driverName);
|
||||
}
|
||||
|
||||
int virAccessManagerCheckNetwork(virAccessManagerPtr manager,
|
||||
@@ -263,7 +265,7 @@ int virAccessManagerCheckNetwork(virAccessManagerPtr manager,
|
||||
if (manager->drv->checkNetwork)
|
||||
ret = manager->drv->checkNetwork(manager, driverName, network, perm);
|
||||
|
||||
- return virAccessManagerSanitizeError(ret);
|
||||
+ return virAccessManagerSanitizeError(ret, driverName);
|
||||
}
|
||||
|
||||
int virAccessManagerCheckNodeDevice(virAccessManagerPtr manager,
|
||||
@@ -278,7 +280,7 @@ int virAccessManagerCheckNodeDevice(virAccessManagerPtr manager,
|
||||
if (manager->drv->checkNodeDevice)
|
||||
ret = manager->drv->checkNodeDevice(manager, driverName, nodedev, perm);
|
||||
|
||||
- return virAccessManagerSanitizeError(ret);
|
||||
+ return virAccessManagerSanitizeError(ret, driverName);
|
||||
}
|
||||
|
||||
int virAccessManagerCheckNWFilter(virAccessManagerPtr manager,
|
||||
@@ -293,7 +295,7 @@ int virAccessManagerCheckNWFilter(virAccessManagerPtr manager,
|
||||
if (manager->drv->checkNWFilter)
|
||||
ret = manager->drv->checkNWFilter(manager, driverName, nwfilter, perm);
|
||||
|
||||
- return virAccessManagerSanitizeError(ret);
|
||||
+ return virAccessManagerSanitizeError(ret, driverName);
|
||||
}
|
||||
|
||||
int virAccessManagerCheckNWFilterBinding(virAccessManagerPtr manager,
|
||||
@@ -308,7 +310,7 @@ int virAccessManagerCheckNWFilterBinding(virAccessManagerPtr manager,
|
||||
if (manager->drv->checkNWFilterBinding)
|
||||
ret = manager->drv->checkNWFilterBinding(manager, driverName, binding, perm);
|
||||
|
||||
- return virAccessManagerSanitizeError(ret);
|
||||
+ return virAccessManagerSanitizeError(ret, driverName);
|
||||
}
|
||||
|
||||
int virAccessManagerCheckSecret(virAccessManagerPtr manager,
|
||||
@@ -323,7 +325,7 @@ int virAccessManagerCheckSecret(virAccessManagerPtr manager,
|
||||
if (manager->drv->checkSecret)
|
||||
ret = manager->drv->checkSecret(manager, driverName, secret, perm);
|
||||
|
||||
- return virAccessManagerSanitizeError(ret);
|
||||
+ return virAccessManagerSanitizeError(ret, driverName);
|
||||
}
|
||||
|
||||
int virAccessManagerCheckStoragePool(virAccessManagerPtr manager,
|
||||
@@ -338,7 +340,7 @@ int virAccessManagerCheckStoragePool(virAccessManagerPtr manager,
|
||||
if (manager->drv->checkStoragePool)
|
||||
ret = manager->drv->checkStoragePool(manager, driverName, pool, perm);
|
||||
|
||||
- return virAccessManagerSanitizeError(ret);
|
||||
+ return virAccessManagerSanitizeError(ret, driverName);
|
||||
}
|
||||
|
||||
int virAccessManagerCheckStorageVol(virAccessManagerPtr manager,
|
||||
@@ -354,5 +356,5 @@ int virAccessManagerCheckStorageVol(virAccessManagerPtr manager,
|
||||
if (manager->drv->checkStorageVol)
|
||||
ret = manager->drv->checkStorageVol(manager, driverName, pool, vol, perm);
|
||||
|
||||
- return virAccessManagerSanitizeError(ret);
|
||||
+ return virAccessManagerSanitizeError(ret, driverName);
|
||||
}
|
||||
diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl
|
||||
index 0c4648c0fb..a8b9f5aeca 100755
|
||||
--- a/src/rpc/gendispatch.pl
|
||||
+++ b/src/rpc/gendispatch.pl
|
||||
@@ -2199,7 +2199,8 @@ elsif ($mode eq "client") {
|
||||
print " virObjectUnref(mgr);\n";
|
||||
if ($action eq "Ensure") {
|
||||
print " if (rv == 0)\n";
|
||||
- print " virReportError(VIR_ERR_ACCESS_DENIED, NULL);\n";
|
||||
+ print " virReportError(VIR_ERR_ACCESS_DENIED,\n";
|
||||
+ print" _(\"'%s' denied access\"), conn->driver->name);\n";
|
||||
print " return $fail;\n";
|
||||
} else {
|
||||
print " virResetLastError();\n";
|
||||
--
|
||||
2.19.2
|
||||
|
@ -0,0 +1,61 @@
|
||||
From 3eaa16967f0546c5d1596bb6c36767cbe01040b9 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <3eaa16967f0546c5d1596bb6c36767cbe01040b9@dist-git>
|
||||
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
|
||||
Date: Wed, 15 May 2019 21:40:56 +0100
|
||||
Subject: [PATCH] admin: reject clients unless their UID matches the current
|
||||
UID
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The admin protocol RPC messages are only intended for use by the user
|
||||
running the daemon. As such they should not be allowed for any client
|
||||
UID that does not match the server UID.
|
||||
|
||||
Fixes CVE-2019-10132
|
||||
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||
(cherry picked from commit 96f41cd765c9e525fe28ee5abbfbf4a79b3720c7)
|
||||
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Message-Id: <20190515204058.28077-2-berrange@redhat.com>
|
||||
---
|
||||
src/admin/admin_server_dispatch.c | 22 ++++++++++++++++++++++
|
||||
1 file changed, 22 insertions(+)
|
||||
|
||||
diff --git a/src/admin/admin_server_dispatch.c b/src/admin/admin_server_dispatch.c
|
||||
index b78ff902c0..9f25813ae3 100644
|
||||
--- a/src/admin/admin_server_dispatch.c
|
||||
+++ b/src/admin/admin_server_dispatch.c
|
||||
@@ -66,6 +66,28 @@ remoteAdmClientNew(virNetServerClientPtr client ATTRIBUTE_UNUSED,
|
||||
void *opaque)
|
||||
{
|
||||
struct daemonAdmClientPrivate *priv;
|
||||
+ uid_t clientuid;
|
||||
+ gid_t clientgid;
|
||||
+ pid_t clientpid;
|
||||
+ unsigned long long timestamp;
|
||||
+
|
||||
+ if (virNetServerClientGetUNIXIdentity(client,
|
||||
+ &clientuid,
|
||||
+ &clientgid,
|
||||
+ &clientpid,
|
||||
+ ×tamp) < 0)
|
||||
+ return NULL;
|
||||
+
|
||||
+ VIR_DEBUG("New client pid %lld uid %lld",
|
||||
+ (long long)clientpid,
|
||||
+ (long long)clientuid);
|
||||
+
|
||||
+ if (geteuid() != clientuid) {
|
||||
+ virReportRestrictedError(_("Disallowing client %lld with uid %lld"),
|
||||
+ (long long)clientpid,
|
||||
+ (long long)clientuid);
|
||||
+ return NULL;
|
||||
+ }
|
||||
|
||||
if (VIR_ALLOC(priv) < 0)
|
||||
return NULL;
|
||||
--
|
||||
2.22.0
|
||||
|
@ -0,0 +1,46 @@
|
||||
From bab30af2d83e27d9141545cb9dcff51924e52b4d Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <bab30af2d83e27d9141545cb9dcff51924e52b4d@dist-git>
|
||||
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
|
||||
Date: Tue, 18 Jun 2019 13:30:02 +0200
|
||||
Subject: [PATCH] api: disallow virConnect*HypervisorCPU on read-only
|
||||
connections
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
These APIs can be used to execute arbitrary emulators.
|
||||
Forbid them on read-only connections.
|
||||
|
||||
Fixes: CVE-2019-10168
|
||||
Signed-off-by: Ján Tomko <jtomko@redhat.com>
|
||||
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||
Signed-off-by: Ján Tomko <jtomko@redhat.com>
|
||||
Message-Id: <470651092e7d6a4ba5875cf8885fd3714d5ea189.1560857354.git.jtomko@redhat.com>
|
||||
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
---
|
||||
src/libvirt-host.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/src/libvirt-host.c b/src/libvirt-host.c
|
||||
index e20d6ee250..2978825d22 100644
|
||||
--- a/src/libvirt-host.c
|
||||
+++ b/src/libvirt-host.c
|
||||
@@ -1041,6 +1041,7 @@ virConnectCompareHypervisorCPU(virConnectPtr conn,
|
||||
|
||||
virCheckConnectReturn(conn, VIR_CPU_COMPARE_ERROR);
|
||||
virCheckNonNullArgGoto(xmlCPU, error);
|
||||
+ virCheckReadOnlyGoto(conn->flags, error);
|
||||
|
||||
if (conn->driver->connectCompareHypervisorCPU) {
|
||||
int ret;
|
||||
@@ -1234,6 +1235,7 @@ virConnectBaselineHypervisorCPU(virConnectPtr conn,
|
||||
|
||||
virCheckConnectReturn(conn, NULL);
|
||||
virCheckNonNullArgGoto(xmlCPUs, error);
|
||||
+ virCheckReadOnlyGoto(conn->flags, error);
|
||||
|
||||
if (conn->driver->connectBaselineHypervisorCPU) {
|
||||
char *cpu;
|
||||
--
|
||||
2.22.0
|
||||
|
@ -0,0 +1,38 @@
|
||||
From 2b0e20b240848c84932aa549e8ec2b6e0a5646fa Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <2b0e20b240848c84932aa549e8ec2b6e0a5646fa@dist-git>
|
||||
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
|
||||
Date: Tue, 18 Jun 2019 13:30:01 +0200
|
||||
Subject: [PATCH] api: disallow virConnectGetDomainCapabilities on read-only
|
||||
connections
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This API can be used to execute arbitrary emulators.
|
||||
Forbid it on read-only connections.
|
||||
|
||||
Fixes: CVE-2019-10167
|
||||
Signed-off-by: Ján Tomko <jtomko@redhat.com>
|
||||
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||
Signed-off-by: Ján Tomko <jtomko@redhat.com>
|
||||
Message-Id: <eeefd7cf2afba696bed78582e086bfbd3ed23e00.1560857354.git.jtomko@redhat.com>
|
||||
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
---
|
||||
src/libvirt-domain.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
|
||||
index 3855dfe0dd..a1c913bd86 100644
|
||||
--- a/src/libvirt-domain.c
|
||||
+++ b/src/libvirt-domain.c
|
||||
@@ -11279,6 +11279,7 @@ virConnectGetDomainCapabilities(virConnectPtr conn,
|
||||
virResetLastError();
|
||||
|
||||
virCheckConnectReturn(conn, NULL);
|
||||
+ virCheckReadOnlyGoto(conn->flags, error);
|
||||
|
||||
if (conn->driver->connectGetDomainCapabilities) {
|
||||
char *ret;
|
||||
--
|
||||
2.22.0
|
||||
|
@ -0,0 +1,40 @@
|
||||
From 0673d5b707d68562732b78c89fe339e8558f8496 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <0673d5b707d68562732b78c89fe339e8558f8496@dist-git>
|
||||
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
|
||||
Date: Tue, 18 Jun 2019 13:30:00 +0200
|
||||
Subject: [PATCH] api: disallow virDomainManagedSaveDefineXML on read-only
|
||||
connections
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The virDomainManagedSaveDefineXML can be used to alter the domain's
|
||||
config used for managedsave or even execute arbitrary emulator binaries.
|
||||
Forbid it on read-only connections.
|
||||
|
||||
Fixes: CVE-2019-10166
|
||||
Reported-by: Matthias Gerstner <mgerstner@suse.de>
|
||||
Signed-off-by: Ján Tomko <jtomko@redhat.com>
|
||||
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||
Signed-off-by: Ján Tomko <jtomko@redhat.com>
|
||||
Message-Id: <352bf5e963a6482d426f97b0ef36ca019e69280b.1560857354.git.jtomko@redhat.com>
|
||||
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
---
|
||||
src/libvirt-domain.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
|
||||
index 0ba85b9360..3855dfe0dd 100644
|
||||
--- a/src/libvirt-domain.c
|
||||
+++ b/src/libvirt-domain.c
|
||||
@@ -9487,6 +9487,7 @@ virDomainManagedSaveDefineXML(virDomainPtr domain, const char *dxml,
|
||||
|
||||
virCheckDomainReturn(domain, -1);
|
||||
conn = domain->conn;
|
||||
+ virCheckReadOnlyGoto(conn->flags, error);
|
||||
|
||||
if (conn->driver->domainManagedSaveDefineXML) {
|
||||
int ret;
|
||||
--
|
||||
2.22.0
|
||||
|
@ -0,0 +1,98 @@
|
||||
From 8533d820c378ae31176922703b7368f586a59bc0 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <8533d820c378ae31176922703b7368f586a59bc0@dist-git>
|
||||
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
|
||||
Date: Tue, 18 Jun 2019 13:29:59 +0200
|
||||
Subject: [PATCH] api: disallow virDomainSaveImageGetXMLDesc on read-only
|
||||
connections
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The virDomainSaveImageGetXMLDesc API is taking a path parameter,
|
||||
which can point to any path on the system. This file will then be
|
||||
read and parsed by libvirtd running with root privileges.
|
||||
|
||||
Forbid it on read-only connections.
|
||||
|
||||
Fixes: CVE-2019-10161
|
||||
Reported-by: Matthias Gerstner <mgerstner@suse.de>
|
||||
Signed-off-by: Ján Tomko <jtomko@redhat.com>
|
||||
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||
Signed-off-by: Ján Tomko <jtomko@redhat.com>
|
||||
|
||||
Conflicts:
|
||||
src/libvirt-domain.c
|
||||
src/remote/remote_protocol.x
|
||||
|
||||
Upstream commit 12a51f372 which introduced the VIR_DOMAIN_SAVE_IMAGE_XML_SECURE
|
||||
alias for VIR_DOMAIN_XML_SECURE is not backported.
|
||||
Just skip the commit since we now disallow the whole API on read-only
|
||||
connections, regardless of the flag.
|
||||
Message-Id: <4c14d609cd7b548459b9ef2f59728fa5c5e38268.1560857354.git.jtomko@redhat.com>
|
||||
|
||||
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
---
|
||||
src/libvirt-domain.c | 11 ++---------
|
||||
src/qemu/qemu_driver.c | 2 +-
|
||||
src/remote/remote_protocol.x | 3 +--
|
||||
3 files changed, 4 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
|
||||
index ad0ded9ee3..0ba85b9360 100644
|
||||
--- a/src/libvirt-domain.c
|
||||
+++ b/src/libvirt-domain.c
|
||||
@@ -1073,9 +1073,7 @@ virDomainRestoreFlags(virConnectPtr conn, const char *from, const char *dxml,
|
||||
* previously by virDomainSave() or virDomainSaveFlags().
|
||||
*
|
||||
* No security-sensitive data will be included unless @flags contains
|
||||
- * VIR_DOMAIN_XML_SECURE; this flag is rejected on read-only
|
||||
- * connections. For this API, @flags should not contain either
|
||||
- * VIR_DOMAIN_XML_INACTIVE or VIR_DOMAIN_XML_UPDATE_CPU.
|
||||
+ * VIR_DOMAIN_XML_SECURE.
|
||||
*
|
||||
* Returns a 0 terminated UTF-8 encoded XML instance, or NULL in case of
|
||||
* error. The caller must free() the returned value.
|
||||
@@ -1091,12 +1089,7 @@ virDomainSaveImageGetXMLDesc(virConnectPtr conn, const char *file,
|
||||
|
||||
virCheckConnectReturn(conn, NULL);
|
||||
virCheckNonNullArgGoto(file, error);
|
||||
-
|
||||
- if ((conn->flags & VIR_CONNECT_RO) && (flags & VIR_DOMAIN_XML_SECURE)) {
|
||||
- virReportError(VIR_ERR_OPERATION_DENIED, "%s",
|
||||
- _("virDomainSaveImageGetXMLDesc with secure flag"));
|
||||
- goto error;
|
||||
- }
|
||||
+ virCheckReadOnlyGoto(conn->flags, error);
|
||||
|
||||
if (conn->driver->domainSaveImageGetXMLDesc) {
|
||||
char *ret;
|
||||
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
|
||||
index 88c08f88ee..2da87992fd 100644
|
||||
--- a/src/qemu/qemu_driver.c
|
||||
+++ b/src/qemu/qemu_driver.c
|
||||
@@ -6786,7 +6786,7 @@ qemuDomainSaveImageGetXMLDesc(virConnectPtr conn, const char *path,
|
||||
if (fd < 0)
|
||||
goto cleanup;
|
||||
|
||||
- if (virDomainSaveImageGetXMLDescEnsureACL(conn, def, flags) < 0)
|
||||
+ if (virDomainSaveImageGetXMLDescEnsureACL(conn, def) < 0)
|
||||
goto cleanup;
|
||||
|
||||
ret = qemuDomainDefFormatXML(driver, def, flags);
|
||||
diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x
|
||||
index 28c8febabd..52b92334fa 100644
|
||||
--- a/src/remote/remote_protocol.x
|
||||
+++ b/src/remote/remote_protocol.x
|
||||
@@ -5226,8 +5226,7 @@ enum remote_procedure {
|
||||
/**
|
||||
* @generate: both
|
||||
* @priority: high
|
||||
- * @acl: domain:read
|
||||
- * @acl: domain:read_secure:VIR_DOMAIN_XML_SECURE
|
||||
+ * @acl: domain:write
|
||||
*/
|
||||
REMOTE_PROC_DOMAIN_SAVE_IMAGE_GET_XML_DESC = 235,
|
||||
|
||||
--
|
||||
2.22.0
|
||||
|
@ -0,0 +1,65 @@
|
||||
From a26ad1b57617abc4de8a0d13716b898d311ee01e Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <a26ad1b57617abc4de8a0d13716b898d311ee01e@dist-git>
|
||||
From: Michal Privoznik <mprivozn@redhat.com>
|
||||
Date: Thu, 27 Jun 2019 15:18:15 +0200
|
||||
Subject: [PATCH] bhyve: Move autostarting of domains into bhyveStateInitialize
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The stateAutoStart callback will go away shortly. Therefore, move
|
||||
the autostart call into state initialize callback.
|
||||
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit 31c3c35c940010a793fea8351751bb04fab1a6d4)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1685151
|
||||
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Message-Id: <1a93e2bef531c11190c652fcfb73b568ee73e487.1561641375.git.mprivozn@redhat.com>
|
||||
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
---
|
||||
src/bhyve/bhyve_driver.c | 12 ++----------
|
||||
1 file changed, 2 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c
|
||||
index 9284b51783..ec016ecc0c 100644
|
||||
--- a/src/bhyve/bhyve_driver.c
|
||||
+++ b/src/bhyve/bhyve_driver.c
|
||||
@@ -1270,6 +1270,8 @@ bhyveStateInitialize(bool privileged,
|
||||
|
||||
virBhyveProcessReconnectAll(bhyve_driver);
|
||||
|
||||
+ bhyveAutostartDomains(bhyve_driver);
|
||||
+
|
||||
return 0;
|
||||
|
||||
cleanup:
|
||||
@@ -1297,15 +1299,6 @@ bhyveDriverGetGrubCaps(virConnectPtr conn)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static void
|
||||
-bhyveStateAutoStart(void)
|
||||
-{
|
||||
- if (!bhyve_driver)
|
||||
- return;
|
||||
-
|
||||
- bhyveAutostartDomains(bhyve_driver);
|
||||
-}
|
||||
-
|
||||
static int
|
||||
bhyveConnectGetMaxVcpus(virConnectPtr conn,
|
||||
const char *type)
|
||||
@@ -1713,7 +1706,6 @@ static virConnectDriver bhyveConnectDriver = {
|
||||
static virStateDriver bhyveStateDriver = {
|
||||
.name = "bhyve",
|
||||
.stateInitialize = bhyveStateInitialize,
|
||||
- .stateAutoStart = bhyveStateAutoStart,
|
||||
.stateCleanup = bhyveStateCleanup,
|
||||
};
|
||||
|
||||
--
|
||||
2.22.0
|
||||
|
@ -0,0 +1,67 @@
|
||||
From dd083516c7057ee50e59290643634156daf0773b Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <dd083516c7057ee50e59290643634156daf0773b@dist-git>
|
||||
From: Yi Min Zhao <zyimin@linux.ibm.com>
|
||||
Date: Mon, 8 Apr 2019 10:57:18 +0200
|
||||
Subject: [PATCH] conf: Add definitions for 'uid' and 'fid' PCI address
|
||||
attributes
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Add zPCI definitions in preparation of extending the PCI address
|
||||
with parameters uid (user-defined identifier) and fid (PCI function
|
||||
identifier).
|
||||
|
||||
Signed-off-by: Yi Min Zhao <zyimin@linux.ibm.com>
|
||||
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
||||
Reviewed-by: Stefan Zimmermann <stzi@linux.ibm.com>
|
||||
Reviewed-by: Bjoern Walk <bwalk@linux.ibm.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
|
||||
|
||||
(cherry-picked from commit 30522c78c11d9ff6c6c177dfca4a0da8057095fe)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1508149
|
||||
|
||||
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
|
||||
Message-Id: <20190408085732.28684-2-abologna@redhat.com>
|
||||
Reviewed-by: Laine Stump <laine@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
cfg.mk | 1 +
|
||||
src/util/virpci.h | 7 +++++++
|
||||
2 files changed, 8 insertions(+)
|
||||
|
||||
diff --git a/cfg.mk b/cfg.mk
|
||||
index e3e94bf6f0..7fd2b1dcb6 100644
|
||||
--- a/cfg.mk
|
||||
+++ b/cfg.mk
|
||||
@@ -472,6 +472,7 @@ sc_prohibit_canonicalize_file_name:
|
||||
# Insist on correct types for [pug]id.
|
||||
sc_correct_id_types:
|
||||
@prohibit='\<(int|long) *[pug]id\>' \
|
||||
+ exclude='exempt from syntax-check' \
|
||||
halt='use pid_t for pid, uid_t for uid, gid_t for gid' \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
diff --git a/src/util/virpci.h b/src/util/virpci.h
|
||||
index 794b7e59db..01df652b86 100644
|
||||
--- a/src/util/virpci.h
|
||||
+++ b/src/util/virpci.h
|
||||
@@ -36,6 +36,13 @@ typedef virPCIDeviceAddress *virPCIDeviceAddressPtr;
|
||||
typedef struct _virPCIDeviceList virPCIDeviceList;
|
||||
typedef virPCIDeviceList *virPCIDeviceListPtr;
|
||||
|
||||
+typedef struct _virZPCIDeviceAddress virZPCIDeviceAddress;
|
||||
+typedef virZPCIDeviceAddress *virZPCIDeviceAddressPtr;
|
||||
+struct _virZPCIDeviceAddress {
|
||||
+ unsigned int uid; /* exempt from syntax-check */
|
||||
+ unsigned int fid;
|
||||
+};
|
||||
+
|
||||
struct _virPCIDeviceAddress {
|
||||
unsigned int domain;
|
||||
unsigned int bus;
|
||||
--
|
||||
2.22.0
|
||||
|
76
SOURCES/libvirt-conf-Add-validation-of-input-devices.patch
Normal file
76
SOURCES/libvirt-conf-Add-validation-of-input-devices.patch
Normal file
@ -0,0 +1,76 @@
|
||||
From c2afbedc310ac1a65a5ee96c8fa4103e926483c4 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <c2afbedc310ac1a65a5ee96c8fa4103e926483c4@dist-git>
|
||||
From: Han Han <hhan@redhat.com>
|
||||
Date: Tue, 28 Aug 2018 10:30:51 +0200
|
||||
Subject: [PATCH] conf: Add validation of input devices
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1591151
|
||||
|
||||
Add function virDomainInputDefValidate to validate input devices.
|
||||
Make sure evdev attribute of source element is not used by mouse,
|
||||
keyboard, and tablet input device.
|
||||
|
||||
Signed-off-by: Han Han <hhan@redhat.com>
|
||||
Reviewed-by: John Ferlan <jferlan@redhat.com>
|
||||
(cherry picked from commit deb057fd364cb57614c6dea7b05c247231f9ae4f)
|
||||
Signed-off-by: Ján Tomko <jtomko@redhat.com>
|
||||
|
||||
https: //bugzilla.redhat.com/show_bug.cgi?id=1591240
|
||||
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
|
||||
---
|
||||
src/conf/domain_conf.c | 27 ++++++++++++++++++++++++++-
|
||||
1 file changed, 26 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
||||
index 51a79ad8b1..16e52d149d 100644
|
||||
--- a/src/conf/domain_conf.c
|
||||
+++ b/src/conf/domain_conf.c
|
||||
@@ -5760,6 +5760,29 @@ virDomainVsockDefValidate(const virDomainVsockDef *vsock)
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static int
|
||||
+virDomainInputDefValidate(const virDomainInputDef *input)
|
||||
+{
|
||||
+ switch ((virDomainInputType) input->type) {
|
||||
+ case VIR_DOMAIN_INPUT_TYPE_MOUSE:
|
||||
+ case VIR_DOMAIN_INPUT_TYPE_TABLET:
|
||||
+ case VIR_DOMAIN_INPUT_TYPE_KBD:
|
||||
+ case VIR_DOMAIN_INPUT_TYPE_LAST:
|
||||
+ if (input->source.evdev) {
|
||||
+ virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||
+ _("setting source evdev path only supported for "
|
||||
+ "passthrough input devices"));
|
||||
+ return -1;
|
||||
+ }
|
||||
+ break;
|
||||
+
|
||||
+ case VIR_DOMAIN_INPUT_TYPE_PASSTHROUGH:
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
|
||||
static int
|
||||
virDomainDeviceDefValidateInternal(const virDomainDeviceDef *dev,
|
||||
@@ -5799,9 +5822,11 @@ virDomainDeviceDefValidateInternal(const virDomainDeviceDef *dev,
|
||||
case VIR_DOMAIN_DEVICE_VSOCK:
|
||||
return virDomainVsockDefValidate(dev->data.vsock);
|
||||
|
||||
+ case VIR_DOMAIN_DEVICE_INPUT:
|
||||
+ return virDomainInputDefValidate(dev->data.input);
|
||||
+
|
||||
case VIR_DOMAIN_DEVICE_LEASE:
|
||||
case VIR_DOMAIN_DEVICE_FS:
|
||||
- case VIR_DOMAIN_DEVICE_INPUT:
|
||||
case VIR_DOMAIN_DEVICE_SOUND:
|
||||
case VIR_DOMAIN_DEVICE_WATCHDOG:
|
||||
case VIR_DOMAIN_DEVICE_GRAPHICS:
|
||||
--
|
||||
2.18.0
|
||||
|
@ -0,0 +1,527 @@
|
||||
From 87e3a5f2f797c79516a560ddc224074c834ef528 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <87e3a5f2f797c79516a560ddc224074c834ef528@dist-git>
|
||||
From: Yi Min Zhao <zyimin@linux.ibm.com>
|
||||
Date: Mon, 8 Apr 2019 10:57:27 +0200
|
||||
Subject: [PATCH] conf: Allocate/release 'uid' and 'fid' in PCI address
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This patch adds new functions for reservation, assignment and release
|
||||
to handle the uid/fid. If the uid/fid is defined in the domain XML,
|
||||
they will be reserved directly in the collecting phase. If any of them
|
||||
is not defined, we will find out an available value for them from the
|
||||
zPCI address hashtable, and reserve them. For the hotplug case there
|
||||
might not be a zPCI definition. So allocate and reserve uid/fid the
|
||||
case. Assign if needed and reserve uid/fid for the defined case.
|
||||
|
||||
Signed-off-by: Yi Min Zhao <zyimin@linux.ibm.com>
|
||||
Reviewed-by: Bjoern Walk <bwalk@linux.ibm.com>
|
||||
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
||||
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
|
||||
|
||||
(cherry picked from commit f183b87fc1dbcc6446ac3c1cef9cdd345b9725fb)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1508149
|
||||
|
||||
Conflicts:
|
||||
|
||||
* src/libvirt_private.syms
|
||||
+ several symbols are not present in the list
|
||||
- missing 9ad119f4db5, ab3f781a10c, edeef779585, b899726faa5
|
||||
|
||||
* src/qemu/qemu_domain_address.c
|
||||
+ the old name for virDeviceInfoPCIAddressIsPresent() is used
|
||||
- missing 76151a53a100
|
||||
|
||||
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
|
||||
Message-Id: <20190408085732.28684-11-abologna@redhat.com>
|
||||
Reviewed-by: Laine Stump <laine@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
src/conf/device_conf.c | 16 +++
|
||||
src/conf/device_conf.h | 3 +
|
||||
src/conf/domain_addr.c | 244 +++++++++++++++++++++++++++++++++
|
||||
src/conf/domain_addr.h | 12 ++
|
||||
src/libvirt_private.syms | 5 +
|
||||
src/qemu/qemu_domain_address.c | 59 +++++++-
|
||||
6 files changed, 338 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c
|
||||
index cadac32603..76370d30a2 100644
|
||||
--- a/src/conf/device_conf.c
|
||||
+++ b/src/conf/device_conf.c
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "viruuid.h"
|
||||
#include "virbuffer.h"
|
||||
#include "device_conf.h"
|
||||
+#include "domain_addr.h"
|
||||
#include "virstring.h"
|
||||
|
||||
#define VIR_FROM_THIS VIR_FROM_DEVICE
|
||||
@@ -230,6 +231,21 @@ int virPCIDeviceAddressIsValid(virPCIDeviceAddressPtr addr,
|
||||
}
|
||||
|
||||
|
||||
+bool
|
||||
+virDeviceInfoPCIAddressExtensionIsWanted(const virDomainDeviceInfo *info)
|
||||
+{
|
||||
+ return (info->addr.pci.extFlags & VIR_PCI_ADDRESS_EXTENSION_ZPCI) &&
|
||||
+ virZPCIDeviceAddressIsEmpty(&info->addr.pci.zpci);
|
||||
+}
|
||||
+
|
||||
+bool
|
||||
+virDeviceInfoPCIAddressExtensionIsPresent(const virDomainDeviceInfo *info)
|
||||
+{
|
||||
+ return (info->addr.pci.extFlags & VIR_PCI_ADDRESS_EXTENSION_ZPCI) &&
|
||||
+ !virZPCIDeviceAddressIsEmpty(&info->addr.pci.zpci);
|
||||
+}
|
||||
+
|
||||
+
|
||||
int
|
||||
virPCIDeviceAddressParseXML(xmlNodePtr node,
|
||||
virPCIDeviceAddressPtr addr)
|
||||
diff --git a/src/conf/device_conf.h b/src/conf/device_conf.h
|
||||
index c79066ec02..6bef2f093a 100644
|
||||
--- a/src/conf/device_conf.h
|
||||
+++ b/src/conf/device_conf.h
|
||||
@@ -214,6 +214,9 @@ virDeviceInfoPCIAddressPresent(const virDomainDeviceInfo *info)
|
||||
!virPCIDeviceAddressIsEmpty(&info->addr.pci);
|
||||
}
|
||||
|
||||
+bool virDeviceInfoPCIAddressExtensionIsWanted(const virDomainDeviceInfo *info);
|
||||
+bool virDeviceInfoPCIAddressExtensionIsPresent(const virDomainDeviceInfo *info);
|
||||
+
|
||||
int virPCIDeviceAddressParseXML(xmlNodePtr node,
|
||||
virPCIDeviceAddressPtr addr);
|
||||
|
||||
diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c
|
||||
index 9e0a0fdf95..a58910c394 100644
|
||||
--- a/src/conf/domain_addr.c
|
||||
+++ b/src/conf/domain_addr.c
|
||||
@@ -33,6 +33,238 @@
|
||||
|
||||
VIR_LOG_INIT("conf.domain_addr");
|
||||
|
||||
+static int
|
||||
+virDomainZPCIAddressReserveId(virHashTablePtr set,
|
||||
+ unsigned int id,
|
||||
+ const char *name)
|
||||
+{
|
||||
+ if (virHashLookup(set, &id)) {
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
+ _("zPCI %s %o is already reserved"),
|
||||
+ name, id);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ if (virHashAddEntry(set, &id, (void*)1) < 0) {
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
+ _("Failed to reserve %s %o"),
|
||||
+ name, id);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static int
|
||||
+virDomainZPCIAddressReserveUid(virHashTablePtr set,
|
||||
+ virZPCIDeviceAddressPtr addr)
|
||||
+{
|
||||
+ return virDomainZPCIAddressReserveId(set, addr->uid, "uid");
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static int
|
||||
+virDomainZPCIAddressReserveFid(virHashTablePtr set,
|
||||
+ virZPCIDeviceAddressPtr addr)
|
||||
+{
|
||||
+ return virDomainZPCIAddressReserveId(set, addr->fid, "fid");
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static int
|
||||
+virDomainZPCIAddressAssignId(virHashTablePtr set,
|
||||
+ unsigned int *id,
|
||||
+ unsigned int min,
|
||||
+ unsigned int max,
|
||||
+ const char *name)
|
||||
+{
|
||||
+ while (virHashLookup(set, &min)) {
|
||||
+ if (min == max) {
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
+ _("There is no more free %s."),
|
||||
+ name);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ ++min;
|
||||
+ }
|
||||
+ *id = min;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static int
|
||||
+virDomainZPCIAddressAssignUid(virHashTablePtr set,
|
||||
+ virZPCIDeviceAddressPtr addr)
|
||||
+{
|
||||
+ return virDomainZPCIAddressAssignId(set, &addr->uid, 1,
|
||||
+ VIR_DOMAIN_DEVICE_ZPCI_MAX_UID, "uid");
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static int
|
||||
+virDomainZPCIAddressAssignFid(virHashTablePtr set,
|
||||
+ virZPCIDeviceAddressPtr addr)
|
||||
+{
|
||||
+ return virDomainZPCIAddressAssignId(set, &addr->fid, 0,
|
||||
+ VIR_DOMAIN_DEVICE_ZPCI_MAX_FID, "fid");
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static void
|
||||
+virDomainZPCIAddressReleaseId(virHashTablePtr set,
|
||||
+ unsigned int *id,
|
||||
+ const char *name)
|
||||
+{
|
||||
+ if (virHashRemoveEntry(set, id) < 0) {
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
+ _("Release %s %o failed"),
|
||||
+ name, *id);
|
||||
+ }
|
||||
+
|
||||
+ *id = 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static void
|
||||
+virDomainZPCIAddressReleaseUid(virHashTablePtr set,
|
||||
+ virZPCIDeviceAddressPtr addr)
|
||||
+{
|
||||
+ virDomainZPCIAddressReleaseId(set, &addr->uid, "uid");
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static void
|
||||
+virDomainZPCIAddressReleaseFid(virHashTablePtr set,
|
||||
+ virZPCIDeviceAddressPtr addr)
|
||||
+{
|
||||
+ virDomainZPCIAddressReleaseId(set, &addr->fid, "fid");
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static void
|
||||
+virDomainZPCIAddressReleaseIds(virDomainZPCIAddressIdsPtr zpciIds,
|
||||
+ virZPCIDeviceAddressPtr addr)
|
||||
+{
|
||||
+ if (!zpciIds || virZPCIDeviceAddressIsEmpty(addr))
|
||||
+ return;
|
||||
+
|
||||
+ virDomainZPCIAddressReleaseUid(zpciIds->uids, addr);
|
||||
+
|
||||
+ virDomainZPCIAddressReleaseFid(zpciIds->fids, addr);
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static int
|
||||
+virDomainZPCIAddressReserveNextUid(virHashTablePtr uids,
|
||||
+ virZPCIDeviceAddressPtr zpci)
|
||||
+{
|
||||
+ if (virDomainZPCIAddressAssignUid(uids, zpci) < 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ if (virDomainZPCIAddressReserveUid(uids, zpci) < 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static int
|
||||
+virDomainZPCIAddressReserveNextFid(virHashTablePtr fids,
|
||||
+ virZPCIDeviceAddressPtr zpci)
|
||||
+{
|
||||
+ if (virDomainZPCIAddressAssignFid(fids, zpci) < 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ if (virDomainZPCIAddressReserveFid(fids, zpci) < 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static int
|
||||
+virDomainZPCIAddressReserveAddr(virDomainZPCIAddressIdsPtr zpciIds,
|
||||
+ virZPCIDeviceAddressPtr addr)
|
||||
+{
|
||||
+ if (virDomainZPCIAddressReserveUid(zpciIds->uids, addr) < 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ if (virDomainZPCIAddressReserveFid(zpciIds->fids, addr) < 0) {
|
||||
+ virDomainZPCIAddressReleaseUid(zpciIds->uids, addr);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static int
|
||||
+virDomainZPCIAddressReserveNextAddr(virDomainZPCIAddressIdsPtr zpciIds,
|
||||
+ virZPCIDeviceAddressPtr addr)
|
||||
+{
|
||||
+ if (virDomainZPCIAddressReserveNextUid(zpciIds->uids, addr) < 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ if (virDomainZPCIAddressReserveNextFid(zpciIds->fids, addr) < 0) {
|
||||
+ virDomainZPCIAddressReleaseUid(zpciIds->uids, addr);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+int
|
||||
+virDomainPCIAddressExtensionReserveAddr(virDomainPCIAddressSetPtr addrs,
|
||||
+ virPCIDeviceAddressPtr addr)
|
||||
+{
|
||||
+ if (addr->extFlags & VIR_PCI_ADDRESS_EXTENSION_ZPCI) {
|
||||
+ /* Reserve uid/fid to ZPCI device which has defined uid/fid
|
||||
+ * in the domain.
|
||||
+ */
|
||||
+ return virDomainZPCIAddressReserveAddr(addrs->zpciIds, &addr->zpci);
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+int
|
||||
+virDomainPCIAddressExtensionReserveNextAddr(virDomainPCIAddressSetPtr addrs,
|
||||
+ virPCIDeviceAddressPtr addr)
|
||||
+{
|
||||
+ if (addr->extFlags & VIR_PCI_ADDRESS_EXTENSION_ZPCI) {
|
||||
+ virZPCIDeviceAddress zpci = { 0 };
|
||||
+
|
||||
+ if (virDomainZPCIAddressReserveNextAddr(addrs->zpciIds, &zpci) < 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ if (!addrs->dryRun)
|
||||
+ addr->zpci = zpci;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+virDomainPCIAddressExtensionEnsureAddr(virDomainPCIAddressSetPtr addrs,
|
||||
+ virPCIDeviceAddressPtr addr)
|
||||
+{
|
||||
+ if (addr->extFlags & VIR_PCI_ADDRESS_EXTENSION_ZPCI) {
|
||||
+ virZPCIDeviceAddressPtr zpci = &addr->zpci;
|
||||
+
|
||||
+ if (virZPCIDeviceAddressIsEmpty(zpci))
|
||||
+ return virDomainZPCIAddressReserveNextAddr(addrs->zpciIds, zpci);
|
||||
+ else
|
||||
+ return virDomainZPCIAddressReserveAddr(addrs->zpciIds, zpci);
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
virDomainPCIConnectFlags
|
||||
virDomainPCIControllerModelToConnectType(virDomainControllerModelPCI model)
|
||||
{
|
||||
@@ -729,12 +961,24 @@ virDomainPCIAddressEnsureAddr(virDomainPCIAddressSetPtr addrs,
|
||||
ret = virDomainPCIAddressReserveNextAddr(addrs, dev, flags, -1);
|
||||
}
|
||||
|
||||
+ dev->addr.pci.extFlags = dev->pciAddrExtFlags;
|
||||
+ ret = virDomainPCIAddressExtensionEnsureAddr(addrs, &dev->addr.pci);
|
||||
+
|
||||
cleanup:
|
||||
VIR_FREE(addrStr);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
+void
|
||||
+virDomainPCIAddressExtensionReleaseAddr(virDomainPCIAddressSetPtr addrs,
|
||||
+ virPCIDeviceAddressPtr addr)
|
||||
+{
|
||||
+ if (addr->extFlags & VIR_PCI_ADDRESS_EXTENSION_ZPCI)
|
||||
+ virDomainZPCIAddressReleaseIds(addrs->zpciIds, &addr->zpci);
|
||||
+}
|
||||
+
|
||||
+
|
||||
void
|
||||
virDomainPCIAddressReleaseAddr(virDomainPCIAddressSetPtr addrs,
|
||||
virPCIDeviceAddressPtr addr)
|
||||
diff --git a/src/conf/domain_addr.h b/src/conf/domain_addr.h
|
||||
index b01e6b9d20..e5ce4868d5 100644
|
||||
--- a/src/conf/domain_addr.h
|
||||
+++ b/src/conf/domain_addr.h
|
||||
@@ -166,6 +166,14 @@ bool virDomainPCIAddressSlotInUse(virDomainPCIAddressSetPtr addrs,
|
||||
virPCIDeviceAddressPtr addr)
|
||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
||||
|
||||
+int virDomainPCIAddressExtensionReserveAddr(virDomainPCIAddressSetPtr addrs,
|
||||
+ virPCIDeviceAddressPtr addr)
|
||||
+ ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
||||
+
|
||||
+int virDomainPCIAddressExtensionReserveNextAddr(virDomainPCIAddressSetPtr addrs,
|
||||
+ virPCIDeviceAddressPtr addr)
|
||||
+ ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
||||
+
|
||||
int virDomainPCIAddressReserveAddr(virDomainPCIAddressSetPtr addrs,
|
||||
virPCIDeviceAddressPtr addr,
|
||||
virDomainPCIConnectFlags flags,
|
||||
@@ -187,6 +195,10 @@ void virDomainPCIAddressReleaseAddr(virDomainPCIAddressSetPtr addrs,
|
||||
virPCIDeviceAddressPtr addr)
|
||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
||||
|
||||
+void virDomainPCIAddressExtensionReleaseAddr(virDomainPCIAddressSetPtr addrs,
|
||||
+ virPCIDeviceAddressPtr addr)
|
||||
+ ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
||||
+
|
||||
void virDomainPCIAddressSetAllMulti(virDomainDefPtr def)
|
||||
ATTRIBUTE_NONNULL(1);
|
||||
|
||||
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
|
||||
index b2a2a1f265..ee7625b0f3 100644
|
||||
--- a/src/libvirt_private.syms
|
||||
+++ b/src/libvirt_private.syms
|
||||
@@ -93,6 +93,8 @@ virCPUModeTypeToString;
|
||||
|
||||
|
||||
# conf/device_conf.h
|
||||
+virDeviceInfoPCIAddressExtensionIsPresent;
|
||||
+virDeviceInfoPCIAddressExtensionIsWanted;
|
||||
virDomainDeviceInfoAddressIsEqual;
|
||||
virDomainDeviceInfoCopy;
|
||||
virInterfaceLinkFormat;
|
||||
@@ -114,6 +116,9 @@ virDomainPCIAddressAsString;
|
||||
virDomainPCIAddressBusIsFullyReserved;
|
||||
virDomainPCIAddressBusSetModel;
|
||||
virDomainPCIAddressEnsureAddr;
|
||||
+virDomainPCIAddressExtensionReleaseAddr;
|
||||
+virDomainPCIAddressExtensionReserveAddr;
|
||||
+virDomainPCIAddressExtensionReserveNextAddr;
|
||||
virDomainPCIAddressReleaseAddr;
|
||||
virDomainPCIAddressReserveAddr;
|
||||
virDomainPCIAddressReserveNextAddr;
|
||||
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
|
||||
index ba870d56b1..8338241cba 100644
|
||||
--- a/src/qemu/qemu_domain_address.c
|
||||
+++ b/src/qemu/qemu_domain_address.c
|
||||
@@ -1405,6 +1405,24 @@ qemuDomainPCIAddressReserveNextAddr(virDomainPCIAddressSetPtr addrs,
|
||||
}
|
||||
|
||||
|
||||
+static int
|
||||
+qemuDomainAssignPCIAddressExtension(virDomainDefPtr def ATTRIBUTE_UNUSED,
|
||||
+ virDomainDeviceDefPtr device ATTRIBUTE_UNUSED,
|
||||
+ virDomainDeviceInfoPtr info,
|
||||
+ void *opaque)
|
||||
+{
|
||||
+ virDomainPCIAddressSetPtr addrs = opaque;
|
||||
+ virPCIDeviceAddressPtr addr = &info->addr.pci;
|
||||
+
|
||||
+ if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI)
|
||||
+ addr->extFlags = info->pciAddrExtFlags;
|
||||
+
|
||||
+ if (virDeviceInfoPCIAddressExtensionIsWanted(info))
|
||||
+ return virDomainPCIAddressExtensionReserveNextAddr(addrs, addr);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static int
|
||||
qemuDomainCollectPCIAddress(virDomainDefPtr def ATTRIBUTE_UNUSED,
|
||||
virDomainDeviceDefPtr device,
|
||||
@@ -1498,6 +1516,31 @@ qemuDomainCollectPCIAddress(virDomainDefPtr def ATTRIBUTE_UNUSED,
|
||||
return ret;
|
||||
}
|
||||
|
||||
+static int
|
||||
+qemuDomainCollectPCIAddressExtension(virDomainDefPtr def ATTRIBUTE_UNUSED,
|
||||
+ virDomainDeviceDefPtr device,
|
||||
+ virDomainDeviceInfoPtr info,
|
||||
+ void *opaque)
|
||||
+{
|
||||
+ virDomainPCIAddressSetPtr addrs = opaque;
|
||||
+ virPCIDeviceAddressPtr addr = &info->addr.pci;
|
||||
+
|
||||
+ if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI)
|
||||
+ addr->extFlags = info->pciAddrExtFlags;
|
||||
+
|
||||
+ if (!virDeviceInfoPCIAddressExtensionIsPresent(info) ||
|
||||
+ ((device->type == VIR_DOMAIN_DEVICE_HOSTDEV) &&
|
||||
+ (device->data.hostdev->parent.type != VIR_DOMAIN_DEVICE_NONE))) {
|
||||
+ /* If a hostdev has a parent, its info will be a part of the
|
||||
+ * parent, and will have its address collected during the scan
|
||||
+ * of the parent's device type.
|
||||
+ */
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ return virDomainPCIAddressExtensionReserveAddr(addrs, addr);
|
||||
+}
|
||||
+
|
||||
static virDomainPCIAddressSetPtr
|
||||
qemuDomainPCIAddressSetCreate(virDomainDefPtr def,
|
||||
virQEMUCapsPtr qemuCaps,
|
||||
@@ -1589,6 +1632,12 @@ qemuDomainPCIAddressSetCreate(virDomainDefPtr def,
|
||||
if (virDomainDeviceInfoIterate(def, qemuDomainCollectPCIAddress, addrs) < 0)
|
||||
goto error;
|
||||
|
||||
+ if (virDomainDeviceInfoIterate(def,
|
||||
+ qemuDomainCollectPCIAddressExtension,
|
||||
+ addrs) < 0) {
|
||||
+ goto error;
|
||||
+ }
|
||||
+
|
||||
return addrs;
|
||||
|
||||
error:
|
||||
@@ -2590,6 +2639,9 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def,
|
||||
if (qemuDomainAssignDevicePCISlots(def, qemuCaps, addrs) < 0)
|
||||
goto cleanup;
|
||||
|
||||
+ if (virDomainDeviceInfoIterate(def, qemuDomainAssignPCIAddressExtension, addrs) < 0)
|
||||
+ goto cleanup;
|
||||
+
|
||||
/* Only for *new* domains with pcie-root (and no other
|
||||
* manually specified PCI controllers in the definition): If,
|
||||
* after assigning addresses/reserving slots for all devices,
|
||||
@@ -2684,6 +2736,9 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def,
|
||||
if (qemuDomainAssignDevicePCISlots(def, qemuCaps, addrs) < 0)
|
||||
goto cleanup;
|
||||
|
||||
+ if (virDomainDeviceInfoIterate(def, qemuDomainAssignPCIAddressExtension, addrs) < 0)
|
||||
+ goto cleanup;
|
||||
+
|
||||
/* set multi attribute for devices at function 0 of
|
||||
* any slot that has multiple functions in use
|
||||
*/
|
||||
@@ -3143,8 +3198,10 @@ qemuDomainReleaseDeviceAddress(virDomainObjPtr vm,
|
||||
if (!devstr)
|
||||
devstr = info->alias;
|
||||
|
||||
- if (virDeviceInfoPCIAddressPresent(info))
|
||||
+ if (virDeviceInfoPCIAddressPresent(info)) {
|
||||
virDomainPCIAddressReleaseAddr(priv->pciaddrs, &info->addr.pci);
|
||||
+ virDomainPCIAddressExtensionReleaseAddr(priv->pciaddrs, &info->addr.pci);
|
||||
+ }
|
||||
|
||||
if (virDomainUSBAddressRelease(priv->usbaddrs, info) < 0)
|
||||
VIR_WARN("Unable to release USB address on %s", NULLSTR(devstr));
|
||||
--
|
||||
2.22.0
|
||||
|
@ -0,0 +1,69 @@
|
||||
From 2e3774564235a185a2cc4b7a22c17de17498db68 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <2e3774564235a185a2cc4b7a22c17de17498db68@dist-git>
|
||||
From: Michal Privoznik <mprivozn@redhat.com>
|
||||
Date: Thu, 18 Apr 2019 19:36:31 +0200
|
||||
Subject: [PATCH] conf: Expose virDomainSCSIDriveAddressIsUsed
|
||||
|
||||
RHEl-7.7: https://bugzilla.redhat.com/show_bug.cgi?id=1692296
|
||||
RHEL-8.1.0: https://bugzilla.redhat.com/show_bug.cgi?id=1692354
|
||||
|
||||
This function checks if given drive address is already present in
|
||||
passed domain definition. Expose the function as it will be used
|
||||
shortly.
|
||||
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Tested-by: Daniel Henrique Barboza <danielhb413@gmail.com>
|
||||
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
|
||||
(cherry picked from commit 89237d534f0fe950d06a2081089154160c6c2224)
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Message-Id: <ef6c1d914a1f6bf0cdb44006b9adf6edf7bb4d41.1555608962.git.mprivozn@redhat.com>
|
||||
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
---
|
||||
src/conf/domain_conf.c | 2 +-
|
||||
src/conf/domain_conf.h | 4 ++++
|
||||
src/libvirt_private.syms | 1 +
|
||||
3 files changed, 6 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
||||
index d431441f62..e62f78471c 100644
|
||||
--- a/src/conf/domain_conf.c
|
||||
+++ b/src/conf/domain_conf.c
|
||||
@@ -4404,7 +4404,7 @@ virDomainDriveAddressIsUsedByHostdev(const virDomainDef *def,
|
||||
* Return true if the SCSI drive address is already in use, false
|
||||
* otherwise.
|
||||
*/
|
||||
-static bool
|
||||
+bool
|
||||
virDomainSCSIDriveAddressIsUsed(const virDomainDef *def,
|
||||
const virDomainDeviceDriveAddress *addr)
|
||||
{
|
||||
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
|
||||
index f05fca284f..dbccf2cf24 100644
|
||||
--- a/src/conf/domain_conf.h
|
||||
+++ b/src/conf/domain_conf.h
|
||||
@@ -2789,6 +2789,10 @@ virDomainXMLNamespacePtr
|
||||
virDomainXMLOptionGetNamespace(virDomainXMLOptionPtr xmlopt)
|
||||
ATTRIBUTE_NONNULL(1);
|
||||
|
||||
+bool
|
||||
+virDomainSCSIDriveAddressIsUsed(const virDomainDef *def,
|
||||
+ const virDomainDeviceDriveAddress *addr);
|
||||
+
|
||||
int virDomainDefPostParse(virDomainDefPtr def,
|
||||
virCapsPtr caps,
|
||||
unsigned int parseFlags,
|
||||
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
|
||||
index 624151056a..df27ac4b3a 100644
|
||||
--- a/src/libvirt_private.syms
|
||||
+++ b/src/libvirt_private.syms
|
||||
@@ -520,6 +520,7 @@ virDomainRunningReasonTypeToString;
|
||||
virDomainSaveConfig;
|
||||
virDomainSaveStatus;
|
||||
virDomainSaveXML;
|
||||
+virDomainSCSIDriveAddressIsUsed;
|
||||
virDomainSeclabelTypeFromString;
|
||||
virDomainSeclabelTypeToString;
|
||||
virDomainShmemDefEquals;
|
||||
--
|
||||
2.21.0
|
||||
|
@ -0,0 +1,35 @@
|
||||
From b1c91c78451c59b0ebe3aafa17eef764e69be28c Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <b1c91c78451c59b0ebe3aafa17eef764e69be28c@dist-git>
|
||||
From: Han Han <hhan@redhat.com>
|
||||
Date: Tue, 31 Jul 2018 10:42:27 +0200
|
||||
Subject: [PATCH] conf: Fix a error msg typo in virDomainVideoDefValidate
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1607825
|
||||
|
||||
Introduced by commit d48813e8.
|
||||
|
||||
Signed-off-by: Han Han <hhan@redhat.com>
|
||||
Reviewed-by: Erik Skultety <eskultet@redhat.com>
|
||||
(cherry picked from commit d1c4480390da7243e37daee37f8a40cb439a6a7c)
|
||||
Signed-off-by: Erik Skultety <eskultet@redhat.com>
|
||||
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
---
|
||||
src/conf/domain_conf.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
||||
index 23288aa01b..a05aad056d 100644
|
||||
--- a/src/conf/domain_conf.c
|
||||
+++ b/src/conf/domain_conf.c
|
||||
@@ -5697,7 +5697,7 @@ virDomainVideoDefValidate(const virDomainVideoDef *video,
|
||||
if (def->videos[i]->type == VIR_DOMAIN_VIDEO_TYPE_NONE &&
|
||||
def->nvideos > 1) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
- _("a '%s' video type must be the only video device "
|
||||
+ _("a 'none' video type must be the only video device "
|
||||
"defined for the domain"));
|
||||
return -1;
|
||||
}
|
||||
--
|
||||
2.18.0
|
||||
|
113
SOURCES/libvirt-conf-Fix-check-for-chardev-source-path.patch
Normal file
113
SOURCES/libvirt-conf-Fix-check-for-chardev-source-path.patch
Normal file
@ -0,0 +1,113 @@
|
||||
From 27213f01f9320cf0fec49980f78a100e64025ba4 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <27213f01f9320cf0fec49980f78a100e64025ba4@dist-git>
|
||||
From: Andrea Bolognani <abologna@redhat.com>
|
||||
Date: Fri, 7 Sep 2018 17:53:32 +0200
|
||||
Subject: [PATCH] conf: Fix check for chardev source path
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Attempting to use a chardev definition like
|
||||
|
||||
<serial type='unix'>
|
||||
<target type='isa-serial'/>
|
||||
</serial>
|
||||
|
||||
correctly results in an error being reported, since the source
|
||||
path - a required piece of information - is missing; however,
|
||||
the very similar
|
||||
|
||||
<serial type='unix'>
|
||||
<target type='pci-serial'/>
|
||||
</serial>
|
||||
|
||||
was happily accepted by libvirt, only to result in libvirtd
|
||||
crashing as soon as the guest was started.
|
||||
|
||||
The issue was caused by checking the chardev's targetType
|
||||
against whitelisted values from virDomainChrChannelTargetType
|
||||
without first checking the chardev's deviceType to make sure
|
||||
it is actually a channel, for which the check makes sense,
|
||||
rather than a different type of chardev.
|
||||
|
||||
The only reason this wasn't spotted earlier is that the
|
||||
whitelisted values just so happen to correspond to USB and
|
||||
PCI serial devices and Xen and UML consoles respectively,
|
||||
all of which are fairly uncommon.
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1609720
|
||||
|
||||
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit 614193fac67445a7e92bf620ffef726ed1bd6f07)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1609723
|
||||
|
||||
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
|
||||
Reviewed-by: Erik Skultety <eskultet@redhat.com>
|
||||
---
|
||||
src/conf/domain_conf.c | 11 +++++++----
|
||||
.../serial-unix-missing-source.xml | 15 +++++++++++++++
|
||||
tests/qemuxml2argvtest.c | 1 +
|
||||
3 files changed, 23 insertions(+), 4 deletions(-)
|
||||
create mode 100644 tests/qemuxml2argvdata/serial-unix-missing-source.xml
|
||||
|
||||
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
||||
index a881b43b51..240b33f28c 100644
|
||||
--- a/src/conf/domain_conf.c
|
||||
+++ b/src/conf/domain_conf.c
|
||||
@@ -5523,11 +5523,14 @@ virDomainChrSourceDefValidate(const virDomainChrSourceDef *def,
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_CHR_TYPE_UNIX:
|
||||
- /* path can be auto generated */
|
||||
+ /* The source path can be auto generated for certain specific
|
||||
+ * types of channels, but in most cases we should report an
|
||||
+ * error if the user didn't provide it */
|
||||
if (!def->data.nix.path &&
|
||||
- (!chr_def ||
|
||||
- (chr_def->targetType != VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_XEN &&
|
||||
- chr_def->targetType != VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO))) {
|
||||
+ !(chr_def &&
|
||||
+ chr_def->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL &&
|
||||
+ (chr_def->targetType == VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_XEN ||
|
||||
+ chr_def->targetType == VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO))) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("Missing source path attribute for char device"));
|
||||
return -1;
|
||||
diff --git a/tests/qemuxml2argvdata/serial-unix-missing-source.xml b/tests/qemuxml2argvdata/serial-unix-missing-source.xml
|
||||
new file mode 100644
|
||||
index 0000000000..1e1221f12d
|
||||
--- /dev/null
|
||||
+++ b/tests/qemuxml2argvdata/serial-unix-missing-source.xml
|
||||
@@ -0,0 +1,15 @@
|
||||
+<domain type='qemu'>
|
||||
+ <name>guest</name>
|
||||
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||
+ <memory unit='KiB'>1048576</memory>
|
||||
+ <vcpu placement='static'>1</vcpu>
|
||||
+ <os>
|
||||
+ <type arch='aarch64' machine='virt'>hvm</type>
|
||||
+ </os>
|
||||
+ <devices>
|
||||
+ <emulator>/usr/bin/qemu-system-aarch64</emulator>
|
||||
+ <serial type='unix'>
|
||||
+ <target type='pci-serial'/>
|
||||
+ </serial>
|
||||
+ </devices>
|
||||
+</domain>
|
||||
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
|
||||
index 608a2b6ce3..ebe9c8a131 100644
|
||||
--- a/tests/qemuxml2argvtest.c
|
||||
+++ b/tests/qemuxml2argvtest.c
|
||||
@@ -1363,6 +1363,7 @@ mymain(void)
|
||||
DO_TEST("serial-unix-chardev",
|
||||
QEMU_CAPS_DEVICE_ISA_SERIAL);
|
||||
DO_TEST_CAPS_LATEST("serial-unix-chardev");
|
||||
+ DO_TEST_PARSE_ERROR("serial-unix-missing-source", NONE);
|
||||
DO_TEST("serial-tcp-chardev",
|
||||
QEMU_CAPS_DEVICE_ISA_SERIAL);
|
||||
DO_TEST("serial-udp-chardev",
|
||||
--
|
||||
2.19.1
|
||||
|
@ -0,0 +1,241 @@
|
||||
From 7888472ef1d57d992995a16dc7c9ba0fe18562a8 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <7888472ef1d57d992995a16dc7c9ba0fe18562a8@dist-git>
|
||||
From: Yi Min Zhao <zyimin@linux.ibm.com>
|
||||
Date: Mon, 8 Apr 2019 10:57:22 +0200
|
||||
Subject: [PATCH] conf: Introduce address caching for PCI extensions
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This patch provides a caching mechanism for the device address
|
||||
extensions uid and fid on S390. For efficient sparse address allocation,
|
||||
we introduce two hash tables for uid/fid which hold the address set
|
||||
information per domain. Also in order to improve performance of
|
||||
searching available value, we introduce our own callbacks for the two
|
||||
hashtables. In this way, uid/fid is saved in hash key and hash value
|
||||
could be any non-NULL pointer due to no operation on hash value. That is
|
||||
also the reason why we don't introduce hash value free callback.
|
||||
|
||||
Signed-off-by: Yi Min Zhao <zyimin@linux.ibm.com>
|
||||
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
||||
Reviewed-by: Bjoern Walk <bwalk@linux.ibm.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
|
||||
|
||||
(cherry picked from commit 28831e1f1ec001882e907f03f7618f7c00ebc98d)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1508149
|
||||
|
||||
Conflicts:
|
||||
|
||||
* src/conf/domain_addr.h
|
||||
+ context
|
||||
- missing b72183223f3b
|
||||
|
||||
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
|
||||
Message-Id: <20190408085732.28684-6-abologna@redhat.com>
|
||||
Reviewed-by: Laine Stump <laine@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
src/bhyve/bhyve_device.c | 3 +-
|
||||
src/conf/domain_addr.c | 93 +++++++++++++++++++++++++++++++++-
|
||||
src/conf/domain_addr.h | 10 +++-
|
||||
src/qemu/qemu_domain_address.c | 6 ++-
|
||||
4 files changed, 108 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/bhyve/bhyve_device.c b/src/bhyve/bhyve_device.c
|
||||
index 03aa6c93bd..8f0862b0b6 100644
|
||||
--- a/src/bhyve/bhyve_device.c
|
||||
+++ b/src/bhyve/bhyve_device.c
|
||||
@@ -71,7 +71,8 @@ bhyveDomainPCIAddressSetCreate(virDomainDefPtr def, unsigned int nbuses)
|
||||
{
|
||||
virDomainPCIAddressSetPtr addrs;
|
||||
|
||||
- if ((addrs = virDomainPCIAddressSetAlloc(nbuses)) == NULL)
|
||||
+ if ((addrs = virDomainPCIAddressSetAlloc(nbuses,
|
||||
+ VIR_PCI_ADDRESS_EXTENSION_NONE)) == NULL)
|
||||
return NULL;
|
||||
|
||||
if (virDomainPCIAddressBusSetModel(&addrs->buses[0],
|
||||
diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c
|
||||
index 39f22b82eb..3e33549c3d 100644
|
||||
--- a/src/conf/domain_addr.c
|
||||
+++ b/src/conf/domain_addr.c
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "virlog.h"
|
||||
#include "virstring.h"
|
||||
#include "domain_addr.h"
|
||||
+#include "virhashcode.h"
|
||||
|
||||
#define VIR_FROM_THIS VIR_FROM_DOMAIN
|
||||
|
||||
@@ -741,8 +742,93 @@ virDomainPCIAddressReleaseAddr(virDomainPCIAddressSetPtr addrs,
|
||||
addrs->buses[addr->bus].slot[addr->slot].functions &= ~(1 << addr->function);
|
||||
}
|
||||
|
||||
+
|
||||
+static uint32_t
|
||||
+virZPCIAddrKeyCode(const void *name,
|
||||
+ uint32_t seed)
|
||||
+{
|
||||
+ unsigned int value = *((unsigned int *)name);
|
||||
+ return virHashCodeGen(&value, sizeof(value), seed);
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static bool
|
||||
+virZPCIAddrKeyEqual(const void *namea,
|
||||
+ const void *nameb)
|
||||
+{
|
||||
+ return *((unsigned int *)namea) == *((unsigned int *)nameb);
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static void *
|
||||
+virZPCIAddrKeyCopy(const void *name)
|
||||
+{
|
||||
+ unsigned int *copy;
|
||||
+
|
||||
+ if (VIR_ALLOC(copy) < 0)
|
||||
+ return NULL;
|
||||
+
|
||||
+ *copy = *((unsigned int *)name);
|
||||
+ return (void *)copy;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static void
|
||||
+virZPCIAddrKeyFree(void *name)
|
||||
+{
|
||||
+ VIR_FREE(name);
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static void
|
||||
+virDomainPCIAddressSetExtensionFree(virDomainPCIAddressSetPtr addrs)
|
||||
+{
|
||||
+ if (!addrs || !addrs->zpciIds)
|
||||
+ return;
|
||||
+
|
||||
+ virHashFree(addrs->zpciIds->uids);
|
||||
+ virHashFree(addrs->zpciIds->fids);
|
||||
+ VIR_FREE(addrs->zpciIds);
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static int
|
||||
+virDomainPCIAddressSetExtensionAlloc(virDomainPCIAddressSetPtr addrs,
|
||||
+ virPCIDeviceAddressExtensionFlags extFlags)
|
||||
+{
|
||||
+ if (extFlags & VIR_PCI_ADDRESS_EXTENSION_ZPCI) {
|
||||
+ if (addrs->zpciIds)
|
||||
+ return 0;
|
||||
+
|
||||
+ if (VIR_ALLOC(addrs->zpciIds) < 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ if (!(addrs->zpciIds->uids = virHashCreateFull(10, NULL,
|
||||
+ virZPCIAddrKeyCode,
|
||||
+ virZPCIAddrKeyEqual,
|
||||
+ virZPCIAddrKeyCopy,
|
||||
+ virZPCIAddrKeyFree)))
|
||||
+ goto error;
|
||||
+
|
||||
+ if (!(addrs->zpciIds->fids = virHashCreateFull(10, NULL,
|
||||
+ virZPCIAddrKeyCode,
|
||||
+ virZPCIAddrKeyEqual,
|
||||
+ virZPCIAddrKeyCopy,
|
||||
+ virZPCIAddrKeyFree)))
|
||||
+ goto error;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+
|
||||
+ error:
|
||||
+ virDomainPCIAddressSetExtensionFree(addrs);
|
||||
+ return -1;
|
||||
+}
|
||||
+
|
||||
+
|
||||
virDomainPCIAddressSetPtr
|
||||
-virDomainPCIAddressSetAlloc(unsigned int nbuses)
|
||||
+virDomainPCIAddressSetAlloc(unsigned int nbuses,
|
||||
+ virPCIDeviceAddressExtensionFlags extFlags)
|
||||
{
|
||||
virDomainPCIAddressSetPtr addrs;
|
||||
|
||||
@@ -753,6 +839,10 @@ virDomainPCIAddressSetAlloc(unsigned int nbuses)
|
||||
goto error;
|
||||
|
||||
addrs->nbuses = nbuses;
|
||||
+
|
||||
+ if (virDomainPCIAddressSetExtensionAlloc(addrs, extFlags) < 0)
|
||||
+ goto error;
|
||||
+
|
||||
return addrs;
|
||||
|
||||
error:
|
||||
@@ -767,6 +857,7 @@ virDomainPCIAddressSetFree(virDomainPCIAddressSetPtr addrs)
|
||||
if (!addrs)
|
||||
return;
|
||||
|
||||
+ virDomainPCIAddressSetExtensionFree(addrs);
|
||||
VIR_FREE(addrs->buses);
|
||||
VIR_FREE(addrs);
|
||||
}
|
||||
diff --git a/src/conf/domain_addr.h b/src/conf/domain_addr.h
|
||||
index fd06008e26..b01e6b9d20 100644
|
||||
--- a/src/conf/domain_addr.h
|
||||
+++ b/src/conf/domain_addr.h
|
||||
@@ -116,6 +116,12 @@ typedef struct {
|
||||
} virDomainPCIAddressBus;
|
||||
typedef virDomainPCIAddressBus *virDomainPCIAddressBusPtr;
|
||||
|
||||
+typedef struct {
|
||||
+ virHashTablePtr uids;
|
||||
+ virHashTablePtr fids;
|
||||
+} virDomainZPCIAddressIds;
|
||||
+typedef virDomainZPCIAddressIds *virDomainZPCIAddressIdsPtr;
|
||||
+
|
||||
struct _virDomainPCIAddressSet {
|
||||
virDomainPCIAddressBus *buses;
|
||||
size_t nbuses;
|
||||
@@ -125,6 +131,7 @@ struct _virDomainPCIAddressSet {
|
||||
bool areMultipleRootsSupported;
|
||||
/* If true, the guest can use the pcie-to-pci-bridge controller */
|
||||
bool isPCIeToPCIBridgeSupported;
|
||||
+ virDomainZPCIAddressIdsPtr zpciIds;
|
||||
};
|
||||
typedef struct _virDomainPCIAddressSet virDomainPCIAddressSet;
|
||||
typedef virDomainPCIAddressSet *virDomainPCIAddressSetPtr;
|
||||
@@ -132,7 +139,8 @@ typedef virDomainPCIAddressSet *virDomainPCIAddressSetPtr;
|
||||
char *virDomainPCIAddressAsString(virPCIDeviceAddressPtr addr)
|
||||
ATTRIBUTE_NONNULL(1);
|
||||
|
||||
-virDomainPCIAddressSetPtr virDomainPCIAddressSetAlloc(unsigned int nbuses);
|
||||
+virDomainPCIAddressSetPtr virDomainPCIAddressSetAlloc(unsigned int nbuses,
|
||||
+ virPCIDeviceAddressExtensionFlags extFlags);
|
||||
|
||||
void virDomainPCIAddressSetFree(virDomainPCIAddressSetPtr addrs);
|
||||
|
||||
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
|
||||
index 3d01d14b46..ba870d56b1 100644
|
||||
--- a/src/qemu/qemu_domain_address.c
|
||||
+++ b/src/qemu/qemu_domain_address.c
|
||||
@@ -1508,8 +1508,12 @@ qemuDomainPCIAddressSetCreate(virDomainDefPtr def,
|
||||
size_t i;
|
||||
bool hasPCIeRoot = false;
|
||||
virDomainControllerModelPCI defaultModel;
|
||||
+ virPCIDeviceAddressExtensionFlags extFlags = VIR_PCI_ADDRESS_EXTENSION_NONE;
|
||||
|
||||
- if ((addrs = virDomainPCIAddressSetAlloc(nbuses)) == NULL)
|
||||
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_ZPCI))
|
||||
+ extFlags |= VIR_PCI_ADDRESS_EXTENSION_ZPCI;
|
||||
+
|
||||
+ if ((addrs = virDomainPCIAddressSetAlloc(nbuses, extFlags)) == NULL)
|
||||
return NULL;
|
||||
|
||||
addrs->dryRun = dryRun;
|
||||
--
|
||||
2.22.0
|
||||
|
@ -0,0 +1,283 @@
|
||||
From 050eb598af9291f385998cb1127d5bdf83305501 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <050eb598af9291f385998cb1127d5bdf83305501@dist-git>
|
||||
From: Yi Min Zhao <zyimin@linux.ibm.com>
|
||||
Date: Mon, 8 Apr 2019 10:57:21 +0200
|
||||
Subject: [PATCH] conf: Introduce extension flag and zPCI member for PCI
|
||||
address
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This patch introduces PCI address extension flag for virDomainDeviceInfo
|
||||
and virPCIDeviceAddress. The extension flag in virDomainDeviceInfo is
|
||||
used internally during calculating PCI extension flag. The one in
|
||||
virPCIDeviceAddress is the duplicate to indicate extension address is
|
||||
being used. Currently only zPCI extension address is introduced to deal
|
||||
with 'uid' and 'fid' on the S390 platform.
|
||||
|
||||
Signed-off-by: Yi Min Zhao <zyimin@linux.ibm.com>
|
||||
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
|
||||
|
||||
(cherry picked from commit 478e5f90fd4c0c0a8c1b3a8e19b9cae93ed78a4e)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1508149
|
||||
|
||||
Conflicts:
|
||||
|
||||
* src/qemu/qemu_domain_address.c
|
||||
+ context
|
||||
- missing db98a426a640
|
||||
|
||||
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
|
||||
Message-Id: <20190408085732.28684-5-abologna@redhat.com>
|
||||
Reviewed-by: Laine Stump <laine@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
src/conf/device_conf.h | 4 +
|
||||
src/conf/domain_addr.h | 5 ++
|
||||
src/qemu/qemu_domain_address.c | 140 ++++++++++++++++++++++++++++++++-
|
||||
src/util/virpci.h | 2 +
|
||||
4 files changed, 149 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/conf/device_conf.h b/src/conf/device_conf.h
|
||||
index a31ce9c376..c79066ec02 100644
|
||||
--- a/src/conf/device_conf.h
|
||||
+++ b/src/conf/device_conf.h
|
||||
@@ -164,6 +164,10 @@ struct _virDomainDeviceInfo {
|
||||
* assignment, never saved and never reported.
|
||||
*/
|
||||
int pciConnectFlags; /* enum virDomainPCIConnectFlags */
|
||||
+ /* pciAddrExtFlags is only used internally to calculate PCI
|
||||
+ * address extension flags during address assignment.
|
||||
+ */
|
||||
+ int pciAddrExtFlags; /* enum virDomainPCIAddressExtensionFlags */
|
||||
char *loadparm;
|
||||
|
||||
/* PCI devices will only be automatically placed on a PCI bus
|
||||
diff --git a/src/conf/domain_addr.h b/src/conf/domain_addr.h
|
||||
index 3236b7d6de..fd06008e26 100644
|
||||
--- a/src/conf/domain_addr.h
|
||||
+++ b/src/conf/domain_addr.h
|
||||
@@ -29,6 +29,11 @@
|
||||
# define VIR_PCI_ADDRESS_SLOT_LAST 31
|
||||
# define VIR_PCI_ADDRESS_FUNCTION_LAST 7
|
||||
|
||||
+typedef enum {
|
||||
+ VIR_PCI_ADDRESS_EXTENSION_NONE = 0, /* no extension */
|
||||
+ VIR_PCI_ADDRESS_EXTENSION_ZPCI = 1 << 0, /* zPCI support */
|
||||
+} virPCIDeviceAddressExtensionFlags;
|
||||
+
|
||||
typedef enum {
|
||||
VIR_PCI_CONNECT_HOTPLUGGABLE = 1 << 0, /* is hotplug needed/supported */
|
||||
|
||||
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
|
||||
index 79d2b9f9c4..3d01d14b46 100644
|
||||
--- a/src/qemu/qemu_domain_address.c
|
||||
+++ b/src/qemu/qemu_domain_address.c
|
||||
@@ -511,6 +511,64 @@ qemuDomainAssignARMVirtioMMIOAddresses(virDomainDefPtr def,
|
||||
}
|
||||
|
||||
|
||||
+static bool
|
||||
+qemuDomainDeviceSupportZPCI(virDomainDeviceDefPtr device)
|
||||
+{
|
||||
+ switch ((virDomainDeviceType)device->type) {
|
||||
+ case VIR_DOMAIN_DEVICE_CHR:
|
||||
+ return false;
|
||||
+
|
||||
+ case VIR_DOMAIN_DEVICE_CONTROLLER:
|
||||
+ case VIR_DOMAIN_DEVICE_DISK:
|
||||
+ case VIR_DOMAIN_DEVICE_LEASE:
|
||||
+ case VIR_DOMAIN_DEVICE_FS:
|
||||
+ case VIR_DOMAIN_DEVICE_NET:
|
||||
+ case VIR_DOMAIN_DEVICE_INPUT:
|
||||
+ case VIR_DOMAIN_DEVICE_SOUND:
|
||||
+ case VIR_DOMAIN_DEVICE_VIDEO:
|
||||
+ case VIR_DOMAIN_DEVICE_HOSTDEV:
|
||||
+ case VIR_DOMAIN_DEVICE_WATCHDOG:
|
||||
+ case VIR_DOMAIN_DEVICE_GRAPHICS:
|
||||
+ case VIR_DOMAIN_DEVICE_HUB:
|
||||
+ case VIR_DOMAIN_DEVICE_REDIRDEV:
|
||||
+ case VIR_DOMAIN_DEVICE_SMARTCARD:
|
||||
+ case VIR_DOMAIN_DEVICE_MEMBALLOON:
|
||||
+ case VIR_DOMAIN_DEVICE_NVRAM:
|
||||
+ case VIR_DOMAIN_DEVICE_RNG:
|
||||
+ case VIR_DOMAIN_DEVICE_SHMEM:
|
||||
+ case VIR_DOMAIN_DEVICE_TPM:
|
||||
+ case VIR_DOMAIN_DEVICE_PANIC:
|
||||
+ case VIR_DOMAIN_DEVICE_MEMORY:
|
||||
+ case VIR_DOMAIN_DEVICE_IOMMU:
|
||||
+ case VIR_DOMAIN_DEVICE_VSOCK:
|
||||
+ break;
|
||||
+
|
||||
+ case VIR_DOMAIN_DEVICE_NONE:
|
||||
+ case VIR_DOMAIN_DEVICE_LAST:
|
||||
+ default:
|
||||
+ virReportEnumRangeError(virDomainDeviceType, device->type);
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static virPCIDeviceAddressExtensionFlags
|
||||
+qemuDomainDeviceCalculatePCIAddressExtensionFlags(virQEMUCapsPtr qemuCaps,
|
||||
+ virDomainDeviceDefPtr dev)
|
||||
+{
|
||||
+ virPCIDeviceAddressExtensionFlags extFlags = 0;
|
||||
+
|
||||
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_ZPCI) &&
|
||||
+ qemuDomainDeviceSupportZPCI(dev)) {
|
||||
+ extFlags |= VIR_PCI_ADDRESS_EXTENSION_ZPCI;
|
||||
+ }
|
||||
+
|
||||
+ return extFlags;
|
||||
+}
|
||||
+
|
||||
+
|
||||
/**
|
||||
* qemuDomainDeviceCalculatePCIConnectFlags:
|
||||
*
|
||||
@@ -993,6 +1051,56 @@ qemuDomainFillAllPCIConnectFlags(virDomainDefPtr def,
|
||||
}
|
||||
|
||||
|
||||
+/**
|
||||
+ * qemuDomainFillDevicePCIExtensionFlagsIter:
|
||||
+ *
|
||||
+ * @def: the entire DomainDef
|
||||
+ * @dev: The device to be checked
|
||||
+ * @info: virDomainDeviceInfo within the device
|
||||
+ * @opaque: qemu capabilities
|
||||
+ *
|
||||
+ * Sets the pciAddressExtFlags for a single device's info. Has properly
|
||||
+ * formatted arguments to be called by virDomainDeviceInfoIterate().
|
||||
+ *
|
||||
+ * Always returns 0 - there is no failure.
|
||||
+ */
|
||||
+static int
|
||||
+qemuDomainFillDevicePCIExtensionFlagsIter(virDomainDefPtr def ATTRIBUTE_UNUSED,
|
||||
+ virDomainDeviceDefPtr dev,
|
||||
+ virDomainDeviceInfoPtr info,
|
||||
+ void *opaque)
|
||||
+{
|
||||
+ virQEMUCapsPtr qemuCaps = opaque;
|
||||
+
|
||||
+ info->pciAddrExtFlags =
|
||||
+ qemuDomainDeviceCalculatePCIAddressExtensionFlags(qemuCaps, dev);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+/**
|
||||
+ * qemuDomainFillAllPCIExtensionFlags:
|
||||
+ *
|
||||
+ * @def: the entire DomainDef
|
||||
+ * @qemuCaps: as you'd expect
|
||||
+ *
|
||||
+ * Set the info->pciAddressExtFlags for all devices in the domain.
|
||||
+ *
|
||||
+ * Returns 0 on success or -1 on failure (the only possibility of
|
||||
+ * failure would be some internal problem with
|
||||
+ * virDomainDeviceInfoIterate())
|
||||
+ */
|
||||
+static int
|
||||
+qemuDomainFillAllPCIExtensionFlags(virDomainDefPtr def,
|
||||
+ virQEMUCapsPtr qemuCaps)
|
||||
+{
|
||||
+ return virDomainDeviceInfoIterate(def,
|
||||
+ qemuDomainFillDevicePCIExtensionFlagsIter,
|
||||
+ qemuCaps);
|
||||
+}
|
||||
+
|
||||
+
|
||||
/**
|
||||
* qemuDomainFindUnusedIsolationGroupIter:
|
||||
* @def: domain definition
|
||||
@@ -1267,6 +1375,27 @@ qemuDomainFillDevicePCIConnectFlags(virDomainDefPtr def,
|
||||
}
|
||||
|
||||
|
||||
+/**
|
||||
+ * qemuDomainFillDevicePCIExtensionFlags:
|
||||
+ *
|
||||
+ * @dev: The device to be checked
|
||||
+ * @info: virDomainDeviceInfo within the device
|
||||
+ * @qemuCaps: as you'd expect
|
||||
+ *
|
||||
+ * Set the info->pciAddressExtFlags for a single device.
|
||||
+ *
|
||||
+ * No return value.
|
||||
+ */
|
||||
+static void
|
||||
+qemuDomainFillDevicePCIExtensionFlags(virDomainDeviceDefPtr dev,
|
||||
+ virDomainDeviceInfoPtr info,
|
||||
+ virQEMUCapsPtr qemuCaps)
|
||||
+{
|
||||
+ info->pciAddrExtFlags =
|
||||
+ qemuDomainDeviceCalculatePCIAddressExtensionFlags(qemuCaps, dev);
|
||||
+}
|
||||
+
|
||||
+
|
||||
static int
|
||||
qemuDomainPCIAddressReserveNextAddr(virDomainPCIAddressSetPtr addrs,
|
||||
virDomainDeviceInfoPtr dev)
|
||||
@@ -2400,6 +2529,9 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def,
|
||||
if (qemuDomainFillAllPCIConnectFlags(def, qemuCaps, driver) < 0)
|
||||
goto cleanup;
|
||||
|
||||
+ if (qemuDomainFillAllPCIExtensionFlags(def, qemuCaps) < 0)
|
||||
+ goto cleanup;
|
||||
+
|
||||
if (qemuDomainSetupIsolationGroups(def) < 0)
|
||||
goto cleanup;
|
||||
|
||||
@@ -2435,7 +2567,8 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def,
|
||||
*/
|
||||
virDomainDeviceInfo info = {
|
||||
.pciConnectFlags = (VIR_PCI_CONNECT_HOTPLUGGABLE |
|
||||
- VIR_PCI_CONNECT_TYPE_PCI_DEVICE)
|
||||
+ VIR_PCI_CONNECT_TYPE_PCI_DEVICE),
|
||||
+ .pciAddrExtFlags = VIR_PCI_ADDRESS_EXTENSION_NONE
|
||||
};
|
||||
bool buses_reserved = true;
|
||||
|
||||
@@ -2472,7 +2605,8 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def,
|
||||
qemuDomainHasPCIeRoot(def)) {
|
||||
virDomainDeviceInfo info = {
|
||||
.pciConnectFlags = (VIR_PCI_CONNECT_HOTPLUGGABLE |
|
||||
- VIR_PCI_CONNECT_TYPE_PCIE_DEVICE)
|
||||
+ VIR_PCI_CONNECT_TYPE_PCIE_DEVICE),
|
||||
+ .pciAddrExtFlags = VIR_PCI_ADDRESS_EXTENSION_NONE
|
||||
};
|
||||
|
||||
/* if there isn't an empty pcie-root-port, this will
|
||||
@@ -2989,6 +3123,8 @@ qemuDomainEnsurePCIAddress(virDomainObjPtr obj,
|
||||
|
||||
qemuDomainFillDevicePCIConnectFlags(obj->def, dev, priv->qemuCaps, driver);
|
||||
|
||||
+ qemuDomainFillDevicePCIExtensionFlags(dev, info, priv->qemuCaps);
|
||||
+
|
||||
return virDomainPCIAddressEnsureAddr(priv->pciaddrs, info,
|
||||
info->pciConnectFlags);
|
||||
}
|
||||
diff --git a/src/util/virpci.h b/src/util/virpci.h
|
||||
index 01df652b86..b366d7d9c3 100644
|
||||
--- a/src/util/virpci.h
|
||||
+++ b/src/util/virpci.h
|
||||
@@ -49,6 +49,8 @@ struct _virPCIDeviceAddress {
|
||||
unsigned int slot;
|
||||
unsigned int function;
|
||||
int multi; /* virTristateSwitch */
|
||||
+ int extFlags; /* enum virPCIDeviceAddressExtensionFlags */
|
||||
+ virZPCIDeviceAddress zpci;
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
--
|
||||
2.22.0
|
||||
|
@ -0,0 +1,416 @@
|
||||
From 5ad0f7cc1b2444ee9355229316fb008919d22c71 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <5ad0f7cc1b2444ee9355229316fb008919d22c71@dist-git>
|
||||
From: Erik Skultety <eskultet@redhat.com>
|
||||
Date: Thu, 19 Jul 2018 15:04:02 +0200
|
||||
Subject: [PATCH] conf: Introduce new <hostdev> attribute 'display'
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
QEMU 2.12 introduced a new type of display for mediated devices using
|
||||
vfio-pci backend which allows a mediated device to be used as a VGA
|
||||
compatible device as an alternative to an emulated video device. QEMU
|
||||
exposes this feature via a vfio device property 'display' with supported
|
||||
values 'on/off/auto' (libvirt will default to 'off').
|
||||
|
||||
This patch adds the necessary bits to domain config handling in order to
|
||||
expose this feature. Since there's no convenient way for libvirt to come
|
||||
up with usable defaults for the display setting, simply because libvirt
|
||||
is not able to figure out which of the display implementations - dma-buf
|
||||
which requires OpenGL support vs vfio regions which doesn't need OpenGL
|
||||
(works with OpenGL enabled too) - the underlying mdev uses.
|
||||
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
Signed-off-by: Erik Skultety <eskultet@redhat.com>
|
||||
(cherry picked from commit d54e45b6edd7623e488a19e30bc4148a21fa8b03)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1475770
|
||||
Signed-off-by: Erik Skultety <eskultet@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
docs/formatdomain.html.in | 20 +++-
|
||||
docs/schemas/domaincommon.rng | 5 +
|
||||
src/conf/domain_conf.c | 19 +++-
|
||||
src/conf/domain_conf.h | 1 +
|
||||
src/qemu/qemu_domain.c | 98 ++++++++++++++++++-
|
||||
.../qemuxml2argvdata/hostdev-mdev-display.xml | 39 ++++++++
|
||||
.../hostdev-mdev-display.xml | 47 +++++++++
|
||||
tests/qemuxml2xmltest.c | 1 +
|
||||
8 files changed, 222 insertions(+), 8 deletions(-)
|
||||
create mode 100644 tests/qemuxml2argvdata/hostdev-mdev-display.xml
|
||||
create mode 100644 tests/qemuxml2xmloutdata/hostdev-mdev-display.xml
|
||||
|
||||
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
|
||||
index 9dd22554ad..3554c3dc30 100644
|
||||
--- a/docs/formatdomain.html.in
|
||||
+++ b/docs/formatdomain.html.in
|
||||
@@ -4510,9 +4510,23 @@
|
||||
guest. Currently, <code>model='vfio-pci'</code> and
|
||||
<code>model='vfio-ccw'</code> (<span class="since">Since 4.4.0</span>)
|
||||
is supported. Refer <a href="drvnodedev.html#MDEV">MDEV</a> to create
|
||||
- a mediated device on the host. There are also some implications on the
|
||||
- usage of guest's address type depending on the <code>model</code>
|
||||
- attribute, see the <code>address</code> element below.
|
||||
+ a mediated device on the host.
|
||||
+ <span class="since">Since 4.6.0 (QEMU 2.12)</span> an optional
|
||||
+ <code>display</code> attribute may be used to enable or disable
|
||||
+ support for an accelerated remote desktop backed by a mediated
|
||||
+ device (such as NVIDIA vGPU or Intel GVT-g) as an alternative to
|
||||
+ emulated <a href="#elementsVideo">video devices</a>. This attribute
|
||||
+ is limited to <code>model='vfio-pci'</code> only. Supported values
|
||||
+ are either <code>on</code> or <code>off</code> (default is 'off').
|
||||
+ It is required to use a
|
||||
+ <a href="#elementsGraphics">graphical framebuffer</a> in order to
|
||||
+ use this attribute, currently only supported with VNC, Spice and
|
||||
+ egl-headless graphics devices.
|
||||
+ <p>
|
||||
+ Note: There are also some implications on the usage of guest's
|
||||
+ address type depending on the <code>model</code> attribute,
|
||||
+ see the <code>address</code> element below.
|
||||
+ </p>
|
||||
</dd>
|
||||
</dl>
|
||||
<p>
|
||||
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
|
||||
index 157726752c..be8430ab22 100644
|
||||
--- a/docs/schemas/domaincommon.rng
|
||||
+++ b/docs/schemas/domaincommon.rng
|
||||
@@ -4579,6 +4579,11 @@
|
||||
<value>vfio-ccw</value>
|
||||
</choice>
|
||||
</attribute>
|
||||
+ <optional>
|
||||
+ <attribute name="display">
|
||||
+ <ref name="virOnOff"/>
|
||||
+ </attribute>
|
||||
+ </optional>
|
||||
<element name="source">
|
||||
<ref name="mdevaddress"/>
|
||||
</element>
|
||||
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
||||
index 72086f9e86..830c298158 100644
|
||||
--- a/src/conf/domain_conf.c
|
||||
+++ b/src/conf/domain_conf.c
|
||||
@@ -7656,6 +7656,7 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node,
|
||||
char *rawio = NULL;
|
||||
char *backendStr = NULL;
|
||||
char *model = NULL;
|
||||
+ char *display = NULL;
|
||||
int backend;
|
||||
int ret = -1;
|
||||
virDomainHostdevSubsysPCIPtr pcisrc = &def->source.subsys.u.pci;
|
||||
@@ -7675,6 +7676,7 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node,
|
||||
sgio = virXMLPropString(node, "sgio");
|
||||
rawio = virXMLPropString(node, "rawio");
|
||||
model = virXMLPropString(node, "model");
|
||||
+ display = virXMLPropString(node, "display");
|
||||
|
||||
/* @type is passed in from the caller rather than read from the
|
||||
* xml document, because it is specified in different places for
|
||||
@@ -7762,6 +7764,15 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node,
|
||||
model);
|
||||
goto cleanup;
|
||||
}
|
||||
+
|
||||
+ if (display &&
|
||||
+ (mdevsrc->display = virTristateSwitchTypeFromString(display)) <= 0) {
|
||||
+ virReportError(VIR_ERR_XML_ERROR,
|
||||
+ _("unknown value '%s' for <hostdev> attribute "
|
||||
+ "'display'"),
|
||||
+ display);
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
}
|
||||
|
||||
switch (def->source.subsys.type) {
|
||||
@@ -7815,6 +7826,7 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node,
|
||||
VIR_FREE(rawio);
|
||||
VIR_FREE(backendStr);
|
||||
VIR_FREE(model);
|
||||
+ VIR_FREE(display);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -26568,9 +26580,14 @@ virDomainHostdevDefFormat(virBufferPtr buf,
|
||||
virTristateBoolTypeToString(scsisrc->rawio));
|
||||
}
|
||||
|
||||
- if (def->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV)
|
||||
+ if (def->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV) {
|
||||
virBufferAsprintf(buf, " model='%s'",
|
||||
virMediatedDeviceModelTypeToString(mdevsrc->model));
|
||||
+ if (mdevsrc->display != VIR_TRISTATE_SWITCH_ABSENT)
|
||||
+ virBufferAsprintf(buf, " display='%s'",
|
||||
+ virTristateSwitchTypeToString(mdevsrc->display));
|
||||
+ }
|
||||
+
|
||||
}
|
||||
virBufferAddLit(buf, ">\n");
|
||||
virBufferAdjustIndent(buf, 2);
|
||||
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
|
||||
index 3deda1d978..8ca9558ceb 100644
|
||||
--- a/src/conf/domain_conf.h
|
||||
+++ b/src/conf/domain_conf.h
|
||||
@@ -382,6 +382,7 @@ typedef struct _virDomainHostdevSubsysMediatedDev virDomainHostdevSubsysMediated
|
||||
typedef virDomainHostdevSubsysMediatedDev *virDomainHostdevSubsysMediatedDevPtr;
|
||||
struct _virDomainHostdevSubsysMediatedDev {
|
||||
int model; /* enum virMediatedDeviceModelType */
|
||||
+ int display; /* virTristateSwitch */
|
||||
char uuidstr[VIR_UUID_STRING_BUFLEN]; /* mediated device's uuid string */
|
||||
};
|
||||
|
||||
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
|
||||
index 9498594857..5337f1ce55 100644
|
||||
--- a/src/qemu/qemu_domain.c
|
||||
+++ b/src/qemu/qemu_domain.c
|
||||
@@ -4451,9 +4451,48 @@ qemuDomainDeviceDefValidateNetwork(const virDomainNetDef *net)
|
||||
|
||||
|
||||
static int
|
||||
-qemuDomainDeviceDefValidateHostdev(const virDomainHostdevDef *hostdev,
|
||||
- const virDomainDef *def)
|
||||
+qemuDomainMdevDefValidate(const virDomainHostdevSubsysMediatedDev *mdevsrc,
|
||||
+ const virDomainDef *def,
|
||||
+ virQEMUCapsPtr qemuCaps)
|
||||
{
|
||||
+ if (mdevsrc->display == VIR_TRISTATE_SWITCH_ABSENT)
|
||||
+ return 0;
|
||||
+
|
||||
+ if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VFIO_PCI_DISPLAY)) {
|
||||
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
+ _("display property of device vfio-pci is "
|
||||
+ "not supported by this version of QEMU"));
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ if (mdevsrc->model != VIR_MDEV_MODEL_TYPE_VFIO_PCI) {
|
||||
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
+ _("<hostdev> attribute 'display' is only supported"
|
||||
+ " with model='vfio-pci'"));
|
||||
+
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ if (mdevsrc->display == VIR_TRISTATE_SWITCH_ON) {
|
||||
+ if (def->ngraphics == 0) {
|
||||
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
+ _("graphics device is needed for attribute value "
|
||||
+ "'display=on' in <hostdev>"));
|
||||
+ return -1;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static int
|
||||
+qemuDomainDeviceDefValidateHostdev(const virDomainHostdevDef *hostdev,
|
||||
+ const virDomainDef *def,
|
||||
+ virQEMUCapsPtr qemuCaps)
|
||||
+{
|
||||
+ const virDomainHostdevSubsysMediatedDev *mdevsrc;
|
||||
+
|
||||
/* forbid capabilities mode hostdev in this kind of hypervisor */
|
||||
if (hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_CAPABILITIES) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
@@ -4463,6 +4502,24 @@ qemuDomainDeviceDefValidateHostdev(const virDomainHostdevDef *hostdev,
|
||||
return -1;
|
||||
}
|
||||
|
||||
+ if (hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS) {
|
||||
+ switch ((virDomainHostdevSubsysType) hostdev->source.subsys.type) {
|
||||
+ case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB:
|
||||
+ case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI:
|
||||
+ case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI:
|
||||
+ case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST:
|
||||
+ break;
|
||||
+ case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV:
|
||||
+ mdevsrc = &hostdev->source.subsys.u.mdev;
|
||||
+ return qemuDomainMdevDefValidate(mdevsrc, def, qemuCaps);
|
||||
+ case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST:
|
||||
+ default:
|
||||
+ virReportEnumRangeError(virDomainHostdevSubsysType,
|
||||
+ hostdev->source.subsys.type);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -5595,7 +5652,8 @@ qemuDomainDeviceDefValidate(const virDomainDeviceDef *dev,
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_DEVICE_HOSTDEV:
|
||||
- ret = qemuDomainDeviceDefValidateHostdev(dev->data.hostdev, def);
|
||||
+ ret = qemuDomainDeviceDefValidateHostdev(dev->data.hostdev, def,
|
||||
+ qemuCaps);
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_DEVICE_VIDEO:
|
||||
@@ -6205,6 +6263,35 @@ qemuDomainVsockDefPostParse(virDomainVsockDefPtr vsock)
|
||||
}
|
||||
|
||||
|
||||
+static int
|
||||
+qemuDomainHostdevDefMdevPostParse(virDomainHostdevSubsysMediatedDevPtr mdevsrc,
|
||||
+ virQEMUCapsPtr qemuCaps)
|
||||
+{
|
||||
+ /* QEMU 2.12 added support for vfio-pci display type, we default to
|
||||
+ * 'display=off' to stay safe from future changes */
|
||||
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VFIO_PCI_DISPLAY) &&
|
||||
+ mdevsrc->display == VIR_TRISTATE_SWITCH_ABSENT)
|
||||
+ mdevsrc->display = VIR_TRISTATE_SWITCH_OFF;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static int
|
||||
+qemuDomainHostdevDefPostParse(virDomainHostdevDefPtr hostdev,
|
||||
+ virQEMUCapsPtr qemuCaps)
|
||||
+{
|
||||
+ virDomainHostdevSubsysPtr subsys = &hostdev->source.subsys;
|
||||
+
|
||||
+ if (hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
|
||||
+ hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV &&
|
||||
+ qemuDomainHostdevDefMdevPostParse(&subsys->u.mdev, qemuCaps) < 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
static int
|
||||
qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
|
||||
const virDomainDef *def,
|
||||
@@ -6255,11 +6342,14 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
|
||||
ret = qemuDomainVsockDefPostParse(dev->data.vsock);
|
||||
break;
|
||||
|
||||
+ case VIR_DOMAIN_DEVICE_HOSTDEV:
|
||||
+ ret = qemuDomainHostdevDefPostParse(dev->data.hostdev, qemuCaps);
|
||||
+ break;
|
||||
+
|
||||
case VIR_DOMAIN_DEVICE_LEASE:
|
||||
case VIR_DOMAIN_DEVICE_FS:
|
||||
case VIR_DOMAIN_DEVICE_INPUT:
|
||||
case VIR_DOMAIN_DEVICE_SOUND:
|
||||
- case VIR_DOMAIN_DEVICE_HOSTDEV:
|
||||
case VIR_DOMAIN_DEVICE_WATCHDOG:
|
||||
case VIR_DOMAIN_DEVICE_GRAPHICS:
|
||||
case VIR_DOMAIN_DEVICE_HUB:
|
||||
diff --git a/tests/qemuxml2argvdata/hostdev-mdev-display.xml b/tests/qemuxml2argvdata/hostdev-mdev-display.xml
|
||||
new file mode 100644
|
||||
index 0000000000..f37e08e1b9
|
||||
--- /dev/null
|
||||
+++ b/tests/qemuxml2argvdata/hostdev-mdev-display.xml
|
||||
@@ -0,0 +1,39 @@
|
||||
+<domain type='qemu'>
|
||||
+ <name>QEMUGuest2</name>
|
||||
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||
+ <memory unit='KiB'>219136</memory>
|
||||
+ <currentMemory unit='KiB'>219136</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-i686</emulator>
|
||||
+ <disk type='block' device='disk'>
|
||||
+ <driver name='qemu' type='raw'/>
|
||||
+ <source dev='/dev/HostVG/QEMUGuest2'/>
|
||||
+ <target dev='hda' bus='ide'/>
|
||||
+ <address type='drive' controller='0' bus='0' target='0' unit='0'/>
|
||||
+ </disk>
|
||||
+ <controller type='usb' index='0'>
|
||||
+ </controller>
|
||||
+ <controller type='pci' index='0' model='pci-root'/>
|
||||
+ <controller type='ide' index='0'>
|
||||
+ </controller>
|
||||
+ <graphics type='vnc'/>
|
||||
+ <hostdev mode='subsystem' type='mdev' model='vfio-pci' display='on'>
|
||||
+ <source>
|
||||
+ <address uuid='53764d0e-85a0-42b4-af5c-2046b460b1dc'/>
|
||||
+ </source>
|
||||
+ </hostdev>
|
||||
+ <video>
|
||||
+ <model type='qxl' heads='1'/>
|
||||
+ </video>
|
||||
+ <memballoon model='none'/>
|
||||
+ </devices>
|
||||
+</domain>
|
||||
diff --git a/tests/qemuxml2xmloutdata/hostdev-mdev-display.xml b/tests/qemuxml2xmloutdata/hostdev-mdev-display.xml
|
||||
new file mode 100644
|
||||
index 0000000000..94c11b1199
|
||||
--- /dev/null
|
||||
+++ b/tests/qemuxml2xmloutdata/hostdev-mdev-display.xml
|
||||
@@ -0,0 +1,47 @@
|
||||
+<domain type='qemu'>
|
||||
+ <name>QEMUGuest2</name>
|
||||
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||
+ <memory unit='KiB'>219136</memory>
|
||||
+ <currentMemory unit='KiB'>219136</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-i686</emulator>
|
||||
+ <disk type='block' device='disk'>
|
||||
+ <driver name='qemu' type='raw'/>
|
||||
+ <source dev='/dev/HostVG/QEMUGuest2'/>
|
||||
+ <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>
|
||||
+ <input type='mouse' bus='ps2'/>
|
||||
+ <input type='keyboard' bus='ps2'/>
|
||||
+ <graphics type='vnc' port='-1' autoport='yes'>
|
||||
+ <listen type='address'/>
|
||||
+ </graphics>
|
||||
+ <video>
|
||||
+ <model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='1' primary='yes'/>
|
||||
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
|
||||
+ </video>
|
||||
+ <hostdev mode='subsystem' type='mdev' managed='no' model='vfio-pci' display='on'>
|
||||
+ <source>
|
||||
+ <address uuid='53764d0e-85a0-42b4-af5c-2046b460b1dc'/>
|
||||
+ </source>
|
||||
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
|
||||
+ </hostdev>
|
||||
+ <memballoon model='none'/>
|
||||
+ </devices>
|
||||
+</domain>
|
||||
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
|
||||
index fa57221d62..e418e67f6c 100644
|
||||
--- a/tests/qemuxml2xmltest.c
|
||||
+++ b/tests/qemuxml2xmltest.c
|
||||
@@ -479,6 +479,7 @@ mymain(void)
|
||||
DO_TEST("hostdev-pci-address", NONE);
|
||||
DO_TEST("hostdev-vfio", NONE);
|
||||
DO_TEST("hostdev-mdev-precreated", NONE);
|
||||
+ DO_TEST("hostdev-mdev-display", QEMU_CAPS_VFIO_PCI_DISPLAY);
|
||||
DO_TEST("pci-rom", NONE);
|
||||
DO_TEST("pci-rom-disabled", NONE);
|
||||
DO_TEST("pci-rom-disabled-invalid", NONE);
|
||||
--
|
||||
2.18.0
|
||||
|
504
SOURCES/libvirt-conf-Introduce-new-video-type-none.patch
Normal file
504
SOURCES/libvirt-conf-Introduce-new-video-type-none.patch
Normal file
@ -0,0 +1,504 @@
|
||||
From 2010df9c6a8a4ff984e3f1b697398da648342953 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <2010df9c6a8a4ff984e3f1b697398da648342953@dist-git>
|
||||
From: Erik Skultety <eskultet@redhat.com>
|
||||
Date: Thu, 19 Jul 2018 15:04:05 +0200
|
||||
Subject: [PATCH] conf: Introduce new video type 'none'
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Historically, we've always enabled an emulated video device every time we
|
||||
see that graphics should be supported with a guest. With the appearance
|
||||
of mediated devices which can support QEMU's vfio-display capability,
|
||||
users might want to use such a device as the only video device.
|
||||
Therefore introduce a new, effectively a 'disable', type for video
|
||||
device.
|
||||
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
Signed-off-by: Erik Skultety <eskultet@redhat.com>
|
||||
(cherry picked from commit d48813e81af798e3027edcc2f41be2630111ba65)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1475770
|
||||
Signed-off-by: Erik Skultety <eskultet@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
docs/formatdomain.html.in | 13 +++-
|
||||
docs/schemas/domaincommon.rng | 1 +
|
||||
src/conf/domain_conf.c | 61 +++++++++++++------
|
||||
src/conf/domain_conf.h | 1 +
|
||||
src/qemu/qemu_command.c | 12 +++-
|
||||
src/qemu/qemu_domain.c | 2 +
|
||||
src/qemu/qemu_domain_address.c | 7 ++-
|
||||
tests/domaincapsschemadata/full.xml | 1 +
|
||||
.../video-invalid-multiple-devices.xml | 33 ++++++++++
|
||||
tests/qemuxml2argvdata/video-none-device.args | 27 ++++++++
|
||||
tests/qemuxml2argvdata/video-none-device.xml | 39 ++++++++++++
|
||||
tests/qemuxml2argvtest.c | 4 +-
|
||||
.../qemuxml2xmloutdata/video-none-device.xml | 42 +++++++++++++
|
||||
tests/qemuxml2xmltest.c | 1 +
|
||||
14 files changed, 220 insertions(+), 24 deletions(-)
|
||||
create mode 100644 tests/qemuxml2argvdata/video-invalid-multiple-devices.xml
|
||||
create mode 100644 tests/qemuxml2argvdata/video-none-device.args
|
||||
create mode 100644 tests/qemuxml2argvdata/video-none-device.xml
|
||||
create mode 100644 tests/qemuxml2xmloutdata/video-none-device.xml
|
||||
|
||||
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
|
||||
index 0e8f0a125f..42acf7a828 100644
|
||||
--- a/docs/formatdomain.html.in
|
||||
+++ b/docs/formatdomain.html.in
|
||||
@@ -6666,9 +6666,18 @@ qemu-kvm -net nic,model=? /dev/null
|
||||
The <code>model</code> element has a mandatory <code>type</code>
|
||||
attribute which takes the value "vga", "cirrus", "vmvga", "xen",
|
||||
"vbox", "qxl" (<span class="since">since 0.8.6</span>),
|
||||
- "virtio" (<span class="since">since 1.3.0</span>)
|
||||
- or "gop" (<span class="since">since 3.2.0</span>)
|
||||
+ "virtio" (<span class="since">since 1.3.0</span>),
|
||||
+ "gop" (<span class="since">since 3.2.0</span>), or
|
||||
+ "none" (<span class="since">since 4.6.0</span>)
|
||||
depending on the hypervisor features available.
|
||||
+ The purpose of the type <code>none</code> is to instruct libvirt not
|
||||
+ to add a default video device in the guest (see the paragraph above).
|
||||
+ This legacy behaviour can be inconvenient in cases where GPU mediated
|
||||
+ devices are meant to be the only rendering device within a guest and
|
||||
+ so specifying another <code>video</code> device along with type
|
||||
+ <code>none</code>.
|
||||
+ Refer to <a id="elementsHostDev">Host device assignment</a> to see
|
||||
+ how to add a mediated device into a guest.
|
||||
</p>
|
||||
<p>
|
||||
You can provide the amount of video memory in kibibytes (blocks of
|
||||
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
|
||||
index be8430ab22..ac04af51a1 100644
|
||||
--- a/docs/schemas/domaincommon.rng
|
||||
+++ b/docs/schemas/domaincommon.rng
|
||||
@@ -3454,6 +3454,7 @@
|
||||
<value>vbox</value>
|
||||
<value>virtio</value>
|
||||
<value>gop</value>
|
||||
+ <value>none</value>
|
||||
</choice>
|
||||
</attribute>
|
||||
<group>
|
||||
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
||||
index 830c298158..23288aa01b 100644
|
||||
--- a/src/conf/domain_conf.c
|
||||
+++ b/src/conf/domain_conf.c
|
||||
@@ -590,7 +590,8 @@ VIR_ENUM_IMPL(virDomainVideo, VIR_DOMAIN_VIDEO_TYPE_LAST,
|
||||
"qxl",
|
||||
"parallels",
|
||||
"virtio",
|
||||
- "gop")
|
||||
+ "gop",
|
||||
+ "none")
|
||||
|
||||
VIR_ENUM_IMPL(virDomainVideoVGAConf, VIR_DOMAIN_VIDEO_VGACONF_LAST,
|
||||
"io",
|
||||
@@ -5106,22 +5107,30 @@ virDomainDefPostParseVideo(virDomainDefPtr def,
|
||||
if (def->nvideos == 0)
|
||||
return 0;
|
||||
|
||||
- virDomainDeviceDef device = {
|
||||
- .type = VIR_DOMAIN_DEVICE_VIDEO,
|
||||
- .data.video = def->videos[0],
|
||||
- };
|
||||
+ if (def->videos[0]->type == VIR_DOMAIN_VIDEO_TYPE_NONE) {
|
||||
+ /* we don't want to format any values we automatically fill in for
|
||||
+ * videos into the XML, so clear them
|
||||
+ */
|
||||
+ virDomainVideoDefClear(def->videos[0]);
|
||||
+ def->videos[0]->type = VIR_DOMAIN_VIDEO_TYPE_NONE;
|
||||
+ } else {
|
||||
+ virDomainDeviceDef device = {
|
||||
+ .type = VIR_DOMAIN_DEVICE_VIDEO,
|
||||
+ .data.video = def->videos[0],
|
||||
+ };
|
||||
|
||||
- /* Mark the first video as primary. If the user specified
|
||||
- * primary="yes", the parser already inserted the device at
|
||||
- * def->videos[0]
|
||||
- */
|
||||
- def->videos[0]->primary = true;
|
||||
+ /* Mark the first video as primary. If the user specified
|
||||
+ * primary="yes", the parser already inserted the device at
|
||||
+ * def->videos[0]
|
||||
+ */
|
||||
+ def->videos[0]->primary = true;
|
||||
|
||||
- /* videos[0] might have been added in AddImplicitDevices, after we've
|
||||
- * done the per-device post-parse */
|
||||
- if (virDomainDefPostParseDeviceIterator(def, &device,
|
||||
- NULL, opaque) < 0)
|
||||
- return -1;
|
||||
+ /* videos[0] might have been added in AddImplicitDevices, after we've
|
||||
+ * done the per-device post-parse */
|
||||
+ if (virDomainDefPostParseDeviceIterator(def, &device,
|
||||
+ NULL, opaque) < 0)
|
||||
+ return -1;
|
||||
+ }
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -5670,13 +5679,30 @@ virDomainHostdevDefValidate(const virDomainHostdevDef *hostdev)
|
||||
|
||||
|
||||
static int
|
||||
-virDomainVideoDefValidate(const virDomainVideoDef *video)
|
||||
+virDomainVideoDefValidate(const virDomainVideoDef *video,
|
||||
+ const virDomainDef *def)
|
||||
{
|
||||
+ size_t i;
|
||||
+
|
||||
if (video->type == VIR_DOMAIN_VIDEO_TYPE_DEFAULT) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("missing video model and cannot determine default"));
|
||||
return -1;
|
||||
}
|
||||
+
|
||||
+ /* it doesn't make sense to pair video device type 'none' with any other
|
||||
+ * types, there can be only a single video device in such case
|
||||
+ */
|
||||
+ for (i = 0; i < def->nvideos; i++) {
|
||||
+ if (def->videos[i]->type == VIR_DOMAIN_VIDEO_TYPE_NONE &&
|
||||
+ def->nvideos > 1) {
|
||||
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
+ _("a '%s' video type must be the only video device "
|
||||
+ "defined for the domain"));
|
||||
+ return -1;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -5738,7 +5764,7 @@ virDomainDeviceDefValidateInternal(const virDomainDeviceDef *dev,
|
||||
return virDomainHostdevDefValidate(dev->data.hostdev);
|
||||
|
||||
case VIR_DOMAIN_DEVICE_VIDEO:
|
||||
- return virDomainVideoDefValidate(dev->data.video);
|
||||
+ return virDomainVideoDefValidate(dev->data.video, def);
|
||||
|
||||
case VIR_DOMAIN_DEVICE_MEMORY:
|
||||
return virDomainMemoryDefValidate(dev->data.memory);
|
||||
@@ -15048,6 +15074,7 @@ virDomainVideoDefaultRAM(const virDomainDef *def,
|
||||
case VIR_DOMAIN_VIDEO_TYPE_PARALLELS:
|
||||
case VIR_DOMAIN_VIDEO_TYPE_VIRTIO:
|
||||
case VIR_DOMAIN_VIDEO_TYPE_GOP:
|
||||
+ case VIR_DOMAIN_VIDEO_TYPE_NONE:
|
||||
case VIR_DOMAIN_VIDEO_TYPE_LAST:
|
||||
default:
|
||||
return 0;
|
||||
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
|
||||
index 8ca9558ceb..5e2f21dea3 100644
|
||||
--- a/src/conf/domain_conf.h
|
||||
+++ b/src/conf/domain_conf.h
|
||||
@@ -1424,6 +1424,7 @@ typedef enum {
|
||||
VIR_DOMAIN_VIDEO_TYPE_PARALLELS, /* pseudo device for VNC in containers */
|
||||
VIR_DOMAIN_VIDEO_TYPE_VIRTIO,
|
||||
VIR_DOMAIN_VIDEO_TYPE_GOP,
|
||||
+ VIR_DOMAIN_VIDEO_TYPE_NONE,
|
||||
|
||||
VIR_DOMAIN_VIDEO_TYPE_LAST
|
||||
} virDomainVideoType;
|
||||
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
|
||||
index 1fce45134f..954265feb0 100644
|
||||
--- a/src/qemu/qemu_command.c
|
||||
+++ b/src/qemu/qemu_command.c
|
||||
@@ -105,7 +105,8 @@ VIR_ENUM_IMPL(qemuVideo, VIR_DOMAIN_VIDEO_TYPE_LAST,
|
||||
"qxl",
|
||||
"", /* don't support parallels */
|
||||
"", /* no need for virtio */
|
||||
- "" /* don't support gop */);
|
||||
+ "" /* don't support gop */,
|
||||
+ "" /* 'none' doesn't make sense here */);
|
||||
|
||||
VIR_ENUM_DECL(qemuDeviceVideo)
|
||||
|
||||
@@ -119,7 +120,8 @@ VIR_ENUM_IMPL(qemuDeviceVideo, VIR_DOMAIN_VIDEO_TYPE_LAST,
|
||||
"qxl-vga",
|
||||
"", /* don't support parallels */
|
||||
"virtio-vga",
|
||||
- "" /* don't support gop */);
|
||||
+ "" /* don't support gop */,
|
||||
+ "" /* 'none' doesn't make sense here */);
|
||||
|
||||
VIR_ENUM_DECL(qemuDeviceVideoSecondary)
|
||||
|
||||
@@ -133,7 +135,8 @@ VIR_ENUM_IMPL(qemuDeviceVideoSecondary, VIR_DOMAIN_VIDEO_TYPE_LAST,
|
||||
"qxl",
|
||||
"", /* don't support parallels */
|
||||
"virtio-gpu",
|
||||
- "" /* don't support gop */);
|
||||
+ "" /* don't support gop */,
|
||||
+ "" /* 'none' doesn't make sense here */);
|
||||
|
||||
VIR_ENUM_DECL(qemuSoundCodec)
|
||||
|
||||
@@ -4421,6 +4424,9 @@ qemuBuildVideoCommandLine(virCommandPtr cmd,
|
||||
char *str = NULL;
|
||||
virDomainVideoDefPtr video = def->videos[i];
|
||||
|
||||
+ if (video->type == VIR_DOMAIN_VIDEO_TYPE_NONE)
|
||||
+ continue;
|
||||
+
|
||||
if (video->primary) {
|
||||
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIDEO_PRIMARY)) {
|
||||
|
||||
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
|
||||
index 5337f1ce55..508846116b 100644
|
||||
--- a/src/qemu/qemu_domain.c
|
||||
+++ b/src/qemu/qemu_domain.c
|
||||
@@ -4528,6 +4528,8 @@ static int
|
||||
qemuDomainDeviceDefValidateVideo(const virDomainVideoDef *video)
|
||||
{
|
||||
switch ((virDomainVideoType) video->type) {
|
||||
+ case VIR_DOMAIN_VIDEO_TYPE_NONE:
|
||||
+ return 0;
|
||||
case VIR_DOMAIN_VIDEO_TYPE_XEN:
|
||||
case VIR_DOMAIN_VIDEO_TYPE_VBOX:
|
||||
case VIR_DOMAIN_VIDEO_TYPE_PARALLELS:
|
||||
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
|
||||
index ab2ac022f1..e6996934b8 100644
|
||||
--- a/src/qemu/qemu_domain_address.c
|
||||
+++ b/src/qemu/qemu_domain_address.c
|
||||
@@ -821,6 +821,7 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev,
|
||||
|
||||
case VIR_DOMAIN_VIDEO_TYPE_DEFAULT:
|
||||
case VIR_DOMAIN_VIDEO_TYPE_GOP:
|
||||
+ case VIR_DOMAIN_VIDEO_TYPE_NONE:
|
||||
case VIR_DOMAIN_VIDEO_TYPE_LAST:
|
||||
return 0;
|
||||
}
|
||||
@@ -1532,7 +1533,8 @@ qemuDomainValidateDevicePCISlotsPIIX3(virDomainDefPtr def,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
- if (def->nvideos > 0) {
|
||||
+ if (def->nvideos > 0 &&
|
||||
+ def->videos[0]->type != VIR_DOMAIN_VIDEO_TYPE_NONE) {
|
||||
/* Because the PIIX3 integrated IDE/USB controllers are
|
||||
* already at slot 1, when qemu looks for the first free slot
|
||||
* to place the VGA controller (which is always the first
|
||||
@@ -1540,6 +1542,7 @@ qemuDomainValidateDevicePCISlotsPIIX3(virDomainDefPtr def,
|
||||
* at slot 2.
|
||||
*/
|
||||
virDomainVideoDefPtr primaryVideo = def->videos[0];
|
||||
+
|
||||
if (virDeviceInfoPCIAddressWanted(&primaryVideo->info)) {
|
||||
memset(&tmp_addr, 0, sizeof(tmp_addr));
|
||||
tmp_addr.slot = 2;
|
||||
@@ -2105,6 +2108,8 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
|
||||
|
||||
/* Video devices */
|
||||
for (i = 0; i < def->nvideos; i++) {
|
||||
+ if (def->videos[i]->type == VIR_DOMAIN_VIDEO_TYPE_NONE)
|
||||
+ continue;
|
||||
|
||||
if (!virDeviceInfoPCIAddressWanted(&def->videos[i]->info))
|
||||
continue;
|
||||
diff --git a/tests/domaincapsschemadata/full.xml b/tests/domaincapsschemadata/full.xml
|
||||
index 154c4a6fe9..eafba1ae5b 100644
|
||||
--- a/tests/domaincapsschemadata/full.xml
|
||||
+++ b/tests/domaincapsschemadata/full.xml
|
||||
@@ -74,6 +74,7 @@
|
||||
<value>parallels</value>
|
||||
<value>virtio</value>
|
||||
<value>gop</value>
|
||||
+ <value>none</value>
|
||||
</enum>
|
||||
</video>
|
||||
<hostdev supported='yes'>
|
||||
diff --git a/tests/qemuxml2argvdata/video-invalid-multiple-devices.xml b/tests/qemuxml2argvdata/video-invalid-multiple-devices.xml
|
||||
new file mode 100644
|
||||
index 0000000000..3f105efaae
|
||||
--- /dev/null
|
||||
+++ b/tests/qemuxml2argvdata/video-invalid-multiple-devices.xml
|
||||
@@ -0,0 +1,33 @@
|
||||
+<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' cpuset='1-4,8-20,525'>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-i686</emulator>
|
||||
+ <disk type='block' device='disk'>
|
||||
+ <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'/>
|
||||
+ <controller type='ide' index='0'/>
|
||||
+ <controller type='pci' index='0' model='pci-root'/>
|
||||
+ <video>
|
||||
+ <model type='qxl'/>
|
||||
+ </video>
|
||||
+ <video>
|
||||
+ <model type='none'/>
|
||||
+ </video>
|
||||
+ <memballoon model='virtio'/>
|
||||
+ </devices>
|
||||
+</domain>
|
||||
diff --git a/tests/qemuxml2argvdata/video-none-device.args b/tests/qemuxml2argvdata/video-none-device.args
|
||||
new file mode 100644
|
||||
index 0000000000..1b03c0cb97
|
||||
--- /dev/null
|
||||
+++ b/tests/qemuxml2argvdata/video-none-device.args
|
||||
@@ -0,0 +1,27 @@
|
||||
+LC_ALL=C \
|
||||
+PATH=/bin \
|
||||
+HOME=/home/test \
|
||||
+USER=test \
|
||||
+LOGNAME=test \
|
||||
+QEMU_AUDIO_DRV=none \
|
||||
+/usr/bin/qemu-system-i686 \
|
||||
+-name QEMUGuest1 \
|
||||
+-S \
|
||||
+-machine pc,accel=tcg,usb=off,dump-guest-core=off \
|
||||
+-m 214 \
|
||||
+-smp 1,sockets=1,cores=1,threads=1 \
|
||||
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
|
||||
+-no-user-config \
|
||||
+-nodefaults \
|
||||
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
|
||||
+server,nowait \
|
||||
+-mon chardev=charmonitor,id=monitor,mode=control \
|
||||
+-rtc base=utc \
|
||||
+-no-shutdown \
|
||||
+-no-acpi \
|
||||
+-boot c \
|
||||
+-usb \
|
||||
+-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
|
||||
+-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
|
||||
+-vnc 127.0.0.1:0 \
|
||||
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
|
||||
diff --git a/tests/qemuxml2argvdata/video-none-device.xml b/tests/qemuxml2argvdata/video-none-device.xml
|
||||
new file mode 100644
|
||||
index 0000000000..4b591562b7
|
||||
--- /dev/null
|
||||
+++ b/tests/qemuxml2argvdata/video-none-device.xml
|
||||
@@ -0,0 +1,39 @@
|
||||
+<domain type='qemu'>
|
||||
+ <name>QEMUGuest1</name>
|
||||
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||
+ <memory unit='KiB'>219136</memory>
|
||||
+ <currentMemory unit='KiB'>219136</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-i686</emulator>
|
||||
+ <disk type='block' device='disk'>
|
||||
+ <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='ide' index='0'>
|
||||
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
|
||||
+ </controller>
|
||||
+ <controller type='pci' index='0' model='pci-root'/>
|
||||
+ <input type='mouse' bus='ps2'/>
|
||||
+ <input type='keyboard' bus='ps2'/>
|
||||
+ <graphics type='vnc'/>
|
||||
+ <video>
|
||||
+ <model type='none'/>
|
||||
+ </video>
|
||||
+ <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 9237a4fb89..3cff4ffb5e 100644
|
||||
--- a/tests/qemuxml2argvtest.c
|
||||
+++ b/tests/qemuxml2argvtest.c
|
||||
@@ -1998,7 +1998,9 @@ mymain(void)
|
||||
QEMU_CAPS_DEVICE_VIRTIO_VGA,
|
||||
QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
|
||||
QEMU_CAPS_VIRTIO_GPU_MAX_OUTPUTS);
|
||||
- DO_TEST_PARSE_ERROR("video-invalid", NONE);
|
||||
+ DO_TEST("video-none-device",
|
||||
+ QEMU_CAPS_VNC);
|
||||
+ DO_TEST_PARSE_ERROR("video-invalid-multiple-devices", NONE);
|
||||
|
||||
DO_TEST("virtio-rng-default",
|
||||
QEMU_CAPS_DEVICE_VIRTIO_RNG,
|
||||
diff --git a/tests/qemuxml2xmloutdata/video-none-device.xml b/tests/qemuxml2xmloutdata/video-none-device.xml
|
||||
new file mode 100644
|
||||
index 0000000000..6e76b394fe
|
||||
--- /dev/null
|
||||
+++ b/tests/qemuxml2xmloutdata/video-none-device.xml
|
||||
@@ -0,0 +1,42 @@
|
||||
+<domain type='qemu'>
|
||||
+ <name>QEMUGuest1</name>
|
||||
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||
+ <memory unit='KiB'>219136</memory>
|
||||
+ <currentMemory unit='KiB'>219136</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-i686</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='ide' index='0'>
|
||||
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
|
||||
+ </controller>
|
||||
+ <controller type='pci' index='0' model='pci-root'/>
|
||||
+ <input type='mouse' bus='ps2'/>
|
||||
+ <input type='keyboard' bus='ps2'/>
|
||||
+ <graphics type='vnc' port='-1' autoport='yes'>
|
||||
+ <listen type='address'/>
|
||||
+ </graphics>
|
||||
+ <video>
|
||||
+ <model type='none'/>
|
||||
+ </video>
|
||||
+ <memballoon model='virtio'>
|
||||
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
|
||||
+ </memballoon>
|
||||
+ </devices>
|
||||
+</domain>
|
||||
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
|
||||
index e418e67f6c..e35644d479 100644
|
||||
--- a/tests/qemuxml2xmltest.c
|
||||
+++ b/tests/qemuxml2xmltest.c
|
||||
@@ -1145,6 +1145,7 @@ mymain(void)
|
||||
QEMU_CAPS_VIRTIO_GPU_MAX_OUTPUTS,
|
||||
QEMU_CAPS_VNC,
|
||||
QEMU_CAPS_DEVICE_VIRTIO_GPU_CCW);
|
||||
+ DO_TEST("video-none-device", NONE);
|
||||
|
||||
DO_TEST("intel-iommu",
|
||||
QEMU_CAPS_DEVICE_INTEL_IOMMU);
|
||||
--
|
||||
2.18.0
|
||||
|
@ -0,0 +1,574 @@
|
||||
From fddd43e717869d56e481c3fde2d5ee6b5513a1f5 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <fddd43e717869d56e481c3fde2d5ee6b5513a1f5@dist-git>
|
||||
From: Yi Min Zhao <zyimin@linux.ibm.com>
|
||||
Date: Mon, 8 Apr 2019 10:57:25 +0200
|
||||
Subject: [PATCH] conf: Introduce parser, formatter for uid and fid
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This patch introduces new XML parser/formatter functions. Uid is
|
||||
16-bit and non-zero. Fid is 32-bit. They are the two attributes of zpci
|
||||
which is introduced as PCI address element. Zpci element is parsed and
|
||||
formatted along with PCI address. And add the related test cases.
|
||||
|
||||
Signed-off-by: Yi Min Zhao <zyimin@linux.ibm.com>
|
||||
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
||||
Reviewed-by: Stefan Zimmermann <stzi@linux.ibm.com>
|
||||
Reviewed-by: Bjoern Walk <bwalk@linux.ibm.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
|
||||
|
||||
(cherry picked from commit b4833b2c2f7be8a68eb6495ed57ed61918e3ecd8)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1508149
|
||||
|
||||
Conflicts:
|
||||
|
||||
* src/conf/device_conf.c
|
||||
+ context
|
||||
- missing edeef779585
|
||||
|
||||
* tests/qemuxml2argvtest.c
|
||||
+ context
|
||||
- missing a0ff9fbe5cad, 0bdb704383f7
|
||||
|
||||
Changed:
|
||||
|
||||
* tests/qemuxml2argvdata/disk-virtio-s390-zpci.args
|
||||
tests/qemuxml2argvdata/hostdev-vfio-zpci.args
|
||||
+ no -boot in output
|
||||
- missing caccbba64aa9
|
||||
|
||||
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
|
||||
Message-Id: <20190408085732.28684-9-abologna@redhat.com>
|
||||
Reviewed-by: Laine Stump <laine@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
docs/schemas/basictypes.rng | 27 ++++++++++
|
||||
docs/schemas/domaincommon.rng | 1 +
|
||||
src/conf/device_conf.c | 53 +++++++++++++++++++
|
||||
src/conf/domain_addr.c | 3 ++
|
||||
src/conf/domain_conf.c | 12 ++++-
|
||||
src/libvirt_private.syms | 2 +
|
||||
src/util/virpci.c | 26 +++++++++
|
||||
src/util/virpci.h | 6 +++
|
||||
.../disk-virtio-s390-zpci.args | 26 +++++++++
|
||||
.../disk-virtio-s390-zpci.xml | 19 +++++++
|
||||
tests/qemuxml2argvdata/hostdev-vfio-zpci.args | 24 +++++++++
|
||||
tests/qemuxml2argvdata/hostdev-vfio-zpci.xml | 21 ++++++++
|
||||
tests/qemuxml2argvtest.c | 7 +++
|
||||
.../disk-virtio-s390-zpci.xml | 31 +++++++++++
|
||||
.../qemuxml2xmloutdata/hostdev-vfio-zpci.xml | 32 +++++++++++
|
||||
tests/qemuxml2xmltest.c | 6 +++
|
||||
16 files changed, 295 insertions(+), 1 deletion(-)
|
||||
create mode 100644 tests/qemuxml2argvdata/disk-virtio-s390-zpci.args
|
||||
create mode 100644 tests/qemuxml2argvdata/disk-virtio-s390-zpci.xml
|
||||
create mode 100644 tests/qemuxml2argvdata/hostdev-vfio-zpci.args
|
||||
create mode 100644 tests/qemuxml2argvdata/hostdev-vfio-zpci.xml
|
||||
create mode 100644 tests/qemuxml2xmloutdata/disk-virtio-s390-zpci.xml
|
||||
create mode 100644 tests/qemuxml2xmloutdata/hostdev-vfio-zpci.xml
|
||||
|
||||
diff --git a/docs/schemas/basictypes.rng b/docs/schemas/basictypes.rng
|
||||
index b45a7fcdc8..97e14d7ca8 100644
|
||||
--- a/docs/schemas/basictypes.rng
|
||||
+++ b/docs/schemas/basictypes.rng
|
||||
@@ -65,6 +65,17 @@
|
||||
</data>
|
||||
</choice>
|
||||
</define>
|
||||
+ <define name="uint32">
|
||||
+ <choice>
|
||||
+ <data type="string">
|
||||
+ <param name="pattern">(0x)?[0-9a-fA-F]{1,8}</param>
|
||||
+ </data>
|
||||
+ <data type="unsignedInt">
|
||||
+ <param name="minInclusive">0</param>
|
||||
+ <param name="maxInclusive">4294967295</param>
|
||||
+ </data>
|
||||
+ </choice>
|
||||
+ </define>
|
||||
|
||||
<define name="UUID">
|
||||
<choice>
|
||||
@@ -111,6 +122,22 @@
|
||||
</attribute>
|
||||
</optional>
|
||||
</define>
|
||||
+ <define name="zpciaddress">
|
||||
+ <optional>
|
||||
+ <element name="zpci">
|
||||
+ <optional>
|
||||
+ <attribute name="uid">
|
||||
+ <ref name="uint16"/>
|
||||
+ </attribute>
|
||||
+ </optional>
|
||||
+ <optional>
|
||||
+ <attribute name="fid">
|
||||
+ <ref name="uint32"/>
|
||||
+ </attribute>
|
||||
+ </optional>
|
||||
+ </element>
|
||||
+ </optional>
|
||||
+ </define>
|
||||
|
||||
<!-- a 6 byte MAC address in ASCII-hex format, eg "12:34:56:78:9A:BC" -->
|
||||
<!-- The lowest bit of the 1st byte is the "multicast" bit. a -->
|
||||
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
|
||||
index 70a7767d9c..2b6d4dced6 100644
|
||||
--- a/docs/schemas/domaincommon.rng
|
||||
+++ b/docs/schemas/domaincommon.rng
|
||||
@@ -5186,6 +5186,7 @@
|
||||
<value>pci</value>
|
||||
</attribute>
|
||||
<ref name="pciaddress"/>
|
||||
+ <ref name="zpciaddress"/>
|
||||
</group>
|
||||
<group>
|
||||
<attribute name="type">
|
||||
diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c
|
||||
index d69f94fadf..cadac32603 100644
|
||||
--- a/src/conf/device_conf.c
|
||||
+++ b/src/conf/device_conf.c
|
||||
@@ -32,6 +32,45 @@
|
||||
|
||||
#define VIR_FROM_THIS VIR_FROM_DEVICE
|
||||
|
||||
+static int
|
||||
+virZPCIDeviceAddressParseXML(xmlNodePtr node,
|
||||
+ virPCIDeviceAddressPtr addr)
|
||||
+{
|
||||
+ virZPCIDeviceAddress def = { 0 };
|
||||
+ char *uid;
|
||||
+ char *fid;
|
||||
+ int ret = -1;
|
||||
+
|
||||
+ uid = virXMLPropString(node, "uid");
|
||||
+ fid = virXMLPropString(node, "fid");
|
||||
+
|
||||
+ if (uid &&
|
||||
+ virStrToLong_uip(uid, NULL, 0, &def.uid) < 0) {
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
+ _("Cannot parse <address> 'uid' attribute"));
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+
|
||||
+ if (fid &&
|
||||
+ virStrToLong_uip(fid, NULL, 0, &def.fid) < 0) {
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
+ _("Cannot parse <address> 'fid' attribute"));
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+
|
||||
+ if (!virZPCIDeviceAddressIsEmpty(&def) &&
|
||||
+ !virZPCIDeviceAddressIsValid(&def))
|
||||
+ goto cleanup;
|
||||
+
|
||||
+ addr->zpci = def;
|
||||
+ ret = 0;
|
||||
+
|
||||
+ cleanup:
|
||||
+ VIR_FREE(uid);
|
||||
+ VIR_FREE(fid);
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
int
|
||||
virDomainDeviceInfoCopy(virDomainDeviceInfoPtr dst,
|
||||
virDomainDeviceInfoPtr src)
|
||||
@@ -196,6 +235,8 @@ virPCIDeviceAddressParseXML(xmlNodePtr node,
|
||||
virPCIDeviceAddressPtr addr)
|
||||
{
|
||||
char *domain, *slot, *bus, *function, *multi;
|
||||
+ xmlNodePtr cur;
|
||||
+ xmlNodePtr zpci = NULL;
|
||||
int ret = -1;
|
||||
|
||||
memset(addr, 0, sizeof(*addr));
|
||||
@@ -245,6 +286,18 @@ virPCIDeviceAddressParseXML(xmlNodePtr node,
|
||||
if (!virPCIDeviceAddressIsEmpty(addr) && !virPCIDeviceAddressIsValid(addr, true))
|
||||
goto cleanup;
|
||||
|
||||
+ cur = node->children;
|
||||
+ while (cur) {
|
||||
+ if (cur->type == XML_ELEMENT_NODE &&
|
||||
+ virXMLNodeNameEqual(cur, "zpci")) {
|
||||
+ zpci = cur;
|
||||
+ }
|
||||
+ cur = cur->next;
|
||||
+ }
|
||||
+
|
||||
+ if (zpci && virZPCIDeviceAddressParseXML(zpci, addr) < 0)
|
||||
+ goto cleanup;
|
||||
+
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c
|
||||
index 3e33549c3d..9e0a0fdf95 100644
|
||||
--- a/src/conf/domain_addr.c
|
||||
+++ b/src/conf/domain_addr.c
|
||||
@@ -1054,6 +1054,9 @@ virDomainPCIAddressReserveNextAddr(virDomainPCIAddressSetPtr addrs,
|
||||
dev->isolationGroup, false) < 0)
|
||||
return -1;
|
||||
|
||||
+ addr.extFlags = dev->addr.pci.extFlags;
|
||||
+ addr.zpci = dev->addr.pci.zpci;
|
||||
+
|
||||
if (!addrs->dryRun) {
|
||||
dev->type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
|
||||
dev->addr.pci = addr;
|
||||
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
||||
index bcb0558bc3..29ebf0a930 100644
|
||||
--- a/src/conf/domain_conf.c
|
||||
+++ b/src/conf/domain_conf.c
|
||||
@@ -6448,6 +6448,7 @@ virDomainDeviceInfoFormat(virBufferPtr buf,
|
||||
unsigned int flags)
|
||||
{
|
||||
virBuffer attrBuf = VIR_BUFFER_INITIALIZER;
|
||||
+ virBuffer childBuf = VIR_BUFFER_INITIALIZER;
|
||||
|
||||
if ((flags & VIR_DOMAIN_DEF_FORMAT_ALLOW_BOOT) && info->bootIndex) {
|
||||
virBufferAsprintf(buf, "<boot order='%u'", info->bootIndex);
|
||||
@@ -6510,6 +6511,14 @@ virDomainDeviceInfoFormat(virBufferPtr buf,
|
||||
virBufferAsprintf(&attrBuf, " multifunction='%s'",
|
||||
virTristateSwitchTypeToString(info->addr.pci.multi));
|
||||
}
|
||||
+
|
||||
+ if (!virZPCIDeviceAddressIsEmpty(&info->addr.pci.zpci)) {
|
||||
+ virBufferSetChildIndent(&childBuf, buf);
|
||||
+ virBufferAsprintf(&childBuf,
|
||||
+ "<zpci uid='0x%.4x' fid='0x%.8x'/>\n",
|
||||
+ info->addr.pci.zpci.uid,
|
||||
+ info->addr.pci.zpci.fid);
|
||||
+ }
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE:
|
||||
@@ -6577,9 +6586,10 @@ virDomainDeviceInfoFormat(virBufferPtr buf,
|
||||
break;
|
||||
}
|
||||
|
||||
- virXMLFormatElement(buf, "address", &attrBuf, NULL);
|
||||
+ virXMLFormatElement(buf, "address", &attrBuf, &childBuf);
|
||||
|
||||
virBufferFreeAndReset(&attrBuf);
|
||||
+ virBufferFreeAndReset(&childBuf);
|
||||
}
|
||||
|
||||
static int
|
||||
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
|
||||
index df27ac4b3a..b2a2a1f265 100644
|
||||
--- a/src/libvirt_private.syms
|
||||
+++ b/src/libvirt_private.syms
|
||||
@@ -2569,6 +2569,8 @@ virPCIHeaderTypeToString;
|
||||
virPCIIsVirtualFunction;
|
||||
virPCIStubDriverTypeFromString;
|
||||
virPCIStubDriverTypeToString;
|
||||
+virZPCIDeviceAddressIsEmpty;
|
||||
+virZPCIDeviceAddressIsValid;
|
||||
|
||||
|
||||
# util/virperf.h
|
||||
diff --git a/src/util/virpci.c b/src/util/virpci.c
|
||||
index 8d02366664..3a1e49a7a7 100644
|
||||
--- a/src/util/virpci.c
|
||||
+++ b/src/util/virpci.c
|
||||
@@ -2597,6 +2597,32 @@ virPCIDeviceAddressParse(char *address,
|
||||
|
||||
#ifdef __linux__
|
||||
|
||||
+bool
|
||||
+virZPCIDeviceAddressIsValid(virZPCIDeviceAddressPtr zpci)
|
||||
+{
|
||||
+ /* We don't need to check fid because fid covers
|
||||
+ * all range of uint32 type.
|
||||
+ */
|
||||
+ if (zpci->uid > VIR_DOMAIN_DEVICE_ZPCI_MAX_UID ||
|
||||
+ zpci->uid == 0) {
|
||||
+ virReportError(VIR_ERR_XML_ERROR,
|
||||
+ _("Invalid PCI address uid='0x%.4x', "
|
||||
+ "must be > 0x0000 and <= 0x%.4x"),
|
||||
+ zpci->uid,
|
||||
+ VIR_DOMAIN_DEVICE_ZPCI_MAX_UID);
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
+bool
|
||||
+virZPCIDeviceAddressIsEmpty(const virZPCIDeviceAddress *addr)
|
||||
+{
|
||||
+ return !(addr->uid || addr->fid);
|
||||
+}
|
||||
+
|
||||
+
|
||||
/*
|
||||
* returns true if equal
|
||||
*/
|
||||
diff --git a/src/util/virpci.h b/src/util/virpci.h
|
||||
index b366d7d9c3..1ed9e2381e 100644
|
||||
--- a/src/util/virpci.h
|
||||
+++ b/src/util/virpci.h
|
||||
@@ -36,6 +36,9 @@ typedef virPCIDeviceAddress *virPCIDeviceAddressPtr;
|
||||
typedef struct _virPCIDeviceList virPCIDeviceList;
|
||||
typedef virPCIDeviceList *virPCIDeviceListPtr;
|
||||
|
||||
+# define VIR_DOMAIN_DEVICE_ZPCI_MAX_UID UINT16_MAX
|
||||
+# define VIR_DOMAIN_DEVICE_ZPCI_MAX_FID UINT32_MAX
|
||||
+
|
||||
typedef struct _virZPCIDeviceAddress virZPCIDeviceAddress;
|
||||
typedef virZPCIDeviceAddress *virZPCIDeviceAddressPtr;
|
||||
struct _virZPCIDeviceAddress {
|
||||
@@ -235,6 +238,9 @@ int virPCIGetAddrString(unsigned int domain,
|
||||
|
||||
int virPCIDeviceAddressParse(char *address, virPCIDeviceAddressPtr bdf);
|
||||
|
||||
+bool virZPCIDeviceAddressIsValid(virZPCIDeviceAddressPtr zpci);
|
||||
+bool virZPCIDeviceAddressIsEmpty(const virZPCIDeviceAddress *addr);
|
||||
+
|
||||
int virPCIGetVirtualFunctionInfo(const char *vf_sysfs_device_path,
|
||||
int pfNetDevIdx,
|
||||
char **pfname,
|
||||
diff --git a/tests/qemuxml2argvdata/disk-virtio-s390-zpci.args b/tests/qemuxml2argvdata/disk-virtio-s390-zpci.args
|
||||
new file mode 100644
|
||||
index 0000000000..20e63a15b5
|
||||
--- /dev/null
|
||||
+++ b/tests/qemuxml2argvdata/disk-virtio-s390-zpci.args
|
||||
@@ -0,0 +1,26 @@
|
||||
+LC_ALL=C \
|
||||
+PATH=/bin \
|
||||
+HOME=/home/test \
|
||||
+USER=test \
|
||||
+LOGNAME=test \
|
||||
+QEMU_AUDIO_DRV=none \
|
||||
+/usr/bin/qemu-system-s390x \
|
||||
+-name QEMUGuest1 \
|
||||
+-S \
|
||||
+-machine s390-ccw-virtio,accel=tcg,usb=off,dump-guest-core=off \
|
||||
+-m 214 \
|
||||
+-smp 1,sockets=1,cores=1,threads=1 \
|
||||
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
|
||||
+-display none \
|
||||
+-no-user-config \
|
||||
+-nodefaults \
|
||||
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
|
||||
+server,nowait \
|
||||
+-mon chardev=charmonitor,id=monitor,mode=control \
|
||||
+-rtc base=utc \
|
||||
+-no-shutdown \
|
||||
+-boot c \
|
||||
+-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \
|
||||
+-device virtio-blk-pci,bus=pci.0,addr=0x8,drive=drive-virtio-disk0,\
|
||||
+id=virtio-disk0 \
|
||||
+-device virtio-balloon-ccw,id=balloon0,devno=fe.0.0000
|
||||
diff --git a/tests/qemuxml2argvdata/disk-virtio-s390-zpci.xml b/tests/qemuxml2argvdata/disk-virtio-s390-zpci.xml
|
||||
new file mode 100644
|
||||
index 0000000000..8bf4a23670
|
||||
--- /dev/null
|
||||
+++ b/tests/qemuxml2argvdata/disk-virtio-s390-zpci.xml
|
||||
@@ -0,0 +1,19 @@
|
||||
+<domain type='qemu'>
|
||||
+ <name>QEMUGuest1</name>
|
||||
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||
+ <memory>219136</memory>
|
||||
+ <vcpu>1</vcpu>
|
||||
+ <os>
|
||||
+ <type arch='s390x' machine='s390-ccw-virtio'>hvm</type>
|
||||
+ </os>
|
||||
+ <devices>
|
||||
+ <emulator>/usr/bin/qemu-system-s390x</emulator>
|
||||
+ <disk type='block' device='disk'>
|
||||
+ <source dev='/dev/HostVG/QEMUGuest1'/>
|
||||
+ <target dev='hda' bus='virtio'/>
|
||||
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'>
|
||||
+ <zpci uid='0x0019' fid='0x0000001f'/>
|
||||
+ </address>
|
||||
+ </disk>
|
||||
+ </devices>
|
||||
+</domain>
|
||||
diff --git a/tests/qemuxml2argvdata/hostdev-vfio-zpci.args b/tests/qemuxml2argvdata/hostdev-vfio-zpci.args
|
||||
new file mode 100644
|
||||
index 0000000000..622c504da0
|
||||
--- /dev/null
|
||||
+++ b/tests/qemuxml2argvdata/hostdev-vfio-zpci.args
|
||||
@@ -0,0 +1,24 @@
|
||||
+LC_ALL=C \
|
||||
+PATH=/bin \
|
||||
+HOME=/home/test \
|
||||
+USER=test \
|
||||
+LOGNAME=test \
|
||||
+QEMU_AUDIO_DRV=none \
|
||||
+/usr/bin/qemu-system-s390x \
|
||||
+-name QEMUGuest1 \
|
||||
+-S \
|
||||
+-machine s390-ccw-virtio,accel=tcg,usb=off,dump-guest-core=off \
|
||||
+-m 214 \
|
||||
+-smp 1,sockets=1,cores=1,threads=1 \
|
||||
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
|
||||
+-display none \
|
||||
+-no-user-config \
|
||||
+-nodefaults \
|
||||
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
|
||||
+server,nowait \
|
||||
+-mon chardev=charmonitor,id=monitor,mode=control \
|
||||
+-rtc base=utc \
|
||||
+-no-shutdown \
|
||||
+-boot c \
|
||||
+-device vfio-pci,host=00:00.0,id=hostdev0,bus=pci.0,addr=0x8 \
|
||||
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x1
|
||||
diff --git a/tests/qemuxml2argvdata/hostdev-vfio-zpci.xml b/tests/qemuxml2argvdata/hostdev-vfio-zpci.xml
|
||||
new file mode 100644
|
||||
index 0000000000..002b99c52d
|
||||
--- /dev/null
|
||||
+++ b/tests/qemuxml2argvdata/hostdev-vfio-zpci.xml
|
||||
@@ -0,0 +1,21 @@
|
||||
+<domain type='qemu'>
|
||||
+ <name>QEMUGuest1</name>
|
||||
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||
+ <memory>219100</memory>
|
||||
+ <os>
|
||||
+ <type arch='s390x' machine='s390-ccw-virtio'>hvm</type>
|
||||
+ </os>
|
||||
+ <devices>
|
||||
+ <emulator>/usr/bin/qemu-system-s390x</emulator>
|
||||
+ <controller type='pci' index='0' model='pci-root'/>
|
||||
+ <hostdev mode='subsystem' type='pci' managed='no'>
|
||||
+ <driver name='vfio'/>
|
||||
+ <source>
|
||||
+ <address domain='0x0000' bus='0x00' slot='0x00' function='0x0'/>
|
||||
+ </source>
|
||||
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'>
|
||||
+ <zpci uid='0x0019' fid='0x0000001f'/>
|
||||
+ </address>
|
||||
+ </hostdev>
|
||||
+ </devices>
|
||||
+</domain>
|
||||
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
|
||||
index 7f25cccf9d..2eb2505971 100644
|
||||
--- a/tests/qemuxml2argvtest.c
|
||||
+++ b/tests/qemuxml2argvtest.c
|
||||
@@ -1038,6 +1038,10 @@ mymain(void)
|
||||
QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
|
||||
DO_TEST("disk-virtio-scsi-ccw", QEMU_CAPS_VIRTIO_SCSI,
|
||||
QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
|
||||
+ DO_TEST("disk-virtio-s390-zpci",
|
||||
+ QEMU_CAPS_DEVICE_ZPCI,
|
||||
+ QEMU_CAPS_CCW,
|
||||
+ QEMU_CAPS_VIRTIO_S390);
|
||||
DO_TEST("disk-order",
|
||||
QEMU_CAPS_DRIVE_BOOT, QEMU_CAPS_VIRTIO_BLK_SCSI);
|
||||
DO_TEST("disk-virtio-drive-queues",
|
||||
@@ -1628,6 +1632,9 @@ mymain(void)
|
||||
DO_TEST_PARSE_ERROR("hostdev-mdev-display-missing-graphics",
|
||||
QEMU_CAPS_DEVICE_VFIO_PCI,
|
||||
QEMU_CAPS_VFIO_PCI_DISPLAY);
|
||||
+ DO_TEST("hostdev-vfio-zpci",
|
||||
+ QEMU_CAPS_DEVICE_VFIO_PCI,
|
||||
+ QEMU_CAPS_DEVICE_ZPCI);
|
||||
DO_TEST("pci-rom", NONE);
|
||||
DO_TEST("pci-rom-disabled", NONE);
|
||||
DO_TEST("pci-rom-disabled-invalid", NONE);
|
||||
diff --git a/tests/qemuxml2xmloutdata/disk-virtio-s390-zpci.xml b/tests/qemuxml2xmloutdata/disk-virtio-s390-zpci.xml
|
||||
new file mode 100644
|
||||
index 0000000000..37684c82b1
|
||||
--- /dev/null
|
||||
+++ b/tests/qemuxml2xmloutdata/disk-virtio-s390-zpci.xml
|
||||
@@ -0,0 +1,31 @@
|
||||
+<domain type='qemu'>
|
||||
+ <name>QEMUGuest1</name>
|
||||
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||
+ <memory unit='KiB'>219136</memory>
|
||||
+ <currentMemory unit='KiB'>219136</currentMemory>
|
||||
+ <vcpu placement='static'>1</vcpu>
|
||||
+ <os>
|
||||
+ <type arch='s390x' machine='s390-ccw-virtio'>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-s390x</emulator>
|
||||
+ <disk type='block' device='disk'>
|
||||
+ <driver name='qemu' type='raw'/>
|
||||
+ <source dev='/dev/HostVG/QEMUGuest1'/>
|
||||
+ <target dev='hda' bus='virtio'/>
|
||||
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'>
|
||||
+ <zpci uid='0x0019' fid='0x0000001f'/>
|
||||
+ </address>
|
||||
+ </disk>
|
||||
+ <controller type='pci' index='0' model='pci-root'/>
|
||||
+ <memballoon model='virtio'>
|
||||
+ <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0000'/>
|
||||
+ </memballoon>
|
||||
+ <panic model='s390'/>
|
||||
+ </devices>
|
||||
+</domain>
|
||||
diff --git a/tests/qemuxml2xmloutdata/hostdev-vfio-zpci.xml b/tests/qemuxml2xmloutdata/hostdev-vfio-zpci.xml
|
||||
new file mode 100644
|
||||
index 0000000000..fc8c38ab66
|
||||
--- /dev/null
|
||||
+++ b/tests/qemuxml2xmloutdata/hostdev-vfio-zpci.xml
|
||||
@@ -0,0 +1,32 @@
|
||||
+<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='s390x' machine='s390-ccw-virtio'>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-s390x</emulator>
|
||||
+ <controller type='pci' index='0' model='pci-root'/>
|
||||
+ <hostdev mode='subsystem' type='pci' managed='no'>
|
||||
+ <driver name='vfio'/>
|
||||
+ <source>
|
||||
+ <address domain='0x0000' bus='0x00' slot='0x00' function='0x0'/>
|
||||
+ </source>
|
||||
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'>
|
||||
+ <zpci uid='0x0019' fid='0x0000001f'/>
|
||||
+ </address>
|
||||
+ </hostdev>
|
||||
+ <memballoon model='virtio'>
|
||||
+ <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0000'/>
|
||||
+ </memballoon>
|
||||
+ <panic model='s390'/>
|
||||
+ </devices>
|
||||
+</domain>
|
||||
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
|
||||
index 2a2bf01ffa..a787f4f4a3 100644
|
||||
--- a/tests/qemuxml2xmltest.c
|
||||
+++ b/tests/qemuxml2xmltest.c
|
||||
@@ -400,6 +400,9 @@ mymain(void)
|
||||
QEMU_CAPS_VIRTIO_SCSI);
|
||||
DO_TEST("disk-virtio-scsi-ioeventfd",
|
||||
QEMU_CAPS_VIRTIO_SCSI);
|
||||
+ DO_TEST("disk-virtio-s390-zpci",
|
||||
+ QEMU_CAPS_DEVICE_ZPCI,
|
||||
+ QEMU_CAPS_CCW);
|
||||
DO_TEST("disk-scsi-megasas",
|
||||
QEMU_CAPS_SCSI_MEGASAS);
|
||||
DO_TEST("disk-scsi-mptsas1068",
|
||||
@@ -482,6 +485,9 @@ mymain(void)
|
||||
DO_TEST("hostdev-usb-address", NONE);
|
||||
DO_TEST("hostdev-pci-address", NONE);
|
||||
DO_TEST("hostdev-vfio", NONE);
|
||||
+ DO_TEST("hostdev-vfio-zpci",
|
||||
+ QEMU_CAPS_DEVICE_ZPCI,
|
||||
+ QEMU_CAPS_CCW);
|
||||
DO_TEST("hostdev-mdev-precreated", NONE);
|
||||
DO_TEST("hostdev-mdev-display", QEMU_CAPS_VFIO_PCI_DISPLAY);
|
||||
DO_TEST("pci-rom", NONE);
|
||||
--
|
||||
2.22.0
|
||||
|
103
SOURCES/libvirt-conf-Introduce-virCPUDefCheckFeatures.patch
Normal file
103
SOURCES/libvirt-conf-Introduce-virCPUDefCheckFeatures.patch
Normal file
@ -0,0 +1,103 @@
|
||||
From 0bed2e17ea6469ccabb374c0520a97706b281911 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <0bed2e17ea6469ccabb374c0520a97706b281911@dist-git>
|
||||
From: Jiri Denemark <jdenemar@redhat.com>
|
||||
Date: Fri, 21 Jun 2019 09:26:06 +0200
|
||||
Subject: [PATCH] conf: Introduce virCPUDefCheckFeatures
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This API can be used to check whether a CPU definition contains features
|
||||
matching a given filter.
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit 4e6f58b8d55d44fa9f80736b2745b44710f6e25a)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1697627
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Message-Id: <ea489f203e2d52250acb1b9656de6aba8355f3a6.1561068591.git.jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
src/conf/cpu_conf.c | 33 +++++++++++++++++++++++++++++++++
|
||||
src/conf/cpu_conf.h | 6 ++++++
|
||||
src/libvirt_private.syms | 1 +
|
||||
3 files changed, 40 insertions(+)
|
||||
|
||||
diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
|
||||
index 51e2a83eae..4cccea9981 100644
|
||||
--- a/src/conf/cpu_conf.c
|
||||
+++ b/src/conf/cpu_conf.c
|
||||
@@ -872,6 +872,39 @@ virCPUDefFilterFeatures(virCPUDefPtr cpu,
|
||||
}
|
||||
|
||||
|
||||
+/**
|
||||
+ * virCPUDefCheckFeatures:
|
||||
+ *
|
||||
+ * Check CPU features for which @filter reports true and store them in a NULL
|
||||
+ * terminated list returned via @features.
|
||||
+ *
|
||||
+ * Returns the number of features matching @filter or -1 on error.
|
||||
+ */
|
||||
+int
|
||||
+virCPUDefCheckFeatures(virCPUDefPtr cpu,
|
||||
+ virCPUDefFeatureFilter filter,
|
||||
+ void *opaque,
|
||||
+ char ***features)
|
||||
+{
|
||||
+ VIR_AUTOSTRINGLIST list = NULL;
|
||||
+ size_t n = 0;
|
||||
+ size_t i;
|
||||
+
|
||||
+ *features = NULL;
|
||||
+
|
||||
+ for (i = 0; i < cpu->nfeatures; i++) {
|
||||
+ if (filter(cpu->features[i].name, opaque)) {
|
||||
+ if (virStringListAdd(&list, cpu->features[i].name) < 0)
|
||||
+ return -1;
|
||||
+ n++;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ VIR_STEAL_PTR(*features, list);
|
||||
+ return n;
|
||||
+}
|
||||
+
|
||||
+
|
||||
bool
|
||||
virCPUDefIsEqual(virCPUDefPtr src,
|
||||
virCPUDefPtr dst,
|
||||
diff --git a/src/conf/cpu_conf.h b/src/conf/cpu_conf.h
|
||||
index ad25932b9b..cba0ec7c81 100644
|
||||
--- a/src/conf/cpu_conf.h
|
||||
+++ b/src/conf/cpu_conf.h
|
||||
@@ -225,6 +225,12 @@ virCPUDefFilterFeatures(virCPUDefPtr cpu,
|
||||
virCPUDefFeatureFilter filter,
|
||||
void *opaque);
|
||||
|
||||
+int
|
||||
+virCPUDefCheckFeatures(virCPUDefPtr cpu,
|
||||
+ virCPUDefFeatureFilter filter,
|
||||
+ void *opaque,
|
||||
+ char ***features);
|
||||
+
|
||||
virCPUDefPtr *
|
||||
virCPUDefListParse(const char **xmlCPUs,
|
||||
unsigned int ncpus,
|
||||
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
|
||||
index 06374deaae..0290f960a0 100644
|
||||
--- a/src/libvirt_private.syms
|
||||
+++ b/src/libvirt_private.syms
|
||||
@@ -72,6 +72,7 @@ virCapabilitiesSetNetPrefix;
|
||||
virCPUCacheModeTypeFromString;
|
||||
virCPUCacheModeTypeToString;
|
||||
virCPUDefAddFeature;
|
||||
+virCPUDefCheckFeatures;
|
||||
virCPUDefCopy;
|
||||
virCPUDefCopyModel;
|
||||
virCPUDefCopyModelFilter;
|
||||
--
|
||||
2.22.0
|
||||
|
@ -0,0 +1,210 @@
|
||||
From cb0d627bf064a14c83f3d34e8b73d77ed1733843 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <cb0d627bf064a14c83f3d34e8b73d77ed1733843@dist-git>
|
||||
From: Pavel Hrdina <phrdina@redhat.com>
|
||||
Date: Mon, 13 Aug 2018 19:21:54 +0200
|
||||
Subject: [PATCH] conf: Introduce virDomainDefPostParseMemtune
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Previously we were ignoring "nodeset" attribute for hugepage pages
|
||||
if there was no guest NUMA topology configured in the domain XML.
|
||||
Commit <fa6bdf6afa878b8d7c5ed71664ee72be8967cdc5> partially fixed
|
||||
that issue but it introduced a somehow valid regression.
|
||||
|
||||
In case that there is no guest NUMA topology configured and the
|
||||
"nodeset" attribute is set to "0" it was accepted and was working
|
||||
properly even though it was not completely valid XML.
|
||||
|
||||
This patch introduces a workaround that it will ignore the nodeset="0"
|
||||
only in case that there is no guest NUMA topology in order not to
|
||||
hit the validation error.
|
||||
|
||||
After this commit the following XML configuration is valid:
|
||||
|
||||
<memoryBacking>
|
||||
<hugepages>
|
||||
<page size='2048' unit='KiB' nodeset='0'/>
|
||||
</hugepages>
|
||||
</memoryBacking>
|
||||
|
||||
but this configuration remains invalid:
|
||||
|
||||
<memoryBacking>
|
||||
<hugepages>
|
||||
<page size='2048' unit='KiB' nodeset='0'/>
|
||||
<page size='1048576' unit='KiB'/>
|
||||
</hugepages>
|
||||
</memoryBacking>
|
||||
|
||||
The issue with the second configuration is that it was originally
|
||||
working, however changing the order of the <page> elements resolved
|
||||
into using different page size for the guest. The code is written
|
||||
in a way that it expect only one page configured and always uses only
|
||||
the first page in case that there is no guest NUMA topology configured.
|
||||
See qemuBuildMemPathStr() function for details.
|
||||
|
||||
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1591235
|
||||
|
||||
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
|
||||
(cherry picked from commit 0a476f152150f62306f9f8d124aa44e4adb9158c)
|
||||
|
||||
Conflicts:
|
||||
tests/qemuxml2argvdata/hugepages-nodeset.args
|
||||
- missing upstream commit <caccbba64a>
|
||||
|
||||
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1615461
|
||||
|
||||
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
src/conf/domain_conf.c | 27 +++++++++++++++++
|
||||
tests/qemuxml2argvdata/hugepages-nodeset.args | 26 ++++++++++++++++
|
||||
tests/qemuxml2argvtest.c | 2 +-
|
||||
.../qemuxml2xmloutdata/hugepages-nodeset.xml | 30 +++++++++++++++++++
|
||||
tests/qemuxml2xmltest.c | 1 +
|
||||
5 files changed, 85 insertions(+), 1 deletion(-)
|
||||
create mode 100644 tests/qemuxml2argvdata/hugepages-nodeset.args
|
||||
create mode 100644 tests/qemuxml2xmloutdata/hugepages-nodeset.xml
|
||||
|
||||
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
||||
index 98e833c5bb..8a43e607e9 100644
|
||||
--- a/src/conf/domain_conf.c
|
||||
+++ b/src/conf/domain_conf.c
|
||||
@@ -4088,6 +4088,31 @@ virDomainDefPostParseMemory(virDomainDefPtr def,
|
||||
}
|
||||
|
||||
|
||||
+static void
|
||||
+virDomainDefPostParseMemtune(virDomainDefPtr def)
|
||||
+{
|
||||
+ size_t i;
|
||||
+
|
||||
+ if (virDomainNumaGetNodeCount(def->numa) == 0) {
|
||||
+ /* If guest NUMA is not configured and any hugepage page has nodemask
|
||||
+ * set to "0" free and clear that nodemas, otherwise we would rise
|
||||
+ * an error that there is no guest NUMA node configured. */
|
||||
+ for (i = 0; i < def->mem.nhugepages; i++) {
|
||||
+ ssize_t nextBit;
|
||||
+
|
||||
+ if (!def->mem.hugepages[i].nodemask)
|
||||
+ continue;
|
||||
+
|
||||
+ nextBit = virBitmapNextSetBit(def->mem.hugepages[i].nodemask, 0);
|
||||
+ if (nextBit < 0) {
|
||||
+ virBitmapFree(def->mem.hugepages[i].nodemask);
|
||||
+ def->mem.hugepages[i].nodemask = NULL;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+
|
||||
static int
|
||||
virDomainDefAddConsoleCompat(virDomainDefPtr def)
|
||||
{
|
||||
@@ -5155,6 +5180,8 @@ virDomainDefPostParseCommon(virDomainDefPtr def,
|
||||
if (virDomainDefPostParseMemory(def, data->parseFlags) < 0)
|
||||
return -1;
|
||||
|
||||
+ virDomainDefPostParseMemtune(def);
|
||||
+
|
||||
if (virDomainDefRejectDuplicateControllers(def) < 0)
|
||||
return -1;
|
||||
|
||||
diff --git a/tests/qemuxml2argvdata/hugepages-nodeset.args b/tests/qemuxml2argvdata/hugepages-nodeset.args
|
||||
new file mode 100644
|
||||
index 0000000000..d094be1252
|
||||
--- /dev/null
|
||||
+++ b/tests/qemuxml2argvdata/hugepages-nodeset.args
|
||||
@@ -0,0 +1,26 @@
|
||||
+LC_ALL=C \
|
||||
+PATH=/bin \
|
||||
+HOME=/home/test \
|
||||
+USER=test \
|
||||
+LOGNAME=test \
|
||||
+QEMU_AUDIO_DRV=none \
|
||||
+/usr/bin/qemu-system-i686 \
|
||||
+-name SomeDummyHugepagesGuest \
|
||||
+-S \
|
||||
+-machine pc,accel=tcg,usb=off,dump-guest-core=off \
|
||||
+-m 1024 \
|
||||
+-mem-prealloc \
|
||||
+-mem-path /dev/hugepages2M/libvirt/qemu/-1-SomeDummyHugepagesGu \
|
||||
+-smp 2,sockets=2,cores=1,threads=1 \
|
||||
+-uuid ef1bdff4-27f3-4e85-a807-5fb4d58463cc \
|
||||
+-display none \
|
||||
+-no-user-config \
|
||||
+-nodefaults \
|
||||
+-chardev socket,id=charmonitor,\
|
||||
+path=/tmp/lib/domain--1-SomeDummyHugepagesGu/monitor.sock,server,nowait \
|
||||
+-mon chardev=charmonitor,id=monitor,mode=control \
|
||||
+-rtc base=utc \
|
||||
+-no-shutdown \
|
||||
+-no-acpi \
|
||||
+-boot c \
|
||||
+-usb
|
||||
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
|
||||
index f82bca2637..e6c0120670 100644
|
||||
--- a/tests/qemuxml2argvtest.c
|
||||
+++ b/tests/qemuxml2argvtest.c
|
||||
@@ -960,7 +960,7 @@ mymain(void)
|
||||
DO_TEST("hugepages-default-2M", NONE);
|
||||
DO_TEST("hugepages-default-system-size", NONE);
|
||||
DO_TEST_PARSE_ERROR("hugepages-default-1G-nodeset-2M", NONE);
|
||||
- DO_TEST_PARSE_ERROR("hugepages-nodeset", NONE);
|
||||
+ DO_TEST("hugepages-nodeset", NONE);
|
||||
DO_TEST_PARSE_ERROR("hugepages-nodeset-nonexist",
|
||||
QEMU_CAPS_DEVICE_PC_DIMM,
|
||||
QEMU_CAPS_OBJECT_MEMORY_FILE,
|
||||
diff --git a/tests/qemuxml2xmloutdata/hugepages-nodeset.xml b/tests/qemuxml2xmloutdata/hugepages-nodeset.xml
|
||||
new file mode 100644
|
||||
index 0000000000..ac219a7800
|
||||
--- /dev/null
|
||||
+++ b/tests/qemuxml2xmloutdata/hugepages-nodeset.xml
|
||||
@@ -0,0 +1,30 @@
|
||||
+<domain type='qemu'>
|
||||
+ <name>SomeDummyHugepagesGuest</name>
|
||||
+ <uuid>ef1bdff4-27f3-4e85-a807-5fb4d58463cc</uuid>
|
||||
+ <memory unit='KiB'>1048576</memory>
|
||||
+ <currentMemory unit='KiB'>1048576</currentMemory>
|
||||
+ <memoryBacking>
|
||||
+ <hugepages>
|
||||
+ <page size='2048' unit='KiB'/>
|
||||
+ </hugepages>
|
||||
+ </memoryBacking>
|
||||
+ <vcpu placement='static'>2</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-i686</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='none'/>
|
||||
+ </devices>
|
||||
+</domain>
|
||||
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
|
||||
index aa543e9e51..b76410b2c1 100644
|
||||
--- a/tests/qemuxml2xmltest.c
|
||||
+++ b/tests/qemuxml2xmltest.c
|
||||
@@ -336,6 +336,7 @@ mymain(void)
|
||||
DO_TEST("hugepages-default", NONE);
|
||||
DO_TEST("hugepages-default-2M", NONE);
|
||||
DO_TEST("hugepages-default-system-size", NONE);
|
||||
+ DO_TEST("hugepages-nodeset", NONE);
|
||||
DO_TEST("hugepages-numa-default-2M", NONE);
|
||||
DO_TEST("hugepages-numa-default-dimm", NONE);
|
||||
DO_TEST("hugepages-numa-nodeset", NONE);
|
||||
--
|
||||
2.18.0
|
||||
|
@ -0,0 +1,89 @@
|
||||
From 2f954b30573d57ab0b5d68364afa6168d00ca3e6 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <2f954b30573d57ab0b5d68364afa6168d00ca3e6@dist-git>
|
||||
From: Erik Skultety <eskultet@redhat.com>
|
||||
Date: Thu, 19 Jul 2018 15:03:52 +0200
|
||||
Subject: [PATCH] conf: Introduce virDomainDefPostParseVideo helper
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Move the video post parse bits into a separate helper as the logic is
|
||||
going to be extended in the future.
|
||||
|
||||
Signed-off-by: Erik Skultety <eskultet@redhat.com>
|
||||
Reviewed-by: John Ferlan <jferlan@redhat.com>
|
||||
(cherry picked from commit 75aa179ad68f5845955128b9f047a43c8e5c9066)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1475770
|
||||
Signed-off-by: Erik Skultety <eskultet@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
src/conf/domain_conf.c | 45 ++++++++++++++++++++++++++++--------------
|
||||
1 file changed, 30 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
||||
index d23b2861ef..db8e17dac4 100644
|
||||
--- a/src/conf/domain_conf.c
|
||||
+++ b/src/conf/domain_conf.c
|
||||
@@ -5097,6 +5097,34 @@ virDomainDefBootOrderPostParse(virDomainDefPtr def)
|
||||
}
|
||||
|
||||
|
||||
+static int
|
||||
+virDomainDefPostParseVideo(virDomainDefPtr def,
|
||||
+ void *opaque)
|
||||
+{
|
||||
+ if (def->nvideos == 0)
|
||||
+ return 0;
|
||||
+
|
||||
+ virDomainDeviceDef device = {
|
||||
+ .type = VIR_DOMAIN_DEVICE_VIDEO,
|
||||
+ .data.video = def->videos[0],
|
||||
+ };
|
||||
+
|
||||
+ /* Mark the first video as primary. If the user specified
|
||||
+ * primary="yes", the parser already inserted the device at
|
||||
+ * def->videos[0]
|
||||
+ */
|
||||
+ def->videos[0]->primary = true;
|
||||
+
|
||||
+ /* videos[0] might have been added in AddImplicitDevices, after we've
|
||||
+ * done the per-device post-parse */
|
||||
+ if (virDomainDefPostParseDeviceIterator(def, &device,
|
||||
+ NULL, opaque) < 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
static int
|
||||
virDomainDefPostParseCommon(virDomainDefPtr def,
|
||||
struct virDomainDefPostParseDeviceIteratorData *data)
|
||||
@@ -5133,21 +5161,8 @@ virDomainDefPostParseCommon(virDomainDefPtr def,
|
||||
if (virDomainDefAddImplicitDevices(def) < 0)
|
||||
return -1;
|
||||
|
||||
- if (def->nvideos != 0) {
|
||||
- virDomainDeviceDef device = {
|
||||
- .type = VIR_DOMAIN_DEVICE_VIDEO,
|
||||
- .data.video = def->videos[0],
|
||||
- };
|
||||
-
|
||||
- /* Mark the first video as primary. If the user specified primary="yes",
|
||||
- * the parser already inserted the device at def->videos[0] */
|
||||
- def->videos[0]->primary = true;
|
||||
-
|
||||
- /* videos[0] might have been added in AddImplicitDevices, after we've
|
||||
- * done the per-device post-parse */
|
||||
- if (virDomainDefPostParseDeviceIterator(def, &device, NULL, data) < 0)
|
||||
- return -1;
|
||||
- }
|
||||
+ if (virDomainDefPostParseVideo(def, data) < 0)
|
||||
+ return -1;
|
||||
|
||||
if (def->nserials != 0) {
|
||||
virDomainDeviceDef device = {
|
||||
--
|
||||
2.18.0
|
||||
|
@ -0,0 +1,105 @@
|
||||
From e6b37b93dd6e7ec133378aec04dd9c96e0ab57cb Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <e6b37b93dd6e7ec133378aec04dd9c96e0ab57cb@dist-git>
|
||||
From: Erik Skultety <eskultet@redhat.com>
|
||||
Date: Thu, 19 Jul 2018 15:04:00 +0200
|
||||
Subject: [PATCH] conf: Introduce virDomainGraphicsDefHasOpenGL helper
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
A simple helper which will loop through all the graphics elements and
|
||||
checks whether at least one of them enables OpenGL support, either by
|
||||
containing <gl enable='yes'/> or being of type 'egl-headless'.
|
||||
|
||||
Signed-off-by: Erik Skultety <eskultet@redhat.com>
|
||||
Acked-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit 425329181f1db19f34a8ffffc1da9afa7f323f13)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1475770
|
||||
Signed-off-by: Erik Skultety <eskultet@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
src/conf/domain_conf.c | 43 ++++++++++++++++++++++++++++++++++++++++
|
||||
src/conf/domain_conf.h | 3 +++
|
||||
src/libvirt_private.syms | 1 +
|
||||
3 files changed, 47 insertions(+)
|
||||
|
||||
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
||||
index fa4dfafcff..08654ab41d 100644
|
||||
--- a/src/conf/domain_conf.c
|
||||
+++ b/src/conf/domain_conf.c
|
||||
@@ -30284,3 +30284,46 @@ virDomainDefHasManagedPR(const virDomainDef *def)
|
||||
|
||||
return false;
|
||||
}
|
||||
+
|
||||
+
|
||||
+/**
|
||||
+ * virDomainGraphicsDefHasOpenGL:
|
||||
+ * @def: domain definition
|
||||
+ *
|
||||
+ * Returns true if a domain config contains at least one <graphics> element
|
||||
+ * with OpenGL support enabled, false otherwise.
|
||||
+ */
|
||||
+bool
|
||||
+virDomainGraphicsDefHasOpenGL(const virDomainDef *def)
|
||||
+{
|
||||
+ size_t i;
|
||||
+
|
||||
+ for (i = 0; i < def->ngraphics; i++) {
|
||||
+ virDomainGraphicsDefPtr graphics = def->graphics[i];
|
||||
+
|
||||
+ /* we only care about OpenGL support for a given type here */
|
||||
+ switch (graphics->type) {
|
||||
+ case VIR_DOMAIN_GRAPHICS_TYPE_VNC:
|
||||
+ case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
|
||||
+ case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP:
|
||||
+ continue;
|
||||
+ case VIR_DOMAIN_GRAPHICS_TYPE_SDL:
|
||||
+ if (graphics->data.sdl.gl == VIR_TRISTATE_BOOL_YES)
|
||||
+ return true;
|
||||
+
|
||||
+ continue;
|
||||
+ case VIR_DOMAIN_GRAPHICS_TYPE_SPICE:
|
||||
+ if (graphics->data.spice.gl == VIR_TRISTATE_BOOL_YES)
|
||||
+ return true;
|
||||
+
|
||||
+ continue;
|
||||
+ case VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS:
|
||||
+ return true;
|
||||
+
|
||||
+ case VIR_DOMAIN_GRAPHICS_TYPE_LAST:
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return false;
|
||||
+}
|
||||
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
|
||||
index 26f75b15d0..3deda1d978 100644
|
||||
--- a/src/conf/domain_conf.h
|
||||
+++ b/src/conf/domain_conf.h
|
||||
@@ -3642,4 +3642,7 @@ virDomainDiskGetDetectZeroesMode(virDomainDiskDiscard discard,
|
||||
bool
|
||||
virDomainDefHasManagedPR(const virDomainDef *def);
|
||||
|
||||
+bool
|
||||
+virDomainGraphicsDefHasOpenGL(const virDomainDef *def);
|
||||
+
|
||||
#endif /* __DOMAIN_CONF_H */
|
||||
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
|
||||
index 5bd08d3f67..86846f3b08 100644
|
||||
--- a/src/libvirt_private.syms
|
||||
+++ b/src/libvirt_private.syms
|
||||
@@ -368,6 +368,7 @@ virDomainGetFilesystemForTarget;
|
||||
virDomainGraphicsAuthConnectedTypeFromString;
|
||||
virDomainGraphicsAuthConnectedTypeToString;
|
||||
virDomainGraphicsDefFree;
|
||||
+virDomainGraphicsDefHasOpenGL;
|
||||
virDomainGraphicsGetListen;
|
||||
virDomainGraphicsListenAppendAddress;
|
||||
virDomainGraphicsListenAppendSocket;
|
||||
--
|
||||
2.18.0
|
||||
|
@ -0,0 +1,84 @@
|
||||
From f60ad6c8636b58d8559963aaf2e445bb4dd3db63 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <f60ad6c8636b58d8559963aaf2e445bb4dd3db63@dist-git>
|
||||
From: Erik Skultety <eskultet@redhat.com>
|
||||
Date: Thu, 19 Jul 2018 15:03:51 +0200
|
||||
Subject: [PATCH] conf: Introduce virDomainVideoDefClear helper
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Future patches rely on the ability to reset the contents of the
|
||||
virDomainVideoDef structure rather than re-allocating it.
|
||||
|
||||
Signed-off-by: Erik Skultety <eskultet@redhat.com>
|
||||
Reviewed-by: John Ferlan <jferlan@redhat.com>
|
||||
(cherry picked from commit f317b1e5c57291644c841cb620eda86dac8642a1)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1475770
|
||||
Signed-off-by: Erik Skultety <eskultet@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
src/conf/domain_conf.c | 14 +++++++++++++-
|
||||
src/conf/domain_conf.h | 1 +
|
||||
src/libvirt_private.syms | 1 +
|
||||
3 files changed, 15 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
||||
index 70eb45f03a..d23b2861ef 100644
|
||||
--- a/src/conf/domain_conf.c
|
||||
+++ b/src/conf/domain_conf.c
|
||||
@@ -2538,7 +2538,8 @@ virDomainVideoDefNew(void)
|
||||
}
|
||||
|
||||
|
||||
-void virDomainVideoDefFree(virDomainVideoDefPtr def)
|
||||
+void
|
||||
+virDomainVideoDefClear(virDomainVideoDefPtr def)
|
||||
{
|
||||
if (!def)
|
||||
return;
|
||||
@@ -2548,6 +2549,17 @@ void virDomainVideoDefFree(virDomainVideoDefPtr def)
|
||||
VIR_FREE(def->accel);
|
||||
VIR_FREE(def->virtio);
|
||||
VIR_FREE(def->driver);
|
||||
+
|
||||
+ memset(def, 0, sizeof(*def));
|
||||
+}
|
||||
+
|
||||
+
|
||||
+void virDomainVideoDefFree(virDomainVideoDefPtr def)
|
||||
+{
|
||||
+ if (!def)
|
||||
+ return;
|
||||
+
|
||||
+ virDomainVideoDefClear(def);
|
||||
VIR_FREE(def);
|
||||
}
|
||||
|
||||
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
|
||||
index 41d27482fb..1fc1734bcc 100644
|
||||
--- a/src/conf/domain_conf.h
|
||||
+++ b/src/conf/domain_conf.h
|
||||
@@ -2884,6 +2884,7 @@ void virDomainNVRAMDefFree(virDomainNVRAMDefPtr def);
|
||||
void virDomainWatchdogDefFree(virDomainWatchdogDefPtr def);
|
||||
virDomainVideoDefPtr virDomainVideoDefNew(void);
|
||||
void virDomainVideoDefFree(virDomainVideoDefPtr def);
|
||||
+void virDomainVideoDefClear(virDomainVideoDefPtr def);
|
||||
virDomainHostdevDefPtr virDomainHostdevDefNew(void);
|
||||
void virDomainHostdevDefClear(virDomainHostdevDefPtr def);
|
||||
void virDomainHostdevDefFree(virDomainHostdevDefPtr def);
|
||||
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
|
||||
index 5499a368c0..5bd08d3f67 100644
|
||||
--- a/src/libvirt_private.syms
|
||||
+++ b/src/libvirt_private.syms
|
||||
@@ -567,6 +567,7 @@ virDomainTPMModelTypeToString;
|
||||
virDomainUSBDeviceDefForeach;
|
||||
virDomainVideoDefaultRAM;
|
||||
virDomainVideoDefaultType;
|
||||
+virDomainVideoDefClear;
|
||||
virDomainVideoDefFree;
|
||||
virDomainVideoDefNew;
|
||||
virDomainVideoTypeFromString;
|
||||
--
|
||||
2.18.0
|
||||
|
@ -0,0 +1,122 @@
|
||||
From 680d10a61dfab864b5e1bca9e1f197ae06e62d87 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <680d10a61dfab864b5e1bca9e1f197ae06e62d87@dist-git>
|
||||
From: Erik Skultety <eskultet@redhat.com>
|
||||
Date: Fri, 30 Nov 2018 15:49:26 +0100
|
||||
Subject: [PATCH] conf: Move VFIO AP validation from post parse to QEMU
|
||||
validation code
|
||||
|
||||
VFIO AP has a limitation on a single device per domain, however, when
|
||||
commit 11708641 added the support for vfio-ap, check for this limitation
|
||||
was performed as part of the post parse code. Generally, checks like that
|
||||
should be performed within the driver's validation callback to eliminate
|
||||
any slight chance of failing in post parse, which could potentially
|
||||
result in the domain XML config vanishing.
|
||||
|
||||
Signed-off-by: Erik Skultety <eskultet@redhat.com>
|
||||
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
||||
(cherry picked from commit 25dde373730545894f60ce5b1497f19d61714c69)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1508146
|
||||
|
||||
Signed-off-by: Pino Toscano <ptoscano@redhat.com>
|
||||
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
---
|
||||
src/conf/domain_conf.c | 28 ----------------------------
|
||||
src/qemu/qemu_domain.c | 28 +++++++++++++++++++++++++++-
|
||||
2 files changed, 27 insertions(+), 29 deletions(-)
|
||||
|
||||
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
||||
index ea7152eb94..e013e9f0c5 100644
|
||||
--- a/src/conf/domain_conf.c
|
||||
+++ b/src/conf/domain_conf.c
|
||||
@@ -4325,31 +4325,6 @@ virDomainDefPostParseGraphics(virDomainDef *def)
|
||||
}
|
||||
|
||||
|
||||
-static int
|
||||
-virDomainDefPostParseHostdev(virDomainDefPtr def)
|
||||
-{
|
||||
- size_t i;
|
||||
- bool vfioap_found = false;
|
||||
-
|
||||
- /* verify settings of hostdevs vfio-ap */
|
||||
- for (i = 0; i < def->nhostdevs; i++) {
|
||||
- virDomainHostdevDefPtr hostdev = def->hostdevs[i];
|
||||
-
|
||||
- if (virHostdevIsMdevDevice(hostdev) &&
|
||||
- hostdev->source.subsys.u.mdev.model == VIR_MDEV_MODEL_TYPE_VFIO_AP) {
|
||||
- if (vfioap_found) {
|
||||
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
- _("Only one hostdev of model vfio-ap is "
|
||||
- "supported"));
|
||||
- return -1;
|
||||
- }
|
||||
- vfioap_found = true;
|
||||
- }
|
||||
- }
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
-
|
||||
/**
|
||||
* virDomainDriveAddressIsUsedByDisk:
|
||||
* @def: domain definition containing the disks to check
|
||||
@@ -5262,9 +5237,6 @@ virDomainDefPostParseCommon(virDomainDefPtr def,
|
||||
|
||||
virDomainDefPostParseGraphics(def);
|
||||
|
||||
- if (virDomainDefPostParseHostdev(def) < 0)
|
||||
- return -1;
|
||||
-
|
||||
if (virDomainDefPostParseCPU(def) < 0)
|
||||
return -1;
|
||||
|
||||
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
|
||||
index 4898d58733..08f479fa1d 100644
|
||||
--- a/src/qemu/qemu_domain.c
|
||||
+++ b/src/qemu/qemu_domain.c
|
||||
@@ -4486,6 +4486,32 @@ qemuDomainMdevDefVFIOPCIValidate(const virDomainHostdevSubsysMediatedDev *dev,
|
||||
}
|
||||
|
||||
|
||||
+static int
|
||||
+qemuDomainMdevDefVFIOAPValidate(const virDomainDef *def)
|
||||
+{
|
||||
+ size_t i;
|
||||
+ bool vfioap_found = false;
|
||||
+
|
||||
+ /* VFIO-AP is restricted to a single mediated device only */
|
||||
+ for (i = 0; i < def->nhostdevs; i++) {
|
||||
+ virDomainHostdevDefPtr hostdev = def->hostdevs[i];
|
||||
+
|
||||
+ if (virHostdevIsMdevDevice(hostdev) &&
|
||||
+ hostdev->source.subsys.u.mdev.model == VIR_MDEV_MODEL_TYPE_VFIO_AP) {
|
||||
+ if (vfioap_found) {
|
||||
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
+ _("Only one hostdev of model vfio-ap is "
|
||||
+ "supported"));
|
||||
+ return -1;
|
||||
+ }
|
||||
+ vfioap_found = true;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
static int
|
||||
qemuDomainMdevDefValidate(const virDomainHostdevSubsysMediatedDev *mdevsrc,
|
||||
const virDomainDef *def,
|
||||
@@ -4495,7 +4521,7 @@ qemuDomainMdevDefValidate(const virDomainHostdevSubsysMediatedDev *mdevsrc,
|
||||
case VIR_MDEV_MODEL_TYPE_VFIO_PCI:
|
||||
return qemuDomainMdevDefVFIOPCIValidate(mdevsrc, def, qemuCaps);
|
||||
case VIR_MDEV_MODEL_TYPE_VFIO_AP:
|
||||
- break;
|
||||
+ return qemuDomainMdevDefVFIOAPValidate(def);
|
||||
case VIR_MDEV_MODEL_TYPE_VFIO_CCW:
|
||||
break;
|
||||
case VIR_MDEV_MODEL_TYPE_LAST:
|
||||
--
|
||||
2.19.2
|
||||
|
@ -0,0 +1,247 @@
|
||||
From d1a499f071b2a223641d2e4f0783eda1ad67d1ae Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <d1a499f071b2a223641d2e4f0783eda1ad67d1ae@dist-git>
|
||||
From: Pavel Hrdina <phrdina@redhat.com>
|
||||
Date: Mon, 13 Aug 2018 19:21:52 +0200
|
||||
Subject: [PATCH] conf: Move hugepage XML validation check out of qemu_command
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
We can safely validate the hugepage nodeset attribute at a define time.
|
||||
This validation is not done for already existing domains when the daemon
|
||||
is restarted.
|
||||
|
||||
All the changes to the tests are necessary because we move the error
|
||||
from domain start into XML parse.
|
||||
|
||||
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
|
||||
(cherry picked from commit 5c93dfb46d9dff623707994f115b6bd7ca4f0682)
|
||||
|
||||
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1615461
|
||||
|
||||
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
src/conf/domain_conf.c | 32 +++++++++++++++++
|
||||
src/qemu/qemu_command.c | 34 -------------------
|
||||
.../seclabel-dynamic-none-relabel.xml | 2 +-
|
||||
tests/qemuxml2argvtest.c | 18 +++++-----
|
||||
.../hugepages-default-1G-nodeset-2M.xml | 1 -
|
||||
.../qemuxml2xmloutdata/hugepages-nodeset.xml | 1 -
|
||||
.../hugepages-numa-nodeset-nonexist.xml | 1 -
|
||||
.../seclabel-dynamic-none-relabel.xml | 2 +-
|
||||
tests/qemuxml2xmltest.c | 3 --
|
||||
9 files changed, 43 insertions(+), 51 deletions(-)
|
||||
delete mode 120000 tests/qemuxml2xmloutdata/hugepages-default-1G-nodeset-2M.xml
|
||||
delete mode 120000 tests/qemuxml2xmloutdata/hugepages-nodeset.xml
|
||||
delete mode 120000 tests/qemuxml2xmloutdata/hugepages-numa-nodeset-nonexist.xml
|
||||
|
||||
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
||||
index a05aad056d..280bbdf35c 100644
|
||||
--- a/src/conf/domain_conf.c
|
||||
+++ b/src/conf/domain_conf.c
|
||||
@@ -6142,6 +6142,35 @@ virDomainDefLifecycleActionValidate(const virDomainDef *def)
|
||||
}
|
||||
|
||||
|
||||
+static int
|
||||
+virDomainDefMemtuneValidate(const virDomainDef *def)
|
||||
+{
|
||||
+ const virDomainMemtune *mem = &(def->mem);
|
||||
+ size_t i;
|
||||
+ ssize_t pos = virDomainNumaGetNodeCount(def->numa) - 1;
|
||||
+
|
||||
+ for (i = 0; i < mem->nhugepages; i++) {
|
||||
+ ssize_t nextBit;
|
||||
+
|
||||
+ if (!mem->hugepages[i].nodemask) {
|
||||
+ /* This is the master hugepage to use. Skip it as it has no
|
||||
+ * nodemask anyway. */
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ nextBit = virBitmapNextSetBit(mem->hugepages[i].nodemask, pos);
|
||||
+ if (nextBit >= 0) {
|
||||
+ virReportError(VIR_ERR_XML_DETAIL,
|
||||
+ _("hugepages: node %zd not found"),
|
||||
+ nextBit);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
static int
|
||||
virDomainDefValidateInternal(const virDomainDef *def)
|
||||
{
|
||||
@@ -6177,6 +6206,9 @@ virDomainDefValidateInternal(const virDomainDef *def)
|
||||
if (virDomainDefLifecycleActionValidate(def) < 0)
|
||||
return -1;
|
||||
|
||||
+ if (virDomainDefMemtuneValidate(def) < 0)
|
||||
+ return -1;
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
|
||||
index 954265feb0..f2b64ed720 100644
|
||||
--- a/src/qemu/qemu_command.c
|
||||
+++ b/src/qemu/qemu_command.c
|
||||
@@ -7482,16 +7482,6 @@ qemuBuildMemPathStr(virQEMUDriverConfigPtr cfg,
|
||||
if (!def->mem.nhugepages)
|
||||
return 0;
|
||||
|
||||
- if (def->mem.hugepages[0].nodemask) {
|
||||
- ssize_t next_bit = virBitmapNextSetBit(def->mem.hugepages[0].nodemask, -1);
|
||||
- if (next_bit >= 0) {
|
||||
- virReportError(VIR_ERR_XML_DETAIL,
|
||||
- _("hugepages: node %zd not found"),
|
||||
- next_bit);
|
||||
- return -1;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
/* There is one special case: if user specified "huge"
|
||||
* pages of regular system pages size.
|
||||
* And there is nothing to do in this case.
|
||||
@@ -7624,30 +7614,6 @@ qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg,
|
||||
if (!virDomainNumatuneNodesetIsAvailable(def->numa, priv->autoNodeset))
|
||||
goto cleanup;
|
||||
|
||||
- for (i = 0; i < def->mem.nhugepages; i++) {
|
||||
- ssize_t next_bit, pos = 0;
|
||||
-
|
||||
- if (!def->mem.hugepages[i].nodemask) {
|
||||
- /* This is the master hugepage to use. Skip it as it has no
|
||||
- * nodemask anyway. */
|
||||
- continue;
|
||||
- }
|
||||
-
|
||||
- if (ncells) {
|
||||
- /* Fortunately, we allow only guest NUMA nodes to be continuous
|
||||
- * starting from zero. */
|
||||
- pos = ncells - 1;
|
||||
- }
|
||||
-
|
||||
- next_bit = virBitmapNextSetBit(def->mem.hugepages[i].nodemask, pos);
|
||||
- if (next_bit >= 0) {
|
||||
- virReportError(VIR_ERR_XML_DETAIL,
|
||||
- _("hugepages: node %zd not found"),
|
||||
- next_bit);
|
||||
- goto cleanup;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
if (VIR_ALLOC_N(nodeBackends, ncells) < 0)
|
||||
goto cleanup;
|
||||
|
||||
diff --git a/tests/qemuxml2argvdata/seclabel-dynamic-none-relabel.xml b/tests/qemuxml2argvdata/seclabel-dynamic-none-relabel.xml
|
||||
index 47f253b5f7..e954250009 100644
|
||||
--- a/tests/qemuxml2argvdata/seclabel-dynamic-none-relabel.xml
|
||||
+++ b/tests/qemuxml2argvdata/seclabel-dynamic-none-relabel.xml
|
||||
@@ -5,7 +5,7 @@
|
||||
<currentMemory unit='KiB'>262144</currentMemory>
|
||||
<memoryBacking>
|
||||
<hugepages>
|
||||
- <page size='2048' unit='KiB' nodeset='0'/>
|
||||
+ <page size='2048' unit='KiB'/>
|
||||
</hugepages>
|
||||
</memoryBacking>
|
||||
<vcpu placement='static'>4</vcpu>
|
||||
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
|
||||
index bd5fdf9412..f82bca2637 100644
|
||||
--- a/tests/qemuxml2argvtest.c
|
||||
+++ b/tests/qemuxml2argvtest.c
|
||||
@@ -959,12 +959,12 @@ mymain(void)
|
||||
DO_TEST("hugepages-default", NONE);
|
||||
DO_TEST("hugepages-default-2M", NONE);
|
||||
DO_TEST("hugepages-default-system-size", NONE);
|
||||
- DO_TEST("hugepages-default-1G-nodeset-2M", NONE);
|
||||
- DO_TEST_FAILURE("hugepages-nodeset", NONE);
|
||||
- DO_TEST_FAILURE("hugepages-nodeset-nonexist",
|
||||
- QEMU_CAPS_DEVICE_PC_DIMM,
|
||||
- QEMU_CAPS_OBJECT_MEMORY_FILE,
|
||||
- QEMU_CAPS_OBJECT_MEMORY_FILE_DISCARD);
|
||||
+ DO_TEST_PARSE_ERROR("hugepages-default-1G-nodeset-2M", NONE);
|
||||
+ DO_TEST_PARSE_ERROR("hugepages-nodeset", NONE);
|
||||
+ DO_TEST_PARSE_ERROR("hugepages-nodeset-nonexist",
|
||||
+ QEMU_CAPS_DEVICE_PC_DIMM,
|
||||
+ QEMU_CAPS_OBJECT_MEMORY_FILE,
|
||||
+ QEMU_CAPS_OBJECT_MEMORY_FILE_DISCARD);
|
||||
DO_TEST("hugepages-numa-default",
|
||||
QEMU_CAPS_OBJECT_MEMORY_FILE);
|
||||
DO_TEST("hugepages-numa-default-2M",
|
||||
@@ -979,9 +979,9 @@ mymain(void)
|
||||
DO_TEST("hugepages-numa-nodeset-part",
|
||||
QEMU_CAPS_OBJECT_MEMORY_RAM,
|
||||
QEMU_CAPS_OBJECT_MEMORY_FILE);
|
||||
- DO_TEST_FAILURE("hugepages-numa-nodeset-nonexist",
|
||||
- QEMU_CAPS_OBJECT_MEMORY_RAM,
|
||||
- QEMU_CAPS_OBJECT_MEMORY_FILE);
|
||||
+ DO_TEST_PARSE_ERROR("hugepages-numa-nodeset-nonexist",
|
||||
+ QEMU_CAPS_OBJECT_MEMORY_RAM,
|
||||
+ QEMU_CAPS_OBJECT_MEMORY_FILE);
|
||||
DO_TEST("hugepages-shared",
|
||||
QEMU_CAPS_OBJECT_MEMORY_RAM,
|
||||
QEMU_CAPS_OBJECT_MEMORY_FILE);
|
||||
diff --git a/tests/qemuxml2xmloutdata/hugepages-default-1G-nodeset-2M.xml b/tests/qemuxml2xmloutdata/hugepages-default-1G-nodeset-2M.xml
|
||||
deleted file mode 120000
|
||||
index 3d8eb7616e..0000000000
|
||||
--- a/tests/qemuxml2xmloutdata/hugepages-default-1G-nodeset-2M.xml
|
||||
+++ /dev/null
|
||||
@@ -1 +0,0 @@
|
||||
-../qemuxml2argvdata/hugepages-default-1G-nodeset-2M.xml
|
||||
\ No newline at end of file
|
||||
diff --git a/tests/qemuxml2xmloutdata/hugepages-nodeset.xml b/tests/qemuxml2xmloutdata/hugepages-nodeset.xml
|
||||
deleted file mode 120000
|
||||
index b55838b780..0000000000
|
||||
--- a/tests/qemuxml2xmloutdata/hugepages-nodeset.xml
|
||||
+++ /dev/null
|
||||
@@ -1 +0,0 @@
|
||||
-../qemuxml2argvdata/hugepages-nodeset.xml
|
||||
\ No newline at end of file
|
||||
diff --git a/tests/qemuxml2xmloutdata/hugepages-numa-nodeset-nonexist.xml b/tests/qemuxml2xmloutdata/hugepages-numa-nodeset-nonexist.xml
|
||||
deleted file mode 120000
|
||||
index d490edca69..0000000000
|
||||
--- a/tests/qemuxml2xmloutdata/hugepages-numa-nodeset-nonexist.xml
|
||||
+++ /dev/null
|
||||
@@ -1 +0,0 @@
|
||||
-../qemuxml2argvdata/hugepages-numa-nodeset-nonexist.xml
|
||||
\ No newline at end of file
|
||||
diff --git a/tests/qemuxml2xmloutdata/seclabel-dynamic-none-relabel.xml b/tests/qemuxml2xmloutdata/seclabel-dynamic-none-relabel.xml
|
||||
index 050967b4ee..bfa66b8deb 100644
|
||||
--- a/tests/qemuxml2xmloutdata/seclabel-dynamic-none-relabel.xml
|
||||
+++ b/tests/qemuxml2xmloutdata/seclabel-dynamic-none-relabel.xml
|
||||
@@ -5,7 +5,7 @@
|
||||
<currentMemory unit='KiB'>262144</currentMemory>
|
||||
<memoryBacking>
|
||||
<hugepages>
|
||||
- <page size='2048' unit='KiB' nodeset='0'/>
|
||||
+ <page size='2048' unit='KiB'/>
|
||||
</hugepages>
|
||||
</memoryBacking>
|
||||
<vcpu placement='static'>4</vcpu>
|
||||
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
|
||||
index acbe2f7133..aa543e9e51 100644
|
||||
--- a/tests/qemuxml2xmltest.c
|
||||
+++ b/tests/qemuxml2xmltest.c
|
||||
@@ -336,13 +336,10 @@ mymain(void)
|
||||
DO_TEST("hugepages-default", NONE);
|
||||
DO_TEST("hugepages-default-2M", NONE);
|
||||
DO_TEST("hugepages-default-system-size", NONE);
|
||||
- DO_TEST("hugepages-default-1G-nodeset-2M", NONE);
|
||||
- DO_TEST("hugepages-nodeset", NONE);
|
||||
DO_TEST("hugepages-numa-default-2M", NONE);
|
||||
DO_TEST("hugepages-numa-default-dimm", NONE);
|
||||
DO_TEST("hugepages-numa-nodeset", NONE);
|
||||
DO_TEST("hugepages-numa-nodeset-part", NONE);
|
||||
- DO_TEST("hugepages-numa-nodeset-nonexist", NONE);
|
||||
DO_TEST("hugepages-shared", NONE);
|
||||
DO_TEST("hugepages-memaccess", NONE);
|
||||
DO_TEST("hugepages-memaccess2", NONE);
|
||||
--
|
||||
2.18.0
|
||||
|
@ -0,0 +1,126 @@
|
||||
From a4ddc9b4213809cbab4abce609441975ae433dae Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <a4ddc9b4213809cbab4abce609441975ae433dae@dist-git>
|
||||
From: Pavel Hrdina <phrdina@redhat.com>
|
||||
Date: Mon, 13 Aug 2018 19:21:53 +0200
|
||||
Subject: [PATCH] conf: Move hugepages validation out of XML parser
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
|
||||
(cherry picked from commit 82327038390bfae117dc6e1d9062e38901cd4c97)
|
||||
|
||||
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1615461
|
||||
|
||||
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
src/conf/domain_conf.c | 75 ++++++++++++++++++++++--------------------
|
||||
1 file changed, 40 insertions(+), 35 deletions(-)
|
||||
|
||||
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
||||
index 280bbdf35c..98e833c5bb 100644
|
||||
--- a/src/conf/domain_conf.c
|
||||
+++ b/src/conf/domain_conf.c
|
||||
@@ -6149,9 +6149,49 @@ virDomainDefMemtuneValidate(const virDomainDef *def)
|
||||
size_t i;
|
||||
ssize_t pos = virDomainNumaGetNodeCount(def->numa) - 1;
|
||||
|
||||
+ if (mem->nhugepages == 0)
|
||||
+ return 0;
|
||||
+
|
||||
+ if (mem->allocation == VIR_DOMAIN_MEMORY_ALLOCATION_ONDEMAND) {
|
||||
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
+ _("hugepages are not allowed with memory "
|
||||
+ "allocation ondemand"));
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ if (mem->source == VIR_DOMAIN_MEMORY_SOURCE_ANONYMOUS) {
|
||||
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
+ _("hugepages are not allowed with anonymous "
|
||||
+ "memory source"));
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
for (i = 0; i < mem->nhugepages; i++) {
|
||||
+ size_t j;
|
||||
ssize_t nextBit;
|
||||
|
||||
+ for (j = 0; j < i; j++) {
|
||||
+ if (mem->hugepages[i].nodemask &&
|
||||
+ mem->hugepages[j].nodemask &&
|
||||
+ virBitmapOverlaps(mem->hugepages[i].nodemask,
|
||||
+ mem->hugepages[j].nodemask)) {
|
||||
+ virReportError(VIR_ERR_XML_DETAIL,
|
||||
+ _("nodeset attribute of hugepages "
|
||||
+ "of sizes %llu and %llu intersect"),
|
||||
+ mem->hugepages[i].size,
|
||||
+ mem->hugepages[j].size);
|
||||
+ return -1;
|
||||
+ } else if (!mem->hugepages[i].nodemask &&
|
||||
+ !mem->hugepages[j].nodemask) {
|
||||
+ virReportError(VIR_ERR_XML_DETAIL,
|
||||
+ _("two master hugepages detected: "
|
||||
+ "%llu and %llu"),
|
||||
+ mem->hugepages[i].size,
|
||||
+ mem->hugepages[j].size);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
if (!mem->hugepages[i].nodemask) {
|
||||
/* This is the master hugepage to use. Skip it as it has no
|
||||
* nodemask anyway. */
|
||||
@@ -19414,19 +19454,6 @@ virDomainDefParseXML(xmlDocPtr xml,
|
||||
|
||||
if (virXPathNode("./memoryBacking/hugepages", ctxt)) {
|
||||
/* hugepages will be used */
|
||||
-
|
||||
- if (def->mem.allocation == VIR_DOMAIN_MEMORY_ALLOCATION_ONDEMAND) {
|
||||
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
- _("hugepages are not allowed with memory allocation ondemand"));
|
||||
- goto error;
|
||||
- }
|
||||
-
|
||||
- if (def->mem.source == VIR_DOMAIN_MEMORY_SOURCE_ANONYMOUS) {
|
||||
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
- _("hugepages are not allowed with anonymous memory source"));
|
||||
- goto error;
|
||||
- }
|
||||
-
|
||||
if ((n = virXPathNodeSet("./memoryBacking/hugepages/page", ctxt, &nodes)) < 0) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("cannot extract hugepages nodes"));
|
||||
@@ -19442,28 +19469,6 @@ virDomainDefParseXML(xmlDocPtr xml,
|
||||
&def->mem.hugepages[i]) < 0)
|
||||
goto error;
|
||||
def->mem.nhugepages++;
|
||||
-
|
||||
- for (j = 0; j < i; j++) {
|
||||
- if (def->mem.hugepages[i].nodemask &&
|
||||
- def->mem.hugepages[j].nodemask &&
|
||||
- virBitmapOverlaps(def->mem.hugepages[i].nodemask,
|
||||
- def->mem.hugepages[j].nodemask)) {
|
||||
- virReportError(VIR_ERR_XML_DETAIL,
|
||||
- _("nodeset attribute of hugepages "
|
||||
- "of sizes %llu and %llu intersect"),
|
||||
- def->mem.hugepages[i].size,
|
||||
- def->mem.hugepages[j].size);
|
||||
- goto error;
|
||||
- } else if (!def->mem.hugepages[i].nodemask &&
|
||||
- !def->mem.hugepages[j].nodemask) {
|
||||
- virReportError(VIR_ERR_XML_DETAIL,
|
||||
- _("two master hugepages detected: "
|
||||
- "%llu and %llu"),
|
||||
- def->mem.hugepages[i].size,
|
||||
- def->mem.hugepages[j].size);
|
||||
- goto error;
|
||||
- }
|
||||
- }
|
||||
}
|
||||
|
||||
VIR_FREE(nodes);
|
||||
--
|
||||
2.18.0
|
||||
|
152
SOURCES/libvirt-conf-Parse-and-format-nested-hv-feature.patch
Normal file
152
SOURCES/libvirt-conf-Parse-and-format-nested-hv-feature.patch
Normal file
@ -0,0 +1,152 @@
|
||||
From 742667e7f0a55f3a8042840e2995982a003dc2fc Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <742667e7f0a55f3a8042840e2995982a003dc2fc@dist-git>
|
||||
From: Andrea Bolognani <abologna@redhat.com>
|
||||
Date: Tue, 4 Dec 2018 16:46:19 +0100
|
||||
Subject: [PATCH] conf: Parse and format nested-hv feature
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
|
||||
(cherry picked from commit bfa2bd7e38f2777260b63200ef12804e13a7a5c2)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1647822
|
||||
|
||||
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
docs/formatdomain.html.in | 12 ++++++++++++
|
||||
docs/schemas/domaincommon.rng | 5 +++++
|
||||
src/conf/domain_conf.c | 4 ++++
|
||||
src/conf/domain_conf.h | 1 +
|
||||
src/qemu/qemu_domain.c | 1 +
|
||||
tests/qemuxml2argvdata/pseries-features.xml | 1 +
|
||||
tests/qemuxml2xmloutdata/pseries-features.xml | 1 +
|
||||
7 files changed, 25 insertions(+)
|
||||
|
||||
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
|
||||
index 54eb298414..02d0ac4241 100644
|
||||
--- a/docs/formatdomain.html.in
|
||||
+++ b/docs/formatdomain.html.in
|
||||
@@ -2191,6 +2191,18 @@
|
||||
defined, the hypervisor default will be used.
|
||||
<span class="since">Since 4.6.0</span> (QEMU/KVM only)
|
||||
</dd>
|
||||
+ <dt><code>nested-hv</code></dt>
|
||||
+ <dd>Configure nested HV availability for pSeries guests. This needs to
|
||||
+ be enabled from the host (L0) in order to be effective; having HV
|
||||
+ support in the (L1) guest is very desiderable if it's planned to
|
||||
+ run nested (L2) guests inside it, because it will result in those
|
||||
+ nested guests having much better performance than they would when
|
||||
+ using KVM PR or TCG.
|
||||
+ Possible values for the <code>state</code> attribute are
|
||||
+ <code>on</code> and <code>off</code>. If the attribute is not
|
||||
+ defined, the hypervisor default will be used.
|
||||
+ <span class="since">Since 4.10.0</span> (QEMU/KVM only)
|
||||
+ </dd>
|
||||
</dl>
|
||||
|
||||
<h3><a id="elementsTime">Time keeping</a></h3>
|
||||
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
|
||||
index e4ce7804b9..70a7767d9c 100644
|
||||
--- a/docs/schemas/domaincommon.rng
|
||||
+++ b/docs/schemas/domaincommon.rng
|
||||
@@ -4925,6 +4925,11 @@
|
||||
<ref name="featurestate"/>
|
||||
</element>
|
||||
</optional>
|
||||
+ <optional>
|
||||
+ <element name="nested-hv">
|
||||
+ <ref name="featurestate"/>
|
||||
+ </element>
|
||||
+ </optional>
|
||||
</interleave>
|
||||
</element>
|
||||
</optional>
|
||||
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
||||
index e013e9f0c5..660e1523fe 100644
|
||||
--- a/src/conf/domain_conf.c
|
||||
+++ b/src/conf/domain_conf.c
|
||||
@@ -153,6 +153,7 @@ VIR_ENUM_IMPL(virDomainFeature, VIR_DOMAIN_FEATURE_LAST,
|
||||
"hpt",
|
||||
"vmcoreinfo",
|
||||
"htm",
|
||||
+ "nested-hv",
|
||||
);
|
||||
|
||||
VIR_ENUM_IMPL(virDomainCapabilitiesPolicy, VIR_DOMAIN_CAPABILITIES_POLICY_LAST,
|
||||
@@ -19987,6 +19988,7 @@ virDomainDefParseXML(xmlDocPtr xml,
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_FEATURE_HTM:
|
||||
+ case VIR_DOMAIN_FEATURE_NESTED_HV:
|
||||
if (!(tmp = virXMLPropString(nodes[i], "state"))) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("missing state attribute '%s' of feature '%s'"),
|
||||
@@ -22147,6 +22149,7 @@ virDomainDefFeaturesCheckABIStability(virDomainDefPtr src,
|
||||
case VIR_DOMAIN_FEATURE_SMM:
|
||||
case VIR_DOMAIN_FEATURE_VMCOREINFO:
|
||||
case VIR_DOMAIN_FEATURE_HTM:
|
||||
+ case VIR_DOMAIN_FEATURE_NESTED_HV:
|
||||
if (src->features[i] != dst->features[i]) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("State of feature '%s' differs: "
|
||||
@@ -27823,6 +27826,7 @@ virDomainDefFormatInternal(virDomainDefPtr def,
|
||||
case VIR_DOMAIN_FEATURE_PVSPINLOCK:
|
||||
case VIR_DOMAIN_FEATURE_VMPORT:
|
||||
case VIR_DOMAIN_FEATURE_HTM:
|
||||
+ case VIR_DOMAIN_FEATURE_NESTED_HV:
|
||||
switch ((virTristateSwitch) def->features[i]) {
|
||||
case VIR_TRISTATE_SWITCH_LAST:
|
||||
case VIR_TRISTATE_SWITCH_ABSENT:
|
||||
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
|
||||
index d32514e7e6..f05fca284f 100644
|
||||
--- a/src/conf/domain_conf.h
|
||||
+++ b/src/conf/domain_conf.h
|
||||
@@ -1775,6 +1775,7 @@ typedef enum {
|
||||
VIR_DOMAIN_FEATURE_HPT,
|
||||
VIR_DOMAIN_FEATURE_VMCOREINFO,
|
||||
VIR_DOMAIN_FEATURE_HTM,
|
||||
+ VIR_DOMAIN_FEATURE_NESTED_HV,
|
||||
|
||||
VIR_DOMAIN_FEATURE_LAST
|
||||
} virDomainFeature;
|
||||
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
|
||||
index 4fcca1e05a..0ddc6ef4a7 100644
|
||||
--- a/src/qemu/qemu_domain.c
|
||||
+++ b/src/qemu/qemu_domain.c
|
||||
@@ -3819,6 +3819,7 @@ qemuDomainDefValidateFeatures(const virDomainDef *def,
|
||||
|
||||
case VIR_DOMAIN_FEATURE_HPT:
|
||||
case VIR_DOMAIN_FEATURE_HTM:
|
||||
+ case VIR_DOMAIN_FEATURE_NESTED_HV:
|
||||
if (def->features[i] != VIR_TRISTATE_SWITCH_ABSENT &&
|
||||
!qemuDomainIsPSeries(def)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
diff --git a/tests/qemuxml2argvdata/pseries-features.xml b/tests/qemuxml2argvdata/pseries-features.xml
|
||||
index 5c842fe87b..6f7d32b065 100644
|
||||
--- a/tests/qemuxml2argvdata/pseries-features.xml
|
||||
+++ b/tests/qemuxml2argvdata/pseries-features.xml
|
||||
@@ -11,6 +11,7 @@
|
||||
<maxpagesize unit='GiB'>1</maxpagesize>
|
||||
</hpt>
|
||||
<htm state='on'/>
|
||||
+ <nested-hv state='off'/>
|
||||
</features>
|
||||
<devices>
|
||||
<emulator>/usr/bin/qemu-system-ppc64</emulator>
|
||||
diff --git a/tests/qemuxml2xmloutdata/pseries-features.xml b/tests/qemuxml2xmloutdata/pseries-features.xml
|
||||
index 55a44c75a0..7e12bc9c03 100644
|
||||
--- a/tests/qemuxml2xmloutdata/pseries-features.xml
|
||||
+++ b/tests/qemuxml2xmloutdata/pseries-features.xml
|
||||
@@ -13,6 +13,7 @@
|
||||
<maxpagesize unit='KiB'>1048576</maxpagesize>
|
||||
</hpt>
|
||||
<htm state='on'/>
|
||||
+ <nested-hv state='off'/>
|
||||
</features>
|
||||
<clock offset='utc'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
--
|
||||
2.20.1
|
||||
|
@ -0,0 +1,194 @@
|
||||
From cb462f891f39ff47179e6fe65437450f9d8c7824 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <cb462f891f39ff47179e6fe65437450f9d8c7824@dist-git>
|
||||
From: Andrea Bolognani <abologna@redhat.com>
|
||||
Date: Tue, 3 Jul 2018 15:25:16 +0200
|
||||
Subject: [PATCH] conf: Parse and format the HTM pSeries feature
|
||||
|
||||
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
|
||||
Reviewed-by: John Ferlan <jferlan@redhat.com>
|
||||
|
||||
(cherry picked from commit 9f3b9100f33036cb14296aa0a788788743b75a23)
|
||||
https: //bugzilla.redhat.com/show_bug.cgi?id=1525599
|
||||
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
|
||||
Acked-by: David Gibson <dgibson@redhat.com>
|
||||
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
---
|
||||
docs/formatdomain.html.in | 8 ++++++++
|
||||
docs/schemas/domaincommon.rng | 5 +++++
|
||||
src/conf/domain_conf.c | 19 +++++++++++++++++++
|
||||
src/conf/domain_conf.h | 1 +
|
||||
src/qemu/qemu_domain.c | 1 +
|
||||
tests/qemuxml2argvdata/pseries-features.xml | 1 +
|
||||
tests/qemuxml2argvtest.c | 1 +
|
||||
tests/qemuxml2xmloutdata/pseries-features.xml | 1 +
|
||||
tests/qemuxml2xmltest.c | 1 +
|
||||
9 files changed, 38 insertions(+)
|
||||
|
||||
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
|
||||
index 0d68596991..a3afe137bf 100644
|
||||
--- a/docs/formatdomain.html.in
|
||||
+++ b/docs/formatdomain.html.in
|
||||
@@ -1929,6 +1929,7 @@
|
||||
<smm state='on'>
|
||||
<tseg unit='MiB'>48</tseg>
|
||||
</smm>
|
||||
+ <htm state='on'/>
|
||||
</features>
|
||||
...</pre>
|
||||
|
||||
@@ -2162,6 +2163,13 @@
|
||||
<dd>Enable QEMU vmcoreinfo device to let the guest kernel save debug
|
||||
details. <span class="since">Since 4.4.0</span> (QEMU only)
|
||||
</dd>
|
||||
+ <dt><code>htm</code></dt>
|
||||
+ <dd>Configure HTM (Hardware Transational Memory) availability for
|
||||
+ pSeries guests. Possible values for the <code>state</code> attribute
|
||||
+ are <code>on</code> and <code>off</code>. If the attribute is not
|
||||
+ defined, the hypervisor default will be used.
|
||||
+ <span class="since">Since 4.6.0</span> (QEMU/KVM only)
|
||||
+ </dd>
|
||||
</dl>
|
||||
|
||||
<h3><a id="elementsTime">Time keeping</a></h3>
|
||||
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
|
||||
index f46145cf9b..bd687ce9d3 100644
|
||||
--- a/docs/schemas/domaincommon.rng
|
||||
+++ b/docs/schemas/domaincommon.rng
|
||||
@@ -4907,6 +4907,11 @@
|
||||
<optional>
|
||||
<ref name="vmcoreinfo"/>
|
||||
</optional>
|
||||
+ <optional>
|
||||
+ <element name="htm">
|
||||
+ <ref name="featurestate"/>
|
||||
+ </element>
|
||||
+ </optional>
|
||||
</interleave>
|
||||
</element>
|
||||
</optional>
|
||||
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
||||
index b8b53450fa..f4e59f6c91 100644
|
||||
--- a/src/conf/domain_conf.c
|
||||
+++ b/src/conf/domain_conf.c
|
||||
@@ -152,6 +152,7 @@ VIR_ENUM_IMPL(virDomainFeature, VIR_DOMAIN_FEATURE_LAST,
|
||||
"ioapic",
|
||||
"hpt",
|
||||
"vmcoreinfo",
|
||||
+ "htm",
|
||||
);
|
||||
|
||||
VIR_ENUM_IMPL(virDomainCapabilitiesPolicy, VIR_DOMAIN_CAPABILITIES_POLICY_LAST,
|
||||
@@ -19827,6 +19828,22 @@ virDomainDefParseXML(xmlDocPtr xml,
|
||||
}
|
||||
break;
|
||||
|
||||
+ case VIR_DOMAIN_FEATURE_HTM:
|
||||
+ if (!(tmp = virXMLPropString(nodes[i], "state"))) {
|
||||
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
+ _("missing state attribute '%s' of feature '%s'"),
|
||||
+ tmp, virDomainFeatureTypeToString(val));
|
||||
+ goto error;
|
||||
+ }
|
||||
+ if ((def->features[val] = virTristateSwitchTypeFromString(tmp)) < 0) {
|
||||
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
+ _("unknown state attribute '%s' of feature '%s'"),
|
||||
+ tmp, virDomainFeatureTypeToString(val));
|
||||
+ goto error;
|
||||
+ }
|
||||
+ VIR_FREE(tmp);
|
||||
+ break;
|
||||
+
|
||||
/* coverity[dead_error_begin] */
|
||||
case VIR_DOMAIN_FEATURE_LAST:
|
||||
break;
|
||||
@@ -21961,6 +21978,7 @@ virDomainDefFeaturesCheckABIStability(virDomainDefPtr src,
|
||||
case VIR_DOMAIN_FEATURE_VMPORT:
|
||||
case VIR_DOMAIN_FEATURE_SMM:
|
||||
case VIR_DOMAIN_FEATURE_VMCOREINFO:
|
||||
+ case VIR_DOMAIN_FEATURE_HTM:
|
||||
if (src->features[i] != dst->features[i]) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("State of feature '%s' differs: "
|
||||
@@ -27626,6 +27644,7 @@ virDomainDefFormatInternal(virDomainDefPtr def,
|
||||
case VIR_DOMAIN_FEATURE_PMU:
|
||||
case VIR_DOMAIN_FEATURE_PVSPINLOCK:
|
||||
case VIR_DOMAIN_FEATURE_VMPORT:
|
||||
+ case VIR_DOMAIN_FEATURE_HTM:
|
||||
switch ((virTristateSwitch) def->features[i]) {
|
||||
case VIR_TRISTATE_SWITCH_LAST:
|
||||
case VIR_TRISTATE_SWITCH_ABSENT:
|
||||
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
|
||||
index 71437dc485..41d27482fb 100644
|
||||
--- a/src/conf/domain_conf.h
|
||||
+++ b/src/conf/domain_conf.h
|
||||
@@ -1771,6 +1771,7 @@ typedef enum {
|
||||
VIR_DOMAIN_FEATURE_IOAPIC,
|
||||
VIR_DOMAIN_FEATURE_HPT,
|
||||
VIR_DOMAIN_FEATURE_VMCOREINFO,
|
||||
+ VIR_DOMAIN_FEATURE_HTM,
|
||||
|
||||
VIR_DOMAIN_FEATURE_LAST
|
||||
} virDomainFeature;
|
||||
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
|
||||
index 4c2a162b85..0eacad1e44 100644
|
||||
--- a/src/qemu/qemu_domain.c
|
||||
+++ b/src/qemu/qemu_domain.c
|
||||
@@ -3865,6 +3865,7 @@ qemuDomainDefValidateFeatures(const virDomainDef *def,
|
||||
case VIR_DOMAIN_FEATURE_PMU:
|
||||
case VIR_DOMAIN_FEATURE_VMPORT:
|
||||
case VIR_DOMAIN_FEATURE_VMCOREINFO:
|
||||
+ case VIR_DOMAIN_FEATURE_HTM:
|
||||
case VIR_DOMAIN_FEATURE_LAST:
|
||||
break;
|
||||
}
|
||||
diff --git a/tests/qemuxml2argvdata/pseries-features.xml b/tests/qemuxml2argvdata/pseries-features.xml
|
||||
index 30cee5b81c..5c842fe87b 100644
|
||||
--- a/tests/qemuxml2argvdata/pseries-features.xml
|
||||
+++ b/tests/qemuxml2argvdata/pseries-features.xml
|
||||
@@ -10,6 +10,7 @@
|
||||
<hpt resizing='required'>
|
||||
<maxpagesize unit='GiB'>1</maxpagesize>
|
||||
</hpt>
|
||||
+ <htm state='on'/>
|
||||
</features>
|
||||
<devices>
|
||||
<emulator>/usr/bin/qemu-system-ppc64</emulator>
|
||||
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
|
||||
index c279ac4975..d6911f9344 100644
|
||||
--- a/tests/qemuxml2argvtest.c
|
||||
+++ b/tests/qemuxml2argvtest.c
|
||||
@@ -1850,6 +1850,7 @@ mymain(void)
|
||||
DO_TEST("pseries-features",
|
||||
QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
|
||||
QEMU_CAPS_MACHINE_PSERIES_CAP_HPT_MAX_PAGE_SIZE,
|
||||
+ QEMU_CAPS_MACHINE_PSERIES_CAP_HTM,
|
||||
QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT);
|
||||
DO_TEST_FAILURE("pseries-features",
|
||||
QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE);
|
||||
diff --git a/tests/qemuxml2xmloutdata/pseries-features.xml b/tests/qemuxml2xmloutdata/pseries-features.xml
|
||||
index f36705f011..55a44c75a0 100644
|
||||
--- a/tests/qemuxml2xmloutdata/pseries-features.xml
|
||||
+++ b/tests/qemuxml2xmloutdata/pseries-features.xml
|
||||
@@ -12,6 +12,7 @@
|
||||
<hpt resizing='required'>
|
||||
<maxpagesize unit='KiB'>1048576</maxpagesize>
|
||||
</hpt>
|
||||
+ <htm state='on'/>
|
||||
</features>
|
||||
<clock offset='utc'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
|
||||
index eac6d5b073..bbb995656e 100644
|
||||
--- a/tests/qemuxml2xmltest.c
|
||||
+++ b/tests/qemuxml2xmltest.c
|
||||
@@ -620,6 +620,7 @@ mymain(void)
|
||||
DO_TEST("pseries-features",
|
||||
QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
|
||||
QEMU_CAPS_MACHINE_PSERIES_CAP_HPT_MAX_PAGE_SIZE,
|
||||
+ QEMU_CAPS_MACHINE_PSERIES_CAP_HTM,
|
||||
QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT);
|
||||
|
||||
DO_TEST("pseries-serial-native",
|
||||
--
|
||||
2.18.0
|
||||
|
@ -0,0 +1,48 @@
|
||||
From ac3ea7982236832f5f2ae86b631aface267d035c Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <ac3ea7982236832f5f2ae86b631aface267d035c@dist-git>
|
||||
From: Michal Privoznik <mprivozn@redhat.com>
|
||||
Date: Tue, 21 Aug 2018 14:23:40 +0200
|
||||
Subject: [PATCH] conf: Parse guestfwd channel device info again
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1610072
|
||||
|
||||
Due to historical reasons we were not parsing device info on
|
||||
guestfwd channel. Sure, it doesn't make much sense to parse
|
||||
<address/> but it surely makes sense to parse its alias (which
|
||||
might be an user alias).
|
||||
|
||||
This reverts commit 47a3dd46ead20e6fdc30bcdc1b8e707e250d33da
|
||||
which fixed https://bugzilla.redhat.com/show_bug.cgi?id=1172526.
|
||||
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
|
||||
(cherry picked from commit cab1843914d9ce5d1ca28477d2b48e5304e9e6f2)
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
---
|
||||
src/conf/domain_conf.c | 8 +-------
|
||||
1 file changed, 1 insertion(+), 7 deletions(-)
|
||||
|
||||
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
||||
index 8a43e607e9..51a79ad8b1 100644
|
||||
--- a/src/conf/domain_conf.c
|
||||
+++ b/src/conf/domain_conf.c
|
||||
@@ -12760,14 +12760,8 @@ virDomainChrDefParseXML(virDomainXMLOptionPtr xmlopt,
|
||||
}
|
||||
}
|
||||
|
||||
- if (def->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL &&
|
||||
- def->targetType == VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_GUESTFWD) {
|
||||
- VIR_DEBUG("Ignoring device address for gustfwd channel");
|
||||
- } else if (virDomainDeviceInfoParseXML(xmlopt, node,
|
||||
- &def->info, flags) < 0) {
|
||||
+ if (virDomainDeviceInfoParseXML(xmlopt, node, &def->info, flags) < 0)
|
||||
goto error;
|
||||
- }
|
||||
-
|
||||
|
||||
if (def->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL &&
|
||||
def->targetType == VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB &&
|
||||
--
|
||||
2.18.0
|
||||
|
@ -0,0 +1,175 @@
|
||||
From fd6fae19231031f3feb83c854efdf2f1abfa7847 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <fd6fae19231031f3feb83c854efdf2f1abfa7847@dist-git>
|
||||
From: Erik Skultety <eskultet@redhat.com>
|
||||
Date: Thu, 19 Jul 2018 15:04:01 +0200
|
||||
Subject: [PATCH] conf: Replace 'error' with 'cleanup' in
|
||||
virDomainHostdevDefParseXMLSubsys
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The exit path is the same for both success and failure, so the label
|
||||
should be called cleanup.
|
||||
|
||||
Signed-off-by: Erik Skultety <eskultet@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit f1f6f4858260a77416ed5e0c86c4e0614aaf0a5e)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1475770
|
||||
Signed-off-by: Erik Skultety <eskultet@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
src/conf/domain_conf.c | 38 +++++++++++++++++++-------------------
|
||||
1 file changed, 19 insertions(+), 19 deletions(-)
|
||||
|
||||
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
||||
index 08654ab41d..72086f9e86 100644
|
||||
--- a/src/conf/domain_conf.c
|
||||
+++ b/src/conf/domain_conf.c
|
||||
@@ -7690,18 +7690,18 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node,
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("unknown host device source address type '%s'"),
|
||||
type);
|
||||
- goto error;
|
||||
+ goto cleanup;
|
||||
}
|
||||
} else {
|
||||
virReportError(VIR_ERR_XML_ERROR,
|
||||
"%s", _("missing source address type"));
|
||||
- goto error;
|
||||
+ goto cleanup;
|
||||
}
|
||||
|
||||
if (!(sourcenode = virXPathNode("./source", ctxt))) {
|
||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||
_("Missing <source> element in hostdev device"));
|
||||
- goto error;
|
||||
+ goto cleanup;
|
||||
}
|
||||
|
||||
if (def->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB &&
|
||||
@@ -7709,20 +7709,20 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node,
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("Setting startupPolicy is only allowed for USB"
|
||||
" devices"));
|
||||
- goto error;
|
||||
+ goto cleanup;
|
||||
}
|
||||
|
||||
if (sgio) {
|
||||
if (def->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI) {
|
||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||
_("sgio is only supported for scsi host device"));
|
||||
- goto error;
|
||||
+ goto cleanup;
|
||||
}
|
||||
|
||||
if ((scsisrc->sgio = virDomainDeviceSGIOTypeFromString(sgio)) <= 0) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("unknown sgio mode '%s'"), sgio);
|
||||
- goto error;
|
||||
+ goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7730,14 +7730,14 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node,
|
||||
if (def->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI) {
|
||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||
_("rawio is only supported for scsi host device"));
|
||||
- goto error;
|
||||
+ goto cleanup;
|
||||
}
|
||||
|
||||
if ((scsisrc->rawio = virTristateBoolTypeFromString(rawio)) <= 0) {
|
||||
virReportError(VIR_ERR_XML_ERROR,
|
||||
_("unknown hostdev rawio setting '%s'"),
|
||||
rawio);
|
||||
- goto error;
|
||||
+ goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7746,28 +7746,28 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node,
|
||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||
_("'model' attribute in <hostdev> is only supported "
|
||||
"when type='mdev'"));
|
||||
- goto error;
|
||||
+ goto cleanup;
|
||||
}
|
||||
} else {
|
||||
if (!model) {
|
||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||
_("Missing 'model' attribute in mediated device's "
|
||||
"<hostdev> element"));
|
||||
- goto error;
|
||||
+ goto cleanup;
|
||||
}
|
||||
|
||||
if ((mdevsrc->model = virMediatedDeviceModelTypeFromString(model)) < 0) {
|
||||
virReportError(VIR_ERR_XML_ERROR,
|
||||
_("unknown hostdev model '%s'"),
|
||||
model);
|
||||
- goto error;
|
||||
+ goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
switch (def->source.subsys.type) {
|
||||
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI:
|
||||
if (virDomainHostdevSubsysPCIDefParseXML(sourcenode, def, flags) < 0)
|
||||
- goto error;
|
||||
+ goto cleanup;
|
||||
|
||||
backend = VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT;
|
||||
if ((backendStr = virXPathString("string(./driver/@name)", ctxt)) &&
|
||||
@@ -7776,7 +7776,7 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node,
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("Unknown PCI device <driver name='%s'/> "
|
||||
"has been specified"), backendStr);
|
||||
- goto error;
|
||||
+ goto cleanup;
|
||||
}
|
||||
pcisrc->backend = backend;
|
||||
|
||||
@@ -7784,32 +7784,32 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node,
|
||||
|
||||
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB:
|
||||
if (virDomainHostdevSubsysUSBDefParseXML(sourcenode, def) < 0)
|
||||
- goto error;
|
||||
+ goto cleanup;
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI:
|
||||
if (virDomainHostdevSubsysSCSIDefParseXML(sourcenode, scsisrc, ctxt) < 0)
|
||||
- goto error;
|
||||
+ goto cleanup;
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST:
|
||||
if (virDomainHostdevSubsysSCSIVHostDefParseXML(sourcenode, def) < 0)
|
||||
- goto error;
|
||||
+ goto cleanup;
|
||||
break;
|
||||
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV:
|
||||
if (virDomainHostdevSubsysMediatedDevDefParseXML(def, ctxt) < 0)
|
||||
- goto error;
|
||||
+ goto cleanup;
|
||||
break;
|
||||
|
||||
default:
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("address type='%s' not supported in hostdev interfaces"),
|
||||
virDomainHostdevSubsysTypeToString(def->source.subsys.type));
|
||||
- goto error;
|
||||
+ goto cleanup;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
- error:
|
||||
+ cleanup:
|
||||
VIR_FREE(managed);
|
||||
VIR_FREE(sgio);
|
||||
VIR_FREE(rawio);
|
||||
--
|
||||
2.18.0
|
||||
|
@ -0,0 +1,214 @@
|
||||
From b56deb73400af9518bdc86802b8ac8da0670d806 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <b56deb73400af9518bdc86802b8ac8da0670d806@dist-git>
|
||||
From: Laine Stump <laine@laine.org>
|
||||
Date: Thu, 10 Jan 2019 09:44:45 -0500
|
||||
Subject: [PATCH] conf: correct false boot order error during domain parse
|
||||
|
||||
virDomainDefCollectBootOrder() is called for every item on the list
|
||||
for each type of device. One of the checks it makes is to gather the
|
||||
order attributes from the <boot> element of all devices, and assure
|
||||
that no two devices have been given the same order.
|
||||
|
||||
Since (internally to libvirt, *not* in the domain XML) an <interface
|
||||
type='hostdev'> is on both the list of hostdev devices and the list of
|
||||
network devices, it will be counted twice, and the code that checks
|
||||
for multiple devices with the same boot order will give a false
|
||||
positive.
|
||||
|
||||
To remedy this, we make sure to return early for hostdev devices that
|
||||
have a parent.type != NONE.
|
||||
|
||||
This was introduced in commit 5b75a4, which was first in libvirt-4.4.0.
|
||||
|
||||
Resolves: https://bugzilla.redhat.com/1630393 (RHEL8)
|
||||
Resolves: https://bugzilla.redhat.com/1601318 (RHEL7)
|
||||
|
||||
Change from upstream: upstream has eliminated QEMU_CAPS_BOOTINDEX and
|
||||
QEMU_CAPS_PCI_BOOTINDEX so they're no longer necessary in test cases.
|
||||
|
||||
Signed-off-by: Laine Stump <laine@laine.org>
|
||||
(cherry picked from commit 7ea7342996d74591e00bcbf14b1eb3995f77a199)
|
||||
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
---
|
||||
src/conf/domain_conf.c | 8 ++++
|
||||
.../net-hostdev-bootorder.args | 27 ++++++++++++
|
||||
.../net-hostdev-bootorder.xml | 36 ++++++++++++++++
|
||||
tests/qemuxml2argvtest.c | 3 ++
|
||||
.../net-hostdev-bootorder.xml | 42 +++++++++++++++++++
|
||||
tests/qemuxml2xmltest.c | 1 +
|
||||
6 files changed, 117 insertions(+)
|
||||
create mode 100644 tests/qemuxml2argvdata/net-hostdev-bootorder.args
|
||||
create mode 100644 tests/qemuxml2argvdata/net-hostdev-bootorder.xml
|
||||
create mode 100644 tests/qemuxml2xmloutdata/net-hostdev-bootorder.xml
|
||||
|
||||
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
||||
index 660e1523fe..d431441f62 100644
|
||||
--- a/src/conf/domain_conf.c
|
||||
+++ b/src/conf/domain_conf.c
|
||||
@@ -5076,6 +5076,14 @@ virDomainDefCollectBootOrder(virDomainDefPtr def ATTRIBUTE_UNUSED,
|
||||
if (info->bootIndex == 0)
|
||||
return 0;
|
||||
|
||||
+ if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV &&
|
||||
+ dev->data.hostdev->parent.type != VIR_DOMAIN_DEVICE_NONE) {
|
||||
+ /* This hostdev is a child of a higher level device
|
||||
+ * (e.g. interface), and thus already being counted on the
|
||||
+ * list for the other device type.
|
||||
+ */
|
||||
+ return 0;
|
||||
+ }
|
||||
if (virAsprintf(&order, "%u", info->bootIndex) < 0)
|
||||
goto cleanup;
|
||||
|
||||
diff --git a/tests/qemuxml2argvdata/net-hostdev-bootorder.args b/tests/qemuxml2argvdata/net-hostdev-bootorder.args
|
||||
new file mode 100644
|
||||
index 0000000000..e632d9b195
|
||||
--- /dev/null
|
||||
+++ b/tests/qemuxml2argvdata/net-hostdev-bootorder.args
|
||||
@@ -0,0 +1,27 @@
|
||||
+LC_ALL=C \
|
||||
+PATH=/bin \
|
||||
+HOME=/home/test \
|
||||
+USER=test \
|
||||
+LOGNAME=test \
|
||||
+QEMU_AUDIO_DRV=none \
|
||||
+/usr/bin/qemu-system-i686 \
|
||||
+-name QEMUGuest1 \
|
||||
+-S \
|
||||
+-machine pc,accel=tcg,usb=off,dump-guest-core=off \
|
||||
+-m 214 \
|
||||
+-smp 1,sockets=1,cores=1,threads=1 \
|
||||
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
|
||||
+-display none \
|
||||
+-no-user-config \
|
||||
+-nodefaults \
|
||||
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
|
||||
+server,nowait \
|
||||
+-mon chardev=charmonitor,id=monitor,mode=control \
|
||||
+-rtc base=utc \
|
||||
+-no-shutdown \
|
||||
+-no-acpi \
|
||||
+-usb \
|
||||
+-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
|
||||
+-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,\
|
||||
+bootindex=2 \
|
||||
+-device pci-assign,host=03:07.1,id=hostdev0,bootindex=1,bus=pci.0,addr=0x3
|
||||
diff --git a/tests/qemuxml2argvdata/net-hostdev-bootorder.xml b/tests/qemuxml2argvdata/net-hostdev-bootorder.xml
|
||||
new file mode 100644
|
||||
index 0000000000..cd9f32b2f3
|
||||
--- /dev/null
|
||||
+++ b/tests/qemuxml2argvdata/net-hostdev-bootorder.xml
|
||||
@@ -0,0 +1,36 @@
|
||||
+<domain type='qemu'>
|
||||
+ <name>QEMUGuest1</name>
|
||||
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||
+ <memory unit='KiB'>219136</memory>
|
||||
+ <currentMemory unit='KiB'>219136</currentMemory>
|
||||
+ <vcpu placement='static'>1</vcpu>
|
||||
+ <os>
|
||||
+ <type arch='i686' machine='pc'>hvm</type>
|
||||
+ </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-i686</emulator>
|
||||
+ <disk type='block' device='disk'>
|
||||
+ <source dev='/dev/HostVG/QEMUGuest1'/>
|
||||
+ <target dev='hda' bus='ide'/>
|
||||
+ <address type='drive' controller='0' bus='0' target='0' unit='0'/>
|
||||
+ <boot order='2'/>
|
||||
+ </disk>
|
||||
+ <controller type='usb' index='0'/>
|
||||
+ <controller type='ide' index='0'/>
|
||||
+ <controller type='pci' index='0' model='pci-root'/>
|
||||
+ <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>
|
||||
+ <boot order='1'/>
|
||||
+ </interface>
|
||||
+ <input type='mouse' bus='ps2'/>
|
||||
+ <input type='keyboard' bus='ps2'/>
|
||||
+ <memballoon model='none'/>
|
||||
+ </devices>
|
||||
+</domain>
|
||||
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
|
||||
index bd4aa1266d..690a39054e 100644
|
||||
--- a/tests/qemuxml2argvtest.c
|
||||
+++ b/tests/qemuxml2argvtest.c
|
||||
@@ -1324,6 +1324,9 @@ mymain(void)
|
||||
DO_TEST("net-mcast", NONE);
|
||||
DO_TEST("net-udp", NONE);
|
||||
DO_TEST("net-hostdev", NONE);
|
||||
+ DO_TEST("net-hostdev-bootorder",
|
||||
+ QEMU_CAPS_BOOTINDEX,
|
||||
+ QEMU_CAPS_PCI_BOOTINDEX);
|
||||
DO_TEST("net-hostdev-multidomain", NONE);
|
||||
DO_TEST("net-hostdev-vfio",
|
||||
QEMU_CAPS_DEVICE_VFIO_PCI);
|
||||
diff --git a/tests/qemuxml2xmloutdata/net-hostdev-bootorder.xml b/tests/qemuxml2xmloutdata/net-hostdev-bootorder.xml
|
||||
new file mode 100644
|
||||
index 0000000000..d9ecf40cf0
|
||||
--- /dev/null
|
||||
+++ b/tests/qemuxml2xmloutdata/net-hostdev-bootorder.xml
|
||||
@@ -0,0 +1,42 @@
|
||||
+<domain type='qemu'>
|
||||
+ <name>QEMUGuest1</name>
|
||||
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||
+ <memory unit='KiB'>219136</memory>
|
||||
+ <currentMemory unit='KiB'>219136</currentMemory>
|
||||
+ <vcpu placement='static'>1</vcpu>
|
||||
+ <os>
|
||||
+ <type arch='i686' machine='pc'>hvm</type>
|
||||
+ </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-i686</emulator>
|
||||
+ <disk type='block' device='disk'>
|
||||
+ <driver name='qemu' type='raw'/>
|
||||
+ <source dev='/dev/HostVG/QEMUGuest1'/>
|
||||
+ <target dev='hda' bus='ide'/>
|
||||
+ <boot order='2'/>
|
||||
+ <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='ide' index='0'>
|
||||
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
|
||||
+ </controller>
|
||||
+ <controller type='pci' index='0' model='pci-root'/>
|
||||
+ <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>
|
||||
+ <boot order='1'/>
|
||||
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
|
||||
+ </interface>
|
||||
+ <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 db088fff6b..dbac863239 100644
|
||||
--- a/tests/qemuxml2xmltest.c
|
||||
+++ b/tests/qemuxml2xmltest.c
|
||||
@@ -454,6 +454,7 @@ mymain(void)
|
||||
DO_TEST("net-virtio-network-portgroup", NONE);
|
||||
DO_TEST("net-virtio-rxtxqueuesize", NONE);
|
||||
DO_TEST("net-hostdev", NONE);
|
||||
+ DO_TEST("net-hostdev-bootorder", NONE);
|
||||
DO_TEST("net-hostdev-vfio", NONE);
|
||||
DO_TEST("net-midonet", NONE);
|
||||
DO_TEST("net-openvswitch", NONE);
|
||||
--
|
||||
2.20.1
|
||||
|
@ -0,0 +1,262 @@
|
||||
From efc0312e1edb3d8196806606fbb639bbbd0bd6d4 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <efc0312e1edb3d8196806606fbb639bbbd0bd6d4@dist-git>
|
||||
From: Vitaly Kuznetsov <vkuznets@redhat.com>
|
||||
Date: Thu, 9 Aug 2018 15:14:21 +0200
|
||||
Subject: [PATCH] conf: qemu: add support for Hyper-V PV TLB flush
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Qemu-3.0 supports Hyper-V-style PV TLB flush, Windows guests can benefit
|
||||
from this feature as KVM knows which vCPUs are not currently scheduled (and
|
||||
thus don't require any immediate action).
|
||||
|
||||
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
|
||||
Reviewed-by: John Ferlan <jferlan@redhat.com>
|
||||
(cherry picked from commit f4c39db7366376bd95e1751b0e3ced9c73c14f5b)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1589702
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
docs/formatdomain.html.in | 7 +++++++
|
||||
docs/schemas/domaincommon.rng | 5 +++++
|
||||
src/conf/domain_conf.c | 6 +++++-
|
||||
src/conf/domain_conf.h | 1 +
|
||||
src/cpu/cpu_x86.c | 3 +++
|
||||
src/cpu/cpu_x86_data.h | 1 +
|
||||
src/qemu/qemu_command.c | 1 +
|
||||
src/qemu/qemu_parse_command.c | 1 +
|
||||
src/qemu/qemu_process.c | 1 +
|
||||
tests/qemuxml2argvdata/hyperv-off.xml | 1 +
|
||||
tests/qemuxml2argvdata/hyperv.args | 2 +-
|
||||
tests/qemuxml2argvdata/hyperv.xml | 1 +
|
||||
tests/qemuxml2xmloutdata/hyperv-off.xml | 1 +
|
||||
tests/qemuxml2xmloutdata/hyperv.xml | 1 +
|
||||
14 files changed, 30 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
|
||||
index 43a1067501..c019b26644 100644
|
||||
--- a/docs/formatdomain.html.in
|
||||
+++ b/docs/formatdomain.html.in
|
||||
@@ -1917,6 +1917,7 @@
|
||||
<vendor_id state='on' value='KVM Hv'/>
|
||||
<frequencies state='on'/>
|
||||
<reenlightenment state='on'/>
|
||||
+ <tlbflush state='on'/>
|
||||
</hyperv>
|
||||
<kvm>
|
||||
<hidden state='on'/>
|
||||
@@ -2051,6 +2052,12 @@
|
||||
<td> on, off</td>
|
||||
<td><span class="since">4.7.0 (QEMU 3.0)</span></td>
|
||||
</tr>
|
||||
+ <tr>
|
||||
+ <td>tlbflush</td>
|
||||
+ <td>Enable PV TLB flush support</td>
|
||||
+ <td> on, off</td>
|
||||
+ <td><span class="since">4.7.0 (QEMU 3.0)</span></td>
|
||||
+ </tr>
|
||||
</table>
|
||||
</dd>
|
||||
<dt><code>pvspinlock</code></dt>
|
||||
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
|
||||
index ceee7a8efe..1c6f2a295d 100644
|
||||
--- a/docs/schemas/domaincommon.rng
|
||||
+++ b/docs/schemas/domaincommon.rng
|
||||
@@ -5723,6 +5723,11 @@
|
||||
<ref name="featurestate"/>
|
||||
</element>
|
||||
</optional>
|
||||
+ <optional>
|
||||
+ <element name="tlbflush">
|
||||
+ <ref name="featurestate"/>
|
||||
+ </element>
|
||||
+ </optional>
|
||||
</interleave>
|
||||
</element>
|
||||
</define>
|
||||
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
||||
index 18b4d03a61..e013e9f0c5 100644
|
||||
--- a/src/conf/domain_conf.c
|
||||
+++ b/src/conf/domain_conf.c
|
||||
@@ -171,7 +171,8 @@ VIR_ENUM_IMPL(virDomainHyperv, VIR_DOMAIN_HYPERV_LAST,
|
||||
"reset",
|
||||
"vendor_id",
|
||||
"frequencies",
|
||||
- "reenlightenment")
|
||||
+ "reenlightenment",
|
||||
+ "tlbflush")
|
||||
|
||||
VIR_ENUM_IMPL(virDomainKVM, VIR_DOMAIN_KVM_LAST,
|
||||
"hidden")
|
||||
@@ -20055,6 +20056,7 @@ virDomainDefParseXML(xmlDocPtr xml,
|
||||
case VIR_DOMAIN_HYPERV_RESET:
|
||||
case VIR_DOMAIN_HYPERV_FREQUENCIES:
|
||||
case VIR_DOMAIN_HYPERV_REENLIGHTENMENT:
|
||||
+ case VIR_DOMAIN_HYPERV_TLBFLUSH:
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_HYPERV_SPINLOCKS:
|
||||
@@ -22248,6 +22250,7 @@ virDomainDefFeaturesCheckABIStability(virDomainDefPtr src,
|
||||
case VIR_DOMAIN_HYPERV_RESET:
|
||||
case VIR_DOMAIN_HYPERV_FREQUENCIES:
|
||||
case VIR_DOMAIN_HYPERV_REENLIGHTENMENT:
|
||||
+ case VIR_DOMAIN_HYPERV_TLBFLUSH:
|
||||
if (src->hyperv_features[i] != dst->hyperv_features[i]) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("State of HyperV enlightenment "
|
||||
@@ -27898,6 +27901,7 @@ virDomainDefFormatInternal(virDomainDefPtr def,
|
||||
case VIR_DOMAIN_HYPERV_RESET:
|
||||
case VIR_DOMAIN_HYPERV_FREQUENCIES:
|
||||
case VIR_DOMAIN_HYPERV_REENLIGHTENMENT:
|
||||
+ case VIR_DOMAIN_HYPERV_TLBFLUSH:
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_HYPERV_SPINLOCKS:
|
||||
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
|
||||
index e450923019..d32514e7e6 100644
|
||||
--- a/src/conf/domain_conf.h
|
||||
+++ b/src/conf/domain_conf.h
|
||||
@@ -1793,6 +1793,7 @@ typedef enum {
|
||||
VIR_DOMAIN_HYPERV_VENDOR_ID,
|
||||
VIR_DOMAIN_HYPERV_FREQUENCIES,
|
||||
VIR_DOMAIN_HYPERV_REENLIGHTENMENT,
|
||||
+ VIR_DOMAIN_HYPERV_TLBFLUSH,
|
||||
|
||||
VIR_DOMAIN_HYPERV_LAST
|
||||
} virDomainHyperv;
|
||||
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
|
||||
index 7a48b78eb9..7fa84f6014 100644
|
||||
--- a/src/cpu/cpu_x86.c
|
||||
+++ b/src/cpu/cpu_x86.c
|
||||
@@ -113,6 +113,8 @@ KVM_FEATURE_DEF(VIR_CPU_x86_KVM_HV_FREQUENCIES,
|
||||
0x40000003, 0x00000800);
|
||||
KVM_FEATURE_DEF(VIR_CPU_x86_KVM_HV_REENLIGHTENMENT,
|
||||
0x40000003, 0x00002000);
|
||||
+KVM_FEATURE_DEF(VIR_CPU_x86_KVM_HV_TLBFLUSH,
|
||||
+ 0x40000004, 0x00000004);
|
||||
|
||||
static virCPUx86Feature x86_kvm_features[] =
|
||||
{
|
||||
@@ -135,6 +137,7 @@ static virCPUx86Feature x86_kvm_features[] =
|
||||
KVM_FEATURE(VIR_CPU_x86_KVM_HV_RESET),
|
||||
KVM_FEATURE(VIR_CPU_x86_KVM_HV_FREQUENCIES),
|
||||
KVM_FEATURE(VIR_CPU_x86_KVM_HV_REENLIGHTENMENT),
|
||||
+ KVM_FEATURE(VIR_CPU_x86_KVM_HV_TLBFLUSH),
|
||||
};
|
||||
|
||||
typedef struct _virCPUx86Model virCPUx86Model;
|
||||
diff --git a/src/cpu/cpu_x86_data.h b/src/cpu/cpu_x86_data.h
|
||||
index a810c64fc9..090a21156f 100644
|
||||
--- a/src/cpu/cpu_x86_data.h
|
||||
+++ b/src/cpu/cpu_x86_data.h
|
||||
@@ -65,6 +65,7 @@ struct _virCPUx86CPUID {
|
||||
# define VIR_CPU_x86_KVM_HV_RESET "__kvm_hv_reset"
|
||||
# define VIR_CPU_x86_KVM_HV_FREQUENCIES "__kvm_hv_frequencies"
|
||||
# define VIR_CPU_x86_KVM_HV_REENLIGHTENMENT "__kvm_hv_reenlightenment"
|
||||
+# define VIR_CPU_x86_KVM_HV_TLBFLUSH "__kvm_hv_tlbflush"
|
||||
|
||||
|
||||
# define VIR_CPU_X86_DATA_INIT { 0 }
|
||||
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
|
||||
index 48f3b09ec9..a3d605c00f 100644
|
||||
--- a/src/qemu/qemu_command.c
|
||||
+++ b/src/qemu/qemu_command.c
|
||||
@@ -6921,6 +6921,7 @@ qemuBuildCpuCommandLine(virCommandPtr cmd,
|
||||
case VIR_DOMAIN_HYPERV_RESET:
|
||||
case VIR_DOMAIN_HYPERV_FREQUENCIES:
|
||||
case VIR_DOMAIN_HYPERV_REENLIGHTENMENT:
|
||||
+ case VIR_DOMAIN_HYPERV_TLBFLUSH:
|
||||
if (def->hyperv_features[i] == VIR_TRISTATE_SWITCH_ON)
|
||||
virBufferAsprintf(&buf, ",hv_%s",
|
||||
virDomainHypervTypeToString(i));
|
||||
diff --git a/src/qemu/qemu_parse_command.c b/src/qemu/qemu_parse_command.c
|
||||
index 1e67a5a8c8..fdc1d34068 100644
|
||||
--- a/src/qemu/qemu_parse_command.c
|
||||
+++ b/src/qemu/qemu_parse_command.c
|
||||
@@ -1538,6 +1538,7 @@ qemuParseCommandLineCPU(virDomainDefPtr dom,
|
||||
case VIR_DOMAIN_HYPERV_RESET:
|
||||
case VIR_DOMAIN_HYPERV_FREQUENCIES:
|
||||
case VIR_DOMAIN_HYPERV_REENLIGHTENMENT:
|
||||
+ case VIR_DOMAIN_HYPERV_TLBFLUSH:
|
||||
if (value) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("HyperV feature '%s' should not "
|
||||
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
|
||||
index 990d4d3046..23958bcbce 100644
|
||||
--- a/src/qemu/qemu_process.c
|
||||
+++ b/src/qemu/qemu_process.c
|
||||
@@ -3925,6 +3925,7 @@ qemuProcessVerifyHypervFeatures(virDomainDefPtr def,
|
||||
case VIR_DOMAIN_HYPERV_RESET:
|
||||
case VIR_DOMAIN_HYPERV_FREQUENCIES:
|
||||
case VIR_DOMAIN_HYPERV_REENLIGHTENMENT:
|
||||
+ case VIR_DOMAIN_HYPERV_TLBFLUSH:
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("host doesn't support hyperv '%s' feature"),
|
||||
virDomainHypervTypeToString(i));
|
||||
diff --git a/tests/qemuxml2argvdata/hyperv-off.xml b/tests/qemuxml2argvdata/hyperv-off.xml
|
||||
index b2e3612df9..dc5777355f 100644
|
||||
--- a/tests/qemuxml2argvdata/hyperv-off.xml
|
||||
+++ b/tests/qemuxml2argvdata/hyperv-off.xml
|
||||
@@ -22,6 +22,7 @@
|
||||
<vendor_id state='off'/>
|
||||
<frequencies state='off'/>
|
||||
<reenlightenment state='off'/>
|
||||
+ <tlbflush state='off'/>
|
||||
</hyperv>
|
||||
</features>
|
||||
<clock offset='utc'/>
|
||||
diff --git a/tests/qemuxml2argvdata/hyperv.args b/tests/qemuxml2argvdata/hyperv.args
|
||||
index 4feafad8e2..6ee6198fb0 100644
|
||||
--- a/tests/qemuxml2argvdata/hyperv.args
|
||||
+++ b/tests/qemuxml2argvdata/hyperv.args
|
||||
@@ -10,7 +10,7 @@ QEMU_AUDIO_DRV=none \
|
||||
-machine pc,accel=tcg,usb=off,dump-guest-core=off \
|
||||
-cpu 'qemu32,hv_relaxed,hv_vapic,hv_spinlocks=0x2fff,hv_vpindex,hv_runtime,\
|
||||
hv_synic,hv_stimer,hv_reset,hv_vendor_id=KVM Hv,hv_frequencies,\
|
||||
-hv_reenlightenment' \
|
||||
+hv_reenlightenment,hv_tlbflush' \
|
||||
-m 214 \
|
||||
-smp 6,sockets=6,cores=1,threads=1 \
|
||||
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
|
||||
diff --git a/tests/qemuxml2argvdata/hyperv.xml b/tests/qemuxml2argvdata/hyperv.xml
|
||||
index 20fcdba59e..816adf6907 100644
|
||||
--- a/tests/qemuxml2argvdata/hyperv.xml
|
||||
+++ b/tests/qemuxml2argvdata/hyperv.xml
|
||||
@@ -22,6 +22,7 @@
|
||||
<vendor_id state='on' value='KVM Hv'/>
|
||||
<frequencies state='on'/>
|
||||
<reenlightenment state='on'/>
|
||||
+ <tlbflush state='on'/>
|
||||
</hyperv>
|
||||
</features>
|
||||
<clock offset='utc'/>
|
||||
diff --git a/tests/qemuxml2xmloutdata/hyperv-off.xml b/tests/qemuxml2xmloutdata/hyperv-off.xml
|
||||
index 4a41e0c37e..77a8dac810 100644
|
||||
--- a/tests/qemuxml2xmloutdata/hyperv-off.xml
|
||||
+++ b/tests/qemuxml2xmloutdata/hyperv-off.xml
|
||||
@@ -22,6 +22,7 @@
|
||||
<vendor_id state='off'/>
|
||||
<frequencies state='off'/>
|
||||
<reenlightenment state='off'/>
|
||||
+ <tlbflush state='off'/>
|
||||
</hyperv>
|
||||
</features>
|
||||
<clock offset='utc'/>
|
||||
diff --git a/tests/qemuxml2xmloutdata/hyperv.xml b/tests/qemuxml2xmloutdata/hyperv.xml
|
||||
index 183b45980b..fc8c59a557 100644
|
||||
--- a/tests/qemuxml2xmloutdata/hyperv.xml
|
||||
+++ b/tests/qemuxml2xmloutdata/hyperv.xml
|
||||
@@ -22,6 +22,7 @@
|
||||
<vendor_id state='on' value='KVM Hv'/>
|
||||
<frequencies state='on'/>
|
||||
<reenlightenment state='on'/>
|
||||
+ <tlbflush state='on'/>
|
||||
</hyperv>
|
||||
</features>
|
||||
<clock offset='utc'/>
|
||||
--
|
||||
2.19.1
|
||||
|
@ -0,0 +1,262 @@
|
||||
From b4335c3290082dd8aa0915e340b625197d80fdc3 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <b4335c3290082dd8aa0915e340b625197d80fdc3@dist-git>
|
||||
From: Vitaly Kuznetsov <vkuznets@redhat.com>
|
||||
Date: Thu, 9 Aug 2018 15:14:19 +0200
|
||||
Subject: [PATCH] conf: qemu: add support for Hyper-V frequency MSRs
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Qemu-2.12 gained 'hv-frequencies' cpu flag to enable Hyper-V frequency
|
||||
MSRs. These MSRs are required (but not sufficient) to make Hyper-V on
|
||||
KVM pass stable TSC page clocksource to L2 guests.
|
||||
|
||||
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
|
||||
Reviewed-by: John Ferlan <jferlan@redhat.com>
|
||||
(cherry picked from commit 8253bca9615233f670c7dad659c120e4556a748a)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1589702
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
docs/formatdomain.html.in | 7 +++++++
|
||||
docs/schemas/domaincommon.rng | 5 +++++
|
||||
src/conf/domain_conf.c | 6 +++++-
|
||||
src/conf/domain_conf.h | 1 +
|
||||
src/cpu/cpu_x86.c | 3 +++
|
||||
src/cpu/cpu_x86_data.h | 1 +
|
||||
src/qemu/qemu_command.c | 1 +
|
||||
src/qemu/qemu_parse_command.c | 1 +
|
||||
src/qemu/qemu_process.c | 1 +
|
||||
tests/qemuxml2argvdata/hyperv-off.xml | 1 +
|
||||
tests/qemuxml2argvdata/hyperv.args | 2 +-
|
||||
tests/qemuxml2argvdata/hyperv.xml | 1 +
|
||||
tests/qemuxml2xmloutdata/hyperv-off.xml | 1 +
|
||||
tests/qemuxml2xmloutdata/hyperv.xml | 1 +
|
||||
14 files changed, 30 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
|
||||
index 42acf7a828..3b493a98ac 100644
|
||||
--- a/docs/formatdomain.html.in
|
||||
+++ b/docs/formatdomain.html.in
|
||||
@@ -1915,6 +1915,7 @@
|
||||
<synic state='on'/>
|
||||
<reset state='on'/>
|
||||
<vendor_id state='on' value='KVM Hv'/>
|
||||
+ <frequencies state='on'/>
|
||||
</hyperv>
|
||||
<kvm>
|
||||
<hidden state='on'/>
|
||||
@@ -2037,6 +2038,12 @@
|
||||
<td>on, off; value - string, up to 12 characters</td>
|
||||
<td><span class="since">1.3.3 (QEMU 2.5)</span></td>
|
||||
</tr>
|
||||
+ <tr>
|
||||
+ <td>frequencies</td>
|
||||
+ <td>Expose frequency MSRs</td>
|
||||
+ <td> on, off</td>
|
||||
+ <td><span class="since">4.7.0 (QEMU 2.12)</span></td>
|
||||
+ </tr>
|
||||
</table>
|
||||
</dd>
|
||||
<dt><code>pvspinlock</code></dt>
|
||||
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
|
||||
index ac04af51a1..f156a6b7c4 100644
|
||||
--- a/docs/schemas/domaincommon.rng
|
||||
+++ b/docs/schemas/domaincommon.rng
|
||||
@@ -5713,6 +5713,11 @@
|
||||
</optional>
|
||||
</element>
|
||||
</optional>
|
||||
+ <optional>
|
||||
+ <element name="frequencies">
|
||||
+ <ref name="featurestate"/>
|
||||
+ </element>
|
||||
+ </optional>
|
||||
</interleave>
|
||||
</element>
|
||||
</define>
|
||||
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
||||
index 240b33f28c..150dd8acc8 100644
|
||||
--- a/src/conf/domain_conf.c
|
||||
+++ b/src/conf/domain_conf.c
|
||||
@@ -169,7 +169,8 @@ VIR_ENUM_IMPL(virDomainHyperv, VIR_DOMAIN_HYPERV_LAST,
|
||||
"synic",
|
||||
"stimer",
|
||||
"reset",
|
||||
- "vendor_id")
|
||||
+ "vendor_id",
|
||||
+ "frequencies")
|
||||
|
||||
VIR_ENUM_IMPL(virDomainKVM, VIR_DOMAIN_KVM_LAST,
|
||||
"hidden")
|
||||
@@ -20051,6 +20052,7 @@ virDomainDefParseXML(xmlDocPtr xml,
|
||||
case VIR_DOMAIN_HYPERV_SYNIC:
|
||||
case VIR_DOMAIN_HYPERV_STIMER:
|
||||
case VIR_DOMAIN_HYPERV_RESET:
|
||||
+ case VIR_DOMAIN_HYPERV_FREQUENCIES:
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_HYPERV_SPINLOCKS:
|
||||
@@ -22242,6 +22244,7 @@ virDomainDefFeaturesCheckABIStability(virDomainDefPtr src,
|
||||
case VIR_DOMAIN_HYPERV_SYNIC:
|
||||
case VIR_DOMAIN_HYPERV_STIMER:
|
||||
case VIR_DOMAIN_HYPERV_RESET:
|
||||
+ case VIR_DOMAIN_HYPERV_FREQUENCIES:
|
||||
if (src->hyperv_features[i] != dst->hyperv_features[i]) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("State of HyperV enlightenment "
|
||||
@@ -27890,6 +27893,7 @@ virDomainDefFormatInternal(virDomainDefPtr def,
|
||||
case VIR_DOMAIN_HYPERV_SYNIC:
|
||||
case VIR_DOMAIN_HYPERV_STIMER:
|
||||
case VIR_DOMAIN_HYPERV_RESET:
|
||||
+ case VIR_DOMAIN_HYPERV_FREQUENCIES:
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_HYPERV_SPINLOCKS:
|
||||
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
|
||||
index 5e2f21dea3..97d38ff7b9 100644
|
||||
--- a/src/conf/domain_conf.h
|
||||
+++ b/src/conf/domain_conf.h
|
||||
@@ -1791,6 +1791,7 @@ typedef enum {
|
||||
VIR_DOMAIN_HYPERV_STIMER,
|
||||
VIR_DOMAIN_HYPERV_RESET,
|
||||
VIR_DOMAIN_HYPERV_VENDOR_ID,
|
||||
+ VIR_DOMAIN_HYPERV_FREQUENCIES,
|
||||
|
||||
VIR_DOMAIN_HYPERV_LAST
|
||||
} virDomainHyperv;
|
||||
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
|
||||
index 809da94117..a2fbfb577d 100644
|
||||
--- a/src/cpu/cpu_x86.c
|
||||
+++ b/src/cpu/cpu_x86.c
|
||||
@@ -109,6 +109,8 @@ KVM_FEATURE_DEF(VIR_CPU_x86_KVM_HV_VPINDEX,
|
||||
0x40000003, 0x00000040);
|
||||
KVM_FEATURE_DEF(VIR_CPU_x86_KVM_HV_RESET,
|
||||
0x40000003, 0x00000080);
|
||||
+KVM_FEATURE_DEF(VIR_CPU_x86_KVM_HV_FREQUENCIES,
|
||||
+ 0x40000003, 0x00000800);
|
||||
|
||||
static virCPUx86Feature x86_kvm_features[] =
|
||||
{
|
||||
@@ -129,6 +131,7 @@ static virCPUx86Feature x86_kvm_features[] =
|
||||
KVM_FEATURE(VIR_CPU_x86_KVM_HV_VAPIC),
|
||||
KVM_FEATURE(VIR_CPU_x86_KVM_HV_VPINDEX),
|
||||
KVM_FEATURE(VIR_CPU_x86_KVM_HV_RESET),
|
||||
+ KVM_FEATURE(VIR_CPU_x86_KVM_HV_FREQUENCIES),
|
||||
};
|
||||
|
||||
typedef struct _virCPUx86Model virCPUx86Model;
|
||||
diff --git a/src/cpu/cpu_x86_data.h b/src/cpu/cpu_x86_data.h
|
||||
index b89110f16c..c01eb41be5 100644
|
||||
--- a/src/cpu/cpu_x86_data.h
|
||||
+++ b/src/cpu/cpu_x86_data.h
|
||||
@@ -63,6 +63,7 @@ struct _virCPUx86CPUID {
|
||||
# define VIR_CPU_x86_KVM_HV_VAPIC "__kvm_hv_vapic"
|
||||
# define VIR_CPU_x86_KVM_HV_VPINDEX "__kvm_hv_vpindex"
|
||||
# define VIR_CPU_x86_KVM_HV_RESET "__kvm_hv_reset"
|
||||
+# define VIR_CPU_x86_KVM_HV_FREQUENCIES "__kvm_hv_frequencies"
|
||||
|
||||
|
||||
# define VIR_CPU_X86_DATA_INIT { 0 }
|
||||
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
|
||||
index 028f48310b..82c349819e 100644
|
||||
--- a/src/qemu/qemu_command.c
|
||||
+++ b/src/qemu/qemu_command.c
|
||||
@@ -6919,6 +6919,7 @@ qemuBuildCpuCommandLine(virCommandPtr cmd,
|
||||
case VIR_DOMAIN_HYPERV_SYNIC:
|
||||
case VIR_DOMAIN_HYPERV_STIMER:
|
||||
case VIR_DOMAIN_HYPERV_RESET:
|
||||
+ case VIR_DOMAIN_HYPERV_FREQUENCIES:
|
||||
if (def->hyperv_features[i] == VIR_TRISTATE_SWITCH_ON)
|
||||
virBufferAsprintf(&buf, ",hv_%s",
|
||||
virDomainHypervTypeToString(i));
|
||||
diff --git a/src/qemu/qemu_parse_command.c b/src/qemu/qemu_parse_command.c
|
||||
index 351425fedd..ffea9a26bd 100644
|
||||
--- a/src/qemu/qemu_parse_command.c
|
||||
+++ b/src/qemu/qemu_parse_command.c
|
||||
@@ -1536,6 +1536,7 @@ qemuParseCommandLineCPU(virDomainDefPtr dom,
|
||||
case VIR_DOMAIN_HYPERV_SYNIC:
|
||||
case VIR_DOMAIN_HYPERV_STIMER:
|
||||
case VIR_DOMAIN_HYPERV_RESET:
|
||||
+ case VIR_DOMAIN_HYPERV_FREQUENCIES:
|
||||
if (value) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("HyperV feature '%s' should not "
|
||||
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
|
||||
index 2d51c0fa25..dd92a6c179 100644
|
||||
--- a/src/qemu/qemu_process.c
|
||||
+++ b/src/qemu/qemu_process.c
|
||||
@@ -3923,6 +3923,7 @@ qemuProcessVerifyHypervFeatures(virDomainDefPtr def,
|
||||
case VIR_DOMAIN_HYPERV_SYNIC:
|
||||
case VIR_DOMAIN_HYPERV_STIMER:
|
||||
case VIR_DOMAIN_HYPERV_RESET:
|
||||
+ case VIR_DOMAIN_HYPERV_FREQUENCIES:
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("host doesn't support hyperv '%s' feature"),
|
||||
virDomainHypervTypeToString(i));
|
||||
diff --git a/tests/qemuxml2argvdata/hyperv-off.xml b/tests/qemuxml2argvdata/hyperv-off.xml
|
||||
index ba9c978848..d3a8455ac3 100644
|
||||
--- a/tests/qemuxml2argvdata/hyperv-off.xml
|
||||
+++ b/tests/qemuxml2argvdata/hyperv-off.xml
|
||||
@@ -20,6 +20,7 @@
|
||||
<stimer state='off'/>
|
||||
<reset state='off'/>
|
||||
<vendor_id state='off'/>
|
||||
+ <frequencies state='off'/>
|
||||
</hyperv>
|
||||
</features>
|
||||
<clock offset='utc'/>
|
||||
diff --git a/tests/qemuxml2argvdata/hyperv.args b/tests/qemuxml2argvdata/hyperv.args
|
||||
index a1acbb63de..53026bb2d5 100644
|
||||
--- a/tests/qemuxml2argvdata/hyperv.args
|
||||
+++ b/tests/qemuxml2argvdata/hyperv.args
|
||||
@@ -9,7 +9,7 @@ QEMU_AUDIO_DRV=none \
|
||||
-S \
|
||||
-machine pc,accel=tcg,usb=off,dump-guest-core=off \
|
||||
-cpu 'qemu32,hv_relaxed,hv_vapic,hv_spinlocks=0x2fff,hv_vpindex,hv_runtime,\
|
||||
-hv_synic,hv_stimer,hv_reset,hv_vendor_id=KVM Hv' \
|
||||
+hv_synic,hv_stimer,hv_reset,hv_vendor_id=KVM Hv,hv_frequencies' \
|
||||
-m 214 \
|
||||
-smp 6,sockets=6,cores=1,threads=1 \
|
||||
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
|
||||
diff --git a/tests/qemuxml2argvdata/hyperv.xml b/tests/qemuxml2argvdata/hyperv.xml
|
||||
index 09f6d21024..27372d1636 100644
|
||||
--- a/tests/qemuxml2argvdata/hyperv.xml
|
||||
+++ b/tests/qemuxml2argvdata/hyperv.xml
|
||||
@@ -20,6 +20,7 @@
|
||||
<stimer state='on'/>
|
||||
<reset state='on'/>
|
||||
<vendor_id state='on' value='KVM Hv'/>
|
||||
+ <frequencies state='on'/>
|
||||
</hyperv>
|
||||
</features>
|
||||
<clock offset='utc'/>
|
||||
diff --git a/tests/qemuxml2xmloutdata/hyperv-off.xml b/tests/qemuxml2xmloutdata/hyperv-off.xml
|
||||
index 07eaf7219d..3ba0b827c3 100644
|
||||
--- a/tests/qemuxml2xmloutdata/hyperv-off.xml
|
||||
+++ b/tests/qemuxml2xmloutdata/hyperv-off.xml
|
||||
@@ -20,6 +20,7 @@
|
||||
<stimer state='off'/>
|
||||
<reset state='off'/>
|
||||
<vendor_id state='off'/>
|
||||
+ <frequencies state='off'/>
|
||||
</hyperv>
|
||||
</features>
|
||||
<clock offset='utc'/>
|
||||
diff --git a/tests/qemuxml2xmloutdata/hyperv.xml b/tests/qemuxml2xmloutdata/hyperv.xml
|
||||
index f9ae9504de..1e47a946d6 100644
|
||||
--- a/tests/qemuxml2xmloutdata/hyperv.xml
|
||||
+++ b/tests/qemuxml2xmloutdata/hyperv.xml
|
||||
@@ -20,6 +20,7 @@
|
||||
<stimer state='on'/>
|
||||
<reset state='on'/>
|
||||
<vendor_id state='on' value='KVM Hv'/>
|
||||
+ <frequencies state='on'/>
|
||||
</hyperv>
|
||||
</features>
|
||||
<clock offset='utc'/>
|
||||
--
|
||||
2.19.1
|
||||
|
@ -0,0 +1,264 @@
|
||||
From 7b4320c2371e10cf717c7bc28f83485cf176e03d Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <7b4320c2371e10cf717c7bc28f83485cf176e03d@dist-git>
|
||||
From: Vitaly Kuznetsov <vkuznets@redhat.com>
|
||||
Date: Thu, 9 Aug 2018 15:14:20 +0200
|
||||
Subject: [PATCH] conf: qemu: add support for Hyper-V reenlightenment
|
||||
notifications
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Qemu-3.0 supports so-called 'Reenlightenment' notifications and this (in
|
||||
conjunction with 'hv-frequencies') can be used make Hyper-V on KVM pass
|
||||
stable TSC page clocksource to L2 guests.
|
||||
|
||||
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
|
||||
Reviewed-by: John Ferlan <jferlan@redhat.com>
|
||||
(cherry picked from commit b5d770e155cbb7eec036b3d33ee0d81863ffc9a1)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1589702
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
docs/formatdomain.html.in | 7 +++++++
|
||||
docs/schemas/domaincommon.rng | 5 +++++
|
||||
src/conf/domain_conf.c | 6 +++++-
|
||||
src/conf/domain_conf.h | 1 +
|
||||
src/cpu/cpu_x86.c | 3 +++
|
||||
src/cpu/cpu_x86_data.h | 1 +
|
||||
src/qemu/qemu_command.c | 1 +
|
||||
src/qemu/qemu_parse_command.c | 1 +
|
||||
src/qemu/qemu_process.c | 1 +
|
||||
tests/qemuxml2argvdata/hyperv-off.xml | 1 +
|
||||
tests/qemuxml2argvdata/hyperv.args | 3 ++-
|
||||
tests/qemuxml2argvdata/hyperv.xml | 1 +
|
||||
tests/qemuxml2xmloutdata/hyperv-off.xml | 1 +
|
||||
tests/qemuxml2xmloutdata/hyperv.xml | 1 +
|
||||
14 files changed, 31 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
|
||||
index 3b493a98ac..43a1067501 100644
|
||||
--- a/docs/formatdomain.html.in
|
||||
+++ b/docs/formatdomain.html.in
|
||||
@@ -1916,6 +1916,7 @@
|
||||
<reset state='on'/>
|
||||
<vendor_id state='on' value='KVM Hv'/>
|
||||
<frequencies state='on'/>
|
||||
+ <reenlightenment state='on'/>
|
||||
</hyperv>
|
||||
<kvm>
|
||||
<hidden state='on'/>
|
||||
@@ -2044,6 +2045,12 @@
|
||||
<td> on, off</td>
|
||||
<td><span class="since">4.7.0 (QEMU 2.12)</span></td>
|
||||
</tr>
|
||||
+ <tr>
|
||||
+ <td>reenlightenment</td>
|
||||
+ <td>Enable re-enlightenment notification on migration</td>
|
||||
+ <td> on, off</td>
|
||||
+ <td><span class="since">4.7.0 (QEMU 3.0)</span></td>
|
||||
+ </tr>
|
||||
</table>
|
||||
</dd>
|
||||
<dt><code>pvspinlock</code></dt>
|
||||
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
|
||||
index f156a6b7c4..ceee7a8efe 100644
|
||||
--- a/docs/schemas/domaincommon.rng
|
||||
+++ b/docs/schemas/domaincommon.rng
|
||||
@@ -5718,6 +5718,11 @@
|
||||
<ref name="featurestate"/>
|
||||
</element>
|
||||
</optional>
|
||||
+ <optional>
|
||||
+ <element name="reenlightenment">
|
||||
+ <ref name="featurestate"/>
|
||||
+ </element>
|
||||
+ </optional>
|
||||
</interleave>
|
||||
</element>
|
||||
</define>
|
||||
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
||||
index 150dd8acc8..18b4d03a61 100644
|
||||
--- a/src/conf/domain_conf.c
|
||||
+++ b/src/conf/domain_conf.c
|
||||
@@ -170,7 +170,8 @@ VIR_ENUM_IMPL(virDomainHyperv, VIR_DOMAIN_HYPERV_LAST,
|
||||
"stimer",
|
||||
"reset",
|
||||
"vendor_id",
|
||||
- "frequencies")
|
||||
+ "frequencies",
|
||||
+ "reenlightenment")
|
||||
|
||||
VIR_ENUM_IMPL(virDomainKVM, VIR_DOMAIN_KVM_LAST,
|
||||
"hidden")
|
||||
@@ -20053,6 +20054,7 @@ virDomainDefParseXML(xmlDocPtr xml,
|
||||
case VIR_DOMAIN_HYPERV_STIMER:
|
||||
case VIR_DOMAIN_HYPERV_RESET:
|
||||
case VIR_DOMAIN_HYPERV_FREQUENCIES:
|
||||
+ case VIR_DOMAIN_HYPERV_REENLIGHTENMENT:
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_HYPERV_SPINLOCKS:
|
||||
@@ -22245,6 +22247,7 @@ virDomainDefFeaturesCheckABIStability(virDomainDefPtr src,
|
||||
case VIR_DOMAIN_HYPERV_STIMER:
|
||||
case VIR_DOMAIN_HYPERV_RESET:
|
||||
case VIR_DOMAIN_HYPERV_FREQUENCIES:
|
||||
+ case VIR_DOMAIN_HYPERV_REENLIGHTENMENT:
|
||||
if (src->hyperv_features[i] != dst->hyperv_features[i]) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("State of HyperV enlightenment "
|
||||
@@ -27894,6 +27897,7 @@ virDomainDefFormatInternal(virDomainDefPtr def,
|
||||
case VIR_DOMAIN_HYPERV_STIMER:
|
||||
case VIR_DOMAIN_HYPERV_RESET:
|
||||
case VIR_DOMAIN_HYPERV_FREQUENCIES:
|
||||
+ case VIR_DOMAIN_HYPERV_REENLIGHTENMENT:
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_HYPERV_SPINLOCKS:
|
||||
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
|
||||
index 97d38ff7b9..e450923019 100644
|
||||
--- a/src/conf/domain_conf.h
|
||||
+++ b/src/conf/domain_conf.h
|
||||
@@ -1792,6 +1792,7 @@ typedef enum {
|
||||
VIR_DOMAIN_HYPERV_RESET,
|
||||
VIR_DOMAIN_HYPERV_VENDOR_ID,
|
||||
VIR_DOMAIN_HYPERV_FREQUENCIES,
|
||||
+ VIR_DOMAIN_HYPERV_REENLIGHTENMENT,
|
||||
|
||||
VIR_DOMAIN_HYPERV_LAST
|
||||
} virDomainHyperv;
|
||||
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
|
||||
index a2fbfb577d..7a48b78eb9 100644
|
||||
--- a/src/cpu/cpu_x86.c
|
||||
+++ b/src/cpu/cpu_x86.c
|
||||
@@ -111,6 +111,8 @@ KVM_FEATURE_DEF(VIR_CPU_x86_KVM_HV_RESET,
|
||||
0x40000003, 0x00000080);
|
||||
KVM_FEATURE_DEF(VIR_CPU_x86_KVM_HV_FREQUENCIES,
|
||||
0x40000003, 0x00000800);
|
||||
+KVM_FEATURE_DEF(VIR_CPU_x86_KVM_HV_REENLIGHTENMENT,
|
||||
+ 0x40000003, 0x00002000);
|
||||
|
||||
static virCPUx86Feature x86_kvm_features[] =
|
||||
{
|
||||
@@ -132,6 +134,7 @@ static virCPUx86Feature x86_kvm_features[] =
|
||||
KVM_FEATURE(VIR_CPU_x86_KVM_HV_VPINDEX),
|
||||
KVM_FEATURE(VIR_CPU_x86_KVM_HV_RESET),
|
||||
KVM_FEATURE(VIR_CPU_x86_KVM_HV_FREQUENCIES),
|
||||
+ KVM_FEATURE(VIR_CPU_x86_KVM_HV_REENLIGHTENMENT),
|
||||
};
|
||||
|
||||
typedef struct _virCPUx86Model virCPUx86Model;
|
||||
diff --git a/src/cpu/cpu_x86_data.h b/src/cpu/cpu_x86_data.h
|
||||
index c01eb41be5..a810c64fc9 100644
|
||||
--- a/src/cpu/cpu_x86_data.h
|
||||
+++ b/src/cpu/cpu_x86_data.h
|
||||
@@ -64,6 +64,7 @@ struct _virCPUx86CPUID {
|
||||
# define VIR_CPU_x86_KVM_HV_VPINDEX "__kvm_hv_vpindex"
|
||||
# define VIR_CPU_x86_KVM_HV_RESET "__kvm_hv_reset"
|
||||
# define VIR_CPU_x86_KVM_HV_FREQUENCIES "__kvm_hv_frequencies"
|
||||
+# define VIR_CPU_x86_KVM_HV_REENLIGHTENMENT "__kvm_hv_reenlightenment"
|
||||
|
||||
|
||||
# define VIR_CPU_X86_DATA_INIT { 0 }
|
||||
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
|
||||
index 82c349819e..48f3b09ec9 100644
|
||||
--- a/src/qemu/qemu_command.c
|
||||
+++ b/src/qemu/qemu_command.c
|
||||
@@ -6920,6 +6920,7 @@ qemuBuildCpuCommandLine(virCommandPtr cmd,
|
||||
case VIR_DOMAIN_HYPERV_STIMER:
|
||||
case VIR_DOMAIN_HYPERV_RESET:
|
||||
case VIR_DOMAIN_HYPERV_FREQUENCIES:
|
||||
+ case VIR_DOMAIN_HYPERV_REENLIGHTENMENT:
|
||||
if (def->hyperv_features[i] == VIR_TRISTATE_SWITCH_ON)
|
||||
virBufferAsprintf(&buf, ",hv_%s",
|
||||
virDomainHypervTypeToString(i));
|
||||
diff --git a/src/qemu/qemu_parse_command.c b/src/qemu/qemu_parse_command.c
|
||||
index ffea9a26bd..1e67a5a8c8 100644
|
||||
--- a/src/qemu/qemu_parse_command.c
|
||||
+++ b/src/qemu/qemu_parse_command.c
|
||||
@@ -1537,6 +1537,7 @@ qemuParseCommandLineCPU(virDomainDefPtr dom,
|
||||
case VIR_DOMAIN_HYPERV_STIMER:
|
||||
case VIR_DOMAIN_HYPERV_RESET:
|
||||
case VIR_DOMAIN_HYPERV_FREQUENCIES:
|
||||
+ case VIR_DOMAIN_HYPERV_REENLIGHTENMENT:
|
||||
if (value) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("HyperV feature '%s' should not "
|
||||
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
|
||||
index dd92a6c179..990d4d3046 100644
|
||||
--- a/src/qemu/qemu_process.c
|
||||
+++ b/src/qemu/qemu_process.c
|
||||
@@ -3924,6 +3924,7 @@ qemuProcessVerifyHypervFeatures(virDomainDefPtr def,
|
||||
case VIR_DOMAIN_HYPERV_STIMER:
|
||||
case VIR_DOMAIN_HYPERV_RESET:
|
||||
case VIR_DOMAIN_HYPERV_FREQUENCIES:
|
||||
+ case VIR_DOMAIN_HYPERV_REENLIGHTENMENT:
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("host doesn't support hyperv '%s' feature"),
|
||||
virDomainHypervTypeToString(i));
|
||||
diff --git a/tests/qemuxml2argvdata/hyperv-off.xml b/tests/qemuxml2argvdata/hyperv-off.xml
|
||||
index d3a8455ac3..b2e3612df9 100644
|
||||
--- a/tests/qemuxml2argvdata/hyperv-off.xml
|
||||
+++ b/tests/qemuxml2argvdata/hyperv-off.xml
|
||||
@@ -21,6 +21,7 @@
|
||||
<reset state='off'/>
|
||||
<vendor_id state='off'/>
|
||||
<frequencies state='off'/>
|
||||
+ <reenlightenment state='off'/>
|
||||
</hyperv>
|
||||
</features>
|
||||
<clock offset='utc'/>
|
||||
diff --git a/tests/qemuxml2argvdata/hyperv.args b/tests/qemuxml2argvdata/hyperv.args
|
||||
index 53026bb2d5..4feafad8e2 100644
|
||||
--- a/tests/qemuxml2argvdata/hyperv.args
|
||||
+++ b/tests/qemuxml2argvdata/hyperv.args
|
||||
@@ -9,7 +9,8 @@ QEMU_AUDIO_DRV=none \
|
||||
-S \
|
||||
-machine pc,accel=tcg,usb=off,dump-guest-core=off \
|
||||
-cpu 'qemu32,hv_relaxed,hv_vapic,hv_spinlocks=0x2fff,hv_vpindex,hv_runtime,\
|
||||
-hv_synic,hv_stimer,hv_reset,hv_vendor_id=KVM Hv,hv_frequencies' \
|
||||
+hv_synic,hv_stimer,hv_reset,hv_vendor_id=KVM Hv,hv_frequencies,\
|
||||
+hv_reenlightenment' \
|
||||
-m 214 \
|
||||
-smp 6,sockets=6,cores=1,threads=1 \
|
||||
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
|
||||
diff --git a/tests/qemuxml2argvdata/hyperv.xml b/tests/qemuxml2argvdata/hyperv.xml
|
||||
index 27372d1636..20fcdba59e 100644
|
||||
--- a/tests/qemuxml2argvdata/hyperv.xml
|
||||
+++ b/tests/qemuxml2argvdata/hyperv.xml
|
||||
@@ -21,6 +21,7 @@
|
||||
<reset state='on'/>
|
||||
<vendor_id state='on' value='KVM Hv'/>
|
||||
<frequencies state='on'/>
|
||||
+ <reenlightenment state='on'/>
|
||||
</hyperv>
|
||||
</features>
|
||||
<clock offset='utc'/>
|
||||
diff --git a/tests/qemuxml2xmloutdata/hyperv-off.xml b/tests/qemuxml2xmloutdata/hyperv-off.xml
|
||||
index 3ba0b827c3..4a41e0c37e 100644
|
||||
--- a/tests/qemuxml2xmloutdata/hyperv-off.xml
|
||||
+++ b/tests/qemuxml2xmloutdata/hyperv-off.xml
|
||||
@@ -21,6 +21,7 @@
|
||||
<reset state='off'/>
|
||||
<vendor_id state='off'/>
|
||||
<frequencies state='off'/>
|
||||
+ <reenlightenment state='off'/>
|
||||
</hyperv>
|
||||
</features>
|
||||
<clock offset='utc'/>
|
||||
diff --git a/tests/qemuxml2xmloutdata/hyperv.xml b/tests/qemuxml2xmloutdata/hyperv.xml
|
||||
index 1e47a946d6..183b45980b 100644
|
||||
--- a/tests/qemuxml2xmloutdata/hyperv.xml
|
||||
+++ b/tests/qemuxml2xmloutdata/hyperv.xml
|
||||
@@ -21,6 +21,7 @@
|
||||
<reset state='on'/>
|
||||
<vendor_id state='on' value='KVM Hv'/>
|
||||
<frequencies state='on'/>
|
||||
+ <reenlightenment state='on'/>
|
||||
</hyperv>
|
||||
</features>
|
||||
<clock offset='utc'/>
|
||||
--
|
||||
2.19.1
|
||||
|
@ -0,0 +1,154 @@
|
||||
From 2566a32fae64fa5cc8a3d3c30778d0ea7d8c4faa Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <2566a32fae64fa5cc8a3d3c30778d0ea7d8c4faa@dist-git>
|
||||
From: Yi Min Zhao <zyimin@linux.ibm.com>
|
||||
Date: Mon, 8 Apr 2019 10:57:24 +0200
|
||||
Subject: [PATCH] conf: use virXMLFormatElement() in
|
||||
virDomainDeviceInfoFormat()
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
In order to add zPCI child element for PCI address, we update
|
||||
virDomainDeviceInfoFormat() to format device info by helper function
|
||||
virXMLFormatElement(). Then we could simply format zPCI address into
|
||||
child buffer later.
|
||||
|
||||
Signed-off-by: Yi Min Zhao <zyimin@linux.ibm.com>
|
||||
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
||||
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
|
||||
|
||||
(cherry picked from commit 0d6b87335c00451b0923ecc91d617f71e4135bf8)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1508149
|
||||
|
||||
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
|
||||
Message-Id: <20190408085732.28684-8-abologna@redhat.com>
|
||||
Reviewed-by: Laine Stump <laine@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
src/conf/domain_conf.c | 40 ++++++++++++++++++++++------------------
|
||||
1 file changed, 22 insertions(+), 18 deletions(-)
|
||||
|
||||
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
||||
index e62f78471c..bcb0558bc3 100644
|
||||
--- a/src/conf/domain_conf.c
|
||||
+++ b/src/conf/domain_conf.c
|
||||
@@ -6447,6 +6447,8 @@ virDomainDeviceInfoFormat(virBufferPtr buf,
|
||||
virDomainDeviceInfoPtr info,
|
||||
unsigned int flags)
|
||||
{
|
||||
+ virBuffer attrBuf = VIR_BUFFER_INITIALIZER;
|
||||
+
|
||||
if ((flags & VIR_DOMAIN_DEF_FORMAT_ALLOW_BOOT) && info->bootIndex) {
|
||||
virBufferAsprintf(buf, "<boot order='%u'", info->bootIndex);
|
||||
|
||||
@@ -6491,13 +6493,13 @@ virDomainDeviceInfoFormat(virBufferPtr buf,
|
||||
info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390)
|
||||
return;
|
||||
|
||||
- virBufferAsprintf(buf, "<address type='%s'",
|
||||
+ virBufferAsprintf(&attrBuf, " type='%s'",
|
||||
virDomainDeviceAddressTypeToString(info->type));
|
||||
|
||||
switch ((virDomainDeviceAddressType) info->type) {
|
||||
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI:
|
||||
if (!virPCIDeviceAddressIsEmpty(&info->addr.pci)) {
|
||||
- virBufferAsprintf(buf, " domain='0x%.4x' bus='0x%.2x' "
|
||||
+ virBufferAsprintf(&attrBuf, " domain='0x%.4x' bus='0x%.2x' "
|
||||
"slot='0x%.2x' function='0x%.1x'",
|
||||
info->addr.pci.domain,
|
||||
info->addr.pci.bus,
|
||||
@@ -6505,13 +6507,13 @@ virDomainDeviceInfoFormat(virBufferPtr buf,
|
||||
info->addr.pci.function);
|
||||
}
|
||||
if (info->addr.pci.multi) {
|
||||
- virBufferAsprintf(buf, " multifunction='%s'",
|
||||
- virTristateSwitchTypeToString(info->addr.pci.multi));
|
||||
+ virBufferAsprintf(&attrBuf, " multifunction='%s'",
|
||||
+ virTristateSwitchTypeToString(info->addr.pci.multi));
|
||||
}
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE:
|
||||
- virBufferAsprintf(buf, " controller='%d' bus='%d' target='%d' unit='%d'",
|
||||
+ virBufferAsprintf(&attrBuf, " controller='%d' bus='%d' target='%d' unit='%d'",
|
||||
info->addr.drive.controller,
|
||||
info->addr.drive.bus,
|
||||
info->addr.drive.target,
|
||||
@@ -6519,34 +6521,34 @@ virDomainDeviceInfoFormat(virBufferPtr buf,
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_SERIAL:
|
||||
- virBufferAsprintf(buf, " controller='%d' bus='%d' port='%d'",
|
||||
+ virBufferAsprintf(&attrBuf, " controller='%d' bus='%d' port='%d'",
|
||||
info->addr.vioserial.controller,
|
||||
info->addr.vioserial.bus,
|
||||
info->addr.vioserial.port);
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCID:
|
||||
- virBufferAsprintf(buf, " controller='%d' slot='%d'",
|
||||
+ virBufferAsprintf(&attrBuf, " controller='%d' slot='%d'",
|
||||
info->addr.ccid.controller,
|
||||
info->addr.ccid.slot);
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_USB:
|
||||
- virBufferAsprintf(buf, " bus='%d'", info->addr.usb.bus);
|
||||
+ virBufferAsprintf(&attrBuf, " bus='%d'", info->addr.usb.bus);
|
||||
if (virDomainUSBAddressPortIsValid(info->addr.usb.port)) {
|
||||
- virBufferAddLit(buf, " port='");
|
||||
- virDomainUSBAddressPortFormatBuf(buf, info->addr.usb.port);
|
||||
- virBufferAddLit(buf, "'");
|
||||
+ virBufferAddLit(&attrBuf, " port='");
|
||||
+ virDomainUSBAddressPortFormatBuf(&attrBuf, info->addr.usb.port);
|
||||
+ virBufferAddLit(&attrBuf, "'");
|
||||
}
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO:
|
||||
if (info->addr.spaprvio.has_reg)
|
||||
- virBufferAsprintf(buf, " reg='0x%llx'", info->addr.spaprvio.reg);
|
||||
+ virBufferAsprintf(&attrBuf, " reg='0x%llx'", info->addr.spaprvio.reg);
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW:
|
||||
- virBufferAsprintf(buf, " cssid='0x%x' ssid='0x%x' devno='0x%04x'",
|
||||
+ virBufferAsprintf(&attrBuf, " cssid='0x%x' ssid='0x%x' devno='0x%04x'",
|
||||
info->addr.ccw.cssid,
|
||||
info->addr.ccw.ssid,
|
||||
info->addr.ccw.devno);
|
||||
@@ -6557,15 +6559,15 @@ virDomainDeviceInfoFormat(virBufferPtr buf,
|
||||
|
||||
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_ISA:
|
||||
if (info->addr.isa.iobase > 0)
|
||||
- virBufferAsprintf(buf, " iobase='0x%x'", info->addr.isa.iobase);
|
||||
+ virBufferAsprintf(&attrBuf, " iobase='0x%x'", info->addr.isa.iobase);
|
||||
if (info->addr.isa.irq > 0)
|
||||
- virBufferAsprintf(buf, " irq='0x%x'", info->addr.isa.irq);
|
||||
+ virBufferAsprintf(&attrBuf, " irq='0x%x'", info->addr.isa.irq);
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DIMM:
|
||||
- virBufferAsprintf(buf, " slot='%u'", info->addr.dimm.slot);
|
||||
+ virBufferAsprintf(&attrBuf, " slot='%u'", info->addr.dimm.slot);
|
||||
if (info->addr.dimm.base)
|
||||
- virBufferAsprintf(buf, " base='0x%llx'", info->addr.dimm.base);
|
||||
+ virBufferAsprintf(&attrBuf, " base='0x%llx'", info->addr.dimm.base);
|
||||
|
||||
break;
|
||||
|
||||
@@ -6575,7 +6577,9 @@ virDomainDeviceInfoFormat(virBufferPtr buf,
|
||||
break;
|
||||
}
|
||||
|
||||
- virBufferAddLit(buf, "/>\n");
|
||||
+ virXMLFormatElement(buf, "address", &attrBuf, NULL);
|
||||
+
|
||||
+ virBufferFreeAndReset(&attrBuf);
|
||||
}
|
||||
|
||||
static int
|
||||
--
|
||||
2.22.0
|
||||
|
@ -0,0 +1,110 @@
|
||||
From 5b3cf2163da13ac79129ca2bb85ae1908922644c Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <5b3cf2163da13ac79129ca2bb85ae1908922644c@dist-git>
|
||||
From: Laine Stump <laine@laine.org>
|
||||
Date: Fri, 1 Feb 2019 20:29:27 -0500
|
||||
Subject: [PATCH] configure: change HAVE_FIREWALLD to WITH_FIREWALLD
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Support for firewalld is a feature that can be selectively enabled or
|
||||
disabled (using --with-firewalld/--without-firewalld), not merely
|
||||
something that must be accounted for in the code if it is present with
|
||||
no exceptions. It is more consistent with other usage in libvirt to
|
||||
use WITH_FIREWALLD rather than HAVE_FIREWALLD.
|
||||
|
||||
Signed-off-by: Laine Stump <laine@laine.org>
|
||||
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||
(cherry picked from commit 4bf0f390ed57307050a213f3f6364061f2717b00)
|
||||
|
||||
https://bugzilla.redhat.com/1650320
|
||||
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
m4/virt-firewalld.m4 | 4 ++--
|
||||
src/network/bridge_driver.c | 6 +++---
|
||||
src/nwfilter/nwfilter_driver.c | 6 +++---
|
||||
3 files changed, 8 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/m4/virt-firewalld.m4 b/m4/virt-firewalld.m4
|
||||
index 08d2ff83d6..89efa47589 100644
|
||||
--- a/m4/virt-firewalld.m4
|
||||
+++ b/m4/virt-firewalld.m4
|
||||
@@ -32,10 +32,10 @@ AC_DEFUN([LIBVIRT_CHECK_FIREWALLD], [
|
||||
if test "x$with_dbus" != "xyes" ; then
|
||||
AC_MSG_ERROR([You must have dbus enabled for firewalld support])
|
||||
fi
|
||||
- AC_DEFINE_UNQUOTED([HAVE_FIREWALLD], [1], [whether firewalld support is enabled])
|
||||
+ AC_DEFINE_UNQUOTED([WITH_FIREWALLD], [1], [whether firewalld support is enabled])
|
||||
fi
|
||||
|
||||
- AM_CONDITIONAL([HAVE_FIREWALLD], [test "x$with_firewalld" != "xno"])
|
||||
+ AM_CONDITIONAL([WITH_FIREWALLD], [test "x$with_firewalld" != "xno"])
|
||||
])
|
||||
|
||||
AC_DEFUN([LIBVIRT_RESULT_FIREWALLD], [
|
||||
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
|
||||
index 1ad95d524c..d153a8cdb6 100644
|
||||
--- a/src/network/bridge_driver.c
|
||||
+++ b/src/network/bridge_driver.c
|
||||
@@ -538,7 +538,7 @@ networkAutostartConfig(virNetworkObjPtr obj,
|
||||
}
|
||||
|
||||
|
||||
-#if HAVE_FIREWALLD
|
||||
+#ifdef WITH_FIREWALLD
|
||||
static DBusHandlerResult
|
||||
firewalld_dbus_filter_bridge(DBusConnection *connection ATTRIBUTE_UNUSED,
|
||||
DBusMessage *message,
|
||||
@@ -659,7 +659,7 @@ networkStateInitialize(bool privileged,
|
||||
int ret = -1;
|
||||
char *configdir = NULL;
|
||||
char *rundir = NULL;
|
||||
-#ifdef HAVE_FIREWALLD
|
||||
+#ifdef WITH_FIREWALLD
|
||||
DBusConnection *sysbus = NULL;
|
||||
#endif
|
||||
|
||||
@@ -757,7 +757,7 @@ networkStateInitialize(bool privileged,
|
||||
|
||||
network_driver->networkEventState = virObjectEventStateNew();
|
||||
|
||||
-#ifdef HAVE_FIREWALLD
|
||||
+#ifdef WITH_FIREWALLD
|
||||
if (!(sysbus = virDBusGetSystemBus())) {
|
||||
VIR_WARN("DBus not available, disabling firewalld support "
|
||||
"in bridge_network_driver: %s", virGetLastErrorMessage());
|
||||
diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c
|
||||
index ed34586105..a657b750e6 100644
|
||||
--- a/src/nwfilter/nwfilter_driver.c
|
||||
+++ b/src/nwfilter/nwfilter_driver.c
|
||||
@@ -79,7 +79,7 @@ static void nwfilterDriverUnlock(void)
|
||||
virMutexUnlock(&driver->lock);
|
||||
}
|
||||
|
||||
-#if HAVE_FIREWALLD
|
||||
+#ifdef WITH_FIREWALLD
|
||||
|
||||
static DBusHandlerResult
|
||||
nwfilterFirewalldDBusFilter(DBusConnection *connection ATTRIBUTE_UNUSED,
|
||||
@@ -148,7 +148,7 @@ nwfilterDriverInstallDBusMatches(DBusConnection *sysbus)
|
||||
return ret;
|
||||
}
|
||||
|
||||
-#else /* HAVE_FIREWALLD */
|
||||
+#else /* WITH_FIREWALLD */
|
||||
|
||||
static void
|
||||
nwfilterDriverRemoveDBusMatches(void)
|
||||
@@ -161,7 +161,7 @@ nwfilterDriverInstallDBusMatches(DBusConnection *sysbus ATTRIBUTE_UNUSED)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-#endif /* HAVE_FIREWALLD */
|
||||
+#endif /* WITH_FIREWALLD */
|
||||
|
||||
static int
|
||||
virNWFilterTriggerRebuildImpl(void *opaque)
|
||||
--
|
||||
2.20.1
|
||||
|
@ -0,0 +1,280 @@
|
||||
From f89135129d722dca4e5eb7dbcc6845ab757f2e08 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <f89135129d722dca4e5eb7dbcc6845ab757f2e08@dist-git>
|
||||
From: Laine Stump <laine@laine.org>
|
||||
Date: Fri, 1 Feb 2019 20:29:30 -0500
|
||||
Subject: [PATCH] configure: selectively install a firewalld 'libvirt' zone
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
In the past (when both libvirt and firewalld used iptables), if either
|
||||
libvirt's rules *OR* firewalld's rules accepted a packet, it would
|
||||
be accepted. This was because libvirt and firewalld rules were
|
||||
processed during the same kernel hook, and a single ACCEPT result
|
||||
would terminate the rule traversal and cause the packet to be
|
||||
accepted.
|
||||
|
||||
But now firewalld can use nftables for its backend, while libvirt's
|
||||
firewall rules are still using iptables; iptables rules are still
|
||||
processed, but at a different time during packet processing
|
||||
(i.e. during a different hook) than the firewalld nftables rules. The
|
||||
result is that a packet must be accepted by *BOTH* the libvirt
|
||||
iptables rules *AND* the firewalld nftable rules in order to be
|
||||
accepted.
|
||||
|
||||
This causes pain because
|
||||
|
||||
1) libvirt always adds rules to permit DNS and DHCP (and sometimes
|
||||
TFTP) from guests to the host network's bridge interface. But
|
||||
libvirt's bridges are in firewalld's "default" zone (which is usually
|
||||
the zone called "public"). The public zone allows ssh, but doesn't
|
||||
allow DNS, DHCP, or TFTP. So even though libvirt's rules allow the
|
||||
DHCP and DNS traffic, the firewalld rules (now processed during a
|
||||
different hook) dont, thus guests connected to libvirt's bridges can't
|
||||
acquire an IP address from DHCP, nor can they make DNS queries to the
|
||||
DNS server libvirt has setup on the host. (This could be solved by
|
||||
modifying the default firewalld zone to allow DNS and DHCP, but that
|
||||
would open *all* interfaces in the default zone to those services,
|
||||
which is most likely not what the host's admin wants.)
|
||||
|
||||
2) Even though libvirt adds iptables rules to allow forwarded traffic
|
||||
to pass the iptables hook, firewalld's higher level "rich rules" don't
|
||||
yet have the ability to configure the acceptance of forwarded traffic
|
||||
(traffic that is going somewhere beyond the host), so any traffic that
|
||||
needs to be forwarded from guests to the network beyond the host is
|
||||
rejected during the nftables hook by the default zone's "default
|
||||
reject" policy (which rejects all traffic in the zone not specifically
|
||||
allowed by the rules in the zone, whether that traffic is destined to
|
||||
be forwarded or locally received by the host).
|
||||
|
||||
libvirt can't send "direct" nftables rules (firewalld only supports
|
||||
direct/passthrough rules for iptables), so we can't solve this problem
|
||||
by just sending explicit nftables rules instead of explicit iptables
|
||||
rules (which, if it could be done, would place libvirt's rules in the
|
||||
same hook as firewalld's native rules, and thus eliminate the need for
|
||||
packets to be accepted by both libvirt's and firewalld's own rules).
|
||||
|
||||
However, we can take advantage of a quirk in firewalld zones that have
|
||||
a default policy of "accept" (meaning any packet that doesn't match a
|
||||
specific rule in the zone will be *accepted*) - this default accept will
|
||||
also accept forwarded traffic (not just traffic destined for the host).
|
||||
|
||||
Of course we don't want to modify firewalld's default zone in that
|
||||
way, because that would affect the filtering of traffic coming into
|
||||
the host from other interfaces using that zone. Instead, we will
|
||||
create a new zone called "libvirt". The libvirt zone will have a
|
||||
default policy of accept so that forwarded traffic can pass and list
|
||||
specific services that will be allowed into the host from guests (DNS,
|
||||
DHCP, SSH, and TFTP).
|
||||
|
||||
But the same default accept policy that fixes forwarded traffic also
|
||||
causes *all* traffic from guest to host to be accepted. To close this
|
||||
new hole, the libvirt zone can take advantage of a new feature in
|
||||
firewalld (currently slated for firewalld-0.7.0) - priorities for rich
|
||||
rules - to add a low priority rule that rejects all local traffic (but
|
||||
leaves alone all forwarded traffic).
|
||||
|
||||
So, our new zone will start with a list of services that are allowed
|
||||
(dhcp, dns, tftp, and ssh to start, but configurable via any firewalld
|
||||
management application, or direct editing of the zone file in
|
||||
/etc/firewalld/zones/libvirt.xml), followed by a low priority
|
||||
<reject/> rule (to reject all other traffic from guest to host), and
|
||||
finally with a default policy of accept (to allow forwarded traffic).
|
||||
|
||||
This patch only creates the zonefile for the new zone, and implements
|
||||
a configure.ac option to selectively enable/disable installation of
|
||||
the new zone. A separate patch contains the necessary code to actually
|
||||
place bridge interfaces in the libvirt zone.
|
||||
|
||||
Why do we need a configure option to disable installation of the new
|
||||
libvirt zone? It uses a new firewalld attribute that sets the priority
|
||||
of a rich rule; this feature first appears in firewalld-0.7.0 (unless
|
||||
it has been backported to am earlier firewalld by a downstream
|
||||
maintainer). If the file were installed on a system with firewalld
|
||||
that didn't support rule priorities, firewalld would log an error
|
||||
every time it restarted, causing confusion and lots of extra bug
|
||||
reports.
|
||||
|
||||
So we add two new configure.ac switches to avoid polluting the system
|
||||
logs with this error on systems that don't support rule priorities -
|
||||
"--with-firewalld-zone" and "--without-firewalld-zone". A package
|
||||
builder can use these to include/exclude the libvirt zone file in the
|
||||
installation. If firewalld is enabled (--with-firewalld), the default
|
||||
is --with-firewalld-zone, but it can be disabled during configure
|
||||
(using --without-firewalld-zone). Targets that are using a firewalld
|
||||
version too old to support the rule priority setting in the libvirt
|
||||
zone file can simply add --without-firewalld-zone to their configure
|
||||
commandline.
|
||||
|
||||
These switches only affect whether or not the libvirt zone file is
|
||||
*installed* in /usr/lib/firewalld/zones, but have no effect on whether
|
||||
or not libvirt looks for a zone called libvirt and tries to use it.
|
||||
|
||||
NB: firewalld zones can only be added to the permanent config of
|
||||
firewalld, and won't be loaded/enabled until firewalld is restarted,
|
||||
so at package install/upgrade time we have to restart firewalld. For
|
||||
rpm-based distros, this is done in the libvirt.spec file by calling
|
||||
the %firewalld_restart rpm macro, which is a part of the
|
||||
firewalld-filesystem package. (For distros that don't use rpm
|
||||
packages, the command "firewalld-cmd --reload" will have the same
|
||||
effect).
|
||||
|
||||
Signed-off-by: Laine Stump <laine@laine.org>
|
||||
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||
(cherry picked from commit 3b71f2e42dc6c5453d09136578bfb868874da088)
|
||||
|
||||
https://bugzilla.redhat.com/1650320
|
||||
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
configure.ac | 3 +++
|
||||
libvirt.spec.in | 31 +++++++++++++++++++++++++
|
||||
m4/virt-firewalld-zone.m4 | 45 +++++++++++++++++++++++++++++++++++++
|
||||
src/network/Makefile.inc.am | 10 ++++++++-
|
||||
src/network/libvirt.zone | 23 +++++++++++++++++++
|
||||
5 files changed, 111 insertions(+), 1 deletion(-)
|
||||
create mode 100644 m4/virt-firewalld-zone.m4
|
||||
create mode 100644 src/network/libvirt.zone
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index e25bf0a6ec..3da26484d0 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -247,6 +247,7 @@ LIBVIRT_ARG_CAPNG
|
||||
LIBVIRT_ARG_CURL
|
||||
LIBVIRT_ARG_DBUS
|
||||
LIBVIRT_ARG_FIREWALLD
|
||||
+LIBVIRT_ARG_FIREWALLD_ZONE
|
||||
LIBVIRT_ARG_FUSE
|
||||
LIBVIRT_ARG_GLUSTER
|
||||
LIBVIRT_ARG_HAL
|
||||
@@ -286,6 +287,7 @@ LIBVIRT_CHECK_DBUS
|
||||
LIBVIRT_CHECK_DEVMAPPER
|
||||
LIBVIRT_CHECK_DLOPEN
|
||||
LIBVIRT_CHECK_FIREWALLD
|
||||
+LIBVIRT_CHECK_FIREWALLD_ZONE
|
||||
LIBVIRT_CHECK_FUSE
|
||||
LIBVIRT_CHECK_GLUSTER
|
||||
LIBVIRT_CHECK_GNUTLS
|
||||
@@ -959,6 +961,7 @@ LIBVIRT_RESULT_CURL
|
||||
LIBVIRT_RESULT_DBUS
|
||||
LIBVIRT_RESULT_DLOPEN
|
||||
LIBVIRT_RESULT_FIREWALLD
|
||||
+LIBVIRT_RESULT_FIREWALLD_ZONE
|
||||
LIBVIRT_RESULT_FUSE
|
||||
LIBVIRT_RESULT_GLUSTER
|
||||
LIBVIRT_RESULT_GNUTLS
|
||||
diff --git a/m4/virt-firewalld-zone.m4 b/m4/virt-firewalld-zone.m4
|
||||
new file mode 100644
|
||||
index 0000000000..b67d1a0b2f
|
||||
--- /dev/null
|
||||
+++ b/m4/virt-firewalld-zone.m4
|
||||
@@ -0,0 +1,45 @@
|
||||
+dnl firewalld_zone check - whether or not to install the firewall "libvirt" zone
|
||||
+dnl
|
||||
+dnl Copyright (C) 2019 Red Hat, Inc.
|
||||
+dnl
|
||||
+dnl This library is free software; you can redistribute it and/or
|
||||
+dnl modify it under the terms of the GNU Lesser General Public
|
||||
+dnl License as published by the Free Software Foundation; either
|
||||
+dnl version 2.1 of the License, or (at your option) any later version.
|
||||
+dnl
|
||||
+dnl This library is distributed in the hope that it will be useful,
|
||||
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+dnl Lesser General Public License for more details.
|
||||
+dnl
|
||||
+dnl You should have received a copy of the GNU Lesser General Public
|
||||
+dnl License along with this library. If not, see
|
||||
+dnl <http://www.gnu.org/licenses/>.
|
||||
+dnl
|
||||
+
|
||||
+AC_DEFUN([LIBVIRT_ARG_FIREWALLD_ZONE], [
|
||||
+ LIBVIRT_ARG_WITH([FIREWALLD_ZONE], [Whether to install firewalld libvirt zone], [check])
|
||||
+])
|
||||
+
|
||||
+AC_DEFUN([LIBVIRT_CHECK_FIREWALLD_ZONE], [
|
||||
+ AC_REQUIRE([LIBVIRT_CHECK_FIREWALLD])
|
||||
+ AC_MSG_CHECKING([for whether to install firewalld libvirt zone])
|
||||
+
|
||||
+ if test "x$with_firewalld_zone" = "xcheck" ; then
|
||||
+ with_firewalld_zone=$with_firewalld
|
||||
+ fi
|
||||
+
|
||||
+ if test "x$with_firewalld_zone" = "xyes" ; then
|
||||
+ if test "x$with_firewalld" != "xyes" ; then
|
||||
+ AC_MSG_ERROR([You must have firewalld support enabled to enable firewalld-zone])
|
||||
+ fi
|
||||
+ AC_DEFINE_UNQUOTED([WITH_FIREWALLD_ZONE], [1], [whether firewalld libvirt zone is installed])
|
||||
+ fi
|
||||
+
|
||||
+ AM_CONDITIONAL([WITH_FIREWALLD_ZONE], [test "x$with_firewalld_zone" != "xno"])
|
||||
+ AC_MSG_RESULT($with_firewalld_zone)
|
||||
+])
|
||||
+
|
||||
+AC_DEFUN([LIBVIRT_RESULT_FIREWALLD_ZONE], [
|
||||
+ LIBVIRT_RESULT([firewalld-zone], [$with_firewalld_zone])
|
||||
+])
|
||||
diff --git a/src/network/Makefile.inc.am b/src/network/Makefile.inc.am
|
||||
index 508c8c0422..cbaaa7ea68 100644
|
||||
--- a/src/network/Makefile.inc.am
|
||||
+++ b/src/network/Makefile.inc.am
|
||||
@@ -87,6 +87,11 @@ install-data-network:
|
||||
( cd $(DESTDIR)$(confdir)/qemu/networks/autostart && \
|
||||
rm -f default.xml && \
|
||||
$(LN_S) ../default.xml default.xml )
|
||||
+if WITH_FIREWALLD_ZONE
|
||||
+ $(MKDIR_P) "$(DESTDIR)$(prefix)/lib/firewalld/zones"
|
||||
+ $(INSTALL_DATA) $(srcdir)/network/libvirt.zone \
|
||||
+ $(DESTDIR)$(prefix)/lib/firewalld/zones/libvirt.xml
|
||||
+endif WITH_FIREWALLD_ZONE
|
||||
|
||||
uninstall-data-network:
|
||||
rm -f $(DESTDIR)$(confdir)/qemu/networks/autostart/default.xml
|
||||
@@ -95,10 +100,13 @@ uninstall-data-network:
|
||||
rmdir "$(DESTDIR)$(confdir)/qemu/networks" || :
|
||||
rmdir "$(DESTDIR)$(localstatedir)/lib/libvirt/network" ||:
|
||||
rmdir "$(DESTDIR)$(localstatedir)/run/libvirt/network" ||:
|
||||
+if WITH_FIREWALLD_ZONE
|
||||
+ rm -f $(DESTDIR)$(prefix)/lib/firewalld/zones/libvirt.xml
|
||||
+endif WITH_FIREWALLD_ZONE
|
||||
|
||||
endif WITH_NETWORK
|
||||
|
||||
-EXTRA_DIST += network/default.xml
|
||||
+EXTRA_DIST += network/default.xml network/libvirt.zone
|
||||
|
||||
.PHONY: \
|
||||
install-data-network \
|
||||
diff --git a/src/network/libvirt.zone b/src/network/libvirt.zone
|
||||
new file mode 100644
|
||||
index 0000000000..bf81db1b6e
|
||||
--- /dev/null
|
||||
+++ b/src/network/libvirt.zone
|
||||
@@ -0,0 +1,23 @@
|
||||
+<?xml version="1.0" encoding="utf-8"?>
|
||||
+<zone target="ACCEPT">
|
||||
+ <short>libvirt</short>
|
||||
+
|
||||
+ <description>
|
||||
+ The default policy of "ACCEPT" allows all packets to/from
|
||||
+ interfaces in the zone to be forwarded, while the (*low priority*)
|
||||
+ reject rule blocks any traffic destined for the host, except those
|
||||
+ services explicitly listed (that list can be modified as required
|
||||
+ by the local admin). This zone is intended to be used only by
|
||||
+ libvirt virtual networks - libvirt will add the bridge devices for
|
||||
+ all new virtual networks to this zone by default.
|
||||
+ </description>
|
||||
+
|
||||
+<rule priority='32767'>
|
||||
+ <reject/>
|
||||
+</rule>
|
||||
+<service name='dhcp'/>
|
||||
+<service name='dhcpv6'/>
|
||||
+<service name='dns'/>
|
||||
+<service name='ssh'/>
|
||||
+<service name='tftp'/>
|
||||
+</zone>
|
||||
--
|
||||
2.20.1
|
||||
|
202
SOURCES/libvirt-cpu-Add-support-for-stibp-x86_64-feature.patch
Normal file
202
SOURCES/libvirt-cpu-Add-support-for-stibp-x86_64-feature.patch
Normal file
@ -0,0 +1,202 @@
|
||||
From 41a79702b10fc039aa76524626b77f91dc01edbd Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <41a79702b10fc039aa76524626b77f91dc01edbd@dist-git>
|
||||
From: Jiri Denemark <jdenemar@redhat.com>
|
||||
Date: Mon, 17 Dec 2018 16:24:32 +0100
|
||||
Subject: [PATCH] cpu: Add support for "stibp" x86_64 feature
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
QEMU commit v3.1.0-4-g0e89165829
|
||||
KVM patch: https://lore.kernel.org/lkml/20181205191956.31480-1-ehabkost@redhat.com/
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit eb1b551d21e316c1e80aba0b2af6969fdd849f0c)
|
||||
|
||||
Conflicts:
|
||||
src/cpu_map/x86_features.xml
|
||||
- cpu_map.xml is still monolithic in RHEL-8
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1655032
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
---
|
||||
src/cpu/cpu_map.xml | 3 +++
|
||||
tests/cputestdata/x86_64-cpuid-Core-i7-5600U-ibrs-disabled.xml | 2 +-
|
||||
tests/cputestdata/x86_64-cpuid-Core-i7-5600U-ibrs-guest.xml | 1 +
|
||||
tests/cputestdata/x86_64-cpuid-Core-i7-5600U-ibrs-host.xml | 1 +
|
||||
tests/cputestdata/x86_64-cpuid-Xeon-E5-2609-v3-disabled.xml | 2 +-
|
||||
tests/cputestdata/x86_64-cpuid-Xeon-E5-2609-v3-guest.xml | 1 +
|
||||
tests/cputestdata/x86_64-cpuid-Xeon-E5-2609-v3-host.xml | 1 +
|
||||
tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4-disabled.xml | 2 +-
|
||||
tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4-guest.xml | 1 +
|
||||
tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4-host.xml | 1 +
|
||||
tests/cputestdata/x86_64-cpuid-Xeon-Gold-5115-disabled.xml | 2 +-
|
||||
tests/cputestdata/x86_64-cpuid-Xeon-Gold-5115-guest.xml | 1 +
|
||||
tests/cputestdata/x86_64-cpuid-Xeon-Gold-5115-host.xml | 1 +
|
||||
13 files changed, 15 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/cpu/cpu_map.xml b/src/cpu/cpu_map.xml
|
||||
index cdb023e936..095d49a69a 100644
|
||||
--- a/src/cpu/cpu_map.xml
|
||||
+++ b/src/cpu/cpu_map.xml
|
||||
@@ -328,6 +328,9 @@
|
||||
<feature name='spec-ctrl'>
|
||||
<cpuid eax_in='0x07' ecx_in='0x00' edx='0x04000000'/>
|
||||
</feature>
|
||||
+ <feature name='stibp'>
|
||||
+ <cpuid eax_in='0x07' ecx_in='0x00' edx='0x08000000'/>
|
||||
+ </feature>
|
||||
<feature name='ssbd'>
|
||||
<cpuid eax_in='0x07' ecx_in='0x00' edx='0x80000000'/>
|
||||
</feature>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-ibrs-disabled.xml b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-ibrs-disabled.xml
|
||||
index e033bb141f..5c9cfa9bd6 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-ibrs-disabled.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-ibrs-disabled.xml
|
||||
@@ -1,6 +1,6 @@
|
||||
<!-- Features disabled by QEMU -->
|
||||
<cpudata arch='x86'>
|
||||
<cpuid eax_in='0x00000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x0800c1dc' edx='0xb0600000'/>
|
||||
- <cpuid eax_in='0x00000007' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x04000000'/>
|
||||
+ <cpuid eax_in='0x00000007' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x0c000000'/>
|
||||
<cpuid eax_in='0x80000007' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000100'/>
|
||||
</cpudata>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-ibrs-guest.xml b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-ibrs-guest.xml
|
||||
index 4fa4770208..5d3093cec1 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-ibrs-guest.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-ibrs-guest.xml
|
||||
@@ -23,6 +23,7 @@
|
||||
<feature policy='require' name='arat'/>
|
||||
<feature policy='require' name='tsc_adjust'/>
|
||||
<feature policy='require' name='intel-pt'/>
|
||||
+ <feature policy='require' name='stibp'/>
|
||||
<feature policy='require' name='xsaveopt'/>
|
||||
<feature policy='require' name='pdpe1gb'/>
|
||||
<feature policy='require' name='abm'/>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-ibrs-host.xml b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-ibrs-host.xml
|
||||
index 25690c099c..a534d2dec5 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-ibrs-host.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-ibrs-host.xml
|
||||
@@ -24,6 +24,7 @@
|
||||
<feature name='arat'/>
|
||||
<feature name='tsc_adjust'/>
|
||||
<feature name='intel-pt'/>
|
||||
+ <feature name='stibp'/>
|
||||
<feature name='xsaveopt'/>
|
||||
<feature name='pdpe1gb'/>
|
||||
<feature name='abm'/>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2609-v3-disabled.xml b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2609-v3-disabled.xml
|
||||
index aacc7a2b14..ec299652f7 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2609-v3-disabled.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2609-v3-disabled.xml
|
||||
@@ -1,6 +1,6 @@
|
||||
<!-- 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='0x00001000' ecx='0x00000000' edx='0x00000000'/>
|
||||
+ <cpuid eax_in='0x00000007' ecx_in='0x00' eax='0x00000000' ebx='0x00001000' ecx='0x00000000' edx='0x08000000'/>
|
||||
<cpuid eax_in='0x80000007' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000100'/>
|
||||
</cpudata>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2609-v3-guest.xml b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2609-v3-guest.xml
|
||||
index a66c7a5644..d8aaaad29d 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2609-v3-guest.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2609-v3-guest.xml
|
||||
@@ -24,6 +24,7 @@
|
||||
<feature policy='require' name='arat'/>
|
||||
<feature policy='require' name='tsc_adjust'/>
|
||||
<feature policy='require' name='cmt'/>
|
||||
+ <feature policy='require' name='stibp'/>
|
||||
<feature policy='require' name='xsaveopt'/>
|
||||
<feature policy='require' name='pdpe1gb'/>
|
||||
<feature policy='require' name='abm'/>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2609-v3-host.xml b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2609-v3-host.xml
|
||||
index 624d71db20..9bac4b4648 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2609-v3-host.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2609-v3-host.xml
|
||||
@@ -25,6 +25,7 @@
|
||||
<feature name='arat'/>
|
||||
<feature name='tsc_adjust'/>
|
||||
<feature name='cmt'/>
|
||||
+ <feature name='stibp'/>
|
||||
<feature name='xsaveopt'/>
|
||||
<feature name='pdpe1gb'/>
|
||||
<feature name='abm'/>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4-disabled.xml b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4-disabled.xml
|
||||
index d904808cec..85369d755c 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4-disabled.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4-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='0x00001000' ecx='0x00000000' edx='0x00000000'/>
|
||||
+ <cpuid eax_in='0x00000007' ecx_in='0x00' eax='0x00000000' ebx='0x00001000' ecx='0x00000000' edx='0x08000000'/>
|
||||
<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-Xeon-E5-2623-v4-guest.xml b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4-guest.xml
|
||||
index 7b93df3f1b..7718d7ca59 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4-guest.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4-guest.xml
|
||||
@@ -21,6 +21,7 @@
|
||||
<feature policy='require' name='tsc_adjust'/>
|
||||
<feature policy='require' name='cmt'/>
|
||||
<feature policy='require' name='intel-pt'/>
|
||||
+ <feature policy='require' name='stibp'/>
|
||||
<feature policy='require' name='mbm_total'/>
|
||||
<feature policy='require' name='mbm_local'/>
|
||||
<feature policy='require' name='pdpe1gb'/>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4-host.xml b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4-host.xml
|
||||
index 5078420c7a..43a0b93ab4 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4-host.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4-host.xml
|
||||
@@ -26,6 +26,7 @@
|
||||
<feature name='tsc_adjust'/>
|
||||
<feature name='cmt'/>
|
||||
<feature name='intel-pt'/>
|
||||
+ <feature name='stibp'/>
|
||||
<feature name='xsaveopt'/>
|
||||
<feature name='mbm_total'/>
|
||||
<feature name='mbm_local'/>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-5115-disabled.xml b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-5115-disabled.xml
|
||||
index b5c70a9dc4..a5b85a15c2 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-5115-disabled.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-5115-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='0x00001000' ecx='0x00000008' edx='0x00000000'/>
|
||||
+ <cpuid eax_in='0x00000007' ecx_in='0x00' eax='0x00000000' ebx='0x00001000' ecx='0x00000008' edx='0x08000000'/>
|
||||
<cpuid eax_in='0x0000000d' ecx_in='0x01' eax='0x00000008' ebx='0x00000000' ecx='0x00000000' 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'/>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-5115-guest.xml b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-5115-guest.xml
|
||||
index 480127f341..8f014f6e28 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-5115-guest.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-5115-guest.xml
|
||||
@@ -23,6 +23,7 @@
|
||||
<feature policy='require' name='clflushopt'/>
|
||||
<feature policy='require' name='intel-pt'/>
|
||||
<feature policy='require' name='pku'/>
|
||||
+ <feature policy='require' name='stibp'/>
|
||||
<feature policy='require' name='xsaves'/>
|
||||
<feature policy='require' name='mbm_total'/>
|
||||
<feature policy='require' name='mbm_local'/>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-5115-host.xml b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-5115-host.xml
|
||||
index 680b10acef..9de76fd640 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-5115-host.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-5115-host.xml
|
||||
@@ -24,6 +24,7 @@
|
||||
<feature name='clflushopt'/>
|
||||
<feature name='intel-pt'/>
|
||||
<feature name='pku'/>
|
||||
+ <feature name='stibp'/>
|
||||
<feature name='xsaves'/>
|
||||
<feature name='mbm_total'/>
|
||||
<feature name='mbm_local'/>
|
||||
--
|
||||
2.20.1
|
||||
|
@ -0,0 +1,59 @@
|
||||
From b339a54e493d97a5616be8883d1a0b4ebcd149d3 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <b339a54e493d97a5616be8883d1a0b4ebcd149d3@dist-git>
|
||||
From: Michal Privoznik <mprivozn@redhat.com>
|
||||
Date: Fri, 21 Jun 2019 09:25:18 +0200
|
||||
Subject: [PATCH] cpu: Don't access invalid memory in virCPUx86Translate
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Problem is that if there are no signatures for a CPU, then we
|
||||
still allocate cpu->signatures (even though with size 0). Later,
|
||||
we access cpu->signatures[0] if cpu->signatures is not NULL.
|
||||
|
||||
Invalid read of size 4
|
||||
at 0x5F439D7: virCPUx86Translate (cpu_x86.c:2930)
|
||||
by 0x5F3C239: virCPUTranslate (cpu.c:927)
|
||||
by 0x57CE7A1: qemuProcessUpdateGuestCPU (qemu_process.c:5870)
|
||||
...
|
||||
Address 0xf752d40 is 0 bytes after a block of size 0 alloc'd
|
||||
at 0x4C30EC6: calloc (vg_replace_malloc.c:711)
|
||||
by 0x5DBDE4E: virAllocN (viralloc.c:190)
|
||||
by 0x5F3E4FA: x86ModelCopySignatures (cpu_x86.c:990)
|
||||
by 0x5F3E60F: x86ModelCopy (cpu_x86.c:1008)
|
||||
by 0x5F3E7CB: x86ModelFromCPU (cpu_x86.c:1068)
|
||||
by 0x5F4397E: virCPUx86Translate (cpu_x86.c:2922)
|
||||
by 0x5F3C239: virCPUTranslate (cpu.c:927)
|
||||
by 0x57CE7A1: qemuProcessUpdateGuestCPU (qemu_process.c:5870)
|
||||
...
|
||||
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
(cherry picked from commit 62cb9c335c43a722e81ac0a1ed6e1111ba1d428b)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1686895
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Message-Id: <b36b22d237a7044a473e9b72de9763b2c603198c.1561068591.git.jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
src/cpu/cpu_x86.c | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
|
||||
index 24569a90f3..66aa5a612c 100644
|
||||
--- a/src/cpu/cpu_x86.c
|
||||
+++ b/src/cpu/cpu_x86.c
|
||||
@@ -985,6 +985,9 @@ x86ModelCopySignatures(virCPUx86ModelPtr dst,
|
||||
{
|
||||
size_t i;
|
||||
|
||||
+ if (src->nsignatures == 0)
|
||||
+ return 0;
|
||||
+
|
||||
if (VIR_ALLOC_N(dst->signatures, src->nsignatures) < 0)
|
||||
return -1;
|
||||
|
||||
--
|
||||
2.22.0
|
||||
|
@ -0,0 +1,82 @@
|
||||
From 900c638797181010d2341a8a5496c1335286353e Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <900c638797181010d2341a8a5496c1335286353e@dist-git>
|
||||
From: Jiri Denemark <jdenemar@redhat.com>
|
||||
Date: Fri, 7 Feb 2020 12:01:18 +0100
|
||||
Subject: [PATCH] cpu: Drop CPUID definition for hv-spinlocks
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
hv-spinlocks is not a CPUID feature and should not be checked as such.
|
||||
While starting a domain with hv-spinlocks enabled, we would report a
|
||||
warning about unsupported hyperv spinlocks feature even though it was
|
||||
set properly.
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit ad9d5d3a6a1fc86fca1620278cbd113e08370ba2)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1794868
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Message-Id: <f3040b3536c025c78b1613a487c519993a950c24.1581073232.git.jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
src/cpu/cpu_x86.c | 3 ---
|
||||
src/qemu/qemu_process.c | 5 +++--
|
||||
2 files changed, 3 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
|
||||
index 0459a0d1c8..a985913e5e 100644
|
||||
--- a/src/cpu/cpu_x86.c
|
||||
+++ b/src/cpu/cpu_x86.c
|
||||
@@ -88,8 +88,6 @@ KVM_FEATURE_DEF(VIR_CPU_x86_HV_STIMER,
|
||||
0x40000003, 0x00000008);
|
||||
KVM_FEATURE_DEF(VIR_CPU_x86_HV_RELAXED,
|
||||
0x40000003, 0x00000020);
|
||||
-KVM_FEATURE_DEF(VIR_CPU_x86_HV_SPINLOCKS,
|
||||
- 0x40000003, 0x00000022);
|
||||
KVM_FEATURE_DEF(VIR_CPU_x86_HV_VAPIC,
|
||||
0x40000003, 0x00000030);
|
||||
KVM_FEATURE_DEF(VIR_CPU_x86_HV_VPINDEX,
|
||||
@@ -110,7 +108,6 @@ static virCPUx86Feature x86_kvm_features[] =
|
||||
KVM_FEATURE(VIR_CPU_x86_HV_SYNIC),
|
||||
KVM_FEATURE(VIR_CPU_x86_HV_STIMER),
|
||||
KVM_FEATURE(VIR_CPU_x86_HV_RELAXED),
|
||||
- KVM_FEATURE(VIR_CPU_x86_HV_SPINLOCKS),
|
||||
KVM_FEATURE(VIR_CPU_x86_HV_VAPIC),
|
||||
KVM_FEATURE(VIR_CPU_x86_HV_VPINDEX),
|
||||
KVM_FEATURE(VIR_CPU_x86_HV_RESET),
|
||||
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
|
||||
index 312ce69ba5..17d48357b3 100644
|
||||
--- a/src/qemu/qemu_process.c
|
||||
+++ b/src/qemu/qemu_process.c
|
||||
@@ -3917,7 +3917,8 @@ qemuProcessVerifyHypervFeatures(virDomainDefPtr def,
|
||||
|
||||
for (i = 0; i < VIR_DOMAIN_HYPERV_LAST; i++) {
|
||||
/* always supported string property */
|
||||
- if (i == VIR_DOMAIN_HYPERV_VENDOR_ID)
|
||||
+ if (i == VIR_DOMAIN_HYPERV_VENDOR_ID ||
|
||||
+ i == VIR_DOMAIN_HYPERV_SPINLOCKS)
|
||||
continue;
|
||||
|
||||
if (def->hyperv_features[i] != VIR_TRISTATE_SWITCH_ON)
|
||||
@@ -3938,7 +3939,6 @@ qemuProcessVerifyHypervFeatures(virDomainDefPtr def,
|
||||
switch ((virDomainHyperv) i) {
|
||||
case VIR_DOMAIN_HYPERV_RELAXED:
|
||||
case VIR_DOMAIN_HYPERV_VAPIC:
|
||||
- case VIR_DOMAIN_HYPERV_SPINLOCKS:
|
||||
VIR_WARN("host doesn't support hyperv '%s' feature",
|
||||
virDomainHypervTypeToString(i));
|
||||
break;
|
||||
@@ -3957,6 +3957,7 @@ qemuProcessVerifyHypervFeatures(virDomainDefPtr def,
|
||||
return -1;
|
||||
|
||||
/* coverity[dead_error_begin] */
|
||||
+ case VIR_DOMAIN_HYPERV_SPINLOCKS:
|
||||
case VIR_DOMAIN_HYPERV_VENDOR_ID:
|
||||
case VIR_DOMAIN_HYPERV_LAST:
|
||||
break;
|
||||
--
|
||||
2.25.0
|
||||
|
156
SOURCES/libvirt-cpu-Drop-KVM_-from-hyperv-feature-macros.patch
Normal file
156
SOURCES/libvirt-cpu-Drop-KVM_-from-hyperv-feature-macros.patch
Normal file
@ -0,0 +1,156 @@
|
||||
From a7a5fd909ea7a5d7608568e94f9a0f7d4478719b Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <a7a5fd909ea7a5d7608568e94f9a0f7d4478719b@dist-git>
|
||||
From: Jiri Denemark <jdenemar@redhat.com>
|
||||
Date: Fri, 7 Feb 2020 10:41:43 +0100
|
||||
Subject: [PATCH] cpu: Drop KVM_ from hyperv feature macros
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
All the features are hyperv features even though they are provided by
|
||||
KVM with QEMU. The "KVM" part in the macro names does not make a lot of
|
||||
sense.
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Tested-by: Vitaly Kuznetsov <vkuznets@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit 1ddf014fef4468a15303029fbc563da0aaaf8ce4)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1794868
|
||||
|
||||
Conflicts:
|
||||
src/cpu/cpu_x86.c
|
||||
src/cpu/cpu_x86_data.h
|
||||
- a few extra hyperv features upstream
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Message-Id: <c98a0f397787d6b62621728aed00f48b77521c2c.1581064395.git.jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
src/cpu/cpu_x86.c | 45 +++++++++++++++++++++--------------------
|
||||
src/cpu/cpu_x86_data.h | 22 ++++++++++----------
|
||||
src/qemu/qemu_command.c | 2 +-
|
||||
3 files changed, 35 insertions(+), 34 deletions(-)
|
||||
|
||||
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
|
||||
index cf5ef442e7..ecf11926b4 100644
|
||||
--- a/src/cpu/cpu_x86.c
|
||||
+++ b/src/cpu/cpu_x86.c
|
||||
@@ -95,27 +95,28 @@ KVM_FEATURE_DEF(VIR_CPU_x86_KVM_PV_UNHALT,
|
||||
0x40000001, 0x00000080);
|
||||
KVM_FEATURE_DEF(VIR_CPU_x86_KVM_CLOCKSOURCE_STABLE_BIT,
|
||||
0x40000001, 0x01000000);
|
||||
-KVM_FEATURE_DEF(VIR_CPU_x86_KVM_HV_RUNTIME,
|
||||
+
|
||||
+KVM_FEATURE_DEF(VIR_CPU_x86_HV_RUNTIME,
|
||||
0x40000003, 0x00000001);
|
||||
-KVM_FEATURE_DEF(VIR_CPU_x86_KVM_HV_SYNIC,
|
||||
+KVM_FEATURE_DEF(VIR_CPU_x86_HV_SYNIC,
|
||||
0x40000003, 0x00000004);
|
||||
-KVM_FEATURE_DEF(VIR_CPU_x86_KVM_HV_STIMER,
|
||||
+KVM_FEATURE_DEF(VIR_CPU_x86_HV_STIMER,
|
||||
0x40000003, 0x00000008);
|
||||
-KVM_FEATURE_DEF(VIR_CPU_x86_KVM_HV_RELAXED,
|
||||
+KVM_FEATURE_DEF(VIR_CPU_x86_HV_RELAXED,
|
||||
0x40000003, 0x00000020);
|
||||
-KVM_FEATURE_DEF(VIR_CPU_x86_KVM_HV_SPINLOCKS,
|
||||
+KVM_FEATURE_DEF(VIR_CPU_x86_HV_SPINLOCKS,
|
||||
0x40000003, 0x00000022);
|
||||
-KVM_FEATURE_DEF(VIR_CPU_x86_KVM_HV_VAPIC,
|
||||
+KVM_FEATURE_DEF(VIR_CPU_x86_HV_VAPIC,
|
||||
0x40000003, 0x00000030);
|
||||
-KVM_FEATURE_DEF(VIR_CPU_x86_KVM_HV_VPINDEX,
|
||||
+KVM_FEATURE_DEF(VIR_CPU_x86_HV_VPINDEX,
|
||||
0x40000003, 0x00000040);
|
||||
-KVM_FEATURE_DEF(VIR_CPU_x86_KVM_HV_RESET,
|
||||
+KVM_FEATURE_DEF(VIR_CPU_x86_HV_RESET,
|
||||
0x40000003, 0x00000080);
|
||||
-KVM_FEATURE_DEF(VIR_CPU_x86_KVM_HV_FREQUENCIES,
|
||||
+KVM_FEATURE_DEF(VIR_CPU_x86_HV_FREQUENCIES,
|
||||
0x40000003, 0x00000800);
|
||||
-KVM_FEATURE_DEF(VIR_CPU_x86_KVM_HV_REENLIGHTENMENT,
|
||||
+KVM_FEATURE_DEF(VIR_CPU_x86_HV_REENLIGHTENMENT,
|
||||
0x40000003, 0x00002000);
|
||||
-KVM_FEATURE_DEF(VIR_CPU_x86_KVM_HV_TLBFLUSH,
|
||||
+KVM_FEATURE_DEF(VIR_CPU_x86_HV_TLBFLUSH,
|
||||
0x40000004, 0x00000004);
|
||||
|
||||
static virCPUx86Feature x86_kvm_features[] =
|
||||
@@ -129,17 +130,17 @@ static virCPUx86Feature x86_kvm_features[] =
|
||||
KVM_FEATURE(VIR_CPU_x86_KVM_PV_EOI),
|
||||
KVM_FEATURE(VIR_CPU_x86_KVM_PV_UNHALT),
|
||||
KVM_FEATURE(VIR_CPU_x86_KVM_CLOCKSOURCE_STABLE_BIT),
|
||||
- KVM_FEATURE(VIR_CPU_x86_KVM_HV_RUNTIME),
|
||||
- KVM_FEATURE(VIR_CPU_x86_KVM_HV_SYNIC),
|
||||
- KVM_FEATURE(VIR_CPU_x86_KVM_HV_STIMER),
|
||||
- KVM_FEATURE(VIR_CPU_x86_KVM_HV_RELAXED),
|
||||
- KVM_FEATURE(VIR_CPU_x86_KVM_HV_SPINLOCKS),
|
||||
- KVM_FEATURE(VIR_CPU_x86_KVM_HV_VAPIC),
|
||||
- KVM_FEATURE(VIR_CPU_x86_KVM_HV_VPINDEX),
|
||||
- KVM_FEATURE(VIR_CPU_x86_KVM_HV_RESET),
|
||||
- KVM_FEATURE(VIR_CPU_x86_KVM_HV_FREQUENCIES),
|
||||
- KVM_FEATURE(VIR_CPU_x86_KVM_HV_REENLIGHTENMENT),
|
||||
- KVM_FEATURE(VIR_CPU_x86_KVM_HV_TLBFLUSH),
|
||||
+ KVM_FEATURE(VIR_CPU_x86_HV_RUNTIME),
|
||||
+ KVM_FEATURE(VIR_CPU_x86_HV_SYNIC),
|
||||
+ KVM_FEATURE(VIR_CPU_x86_HV_STIMER),
|
||||
+ KVM_FEATURE(VIR_CPU_x86_HV_RELAXED),
|
||||
+ KVM_FEATURE(VIR_CPU_x86_HV_SPINLOCKS),
|
||||
+ KVM_FEATURE(VIR_CPU_x86_HV_VAPIC),
|
||||
+ KVM_FEATURE(VIR_CPU_x86_HV_VPINDEX),
|
||||
+ KVM_FEATURE(VIR_CPU_x86_HV_RESET),
|
||||
+ KVM_FEATURE(VIR_CPU_x86_HV_FREQUENCIES),
|
||||
+ KVM_FEATURE(VIR_CPU_x86_HV_REENLIGHTENMENT),
|
||||
+ KVM_FEATURE(VIR_CPU_x86_HV_TLBFLUSH),
|
||||
};
|
||||
|
||||
typedef struct _virCPUx86Model virCPUx86Model;
|
||||
diff --git a/src/cpu/cpu_x86_data.h b/src/cpu/cpu_x86_data.h
|
||||
index 77797f633c..9668b13eb9 100644
|
||||
--- a/src/cpu/cpu_x86_data.h
|
||||
+++ b/src/cpu/cpu_x86_data.h
|
||||
@@ -64,17 +64,17 @@ struct _virCPUx86MSR {
|
||||
* ones defined for virDomainHyperv in domain_conf.c.
|
||||
* E.g "hv-runtime" -> "runtime", "hv-spinlocks" -> "spinlocks" etc.
|
||||
*/
|
||||
-# define VIR_CPU_x86_KVM_HV_RUNTIME "hv-runtime"
|
||||
-# define VIR_CPU_x86_KVM_HV_SYNIC "hv-synic"
|
||||
-# define VIR_CPU_x86_KVM_HV_STIMER "hv-stimer"
|
||||
-# define VIR_CPU_x86_KVM_HV_RELAXED "hv-relaxed"
|
||||
-# define VIR_CPU_x86_KVM_HV_SPINLOCKS "hv-spinlocks"
|
||||
-# define VIR_CPU_x86_KVM_HV_VAPIC "hv-vapic"
|
||||
-# define VIR_CPU_x86_KVM_HV_VPINDEX "hv-vpindex"
|
||||
-# define VIR_CPU_x86_KVM_HV_RESET "hv-reset"
|
||||
-# define VIR_CPU_x86_KVM_HV_FREQUENCIES "hv-frequencies"
|
||||
-# define VIR_CPU_x86_KVM_HV_REENLIGHTENMENT "hv-reenlightenment"
|
||||
-# define VIR_CPU_x86_KVM_HV_TLBFLUSH "hv-tlbflush"
|
||||
+# define VIR_CPU_x86_HV_RUNTIME "hv-runtime"
|
||||
+# define VIR_CPU_x86_HV_SYNIC "hv-synic"
|
||||
+# define VIR_CPU_x86_HV_STIMER "hv-stimer"
|
||||
+# define VIR_CPU_x86_HV_RELAXED "hv-relaxed"
|
||||
+# define VIR_CPU_x86_HV_SPINLOCKS "hv-spinlocks"
|
||||
+# define VIR_CPU_x86_HV_VAPIC "hv-vapic"
|
||||
+# define VIR_CPU_x86_HV_VPINDEX "hv-vpindex"
|
||||
+# define VIR_CPU_x86_HV_RESET "hv-reset"
|
||||
+# define VIR_CPU_x86_HV_FREQUENCIES "hv-frequencies"
|
||||
+# define VIR_CPU_x86_HV_REENLIGHTENMENT "hv-reenlightenment"
|
||||
+# define VIR_CPU_x86_HV_TLBFLUSH "hv-tlbflush"
|
||||
|
||||
|
||||
# define VIR_CPU_X86_DATA_INIT { 0 }
|
||||
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
|
||||
index 0289a907a1..71e102747c 100644
|
||||
--- a/src/qemu/qemu_command.c
|
||||
+++ b/src/qemu/qemu_command.c
|
||||
@@ -7039,7 +7039,7 @@ qemuBuildCpuCommandLine(virCommandPtr cmd,
|
||||
case VIR_DOMAIN_HYPERV_SPINLOCKS:
|
||||
if (def->hyperv_features[i] == VIR_TRISTATE_SWITCH_ON)
|
||||
virBufferAsprintf(&buf, ",%s=0x%x",
|
||||
- VIR_CPU_x86_KVM_HV_SPINLOCKS,
|
||||
+ VIR_CPU_x86_HV_SPINLOCKS,
|
||||
def->hyperv_spinlocks);
|
||||
break;
|
||||
|
||||
--
|
||||
2.25.0
|
||||
|
102
SOURCES/libvirt-cpu-Drop-unused-KVM-features.patch
Normal file
102
SOURCES/libvirt-cpu-Drop-unused-KVM-features.patch
Normal file
@ -0,0 +1,102 @@
|
||||
From 3ad9cd82d4fe7e87665a0233662712725f5d3d5d Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <3ad9cd82d4fe7e87665a0233662712725f5d3d5d@dist-git>
|
||||
From: Jiri Denemark <jdenemar@redhat.com>
|
||||
Date: Fri, 7 Feb 2020 10:41:44 +0100
|
||||
Subject: [PATCH] cpu: Drop unused KVM features
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Most of the internally defined KVM CPUID features are not actually used
|
||||
by libvirt. The QEMU driver may enable or disable them on the command
|
||||
line, but we don't check for the associated CPU properties or CPUID
|
||||
bits. They would be useless with QEMU 4.1 anyway since their names were
|
||||
only remotely similar to the actual feature names.
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Tested-by: Vitaly Kuznetsov <vkuznets@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit 9e6172937f8d8f832359dd5eeb4e7c92f9defcbf)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1794868
|
||||
|
||||
Conflicts:
|
||||
src/cpu/cpu_x86_data.h
|
||||
- all defines are indented as downstream lacks #pragma once
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Message-Id: <763f5d57b6cb930d9edbfbe8edbb7d5797a48150.1581064395.git.jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
src/cpu/cpu_x86.c | 24 ------------------------
|
||||
src/cpu/cpu_x86_data.h | 8 --------
|
||||
2 files changed, 32 deletions(-)
|
||||
|
||||
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
|
||||
index ecf11926b4..0459a0d1c8 100644
|
||||
--- a/src/cpu/cpu_x86.c
|
||||
+++ b/src/cpu/cpu_x86.c
|
||||
@@ -77,24 +77,8 @@ struct _virCPUx86Feature {
|
||||
} \
|
||||
}
|
||||
|
||||
-KVM_FEATURE_DEF(VIR_CPU_x86_KVM_CLOCKSOURCE,
|
||||
- 0x40000001, 0x00000001);
|
||||
-KVM_FEATURE_DEF(VIR_CPU_x86_KVM_NOP_IO_DELAY,
|
||||
- 0x40000001, 0x00000002);
|
||||
-KVM_FEATURE_DEF(VIR_CPU_x86_KVM_MMU_OP,
|
||||
- 0x40000001, 0x00000004);
|
||||
-KVM_FEATURE_DEF(VIR_CPU_x86_KVM_CLOCKSOURCE2,
|
||||
- 0x40000001, 0x00000008);
|
||||
-KVM_FEATURE_DEF(VIR_CPU_x86_KVM_ASYNC_PF,
|
||||
- 0x40000001, 0x00000010);
|
||||
-KVM_FEATURE_DEF(VIR_CPU_x86_KVM_STEAL_TIME,
|
||||
- 0x40000001, 0x00000020);
|
||||
-KVM_FEATURE_DEF(VIR_CPU_x86_KVM_PV_EOI,
|
||||
- 0x40000001, 0x00000040);
|
||||
KVM_FEATURE_DEF(VIR_CPU_x86_KVM_PV_UNHALT,
|
||||
0x40000001, 0x00000080);
|
||||
-KVM_FEATURE_DEF(VIR_CPU_x86_KVM_CLOCKSOURCE_STABLE_BIT,
|
||||
- 0x40000001, 0x01000000);
|
||||
|
||||
KVM_FEATURE_DEF(VIR_CPU_x86_HV_RUNTIME,
|
||||
0x40000003, 0x00000001);
|
||||
@@ -121,15 +105,7 @@ KVM_FEATURE_DEF(VIR_CPU_x86_HV_TLBFLUSH,
|
||||
|
||||
static virCPUx86Feature x86_kvm_features[] =
|
||||
{
|
||||
- KVM_FEATURE(VIR_CPU_x86_KVM_CLOCKSOURCE),
|
||||
- KVM_FEATURE(VIR_CPU_x86_KVM_NOP_IO_DELAY),
|
||||
- KVM_FEATURE(VIR_CPU_x86_KVM_MMU_OP),
|
||||
- KVM_FEATURE(VIR_CPU_x86_KVM_CLOCKSOURCE2),
|
||||
- KVM_FEATURE(VIR_CPU_x86_KVM_ASYNC_PF),
|
||||
- KVM_FEATURE(VIR_CPU_x86_KVM_STEAL_TIME),
|
||||
- KVM_FEATURE(VIR_CPU_x86_KVM_PV_EOI),
|
||||
KVM_FEATURE(VIR_CPU_x86_KVM_PV_UNHALT),
|
||||
- KVM_FEATURE(VIR_CPU_x86_KVM_CLOCKSOURCE_STABLE_BIT),
|
||||
KVM_FEATURE(VIR_CPU_x86_HV_RUNTIME),
|
||||
KVM_FEATURE(VIR_CPU_x86_HV_SYNIC),
|
||||
KVM_FEATURE(VIR_CPU_x86_HV_STIMER),
|
||||
diff --git a/src/cpu/cpu_x86_data.h b/src/cpu/cpu_x86_data.h
|
||||
index 9668b13eb9..8a189f854e 100644
|
||||
--- a/src/cpu/cpu_x86_data.h
|
||||
+++ b/src/cpu/cpu_x86_data.h
|
||||
@@ -49,15 +49,7 @@ struct _virCPUx86MSR {
|
||||
# define CPUX86_KVM 0x40000000
|
||||
# define CPUX86_EXTENDED 0x80000000
|
||||
|
||||
-# define VIR_CPU_x86_KVM_CLOCKSOURCE "__kvm_clocksource"
|
||||
-# define VIR_CPU_x86_KVM_NOP_IO_DELAY "__kvm_no_io_delay"
|
||||
-# define VIR_CPU_x86_KVM_MMU_OP "__kvm_mmu_op"
|
||||
-# define VIR_CPU_x86_KVM_CLOCKSOURCE2 "__kvm_clocksource2"
|
||||
-# define VIR_CPU_x86_KVM_ASYNC_PF "__kvm_async_pf"
|
||||
-# define VIR_CPU_x86_KVM_STEAL_TIME "__kvm_steal_time"
|
||||
-# define VIR_CPU_x86_KVM_PV_EOI "__kvm_pv_eoi"
|
||||
# define VIR_CPU_x86_KVM_PV_UNHALT "__kvm_pv_unhalt"
|
||||
-# define VIR_CPU_x86_KVM_CLOCKSOURCE_STABLE_BIT "__kvm_clocksource_stable"
|
||||
|
||||
/*
|
||||
* The following HyperV feature names suffixes must exactly match corresponding
|
||||
--
|
||||
2.25.0
|
||||
|
176
SOURCES/libvirt-cpu-Introduce-virCPUDataAddFeature.patch
Normal file
176
SOURCES/libvirt-cpu-Introduce-virCPUDataAddFeature.patch
Normal file
@ -0,0 +1,176 @@
|
||||
From 992af2f6564b899142a2be5f342e0cdbdd13eadc Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <992af2f6564b899142a2be5f342e0cdbdd13eadc@dist-git>
|
||||
From: Jiri Denemark <jdenemar@redhat.com>
|
||||
Date: Fri, 21 Jun 2019 09:25:59 +0200
|
||||
Subject: [PATCH] cpu: Introduce virCPUDataAddFeature
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This is a generic replacement for the former virCPUx86DataAddFeature,
|
||||
which worked on the generic virCPUDataPtr anyway.
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit df73078c612a70e48aa76e889a7026e2daa47b16)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1697627
|
||||
|
||||
Conflicts:
|
||||
src/cpu/cpu_x86.h
|
||||
- downstream did not switch to #pragma once
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Message-Id: <4e946f702092fe5eb4c8235dbb98402b30876a5f.1561068591.git.jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
src/cpu/cpu.c | 33 +++++++++++++++++++++++++++++++++
|
||||
src/cpu/cpu.h | 9 +++++++++
|
||||
src/cpu/cpu_x86.c | 3 ++-
|
||||
src/cpu/cpu_x86.h | 3 ---
|
||||
src/libvirt_private.syms | 2 +-
|
||||
src/qemu/qemu_capabilities.c | 2 +-
|
||||
6 files changed, 46 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c
|
||||
index cc93c49418..a2d143c94a 100644
|
||||
--- a/src/cpu/cpu.c
|
||||
+++ b/src/cpu/cpu.c
|
||||
@@ -1078,3 +1078,36 @@ virCPUValidateFeatures(virArch arch,
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
+
|
||||
+
|
||||
+/**
|
||||
+ * virCPUDataAddFeature:
|
||||
+ *
|
||||
+ * @cpuData: CPU data
|
||||
+ * @name: feature to be added to @cpuData
|
||||
+ *
|
||||
+ * Adds a feature called @name to @cpuData.
|
||||
+ *
|
||||
+ * Returns 0 on success, -1 on error.
|
||||
+ */
|
||||
+int
|
||||
+virCPUDataAddFeature(virCPUDataPtr cpuData,
|
||||
+ const char *name)
|
||||
+{
|
||||
+ struct cpuArchDriver *driver;
|
||||
+
|
||||
+ VIR_DEBUG("arch=%s, cpuData=%p, name=%s",
|
||||
+ virArchToString(cpuData->arch), cpuData, name);
|
||||
+
|
||||
+ if (!(driver = cpuGetSubDriver(cpuData->arch)))
|
||||
+ return -1;
|
||||
+
|
||||
+ if (!driver->dataAddFeature) {
|
||||
+ virReportError(VIR_ERR_NO_SUPPORT,
|
||||
+ _("cannot add guest CPU feature for %s architecture"),
|
||||
+ virArchToString(cpuData->arch));
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ return driver->dataAddFeature(cpuData, name);
|
||||
+}
|
||||
diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h
|
||||
index 81119b6aeb..e5fae31e30 100644
|
||||
--- a/src/cpu/cpu.h
|
||||
+++ b/src/cpu/cpu.h
|
||||
@@ -121,6 +121,10 @@ typedef virCPUDefPtr
|
||||
typedef int
|
||||
(*virCPUArchValidateFeatures)(virCPUDefPtr cpu);
|
||||
|
||||
+typedef int
|
||||
+(*virCPUArchDataAddFeature)(virCPUDataPtr cpuData,
|
||||
+ const char *name);
|
||||
+
|
||||
struct cpuArchDriver {
|
||||
const char *name;
|
||||
const virArch *arch;
|
||||
@@ -143,6 +147,7 @@ struct cpuArchDriver {
|
||||
virCPUArchExpandFeatures expandFeatures;
|
||||
virCPUArchCopyMigratable copyMigratable;
|
||||
virCPUArchValidateFeatures validateFeatures;
|
||||
+ virCPUArchDataAddFeature dataAddFeature;
|
||||
};
|
||||
|
||||
|
||||
@@ -260,6 +265,10 @@ virCPUValidateFeatures(virArch arch,
|
||||
virCPUDefPtr cpu)
|
||||
ATTRIBUTE_NONNULL(2);
|
||||
|
||||
+int
|
||||
+virCPUDataAddFeature(virCPUDataPtr cpuData,
|
||||
+ const char *name);
|
||||
+
|
||||
/* virCPUDataFormat and virCPUDataParse are implemented for unit tests only and
|
||||
* have no real-life usage
|
||||
*/
|
||||
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
|
||||
index 3c1bd623db..ead962ae06 100644
|
||||
--- a/src/cpu/cpu_x86.c
|
||||
+++ b/src/cpu/cpu_x86.c
|
||||
@@ -3316,7 +3316,7 @@ virCPUx86DataSetVendor(virCPUDataPtr cpuData,
|
||||
}
|
||||
|
||||
|
||||
-int
|
||||
+static int
|
||||
virCPUx86DataAddFeature(virCPUDataPtr cpuData,
|
||||
const char *name)
|
||||
{
|
||||
@@ -3361,4 +3361,5 @@ struct cpuArchDriver cpuDriverX86 = {
|
||||
.expandFeatures = virCPUx86ExpandFeatures,
|
||||
.copyMigratable = virCPUx86CopyMigratable,
|
||||
.validateFeatures = virCPUx86ValidateFeatures,
|
||||
+ .dataAddFeature = virCPUx86DataAddFeature,
|
||||
};
|
||||
diff --git a/src/cpu/cpu_x86.h b/src/cpu/cpu_x86.h
|
||||
index 8b51cef9c1..519024b7c0 100644
|
||||
--- a/src/cpu/cpu_x86.h
|
||||
+++ b/src/cpu/cpu_x86.h
|
||||
@@ -45,7 +45,4 @@ uint32_t virCPUx86DataGetSignature(virCPUDataPtr cpuData,
|
||||
int virCPUx86DataSetVendor(virCPUDataPtr cpuData,
|
||||
const char *vendor);
|
||||
|
||||
-int virCPUx86DataAddFeature(virCPUDataPtr cpuData,
|
||||
- const char *name);
|
||||
-
|
||||
#endif /* __VIR_CPU_X86_H__ */
|
||||
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
|
||||
index 57508de0c1..a20e0593f0 100644
|
||||
--- a/src/libvirt_private.syms
|
||||
+++ b/src/libvirt_private.syms
|
||||
@@ -1187,6 +1187,7 @@ virCPUCompare;
|
||||
virCPUCompareXML;
|
||||
virCPUConvertLegacy;
|
||||
virCPUCopyMigratable;
|
||||
+virCPUDataAddFeature;
|
||||
virCPUDataCheckFeature;
|
||||
virCPUDataFormat;
|
||||
virCPUDataFree;
|
||||
@@ -1205,7 +1206,6 @@ virCPUValidateFeatures;
|
||||
|
||||
# cpu/cpu_x86.h
|
||||
virCPUx86DataAdd;
|
||||
-virCPUx86DataAddFeature;
|
||||
virCPUx86DataGetSignature;
|
||||
virCPUx86DataSetSignature;
|
||||
virCPUx86DataSetVendor;
|
||||
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
|
||||
index 78be2d35f4..4be0ec305f 100644
|
||||
--- a/src/qemu/qemu_capabilities.c
|
||||
+++ b/src/qemu/qemu_capabilities.c
|
||||
@@ -2916,7 +2916,7 @@ virQEMUCapsGetCPUModelX86Data(virQEMUCapsPtr qemuCaps,
|
||||
(migratable && prop->migratable == VIR_TRISTATE_BOOL_NO))
|
||||
continue;
|
||||
|
||||
- if (virCPUx86DataAddFeature(data, name) < 0)
|
||||
+ if (virCPUDataAddFeature(data, name) < 0)
|
||||
goto cleanup;
|
||||
|
||||
break;
|
||||
--
|
||||
2.22.0
|
||||
|
159
SOURCES/libvirt-cpu-allow-include-files-for-CPU-definition.patch
Normal file
159
SOURCES/libvirt-cpu-allow-include-files-for-CPU-definition.patch
Normal file
@ -0,0 +1,159 @@
|
||||
From 6438640b53fef3e889c21a2ed016638b91c5ac80 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <6438640b53fef3e889c21a2ed016638b91c5ac80@dist-git>
|
||||
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
|
||||
Date: Fri, 21 Jun 2019 09:24:44 +0200
|
||||
Subject: [PATCH] cpu: allow include files for CPU definition
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Allow for syntax
|
||||
|
||||
<include filename="subdir/fooo.xml"/>
|
||||
|
||||
to reference other files in the CPU database directory
|
||||
|
||||
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||
(cherry picked from commit eda5f575f2a7530fc7f6471f88496778a9bc9fcb)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1686895
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Message-Id: <800e5ebbc30502fd780a3ef84fe524f1dc0ffd67.1561068591.git.jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
src/cpu/cpu_map.c | 92 +++++++++++++++++++++++++++++++++++++++++++++--
|
||||
1 file changed, 89 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/cpu/cpu_map.c b/src/cpu/cpu_map.c
|
||||
index d263eb8cdd..333c7ef24f 100644
|
||||
--- a/src/cpu/cpu_map.c
|
||||
+++ b/src/cpu/cpu_map.c
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* cpu_map.c: internal functions for handling CPU mapping configuration
|
||||
*
|
||||
- * Copyright (C) 2009-2010 Red Hat, Inc.
|
||||
+ * Copyright (C) 2009-2018 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -70,6 +70,89 @@ static int load(xmlXPathContextPtr ctxt,
|
||||
return ret;
|
||||
}
|
||||
|
||||
+static int
|
||||
+cpuMapLoadInclude(const char *filename,
|
||||
+ cpuMapLoadCallback cb,
|
||||
+ void *data)
|
||||
+{
|
||||
+ xmlDocPtr xml = NULL;
|
||||
+ xmlXPathContextPtr ctxt = NULL;
|
||||
+ int ret = -1;
|
||||
+ int element;
|
||||
+ char *mapfile;
|
||||
+
|
||||
+ if (!(mapfile = virFileFindResource(filename,
|
||||
+ abs_topsrcdir "/src/cpu",
|
||||
+ PKGDATADIR)))
|
||||
+ return -1;
|
||||
+
|
||||
+ VIR_DEBUG("Loading CPU map include from %s", mapfile);
|
||||
+
|
||||
+ if (!(xml = virXMLParseFileCtxt(mapfile, &ctxt)))
|
||||
+ goto cleanup;
|
||||
+
|
||||
+ ctxt->node = xmlDocGetRootElement(xml);
|
||||
+
|
||||
+ for (element = 0; element < CPU_MAP_ELEMENT_LAST; element++) {
|
||||
+ if (load(ctxt, element, cb, data) < 0) {
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
+ _("cannot parse CPU map '%s'"), mapfile);
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ ret = 0;
|
||||
+
|
||||
+ cleanup:
|
||||
+ xmlXPathFreeContext(ctxt);
|
||||
+ xmlFreeDoc(xml);
|
||||
+ VIR_FREE(mapfile);
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static int
|
||||
+loadIncludes(xmlXPathContextPtr ctxt,
|
||||
+ cpuMapLoadCallback callback,
|
||||
+ void *data)
|
||||
+{
|
||||
+ int ret = -1;
|
||||
+ xmlNodePtr ctxt_node;
|
||||
+ xmlNodePtr *nodes = NULL;
|
||||
+ int n;
|
||||
+ size_t i;
|
||||
+
|
||||
+ ctxt_node = ctxt->node;
|
||||
+
|
||||
+ n = virXPathNodeSet("include", ctxt, &nodes);
|
||||
+ if (n < 0)
|
||||
+ goto cleanup;
|
||||
+
|
||||
+ for (i = 0; i < n; i++) {
|
||||
+ char *filename = virXMLPropString(nodes[i], "filename");
|
||||
+ if (!filename) {
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
+ _("Missing 'filename' in CPU map include"));
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+ VIR_DEBUG("Finding CPU map include '%s'", filename);
|
||||
+ if (cpuMapLoadInclude(filename, callback, data) < 0) {
|
||||
+ VIR_FREE(filename);
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+ VIR_FREE(filename);
|
||||
+ }
|
||||
+
|
||||
+ ret = 0;
|
||||
+
|
||||
+ cleanup:
|
||||
+ ctxt->node = ctxt_node;
|
||||
+ VIR_FREE(nodes);
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
|
||||
int cpuMapLoad(const char *arch,
|
||||
cpuMapLoadCallback cb,
|
||||
@@ -88,7 +171,7 @@ int cpuMapLoad(const char *arch,
|
||||
PKGDATADIR)))
|
||||
return -1;
|
||||
|
||||
- VIR_DEBUG("Loading CPU map from %s", mapfile);
|
||||
+ VIR_DEBUG("Loading '%s' CPU map from %s", NULLSTR(arch), mapfile);
|
||||
|
||||
if (arch == NULL) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
@@ -122,11 +205,14 @@ int cpuMapLoad(const char *arch,
|
||||
for (element = 0; element < CPU_MAP_ELEMENT_LAST; element++) {
|
||||
if (load(ctxt, element, cb, data) < 0) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
- _("cannot parse CPU map for %s architecture"), arch);
|
||||
+ _("cannot parse CPU map '%s'"), mapfile);
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
+ if (loadIncludes(ctxt, cb, data) < 0)
|
||||
+ goto cleanup;
|
||||
+
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
--
|
||||
2.22.0
|
||||
|
@ -0,0 +1,51 @@
|
||||
From 612913a764992dc1a9ae63762749ecee447427d7 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <612913a764992dc1a9ae63762749ecee447427d7@dist-git>
|
||||
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
|
||||
Date: Fri, 21 Jun 2019 09:24:45 +0200
|
||||
Subject: [PATCH] cpu: fix cleanup when signature parsing fails
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Two pieces of code accidentally jumped to the wrong label when they
|
||||
failed causing incorrect cleanup, returning a partially initialized
|
||||
CPU model struct.
|
||||
|
||||
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||
(cherry picked from commit 118fcdd480ad38a3e8477f466f6a876dce7e9fa6)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1686895
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Message-Id: <5e9aedc6fd4f4570322a7d13626863bec0449283.1561068591.git.jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
src/cpu/cpu_x86.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
|
||||
index 89baf94d7d..124aa5fd5e 100644
|
||||
--- a/src/cpu/cpu_x86.c
|
||||
+++ b/src/cpu/cpu_x86.c
|
||||
@@ -1250,7 +1250,7 @@ x86ModelParse(xmlXPathContextPtr ctxt,
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Invalid CPU signature family in model %s"),
|
||||
model->name);
|
||||
- goto cleanup;
|
||||
+ goto error;
|
||||
}
|
||||
|
||||
rc = virXPathUInt("string(./signature/@model)", ctxt, &sigModel);
|
||||
@@ -1258,7 +1258,7 @@ x86ModelParse(xmlXPathContextPtr ctxt,
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Invalid CPU signature model in model %s"),
|
||||
model->name);
|
||||
- goto cleanup;
|
||||
+ goto error;
|
||||
}
|
||||
|
||||
model->signature = x86MakeSignature(sigFamily, sigModel, 0);
|
||||
--
|
||||
2.22.0
|
||||
|
@ -0,0 +1,782 @@
|
||||
From 728231dcbbf2a4ab8a4bfe03fdf43d78bdeccbb0 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <728231dcbbf2a4ab8a4bfe03fdf43d78bdeccbb0@dist-git>
|
||||
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
|
||||
Date: Fri, 21 Jun 2019 09:24:46 +0200
|
||||
Subject: [PATCH] cpu: push more parsing logic into common code
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The x86 and ppc impls both duplicate some logic when parsing CPU
|
||||
features. Change the callback signature so that this duplication can be
|
||||
pushed up a level to common code.
|
||||
|
||||
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||
(cherry picked from commit 0815f519784a7c565c543498777dc25f129620f9)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1686895
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Message-Id: <c770b678131dc5e207cbe84d276a2774e0c807c7.1561068591.git.jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
src/cpu/cpu_map.c | 98 +++++++++++++---------
|
||||
src/cpu/cpu_map.h | 22 ++---
|
||||
src/cpu/cpu_ppc64.c | 112 ++++++-------------------
|
||||
src/cpu/cpu_x86.c | 196 +++++++++++++-------------------------------
|
||||
4 files changed, 143 insertions(+), 285 deletions(-)
|
||||
|
||||
diff --git a/src/cpu/cpu_map.c b/src/cpu/cpu_map.c
|
||||
index 333c7ef24f..ac7e58037a 100644
|
||||
--- a/src/cpu/cpu_map.c
|
||||
+++ b/src/cpu/cpu_map.c
|
||||
@@ -35,31 +35,47 @@
|
||||
|
||||
VIR_LOG_INIT("cpu.cpu_map");
|
||||
|
||||
-VIR_ENUM_IMPL(cpuMapElement, CPU_MAP_ELEMENT_LAST,
|
||||
- "vendor",
|
||||
- "feature",
|
||||
- "model")
|
||||
-
|
||||
-
|
||||
-static int load(xmlXPathContextPtr ctxt,
|
||||
- cpuMapElement element,
|
||||
- cpuMapLoadCallback callback,
|
||||
- void *data)
|
||||
+static int
|
||||
+loadData(const char *mapfile,
|
||||
+ xmlXPathContextPtr ctxt,
|
||||
+ const char *element,
|
||||
+ cpuMapLoadCallback callback,
|
||||
+ void *data)
|
||||
{
|
||||
int ret = -1;
|
||||
xmlNodePtr ctxt_node;
|
||||
xmlNodePtr *nodes = NULL;
|
||||
int n;
|
||||
+ size_t i;
|
||||
+ int rv;
|
||||
|
||||
ctxt_node = ctxt->node;
|
||||
|
||||
- n = virXPathNodeSet(cpuMapElementTypeToString(element), ctxt, &nodes);
|
||||
- if (n < 0)
|
||||
+ if ((n = virXPathNodeSet(element, ctxt, &nodes)) < 0)
|
||||
goto cleanup;
|
||||
|
||||
- if (n > 0 &&
|
||||
- callback(element, ctxt, nodes, n, data) < 0)
|
||||
+ if (n > 0 && !callback) {
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
+ _("Unexpected element '%s' in CPU map '%s'"), element, mapfile);
|
||||
goto cleanup;
|
||||
+ }
|
||||
+
|
||||
+ for (i = 0; i < n; i++) {
|
||||
+ xmlNodePtr old = ctxt->node;
|
||||
+ char *name = virXMLPropString(nodes[i], "name");
|
||||
+ if (!name) {
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
+ _("cannot find %s name in CPU map '%s'"), element, mapfile);
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+ VIR_DEBUG("Load %s name %s", element, name);
|
||||
+ ctxt->node = nodes[i];
|
||||
+ rv = callback(ctxt, name, data);
|
||||
+ ctxt->node = old;
|
||||
+ VIR_FREE(name);
|
||||
+ if (rv < 0)
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
|
||||
ret = 0;
|
||||
|
||||
@@ -72,13 +88,14 @@ static int load(xmlXPathContextPtr ctxt,
|
||||
|
||||
static int
|
||||
cpuMapLoadInclude(const char *filename,
|
||||
- cpuMapLoadCallback cb,
|
||||
+ cpuMapLoadCallback vendorCB,
|
||||
+ cpuMapLoadCallback featureCB,
|
||||
+ cpuMapLoadCallback modelCB,
|
||||
void *data)
|
||||
{
|
||||
xmlDocPtr xml = NULL;
|
||||
xmlXPathContextPtr ctxt = NULL;
|
||||
int ret = -1;
|
||||
- int element;
|
||||
char *mapfile;
|
||||
|
||||
if (!(mapfile = virFileFindResource(filename,
|
||||
@@ -93,13 +110,14 @@ cpuMapLoadInclude(const char *filename,
|
||||
|
||||
ctxt->node = xmlDocGetRootElement(xml);
|
||||
|
||||
- for (element = 0; element < CPU_MAP_ELEMENT_LAST; element++) {
|
||||
- if (load(ctxt, element, cb, data) < 0) {
|
||||
- virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
- _("cannot parse CPU map '%s'"), mapfile);
|
||||
- goto cleanup;
|
||||
- }
|
||||
- }
|
||||
+ if (loadData(mapfile, ctxt, "vendor", vendorCB, data) < 0)
|
||||
+ goto cleanup;
|
||||
+
|
||||
+ if (loadData(mapfile, ctxt, "feature", featureCB, data) < 0)
|
||||
+ goto cleanup;
|
||||
+
|
||||
+ if (loadData(mapfile, ctxt, "model", modelCB, data) < 0)
|
||||
+ goto cleanup;
|
||||
|
||||
ret = 0;
|
||||
|
||||
@@ -114,7 +132,9 @@ cpuMapLoadInclude(const char *filename,
|
||||
|
||||
static int
|
||||
loadIncludes(xmlXPathContextPtr ctxt,
|
||||
- cpuMapLoadCallback callback,
|
||||
+ cpuMapLoadCallback vendorCB,
|
||||
+ cpuMapLoadCallback featureCB,
|
||||
+ cpuMapLoadCallback modelCB,
|
||||
void *data)
|
||||
{
|
||||
int ret = -1;
|
||||
@@ -137,7 +157,7 @@ loadIncludes(xmlXPathContextPtr ctxt,
|
||||
goto cleanup;
|
||||
}
|
||||
VIR_DEBUG("Finding CPU map include '%s'", filename);
|
||||
- if (cpuMapLoadInclude(filename, callback, data) < 0) {
|
||||
+ if (cpuMapLoadInclude(filename, vendorCB, featureCB, modelCB, data) < 0) {
|
||||
VIR_FREE(filename);
|
||||
goto cleanup;
|
||||
}
|
||||
@@ -155,7 +175,9 @@ loadIncludes(xmlXPathContextPtr ctxt,
|
||||
|
||||
|
||||
int cpuMapLoad(const char *arch,
|
||||
- cpuMapLoadCallback cb,
|
||||
+ cpuMapLoadCallback vendorCB,
|
||||
+ cpuMapLoadCallback featureCB,
|
||||
+ cpuMapLoadCallback modelCB,
|
||||
void *data)
|
||||
{
|
||||
xmlDocPtr xml = NULL;
|
||||
@@ -163,7 +185,6 @@ int cpuMapLoad(const char *arch,
|
||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||
char *xpath = NULL;
|
||||
int ret = -1;
|
||||
- int element;
|
||||
char *mapfile;
|
||||
|
||||
if (!(mapfile = virFileFindResource("cpu_map.xml",
|
||||
@@ -179,12 +200,6 @@ int cpuMapLoad(const char *arch,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
- if (cb == NULL) {
|
||||
- virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
- "%s", _("no callback provided"));
|
||||
- goto cleanup;
|
||||
- }
|
||||
-
|
||||
if (!(xml = virXMLParseFileCtxt(mapfile, &ctxt)))
|
||||
goto cleanup;
|
||||
|
||||
@@ -202,15 +217,16 @@ int cpuMapLoad(const char *arch,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
- for (element = 0; element < CPU_MAP_ELEMENT_LAST; element++) {
|
||||
- if (load(ctxt, element, cb, data) < 0) {
|
||||
- virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
- _("cannot parse CPU map '%s'"), mapfile);
|
||||
- goto cleanup;
|
||||
- }
|
||||
- }
|
||||
+ if (loadData(mapfile, ctxt, "vendor", vendorCB, data) < 0)
|
||||
+ goto cleanup;
|
||||
|
||||
- if (loadIncludes(ctxt, cb, data) < 0)
|
||||
+ if (loadData(mapfile, ctxt, "feature", featureCB, data) < 0)
|
||||
+ goto cleanup;
|
||||
+
|
||||
+ if (loadData(mapfile, ctxt, "model", modelCB, data) < 0)
|
||||
+ goto cleanup;
|
||||
+
|
||||
+ if (loadIncludes(ctxt, vendorCB, featureCB, modelCB, data) < 0)
|
||||
goto cleanup;
|
||||
|
||||
ret = 0;
|
||||
diff --git a/src/cpu/cpu_map.h b/src/cpu/cpu_map.h
|
||||
index 0c7507e98f..4596987150 100644
|
||||
--- a/src/cpu/cpu_map.h
|
||||
+++ b/src/cpu/cpu_map.h
|
||||
@@ -26,28 +26,16 @@
|
||||
|
||||
# include "virxml.h"
|
||||
|
||||
-
|
||||
-typedef enum {
|
||||
- CPU_MAP_ELEMENT_VENDOR,
|
||||
- CPU_MAP_ELEMENT_FEATURE,
|
||||
- CPU_MAP_ELEMENT_MODEL,
|
||||
-
|
||||
- CPU_MAP_ELEMENT_LAST
|
||||
-} cpuMapElement;
|
||||
-
|
||||
-VIR_ENUM_DECL(cpuMapElement)
|
||||
-
|
||||
-
|
||||
typedef int
|
||||
-(*cpuMapLoadCallback) (cpuMapElement element,
|
||||
- xmlXPathContextPtr ctxt,
|
||||
- xmlNodePtr *nodes,
|
||||
- int n,
|
||||
+(*cpuMapLoadCallback) (xmlXPathContextPtr ctxt,
|
||||
+ const char *name,
|
||||
void *data);
|
||||
|
||||
int
|
||||
cpuMapLoad(const char *arch,
|
||||
- cpuMapLoadCallback cb,
|
||||
+ cpuMapLoadCallback vendorCB,
|
||||
+ cpuMapLoadCallback featureCB,
|
||||
+ cpuMapLoadCallback modelCB,
|
||||
void *data);
|
||||
|
||||
#endif /* __VIR_CPU_MAP_H__ */
|
||||
diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c
|
||||
index d562677fa3..75da5b77d8 100644
|
||||
--- a/src/cpu/cpu_ppc64.c
|
||||
+++ b/src/cpu/cpu_ppc64.c
|
||||
@@ -281,21 +281,19 @@ ppc64MapFree(struct ppc64_map *map)
|
||||
VIR_FREE(map);
|
||||
}
|
||||
|
||||
-static struct ppc64_vendor *
|
||||
-ppc64VendorParse(xmlXPathContextPtr ctxt,
|
||||
- struct ppc64_map *map)
|
||||
+static int
|
||||
+ppc64VendorParse(xmlXPathContextPtr ctxt ATTRIBUTE_UNUSED,
|
||||
+ const char *name,
|
||||
+ void *data)
|
||||
{
|
||||
+ struct ppc64_map *map = data;
|
||||
struct ppc64_vendor *vendor;
|
||||
|
||||
if (VIR_ALLOC(vendor) < 0)
|
||||
- return NULL;
|
||||
+ return -1;
|
||||
|
||||
- vendor->name = virXPathString("string(@name)", ctxt);
|
||||
- if (!vendor->name) {
|
||||
- virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
- "%s", _("Missing CPU vendor name"));
|
||||
+ if (VIR_STRDUP(vendor->name, name) < 0)
|
||||
goto error;
|
||||
- }
|
||||
|
||||
if (ppc64VendorFind(map, vendor->name)) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
@@ -303,57 +301,36 @@ ppc64VendorParse(xmlXPathContextPtr ctxt,
|
||||
goto error;
|
||||
}
|
||||
|
||||
- return vendor;
|
||||
+ if (VIR_APPEND_ELEMENT(map->vendors, map->nvendors, vendor) < 0)
|
||||
+ goto error;
|
||||
+
|
||||
+ return 0;
|
||||
|
||||
error:
|
||||
ppc64VendorFree(vendor);
|
||||
- return NULL;
|
||||
+ return -1;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
-ppc64VendorsLoad(struct ppc64_map *map,
|
||||
- xmlXPathContextPtr ctxt,
|
||||
- xmlNodePtr *nodes,
|
||||
- int n)
|
||||
-{
|
||||
- struct ppc64_vendor *vendor;
|
||||
- size_t i;
|
||||
-
|
||||
- if (VIR_ALLOC_N(map->vendors, n) < 0)
|
||||
- return -1;
|
||||
-
|
||||
- for (i = 0; i < n; i++) {
|
||||
- ctxt->node = nodes[i];
|
||||
- if (!(vendor = ppc64VendorParse(ctxt, map)))
|
||||
- return -1;
|
||||
- map->vendors[map->nvendors++] = vendor;
|
||||
- }
|
||||
-
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
-
|
||||
-static struct ppc64_model *
|
||||
ppc64ModelParse(xmlXPathContextPtr ctxt,
|
||||
- struct ppc64_map *map)
|
||||
+ const char *name,
|
||||
+ void *data)
|
||||
{
|
||||
+ struct ppc64_map *map = data;
|
||||
struct ppc64_model *model;
|
||||
xmlNodePtr *nodes = NULL;
|
||||
char *vendor = NULL;
|
||||
unsigned long pvr;
|
||||
size_t i;
|
||||
int n;
|
||||
+ int ret = -1;
|
||||
|
||||
if (VIR_ALLOC(model) < 0)
|
||||
goto error;
|
||||
|
||||
- model->name = virXPathString("string(@name)", ctxt);
|
||||
- if (!model->name) {
|
||||
- virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
- "%s", _("Missing CPU model name"));
|
||||
+ if (VIR_STRDUP(model->name, name) < 0)
|
||||
goto error;
|
||||
- }
|
||||
|
||||
if (ppc64ModelFind(map, model->name)) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
@@ -410,63 +387,22 @@ ppc64ModelParse(xmlXPathContextPtr ctxt,
|
||||
model->data.pvr[i].mask = pvr;
|
||||
}
|
||||
|
||||
+ if (VIR_APPEND_ELEMENT(map->models, map->nmodels, model) < 0)
|
||||
+ goto error;
|
||||
+
|
||||
+ ret = 0;
|
||||
+
|
||||
cleanup:
|
||||
VIR_FREE(vendor);
|
||||
VIR_FREE(nodes);
|
||||
- return model;
|
||||
+ return ret;
|
||||
|
||||
error:
|
||||
ppc64ModelFree(model);
|
||||
- model = NULL;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
||||
-static int
|
||||
-ppc64ModelsLoad(struct ppc64_map *map,
|
||||
- xmlXPathContextPtr ctxt,
|
||||
- xmlNodePtr *nodes,
|
||||
- int n)
|
||||
-{
|
||||
- struct ppc64_model *model;
|
||||
- size_t i;
|
||||
-
|
||||
- if (VIR_ALLOC_N(map->models, n) < 0)
|
||||
- return -1;
|
||||
-
|
||||
- for (i = 0; i < n; i++) {
|
||||
- ctxt->node = nodes[i];
|
||||
- if (!(model = ppc64ModelParse(ctxt, map)))
|
||||
- return -1;
|
||||
- map->models[map->nmodels++] = model;
|
||||
- }
|
||||
-
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
-
|
||||
-static int
|
||||
-ppc64MapLoadCallback(cpuMapElement element,
|
||||
- xmlXPathContextPtr ctxt,
|
||||
- xmlNodePtr *nodes,
|
||||
- int n,
|
||||
- void *data)
|
||||
-{
|
||||
- struct ppc64_map *map = data;
|
||||
-
|
||||
- switch (element) {
|
||||
- case CPU_MAP_ELEMENT_VENDOR:
|
||||
- return ppc64VendorsLoad(map, ctxt, nodes, n);
|
||||
- case CPU_MAP_ELEMENT_MODEL:
|
||||
- return ppc64ModelsLoad(map, ctxt, nodes, n);
|
||||
- case CPU_MAP_ELEMENT_FEATURE:
|
||||
- case CPU_MAP_ELEMENT_LAST:
|
||||
- break;
|
||||
- }
|
||||
-
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
static struct ppc64_map *
|
||||
ppc64LoadMap(void)
|
||||
{
|
||||
@@ -475,7 +411,7 @@ ppc64LoadMap(void)
|
||||
if (VIR_ALLOC(map) < 0)
|
||||
goto error;
|
||||
|
||||
- if (cpuMapLoad("ppc64", ppc64MapLoadCallback, map) < 0)
|
||||
+ if (cpuMapLoad("ppc64", ppc64VendorParse, NULL, ppc64ModelParse, map) < 0)
|
||||
goto error;
|
||||
|
||||
return map;
|
||||
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
|
||||
index 124aa5fd5e..11dbd1e757 100644
|
||||
--- a/src/cpu/cpu_x86.c
|
||||
+++ b/src/cpu/cpu_x86.c
|
||||
@@ -720,22 +720,21 @@ x86VendorFind(virCPUx86MapPtr map,
|
||||
}
|
||||
|
||||
|
||||
-static virCPUx86VendorPtr
|
||||
+static int
|
||||
x86VendorParse(xmlXPathContextPtr ctxt,
|
||||
- virCPUx86MapPtr map)
|
||||
+ const char *name,
|
||||
+ void *data)
|
||||
{
|
||||
+ virCPUx86MapPtr map = data;
|
||||
virCPUx86VendorPtr vendor = NULL;
|
||||
char *string = NULL;
|
||||
+ int ret = -1;
|
||||
|
||||
if (VIR_ALLOC(vendor) < 0)
|
||||
goto error;
|
||||
|
||||
- vendor->name = virXPathString("string(@name)", ctxt);
|
||||
- if (!vendor->name) {
|
||||
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
- _("Missing CPU vendor name"));
|
||||
+ if (VIR_STRDUP(vendor->name, name) < 0)
|
||||
goto error;
|
||||
- }
|
||||
|
||||
if (x86VendorFind(map, vendor->name)) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
@@ -754,40 +753,21 @@ x86VendorParse(xmlXPathContextPtr ctxt,
|
||||
if (virCPUx86VendorToCPUID(string, &vendor->cpuid) < 0)
|
||||
goto error;
|
||||
|
||||
+ if (VIR_APPEND_ELEMENT(map->vendors, map->nvendors, vendor) < 0)
|
||||
+ goto error;
|
||||
+
|
||||
+ ret = 0;
|
||||
+
|
||||
cleanup:
|
||||
VIR_FREE(string);
|
||||
- return vendor;
|
||||
+ return ret;
|
||||
|
||||
error:
|
||||
x86VendorFree(vendor);
|
||||
- vendor = NULL;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
||||
-static int
|
||||
-x86VendorsLoad(virCPUx86MapPtr map,
|
||||
- xmlXPathContextPtr ctxt,
|
||||
- xmlNodePtr *nodes,
|
||||
- int n)
|
||||
-{
|
||||
- virCPUx86VendorPtr vendor;
|
||||
- size_t i;
|
||||
-
|
||||
- if (VIR_ALLOC_N(map->vendors, n) < 0)
|
||||
- return -1;
|
||||
-
|
||||
- for (i = 0; i < n; i++) {
|
||||
- ctxt->node = nodes[i];
|
||||
- if (!(vendor = x86VendorParse(ctxt, map)))
|
||||
- return -1;
|
||||
- map->vendors[map->nvendors++] = vendor;
|
||||
- }
|
||||
-
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
-
|
||||
static virCPUx86FeaturePtr
|
||||
x86FeatureNew(void)
|
||||
{
|
||||
@@ -909,27 +889,27 @@ x86ParseCPUID(xmlXPathContextPtr ctxt,
|
||||
}
|
||||
|
||||
|
||||
-static virCPUx86FeaturePtr
|
||||
+static int
|
||||
x86FeatureParse(xmlXPathContextPtr ctxt,
|
||||
- virCPUx86MapPtr map)
|
||||
+ const char *name,
|
||||
+ void *data)
|
||||
{
|
||||
+ virCPUx86MapPtr map = data;
|
||||
xmlNodePtr *nodes = NULL;
|
||||
virCPUx86FeaturePtr feature;
|
||||
virCPUx86CPUID cpuid;
|
||||
size_t i;
|
||||
int n;
|
||||
char *str = NULL;
|
||||
+ int ret = -1;
|
||||
|
||||
if (!(feature = x86FeatureNew()))
|
||||
goto error;
|
||||
|
||||
feature->migratable = true;
|
||||
- feature->name = virXPathString("string(@name)", ctxt);
|
||||
- if (!feature->name) {
|
||||
- virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
- "%s", _("Missing CPU feature name"));
|
||||
+
|
||||
+ if (VIR_STRDUP(feature->name, name) < 0)
|
||||
goto error;
|
||||
- }
|
||||
|
||||
if (x86FeatureFind(map, feature->name)) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
@@ -957,46 +937,28 @@ x86FeatureParse(xmlXPathContextPtr ctxt,
|
||||
goto error;
|
||||
}
|
||||
|
||||
+ if (!feature->migratable &&
|
||||
+ VIR_APPEND_ELEMENT_COPY(map->migrate_blockers,
|
||||
+ map->nblockers,
|
||||
+ feature) < 0)
|
||||
+ goto error;
|
||||
+
|
||||
+ if (VIR_APPEND_ELEMENT(map->features, map->nfeatures, feature) < 0)
|
||||
+ goto error;
|
||||
+
|
||||
+ ret = 0;
|
||||
+
|
||||
cleanup:
|
||||
VIR_FREE(nodes);
|
||||
VIR_FREE(str);
|
||||
- return feature;
|
||||
+ return ret;
|
||||
|
||||
error:
|
||||
x86FeatureFree(feature);
|
||||
- feature = NULL;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
||||
-static int
|
||||
-x86FeaturesLoad(virCPUx86MapPtr map,
|
||||
- xmlXPathContextPtr ctxt,
|
||||
- xmlNodePtr *nodes,
|
||||
- int n)
|
||||
-{
|
||||
- virCPUx86FeaturePtr feature;
|
||||
- size_t i;
|
||||
-
|
||||
- if (VIR_ALLOC_N(map->features, n) < 0)
|
||||
- return -1;
|
||||
-
|
||||
- for (i = 0; i < n; i++) {
|
||||
- ctxt->node = nodes[i];
|
||||
- if (!(feature = x86FeatureParse(ctxt, map)))
|
||||
- return -1;
|
||||
- map->features[map->nfeatures++] = feature;
|
||||
- if (!feature->migratable &&
|
||||
- VIR_APPEND_ELEMENT(map->migrate_blockers,
|
||||
- map->nblockers,
|
||||
- feature) < 0)
|
||||
- return -1;
|
||||
- }
|
||||
-
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
-
|
||||
static virCPUx86ModelPtr
|
||||
x86ModelNew(void)
|
||||
{
|
||||
@@ -1192,47 +1154,46 @@ x86ModelCompare(virCPUx86ModelPtr model1,
|
||||
}
|
||||
|
||||
|
||||
-static virCPUx86ModelPtr
|
||||
+static int
|
||||
x86ModelParse(xmlXPathContextPtr ctxt,
|
||||
- virCPUx86MapPtr map)
|
||||
+ const char *name,
|
||||
+ void *data)
|
||||
{
|
||||
+ virCPUx86MapPtr map = data;
|
||||
xmlNodePtr *nodes = NULL;
|
||||
virCPUx86ModelPtr model;
|
||||
char *vendor = NULL;
|
||||
size_t i;
|
||||
int n;
|
||||
+ int ret = -1;
|
||||
|
||||
if (!(model = x86ModelNew()))
|
||||
goto error;
|
||||
|
||||
- model->name = virXPathString("string(@name)", ctxt);
|
||||
- if (!model->name) {
|
||||
- virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
- "%s", _("Missing CPU model name"));
|
||||
+ if (VIR_STRDUP(model->name, name) < 0)
|
||||
goto error;
|
||||
- }
|
||||
|
||||
if (virXPathNode("./model", ctxt)) {
|
||||
virCPUx86ModelPtr ancestor;
|
||||
- char *name;
|
||||
+ char *anname;
|
||||
|
||||
- name = virXPathString("string(./model/@name)", ctxt);
|
||||
- if (!name) {
|
||||
+ anname = virXPathString("string(./model/@name)", ctxt);
|
||||
+ if (!anname) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Missing ancestor's name in CPU model %s"),
|
||||
model->name);
|
||||
goto error;
|
||||
}
|
||||
|
||||
- if (!(ancestor = x86ModelFind(map, name))) {
|
||||
+ if (!(ancestor = x86ModelFind(map, anname))) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Ancestor model %s not found for CPU model %s"),
|
||||
- name, model->name);
|
||||
- VIR_FREE(name);
|
||||
+ anname, model->name);
|
||||
+ VIR_FREE(anname);
|
||||
goto error;
|
||||
}
|
||||
|
||||
- VIR_FREE(name);
|
||||
+ VIR_FREE(anname);
|
||||
|
||||
model->vendor = ancestor->vendor;
|
||||
model->signature = ancestor->signature;
|
||||
@@ -1287,62 +1248,43 @@ x86ModelParse(xmlXPathContextPtr ctxt,
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
virCPUx86FeaturePtr feature;
|
||||
- char *name;
|
||||
+ char *ftname;
|
||||
|
||||
- if (!(name = virXMLPropString(nodes[i], "name"))) {
|
||||
+ if (!(ftname = virXMLPropString(nodes[i], "name"))) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Missing feature name for CPU model %s"), model->name);
|
||||
goto error;
|
||||
}
|
||||
|
||||
- if (!(feature = x86FeatureFind(map, name))) {
|
||||
+ if (!(feature = x86FeatureFind(map, ftname))) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Feature %s required by CPU model %s not found"),
|
||||
- name, model->name);
|
||||
- VIR_FREE(name);
|
||||
+ ftname, model->name);
|
||||
+ VIR_FREE(ftname);
|
||||
goto error;
|
||||
}
|
||||
- VIR_FREE(name);
|
||||
+ VIR_FREE(ftname);
|
||||
|
||||
if (x86DataAdd(&model->data, &feature->data))
|
||||
goto error;
|
||||
}
|
||||
|
||||
+ if (VIR_APPEND_ELEMENT(map->models, map->nmodels, model) < 0)
|
||||
+ goto error;
|
||||
+
|
||||
+ ret = 0;
|
||||
+
|
||||
cleanup:
|
||||
VIR_FREE(vendor);
|
||||
VIR_FREE(nodes);
|
||||
- return model;
|
||||
+ return ret;
|
||||
|
||||
error:
|
||||
x86ModelFree(model);
|
||||
- model = NULL;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
||||
-static int
|
||||
-x86ModelsLoad(virCPUx86MapPtr map,
|
||||
- xmlXPathContextPtr ctxt,
|
||||
- xmlNodePtr *nodes,
|
||||
- int n)
|
||||
-{
|
||||
- virCPUx86ModelPtr model;
|
||||
- size_t i;
|
||||
-
|
||||
- if (VIR_ALLOC_N(map->models, n) < 0)
|
||||
- return -1;
|
||||
-
|
||||
- for (i = 0; i < n; i++) {
|
||||
- ctxt->node = nodes[i];
|
||||
- if (!(model = x86ModelParse(ctxt, map)))
|
||||
- return -1;
|
||||
- map->models[map->nmodels++] = model;
|
||||
- }
|
||||
-
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
-
|
||||
static void
|
||||
x86MapFree(virCPUx86MapPtr map)
|
||||
{
|
||||
@@ -1372,30 +1314,6 @@ x86MapFree(virCPUx86MapPtr map)
|
||||
}
|
||||
|
||||
|
||||
-static int
|
||||
-x86MapLoadCallback(cpuMapElement element,
|
||||
- xmlXPathContextPtr ctxt,
|
||||
- xmlNodePtr *nodes,
|
||||
- int n,
|
||||
- void *data)
|
||||
-{
|
||||
- virCPUx86MapPtr map = data;
|
||||
-
|
||||
- switch (element) {
|
||||
- case CPU_MAP_ELEMENT_VENDOR:
|
||||
- return x86VendorsLoad(map, ctxt, nodes, n);
|
||||
- case CPU_MAP_ELEMENT_FEATURE:
|
||||
- return x86FeaturesLoad(map, ctxt, nodes, n);
|
||||
- case CPU_MAP_ELEMENT_MODEL:
|
||||
- return x86ModelsLoad(map, ctxt, nodes, n);
|
||||
- case CPU_MAP_ELEMENT_LAST:
|
||||
- break;
|
||||
- }
|
||||
-
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
-
|
||||
static virCPUx86MapPtr
|
||||
virCPUx86LoadMap(void)
|
||||
{
|
||||
@@ -1404,7 +1322,7 @@ virCPUx86LoadMap(void)
|
||||
if (VIR_ALLOC(map) < 0)
|
||||
return NULL;
|
||||
|
||||
- if (cpuMapLoad("x86", x86MapLoadCallback, map) < 0)
|
||||
+ if (cpuMapLoad("x86", x86VendorParse, x86FeatureParse, x86ModelParse, map) < 0)
|
||||
goto error;
|
||||
|
||||
return map;
|
||||
--
|
||||
2.22.0
|
||||
|
397
SOURCES/libvirt-cpu-simplify-failure-cleanup-paths.patch
Normal file
397
SOURCES/libvirt-cpu-simplify-failure-cleanup-paths.patch
Normal file
@ -0,0 +1,397 @@
|
||||
From 85d367abe6063225117cc27c85e01e36a7b70409 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <85d367abe6063225117cc27c85e01e36a7b70409@dist-git>
|
||||
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
|
||||
Date: Fri, 21 Jun 2019 09:24:47 +0200
|
||||
Subject: [PATCH] cpu: simplify failure cleanup paths
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Get rid of the separate 'error:' label, so all code paths jump straight
|
||||
to the 'cleanup:' label.
|
||||
|
||||
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||
(cherry picked from commit 18cab54c3a0bc72390f29300684396690a7ecf51)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1686895
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Message-Id: <40ff4abfea153cf8210286a84967c3ca7850b775.1561068591.git.jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
src/cpu/cpu_ppc64.c | 38 ++++++++++++------------
|
||||
src/cpu/cpu_x86.c | 71 ++++++++++++++++++++-------------------------
|
||||
2 files changed, 49 insertions(+), 60 deletions(-)
|
||||
|
||||
diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c
|
||||
index 75da5b77d8..fcba7e9b37 100644
|
||||
--- a/src/cpu/cpu_ppc64.c
|
||||
+++ b/src/cpu/cpu_ppc64.c
|
||||
@@ -288,27 +288,28 @@ ppc64VendorParse(xmlXPathContextPtr ctxt ATTRIBUTE_UNUSED,
|
||||
{
|
||||
struct ppc64_map *map = data;
|
||||
struct ppc64_vendor *vendor;
|
||||
+ int ret = -1;
|
||||
|
||||
if (VIR_ALLOC(vendor) < 0)
|
||||
return -1;
|
||||
|
||||
if (VIR_STRDUP(vendor->name, name) < 0)
|
||||
- goto error;
|
||||
+ goto cleanup;
|
||||
|
||||
if (ppc64VendorFind(map, vendor->name)) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("CPU vendor %s already defined"), vendor->name);
|
||||
- goto error;
|
||||
+ goto cleanup;
|
||||
}
|
||||
|
||||
if (VIR_APPEND_ELEMENT(map->vendors, map->nvendors, vendor) < 0)
|
||||
- goto error;
|
||||
+ goto cleanup;
|
||||
|
||||
- return 0;
|
||||
+ ret = 0;
|
||||
|
||||
- error:
|
||||
+ cleanup:
|
||||
ppc64VendorFree(vendor);
|
||||
- return -1;
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -327,15 +328,15 @@ ppc64ModelParse(xmlXPathContextPtr ctxt,
|
||||
int ret = -1;
|
||||
|
||||
if (VIR_ALLOC(model) < 0)
|
||||
- goto error;
|
||||
+ goto cleanup;
|
||||
|
||||
if (VIR_STRDUP(model->name, name) < 0)
|
||||
- goto error;
|
||||
+ goto cleanup;
|
||||
|
||||
if (ppc64ModelFind(map, model->name)) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("CPU model %s already defined"), model->name);
|
||||
- goto error;
|
||||
+ goto cleanup;
|
||||
}
|
||||
|
||||
if (virXPathBoolean("boolean(./vendor)", ctxt)) {
|
||||
@@ -344,14 +345,14 @@ ppc64ModelParse(xmlXPathContextPtr ctxt,
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Invalid vendor element in CPU model %s"),
|
||||
model->name);
|
||||
- goto error;
|
||||
+ goto cleanup;
|
||||
}
|
||||
|
||||
if (!(model->vendor = ppc64VendorFind(map, vendor))) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Unknown vendor %s referenced by CPU model %s"),
|
||||
vendor, model->name);
|
||||
- goto error;
|
||||
+ goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -359,11 +360,11 @@ ppc64ModelParse(xmlXPathContextPtr ctxt,
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Missing PVR information for CPU model %s"),
|
||||
model->name);
|
||||
- goto error;
|
||||
+ goto cleanup;
|
||||
}
|
||||
|
||||
if (VIR_ALLOC_N(model->data.pvr, n) < 0)
|
||||
- goto error;
|
||||
+ goto cleanup;
|
||||
|
||||
model->data.len = n;
|
||||
|
||||
@@ -374,7 +375,7 @@ ppc64ModelParse(xmlXPathContextPtr ctxt,
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Missing or invalid PVR value in CPU model %s"),
|
||||
model->name);
|
||||
- goto error;
|
||||
+ goto cleanup;
|
||||
}
|
||||
model->data.pvr[i].value = pvr;
|
||||
|
||||
@@ -382,24 +383,21 @@ ppc64ModelParse(xmlXPathContextPtr ctxt,
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Missing or invalid PVR mask in CPU model %s"),
|
||||
model->name);
|
||||
- goto error;
|
||||
+ goto cleanup;
|
||||
}
|
||||
model->data.pvr[i].mask = pvr;
|
||||
}
|
||||
|
||||
if (VIR_APPEND_ELEMENT(map->models, map->nmodels, model) < 0)
|
||||
- goto error;
|
||||
+ goto cleanup;
|
||||
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
+ ppc64ModelFree(model);
|
||||
VIR_FREE(vendor);
|
||||
VIR_FREE(nodes);
|
||||
return ret;
|
||||
-
|
||||
- error:
|
||||
- ppc64ModelFree(model);
|
||||
- goto cleanup;
|
||||
}
|
||||
|
||||
|
||||
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
|
||||
index 11dbd1e757..ce48ca6867 100644
|
||||
--- a/src/cpu/cpu_x86.c
|
||||
+++ b/src/cpu/cpu_x86.c
|
||||
@@ -731,15 +731,15 @@ x86VendorParse(xmlXPathContextPtr ctxt,
|
||||
int ret = -1;
|
||||
|
||||
if (VIR_ALLOC(vendor) < 0)
|
||||
- goto error;
|
||||
+ goto cleanup;
|
||||
|
||||
if (VIR_STRDUP(vendor->name, name) < 0)
|
||||
- goto error;
|
||||
+ goto cleanup;
|
||||
|
||||
if (x86VendorFind(map, vendor->name)) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("CPU vendor %s already defined"), vendor->name);
|
||||
- goto error;
|
||||
+ goto cleanup;
|
||||
}
|
||||
|
||||
string = virXPathString("string(@string)", ctxt);
|
||||
@@ -747,24 +747,21 @@ x86VendorParse(xmlXPathContextPtr ctxt,
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Missing vendor string for CPU vendor %s"),
|
||||
vendor->name);
|
||||
- goto error;
|
||||
+ goto cleanup;
|
||||
}
|
||||
|
||||
if (virCPUx86VendorToCPUID(string, &vendor->cpuid) < 0)
|
||||
- goto error;
|
||||
+ goto cleanup;
|
||||
|
||||
if (VIR_APPEND_ELEMENT(map->vendors, map->nvendors, vendor) < 0)
|
||||
- goto error;
|
||||
+ goto cleanup;
|
||||
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
+ x86VendorFree(vendor);
|
||||
VIR_FREE(string);
|
||||
return ret;
|
||||
-
|
||||
- error:
|
||||
- x86VendorFree(vendor);
|
||||
- goto cleanup;
|
||||
}
|
||||
|
||||
|
||||
@@ -904,17 +901,17 @@ x86FeatureParse(xmlXPathContextPtr ctxt,
|
||||
int ret = -1;
|
||||
|
||||
if (!(feature = x86FeatureNew()))
|
||||
- goto error;
|
||||
+ goto cleanup;
|
||||
|
||||
feature->migratable = true;
|
||||
|
||||
if (VIR_STRDUP(feature->name, name) < 0)
|
||||
- goto error;
|
||||
+ goto cleanup;
|
||||
|
||||
if (x86FeatureFind(map, feature->name)) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("CPU feature %s already defined"), feature->name);
|
||||
- goto error;
|
||||
+ goto cleanup;
|
||||
}
|
||||
|
||||
str = virXPathString("string(@migratable)", ctxt);
|
||||
@@ -923,7 +920,7 @@ x86FeatureParse(xmlXPathContextPtr ctxt,
|
||||
|
||||
n = virXPathNodeSet("./cpuid", ctxt, &nodes);
|
||||
if (n < 0)
|
||||
- goto error;
|
||||
+ goto cleanup;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
ctxt->node = nodes[i];
|
||||
@@ -931,31 +928,28 @@ x86FeatureParse(xmlXPathContextPtr ctxt,
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Invalid cpuid[%zu] in %s feature"),
|
||||
i, feature->name);
|
||||
- goto error;
|
||||
+ goto cleanup;
|
||||
}
|
||||
if (virCPUx86DataAddCPUIDInt(&feature->data, &cpuid))
|
||||
- goto error;
|
||||
+ goto cleanup;
|
||||
}
|
||||
|
||||
if (!feature->migratable &&
|
||||
VIR_APPEND_ELEMENT_COPY(map->migrate_blockers,
|
||||
map->nblockers,
|
||||
feature) < 0)
|
||||
- goto error;
|
||||
+ goto cleanup;
|
||||
|
||||
if (VIR_APPEND_ELEMENT(map->features, map->nfeatures, feature) < 0)
|
||||
- goto error;
|
||||
+ goto cleanup;
|
||||
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
+ x86FeatureFree(feature);
|
||||
VIR_FREE(nodes);
|
||||
VIR_FREE(str);
|
||||
return ret;
|
||||
-
|
||||
- error:
|
||||
- x86FeatureFree(feature);
|
||||
- goto cleanup;
|
||||
}
|
||||
|
||||
|
||||
@@ -1168,10 +1162,10 @@ x86ModelParse(xmlXPathContextPtr ctxt,
|
||||
int ret = -1;
|
||||
|
||||
if (!(model = x86ModelNew()))
|
||||
- goto error;
|
||||
+ goto cleanup;
|
||||
|
||||
if (VIR_STRDUP(model->name, name) < 0)
|
||||
- goto error;
|
||||
+ goto cleanup;
|
||||
|
||||
if (virXPathNode("./model", ctxt)) {
|
||||
virCPUx86ModelPtr ancestor;
|
||||
@@ -1182,7 +1176,7 @@ x86ModelParse(xmlXPathContextPtr ctxt,
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Missing ancestor's name in CPU model %s"),
|
||||
model->name);
|
||||
- goto error;
|
||||
+ goto cleanup;
|
||||
}
|
||||
|
||||
if (!(ancestor = x86ModelFind(map, anname))) {
|
||||
@@ -1190,7 +1184,7 @@ x86ModelParse(xmlXPathContextPtr ctxt,
|
||||
_("Ancestor model %s not found for CPU model %s"),
|
||||
anname, model->name);
|
||||
VIR_FREE(anname);
|
||||
- goto error;
|
||||
+ goto cleanup;
|
||||
}
|
||||
|
||||
VIR_FREE(anname);
|
||||
@@ -1198,7 +1192,7 @@ x86ModelParse(xmlXPathContextPtr ctxt,
|
||||
model->vendor = ancestor->vendor;
|
||||
model->signature = ancestor->signature;
|
||||
if (x86DataCopy(&model->data, &ancestor->data) < 0)
|
||||
- goto error;
|
||||
+ goto cleanup;
|
||||
}
|
||||
|
||||
if (virXPathBoolean("boolean(./signature)", ctxt)) {
|
||||
@@ -1211,7 +1205,7 @@ x86ModelParse(xmlXPathContextPtr ctxt,
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Invalid CPU signature family in model %s"),
|
||||
model->name);
|
||||
- goto error;
|
||||
+ goto cleanup;
|
||||
}
|
||||
|
||||
rc = virXPathUInt("string(./signature/@model)", ctxt, &sigModel);
|
||||
@@ -1219,7 +1213,7 @@ x86ModelParse(xmlXPathContextPtr ctxt,
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Invalid CPU signature model in model %s"),
|
||||
model->name);
|
||||
- goto error;
|
||||
+ goto cleanup;
|
||||
}
|
||||
|
||||
model->signature = x86MakeSignature(sigFamily, sigModel, 0);
|
||||
@@ -1231,20 +1225,20 @@ x86ModelParse(xmlXPathContextPtr ctxt,
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Invalid vendor element in CPU model %s"),
|
||||
model->name);
|
||||
- goto error;
|
||||
+ goto cleanup;
|
||||
}
|
||||
|
||||
if (!(model->vendor = x86VendorFind(map, vendor))) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Unknown vendor %s referenced by CPU model %s"),
|
||||
vendor, model->name);
|
||||
- goto error;
|
||||
+ goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
n = virXPathNodeSet("./feature", ctxt, &nodes);
|
||||
if (n < 0)
|
||||
- goto error;
|
||||
+ goto cleanup;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
virCPUx86FeaturePtr feature;
|
||||
@@ -1253,7 +1247,7 @@ x86ModelParse(xmlXPathContextPtr ctxt,
|
||||
if (!(ftname = virXMLPropString(nodes[i], "name"))) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Missing feature name for CPU model %s"), model->name);
|
||||
- goto error;
|
||||
+ goto cleanup;
|
||||
}
|
||||
|
||||
if (!(feature = x86FeatureFind(map, ftname))) {
|
||||
@@ -1261,27 +1255,24 @@ x86ModelParse(xmlXPathContextPtr ctxt,
|
||||
_("Feature %s required by CPU model %s not found"),
|
||||
ftname, model->name);
|
||||
VIR_FREE(ftname);
|
||||
- goto error;
|
||||
+ goto cleanup;
|
||||
}
|
||||
VIR_FREE(ftname);
|
||||
|
||||
if (x86DataAdd(&model->data, &feature->data))
|
||||
- goto error;
|
||||
+ goto cleanup;
|
||||
}
|
||||
|
||||
if (VIR_APPEND_ELEMENT(map->models, map->nmodels, model) < 0)
|
||||
- goto error;
|
||||
+ goto cleanup;
|
||||
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
+ x86ModelFree(model);
|
||||
VIR_FREE(vendor);
|
||||
VIR_FREE(nodes);
|
||||
return ret;
|
||||
-
|
||||
- error:
|
||||
- x86ModelFree(model);
|
||||
- goto cleanup;
|
||||
}
|
||||
|
||||
|
||||
--
|
||||
2.22.0
|
||||
|
@ -0,0 +1,91 @@
|
||||
From 296ff8fbba31a8052bdf24e409b0bb9e3c041c8f Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <296ff8fbba31a8052bdf24e409b0bb9e3c041c8f@dist-git>
|
||||
From: Jiri Denemark <jdenemar@redhat.com>
|
||||
Date: Fri, 21 Jun 2019 09:25:46 +0200
|
||||
Subject: [PATCH] cpu_conf: Introduce virCPUDefFilterFeatures
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This new internal API can be used for in place filtering of CPU features
|
||||
in virCPUDef.
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit c145b660b8225f73db16660461077ef931730939)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1697627
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Message-Id: <b3bd18c6e9cdf5256a7369bd06e5f773e160d9f3.1561068591.git.jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
src/conf/cpu_conf.c | 22 ++++++++++++++++++++++
|
||||
src/conf/cpu_conf.h | 5 +++++
|
||||
src/libvirt_private.syms | 1 +
|
||||
3 files changed, 28 insertions(+)
|
||||
|
||||
diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
|
||||
index 43a3ab5dcd..51e2a83eae 100644
|
||||
--- a/src/conf/cpu_conf.c
|
||||
+++ b/src/conf/cpu_conf.c
|
||||
@@ -850,6 +850,28 @@ virCPUDefFindFeature(virCPUDefPtr def,
|
||||
}
|
||||
|
||||
|
||||
+int
|
||||
+virCPUDefFilterFeatures(virCPUDefPtr cpu,
|
||||
+ virCPUDefFeatureFilter filter,
|
||||
+ void *opaque)
|
||||
+{
|
||||
+ size_t i = 0;
|
||||
+
|
||||
+ while (i < cpu->nfeatures) {
|
||||
+ if (filter(cpu->features[i].name, opaque)) {
|
||||
+ i++;
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ VIR_FREE(cpu->features[i].name);
|
||||
+ if (VIR_DELETE_ELEMENT_INPLACE(cpu->features, i, cpu->nfeatures) < 0)
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
bool
|
||||
virCPUDefIsEqual(virCPUDefPtr src,
|
||||
virCPUDefPtr dst,
|
||||
diff --git a/src/conf/cpu_conf.h b/src/conf/cpu_conf.h
|
||||
index 9f2e7ee264..ad25932b9b 100644
|
||||
--- a/src/conf/cpu_conf.h
|
||||
+++ b/src/conf/cpu_conf.h
|
||||
@@ -220,6 +220,11 @@ virCPUFeatureDefPtr
|
||||
virCPUDefFindFeature(virCPUDefPtr def,
|
||||
const char *name);
|
||||
|
||||
+int
|
||||
+virCPUDefFilterFeatures(virCPUDefPtr cpu,
|
||||
+ virCPUDefFeatureFilter filter,
|
||||
+ void *opaque);
|
||||
+
|
||||
virCPUDefPtr *
|
||||
virCPUDefListParse(const char **xmlCPUs,
|
||||
unsigned int ncpus,
|
||||
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
|
||||
index 9ebc5384fb..57508de0c1 100644
|
||||
--- a/src/libvirt_private.syms
|
||||
+++ b/src/libvirt_private.syms
|
||||
@@ -76,6 +76,7 @@ virCPUDefCopy;
|
||||
virCPUDefCopyModel;
|
||||
virCPUDefCopyModelFilter;
|
||||
virCPUDefCopyWithoutModel;
|
||||
+virCPUDefFilterFeatures;
|
||||
virCPUDefFindFeature;
|
||||
virCPUDefFormat;
|
||||
virCPUDefFormatBuf;
|
||||
--
|
||||
2.22.0
|
||||
|
@ -0,0 +1,165 @@
|
||||
From acb2d441abd4b584c40748cbaf4f6f7a376753aa Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <acb2d441abd4b584c40748cbaf4f6f7a376753aa@dist-git>
|
||||
From: Jiri Denemark <jdenemar@redhat.com>
|
||||
Date: Fri, 15 Nov 2019 17:52:32 +0100
|
||||
Subject: [PATCH] cpu_conf: Pass policy to CPU feature filtering callbacks
|
||||
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 668797dc5cb474585609559dbe610e09517e23e6)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1749672
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1756156
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1721608
|
||||
|
||||
Conflicts:
|
||||
src/cpu/cpu_x86.c
|
||||
src/qemu/qemu_capabilities.c
|
||||
- no glib stuff downstream
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Message-Id: <e35cd40bd84f7304288051c24fa0d4581c3d43cb.1573836581.git.jdenemar@redhat.com>
|
||||
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
---
|
||||
src/conf/cpu_conf.c | 6 +++---
|
||||
src/conf/cpu_conf.h | 1 +
|
||||
src/cpu/cpu_x86.c | 13 ++++++++++++-
|
||||
src/cpu/cpu_x86.h | 2 ++
|
||||
src/qemu/qemu_capabilities.c | 1 +
|
||||
src/qemu/qemu_capabilities.h | 1 +
|
||||
6 files changed, 20 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
|
||||
index 4cccea9981..d4e3c81145 100644
|
||||
--- a/src/conf/cpu_conf.c
|
||||
+++ b/src/conf/cpu_conf.c
|
||||
@@ -135,7 +135,7 @@ virCPUDefCopyModelFilter(virCPUDefPtr dst,
|
||||
dst->nfeatures = 0;
|
||||
|
||||
for (i = 0; i < src->nfeatures; i++) {
|
||||
- if (filter && !filter(src->features[i].name, opaque))
|
||||
+ if (filter && !filter(src->features[i].name, src->features[i].policy, opaque))
|
||||
continue;
|
||||
|
||||
n = dst->nfeatures++;
|
||||
@@ -858,7 +858,7 @@ virCPUDefFilterFeatures(virCPUDefPtr cpu,
|
||||
size_t i = 0;
|
||||
|
||||
while (i < cpu->nfeatures) {
|
||||
- if (filter(cpu->features[i].name, opaque)) {
|
||||
+ if (filter(cpu->features[i].name, cpu->features[i].policy, opaque)) {
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
@@ -893,7 +893,7 @@ virCPUDefCheckFeatures(virCPUDefPtr cpu,
|
||||
*features = NULL;
|
||||
|
||||
for (i = 0; i < cpu->nfeatures; i++) {
|
||||
- if (filter(cpu->features[i].name, opaque)) {
|
||||
+ if (filter(cpu->features[i].name, cpu->features[i].policy, opaque)) {
|
||||
if (virStringListAdd(&list, cpu->features[i].name) < 0)
|
||||
return -1;
|
||||
n++;
|
||||
diff --git a/src/conf/cpu_conf.h b/src/conf/cpu_conf.h
|
||||
index cba0ec7c81..687e1b09d2 100644
|
||||
--- a/src/conf/cpu_conf.h
|
||||
+++ b/src/conf/cpu_conf.h
|
||||
@@ -162,6 +162,7 @@ virCPUDefCopyModel(virCPUDefPtr dst,
|
||||
* Returns true if feature @name should copied, false otherwise.
|
||||
*/
|
||||
typedef bool (*virCPUDefFeatureFilter)(const char *name,
|
||||
+ virCPUFeaturePolicy policy,
|
||||
void *opaque);
|
||||
|
||||
int
|
||||
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
|
||||
index 9104bdbf1e..cf5ef442e7 100644
|
||||
--- a/src/cpu/cpu_x86.c
|
||||
+++ b/src/cpu/cpu_x86.c
|
||||
@@ -3260,6 +3260,15 @@ virCPUx86ExpandFeatures(virCPUDefPtr cpu)
|
||||
}
|
||||
|
||||
|
||||
+static bool
|
||||
+x86FeatureFilterMigratable(const char *name,
|
||||
+ virCPUFeaturePolicy policy ATTRIBUTE_UNUSED,
|
||||
+ void *cpu_map)
|
||||
+{
|
||||
+ return x86FeatureIsMigratable(name, cpu_map);
|
||||
+}
|
||||
+
|
||||
+
|
||||
static virCPUDefPtr
|
||||
virCPUx86CopyMigratable(virCPUDefPtr cpu)
|
||||
{
|
||||
@@ -3273,7 +3282,7 @@ virCPUx86CopyMigratable(virCPUDefPtr cpu)
|
||||
return NULL;
|
||||
|
||||
if (virCPUDefCopyModelFilter(copy, cpu, false,
|
||||
- x86FeatureIsMigratable, map) < 0)
|
||||
+ x86FeatureFilterMigratable, map) < 0)
|
||||
goto error;
|
||||
|
||||
return copy;
|
||||
@@ -3408,6 +3417,7 @@ virCPUx86FeatureIsMSR(const char *name)
|
||||
*/
|
||||
bool
|
||||
virCPUx86FeatureFilterSelectMSR(const char *name,
|
||||
+ virCPUFeaturePolicy policy ATTRIBUTE_UNUSED,
|
||||
void *opaque ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return virCPUx86FeatureIsMSR(name);
|
||||
@@ -3424,6 +3434,7 @@ virCPUx86FeatureFilterSelectMSR(const char *name,
|
||||
*/
|
||||
bool
|
||||
virCPUx86FeatureFilterDropMSR(const char *name,
|
||||
+ virCPUFeaturePolicy policy ATTRIBUTE_UNUSED,
|
||||
void *opaque ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return !virCPUx86FeatureIsMSR(name);
|
||||
diff --git a/src/cpu/cpu_x86.h b/src/cpu/cpu_x86.h
|
||||
index 5126679985..866fe17e88 100644
|
||||
--- a/src/cpu/cpu_x86.h
|
||||
+++ b/src/cpu/cpu_x86.h
|
||||
@@ -46,9 +46,11 @@ int virCPUx86DataSetVendor(virCPUDataPtr cpuData,
|
||||
const char *vendor);
|
||||
|
||||
bool virCPUx86FeatureFilterSelectMSR(const char *name,
|
||||
+ virCPUFeaturePolicy policy,
|
||||
void *opaque);
|
||||
|
||||
bool virCPUx86FeatureFilterDropMSR(const char *name,
|
||||
+ virCPUFeaturePolicy policy,
|
||||
void *opaque);
|
||||
|
||||
#endif /* __VIR_CPU_X86_H__ */
|
||||
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
|
||||
index fbfe74d45b..c25d8c3e1a 100644
|
||||
--- a/src/qemu/qemu_capabilities.c
|
||||
+++ b/src/qemu/qemu_capabilities.c
|
||||
@@ -2753,6 +2753,7 @@ virQEMUCapsProbeQMPSEVCapabilities(virQEMUCapsPtr qemuCaps,
|
||||
|
||||
bool
|
||||
virQEMUCapsCPUFilterFeatures(const char *name,
|
||||
+ virCPUFeaturePolicy policy ATTRIBUTE_UNUSED,
|
||||
void *opaque)
|
||||
{
|
||||
virArch *arch = opaque;
|
||||
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
|
||||
index 1767b2ab6c..a4055d5458 100644
|
||||
--- a/src/qemu/qemu_capabilities.h
|
||||
+++ b/src/qemu/qemu_capabilities.h
|
||||
@@ -629,6 +629,7 @@ bool virQEMUCapsGuestIsNative(virArch host,
|
||||
virArch guest);
|
||||
|
||||
bool virQEMUCapsCPUFilterFeatures(const char *name,
|
||||
+ virCPUFeaturePolicy policy,
|
||||
void *opaque);
|
||||
|
||||
const char *
|
||||
--
|
||||
2.24.0
|
||||
|
211
SOURCES/libvirt-cpu_map-Add-Cascadelake-Server-CPU-model.patch
Normal file
211
SOURCES/libvirt-cpu_map-Add-Cascadelake-Server-CPU-model.patch
Normal file
@ -0,0 +1,211 @@
|
||||
From 6d31e77ae83bb2b29d3bff5bd08742ee4c611e25 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <6d31e77ae83bb2b29d3bff5bd08742ee4c611e25@dist-git>
|
||||
From: Jiri Denemark <jdenemar@redhat.com>
|
||||
Date: Fri, 21 Jun 2019 09:25:21 +0200
|
||||
Subject: [PATCH] cpu_map: Add Cascadelake-Server CPU model
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Introduced in QEMU 3.1.0 by commit
|
||||
c7a88b52f62b30c04158eeb07f73e3f72221b6a8
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit 2878278c74cc450a7e28a3830ed0ceff3126f12f)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1693433
|
||||
|
||||
Conflicts:
|
||||
src/cpu_map/index.xml
|
||||
src/cpu_map/x86_Cascadelake-Server.xml
|
||||
- cpu_map split not backported
|
||||
|
||||
tests/domaincapsschemadata/qemu_3.1.0.x86_64.xml
|
||||
tests/domaincapsschemadata/qemu_4.0.0.x86_64.xml
|
||||
- test data missing
|
||||
|
||||
tests/cputestdata/x86_64-cpuid-Xeon-Platinum-8268-guest.xml
|
||||
tests/cputestdata/x86_64-cpuid-Xeon-Platinum-8268-host.xml
|
||||
- md-clear feature did not exist at the time of the original
|
||||
patch, but downstream already has it
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Message-Id: <d99c9ab500eb9a482450ba87dec52f5f3cf03429.1561068591.git.jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
src/cpu/cpu_map.xml | 81 +++++++++++++++++++
|
||||
.../x86_64-cpuid-Xeon-Platinum-8268-guest.xml | 5 +-
|
||||
.../x86_64-cpuid-Xeon-Platinum-8268-host.xml | 5 +-
|
||||
.../x86_64-cpuid-Xeon-Platinum-8268-json.xml | 5 +-
|
||||
4 files changed, 84 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/src/cpu/cpu_map.xml b/src/cpu/cpu_map.xml
|
||||
index b2eb07b832..9b289556e8 100644
|
||||
--- a/src/cpu/cpu_map.xml
|
||||
+++ b/src/cpu/cpu_map.xml
|
||||
@@ -2193,6 +2193,87 @@
|
||||
<feature name='xsaveopt'/>
|
||||
</model>
|
||||
|
||||
+ <model name='Cascadelake-Server'>
|
||||
+ <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='hle'/>
|
||||
+ <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'/>
|
||||
+ <!-- 'ospke' is a dynamic feature and cannot be enabled manually
|
||||
+ see QEMU's commit 9ccb9784b57 for more details -->
|
||||
+ <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='rtm'/>
|
||||
+ <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>
|
||||
+
|
||||
<!-- AMD CPUs -->
|
||||
<model name='athlon'>
|
||||
<vendor name='AMD'/>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-8268-guest.xml b/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-8268-guest.xml
|
||||
index 2836481454..c7e8a1fccf 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-8268-guest.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-8268-guest.xml
|
||||
@@ -1,5 +1,5 @@
|
||||
<cpu mode='custom' match='exact'>
|
||||
- <model fallback='forbid'>Skylake-Server-IBRS</model>
|
||||
+ <model fallback='forbid'>Cascadelake-Server</model>
|
||||
<vendor>Intel</vendor>
|
||||
<feature policy='require' name='ds'/>
|
||||
<feature policy='require' name='acpi'/>
|
||||
@@ -20,15 +20,12 @@
|
||||
<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='avx512vnni'/>
|
||||
<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='mbm_total'/>
|
||||
<feature policy='require' name='mbm_local'/>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-8268-host.xml b/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-8268-host.xml
|
||||
index 032d8ffeca..d7482751b4 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-8268-host.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-8268-host.xml
|
||||
@@ -1,6 +1,6 @@
|
||||
<cpu>
|
||||
<arch>x86_64</arch>
|
||||
- <model>Skylake-Server-IBRS</model>
|
||||
+ <model>Cascadelake-Server</model>
|
||||
<vendor>Intel</vendor>
|
||||
<feature name='ds'/>
|
||||
<feature name='acpi'/>
|
||||
@@ -21,15 +21,12 @@
|
||||
<feature name='osxsave'/>
|
||||
<feature name='tsc_adjust'/>
|
||||
<feature name='cmt'/>
|
||||
- <feature name='clflushopt'/>
|
||||
<feature name='intel-pt'/>
|
||||
<feature name='pku'/>
|
||||
<feature name='ospke'/>
|
||||
- <feature name='avx512vnni'/>
|
||||
<feature name='md-clear'/>
|
||||
<feature name='stibp'/>
|
||||
<feature name='arch-capabilities'/>
|
||||
- <feature name='ssbd'/>
|
||||
<feature name='xsaves'/>
|
||||
<feature name='mbm_total'/>
|
||||
<feature name='mbm_local'/>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-8268-json.xml b/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-8268-json.xml
|
||||
index 12431de213..b7d12dced7 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-8268-json.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-8268-json.xml
|
||||
@@ -1,13 +1,10 @@
|
||||
<cpu mode='custom' match='exact'>
|
||||
- <model fallback='forbid'>Skylake-Server-IBRS</model>
|
||||
+ <model fallback='forbid'>Cascadelake-Server</model>
|
||||
<vendor>Intel</vendor>
|
||||
<feature policy='require' name='ss'/>
|
||||
<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='avx512vnni'/>
|
||||
- <feature policy='require' name='ssbd'/>
|
||||
<feature policy='require' name='xsaves'/>
|
||||
</cpu>
|
||||
--
|
||||
2.22.0
|
||||
|
219
SOURCES/libvirt-cpu_map-Add-Icelake-CPU-models.patch
Normal file
219
SOURCES/libvirt-cpu_map-Add-Icelake-CPU-models.patch
Normal file
@ -0,0 +1,219 @@
|
||||
From 08c5219ec08bf4383278e3de8e86768f5148f0e0 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <08c5219ec08bf4383278e3de8e86768f5148f0e0@dist-git>
|
||||
From: Jiri Denemark <jdenemar@redhat.com>
|
||||
Date: Wed, 29 Aug 2018 14:29:20 +0200
|
||||
Subject: [PATCH] cpu_map: Add Icelake CPU models
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Introduced in QEMU by commit v3.0.0-156-g8a11c62da9.
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
(cherry picked from commit 993d85ae5e2422a664ba5f700ed3bf7abd989cfc)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1526625
|
||||
|
||||
Conflicts:
|
||||
src/cpu_map/x86_Icelake-Client.xml
|
||||
src/cpu_map/x86_Icelake-Server.xml
|
||||
- cpu_map.xml is still monolithic in RHEL-8
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
src/cpu/cpu_map.xml | 178 ++++++++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 178 insertions(+)
|
||||
|
||||
diff --git a/src/cpu/cpu_map.xml b/src/cpu/cpu_map.xml
|
||||
index 4d19a7c811..cdb023e936 100644
|
||||
--- a/src/cpu/cpu_map.xml
|
||||
+++ b/src/cpu/cpu_map.xml
|
||||
@@ -1955,6 +1955,184 @@
|
||||
<feature name='xsaveopt'/>
|
||||
</model>
|
||||
|
||||
+ <model name='Icelake-Client'>
|
||||
+ <signature family='6' model='126'/>
|
||||
+ <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='hle'/>
|
||||
+ <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'/>
|
||||
+ <!-- 'ospke' is a dynamic feature and cannot be enabled manually
|
||||
+ see QEMU's commit 9ccb9784b57 for more details -->
|
||||
+ <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='rtm'/>
|
||||
+ <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>
|
||||
+
|
||||
+ <model name='Icelake-Server'>
|
||||
+ <signature family='6' model='134'/>
|
||||
+ <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='hle'/>
|
||||
+ <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'/>
|
||||
+ <!-- 'ospke' is a dynamic feature and cannot be enabled manually
|
||||
+ see QEMU's commit 9ccb9784b57 for more details -->
|
||||
+ <feature name='pae'/>
|
||||
+ <feature name='pat'/>
|
||||
+ <feature name='pcid'/>
|
||||
+ <feature name='pclmuldq'/>
|
||||
+ <feature name='pconfig'/>
|
||||
+ <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='rtm'/>
|
||||
+ <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>
|
||||
+
|
||||
<!-- AMD CPUs -->
|
||||
<model name='athlon'>
|
||||
<vendor name='AMD'/>
|
||||
--
|
||||
2.19.1
|
||||
|
@ -0,0 +1,47 @@
|
||||
From 06a798d6c6283b7041ec8fd631c1289b6fc1b29c Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <06a798d6c6283b7041ec8fd631c1289b6fc1b29c@dist-git>
|
||||
From: Jiri Denemark <jdenemar@redhat.com>
|
||||
Date: Fri, 13 Dec 2019 14:28:07 +0100
|
||||
Subject: [PATCH] cpu_map: Add TAA_NO bit for IA32_ARCH_CAPABILITIES MSR
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
CVE-2019-11135
|
||||
|
||||
CPUs with TAA_NO bit of IA32_ARCH_CAPABILITIES MSR set to 1 are not
|
||||
vulnerable to TSX Asynchronous Abort and passing this bit to a guest
|
||||
may avoid unnecessary mitigations.
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit 07aaced4e6ea6db8b27f44636f51cafa6f1847a8)
|
||||
|
||||
Conflicts:
|
||||
src/cpu_map/x86_features.xml
|
||||
- cpu_map is still monolithic downstream
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Message-Id: <0ff574a85f1cc7b53140d41a6a62254bea08a06f.1576243094.git.jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
src/cpu/cpu_map.xml | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/src/cpu/cpu_map.xml b/src/cpu/cpu_map.xml
|
||||
index 7b9f8bb452..c2b3fca47a 100644
|
||||
--- a/src/cpu/cpu_map.xml
|
||||
+++ b/src/cpu/cpu_map.xml
|
||||
@@ -501,6 +501,9 @@
|
||||
<feature name='mds-no'>
|
||||
<msr index='0x10a' edx='0x00000000' eax='0x00000020'/>
|
||||
</feature>
|
||||
+ <feature name='taa-no'>
|
||||
+ <msr index='0x10a' edx='0x00000000' eax='0x00000100'/>
|
||||
+ </feature>
|
||||
|
||||
<!-- models -->
|
||||
<model name='486'>
|
||||
--
|
||||
2.24.1
|
||||
|
@ -0,0 +1,46 @@
|
||||
From acc51748038a8074fe3a7c769b101455afd64eb7 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <acc51748038a8074fe3a7c769b101455afd64eb7@dist-git>
|
||||
From: Jiri Denemark <jdenemar@redhat.com>
|
||||
Date: Fri, 13 Dec 2019 14:28:08 +0100
|
||||
Subject: [PATCH] cpu_map: Add TSX_CTRL bit for IA32_ARCH_CAPABILITIES MSR
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
CVE-2019-11135
|
||||
|
||||
When TSX_CTRL bit of IA32_ARCH_CAPABILITIES MSR is set to 1, the CPU
|
||||
supports IA32_TSX_CTRL MSR which can be used to disable and/or mask TSX.
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit f411b7ef68221e82dec0129aaf2f2a26a8987504)
|
||||
|
||||
Conflicts:
|
||||
src/cpu_map/x86_features.xml
|
||||
- cpu_map is still monolithic downstream
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Message-Id: <cb4f05c8c84ed910bcd4bceae58f6fd090684031.1576243094.git.jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
src/cpu/cpu_map.xml | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/src/cpu/cpu_map.xml b/src/cpu/cpu_map.xml
|
||||
index c2b3fca47a..9609ce71a7 100644
|
||||
--- a/src/cpu/cpu_map.xml
|
||||
+++ b/src/cpu/cpu_map.xml
|
||||
@@ -501,6 +501,9 @@
|
||||
<feature name='mds-no'>
|
||||
<msr index='0x10a' edx='0x00000000' eax='0x00000020'/>
|
||||
</feature>
|
||||
+ <feature name='tsx-ctrl'>
|
||||
+ <msr index='0x10a' edx='0x00000000' eax='0x00000080'/>
|
||||
+ </feature>
|
||||
<feature name='taa-no'>
|
||||
<msr index='0x10a' edx='0x00000000' eax='0x00000100'/>
|
||||
</feature>
|
||||
--
|
||||
2.24.1
|
||||
|
379
SOURCES/libvirt-cpu_map-Add-features-for-Icelake-CPUs.patch
Normal file
379
SOURCES/libvirt-cpu_map-Add-features-for-Icelake-CPUs.patch
Normal file
@ -0,0 +1,379 @@
|
||||
From fe47728e25c3e12ea5b22a07902bf19a4b3afb43 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <fe47728e25c3e12ea5b22a07902bf19a4b3afb43@dist-git>
|
||||
From: Jiri Denemark <jdenemar@redhat.com>
|
||||
Date: Wed, 29 Aug 2018 14:28:39 +0200
|
||||
Subject: [PATCH] cpu_map: Add features for Icelake CPUs
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
QEMU commits:
|
||||
|
||||
e37a5c7fa4 (v2.12.0)
|
||||
i386: Add Intel Processor Trace feature support
|
||||
|
||||
c2f193b538 (v2.7.0)
|
||||
target-i386: Add support for UMIP and RDPID CPUID bits
|
||||
|
||||
aff9e6e46a (v2.12.0)
|
||||
x86/cpu: Enable new SSE/AVX/AVX512 cpu features
|
||||
|
||||
f77543772d (v2.9.0)
|
||||
x86: add AVX512_VPOPCNTDQ features
|
||||
|
||||
5131dc433d (v3.1.0)
|
||||
i386: Add CPUID bit for PCONFIG
|
||||
|
||||
59a80a19ca (v3.1.0)
|
||||
i386: Add CPUID bit for WBNOINVD
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
(cherry picked from commit 9813081119b6727c8b6067a783465addef06525e)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1526625
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1527657
|
||||
|
||||
Conflicts:
|
||||
src/cpu_map/x86_features.xml
|
||||
- cpu_map.xml is still monolithic in RHEL-8
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
src/cpu/cpu_map.xml | 33 +++++++++++++++++++
|
||||
.../x86_64-cpuid-Core-i5-6600-guest.xml | 1 +
|
||||
.../x86_64-cpuid-Core-i5-6600-host.xml | 1 +
|
||||
.../x86_64-cpuid-Core-i7-5600U-arat-guest.xml | 1 +
|
||||
.../x86_64-cpuid-Core-i7-5600U-arat-host.xml | 1 +
|
||||
.../x86_64-cpuid-Core-i7-5600U-guest.xml | 1 +
|
||||
.../x86_64-cpuid-Core-i7-5600U-host.xml | 1 +
|
||||
.../x86_64-cpuid-Core-i7-5600U-ibrs-guest.xml | 1 +
|
||||
.../x86_64-cpuid-Core-i7-5600U-ibrs-host.xml | 1 +
|
||||
.../x86_64-cpuid-Core-i7-7700-guest.xml | 1 +
|
||||
.../x86_64-cpuid-Core-i7-7700-host.xml | 1 +
|
||||
.../x86_64-cpuid-Xeon-E3-1245-v5-guest.xml | 1 +
|
||||
.../x86_64-cpuid-Xeon-E3-1245-v5-host.xml | 1 +
|
||||
.../x86_64-cpuid-Xeon-E5-2623-v4-guest.xml | 1 +
|
||||
.../x86_64-cpuid-Xeon-E5-2623-v4-host.xml | 1 +
|
||||
.../x86_64-cpuid-Xeon-E5-2650-v4-guest.xml | 1 +
|
||||
.../x86_64-cpuid-Xeon-E5-2650-v4-host.xml | 1 +
|
||||
.../x86_64-cpuid-Xeon-Gold-5115-guest.xml | 1 +
|
||||
.../x86_64-cpuid-Xeon-Gold-5115-host.xml | 1 +
|
||||
.../x86_64-cpuid-Xeon-Gold-6148-guest.xml | 1 +
|
||||
.../x86_64-cpuid-Xeon-Gold-6148-host.xml | 1 +
|
||||
21 files changed, 53 insertions(+)
|
||||
|
||||
diff --git a/src/cpu/cpu_map.xml b/src/cpu/cpu_map.xml
|
||||
index 96daa0f9af..4d19a7c811 100644
|
||||
--- a/src/cpu/cpu_map.xml
|
||||
+++ b/src/cpu/cpu_map.xml
|
||||
@@ -257,6 +257,9 @@
|
||||
<feature name='clwb'>
|
||||
<cpuid eax_in='0x07' ecx_in='0x00' ebx='0x01000000'/>
|
||||
</feature>
|
||||
+ <feature name='intel-pt'>
|
||||
+ <cpuid eax_in='0x07' ecx_in='0x00' ebx='0x02000000'/>
|
||||
+ </feature>
|
||||
<feature name='avx512pf'>
|
||||
<cpuid eax_in='0x07' ecx_in='0x00' ebx='0x04000000'/>
|
||||
</feature>
|
||||
@@ -279,12 +282,36 @@
|
||||
<feature name='avx512vbmi'>
|
||||
<cpuid eax_in='0x07' ecx_in='0x00' ecx='0x00000002'/>
|
||||
</feature>
|
||||
+ <feature name='umip'>
|
||||
+ <cpuid eax_in='0x07' ecx_in='0x00' ecx='0x00000004'/>
|
||||
+ </feature>
|
||||
<feature name='pku'>
|
||||
<cpuid eax_in='0x07' ecx_in='0x00' ecx='0x00000008'/>
|
||||
</feature>
|
||||
<feature name='ospke'>
|
||||
<cpuid eax_in='0x07' ecx_in='0x00' ecx='0x00000010'/>
|
||||
</feature>
|
||||
+ <feature name='avx512vbmi2'>
|
||||
+ <cpuid eax_in='0x07' ecx_in='0x00' ecx='0x00000040'/>
|
||||
+ </feature>
|
||||
+ <feature name='gfni'>
|
||||
+ <cpuid eax_in='0x07' ecx_in='0x00' ecx='0x00000100'/>
|
||||
+ </feature>
|
||||
+ <feature name='vaes'>
|
||||
+ <cpuid eax_in='0x07' ecx_in='0x00' ecx='0x00000200'/>
|
||||
+ </feature>
|
||||
+ <feature name='vpclmulqdq'>
|
||||
+ <cpuid eax_in='0x07' ecx_in='0x00' ecx='0x00000400'/>
|
||||
+ </feature>
|
||||
+ <feature name='avx512vnni'>
|
||||
+ <cpuid eax_in='0x07' ecx_in='0x00' ecx='0x00000800'/>
|
||||
+ </feature>
|
||||
+ <feature name='avx512bitalg'>
|
||||
+ <cpuid eax_in='0x07' ecx_in='0x00' ecx='0x00001000'/>
|
||||
+ </feature>
|
||||
+ <feature name='avx512-vpopcntdq'>
|
||||
+ <cpuid eax_in='0x07' ecx_in='0x00' ecx='0x00004000'/>
|
||||
+ </feature>
|
||||
<feature name='la57'>
|
||||
<cpuid eax_in='0x07' ecx_in='0x00' ecx='0x00010000'/>
|
||||
</feature>
|
||||
@@ -295,6 +322,9 @@
|
||||
<feature name='avx512-4fmaps'>
|
||||
<cpuid eax_in='0x07' ecx_in='0x00' edx='0x00000008'/>
|
||||
</feature>
|
||||
+ <feature name='pconfig'>
|
||||
+ <cpuid eax_in='0x07' ecx_in='0x00' edx='0x00040000'/>
|
||||
+ </feature>
|
||||
<feature name='spec-ctrl'>
|
||||
<cpuid eax_in='0x07' ecx_in='0x00' edx='0x04000000'/>
|
||||
</feature>
|
||||
@@ -430,6 +460,9 @@
|
||||
</feature>
|
||||
|
||||
<!-- More AMD-specific features -->
|
||||
+ <feature name='wbnoinvd'>
|
||||
+ <cpuid eax_in='0x80000008' ebx='0x00000200'/>
|
||||
+ </feature>
|
||||
<feature name='ibpb'>
|
||||
<cpuid eax_in='0x80000008' ebx='0x00001000'/>
|
||||
</feature>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i5-6600-guest.xml b/tests/cputestdata/x86_64-cpuid-Core-i5-6600-guest.xml
|
||||
index c3561d5971..5777a0bfba 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Core-i5-6600-guest.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Core-i5-6600-guest.xml
|
||||
@@ -19,6 +19,7 @@
|
||||
<feature policy='require' name='osxsave'/>
|
||||
<feature policy='require' name='tsc_adjust'/>
|
||||
<feature policy='require' name='clflushopt'/>
|
||||
+ <feature policy='require' name='intel-pt'/>
|
||||
<feature policy='require' name='xsaves'/>
|
||||
<feature policy='require' name='pdpe1gb'/>
|
||||
<feature policy='require' name='invtsc'/>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i5-6600-host.xml b/tests/cputestdata/x86_64-cpuid-Core-i5-6600-host.xml
|
||||
index c799394eaf..faaa07f19b 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Core-i5-6600-host.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Core-i5-6600-host.xml
|
||||
@@ -20,6 +20,7 @@
|
||||
<feature name='osxsave'/>
|
||||
<feature name='tsc_adjust'/>
|
||||
<feature name='clflushopt'/>
|
||||
+ <feature name='intel-pt'/>
|
||||
<feature name='xsaves'/>
|
||||
<feature name='pdpe1gb'/>
|
||||
<feature name='invtsc'/>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-guest.xml b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-guest.xml
|
||||
index 877895cf15..e825e2a0fb 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-guest.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-guest.xml
|
||||
@@ -22,6 +22,7 @@
|
||||
<feature policy='require' name='rdrand'/>
|
||||
<feature policy='require' name='arat'/>
|
||||
<feature policy='require' name='tsc_adjust'/>
|
||||
+ <feature policy='require' name='intel-pt'/>
|
||||
<feature policy='require' name='xsaveopt'/>
|
||||
<feature policy='require' name='pdpe1gb'/>
|
||||
<feature policy='require' name='abm'/>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-host.xml b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-host.xml
|
||||
index 9b24941e0e..ea622c87c7 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-host.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-host.xml
|
||||
@@ -23,6 +23,7 @@
|
||||
<feature name='rdrand'/>
|
||||
<feature name='arat'/>
|
||||
<feature name='tsc_adjust'/>
|
||||
+ <feature name='intel-pt'/>
|
||||
<feature name='xsaveopt'/>
|
||||
<feature name='pdpe1gb'/>
|
||||
<feature name='abm'/>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-guest.xml b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-guest.xml
|
||||
index 877895cf15..e825e2a0fb 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-guest.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-guest.xml
|
||||
@@ -22,6 +22,7 @@
|
||||
<feature policy='require' name='rdrand'/>
|
||||
<feature policy='require' name='arat'/>
|
||||
<feature policy='require' name='tsc_adjust'/>
|
||||
+ <feature policy='require' name='intel-pt'/>
|
||||
<feature policy='require' name='xsaveopt'/>
|
||||
<feature policy='require' name='pdpe1gb'/>
|
||||
<feature policy='require' name='abm'/>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-host.xml b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-host.xml
|
||||
index 9b24941e0e..ea622c87c7 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-host.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-host.xml
|
||||
@@ -23,6 +23,7 @@
|
||||
<feature name='rdrand'/>
|
||||
<feature name='arat'/>
|
||||
<feature name='tsc_adjust'/>
|
||||
+ <feature name='intel-pt'/>
|
||||
<feature name='xsaveopt'/>
|
||||
<feature name='pdpe1gb'/>
|
||||
<feature name='abm'/>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-ibrs-guest.xml b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-ibrs-guest.xml
|
||||
index a70cb6d46a..4fa4770208 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-ibrs-guest.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-ibrs-guest.xml
|
||||
@@ -22,6 +22,7 @@
|
||||
<feature policy='require' name='rdrand'/>
|
||||
<feature policy='require' name='arat'/>
|
||||
<feature policy='require' name='tsc_adjust'/>
|
||||
+ <feature policy='require' name='intel-pt'/>
|
||||
<feature policy='require' name='xsaveopt'/>
|
||||
<feature policy='require' name='pdpe1gb'/>
|
||||
<feature policy='require' name='abm'/>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-ibrs-host.xml b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-ibrs-host.xml
|
||||
index b8e3399103..25690c099c 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-ibrs-host.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-ibrs-host.xml
|
||||
@@ -23,6 +23,7 @@
|
||||
<feature name='rdrand'/>
|
||||
<feature name='arat'/>
|
||||
<feature name='tsc_adjust'/>
|
||||
+ <feature name='intel-pt'/>
|
||||
<feature name='xsaveopt'/>
|
||||
<feature name='pdpe1gb'/>
|
||||
<feature name='abm'/>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-7700-guest.xml b/tests/cputestdata/x86_64-cpuid-Core-i7-7700-guest.xml
|
||||
index c3561d5971..5777a0bfba 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Core-i7-7700-guest.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-7700-guest.xml
|
||||
@@ -19,6 +19,7 @@
|
||||
<feature policy='require' name='osxsave'/>
|
||||
<feature policy='require' name='tsc_adjust'/>
|
||||
<feature policy='require' name='clflushopt'/>
|
||||
+ <feature policy='require' name='intel-pt'/>
|
||||
<feature policy='require' name='xsaves'/>
|
||||
<feature policy='require' name='pdpe1gb'/>
|
||||
<feature policy='require' name='invtsc'/>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-7700-host.xml b/tests/cputestdata/x86_64-cpuid-Core-i7-7700-host.xml
|
||||
index c799394eaf..faaa07f19b 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Core-i7-7700-host.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-7700-host.xml
|
||||
@@ -20,6 +20,7 @@
|
||||
<feature name='osxsave'/>
|
||||
<feature name='tsc_adjust'/>
|
||||
<feature name='clflushopt'/>
|
||||
+ <feature name='intel-pt'/>
|
||||
<feature name='xsaves'/>
|
||||
<feature name='pdpe1gb'/>
|
||||
<feature name='invtsc'/>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E3-1245-v5-guest.xml b/tests/cputestdata/x86_64-cpuid-Xeon-E3-1245-v5-guest.xml
|
||||
index c3561d5971..5777a0bfba 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Xeon-E3-1245-v5-guest.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E3-1245-v5-guest.xml
|
||||
@@ -19,6 +19,7 @@
|
||||
<feature policy='require' name='osxsave'/>
|
||||
<feature policy='require' name='tsc_adjust'/>
|
||||
<feature policy='require' name='clflushopt'/>
|
||||
+ <feature policy='require' name='intel-pt'/>
|
||||
<feature policy='require' name='xsaves'/>
|
||||
<feature policy='require' name='pdpe1gb'/>
|
||||
<feature policy='require' name='invtsc'/>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E3-1245-v5-host.xml b/tests/cputestdata/x86_64-cpuid-Xeon-E3-1245-v5-host.xml
|
||||
index c799394eaf..faaa07f19b 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Xeon-E3-1245-v5-host.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E3-1245-v5-host.xml
|
||||
@@ -20,6 +20,7 @@
|
||||
<feature name='osxsave'/>
|
||||
<feature name='tsc_adjust'/>
|
||||
<feature name='clflushopt'/>
|
||||
+ <feature name='intel-pt'/>
|
||||
<feature name='xsaves'/>
|
||||
<feature name='pdpe1gb'/>
|
||||
<feature name='invtsc'/>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4-guest.xml b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4-guest.xml
|
||||
index 60609f5c70..7b93df3f1b 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4-guest.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4-guest.xml
|
||||
@@ -20,6 +20,7 @@
|
||||
<feature policy='require' name='osxsave'/>
|
||||
<feature policy='require' name='tsc_adjust'/>
|
||||
<feature policy='require' name='cmt'/>
|
||||
+ <feature policy='require' name='intel-pt'/>
|
||||
<feature policy='require' name='mbm_total'/>
|
||||
<feature policy='require' name='mbm_local'/>
|
||||
<feature policy='require' name='pdpe1gb'/>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4-host.xml b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4-host.xml
|
||||
index 357cafd10a..5078420c7a 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4-host.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4-host.xml
|
||||
@@ -25,6 +25,7 @@
|
||||
<feature name='arat'/>
|
||||
<feature name='tsc_adjust'/>
|
||||
<feature name='cmt'/>
|
||||
+ <feature name='intel-pt'/>
|
||||
<feature name='xsaveopt'/>
|
||||
<feature name='mbm_total'/>
|
||||
<feature name='mbm_local'/>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2650-v4-guest.xml b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2650-v4-guest.xml
|
||||
index 2fac54355c..cd7e25b52a 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2650-v4-guest.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2650-v4-guest.xml
|
||||
@@ -20,6 +20,7 @@
|
||||
<feature policy='require' name='osxsave'/>
|
||||
<feature policy='require' name='tsc_adjust'/>
|
||||
<feature policy='require' name='cmt'/>
|
||||
+ <feature policy='require' name='intel-pt'/>
|
||||
<feature policy='require' name='mbm_total'/>
|
||||
<feature policy='require' name='mbm_local'/>
|
||||
<feature policy='require' name='pdpe1gb'/>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2650-v4-host.xml b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2650-v4-host.xml
|
||||
index f482864a98..5dd8d749de 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2650-v4-host.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2650-v4-host.xml
|
||||
@@ -25,6 +25,7 @@
|
||||
<feature name='arat'/>
|
||||
<feature name='tsc_adjust'/>
|
||||
<feature name='cmt'/>
|
||||
+ <feature name='intel-pt'/>
|
||||
<feature name='xsaveopt'/>
|
||||
<feature name='mbm_total'/>
|
||||
<feature name='mbm_local'/>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-5115-guest.xml b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-5115-guest.xml
|
||||
index 5f51dea631..480127f341 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-5115-guest.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-5115-guest.xml
|
||||
@@ -21,6 +21,7 @@
|
||||
<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='xsaves'/>
|
||||
<feature policy='require' name='mbm_total'/>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-5115-host.xml b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-5115-host.xml
|
||||
index a11b31369d..680b10acef 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-5115-host.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-5115-host.xml
|
||||
@@ -22,6 +22,7 @@
|
||||
<feature name='tsc_adjust'/>
|
||||
<feature name='cmt'/>
|
||||
<feature name='clflushopt'/>
|
||||
+ <feature name='intel-pt'/>
|
||||
<feature name='pku'/>
|
||||
<feature name='xsaves'/>
|
||||
<feature name='mbm_total'/>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6148-guest.xml b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6148-guest.xml
|
||||
index f72bcea68b..f31ca1ffc5 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6148-guest.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6148-guest.xml
|
||||
@@ -21,6 +21,7 @@
|
||||
<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='xsaves'/>
|
||||
<feature policy='require' name='mbm_total'/>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6148-host.xml b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6148-host.xml
|
||||
index 1a68e35c19..b18ceddc60 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6148-host.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6148-host.xml
|
||||
@@ -22,6 +22,7 @@
|
||||
<feature name='tsc_adjust'/>
|
||||
<feature name='cmt'/>
|
||||
<feature name='clflushopt'/>
|
||||
+ <feature name='intel-pt'/>
|
||||
<feature name='pku'/>
|
||||
<feature name='xsaves'/>
|
||||
<feature name='mbm_total'/>
|
||||
--
|
||||
2.19.1
|
||||
|
@ -0,0 +1,318 @@
|
||||
From 83a1114820c95f9cd98789b14044a229dcc090a7 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <83a1114820c95f9cd98789b14044a229dcc090a7@dist-git>
|
||||
From: Jiri Denemark <jdenemar@redhat.com>
|
||||
Date: Fri, 21 Jun 2019 09:25:07 +0200
|
||||
Subject: [PATCH] cpu_map: Add hex representation of signatures
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The family/model numbers are nice for humans or for comparing with
|
||||
/proc/cpuinfo, but sometimes there's a need to see the CPUID
|
||||
representation of the signature. Let's add it into a comment for each
|
||||
signature in out cpu_map XMLs as the conversion is not exactly
|
||||
straightforward.
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit 61be05a00fd383f11070761fac5ae28272b784dd)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1686895
|
||||
|
||||
Conflicts:
|
||||
src/cpu/cpu_map.xml
|
||||
- the cpu_map split was not backported
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Message-Id: <e8e2e0bdf183bec170df5252cf927ff5fbe0ef47.1561068591.git.jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
src/cpu/cpu_map.xml | 62 ++++++++++++++++++++++-----------------------
|
||||
1 file changed, 31 insertions(+), 31 deletions(-)
|
||||
|
||||
diff --git a/src/cpu/cpu_map.xml b/src/cpu/cpu_map.xml
|
||||
index a9f284fbbe..a5a5290a09 100644
|
||||
--- a/src/cpu/cpu_map.xml
|
||||
+++ b/src/cpu/cpu_map.xml
|
||||
@@ -828,7 +828,7 @@
|
||||
|
||||
<!-- Intel CPU models -->
|
||||
<model name='Conroe'>
|
||||
- <signature family='6' model='15'/>
|
||||
+ <signature family='6' model='15'/> <!-- 0006f0 -->
|
||||
<vendor name='Intel'/>
|
||||
<feature name='apic'/>
|
||||
<feature name='clflush'/>
|
||||
@@ -860,7 +860,7 @@
|
||||
</model>
|
||||
|
||||
<model name='Penryn'>
|
||||
- <signature family='6' model='23'/>
|
||||
+ <signature family='6' model='23'/> <!-- 010670 -->
|
||||
<vendor name='Intel'/>
|
||||
<feature name='apic'/>
|
||||
<feature name='clflush'/>
|
||||
@@ -894,7 +894,7 @@
|
||||
</model>
|
||||
|
||||
<model name='Nehalem'>
|
||||
- <signature family='6' model='26'/>
|
||||
+ <signature family='6' model='26'/> <!-- 0106a0 -->
|
||||
<vendor name='Intel'/>
|
||||
<feature name='apic'/>
|
||||
<feature name='clflush'/>
|
||||
@@ -930,7 +930,7 @@
|
||||
</model>
|
||||
|
||||
<model name='Nehalem-IBRS'>
|
||||
- <signature family='6' model='26'/>
|
||||
+ <signature family='6' model='26'/> <!-- 0106a0 -->
|
||||
<vendor name='Intel'/>
|
||||
<feature name='apic'/>
|
||||
<feature name='clflush'/>
|
||||
@@ -967,7 +967,7 @@
|
||||
</model>
|
||||
|
||||
<model name='Westmere'>
|
||||
- <signature family='6' model='44'/>
|
||||
+ <signature family='6' model='44'/> <!-- 0206c0 -->
|
||||
<vendor name='Intel'/>
|
||||
<feature name='aes'/>
|
||||
<feature name='apic'/>
|
||||
@@ -1004,7 +1004,7 @@
|
||||
</model>
|
||||
|
||||
<model name='Westmere-IBRS'>
|
||||
- <signature family='6' model='44'/>
|
||||
+ <signature family='6' model='44'/> <!-- 0206c0 -->
|
||||
<vendor name='Intel'/>
|
||||
<feature name='aes'/>
|
||||
<feature name='apic'/>
|
||||
@@ -1042,7 +1042,7 @@
|
||||
</model>
|
||||
|
||||
<model name='SandyBridge'>
|
||||
- <signature family='6' model='42'/>
|
||||
+ <signature family='6' model='42'/> <!-- 0206a0 -->
|
||||
<vendor name='Intel'/>
|
||||
<feature name='aes'/>
|
||||
<feature name='apic'/>
|
||||
@@ -1085,7 +1085,7 @@
|
||||
</model>
|
||||
|
||||
<model name='SandyBridge-IBRS'>
|
||||
- <signature family='6' model='42'/>
|
||||
+ <signature family='6' model='42'/> <!-- 0206a0 -->
|
||||
<vendor name='Intel'/>
|
||||
<feature name='aes'/>
|
||||
<feature name='apic'/>
|
||||
@@ -1129,7 +1129,7 @@
|
||||
</model>
|
||||
|
||||
<model name='IvyBridge'>
|
||||
- <signature family='6' model='58'/>
|
||||
+ <signature family='6' model='58'/> <!-- 0306a0 -->
|
||||
<vendor name='Intel'/>
|
||||
<feature name='aes'/>
|
||||
<feature name='apic'/>
|
||||
@@ -1178,7 +1178,7 @@
|
||||
</model>
|
||||
|
||||
<model name='IvyBridge-IBRS'>
|
||||
- <signature family='6' model='58'/>
|
||||
+ <signature family='6' model='58'/> <!-- 0306a0 -->
|
||||
<vendor name='Intel'/>
|
||||
<feature name='aes'/>
|
||||
<feature name='apic'/>
|
||||
@@ -1228,7 +1228,7 @@
|
||||
</model>
|
||||
|
||||
<model name='Haswell-noTSX'>
|
||||
- <signature family='6' model='60'/>
|
||||
+ <signature family='6' model='60'/> <!-- 0306c0 -->
|
||||
<vendor name='Intel'/>
|
||||
<feature name='aes'/>
|
||||
<feature name='apic'/>
|
||||
@@ -1281,7 +1281,7 @@
|
||||
</model>
|
||||
|
||||
<model name='Haswell-noTSX-IBRS'>
|
||||
- <signature family='6' model='60'/>
|
||||
+ <signature family='6' model='60'/> <!-- 0306c0 -->
|
||||
<vendor name='Intel'/>
|
||||
<feature name='aes'/>
|
||||
<feature name='apic'/>
|
||||
@@ -1335,7 +1335,7 @@
|
||||
</model>
|
||||
|
||||
<model name='Haswell'>
|
||||
- <signature family='6' model='60'/>
|
||||
+ <signature family='6' model='60'/> <!-- 0306c0 -->
|
||||
<vendor name='Intel'/>
|
||||
<feature name='aes'/>
|
||||
<feature name='apic'/>
|
||||
@@ -1390,7 +1390,7 @@
|
||||
</model>
|
||||
|
||||
<model name='Haswell-IBRS'>
|
||||
- <signature family='6' model='60'/>
|
||||
+ <signature family='6' model='60'/> <!-- 0306c0 -->
|
||||
<vendor name='Intel'/>
|
||||
<feature name='aes'/>
|
||||
<feature name='apic'/>
|
||||
@@ -1446,7 +1446,7 @@
|
||||
</model>
|
||||
|
||||
<model name='Broadwell-noTSX'>
|
||||
- <signature family='6' model='61'/>
|
||||
+ <signature family='6' model='61'/> <!-- 0306d0 -->
|
||||
<vendor name='Intel'/>
|
||||
<feature name='3dnowprefetch'/>
|
||||
<feature name='adx'/>
|
||||
@@ -1503,7 +1503,7 @@
|
||||
</model>
|
||||
|
||||
<model name='Broadwell-noTSX-IBRS'>
|
||||
- <signature family='6' model='61'/>
|
||||
+ <signature family='6' model='61'/> <!-- 0306d0 -->
|
||||
<vendor name='Intel'/>
|
||||
<feature name='3dnowprefetch'/>
|
||||
<feature name='adx'/>
|
||||
@@ -1561,7 +1561,7 @@
|
||||
</model>
|
||||
|
||||
<model name='Broadwell'>
|
||||
- <signature family='6' model='61'/>
|
||||
+ <signature family='6' model='61'/> <!-- 0306d0 -->
|
||||
<vendor name='Intel'/>
|
||||
<feature name='3dnowprefetch'/>
|
||||
<feature name='adx'/>
|
||||
@@ -1620,7 +1620,7 @@
|
||||
</model>
|
||||
|
||||
<model name='Broadwell-IBRS'>
|
||||
- <signature family='6' model='61'/>
|
||||
+ <signature family='6' model='61'/> <!-- 0306d0 -->
|
||||
<vendor name='Intel'/>
|
||||
<feature name='3dnowprefetch'/>
|
||||
<feature name='adx'/>
|
||||
@@ -1680,7 +1680,7 @@
|
||||
</model>
|
||||
|
||||
<model name='Skylake-Client'>
|
||||
- <signature family='6' model='94'/>
|
||||
+ <signature family='6' model='94'/> <!-- 0506e0 -->
|
||||
<vendor name='Intel'/>
|
||||
<feature name='3dnowprefetch'/>
|
||||
<feature name='abm'/>
|
||||
@@ -1748,7 +1748,7 @@
|
||||
</model>
|
||||
|
||||
<model name='Skylake-Client-IBRS'>
|
||||
- <signature family='6' model='94'/>
|
||||
+ <signature family='6' model='94'/> <!-- 0506e0 -->
|
||||
<vendor name='Intel'/>
|
||||
<feature name='3dnowprefetch'/>
|
||||
<feature name='abm'/>
|
||||
@@ -1817,7 +1817,7 @@
|
||||
</model>
|
||||
|
||||
<model name='Skylake-Server'>
|
||||
- <signature family='6' model='85'/>
|
||||
+ <signature family='6' model='85'/> <!-- 050654 -->
|
||||
<vendor name='Intel'/>
|
||||
<feature name='3dnowprefetch'/>
|
||||
<feature name='abm'/>
|
||||
@@ -1892,7 +1892,7 @@
|
||||
</model>
|
||||
|
||||
<model name='Skylake-Server-IBRS'>
|
||||
- <signature family='6' model='85'/>
|
||||
+ <signature family='6' model='85'/> <!-- 050654 -->
|
||||
<vendor name='Intel'/>
|
||||
<feature name='3dnowprefetch'/>
|
||||
<feature name='abm'/>
|
||||
@@ -1968,7 +1968,7 @@
|
||||
</model>
|
||||
|
||||
<model name='Icelake-Client'>
|
||||
- <signature family='6' model='126'/>
|
||||
+ <signature family='6' model='126'/> <!-- 0706e0 -->
|
||||
<vendor name='Intel'/>
|
||||
<feature name='3dnowprefetch'/>
|
||||
<feature name='abm'/>
|
||||
@@ -2052,7 +2052,7 @@
|
||||
</model>
|
||||
|
||||
<model name='Icelake-Server'>
|
||||
- <signature family='6' model='134'/>
|
||||
+ <signature family='6' model='134'/> <!-- 080660 -->
|
||||
<vendor name='Intel'/>
|
||||
<feature name='3dnowprefetch'/>
|
||||
<feature name='abm'/>
|
||||
@@ -2209,7 +2209,7 @@
|
||||
</model>
|
||||
|
||||
<model name='Opteron_G1'>
|
||||
- <signature family='15' model='6'/>
|
||||
+ <signature family='15' model='6'/> <!-- 100e60 -->
|
||||
<vendor name='AMD'/>
|
||||
<feature name='apic'/>
|
||||
<feature name='clflush'/>
|
||||
@@ -2239,7 +2239,7 @@
|
||||
</model>
|
||||
|
||||
<model name='Opteron_G2'>
|
||||
- <signature family='15' model='6'/>
|
||||
+ <signature family='15' model='6'/> <!-- 100e60 -->
|
||||
<vendor name='AMD'/>
|
||||
<feature name='apic'/>
|
||||
<feature name='clflush'/>
|
||||
@@ -2273,7 +2273,7 @@
|
||||
</model>
|
||||
|
||||
<model name='Opteron_G3'>
|
||||
- <signature family='15' model='6'/>
|
||||
+ <signature family='15' model='6'/> <!-- 100e60 -->
|
||||
<vendor name='AMD'/>
|
||||
<feature name='abm'/>
|
||||
<feature name='apic'/>
|
||||
@@ -2312,7 +2312,7 @@
|
||||
</model>
|
||||
|
||||
<model name='Opteron_G4'>
|
||||
- <signature family='21' model='1'/>
|
||||
+ <signature family='21' model='1'/> <!-- 600f10 -->
|
||||
<vendor name='AMD'/>
|
||||
<feature name='3dnowprefetch'/>
|
||||
<feature name='abm'/>
|
||||
@@ -2361,7 +2361,7 @@
|
||||
</model>
|
||||
|
||||
<model name='Opteron_G5'>
|
||||
- <signature family='21' model='2'/>
|
||||
+ <signature family='21' model='2'/> <!-- 600f20 -->
|
||||
<vendor name='AMD'/>
|
||||
<feature name='3dnowprefetch'/>
|
||||
<feature name='abm'/>
|
||||
@@ -2413,7 +2413,7 @@
|
||||
</model>
|
||||
|
||||
<model name='EPYC'>
|
||||
- <signature family='23' model='1'/>
|
||||
+ <signature family='23' model='1'/> <!-- 800f10 -->
|
||||
<vendor name='AMD'/>
|
||||
<feature name='3dnowprefetch'/>
|
||||
<feature name='abm'/>
|
||||
@@ -2484,7 +2484,7 @@
|
||||
</model>
|
||||
|
||||
<model name='EPYC-IBPB'>
|
||||
- <signature family='23' model='1'/>
|
||||
+ <signature family='23' model='1'/> <!-- 800f10 -->
|
||||
<vendor name='AMD'/>
|
||||
<feature name='3dnowprefetch'/>
|
||||
<feature name='abm'/>
|
||||
--
|
||||
2.22.0
|
||||
|
@ -0,0 +1,254 @@
|
||||
From 77ad41e460c2e91f2c2e187c80581069654b741d Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <77ad41e460c2e91f2c2e187c80581069654b741d@dist-git>
|
||||
From: Jiri Denemark <Jiri.Denemark@gmail.com>
|
||||
Date: Fri, 21 Jun 2019 09:25:16 +0200
|
||||
Subject: [PATCH] cpu_map: Add more signatures for Broadwell CPU models
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This fixes several CPUs which were incorrectly detected as
|
||||
Skylake-Client.
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit 4ff74a806ad42820eef3877c8ec146770914d8df)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1686895
|
||||
|
||||
Conflicts:
|
||||
src/cpu_map/x86_Broadwell-IBRS.xml
|
||||
src/cpu_map/x86_Broadwell-noTSX-IBRS.xml
|
||||
src/cpu_map/x86_Broadwell-noTSX.xml
|
||||
src/cpu_map/x86_Broadwell.xml
|
||||
- cpu_map split not backported
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Message-Id: <543534b544d2d09470c218aeb6c7d945facaf2c8.1561068591.git.jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
src/cpu/cpu_map.xml | 12 ++++++++++++
|
||||
.../x86_64-cpuid-Xeon-E5-2623-v4-guest.xml | 11 +++++++----
|
||||
.../x86_64-cpuid-Xeon-E5-2623-v4-json.xml | 11 +++++++----
|
||||
.../x86_64-cpuid-Xeon-E5-2630-v4-guest.xml | 11 +++++++----
|
||||
.../x86_64-cpuid-Xeon-E5-2630-v4-json.xml | 11 +++++++----
|
||||
.../x86_64-cpuid-Xeon-E5-2650-v4-guest.xml | 11 +++++++----
|
||||
.../x86_64-cpuid-Xeon-E5-2650-v4-json.xml | 11 +++++++----
|
||||
7 files changed, 54 insertions(+), 24 deletions(-)
|
||||
|
||||
diff --git a/src/cpu/cpu_map.xml b/src/cpu/cpu_map.xml
|
||||
index ed6006643b..04369d1eda 100644
|
||||
--- a/src/cpu/cpu_map.xml
|
||||
+++ b/src/cpu/cpu_map.xml
|
||||
@@ -1473,6 +1473,9 @@
|
||||
|
||||
<model name='Broadwell-noTSX'>
|
||||
<signature family='6' model='61'/> <!-- 0306d0 -->
|
||||
+ <signature family='6' model='71'/> <!-- 040670 -->
|
||||
+ <signature family='6' model='79'/> <!-- 0406f0 -->
|
||||
+ <signature family='6' model='86'/> <!-- 050660 -->
|
||||
<vendor name='Intel'/>
|
||||
<feature name='3dnowprefetch'/>
|
||||
<feature name='adx'/>
|
||||
@@ -1530,6 +1533,9 @@
|
||||
|
||||
<model name='Broadwell-noTSX-IBRS'>
|
||||
<signature family='6' model='61'/> <!-- 0306d0 -->
|
||||
+ <signature family='6' model='71'/> <!-- 040670 -->
|
||||
+ <signature family='6' model='79'/> <!-- 0406f0 -->
|
||||
+ <signature family='6' model='86'/> <!-- 050660 -->
|
||||
<vendor name='Intel'/>
|
||||
<feature name='3dnowprefetch'/>
|
||||
<feature name='adx'/>
|
||||
@@ -1588,6 +1594,9 @@
|
||||
|
||||
<model name='Broadwell'>
|
||||
<signature family='6' model='61'/> <!-- 0306d0 -->
|
||||
+ <signature family='6' model='71'/> <!-- 040670 -->
|
||||
+ <signature family='6' model='79'/> <!-- 0406f0 -->
|
||||
+ <signature family='6' model='86'/> <!-- 050660 -->
|
||||
<vendor name='Intel'/>
|
||||
<feature name='3dnowprefetch'/>
|
||||
<feature name='adx'/>
|
||||
@@ -1647,6 +1656,9 @@
|
||||
|
||||
<model name='Broadwell-IBRS'>
|
||||
<signature family='6' model='61'/> <!-- 0306d0 -->
|
||||
+ <signature family='6' model='71'/> <!-- 040670 -->
|
||||
+ <signature family='6' model='79'/> <!-- 0406f0 -->
|
||||
+ <signature family='6' model='86'/> <!-- 050660 -->
|
||||
<vendor name='Intel'/>
|
||||
<feature name='3dnowprefetch'/>
|
||||
<feature name='adx'/>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4-guest.xml b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4-guest.xml
|
||||
index 7718d7ca59..a5c6d9b471 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4-guest.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4-guest.xml
|
||||
@@ -1,6 +1,7 @@
|
||||
<cpu mode='custom' match='exact'>
|
||||
- <model fallback='forbid'>Skylake-Client-IBRS</model>
|
||||
+ <model fallback='forbid'>Broadwell-IBRS</model>
|
||||
<vendor>Intel</vendor>
|
||||
+ <feature policy='require' name='vme'/>
|
||||
<feature policy='require' name='ds'/>
|
||||
<feature policy='require' name='acpi'/>
|
||||
<feature policy='require' name='ss'/>
|
||||
@@ -18,15 +19,17 @@
|
||||
<feature policy='require' name='pdcm'/>
|
||||
<feature policy='require' name='dca'/>
|
||||
<feature policy='require' name='osxsave'/>
|
||||
+ <feature policy='require' name='f16c'/>
|
||||
+ <feature policy='require' name='rdrand'/>
|
||||
+ <feature policy='require' name='arat'/>
|
||||
<feature policy='require' name='tsc_adjust'/>
|
||||
<feature policy='require' name='cmt'/>
|
||||
<feature policy='require' name='intel-pt'/>
|
||||
<feature policy='require' name='stibp'/>
|
||||
+ <feature policy='require' name='xsaveopt'/>
|
||||
<feature policy='require' name='mbm_total'/>
|
||||
<feature policy='require' name='mbm_local'/>
|
||||
<feature policy='require' name='pdpe1gb'/>
|
||||
+ <feature policy='require' name='abm'/>
|
||||
<feature policy='require' name='invtsc'/>
|
||||
- <feature policy='disable' name='mpx'/>
|
||||
- <feature policy='disable' name='xsavec'/>
|
||||
- <feature policy='disable' name='xgetbv1'/>
|
||||
</cpu>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4-json.xml b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4-json.xml
|
||||
index 167a9028ab..de082dbd93 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4-json.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4-json.xml
|
||||
@@ -1,11 +1,14 @@
|
||||
<cpu mode='custom' match='exact'>
|
||||
- <model fallback='forbid'>Skylake-Client-IBRS</model>
|
||||
+ <model fallback='forbid'>Broadwell-IBRS</model>
|
||||
<vendor>Intel</vendor>
|
||||
+ <feature policy='require' name='vme'/>
|
||||
<feature policy='require' name='ss'/>
|
||||
+ <feature policy='require' name='f16c'/>
|
||||
+ <feature policy='require' name='rdrand'/>
|
||||
<feature policy='require' name='hypervisor'/>
|
||||
+ <feature policy='require' name='arat'/>
|
||||
<feature policy='require' name='tsc_adjust'/>
|
||||
+ <feature policy='require' name='xsaveopt'/>
|
||||
<feature policy='require' name='pdpe1gb'/>
|
||||
- <feature policy='disable' name='mpx'/>
|
||||
- <feature policy='disable' name='xsavec'/>
|
||||
- <feature policy='disable' name='xgetbv1'/>
|
||||
+ <feature policy='require' name='abm'/>
|
||||
</cpu>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2630-v4-guest.xml b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2630-v4-guest.xml
|
||||
index cd7e25b52a..e2999db8e9 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2630-v4-guest.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2630-v4-guest.xml
|
||||
@@ -1,6 +1,7 @@
|
||||
<cpu mode='custom' match='exact'>
|
||||
- <model fallback='forbid'>Skylake-Client</model>
|
||||
+ <model fallback='forbid'>Broadwell</model>
|
||||
<vendor>Intel</vendor>
|
||||
+ <feature policy='require' name='vme'/>
|
||||
<feature policy='require' name='ds'/>
|
||||
<feature policy='require' name='acpi'/>
|
||||
<feature policy='require' name='ss'/>
|
||||
@@ -18,14 +19,16 @@
|
||||
<feature policy='require' name='pdcm'/>
|
||||
<feature policy='require' name='dca'/>
|
||||
<feature policy='require' name='osxsave'/>
|
||||
+ <feature policy='require' name='f16c'/>
|
||||
+ <feature policy='require' name='rdrand'/>
|
||||
+ <feature policy='require' name='arat'/>
|
||||
<feature policy='require' name='tsc_adjust'/>
|
||||
<feature policy='require' name='cmt'/>
|
||||
<feature policy='require' name='intel-pt'/>
|
||||
+ <feature policy='require' name='xsaveopt'/>
|
||||
<feature policy='require' name='mbm_total'/>
|
||||
<feature policy='require' name='mbm_local'/>
|
||||
<feature policy='require' name='pdpe1gb'/>
|
||||
+ <feature policy='require' name='abm'/>
|
||||
<feature policy='require' name='invtsc'/>
|
||||
- <feature policy='disable' name='mpx'/>
|
||||
- <feature policy='disable' name='xsavec'/>
|
||||
- <feature policy='disable' name='xgetbv1'/>
|
||||
</cpu>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2630-v4-json.xml b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2630-v4-json.xml
|
||||
index 5dfce947b2..5b8891093a 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2630-v4-json.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2630-v4-json.xml
|
||||
@@ -1,11 +1,14 @@
|
||||
<cpu mode='custom' match='exact'>
|
||||
- <model fallback='forbid'>Skylake-Client</model>
|
||||
+ <model fallback='forbid'>Broadwell</model>
|
||||
<vendor>Intel</vendor>
|
||||
+ <feature policy='require' name='vme'/>
|
||||
<feature policy='require' name='ss'/>
|
||||
+ <feature policy='require' name='f16c'/>
|
||||
+ <feature policy='require' name='rdrand'/>
|
||||
<feature policy='require' name='hypervisor'/>
|
||||
+ <feature policy='require' name='arat'/>
|
||||
<feature policy='require' name='tsc_adjust'/>
|
||||
+ <feature policy='require' name='xsaveopt'/>
|
||||
<feature policy='require' name='pdpe1gb'/>
|
||||
- <feature policy='disable' name='mpx'/>
|
||||
- <feature policy='disable' name='xsavec'/>
|
||||
- <feature policy='disable' name='xgetbv1'/>
|
||||
+ <feature policy='require' name='abm'/>
|
||||
</cpu>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2650-v4-guest.xml b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2650-v4-guest.xml
|
||||
index cd7e25b52a..e2999db8e9 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2650-v4-guest.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2650-v4-guest.xml
|
||||
@@ -1,6 +1,7 @@
|
||||
<cpu mode='custom' match='exact'>
|
||||
- <model fallback='forbid'>Skylake-Client</model>
|
||||
+ <model fallback='forbid'>Broadwell</model>
|
||||
<vendor>Intel</vendor>
|
||||
+ <feature policy='require' name='vme'/>
|
||||
<feature policy='require' name='ds'/>
|
||||
<feature policy='require' name='acpi'/>
|
||||
<feature policy='require' name='ss'/>
|
||||
@@ -18,14 +19,16 @@
|
||||
<feature policy='require' name='pdcm'/>
|
||||
<feature policy='require' name='dca'/>
|
||||
<feature policy='require' name='osxsave'/>
|
||||
+ <feature policy='require' name='f16c'/>
|
||||
+ <feature policy='require' name='rdrand'/>
|
||||
+ <feature policy='require' name='arat'/>
|
||||
<feature policy='require' name='tsc_adjust'/>
|
||||
<feature policy='require' name='cmt'/>
|
||||
<feature policy='require' name='intel-pt'/>
|
||||
+ <feature policy='require' name='xsaveopt'/>
|
||||
<feature policy='require' name='mbm_total'/>
|
||||
<feature policy='require' name='mbm_local'/>
|
||||
<feature policy='require' name='pdpe1gb'/>
|
||||
+ <feature policy='require' name='abm'/>
|
||||
<feature policy='require' name='invtsc'/>
|
||||
- <feature policy='disable' name='mpx'/>
|
||||
- <feature policy='disable' name='xsavec'/>
|
||||
- <feature policy='disable' name='xgetbv1'/>
|
||||
</cpu>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2650-v4-json.xml b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2650-v4-json.xml
|
||||
index 5dfce947b2..5b8891093a 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2650-v4-json.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2650-v4-json.xml
|
||||
@@ -1,11 +1,14 @@
|
||||
<cpu mode='custom' match='exact'>
|
||||
- <model fallback='forbid'>Skylake-Client</model>
|
||||
+ <model fallback='forbid'>Broadwell</model>
|
||||
<vendor>Intel</vendor>
|
||||
+ <feature policy='require' name='vme'/>
|
||||
<feature policy='require' name='ss'/>
|
||||
+ <feature policy='require' name='f16c'/>
|
||||
+ <feature policy='require' name='rdrand'/>
|
||||
<feature policy='require' name='hypervisor'/>
|
||||
+ <feature policy='require' name='arat'/>
|
||||
<feature policy='require' name='tsc_adjust'/>
|
||||
+ <feature policy='require' name='xsaveopt'/>
|
||||
<feature policy='require' name='pdpe1gb'/>
|
||||
- <feature policy='disable' name='mpx'/>
|
||||
- <feature policy='disable' name='xsavec'/>
|
||||
- <feature policy='disable' name='xgetbv1'/>
|
||||
+ <feature policy='require' name='abm'/>
|
||||
</cpu>
|
||||
--
|
||||
2.22.0
|
||||
|
@ -0,0 +1,41 @@
|
||||
From 93520cb5f3b412c8cb4b5cf7098ff4a8c6c819ab Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <93520cb5f3b412c8cb4b5cf7098ff4a8c6c819ab@dist-git>
|
||||
From: Jiri Denemark <jdenemar@redhat.com>
|
||||
Date: Fri, 21 Jun 2019 09:25:09 +0200
|
||||
Subject: [PATCH] cpu_map: Add more signatures for Conroe CPU model
|
||||
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: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit c1f6a3269c595e7d3d0c9cf31ef7e6cf88291056)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1686895
|
||||
|
||||
Conflicts:
|
||||
src/cpu_map/x86_Conroe.xml
|
||||
- cpu_map split not backported
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Message-Id: <bdc4e7ff05e41cf66f69b61c0c622740f710d411.1561068591.git.jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
src/cpu/cpu_map.xml | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/src/cpu/cpu_map.xml b/src/cpu/cpu_map.xml
|
||||
index a5a5290a09..1699aec2cf 100644
|
||||
--- a/src/cpu/cpu_map.xml
|
||||
+++ b/src/cpu/cpu_map.xml
|
||||
@@ -829,6 +829,7 @@
|
||||
<!-- Intel CPU models -->
|
||||
<model name='Conroe'>
|
||||
<signature family='6' model='15'/> <!-- 0006f0 -->
|
||||
+ <signature family='6' model='22'/> <!-- 010660 -->
|
||||
<vendor name='Intel'/>
|
||||
<feature name='apic'/>
|
||||
<feature name='clflush'/>
|
||||
--
|
||||
2.22.0
|
||||
|
@ -0,0 +1,76 @@
|
||||
From 41472ea4967eed29a41f619aca9c3d78504d0031 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <41472ea4967eed29a41f619aca9c3d78504d0031@dist-git>
|
||||
From: Jiri Denemark <jdenemar@redhat.com>
|
||||
Date: Fri, 21 Jun 2019 09:25:15 +0200
|
||||
Subject: [PATCH] cpu_map: Add more signatures for Haswell CPU models
|
||||
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: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit e58ca588cc0deee36c8ae44f2ad75bf9b1680fc5)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1686895
|
||||
|
||||
Conflicts:
|
||||
src/cpu_map/x86_Haswell-IBRS.xml
|
||||
src/cpu_map/x86_Haswell-noTSX-IBRS.xml
|
||||
src/cpu_map/x86_Haswell-noTSX.xml
|
||||
src/cpu_map/x86_Haswell.xml
|
||||
- cpu_map split not backported
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Message-Id: <f2154885afb3bb49b36ae3468b11251c7ebf896f.1561068591.git.jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
src/cpu/cpu_map.xml | 12 ++++++++++++
|
||||
1 file changed, 12 insertions(+)
|
||||
|
||||
diff --git a/src/cpu/cpu_map.xml b/src/cpu/cpu_map.xml
|
||||
index 9bd8bbbfbb..ed6006643b 100644
|
||||
--- a/src/cpu/cpu_map.xml
|
||||
+++ b/src/cpu/cpu_map.xml
|
||||
@@ -1243,6 +1243,9 @@
|
||||
|
||||
<model name='Haswell-noTSX'>
|
||||
<signature family='6' model='60'/> <!-- 0306c0 -->
|
||||
+ <signature family='6' model='63'/> <!-- 0306f0 -->
|
||||
+ <signature family='6' model='69'/> <!-- 040650 -->
|
||||
+ <signature family='6' model='70'/> <!-- 040660 -->
|
||||
<vendor name='Intel'/>
|
||||
<feature name='aes'/>
|
||||
<feature name='apic'/>
|
||||
@@ -1296,6 +1299,9 @@
|
||||
|
||||
<model name='Haswell-noTSX-IBRS'>
|
||||
<signature family='6' model='60'/> <!-- 0306c0 -->
|
||||
+ <signature family='6' model='63'/> <!-- 0306f0 -->
|
||||
+ <signature family='6' model='69'/> <!-- 040650 -->
|
||||
+ <signature family='6' model='70'/> <!-- 040660 -->
|
||||
<vendor name='Intel'/>
|
||||
<feature name='aes'/>
|
||||
<feature name='apic'/>
|
||||
@@ -1350,6 +1356,9 @@
|
||||
|
||||
<model name='Haswell'>
|
||||
<signature family='6' model='60'/> <!-- 0306c0 -->
|
||||
+ <signature family='6' model='63'/> <!-- 0306f0 -->
|
||||
+ <signature family='6' model='69'/> <!-- 040650 -->
|
||||
+ <signature family='6' model='70'/> <!-- 040660 -->
|
||||
<vendor name='Intel'/>
|
||||
<feature name='aes'/>
|
||||
<feature name='apic'/>
|
||||
@@ -1405,6 +1414,9 @@
|
||||
|
||||
<model name='Haswell-IBRS'>
|
||||
<signature family='6' model='60'/> <!-- 0306c0 -->
|
||||
+ <signature family='6' model='63'/> <!-- 0306f0 -->
|
||||
+ <signature family='6' model='69'/> <!-- 040650 -->
|
||||
+ <signature family='6' model='70'/> <!-- 040660 -->
|
||||
<vendor name='Intel'/>
|
||||
<feature name='aes'/>
|
||||
<feature name='apic'/>
|
||||
--
|
||||
2.22.0
|
||||
|
@ -0,0 +1,50 @@
|
||||
From 182faff133a2a21d6ce9fb2d2f2a59c10bded7a4 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <182faff133a2a21d6ce9fb2d2f2a59c10bded7a4@dist-git>
|
||||
From: Jiri Denemark <jdenemar@redhat.com>
|
||||
Date: Fri, 21 Jun 2019 09:25:14 +0200
|
||||
Subject: [PATCH] cpu_map: Add more signatures for IvyBridge CPU models
|
||||
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: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit 194105fef1a3a8645486df3323e460cc4a9b2d4c)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1686895
|
||||
|
||||
Conflicts:
|
||||
src/cpu_map/x86_IvyBridge-IBRS.xml
|
||||
src/cpu_map/x86_IvyBridge.xml
|
||||
- cpu_map split not backported
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Message-Id: <07778daea0841ab2e211311adc90fd04967b2fb3.1561068591.git.jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
src/cpu/cpu_map.xml | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/src/cpu/cpu_map.xml b/src/cpu/cpu_map.xml
|
||||
index 9eaba9572c..9bd8bbbfbb 100644
|
||||
--- a/src/cpu/cpu_map.xml
|
||||
+++ b/src/cpu/cpu_map.xml
|
||||
@@ -1142,6 +1142,7 @@
|
||||
|
||||
<model name='IvyBridge'>
|
||||
<signature family='6' model='58'/> <!-- 0306a0 -->
|
||||
+ <signature family='6' model='62'/> <!-- 0306e0 -->
|
||||
<vendor name='Intel'/>
|
||||
<feature name='aes'/>
|
||||
<feature name='apic'/>
|
||||
@@ -1191,6 +1192,7 @@
|
||||
|
||||
<model name='IvyBridge-IBRS'>
|
||||
<signature family='6' model='58'/> <!-- 0306a0 -->
|
||||
+ <signature family='6' model='62'/> <!-- 0306e0 -->
|
||||
<vendor name='Intel'/>
|
||||
<feature name='aes'/>
|
||||
<feature name='apic'/>
|
||||
--
|
||||
2.22.0
|
||||
|
@ -0,0 +1,54 @@
|
||||
From 72bcfcf07c76288e943602995308d3e505aa1cff Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <72bcfcf07c76288e943602995308d3e505aa1cff@dist-git>
|
||||
From: Jiri Denemark <jdenemar@redhat.com>
|
||||
Date: Fri, 21 Jun 2019 09:25:11 +0200
|
||||
Subject: [PATCH] cpu_map: Add more signatures for Nehalem CPU models
|
||||
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: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit f349f3c53f6427d9955ab7c57900c094f06dfd87)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1686895
|
||||
|
||||
Conflicts:
|
||||
src/cpu_map/x86_Nehalem-IBRS.xml
|
||||
src/cpu_map/x86_Nehalem.xml
|
||||
- cpu_map split not backported
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Message-Id: <6351ae62d5ea091e831968cd1fc50176d1552a86.1561068591.git.jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
src/cpu/cpu_map.xml | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/src/cpu/cpu_map.xml b/src/cpu/cpu_map.xml
|
||||
index f42b2e629c..4f9c247f3e 100644
|
||||
--- a/src/cpu/cpu_map.xml
|
||||
+++ b/src/cpu/cpu_map.xml
|
||||
@@ -897,6 +897,9 @@
|
||||
|
||||
<model name='Nehalem'>
|
||||
<signature family='6' model='26'/> <!-- 0106a0 -->
|
||||
+ <signature family='6' model='30'/> <!-- 0106e0 -->
|
||||
+ <signature family='6' model='31'/> <!-- 0106f0 -->
|
||||
+ <signature family='6' model='46'/> <!-- 0206e0 -->
|
||||
<vendor name='Intel'/>
|
||||
<feature name='apic'/>
|
||||
<feature name='clflush'/>
|
||||
@@ -933,6 +936,9 @@
|
||||
|
||||
<model name='Nehalem-IBRS'>
|
||||
<signature family='6' model='26'/> <!-- 0106a0 -->
|
||||
+ <signature family='6' model='30'/> <!-- 0106e0 -->
|
||||
+ <signature family='6' model='31'/> <!-- 0106f0 -->
|
||||
+ <signature family='6' model='46'/> <!-- 0206e0 -->
|
||||
<vendor name='Intel'/>
|
||||
<feature name='apic'/>
|
||||
<feature name='clflush'/>
|
||||
--
|
||||
2.22.0
|
||||
|
@ -0,0 +1,41 @@
|
||||
From 4042ef3cf2a0221d4c59a5adc9051ee9ae41aa7d Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <4042ef3cf2a0221d4c59a5adc9051ee9ae41aa7d@dist-git>
|
||||
From: Jiri Denemark <jdenemar@redhat.com>
|
||||
Date: Fri, 21 Jun 2019 09:25:10 +0200
|
||||
Subject: [PATCH] cpu_map: Add more signatures for Penryn CPU model
|
||||
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: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit 0a09e59457f843b53c2702d1936bca6513868320)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1686895
|
||||
|
||||
Conflicts:
|
||||
src/cpu_map/x86_Penryn.xml
|
||||
- cpu_map split not backported
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Message-Id: <1604252f9ef65cfb55161a0f8329ee6868926814.1561068591.git.jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
src/cpu/cpu_map.xml | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/src/cpu/cpu_map.xml b/src/cpu/cpu_map.xml
|
||||
index 1699aec2cf..f42b2e629c 100644
|
||||
--- a/src/cpu/cpu_map.xml
|
||||
+++ b/src/cpu/cpu_map.xml
|
||||
@@ -862,6 +862,7 @@
|
||||
|
||||
<model name='Penryn'>
|
||||
<signature family='6' model='23'/> <!-- 010670 -->
|
||||
+ <signature family='6' model='29'/> <!-- 0106d0 -->
|
||||
<vendor name='Intel'/>
|
||||
<feature name='apic'/>
|
||||
<feature name='clflush'/>
|
||||
--
|
||||
2.22.0
|
||||
|
@ -0,0 +1,50 @@
|
||||
From 250d216f3f9f033ec39b2116b30c93b37967484c Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <250d216f3f9f033ec39b2116b30c93b37967484c@dist-git>
|
||||
From: Jiri Denemark <jdenemar@redhat.com>
|
||||
Date: Fri, 21 Jun 2019 09:25:13 +0200
|
||||
Subject: [PATCH] cpu_map: Add more signatures for SandyBridge CPU models
|
||||
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: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit 4a3c3682f3da4ae1e1036c67db7ddba3dcc66d68)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1686895
|
||||
|
||||
Conflicts:
|
||||
src/cpu_map/x86_SandyBridge-IBRS.xml
|
||||
src/cpu_map/x86_SandyBridge.xml
|
||||
- cpu_map split not backported
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Message-Id: <521680181b58a762b0d6b3668e0d162fbc5d3cf9.1561068591.git.jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
src/cpu/cpu_map.xml | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/src/cpu/cpu_map.xml b/src/cpu/cpu_map.xml
|
||||
index fed0f51934..9eaba9572c 100644
|
||||
--- a/src/cpu/cpu_map.xml
|
||||
+++ b/src/cpu/cpu_map.xml
|
||||
@@ -1053,6 +1053,7 @@
|
||||
|
||||
<model name='SandyBridge'>
|
||||
<signature family='6' model='42'/> <!-- 0206a0 -->
|
||||
+ <signature family='6' model='45'/> <!-- 0206d0 -->
|
||||
<vendor name='Intel'/>
|
||||
<feature name='aes'/>
|
||||
<feature name='apic'/>
|
||||
@@ -1096,6 +1097,7 @@
|
||||
|
||||
<model name='SandyBridge-IBRS'>
|
||||
<signature family='6' model='42'/> <!-- 0206a0 -->
|
||||
+ <signature family='6' model='45'/> <!-- 0206d0 -->
|
||||
<vendor name='Intel'/>
|
||||
<feature name='aes'/>
|
||||
<feature name='apic'/>
|
||||
--
|
||||
2.22.0
|
||||
|
@ -0,0 +1,58 @@
|
||||
From f1a00c505aac83fe04f5385db5a9ed4768b0222b Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <f1a00c505aac83fe04f5385db5a9ed4768b0222b@dist-git>
|
||||
From: Jiri Denemark <jdenemar@redhat.com>
|
||||
Date: Fri, 21 Jun 2019 09:25:17 +0200
|
||||
Subject: [PATCH] cpu_map: Add more signatures for Skylake-Client CPU models
|
||||
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: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit 367d96a5d6b04bf25d025ed59a7079d71f843c56)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1686895
|
||||
|
||||
Conflicts:
|
||||
src/cpu_map/x86_Skylake-Client-IBRS.xml
|
||||
src/cpu_map/x86_Skylake-Client.xml
|
||||
- cpu_map split not backported
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Message-Id: <d7ff83903e6d8ae1881afee54d3a248b9bb28678.1561068591.git.jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
src/cpu/cpu_map.xml | 10 ++++++++++
|
||||
1 file changed, 10 insertions(+)
|
||||
|
||||
diff --git a/src/cpu/cpu_map.xml b/src/cpu/cpu_map.xml
|
||||
index 04369d1eda..b2eb07b832 100644
|
||||
--- a/src/cpu/cpu_map.xml
|
||||
+++ b/src/cpu/cpu_map.xml
|
||||
@@ -1719,6 +1719,11 @@
|
||||
|
||||
<model name='Skylake-Client'>
|
||||
<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'/>
|
||||
@@ -1787,6 +1792,11 @@
|
||||
|
||||
<model name='Skylake-Client-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'/>
|
||||
--
|
||||
2.22.0
|
||||
|
@ -0,0 +1,184 @@
|
||||
From d31a3ba6c9396f8ede2966d49030e9b4011be636 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <d31a3ba6c9396f8ede2966d49030e9b4011be636@dist-git>
|
||||
From: Jiri Denemark <jdenemar@redhat.com>
|
||||
Date: Fri, 21 Jun 2019 09:25:12 +0200
|
||||
Subject: [PATCH] cpu_map: Add more signatures for Westmere CPU model
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This fixes several CPUs which were incorrectly detected as a different
|
||||
CPU model.
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit e89f87721406f6ad6e811ff613a22dc804d69355)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1686895
|
||||
|
||||
Conflicts:
|
||||
src/cpu_map/x86_Westmere.xml
|
||||
- cpu_map split not backported
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Message-Id: <facb5fd10ffe274e581e16db8362d0b8ee71424b.1561068591.git.jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
src/cpu/cpu_map.xml | 2 ++
|
||||
tests/cputestdata/x86_64-cpuid-Core-i5-650-json.xml | 9 +++++----
|
||||
tests/cputestdata/x86_64-cpuid-Pentium-P6100-guest.xml | 10 ++++++----
|
||||
tests/cputestdata/x86_64-cpuid-Xeon-E7-4820-guest.xml | 8 ++++----
|
||||
tests/cputestdata/x86_64-cpuid-Xeon-E7-4820-json.xml | 8 +++++---
|
||||
tests/cputestdata/x86_64-cpuid-Xeon-E7-4830-json.xml | 9 +++++----
|
||||
6 files changed, 27 insertions(+), 19 deletions(-)
|
||||
|
||||
diff --git a/src/cpu/cpu_map.xml b/src/cpu/cpu_map.xml
|
||||
index 4f9c247f3e..fed0f51934 100644
|
||||
--- a/src/cpu/cpu_map.xml
|
||||
+++ b/src/cpu/cpu_map.xml
|
||||
@@ -976,6 +976,8 @@
|
||||
|
||||
<model name='Westmere'>
|
||||
<signature family='6' model='44'/> <!-- 0206c0 -->
|
||||
+ <signature family='6' model='47'/> <!-- 0206f0 -->
|
||||
+ <signature family='6' model='37'/> <!-- 020650 -->
|
||||
<vendor name='Intel'/>
|
||||
<feature name='aes'/>
|
||||
<feature name='apic'/>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i5-650-json.xml b/tests/cputestdata/x86_64-cpuid-Core-i5-650-json.xml
|
||||
index f5980f53e5..cb21e48a9f 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Core-i5-650-json.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Core-i5-650-json.xml
|
||||
@@ -1,12 +1,13 @@
|
||||
<cpu mode='custom' match='exact'>
|
||||
- <model fallback='forbid'>SandyBridge</model>
|
||||
+ <model fallback='forbid'>Westmere</model>
|
||||
<vendor>Intel</vendor>
|
||||
<feature policy='require' name='vme'/>
|
||||
<feature policy='require' name='ss'/>
|
||||
+ <feature policy='require' name='pclmuldq'/>
|
||||
+ <feature policy='require' name='x2apic'/>
|
||||
+ <feature policy='require' name='tsc-deadline'/>
|
||||
<feature policy='require' name='hypervisor'/>
|
||||
<feature policy='require' name='arat'/>
|
||||
<feature policy='require' name='tsc_adjust'/>
|
||||
- <feature policy='disable' name='xsave'/>
|
||||
- <feature policy='disable' name='avx'/>
|
||||
- <feature policy='disable' name='xsaveopt'/>
|
||||
+ <feature policy='require' name='rdtscp'/>
|
||||
</cpu>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Pentium-P6100-guest.xml b/tests/cputestdata/x86_64-cpuid-Pentium-P6100-guest.xml
|
||||
index db5e0ae6af..20e2fa363a 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Pentium-P6100-guest.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Pentium-P6100-guest.xml
|
||||
@@ -1,6 +1,7 @@
|
||||
<cpu mode='custom' match='exact'>
|
||||
- <model fallback='forbid'>core2duo</model>
|
||||
+ <model fallback='forbid'>Westmere</model>
|
||||
<vendor>Intel</vendor>
|
||||
+ <feature policy='require' name='vme'/>
|
||||
<feature policy='require' name='ds'/>
|
||||
<feature policy='require' name='acpi'/>
|
||||
<feature policy='require' name='ss'/>
|
||||
@@ -8,16 +9,17 @@
|
||||
<feature policy='require' name='tm'/>
|
||||
<feature policy='require' name='pbe'/>
|
||||
<feature policy='require' name='dtes64'/>
|
||||
+ <feature policy='require' name='monitor'/>
|
||||
<feature policy='require' name='ds_cpl'/>
|
||||
<feature policy='require' name='est'/>
|
||||
<feature policy='require' name='tm2'/>
|
||||
- <feature policy='require' name='cx16'/>
|
||||
<feature policy='require' name='xtpr'/>
|
||||
<feature policy='require' name='pdcm'/>
|
||||
<feature policy='require' name='pcid'/>
|
||||
- <feature policy='require' name='popcnt'/>
|
||||
<feature policy='require' name='arat'/>
|
||||
<feature policy='require' name='rdtscp'/>
|
||||
- <feature policy='require' name='lahf_lm'/>
|
||||
<feature policy='require' name='invtsc'/>
|
||||
+ <feature policy='disable' name='sse4.1'/>
|
||||
+ <feature policy='disable' name='sse4.2'/>
|
||||
+ <feature policy='disable' name='aes'/>
|
||||
</cpu>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E7-4820-guest.xml b/tests/cputestdata/x86_64-cpuid-Xeon-E7-4820-guest.xml
|
||||
index dbf8580a0e..659779687a 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Xeon-E7-4820-guest.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E7-4820-guest.xml
|
||||
@@ -1,5 +1,5 @@
|
||||
<cpu mode='custom' match='exact'>
|
||||
- <model fallback='forbid'>SandyBridge</model>
|
||||
+ <model fallback='forbid'>Westmere</model>
|
||||
<vendor>Intel</vendor>
|
||||
<feature policy='require' name='vme'/>
|
||||
<feature policy='require' name='ds'/>
|
||||
@@ -8,6 +8,7 @@
|
||||
<feature policy='require' name='ht'/>
|
||||
<feature policy='require' name='tm'/>
|
||||
<feature policy='require' name='pbe'/>
|
||||
+ <feature policy='require' name='pclmuldq'/>
|
||||
<feature policy='require' name='dtes64'/>
|
||||
<feature policy='require' name='monitor'/>
|
||||
<feature policy='require' name='ds_cpl'/>
|
||||
@@ -19,10 +20,9 @@
|
||||
<feature policy='require' name='pdcm'/>
|
||||
<feature policy='require' name='pcid'/>
|
||||
<feature policy='require' name='dca'/>
|
||||
+ <feature policy='require' name='x2apic'/>
|
||||
<feature policy='require' name='arat'/>
|
||||
<feature policy='require' name='pdpe1gb'/>
|
||||
+ <feature policy='require' name='rdtscp'/>
|
||||
<feature policy='require' name='invtsc'/>
|
||||
- <feature policy='disable' name='tsc-deadline'/>
|
||||
- <feature policy='disable' name='xsave'/>
|
||||
- <feature policy='disable' name='avx'/>
|
||||
</cpu>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E7-4820-json.xml b/tests/cputestdata/x86_64-cpuid-Xeon-E7-4820-json.xml
|
||||
index d94a330f37..e8b74c5c30 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Xeon-E7-4820-json.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E7-4820-json.xml
|
||||
@@ -1,12 +1,14 @@
|
||||
<cpu mode='custom' match='exact'>
|
||||
- <model fallback='forbid'>SandyBridge</model>
|
||||
+ <model fallback='forbid'>Westmere</model>
|
||||
<vendor>Intel</vendor>
|
||||
<feature policy='require' name='vme'/>
|
||||
<feature policy='require' name='ss'/>
|
||||
+ <feature policy='require' name='pclmuldq'/>
|
||||
<feature policy='require' name='pcid'/>
|
||||
+ <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='pdpe1gb'/>
|
||||
- <feature policy='disable' name='xsave'/>
|
||||
- <feature policy='disable' name='avx'/>
|
||||
+ <feature policy='require' name='rdtscp'/>
|
||||
</cpu>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E7-4830-json.xml b/tests/cputestdata/x86_64-cpuid-Xeon-E7-4830-json.xml
|
||||
index aae32bd7e2..da949ad25e 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Xeon-E7-4830-json.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E7-4830-json.xml
|
||||
@@ -1,14 +1,15 @@
|
||||
<cpu mode='custom' match='exact'>
|
||||
- <model fallback='forbid'>SandyBridge</model>
|
||||
+ <model fallback='forbid'>Westmere</model>
|
||||
<vendor>Intel</vendor>
|
||||
<feature policy='require' name='vme'/>
|
||||
<feature policy='require' name='ss'/>
|
||||
+ <feature policy='require' name='pclmuldq'/>
|
||||
<feature policy='require' name='pcid'/>
|
||||
+ <feature policy='require' name='x2apic'/>
|
||||
+ <feature policy='require' name='tsc-deadline'/>
|
||||
<feature policy='require' name='hypervisor'/>
|
||||
<feature policy='require' name='arat'/>
|
||||
<feature policy='require' name='tsc_adjust'/>
|
||||
<feature policy='require' name='pdpe1gb'/>
|
||||
- <feature policy='disable' name='xsave'/>
|
||||
- <feature policy='disable' name='avx'/>
|
||||
- <feature policy='disable' name='xsaveopt'/>
|
||||
+ <feature policy='require' name='rdtscp'/>
|
||||
</cpu>
|
||||
--
|
||||
2.22.0
|
||||
|
@ -0,0 +1,110 @@
|
||||
From bd665085c2cd890f2249042f135b7a1735932d1b Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <bd665085c2cd890f2249042f135b7a1735932d1b@dist-git>
|
||||
From: Jiri Denemark <jdenemar@redhat.com>
|
||||
Date: Fri, 21 Jun 2019 09:24:48 +0200
|
||||
Subject: [PATCH] cpu_map: Add support for arch-capabilities feature
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The feature was added to QEMU in 3.1.0 and it is currently blocking
|
||||
migration, which is expected to change in the future. Luckily 3.1.0 is
|
||||
new enough to give us migratability hints on each feature via
|
||||
query-cpu-model-expension, which means we don't need to use the
|
||||
"migratable" attribute on the CPU map XML.
|
||||
|
||||
The kernel calls this feature arch_capabilities and RHEL/CentOS 7.* use
|
||||
arch-facilities. Apparently some CPU test files were gathered with the
|
||||
RHEL version of QEMU. Let's update the test files to avoid possible
|
||||
confusion about the correct naming.
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit 511df17aec36385320dbcc088ba85968537d1d42)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1693433
|
||||
|
||||
Conflicts:
|
||||
src/cpu_map/x86_features.xml
|
||||
- cpu_map split was not backported
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Message-Id: <fc8d72f3a2191ef85b537943aa1cc844f50b038d.1561068591.git.jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
src/cpu/cpu_map.xml | 3 +++
|
||||
tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-ibpb.json | 2 +-
|
||||
tests/cputestdata/x86_64-cpuid-Xeon-E5-2609-v3.json | 2 +-
|
||||
tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4.json | 2 +-
|
||||
tests/cputestdata/x86_64-cpuid-Xeon-Gold-5115.json | 2 +-
|
||||
5 files changed, 7 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/cpu/cpu_map.xml b/src/cpu/cpu_map.xml
|
||||
index ceee0ae489..a9f284fbbe 100644
|
||||
--- a/src/cpu/cpu_map.xml
|
||||
+++ b/src/cpu/cpu_map.xml
|
||||
@@ -337,6 +337,9 @@
|
||||
<feature name='stibp'>
|
||||
<cpuid eax_in='0x07' ecx_in='0x00' edx='0x08000000'/>
|
||||
</feature>
|
||||
+ <feature name='arch-capabilities'> <!-- arch_capabilities, arch-facilities -->
|
||||
+ <cpuid eax_in='0x07' ecx_in='0x00' edx='0x20000000'/>
|
||||
+ </feature>
|
||||
<feature name='ssbd'>
|
||||
<cpuid eax_in='0x07' ecx_in='0x00' edx='0x80000000'/>
|
||||
</feature>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-ibpb.json b/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-ibpb.json
|
||||
index 94a60fcc8f..1f53bb8bf3 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-ibpb.json
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-ibpb.json
|
||||
@@ -232,7 +232,7 @@
|
||||
"avx512vbmi": false,
|
||||
"kvm-asyncpf": true,
|
||||
"spec-ctrl": false,
|
||||
- "arch-facilities": false,
|
||||
+ "arch-capabilities": false,
|
||||
"model": 1,
|
||||
"node-id": -1
|
||||
}
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2609-v3.json b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2609-v3.json
|
||||
index 10c5434263..6bdaf6e83a 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2609-v3.json
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2609-v3.json
|
||||
@@ -232,7 +232,7 @@
|
||||
"avx512vbmi": false,
|
||||
"kvm-asyncpf": true,
|
||||
"spec-ctrl": true,
|
||||
- "arch-facilities": false,
|
||||
+ "arch-capabilities": false,
|
||||
"model": 63,
|
||||
"node-id": -1
|
||||
}
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4.json b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4.json
|
||||
index 0506dec0a7..2c6be20768 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4.json
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4.json
|
||||
@@ -232,7 +232,7 @@
|
||||
"avx512vbmi": false,
|
||||
"kvm-asyncpf": true,
|
||||
"spec-ctrl": true,
|
||||
- "arch-facilities": false,
|
||||
+ "arch-capabilities": false,
|
||||
"model": 79,
|
||||
"node-id": -1
|
||||
}
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-5115.json b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-5115.json
|
||||
index 79f3580219..79b47a56fb 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-5115.json
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-5115.json
|
||||
@@ -232,7 +232,7 @@
|
||||
"avx512vbmi": false,
|
||||
"kvm-asyncpf": true,
|
||||
"spec-ctrl": true,
|
||||
- "arch-facilities": false,
|
||||
+ "arch-capabilities": false,
|
||||
"model": 85,
|
||||
"node-id": -1
|
||||
}
|
||||
--
|
||||
2.22.0
|
||||
|
@ -0,0 +1,46 @@
|
||||
From e7f71788bb7c3534b97fe50b05212e64aa9d1412 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <e7f71788bb7c3534b97fe50b05212e64aa9d1412@dist-git>
|
||||
From: Jiri Denemark <jdenemar@redhat.com>
|
||||
Date: Thu, 25 Apr 2019 16:36:43 +0200
|
||||
Subject: [PATCH] cpu_map: Add support for cldemote CPU feature
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Added in QEMU by v2.12.0-481-g0da0fb0628 (released in 3.0).
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit 8feeee9ee23f0500cc2585e1b11231c54de8e93d)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1537731
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1537777
|
||||
|
||||
Conflicts:
|
||||
src/cpu_map/x86_features.xml
|
||||
- features are defined in src/cpu/cpu_map.xml downstream
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Message-Id: <bb26b8e5c8323be651bae3d1c15aa04528f2c26d.1556202959.git.jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
src/cpu/cpu_map.xml | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/src/cpu/cpu_map.xml b/src/cpu/cpu_map.xml
|
||||
index 095d49a69a..79c40cff34 100644
|
||||
--- a/src/cpu/cpu_map.xml
|
||||
+++ b/src/cpu/cpu_map.xml
|
||||
@@ -315,6 +315,9 @@
|
||||
<feature name='la57'>
|
||||
<cpuid eax_in='0x07' ecx_in='0x00' ecx='0x00010000'/>
|
||||
</feature>
|
||||
+ <feature name='cldemote'>
|
||||
+ <cpuid eax_in='0x07' ecx_in='0x00' ecx='0x02000000'/>
|
||||
+ </feature>
|
||||
|
||||
<feature name='avx512-4vnniw'>
|
||||
<cpuid eax_in='0x07' ecx_in='0x00' edx='0x00000004'/>
|
||||
--
|
||||
2.21.0
|
||||
|
102
SOURCES/libvirt-cpu_map-Define-md-clear-CPUID-bit.patch
Normal file
102
SOURCES/libvirt-cpu_map-Define-md-clear-CPUID-bit.patch
Normal file
@ -0,0 +1,102 @@
|
||||
From 28c9a09d1f42513344c546ac344f90ae3280fd5b Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <28c9a09d1f42513344c546ac344f90ae3280fd5b@dist-git>
|
||||
From: Jiri Denemark <jdenemar@redhat.com>
|
||||
Date: Fri, 5 Apr 2019 15:11:20 +0200
|
||||
Subject: [PATCH] cpu_map: Define md-clear CPUID bit
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
CVE-2018-12126, CVE-2018-12127, CVE-2018-12130, CVE-2019-11091
|
||||
|
||||
The bit is set when microcode provides the mechanism to invoke a flush
|
||||
of various exploitable CPU buffers by invoking the VERW instruction.
|
||||
|
||||
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||
(cherry picked from commit 538d873571d7a682852dc1d70e5f4478f4d64e85)
|
||||
|
||||
Conflicts:
|
||||
src/cpu_map/x86_features.xml
|
||||
- no CPU map split downstream
|
||||
|
||||
tests/cputestdata/x86_64-cpuid-Xeon-Platinum-8268-guest.xml
|
||||
tests/cputestdata/x86_64-cpuid-Xeon-Platinum-8268-host.xml
|
||||
- test data missing downstream
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
---
|
||||
src/cpu/cpu_map.xml | 3 +++
|
||||
tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-enabled.xml | 2 +-
|
||||
tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-guest.xml | 1 +
|
||||
tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-host.xml | 1 +
|
||||
tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-json.xml | 1 +
|
||||
5 files changed, 7 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/cpu/cpu_map.xml b/src/cpu/cpu_map.xml
|
||||
index 79c40cff34..ceee0ae489 100644
|
||||
--- a/src/cpu/cpu_map.xml
|
||||
+++ b/src/cpu/cpu_map.xml
|
||||
@@ -325,6 +325,9 @@
|
||||
<feature name='avx512-4fmaps'>
|
||||
<cpuid eax_in='0x07' ecx_in='0x00' edx='0x00000008'/>
|
||||
</feature>
|
||||
+ <feature name='md-clear'> <!-- md_clear -->
|
||||
+ <cpuid eax_in='0x07' ecx_in='0x00' edx='0x00000400'/>
|
||||
+ </feature>
|
||||
<feature name='pconfig'>
|
||||
<cpuid eax_in='0x07' ecx_in='0x00' edx='0x00040000'/>
|
||||
</feature>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-enabled.xml b/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-enabled.xml
|
||||
index 0deca9fba6..74763a462b 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-enabled.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-enabled.xml
|
||||
@@ -2,7 +2,7 @@
|
||||
<cpudata arch='x86'>
|
||||
<cpuid eax_in='0x00000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0xf7fa3203' edx='0x0f8bfbff'/>
|
||||
<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='0x009c4fbb' ecx='0x00000000' edx='0x8c000000'/>
|
||||
+ <cpuid eax_in='0x00000007' ecx_in='0x00' eax='0x00000000' ebx='0x009c4fbb' ecx='0x00000000' edx='0x8c000400'/>
|
||||
<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='0x00000121' edx='0x2c100800'/>
|
||||
</cpudata>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-guest.xml b/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-guest.xml
|
||||
index 70a0fc3286..867970d2c7 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-guest.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-guest.xml
|
||||
@@ -20,6 +20,7 @@
|
||||
<feature policy='require' name='tsc_adjust'/>
|
||||
<feature policy='require' name='clflushopt'/>
|
||||
<feature policy='require' name='intel-pt'/>
|
||||
+ <feature policy='require' name='md-clear'/>
|
||||
<feature policy='require' name='stibp'/>
|
||||
<feature policy='require' name='ssbd'/>
|
||||
<feature policy='require' name='xsaves'/>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-host.xml b/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-host.xml
|
||||
index bbdfb6aa61..e7ced42797 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-host.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-host.xml
|
||||
@@ -21,6 +21,7 @@
|
||||
<feature name='tsc_adjust'/>
|
||||
<feature name='clflushopt'/>
|
||||
<feature name='intel-pt'/>
|
||||
+ <feature name='md-clear'/>
|
||||
<feature name='stibp'/>
|
||||
<feature name='ssbd'/>
|
||||
<feature name='xsaves'/>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-json.xml b/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-json.xml
|
||||
index 1f321db273..a5591278df 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-json.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-json.xml
|
||||
@@ -5,6 +5,7 @@
|
||||
<feature policy='require' name='hypervisor'/>
|
||||
<feature policy='require' name='tsc_adjust'/>
|
||||
<feature policy='require' name='clflushopt'/>
|
||||
+ <feature policy='require' name='md-clear'/>
|
||||
<feature policy='require' name='stibp'/>
|
||||
<feature policy='require' name='ssbd'/>
|
||||
<feature policy='require' name='pdpe1gb'/>
|
||||
--
|
||||
2.21.0
|
||||
|
@ -0,0 +1,190 @@
|
||||
From 059091703401ef3029a1ffdbec8de97d5d5a1fd1 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <059091703401ef3029a1ffdbec8de97d5d5a1fd1@dist-git>
|
||||
From: Jiri Denemark <jdenemar@redhat.com>
|
||||
Date: Fri, 15 Nov 2019 17:52:36 +0100
|
||||
Subject: [PATCH] cpu_map: Drop pconfig from Icelake-Server CPU model
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The pconfig feature was enabled in QEMU by accident in 3.1.0. All other
|
||||
newer versions do not support it and it was removed from the
|
||||
Icelake-Server CPU model in QEMU.
|
||||
|
||||
We don't normally change our CPU models even when QEMU does so to avoid
|
||||
breaking migrations between different versions of libvirt. But we can
|
||||
safely do so in this specific case. QEMU never supported enabling
|
||||
pconfig so any domain which was able to start has pconfig disabled.
|
||||
|
||||
With a small compatibility hack which explicitly disables pconfig when
|
||||
CPU model equals Icelake-Server in migratable domain definition, only
|
||||
one migration scenario stays broken (and there's nothing we can do about
|
||||
it): from any host to a host with libvirt < 5.10.0 and QEMU > 3.1.0.
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1749672
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||
(cherry picked from commit 9cd03f7957e114892ae54e7ccb3758b6fb440644)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1756156
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1721608
|
||||
|
||||
Conflicts:
|
||||
src/cpu_map/x86_Icelake-Server.xml
|
||||
- still monolithic cpu_map.xml downstream
|
||||
|
||||
src/qemu/qemu_domain.h
|
||||
- context
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Message-Id: <6c06dac67da208e6ba8c07798c31405644acfb16.1573836581.git.jdenemar@redhat.com>
|
||||
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
---
|
||||
src/cpu/cpu_map.xml | 1 -
|
||||
src/qemu/qemu_domain.c | 23 +++++++++++++++++++
|
||||
src/qemu/qemu_domain.h | 3 +++
|
||||
src/qemu/qemu_migration_cookie.c | 3 +++
|
||||
.../x86_64-cpuid-Ice-Lake-Server-guest.xml | 1 -
|
||||
.../x86_64-cpuid-Ice-Lake-Server-host.xml | 11 +--------
|
||||
.../x86_64-cpuid-Ice-Lake-Server-json.xml | 1 -
|
||||
7 files changed, 30 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/src/cpu/cpu_map.xml b/src/cpu/cpu_map.xml
|
||||
index acd9dad7dc..7b9f8bb452 100644
|
||||
--- a/src/cpu/cpu_map.xml
|
||||
+++ b/src/cpu/cpu_map.xml
|
||||
@@ -2176,7 +2176,6 @@
|
||||
<feature name='pat'/>
|
||||
<feature name='pcid'/>
|
||||
<feature name='pclmuldq'/>
|
||||
- <feature name='pconfig'/>
|
||||
<feature name='pdpe1gb'/>
|
||||
<feature name='pge'/>
|
||||
<feature name='pku'/>
|
||||
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
|
||||
index c9899b9e6d..f45d7d427e 100644
|
||||
--- a/src/qemu/qemu_domain.c
|
||||
+++ b/src/qemu/qemu_domain.c
|
||||
@@ -7348,6 +7348,26 @@ qemuDomainDefCopy(virQEMUDriverPtr driver,
|
||||
}
|
||||
|
||||
|
||||
+int
|
||||
+qemuDomainMakeCPUMigratable(virCPUDefPtr cpu)
|
||||
+{
|
||||
+ if (cpu->mode == VIR_CPU_MODE_CUSTOM &&
|
||||
+ STREQ_NULLABLE(cpu->model, "Icelake-Server")) {
|
||||
+ /* Originally Icelake-Server CPU model contained pconfig CPU feature.
|
||||
+ * It was never actually enabled and thus it was removed. To enable
|
||||
+ * migration to QEMU 3.1.0 (with both new and old libvirt), we
|
||||
+ * explicitly disable pconfig in migration XML (otherwise old libvirt
|
||||
+ * would think it was implicitly enabled on the source). New libvirt
|
||||
+ * will drop it from the XML before starting the domain on new QEMU.
|
||||
+ */
|
||||
+ if (virCPUDefUpdateFeature(cpu, "pconfig", VIR_CPU_FEATURE_DISABLE) < 0)
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
static int
|
||||
qemuDomainDefFormatBufInternal(virQEMUDriverPtr driver,
|
||||
virDomainDefPtr def,
|
||||
@@ -7522,6 +7542,9 @@ qemuDomainDefFormatBufInternal(virQEMUDriverPtr driver,
|
||||
if (!(def->cpu = virCPUDefCopy(origCPU)))
|
||||
goto cleanup;
|
||||
}
|
||||
+
|
||||
+ if (qemuDomainMakeCPUMigratable(def->cpu) < 0)
|
||||
+ goto cleanup;
|
||||
}
|
||||
|
||||
format:
|
||||
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
|
||||
index 8463a8b706..a29a678771 100644
|
||||
--- a/src/qemu/qemu_domain.h
|
||||
+++ b/src/qemu/qemu_domain.h
|
||||
@@ -1072,4 +1072,7 @@ char * qemuDomainGetManagedPRSocketPath(qemuDomainObjPrivatePtr priv);
|
||||
virDomainEventResumedDetailType
|
||||
qemuDomainRunningReasonToResumeEvent(virDomainRunningReason reason);
|
||||
|
||||
+int
|
||||
+qemuDomainMakeCPUMigratable(virCPUDefPtr cpu);
|
||||
+
|
||||
#endif /* __QEMU_DOMAIN_H__ */
|
||||
diff --git a/src/qemu/qemu_migration_cookie.c b/src/qemu/qemu_migration_cookie.c
|
||||
index 60df449d53..c270896944 100644
|
||||
--- a/src/qemu/qemu_migration_cookie.c
|
||||
+++ b/src/qemu/qemu_migration_cookie.c
|
||||
@@ -543,6 +543,9 @@ qemuMigrationCookieAddCPU(qemuMigrationCookiePtr mig,
|
||||
if (!(mig->cpu = virCPUDefCopy(vm->def->cpu)))
|
||||
return -1;
|
||||
|
||||
+ if (qemuDomainMakeCPUMigratable(mig->cpu) < 0)
|
||||
+ return -1;
|
||||
+
|
||||
mig->flags |= QEMU_MIGRATION_COOKIE_CPU;
|
||||
|
||||
return 0;
|
||||
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 6ca2099b33..4676f3aa7d 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Ice-Lake-Server-guest.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Ice-Lake-Server-guest.xml
|
||||
@@ -32,5 +32,4 @@
|
||||
<feature policy='require' name='rdctl-no'/>
|
||||
<feature policy='require' name='ibrs-all'/>
|
||||
<feature policy='require' name='skip-l1dfl-vmentry'/>
|
||||
- <feature policy='disable' name='pconfig'/>
|
||||
</cpu>
|
||||
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 31af20bc85..35b9e39629 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Ice-Lake-Server-host.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Ice-Lake-Server-host.xml
|
||||
@@ -1,6 +1,6 @@
|
||||
<cpu>
|
||||
<arch>x86_64</arch>
|
||||
- <model>Icelake-Client</model>
|
||||
+ <model>Icelake-Server</model>
|
||||
<vendor>Intel</vendor>
|
||||
<feature name='ds'/>
|
||||
<feature name='acpi'/>
|
||||
@@ -21,23 +21,14 @@
|
||||
<feature name='osxsave'/>
|
||||
<feature name='tsc_adjust'/>
|
||||
<feature name='cmt'/>
|
||||
- <feature name='avx512f'/>
|
||||
- <feature name='avx512dq'/>
|
||||
<feature name='avx512ifma'/>
|
||||
- <feature name='clflushopt'/>
|
||||
- <feature name='clwb'/>
|
||||
- <feature name='avx512cd'/>
|
||||
<feature name='sha-ni'/>
|
||||
- <feature name='avx512bw'/>
|
||||
- <feature name='avx512vl'/>
|
||||
<feature name='ospke'/>
|
||||
- <feature name='la57'/>
|
||||
<feature name='stibp'/>
|
||||
<feature name='arch-capabilities'/>
|
||||
<feature name='xsaves'/>
|
||||
<feature name='mbm_total'/>
|
||||
<feature name='mbm_local'/>
|
||||
- <feature name='pdpe1gb'/>
|
||||
<feature name='invtsc'/>
|
||||
<feature name='rdctl-no'/>
|
||||
<feature name='ibrs-all'/>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Ice-Lake-Server-json.xml b/tests/cputestdata/x86_64-cpuid-Ice-Lake-Server-json.xml
|
||||
index b043db58d7..ada11d2608 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Ice-Lake-Server-json.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Ice-Lake-Server-json.xml
|
||||
@@ -13,5 +13,4 @@
|
||||
<feature policy='require' name='ibrs-all'/>
|
||||
<feature policy='require' name='skip-l1dfl-vmentry'/>
|
||||
<feature policy='disable' name='intel-pt'/>
|
||||
- <feature policy='disable' name='pconfig'/>
|
||||
</cpu>
|
||||
--
|
||||
2.24.0
|
||||
|
@ -0,0 +1,155 @@
|
||||
From 0c781b84fe81ca2d4865e92d6c22dafcea62261c Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <0c781b84fe81ca2d4865e92d6c22dafcea62261c@dist-git>
|
||||
From: Jiri Denemark <jdenemar@redhat.com>
|
||||
Date: Fri, 21 Jun 2019 09:26:10 +0200
|
||||
Subject: [PATCH] cpu_map: Introduce IA32_ARCH_CAPABILITIES MSR 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: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit c8ec678fd9d97189667c0121f48a220dd26856b7)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1697627
|
||||
|
||||
Conflicts:
|
||||
src/cpu_map/x86_features.xml
|
||||
- cpu_map XML is not split downstream
|
||||
|
||||
tests/domaincapsschemadata/qemu_3.1.0.x86_64.xml
|
||||
tests/domaincapsschemadata/qemu_4.0.0.x86_64.xml
|
||||
- missing
|
||||
|
||||
tests/domaincapsschemadata/qemu_4.1.0.x86_64.xml
|
||||
- commit 4586b11bed9bc59ea749e28f522bf5e0b462c4c7 not
|
||||
backported
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Message-Id: <acddba8b7464f063de46f04fc421319cc78ad86c.1561068591.git.jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
src/cpu/cpu_map.xml | 20 +++++++++++++++++++
|
||||
.../x86_64-cpuid-Core-i7-7600U-enabled.xml | 1 +
|
||||
.../x86_64-cpuid-Core-i7-7600U-json.xml | 1 +
|
||||
...86_64-cpuid-Xeon-Platinum-8268-enabled.xml | 1 +
|
||||
.../x86_64-cpuid-Xeon-Platinum-8268-guest.xml | 4 ++++
|
||||
.../x86_64-cpuid-Xeon-Platinum-8268-host.xml | 4 ++++
|
||||
.../x86_64-cpuid-Xeon-Platinum-8268-json.xml | 3 +++
|
||||
.../qemu_4.1.0.x86_64.xml | 1 +
|
||||
8 files changed, 35 insertions(+)
|
||||
|
||||
diff --git a/src/cpu/cpu_map.xml b/src/cpu/cpu_map.xml
|
||||
index 9b289556e8..acd9dad7dc 100644
|
||||
--- a/src/cpu/cpu_map.xml
|
||||
+++ b/src/cpu/cpu_map.xml
|
||||
@@ -482,6 +482,26 @@
|
||||
<cpuid eax_in='0x80000008' ebx='0x02000000'/>
|
||||
</feature>
|
||||
|
||||
+ <!-- IA32_ARCH_CAPABILITIES features -->
|
||||
+ <feature name='rdctl-no'>
|
||||
+ <msr index='0x10a' edx='0x00000000' eax='0x00000001'/>
|
||||
+ </feature>
|
||||
+ <feature name='ibrs-all'>
|
||||
+ <msr index='0x10a' edx='0x00000000' eax='0x00000002'/>
|
||||
+ </feature>
|
||||
+ <feature name='rsba'>
|
||||
+ <msr index='0x10a' edx='0x00000000' eax='0x00000004'/>
|
||||
+ </feature>
|
||||
+ <feature name='skip-l1dfl-vmentry'>
|
||||
+ <msr index='0x10a' edx='0x00000000' eax='0x00000008'/>
|
||||
+ </feature>
|
||||
+ <feature name='ssb-no'>
|
||||
+ <msr index='0x10a' edx='0x00000000' eax='0x00000010'/>
|
||||
+ </feature>
|
||||
+ <feature name='mds-no'>
|
||||
+ <msr index='0x10a' edx='0x00000000' eax='0x00000020'/>
|
||||
+ </feature>
|
||||
+
|
||||
<!-- models -->
|
||||
<model name='486'>
|
||||
<feature name='fpu'/>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-7600U-enabled.xml b/tests/cputestdata/x86_64-cpuid-Core-i7-7600U-enabled.xml
|
||||
index b1cdaa802a..58bc84577c 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Core-i7-7600U-enabled.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-7600U-enabled.xml
|
||||
@@ -5,4 +5,5 @@
|
||||
<cpuid eax_in='0x00000007' ecx_in='0x00' eax='0x00000000' ebx='0x009c4fbb' ecx='0x00000004' edx='0x84000000'/>
|
||||
<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'/>
|
||||
</cpudata>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-7600U-json.xml b/tests/cputestdata/x86_64-cpuid-Core-i7-7600U-json.xml
|
||||
index 48089c6003..690081493b 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Core-i7-7600U-json.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-7600U-json.xml
|
||||
@@ -10,4 +10,5 @@
|
||||
<feature policy='require' name='ssbd'/>
|
||||
<feature policy='require' name='xsaves'/>
|
||||
<feature policy='require' name='pdpe1gb'/>
|
||||
+ <feature policy='require' name='skip-l1dfl-vmentry'/>
|
||||
</cpu>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-8268-enabled.xml b/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-8268-enabled.xml
|
||||
index 434ac1956a..313009b156 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-8268-enabled.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-8268-enabled.xml
|
||||
@@ -5,4 +5,5 @@
|
||||
<cpuid eax_in='0x00000007' ecx_in='0x00' eax='0x00000000' ebx='0xd19f4fbb' ecx='0x0000080c' edx='0x84000000'/>
|
||||
<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='0x0000000b'/>
|
||||
</cpudata>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-8268-guest.xml b/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-8268-guest.xml
|
||||
index c7e8a1fccf..988fb1dbdc 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-8268-guest.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-8268-guest.xml
|
||||
@@ -30,4 +30,8 @@
|
||||
<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'/>
|
||||
</cpu>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-8268-host.xml b/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-8268-host.xml
|
||||
index d7482751b4..fdeafc4870 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-8268-host.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-8268-host.xml
|
||||
@@ -31,4 +31,8 @@
|
||||
<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'/>
|
||||
</cpu>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-8268-json.xml b/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-8268-json.xml
|
||||
index b7d12dced7..78863c61d1 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-8268-json.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-8268-json.xml
|
||||
@@ -7,4 +7,7 @@
|
||||
<feature policy='require' name='umip'/>
|
||||
<feature policy='require' name='pku'/>
|
||||
<feature policy='require' name='xsaves'/>
|
||||
+ <feature policy='require' name='rdctl-no'/>
|
||||
+ <feature policy='require' name='ibrs-all'/>
|
||||
+ <feature policy='require' name='skip-l1dfl-vmentry'/>
|
||||
</cpu>
|
||||
diff --git a/tests/domaincapsschemadata/qemu_4.1.0.x86_64.xml b/tests/domaincapsschemadata/qemu_4.1.0.x86_64.xml
|
||||
index 47aed6a43a..63ae7957c4 100644
|
||||
--- a/tests/domaincapsschemadata/qemu_4.1.0.x86_64.xml
|
||||
+++ b/tests/domaincapsschemadata/qemu_4.1.0.x86_64.xml
|
||||
@@ -34,6 +34,7 @@
|
||||
<feature policy='require' name='arch-capabilities'/>
|
||||
<feature policy='require' name='xsaves'/>
|
||||
<feature policy='require' name='pdpe1gb'/>
|
||||
+ <feature policy='require' name='skip-l1dfl-vmentry'/>
|
||||
</mode>
|
||||
<mode name='custom' supported='yes'>
|
||||
<model usable='yes'>qemu64</model>
|
||||
--
|
||||
2.22.0
|
||||
|
@ -0,0 +1,46 @@
|
||||
From a919b41c576e9619b14bcc599a2a0c844943f40b Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <a919b41c576e9619b14bcc599a2a0c844943f40b@dist-git>
|
||||
From: Jiri Denemark <jdenemar@redhat.com>
|
||||
Date: Fri, 10 Jan 2020 12:01:47 +0100
|
||||
Subject: [PATCH] cpu_map/x86: Add support for BFLOAT16 data type
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Introduced in QEMU by commit v4.1.0-266-g80db491da4.
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit b570139909fd5d11d82408218a8f1f590a6386b2)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1749516
|
||||
|
||||
Conflicts:
|
||||
src/cpu_map/x86_features.xml
|
||||
- features are defined in src/cpu/cpu_map.xml
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Message-Id: <dac9dd35ec9d467da7ffef82de38adb9c8385d0f.1578654092.git.jdenemar@redhat.com>
|
||||
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
|
||||
---
|
||||
src/cpu/cpu_map.xml | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/src/cpu/cpu_map.xml b/src/cpu/cpu_map.xml
|
||||
index 9609ce71a7..c09c80a2e9 100644
|
||||
--- a/src/cpu/cpu_map.xml
|
||||
+++ b/src/cpu/cpu_map.xml
|
||||
@@ -344,6 +344,10 @@
|
||||
<cpuid eax_in='0x07' ecx_in='0x00' edx='0x80000000'/>
|
||||
</feature>
|
||||
|
||||
+ <feature name='avx512-bf16'>
|
||||
+ <cpuid eax_in='0x07' ecx_in='0x01' eax='0x00000020'/>
|
||||
+ </feature>
|
||||
+
|
||||
<!-- Processor Extended State Enumeration sub leaf 1 -->
|
||||
<feature name='xsaveopt'>
|
||||
<cpuid eax_in='0x0d' ecx_in='0x01' eax='0x00000001'/>
|
||||
--
|
||||
2.24.1
|
||||
|
@ -0,0 +1,328 @@
|
||||
From 808b0c73134cd3c6a7fdd387fd9654dbd41356ac Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <808b0c73134cd3c6a7fdd387fd9654dbd41356ac@dist-git>
|
||||
From: Jiri Denemark <jdenemar@redhat.com>
|
||||
Date: Fri, 21 Jun 2019 09:25:39 +0200
|
||||
Subject: [PATCH] cpu_x86: Add support for storing MSR features in CPU map
|
||||
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: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit fcf4846a6bb902a5cd2230fff2a1e7591dcb7456)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1697627
|
||||
|
||||
Conflicts:
|
||||
tests/cputestdata/cpu-cpuid.py
|
||||
- no need to update this script downstream
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Message-Id: <0c37dabaaa6c2559b48918ca55e170750fe34ea0.1561068591.git.jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
src/cpu/cpu_x86.c | 127 +++++++++++++++++++++++++++++++++++++----
|
||||
src/cpu/cpu_x86_data.h | 10 ++++
|
||||
2 files changed, 125 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
|
||||
index e6da974b31..49562944c1 100644
|
||||
--- a/src/cpu/cpu_x86.c
|
||||
+++ b/src/cpu/cpu_x86.c
|
||||
@@ -197,6 +197,8 @@ virCPUx86DataItemMatch(const virCPUx86DataItem *item1,
|
||||
{
|
||||
const virCPUx86CPUID *cpuid1;
|
||||
const virCPUx86CPUID *cpuid2;
|
||||
+ const virCPUx86MSR *msr1;
|
||||
+ const virCPUx86MSR *msr2;
|
||||
|
||||
switch (item1->type) {
|
||||
case VIR_CPU_X86_DATA_CPUID:
|
||||
@@ -207,6 +209,12 @@ virCPUx86DataItemMatch(const virCPUx86DataItem *item1,
|
||||
cpuid1->ecx == cpuid2->ecx &&
|
||||
cpuid1->edx == cpuid2->edx);
|
||||
|
||||
+ case VIR_CPU_X86_DATA_MSR:
|
||||
+ msr1 = &item1->data.msr;
|
||||
+ msr2 = &item2->data.msr;
|
||||
+ return (msr1->eax == msr2->eax &&
|
||||
+ msr1->edx == msr2->edx);
|
||||
+
|
||||
case VIR_CPU_X86_DATA_NONE:
|
||||
default:
|
||||
return false;
|
||||
@@ -220,6 +228,8 @@ virCPUx86DataItemMatchMasked(const virCPUx86DataItem *item,
|
||||
{
|
||||
const virCPUx86CPUID *cpuid;
|
||||
const virCPUx86CPUID *cpuidMask;
|
||||
+ const virCPUx86MSR *msr;
|
||||
+ const virCPUx86MSR *msrMask;
|
||||
|
||||
switch (item->type) {
|
||||
case VIR_CPU_X86_DATA_CPUID:
|
||||
@@ -230,6 +240,12 @@ virCPUx86DataItemMatchMasked(const virCPUx86DataItem *item,
|
||||
(cpuid->ecx & cpuidMask->ecx) == cpuidMask->ecx &&
|
||||
(cpuid->edx & cpuidMask->edx) == cpuidMask->edx);
|
||||
|
||||
+ case VIR_CPU_X86_DATA_MSR:
|
||||
+ msr = &item->data.msr;
|
||||
+ msrMask = &mask->data.msr;
|
||||
+ return ((msr->eax & msrMask->eax) == msrMask->eax &&
|
||||
+ (msr->edx & msrMask->edx) == msrMask->edx);
|
||||
+
|
||||
case VIR_CPU_X86_DATA_NONE:
|
||||
default:
|
||||
return false;
|
||||
@@ -243,6 +259,8 @@ virCPUx86DataItemSetBits(virCPUx86DataItemPtr item,
|
||||
{
|
||||
virCPUx86CPUIDPtr cpuid;
|
||||
const virCPUx86CPUID *cpuidMask;
|
||||
+ virCPUx86MSRPtr msr;
|
||||
+ const virCPUx86MSR *msrMask;
|
||||
|
||||
if (!mask)
|
||||
return;
|
||||
@@ -257,6 +275,13 @@ virCPUx86DataItemSetBits(virCPUx86DataItemPtr item,
|
||||
cpuid->edx |= cpuidMask->edx;
|
||||
break;
|
||||
|
||||
+ case VIR_CPU_X86_DATA_MSR:
|
||||
+ msr = &item->data.msr;
|
||||
+ msrMask = &mask->data.msr;
|
||||
+ msr->eax |= msrMask->eax;
|
||||
+ msr->edx |= msrMask->edx;
|
||||
+ break;
|
||||
+
|
||||
case VIR_CPU_X86_DATA_NONE:
|
||||
default:
|
||||
break;
|
||||
@@ -270,6 +295,8 @@ virCPUx86DataItemClearBits(virCPUx86DataItemPtr item,
|
||||
{
|
||||
virCPUx86CPUIDPtr cpuid;
|
||||
const virCPUx86CPUID *cpuidMask;
|
||||
+ virCPUx86MSRPtr msr;
|
||||
+ const virCPUx86MSR *msrMask;
|
||||
|
||||
if (!mask)
|
||||
return;
|
||||
@@ -284,6 +311,13 @@ virCPUx86DataItemClearBits(virCPUx86DataItemPtr item,
|
||||
cpuid->edx &= ~cpuidMask->edx;
|
||||
break;
|
||||
|
||||
+ case VIR_CPU_X86_DATA_MSR:
|
||||
+ msr = &item->data.msr;
|
||||
+ msrMask = &mask->data.msr;
|
||||
+ msr->eax &= ~msrMask->eax;
|
||||
+ msr->edx &= ~msrMask->edx;
|
||||
+ break;
|
||||
+
|
||||
case VIR_CPU_X86_DATA_NONE:
|
||||
default:
|
||||
break;
|
||||
@@ -297,6 +331,8 @@ virCPUx86DataItemAndBits(virCPUx86DataItemPtr item,
|
||||
{
|
||||
virCPUx86CPUIDPtr cpuid;
|
||||
const virCPUx86CPUID *cpuidMask;
|
||||
+ virCPUx86MSRPtr msr;
|
||||
+ const virCPUx86MSR *msrMask;
|
||||
|
||||
if (!mask)
|
||||
return;
|
||||
@@ -311,6 +347,13 @@ virCPUx86DataItemAndBits(virCPUx86DataItemPtr item,
|
||||
cpuid->edx &= cpuidMask->edx;
|
||||
break;
|
||||
|
||||
+ case VIR_CPU_X86_DATA_MSR:
|
||||
+ msr = &item->data.msr;
|
||||
+ msrMask = &mask->data.msr;
|
||||
+ msr->eax &= msrMask->eax;
|
||||
+ msr->edx &= msrMask->edx;
|
||||
+ break;
|
||||
+
|
||||
case VIR_CPU_X86_DATA_NONE:
|
||||
default:
|
||||
break;
|
||||
@@ -373,6 +416,14 @@ virCPUx86DataSorter(const void *a, const void *b)
|
||||
|
||||
break;
|
||||
|
||||
+ case VIR_CPU_X86_DATA_MSR:
|
||||
+ if (da->data.msr.index > db->data.msr.index)
|
||||
+ return 1;
|
||||
+ else if (da->data.msr.index < db->data.msr.index)
|
||||
+ return -1;
|
||||
+
|
||||
+ break;
|
||||
+
|
||||
case VIR_CPU_X86_DATA_NONE:
|
||||
default:
|
||||
break;
|
||||
@@ -978,6 +1029,31 @@ x86ParseCPUID(xmlXPathContextPtr ctxt,
|
||||
}
|
||||
|
||||
|
||||
+static int
|
||||
+x86ParseMSR(xmlXPathContextPtr ctxt,
|
||||
+ virCPUx86DataItemPtr item)
|
||||
+{
|
||||
+ virCPUx86MSRPtr msr;
|
||||
+ unsigned long index;
|
||||
+ unsigned long eax;
|
||||
+ unsigned long edx;
|
||||
+
|
||||
+ memset(item, 0, sizeof(*item));
|
||||
+
|
||||
+ if (virXPathULongHex("string(@index)", ctxt, &index) < 0 ||
|
||||
+ virXPathULongHex("string(@eax)", ctxt, &eax) < 0 ||
|
||||
+ virXPathULongHex("string(@edx)", ctxt, &edx) < 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ item->type = VIR_CPU_X86_DATA_MSR;
|
||||
+ msr = &item->data.msr;
|
||||
+ msr->index = index;
|
||||
+ msr->eax = eax;
|
||||
+ msr->edx = edx;
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
static int
|
||||
x86FeatureParse(xmlXPathContextPtr ctxt,
|
||||
const char *name,
|
||||
@@ -1010,25 +1086,35 @@ x86FeatureParse(xmlXPathContextPtr ctxt,
|
||||
if (STREQ_NULLABLE(str, "no"))
|
||||
feature->migratable = false;
|
||||
|
||||
- n = virXPathNodeSet("./cpuid", ctxt, &nodes);
|
||||
+ n = virXPathNodeSet("./cpuid|./msr", ctxt, &nodes);
|
||||
if (n < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (n == 0) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
- _("Missing cpuid for feature %s"),
|
||||
+ _("Missing cpuid or msr element in feature %s"),
|
||||
feature->name);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
ctxt->node = nodes[i];
|
||||
- if (x86ParseCPUID(ctxt, &item) < 0) {
|
||||
- virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
- _("Invalid cpuid[%zu] in %s feature"),
|
||||
- i, feature->name);
|
||||
- goto cleanup;
|
||||
+ if (virXMLNodeNameEqual(nodes[i], "cpuid")) {
|
||||
+ if (x86ParseCPUID(ctxt, &item) < 0) {
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
+ _("Invalid cpuid[%zu] in %s feature"),
|
||||
+ i, feature->name);
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+ } else {
|
||||
+ if (x86ParseMSR(ctxt, &item) < 0) {
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
+ _("Invalid msr[%zu] in %s feature"),
|
||||
+ i, feature->name);
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
}
|
||||
+
|
||||
if (virCPUx86DataAddItem(&feature->data, &item))
|
||||
goto cleanup;
|
||||
}
|
||||
@@ -1544,6 +1630,7 @@ virCPUx86DataFormat(const virCPUData *data)
|
||||
virBufferAddLit(&buf, "<cpudata arch='x86'>\n");
|
||||
while ((item = virCPUx86DataNext(&iter))) {
|
||||
virCPUx86CPUIDPtr cpuid;
|
||||
+ virCPUx86MSRPtr msr;
|
||||
|
||||
switch (item->type) {
|
||||
case VIR_CPU_X86_DATA_CPUID:
|
||||
@@ -1556,6 +1643,13 @@ virCPUx86DataFormat(const virCPUData *data)
|
||||
cpuid->eax, cpuid->ebx, cpuid->ecx, cpuid->edx);
|
||||
break;
|
||||
|
||||
+ case VIR_CPU_X86_DATA_MSR:
|
||||
+ msr = &item->data.msr;
|
||||
+ virBufferAsprintf(&buf,
|
||||
+ " <msr index='0x%x' eax='0x%08x' edx='0x%08x'/>\n",
|
||||
+ msr->index, msr->eax, msr->edx);
|
||||
+ break;
|
||||
+
|
||||
case VIR_CPU_X86_DATA_NONE:
|
||||
default:
|
||||
break;
|
||||
@@ -1579,7 +1673,7 @@ virCPUx86DataParse(xmlXPathContextPtr ctxt)
|
||||
size_t i;
|
||||
int n;
|
||||
|
||||
- n = virXPathNodeSet("/cpudata/cpuid", ctxt, &nodes);
|
||||
+ n = virXPathNodeSet("/cpudata/cpuid|/cpudata/msr", ctxt, &nodes);
|
||||
if (n <= 0) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("no x86 CPU data found"));
|
||||
@@ -1591,11 +1685,20 @@ virCPUx86DataParse(xmlXPathContextPtr ctxt)
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
ctxt->node = nodes[i];
|
||||
- if (x86ParseCPUID(ctxt, &item) < 0) {
|
||||
- virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
- _("failed to parse cpuid[%zu]"), i);
|
||||
- goto error;
|
||||
+ if (virXMLNodeNameEqual(nodes[i], "cpuid")) {
|
||||
+ if (x86ParseCPUID(ctxt, &item) < 0) {
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
+ _("failed to parse cpuid[%zu]"), i);
|
||||
+ goto error;
|
||||
+ }
|
||||
+ } else {
|
||||
+ if (x86ParseMSR(ctxt, &item) < 0) {
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
+ _("failed to parse msr[%zu]"), i);
|
||||
+ goto error;
|
||||
+ }
|
||||
}
|
||||
+
|
||||
if (virCPUx86DataAdd(cpuData, &item) < 0)
|
||||
goto error;
|
||||
}
|
||||
diff --git a/src/cpu/cpu_x86_data.h b/src/cpu/cpu_x86_data.h
|
||||
index da8e91fe71..454345b688 100644
|
||||
--- a/src/cpu/cpu_x86_data.h
|
||||
+++ b/src/cpu/cpu_x86_data.h
|
||||
@@ -37,6 +37,14 @@ struct _virCPUx86CPUID {
|
||||
uint32_t edx;
|
||||
};
|
||||
|
||||
+typedef struct _virCPUx86MSR virCPUx86MSR;
|
||||
+typedef virCPUx86MSR *virCPUx86MSRPtr;
|
||||
+struct _virCPUx86MSR {
|
||||
+ uint32_t index;
|
||||
+ uint32_t eax;
|
||||
+ uint32_t edx;
|
||||
+};
|
||||
+
|
||||
# define CPUX86_BASIC 0x0
|
||||
# define CPUX86_KVM 0x40000000
|
||||
# define CPUX86_EXTENDED 0x80000000
|
||||
@@ -74,6 +82,7 @@ struct _virCPUx86CPUID {
|
||||
typedef enum {
|
||||
VIR_CPU_X86_DATA_NONE = 0,
|
||||
VIR_CPU_X86_DATA_CPUID,
|
||||
+ VIR_CPU_X86_DATA_MSR,
|
||||
} virCPUx86DataType;
|
||||
|
||||
typedef struct _virCPUx86DataItem virCPUx86DataItem;
|
||||
@@ -82,6 +91,7 @@ struct _virCPUx86DataItem {
|
||||
virCPUx86DataType type;
|
||||
union {
|
||||
virCPUx86CPUID cpuid;
|
||||
+ virCPUx86MSR msr;
|
||||
} data;
|
||||
};
|
||||
|
||||
--
|
||||
2.22.0
|
||||
|
@ -0,0 +1,81 @@
|
||||
From 459e059de518794d909c77b6c24fd6962558d362 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <459e059de518794d909c77b6c24fd6962558d362@dist-git>
|
||||
From: Jiri Denemark <jdenemar@redhat.com>
|
||||
Date: Fri, 21 Jun 2019 09:25:06 +0200
|
||||
Subject: [PATCH] cpu_x86: Add virCPUx86DataGetSignature for tests
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The function exports the functionality of x86DataToSignatureFull and
|
||||
x86MakeSignature to the test suite.
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit 661307b4b2e8597d889efddfac0ff5d324c9fa42)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1686895
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Message-Id: <7964c9cc9ea47fdce4c2b07fda8efa2cb9f9f384.1561068591.git.jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
src/cpu/cpu_x86.c | 12 ++++++++++++
|
||||
src/cpu/cpu_x86.h | 5 +++++
|
||||
src/libvirt_private.syms | 1 +
|
||||
3 files changed, 18 insertions(+)
|
||||
|
||||
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
|
||||
index ba14a6097d..24569a90f3 100644
|
||||
--- a/src/cpu/cpu_x86.c
|
||||
+++ b/src/cpu/cpu_x86.c
|
||||
@@ -3066,6 +3066,18 @@ virCPUx86DataSetSignature(virCPUDataPtr cpuData,
|
||||
}
|
||||
|
||||
|
||||
+uint32_t
|
||||
+virCPUx86DataGetSignature(virCPUDataPtr cpuData,
|
||||
+ unsigned int *family,
|
||||
+ unsigned int *model,
|
||||
+ unsigned int *stepping)
|
||||
+{
|
||||
+ x86DataToSignatureFull(&cpuData->data.x86, family, model, stepping);
|
||||
+
|
||||
+ return x86MakeSignature(*family, *model, *stepping);
|
||||
+}
|
||||
+
|
||||
+
|
||||
int
|
||||
virCPUx86DataSetVendor(virCPUDataPtr cpuData,
|
||||
const char *vendor)
|
||||
diff --git a/src/cpu/cpu_x86.h b/src/cpu/cpu_x86.h
|
||||
index 5d14d83e1b..9d3c2b2cdd 100644
|
||||
--- a/src/cpu/cpu_x86.h
|
||||
+++ b/src/cpu/cpu_x86.h
|
||||
@@ -37,6 +37,11 @@ int virCPUx86DataSetSignature(virCPUDataPtr cpuData,
|
||||
unsigned int model,
|
||||
unsigned int stepping);
|
||||
|
||||
+uint32_t virCPUx86DataGetSignature(virCPUDataPtr cpuData,
|
||||
+ unsigned int *family,
|
||||
+ unsigned int *model,
|
||||
+ unsigned int *stepping);
|
||||
+
|
||||
int virCPUx86DataSetVendor(virCPUDataPtr cpuData,
|
||||
const char *vendor);
|
||||
|
||||
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
|
||||
index 7c48908a54..a275fa9aa1 100644
|
||||
--- a/src/libvirt_private.syms
|
||||
+++ b/src/libvirt_private.syms
|
||||
@@ -1205,6 +1205,7 @@ virCPUValidateFeatures;
|
||||
# cpu/cpu_x86.h
|
||||
virCPUx86DataAddCPUID;
|
||||
virCPUx86DataAddFeature;
|
||||
+virCPUx86DataGetSignature;
|
||||
virCPUx86DataSetSignature;
|
||||
virCPUx86DataSetVendor;
|
||||
|
||||
--
|
||||
2.22.0
|
||||
|
@ -0,0 +1,77 @@
|
||||
From 0b98a3d385f3d46949c5b2bc15c27c7c62739496 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <0b98a3d385f3d46949c5b2bc15c27c7c62739496@dist-git>
|
||||
From: Jiri Denemark <jdenemar@redhat.com>
|
||||
Date: Fri, 21 Jun 2019 09:24:59 +0200
|
||||
Subject: [PATCH] cpu_x86: Add x86ModelCopySignatures helper
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Introduce a helper for copying CPU signature between two CPU models.
|
||||
|
||||
It's not very useful until the way we store signatures is changed in the
|
||||
next patch.
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit 2254c1cfb854dfc52f3b4bfdfca2bd995b0a163c)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1686895
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Message-Id: <eb973566dab0f8d77ff536e4c56eb6bffd77928f.1561068591.git.jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
src/cpu/cpu_x86.c | 16 +++++++++++++---
|
||||
1 file changed, 13 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
|
||||
index 51cb9b7143..e25bc691ae 100644
|
||||
--- a/src/cpu/cpu_x86.c
|
||||
+++ b/src/cpu/cpu_x86.c
|
||||
@@ -977,6 +977,16 @@ x86ModelFree(virCPUx86ModelPtr model)
|
||||
}
|
||||
|
||||
|
||||
+static int
|
||||
+x86ModelCopySignatures(virCPUx86ModelPtr dst,
|
||||
+ virCPUx86ModelPtr src)
|
||||
+{
|
||||
+ dst->signature = src->signature;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
static virCPUx86ModelPtr
|
||||
x86ModelCopy(virCPUx86ModelPtr model)
|
||||
{
|
||||
@@ -984,13 +994,13 @@ x86ModelCopy(virCPUx86ModelPtr model)
|
||||
|
||||
if (VIR_ALLOC(copy) < 0 ||
|
||||
VIR_STRDUP(copy->name, model->name) < 0 ||
|
||||
+ x86ModelCopySignatures(copy, model) < 0 ||
|
||||
x86DataCopy(©->data, &model->data) < 0) {
|
||||
x86ModelFree(copy);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
copy->vendor = model->vendor;
|
||||
- copy->signature = model->signature;
|
||||
|
||||
return copy;
|
||||
}
|
||||
@@ -1176,8 +1186,8 @@ x86ModelParseAncestor(virCPUx86ModelPtr model,
|
||||
}
|
||||
|
||||
model->vendor = ancestor->vendor;
|
||||
- model->signature = ancestor->signature;
|
||||
- if (x86DataCopy(&model->data, &ancestor->data) < 0)
|
||||
+ if (x86ModelCopySignatures(model, ancestor) < 0 ||
|
||||
+ x86DataCopy(&model->data, &ancestor->data) < 0)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
--
|
||||
2.22.0
|
||||
|
@ -0,0 +1,114 @@
|
||||
From 5196a4b5fad475a8489faa9b5542536a941bd9da Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <5196a4b5fad475a8489faa9b5542536a941bd9da@dist-git>
|
||||
From: Jiri Denemark <jdenemar@redhat.com>
|
||||
Date: Fri, 21 Jun 2019 09:25:01 +0200
|
||||
Subject: [PATCH] cpu_x86: Allow multiple signatures for a CPU model
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
CPU signatures in the cpu_map serve as a hint for CPUID to CPU model
|
||||
matching algorithm. If the CPU signatures matches any CPU model in the
|
||||
cpu_map, this model will be the preferred one.
|
||||
|
||||
This works out well and solved several mismatches, but in real world
|
||||
CPUs which should match a single CPU model may be produced with several
|
||||
different signatures. For example, low voltage Broadwell CPUs for
|
||||
laptops and Broadwell CPUs for servers differ in CPU model numbers while
|
||||
we should detect them all as Broadwell CPU model.
|
||||
|
||||
This patch adds support for storing several signatures for a single CPU
|
||||
model to make this hint useful for more CPUs. Later commits will provide
|
||||
additional signatures for existing CPU models, which will correct some
|
||||
results in our CPU test suite.
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit dfeb3e598438a891a05487c34e6723d1d3ed9256)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1686895
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Message-Id: <393649e6301769c297f2d09bcb88d6200882eb9d.1561068591.git.jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
src/cpu/cpu_x86.c | 31 +++++++++++++++++++++----------
|
||||
1 file changed, 21 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
|
||||
index f8b8d8a96b..7bd8119c23 100644
|
||||
--- a/src/cpu/cpu_x86.c
|
||||
+++ b/src/cpu/cpu_x86.c
|
||||
@@ -1204,22 +1204,32 @@ x86ModelParseAncestor(virCPUx86ModelPtr model,
|
||||
|
||||
|
||||
static int
|
||||
-x86ModelParseSignature(virCPUx86ModelPtr model,
|
||||
- xmlXPathContextPtr ctxt)
|
||||
+x86ModelParseSignatures(virCPUx86ModelPtr model,
|
||||
+ xmlXPathContextPtr ctxt)
|
||||
{
|
||||
+ VIR_AUTOFREE(xmlNodePtr *) nodes = NULL;
|
||||
+ xmlNodePtr root = ctxt->node;
|
||||
+ size_t i;
|
||||
+ int n;
|
||||
+
|
||||
+ if ((n = virXPathNodeSet("./signature", ctxt, &nodes)) <= 0)
|
||||
+ return n;
|
||||
+
|
||||
/* Remove inherited signatures. */
|
||||
VIR_FREE(model->signatures);
|
||||
|
||||
- if (virXPathBoolean("boolean(./signature)", ctxt)) {
|
||||
+ model->nsignatures = n;
|
||||
+ if (VIR_ALLOC_N(model->signatures, n) < 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ for (i = 0; i < n; i++) {
|
||||
unsigned int sigFamily = 0;
|
||||
unsigned int sigModel = 0;
|
||||
int rc;
|
||||
|
||||
- model->nsignatures = 1;
|
||||
- if (VIR_ALLOC_N(model->signatures, 1) < 0)
|
||||
- return -1;
|
||||
+ ctxt->node = nodes[i];
|
||||
|
||||
- rc = virXPathUInt("string(./signature/@family)", ctxt, &sigFamily);
|
||||
+ rc = virXPathUInt("string(@family)", ctxt, &sigFamily);
|
||||
if (rc < 0 || sigFamily == 0) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Invalid CPU signature family in model %s"),
|
||||
@@ -1227,7 +1237,7 @@ x86ModelParseSignature(virCPUx86ModelPtr model,
|
||||
return -1;
|
||||
}
|
||||
|
||||
- rc = virXPathUInt("string(./signature/@model)", ctxt, &sigModel);
|
||||
+ rc = virXPathUInt("string(@model)", ctxt, &sigModel);
|
||||
if (rc < 0 || sigModel == 0) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Invalid CPU signature model in model %s"),
|
||||
@@ -1235,9 +1245,10 @@ x86ModelParseSignature(virCPUx86ModelPtr model,
|
||||
return -1;
|
||||
}
|
||||
|
||||
- model->signatures[0] = x86MakeSignature(sigFamily, sigModel, 0);
|
||||
+ model->signatures[i] = x86MakeSignature(sigFamily, sigModel, 0);
|
||||
}
|
||||
|
||||
+ ctxt->node = root;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1334,7 +1345,7 @@ x86ModelParse(xmlXPathContextPtr ctxt,
|
||||
if (x86ModelParseAncestor(model, ctxt, map) < 0)
|
||||
goto cleanup;
|
||||
|
||||
- if (x86ModelParseSignature(model, ctxt) < 0)
|
||||
+ if (x86ModelParseSignatures(model, ctxt) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (x86ModelParseVendor(model, ctxt, map) < 0)
|
||||
--
|
||||
2.22.0
|
||||
|
60
SOURCES/libvirt-cpu_x86-Do-not-cache-microcode-version.patch
Normal file
60
SOURCES/libvirt-cpu_x86-Do-not-cache-microcode-version.patch
Normal file
@ -0,0 +1,60 @@
|
||||
From f574d83a57b54248bc1f1c7fd3b25894d579c8e3 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <f574d83a57b54248bc1f1c7fd3b25894d579c8e3@dist-git>
|
||||
From: Jiri Denemark <jdenemar@redhat.com>
|
||||
Date: Fri, 5 Apr 2019 11:33:32 +0200
|
||||
Subject: [PATCH] cpu_x86: Do not cache microcode version
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The microcode version checks are used to invalidate cached CPU data we
|
||||
get from QEMU. To minimize /proc/cpuinfo parsing the microcode version
|
||||
was only read when libvirtd started and cached for the daemon's
|
||||
lifetime. However, the CPU microcode can change anytime (updating the
|
||||
microcode package can automatically upload it to the CPU) and we need to
|
||||
stop caching it to avoid using stale CPU model data.
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit be46f613261d3b655a1f15afd635087e68a9c39b)
|
||||
|
||||
CVE-2018-12126, CVE-2018-12127, CVE-2018-12130, CVE-2019-11091
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
---
|
||||
src/cpu/cpu_x86.c | 5 +----
|
||||
1 file changed, 1 insertion(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
|
||||
index 7fa84f6014..89baf94d7d 100644
|
||||
--- a/src/cpu/cpu_x86.c
|
||||
+++ b/src/cpu/cpu_x86.c
|
||||
@@ -163,7 +163,6 @@ struct _virCPUx86Map {
|
||||
};
|
||||
|
||||
static virCPUx86MapPtr cpuMap;
|
||||
-static unsigned int microcodeVersion;
|
||||
|
||||
int virCPUx86DriverOnceInit(void);
|
||||
VIR_ONCE_GLOBAL_INIT(virCPUx86Driver);
|
||||
@@ -1422,8 +1421,6 @@ virCPUx86DriverOnceInit(void)
|
||||
if (!(cpuMap = virCPUx86LoadMap()))
|
||||
return -1;
|
||||
|
||||
- microcodeVersion = virHostCPUGetMicrocodeVersion();
|
||||
-
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2463,7 +2460,7 @@ virCPUx86GetHost(virCPUDefPtr cpu,
|
||||
goto cleanup;
|
||||
|
||||
ret = x86DecodeCPUData(cpu, cpuData, models);
|
||||
- cpu->microcodeVersion = microcodeVersion;
|
||||
+ cpu->microcodeVersion = virHostCPUGetMicrocodeVersion();
|
||||
|
||||
cleanup:
|
||||
virCPUx86DataFree(cpuData);
|
||||
--
|
||||
2.21.0
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user