Newer versions of QEMU support virtio-scsi and virtio-rng devices
on the virtio-s390 and ccw busses. Adding capability detecion,
address assignment and command line generation for that.
Signed-off-by: Viktor Mihajlovski <mihajlov(a)linux.vnet.ibm.com>
---
src/qemu/qemu_capabilities.c | 4 ++++
src/qemu/qemu_command.c | 29 ++++++++++++++++++++++++-----
2 files changed, 28 insertions(+), 5 deletions(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index d12ae2e..fa716da 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -1323,6 +1323,8 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = {
{ "sclpconsole", QEMU_CAPS_SCLP_S390 },
{ "lsi53c895a", QEMU_CAPS_SCSI_LSI },
{ "virtio-scsi-pci", QEMU_CAPS_VIRTIO_SCSI },
+ { "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 +1338,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_command.c b/src/qemu/qemu_command.c
index d15f719..44adfa3 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -899,7 +899,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 +923,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 +936,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 +3285,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 +4504,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