diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 0908709813f011e5942fba23d8eb9b4690c429ae..08dc74b6b9c99c750f1c09c885f4ce25b18f74cc 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -6048,6 +6048,8 @@ qemu-kvm -net nic,model=? /dev/null
sub-element <address>
which can tie the
device to a particular PCI
slot, documented above.
+ On S390, address
can be used to provide a CCW address for
+ an input device (since 4.2.0).
For type passthrough
, the mandatory sub-element source
must have an evdev
attribute containing the absolute path to the
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 314f175deff63ea595cbca46262647d295c8a585..89fd08b6429a06361d58409b45717319a90baa6f 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;
diff --git a/tests/qemuxml2argvdata/input-virtio-ccw.args b/tests/qemuxml2argvdata/input-virtio-ccw.args
new file mode 100644
index 0000000000000000000000000000000000000000..6ee318c35015b14ec486cba6c9eaa82c0a2eba1b
--- /dev/null
+++ b/tests/qemuxml2argvdata/input-virtio-ccw.args
@@ -0,0 +1,26 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-s390x \
+-name QEMUGuest1 \
+-S \
+-M s390-ccw-virtio \
+-m 214 \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1803 \
+-nographic \
+-nodefaults \
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
+server,nowait \
+-mon chardev=charmonitor,id=monitor,mode=readline \
+-boot c \
+-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \
+-device virtio-blk-ccw,devno=fe.0.0000,drive=drive-virtio-disk0,\
+id=virtio-disk0 \
+-device virtio-keyboard-ccw,id=input0,devno=fe.0.0002 \
+-device virtio-mouse-ccw,id=input1,devno=fe.0.0003 \
+-device virtio-tablet-ccw,id=input2,devno=fe.0.0004 \
+-device virtio-balloon-ccw,id=balloon0,devno=fe.0.0001
diff --git a/tests/qemuxml2argvdata/input-virtio-ccw.xml b/tests/qemuxml2argvdata/input-virtio-ccw.xml
new file mode 100644
index 0000000000000000000000000000000000000000..a9716627e1673fbc55134cdc5e9bfd6636290de0
--- /dev/null
+++ b/tests/qemuxml2argvdata/input-virtio-ccw.xml
@@ -0,0 +1,29 @@
+
+ QEMUGuest1
+ c7a5fdbd-edaf-9455-926a-d65c16db1803
+ 219136
+ 219136
+ 1
+
+ hvm
+
+
+ destroy
+ restart
+ destroy
+
+ /usr/bin/qemu-system-s390x
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index e86939d8b37f605e04a2ec130ae63746d2afdcf3..308d71f725473323789444f8d60cff58b1a6c9a8 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -3015,6 +3015,14 @@ mymain(void)
QEMU_CAPS_VNC,
QEMU_CAPS_DEVICE_VIRTIO_GPU_CCW);
+ DO_TEST("input-virtio-ccw", QEMU_CAPS_VIRTIO_CCW,
+ QEMU_CAPS_VIRTIO_KEYBOARD,
+ QEMU_CAPS_VIRTIO_MOUSE,
+ QEMU_CAPS_VIRTIO_TABLET,
+ QEMU_CAPS_DEVICE_VIRTIO_KEYBOARD_CCW,
+ QEMU_CAPS_DEVICE_VIRTIO_MOUSE_CCW,
+ QEMU_CAPS_DEVICE_VIRTIO_TABLET_CCW);
+
if (getenv("LIBVIRT_SKIP_CLEANUP") == NULL)
virFileDeleteTree(fakerootdir);
diff --git a/tests/qemuxml2xmloutdata/input-virtio-ccw.xml b/tests/qemuxml2xmloutdata/input-virtio-ccw.xml
new file mode 100644
index 0000000000000000000000000000000000000000..20aed31f3f92309d5522236ffa5de9bf5731b25e
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/input-virtio-ccw.xml
@@ -0,0 +1,37 @@
+
+ QEMUGuest1
+ c7a5fdbd-edaf-9455-926a-d65c16db1803
+ 219136
+ 219136
+ 1
+
+ hvm
+
+
+
+ destroy
+ restart
+ destroy
+
+ /usr/bin/qemu-system-s390x
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 5b014ca60b9168aba2d5f46675ae2f3d56ac4831..0f560290a0e364e80997e1b3992c2adb69958160 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -1230,6 +1230,14 @@ mymain(void)
QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE);
DO_TEST("user-aliases", NONE);
+ DO_TEST("input-virtio-ccw",
+ QEMU_CAPS_VIRTIO_CCW,
+ QEMU_CAPS_VIRTIO_KEYBOARD,
+ QEMU_CAPS_VIRTIO_MOUSE,
+ QEMU_CAPS_VIRTIO_TABLET,
+ QEMU_CAPS_DEVICE_VIRTIO_KEYBOARD_CCW,
+ QEMU_CAPS_DEVICE_VIRTIO_MOUSE_CCW,
+ QEMU_CAPS_DEVICE_VIRTIO_TABLET_CCW);
/* Test disks with format probing enabled for legacy reasons.
* New tests should not go in this section. */