The 'display' option for the 'vfio-pci' device was added in qemu-2.12
and can't be compiled out. Assume support for the flag.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_domain.c | 11 ++++-------
src/qemu/qemu_validate.c | 6 ------
tests/qemuxml2argvdata/hostdev-mdev-precreated.args | 2 +-
tests/qemuxml2argvtest.c | 3 +--
4 files changed, 6 insertions(+), 16 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 9781df1355..c7d64e1b5c 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -6034,13 +6034,11 @@
qemuDomainDeviceHostdevDefPostParseRestoreBackendAlias(virDomainHostdevDef *host
static int
-qemuDomainHostdevDefMdevPostParse(virDomainHostdevSubsysMediatedDev *mdevsrc,
- virQEMUCaps *qemuCaps)
+qemuDomainHostdevDefMdevPostParse(virDomainHostdevSubsysMediatedDev *mdevsrc)
{
/* 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->model == VIR_MDEV_MODEL_TYPE_VFIO_PCI &&
+ if (mdevsrc->model == VIR_MDEV_MODEL_TYPE_VFIO_PCI &&
mdevsrc->display == VIR_TRISTATE_SWITCH_ABSENT)
mdevsrc->display = VIR_TRISTATE_SWITCH_OFF;
@@ -6050,7 +6048,6 @@ qemuDomainHostdevDefMdevPostParse(virDomainHostdevSubsysMediatedDev
*mdevsrc,
static int
qemuDomainHostdevDefPostParse(virDomainHostdevDef *hostdev,
- virQEMUCaps *qemuCaps,
unsigned int parseFlags)
{
virDomainHostdevSubsys *subsys = &hostdev->source.subsys;
@@ -6063,7 +6060,7 @@ qemuDomainHostdevDefPostParse(virDomainHostdevDef *hostdev,
if (hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV &&
- qemuDomainHostdevDefMdevPostParse(&subsys->u.mdev, qemuCaps) < 0)
+ qemuDomainHostdevDefMdevPostParse(&subsys->u.mdev) < 0)
return -1;
return 0;
@@ -6213,7 +6210,7 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDef *dev,
break;
case VIR_DOMAIN_DEVICE_HOSTDEV:
- ret = qemuDomainHostdevDefPostParse(dev->data.hostdev, qemuCaps, parseFlags);
+ ret = qemuDomainHostdevDefPostParse(dev->data.hostdev, parseFlags);
break;
case VIR_DOMAIN_DEVICE_TPM:
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index d5fe1cbd73..1346bbfb44 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -2341,12 +2341,6 @@ qemuValidateDomainMdevDefVFIOPCI(const virDomainHostdevDef
*hostdev,
if (dev->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 (dev->model != VIR_MDEV_MODEL_TYPE_VFIO_PCI) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("<hostdev> attribute 'display' is only
supported with model='vfio-pci'"));
diff --git a/tests/qemuxml2argvdata/hostdev-mdev-precreated.args
b/tests/qemuxml2argvdata/hostdev-mdev-precreated.args
index 2e49cff0e2..7c76cd5d15 100644
--- a/tests/qemuxml2argvdata/hostdev-mdev-precreated.args
+++ b/tests/qemuxml2argvdata/hostdev-mdev-precreated.args
@@ -27,5 +27,5 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest2/.config \
-boot strict=on \
-usb \
-audiodev
'{"id":"audio1","driver":"none"}' \
--device
vfio-pci,id=hostdev0,sysfsdev=/sys/bus/mdev/devices/53764d0e-85a0-42b4-af5c-2046b460b1dc,bus=pci.0,addr=0x2
\
+-device
vfio-pci,id=hostdev0,sysfsdev=/sys/bus/mdev/devices/53764d0e-85a0-42b4-af5c-2046b460b1dc,display=off,bus=pci.0,addr=0x2
\
-msg timestamp=on
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 8afb2bf2be..1fe2fafeab 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1714,8 +1714,7 @@ mymain(void)
DO_TEST_CAPS_LATEST("hostdev-mdev-display-vnc");
DO_TEST_CAPS_LATEST("hostdev-mdev-display-vnc-egl-headless");
DO_TEST_PARSE_ERROR("hostdev-mdev-display-missing-graphics",
- QEMU_CAPS_DEVICE_VFIO_PCI,
- QEMU_CAPS_VFIO_PCI_DISPLAY);
+ QEMU_CAPS_DEVICE_VFIO_PCI);
DO_TEST_CAPS_LATEST("hostdev-mdev-display-ramfb");
DO_TEST_CAPS_LATEST_PARSE_ERROR("hostdev-mdev-display-ramfb-multiple");
DO_TEST_PARSE_ERROR("hostdev-vfio-zpci-wrong-arch",
--
2.41.0