diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 6fd2189cd2f46859f6b93d0c733b40b3307a502c..0908709813f011e5942fba23d8eb9b4690c429ae 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -6484,6 +6484,9 @@ qemu-kvm -net nic,model=? /dev/null
The optional address sub-element can be used to tie the video device to a particular PCI slot. + On S390, address can be used to provide the + CCW address for the video device ( + since 4.2.0).
driver
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 937a7d1b7babc982ff9e283e8c3030e67f793ad0..314f175deff63ea595cbca46262647d295c8a585 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -132,7 +132,7 @@ VIR_ENUM_IMPL(qemuDeviceVideoSecondary, VIR_DOMAIN_VIDEO_TYPE_LAST, "", /* don't support vbox */ "qxl", "", /* don't support parallels */ - "virtio-gpu-pci", + "virtio-gpu", "" /* don't support gop */); VIR_ENUM_DECL(qemuSoundCodec) @@ -4296,7 +4296,16 @@ qemuBuildDeviceVideoStr(const virDomainDef *def, goto error; } - virBufferAsprintf(&buf, "%s,id=%s", model, video->info.alias); + if (STREQ(model, "virtio-gpu")) { + if (video->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) + virBufferAsprintf(&buf, "%s-ccw", model); + else + virBufferAsprintf(&buf, "%s-pci", model); + } else { + virBufferAsprintf(&buf, "%s", model); + } + + virBufferAsprintf(&buf, ",id=%s", video->info.alias); if (video->accel && video->accel->accel3d == VIR_TRISTATE_SWITCH_ON) { virBufferAsprintf(&buf, ",virgl=%s", diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index 25517064d7cbaf031493d7d2a5ad4c13263b9d8d..37473ebf13af6a8ffcbf18882cea4da3c5272035 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -287,8 +287,8 @@ qemuDomainPrimeVirtioDeviceAddresses(virDomainDefPtr def, { /* declare address-less virtio devices to be of address type 'type' - disks, networks, consoles, controllers, memballoon and rng in this - order + disks, networks, videos, consoles, controllers, memballoon and rng + in this order if type is ccw filesystem devices are declared to be of address type ccw */ size_t i; @@ -308,6 +308,14 @@ qemuDomainPrimeVirtioDeviceAddresses(virDomainDefPtr def, } } + for (i = 0; i < def->nvideos; i++) { + virDomainVideoDefPtr video = def->videos[i]; + + if (video->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE && + video->type == VIR_DOMAIN_VIDEO_TYPE_VIRTIO) + video->info.type = type; + } + for (i = 0; i < def->ninputs; i++) { if (def->inputs[i]->bus == VIR_DOMAIN_INPUT_BUS_VIRTIO && def->inputs[i]->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 57c06c7c15506e816baa91d9b2121327bc3f9eb9..1afb71f113d516e7a1a9657d69898be52f197e37 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -4778,7 +4778,10 @@ qemuProcessStartValidateVideo(virDomainObjPtr vm, (video->type == VIR_DOMAIN_VIDEO_TYPE_QXL && !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_QXL)) || (video->type == VIR_DOMAIN_VIDEO_TYPE_VIRTIO && - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_GPU))) { + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_GPU)) || + (video->type == VIR_DOMAIN_VIDEO_TYPE_VIRTIO && + video->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_GPU_CCW))) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("this QEMU does not support '%s' video device"), virDomainVideoTypeToString(video->type)); diff --git a/tests/qemuxml2argvdata/video-virtio-gpu-ccw.args b/tests/qemuxml2argvdata/video-virtio-gpu-ccw.args new file mode 100644 index 0000000000000000000000000000000000000000..e5e88545492681b295c758877bbac7b3d320e1b5 --- /dev/null +++ b/tests/qemuxml2argvdata/video-virtio-gpu-ccw.args @@ -0,0 +1,25 @@ +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 \ +-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 \ +-vnc 127.0.0.1:0 \ +-device virtio-gpu-ccw,id=video0,max_outputs=1,devno=fe.0.0002 \ +-device virtio-gpu-ccw,id=video1,max_outputs=1,devno=fe.0.0003 \ +-device virtio-balloon-ccw,id=balloon0,devno=fe.0.0001 diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 064fd3b767379782fc12237b0df5bd1dd9a3d7bd..e86939d8b37f605e04a2ec130ae63746d2afdcf3 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -3008,6 +3008,13 @@ mymain(void) DO_TEST("disk-many-format-probing", QEMU_CAPS_DRIVE_BOOT); driver.config->allowDiskFormatProbing = false; + DO_TEST("video-virtio-gpu-ccw", QEMU_CAPS_VIRTIO_CCW, + QEMU_CAPS_DEVICE_VIRTIO_GPU, + QEMU_CAPS_DEVICE_VIDEO_PRIMARY, + QEMU_CAPS_VIRTIO_GPU_MAX_OUTPUTS, + QEMU_CAPS_VNC, + QEMU_CAPS_DEVICE_VIRTIO_GPU_CCW); + if (getenv("LIBVIRT_SKIP_CLEANUP") == NULL) virFileDeleteTree(fakerootdir);