[PATCH v2 2/7] qemu: Add support for virtio-gpu-ccw video device on S390

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



QEMU on S390 (since v2.11) can support the virtio-gpu-ccw device,
which can be used as a video device.

Signed-off-by: Farhan Ali <alifm@xxxxxxxxxxxxxxxxxx>
---
 docs/formatdomain.html.in      |  3 +++
 src/qemu/qemu_command.c        | 13 +++++++++++--
 src/qemu/qemu_domain.c         |  2 +-
 src/qemu/qemu_domain_address.c | 12 ++++++++++--
 src/qemu/qemu_process.c        |  5 ++++-
 5 files changed, 29 insertions(+), 6 deletions(-)

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 6fd2189..0908709 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -6484,6 +6484,9 @@ qemu-kvm -net nic,model=? /dev/null
       <dd>
         The optional <code>address</code> sub-element can be used to
         tie the video device to a particular PCI slot.
+        On S390, <code>address</code> can be used to provide the
+        CCW address for the video device (<span class="since">
+        since 4.2.0</span>).
       </dd>
 
       <dt><code>driver</code></dt>
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index a8afbd1..5882637 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.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/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index 2551706..37473eb 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 57c06c7..1afb71f 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));
-- 
2.7.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux