QEMU on S390 (since v2.11) can support virtio input ccw devices.
So build the qemu command line for ccw devices.
Also introduce capabilities for virtio-{keyboard, mouse, tablet}-ccw
devices.
Signed-off-by: Farhan Ali <alifm(a)linux.vnet.ibm.com>
Signed-off-by: Boris Fiuczynski <fiuczy(a)linux.vnet.ibm.com>
---
docs/formatdomain.html.in | 2 ++
src/qemu/qemu_capabilities.c | 8 ++++++++
src/qemu/qemu_capabilities.h | 5 +++++
src/qemu/qemu_command.c | 14 +++++++++++---
tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml | 3 +++
5 files changed, 29 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_capabilities.c b/src/qemu/qemu_capabilities.c
index 9db4c31..14564e8 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -460,6 +460,11 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
"machine.pseries.max-cpu-compat",
"dump-completed",
"virtio-gpu-ccw",
+ "virtio-keyboard-ccw",
+
+ /* 285 */
+ "virtio-mouse-ccw",
+ "virtio-tablet-ccw",
);
@@ -1696,6 +1701,9 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = {
{ "isa-serial", QEMU_CAPS_DEVICE_ISA_SERIAL },
{ "pl011", QEMU_CAPS_DEVICE_PL011 },
{ "virtio-gpu-ccw", QEMU_CAPS_DEVICE_VIRTIO_GPU_CCW },
+ { "virtio-keyboard-ccw", QEMU_CAPS_DEVICE_VIRTIO_KEYBOARD_CCW },
+ { "virtio-mouse-ccw", QEMU_CAPS_DEVICE_VIRTIO_MOUSE_CCW },
+ { "virtio-tablet-ccw", QEMU_CAPS_DEVICE_VIRTIO_TABLET_CCW },
};
static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVirtioBalloon[] = {
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index b4852e5..3f3c29f 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -445,6 +445,11 @@ typedef enum {
QEMU_CAPS_MACHINE_PSERIES_MAX_CPU_COMPAT, /* -machine pseries,max-cpu-compat= */
QEMU_CAPS_DUMP_COMPLETED, /* DUMP_COMPLETED event */
QEMU_CAPS_DEVICE_VIRTIO_GPU_CCW, /* -device virtio-gpu-ccw */
+ QEMU_CAPS_DEVICE_VIRTIO_KEYBOARD_CCW, /* -device virtio-keyboard-ccw */
+
+ /* 285 */
+ QEMU_CAPS_DEVICE_VIRTIO_MOUSE_CCW, /* -device virtio-mouse-ccw */
+ QEMU_CAPS_DEVICE_VIRTIO_TABLET_CCW, /* -device virtio-tablet-ccw */
QEMU_CAPS_LAST /* this must always be the last item */
} virQEMUCapsFlags;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index ba63670..5477e14 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3921,6 +3921,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 {
@@ -3932,7 +3934,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;
@@ -3940,7 +3944,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;
@@ -3948,7 +3954,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;
diff --git a/tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml
b/tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml
index ec5c396..fda5c36 100644
--- a/tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml
+++ b/tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml
@@ -147,6 +147,9 @@
<flag name='iscsi.password-secret'/>
<flag name='dump-completed'/>
<flag name='virtio-gpu-ccw'/>
+ <flag name='virtio-keyboard-ccw'/>
+ <flag name='virtio-mouse-ccw'/>
+ <flag name='virtio-tablet-ccw'/>
<version>2011000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>342885</microcodeVersion>
--
2.7.4