mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-25 01:34:11 +03:00
qemu: Always assume support for QEMU_CAPS_DEVICE_VFIO_PCI
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@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
aaec42dbdf
commit
cbb3adde61
@ -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:
|
||||
|
@ -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'"));
|
||||
|
@ -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
|
||||
|
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user