Newer versions of QEMU support virtio-scsi and virtio-rng devices on the virtio-s390 and ccw busses. Since the virtio-capability is orthogonal to the implementing bus we add a generic virtio-scsi capability but do not touch the already existing virtio-scsi-pci capability for PCI based systems. Adding capability detection, address assignment and command line generation for virtio-scsi and virtio-rng. Signed-off-by: Viktor Mihajlovski <mihajlov@xxxxxxxxxxxxxxxxxx> --- V2 Changes - Add virtio-scsi capability for non-PCI busses. - Check for both capabilities in qemuSetScsiControllerModel src/qemu/qemu_capabilities.c | 7 ++++++- src/qemu/qemu_capabilities.h | 1 + src/qemu/qemu_command.c | 32 ++++++++++++++++++++++++++------ 3 files changed, 33 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 79cfdb3..fff5de9 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -210,7 +210,8 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST, "rng-random", /* 130 */ "rng-egd", - "virtio-ccw" + "virtio-ccw", + "virtio-scsi" ); struct _virQEMUCaps { @@ -1323,6 +1324,8 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = { { "sclpconsole", QEMU_CAPS_SCLP_S390 }, { "lsi53c895a", QEMU_CAPS_SCSI_LSI }, { "virtio-scsi-pci", QEMU_CAPS_VIRTIO_SCSI_PCI }, + { "virtio-scsi-s390", QEMU_CAPS_VIRTIO_SCSI }, + { "virtio-scsi-ccw", QEMU_CAPS_VIRTIO_SCSI }, { "spicevmc", QEMU_CAPS_DEVICE_SPICEVMC }, { "qxl-vga", QEMU_CAPS_DEVICE_QXL_VGA }, { "qxl", QEMU_CAPS_DEVICE_QXL }, @@ -1336,6 +1339,8 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = { { "usb-serial", QEMU_CAPS_DEVICE_USB_SERIAL}, { "usb-net", QEMU_CAPS_DEVICE_USB_NET}, { "virtio-rng-pci", QEMU_CAPS_DEVICE_VIRTIO_RNG }, + { "virtio-rng-s390", QEMU_CAPS_DEVICE_VIRTIO_RNG }, + { "virtio-rng-ccw", QEMU_CAPS_DEVICE_VIRTIO_RNG }, { "rng-random", QEMU_CAPS_OBJECT_RNG_RANDOM }, { "rng-egd", QEMU_CAPS_OBJECT_RNG_EGD }, }; diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 5c5dc5a..1ed060e 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -172,6 +172,7 @@ enum virQEMUCapsFlags { virtio rng */ QEMU_CAPS_OBJECT_RNG_EGD = 131, /* EGD protocol daemon for rng */ QEMU_CAPS_VIRTIO_CCW = 132, /* -device virtio-*-ccw */ + QEMU_CAPS_VIRTIO_SCSI = 133, /* -device virtio-scsi-* (* != pci) */ QEMU_CAPS_LAST, /* this must always be the last item */ }; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index e7f2325..8ee6fb4 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -505,7 +505,8 @@ qemuSetScsiControllerModel(virDomainDefPtr def, } break; case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI: - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_SCSI_PCI)) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_SCSI_PCI) && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_SCSI)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("This QEMU doesn't support " "virtio scsi controller")); @@ -899,7 +900,8 @@ qemuDomainPrimeS390VirtioDevices(virDomainDefPtr def, { /* declare address-less virtio devices to be of address type 'type' - only disks, networks, consoles, controllers and memballoon for now + disks, networks, consoles, controllers, memballoon and rng in this + order */ int i; @@ -922,8 +924,10 @@ qemuDomainPrimeS390VirtioDevices(virDomainDefPtr def, } for (i = 0; i < def->ncontrollers ; i++) { - if (def->controllers[i]->type == - VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL && + if ((def->controllers[i]->type == + VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL || + def->controllers[i]->type == + VIR_DOMAIN_CONTROLLER_TYPE_SCSI) && def->controllers[i]->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) def->controllers[i]->info.type = type; @@ -933,6 +937,11 @@ qemuDomainPrimeS390VirtioDevices(virDomainDefPtr def, def->memballoon->model == VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO && def->memballoon->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) def->memballoon->info.type = type; + + if (def->rng && + def->rng->model == VIR_DOMAIN_RNG_MODEL_VIRTIO && + def->rng->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) + def->rng->info.type = type; } static int @@ -3277,7 +3286,13 @@ qemuBuildControllerDevStr(virDomainDefPtr domainDef, switch (model) { case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI: - virBufferAddLit(&buf, "virtio-scsi-pci"); + if (def->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) + virBufferAddLit(&buf, "virtio-scsi-ccw"); + else if (def->info.type == + VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390) + virBufferAddLit(&buf, "virtio-scsi-s390"); + else + virBufferAddLit(&buf, "virtio-scsi-pci"); break; case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC: virBufferAddLit(&buf, "lsi"); @@ -4490,7 +4505,12 @@ qemuBuildRNGDeviceArgs(virCommandPtr cmd, goto cleanup; } - virBufferAsprintf(&buf, "virtio-rng-pci,rng=%s", dev->info.alias); + if (dev->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) + virBufferAsprintf(&buf, "virtio-rng-ccw,rng=%s", dev->info.alias); + else if (dev->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390) + virBufferAsprintf(&buf, "virtio-rng-s390,rng=%s", dev->info.alias); + else + virBufferAsprintf(&buf, "virtio-rng-pci,rng=%s", dev->info.alias); if (qemuBuildDeviceAddressStr(&buf, &dev->info, qemuCaps) < 0) goto cleanup; -- 1.7.9.5 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list