S390 guests can only support a virtio-gpu-ccw device as a video
device. So set default video model type to VIR_DOMAIN_VIDEO_TYPE_VIRTIO
for S390 guests.
Signed-off-by: Farhan Ali <alifm(a)linux.vnet.ibm.com>
---
src/qemu/qemu_domain.c | 2 +-
.../qemuxml2argvdata/video-virtio-gpu-ccw-auto.xml | 18 +++++++++++
.../video-virtio-gpu-ccw-auto.xml | 35 ++++++++++++++++++++++
tests/qemuxml2xmltest.c | 7 +++++
4 files changed, 61 insertions(+), 1 deletion(-)
create mode 100644 tests/qemuxml2argvdata/video-virtio-gpu-ccw-auto.xml
create mode 100644 tests/qemuxml2xmloutdata/video-virtio-gpu-ccw-auto.xml
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 7022f7c..4aaf617 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -5425,7 +5425,7 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
if (dev->data.video->type == VIR_DOMAIN_VIDEO_TYPE_DEFAULT) {
if (ARCH_IS_PPC64(def->os.arch))
dev->data.video->type = VIR_DOMAIN_VIDEO_TYPE_VGA;
- else if (qemuDomainIsVirt(def))
+ else if (qemuDomainIsVirt(def) || ARCH_IS_S390(def->os.arch))
dev->data.video->type = VIR_DOMAIN_VIDEO_TYPE_VIRTIO;
else
dev->data.video->type = VIR_DOMAIN_VIDEO_TYPE_CIRRUS;
diff --git a/tests/qemuxml2argvdata/video-virtio-gpu-ccw-auto.xml
b/tests/qemuxml2argvdata/video-virtio-gpu-ccw-auto.xml
new file mode 100644
index 0000000..2d5da38
--- /dev/null
+++ b/tests/qemuxml2argvdata/video-virtio-gpu-ccw-auto.xml
@@ -0,0 +1,18 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1803</uuid>
+ <memory>219136</memory>
+ <vcpu>1</vcpu>
+ <os>
+ <type arch='s390x' machine='s390-ccw-virtio'>hvm</type>
+ </os>
+ <devices>
+ <emulator>/usr/bin/qemu-system-s390x</emulator>
+ <disk type='block' device='disk'>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='hda' bus='virtio'/>
+ </disk>
+ <graphics type='vnc'/>
+ <panic model='s390'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/video-virtio-gpu-ccw-auto.xml
b/tests/qemuxml2xmloutdata/video-virtio-gpu-ccw-auto.xml
new file mode 100644
index 0000000..b373275
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/video-virtio-gpu-ccw-auto.xml
@@ -0,0 +1,35 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1803</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='s390x' machine='s390-ccw-virtio'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-system-s390x</emulator>
+ <disk type='block' device='disk'>
+ <driver name='qemu' type='raw'/>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='hda' bus='virtio'/>
+ <address type='ccw' cssid='0xfe' ssid='0x0'
devno='0x0000'/>
+ </disk>
+ <graphics type='vnc' port='-1' autoport='yes'>
+ <listen type='address'/>
+ </graphics>
+ <video>
+ <model type='virtio' heads='1' primary='yes'/>
+ <address type='ccw' cssid='0xfe' ssid='0x0'
devno='0x0001'/>
+ </video>
+ <memballoon model='virtio'>
+ <address type='ccw' cssid='0xfe' ssid='0x0'
devno='0x0002'/>
+ </memballoon>
+ <panic model='s390'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 7657377..5b014ca 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -1187,6 +1187,13 @@ mymain(void)
QEMU_CAPS_VIRTIO_GPU_MAX_OUTPUTS,
QEMU_CAPS_VNC,
QEMU_CAPS_DEVICE_VIRTIO_GPU_CCW);
+ DO_TEST("video-virtio-gpu-ccw-auto",
+ 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);
DO_TEST("intel-iommu",
QEMU_CAPS_DEVICE_INTEL_IOMMU);
--
2.7.4