Generates the QEMU command line for the vfio-ccw device. Signed-off-by: Shalini Chellathurai Saroja <shalini@xxxxxxxxxxxxxxxxxx> Reviewed-by: Bjoern Walk <bwalk@xxxxxxxxxxxxxxxxxx> Reviewed-by: Boris Fiuczynski <fiuczy@xxxxxxxxxxxxxxxxxx> Reviewed-by: Marc Hartmayer <mhartmay@xxxxxxxxxxxxxxxxxx> --- src/qemu/qemu_command.c | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index e47f915fc8..ad60a7b433 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -5123,11 +5123,17 @@ qemuBuildHostdevMediatedDevStr(const virDomainDef *def, virDomainHostdevSubsysMediatedDevPtr mdevsrc = &dev->source.subsys.u.mdev; char *ret = NULL; char *mdevPath = NULL; + const char *dev_str = NULL; if (!(mdevPath = virMediatedDeviceGetSysfsPath(mdevsrc->uuidstr))) goto cleanup; - virBufferAddLit(&buf, "vfio-pci"); + dev_str = virMediatedDeviceModelTypeToString(mdevsrc->model); + + if (!dev_str) + goto cleanup; + + virBufferAdd(&buf, dev_str, -1); virBufferAsprintf(&buf, ",id=%s,sysfsdev=%s", dev->info->alias, mdevPath); if (qemuBuildDeviceAddressStr(&buf, def, dev->info, qemuCaps) < 0) @@ -5347,11 +5353,28 @@ qemuBuildHostdevCommandLine(virCommandPtr cmd, /* MDEV */ if (virHostdevIsMdevDevice(hostdev)) { - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VFIO_PCI)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("VFIO PCI device assignment is not " - "supported by this version of qemu")); + switch ((virMediatedDeviceModelType) subsys->u.mdev.model) { + case VIR_MDEV_MODEL_TYPE_VFIO_PCI: + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VFIO_PCI)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("VFIO PCI device assignment is not " + "supported by this version of QEMU")); + return -1; + } + break; + case VIR_MDEV_MODEL_TYPE_VFIO_CCW: + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VFIO_CCW)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("VFIO CCW device assignment is not " + "supported by this version of QEMU")); + return -1; + } + break; + case VIR_MDEV_MODEL_TYPE_LAST: + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected vfio type '%d'"), subsys->u.mdev.model); return -1; + break; } virCommandAddArg(cmd, "-device"); -- 2.13.4 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list