[libvirt] [PATCH v2 5/7] qemu: Add support for virtio input ccw devices

Farhan Ali alifm at linux.vnet.ibm.com
Mon Mar 19 18:35:33 UTC 2018


QEMU on S390 (since v2.11) can support virtio input ccw devices.
So build the qemu command line for ccw devices.

Signed-off-by: Farhan Ali <alifm at linux.vnet.ibm.com>
---
 docs/formatdomain.html.in |  2 ++
 src/qemu/qemu_command.c   | 14 +++++++++++---
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 0908709..08dc74b 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -6048,6 +6048,8 @@ qemu-kvm -net nic,model=? /dev/null
       sub-element <code><address></code> which can tie the
       device to a particular PCI
       slot, <a href="#elementsAddress">documented above</a>.
+      On S390, <code>address</code> can be used to provide a CCW address for
+      an input device (<span class="since">since 4.2.0</span>).
 
       For type <code>passthrough</code>, the mandatory sub-element <code>source</code>
       must have an <code>evdev</code> attribute containing the absolute path to the
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 5882637..c95d5eb 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3955,6 +3955,8 @@ qemuBuildVirtioInputDevStr(const virDomainDef *def,
 
     if (dev->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
         suffix = "-pci";
+    } else if (dev->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) {
+        suffix = "-ccw";
     } else if (dev->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO) {
         suffix = "-device";
     } else {
@@ -3966,7 +3968,9 @@ qemuBuildVirtioInputDevStr(const virDomainDef *def,
 
     switch ((virDomainInputType) dev->type) {
     case VIR_DOMAIN_INPUT_TYPE_MOUSE:
-        if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_MOUSE)) {
+        if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_MOUSE) ||
+            (dev->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW &&
+             !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_MOUSE_CCW))) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                            _("virtio-mouse is not supported by this QEMU binary"));
             goto error;
@@ -3974,7 +3978,9 @@ qemuBuildVirtioInputDevStr(const virDomainDef *def,
         virBufferAsprintf(&buf, "virtio-mouse%s,id=%s", suffix, dev->info.alias);
         break;
     case VIR_DOMAIN_INPUT_TYPE_TABLET:
-        if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_TABLET)) {
+        if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_TABLET) ||
+            (dev->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW &&
+             !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_TABLET_CCW))) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                            _("virtio-tablet is not supported by this QEMU binary"));
             goto error;
@@ -3982,7 +3988,9 @@ qemuBuildVirtioInputDevStr(const virDomainDef *def,
         virBufferAsprintf(&buf, "virtio-tablet%s,id=%s", suffix, dev->info.alias);
         break;
     case VIR_DOMAIN_INPUT_TYPE_KBD:
-        if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_KEYBOARD)) {
+        if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_KEYBOARD) ||
+            (dev->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW &&
+             !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_KEYBOARD_CCW))) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                            _("virtio-keyboard is not supported by this QEMU binary"));
             goto error;
-- 
2.7.4




More information about the libvir-list mailing list