Blame SOURCES/kvm-virtio-gpu-disallow-vIOMMU.patch

4a2fec
From 5ce65934798e5c87e465f30ad08f24b76429ee7c Mon Sep 17 00:00:00 2001
4a2fec
From: Peter Xu <peterx@redhat.com>
4a2fec
Date: Tue, 6 Feb 2018 08:21:19 +0100
4a2fec
Subject: [PATCH 20/20] virtio-gpu: disallow vIOMMU
4a2fec
MIME-Version: 1.0
4a2fec
Content-Type: text/plain; charset=UTF-8
4a2fec
Content-Transfer-Encoding: 8bit
4a2fec
4a2fec
RH-Author: Peter Xu <peterx@redhat.com>
4a2fec
Message-id: <20180206082119.9246-1-peterx@redhat.com>
4a2fec
Patchwork-id: 78903
4a2fec
O-Subject: [RHEL-7.5 qemu-kvm-rhev PATCH] virtio-gpu: disallow vIOMMU
4a2fec
Bugzilla: 1540182
4a2fec
RH-Acked-by: Gerd Hoffmann <kraxel@redhat.com>
4a2fec
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
4a2fec
RH-Acked-by: Marc-André Lureau <mlureau@redhat.com>
4a2fec
4a2fec
virtio-gpu has special code path that bypassed vIOMMU protection.  So
4a2fec
for now let's disable iommu_platform for the device until we fully
4a2fec
support that (if needed).
4a2fec
4a2fec
After the patch, both virtio-vga and virtio-gpu won't allow to boot with
4a2fec
iommu_platform parameter set.
4a2fec
4a2fec
CC: Gerd Hoffmann <kraxel@redhat.com>
4a2fec
Signed-off-by: Peter Xu <peterx@redhat.com>
4a2fec
Message-id: 20180131040401.3550-1-peterx@redhat.com
4a2fec
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
4a2fec
(cherry picked from commit 34e304e97576a9e17680c868c00ff524a981007b)
4a2fec
Signed-off-by: Peter Xu <peterx@redhat.com>
4a2fec
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
4a2fec
---
4a2fec
 hw/display/virtio-gpu-pci.c | 8 +++++++-
4a2fec
 hw/display/virtio-gpu.c     | 5 +++++
4a2fec
 2 files changed, 12 insertions(+), 1 deletion(-)
4a2fec
4a2fec
diff --git a/hw/display/virtio-gpu-pci.c b/hw/display/virtio-gpu-pci.c
4a2fec
index ef92c4a..3519dc8 100644
4a2fec
--- a/hw/display/virtio-gpu-pci.c
4a2fec
+++ b/hw/display/virtio-gpu-pci.c
4a2fec
@@ -28,10 +28,16 @@ static void virtio_gpu_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
4a2fec
     VirtIOGPU *g = &vgpu->vdev;
4a2fec
     DeviceState *vdev = DEVICE(&vgpu->vdev);
4a2fec
     int i;
4a2fec
+    Error *local_error = NULL;
4a2fec
 
4a2fec
     qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus));
4a2fec
     virtio_pci_force_virtio_1(vpci_dev);
4a2fec
-    object_property_set_bool(OBJECT(vdev), true, "realized", errp);
4a2fec
+    object_property_set_bool(OBJECT(vdev), true, "realized", &local_error);
4a2fec
+
4a2fec
+    if (local_error) {
4a2fec
+        error_propagate(errp, local_error);
4a2fec
+        return;
4a2fec
+    }
4a2fec
 
4a2fec
     for (i = 0; i < g->conf.max_outputs; i++) {
4a2fec
         object_property_set_link(OBJECT(g->scanout[i].con),
4a2fec
diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
4a2fec
index 4e66535..db53e0b 100644
4a2fec
--- a/hw/display/virtio-gpu.c
4a2fec
+++ b/hw/display/virtio-gpu.c
4a2fec
@@ -1109,6 +1109,11 @@ static void virtio_gpu_device_realize(DeviceState *qdev, Error **errp)
4a2fec
     Error *local_err = NULL;
4a2fec
     int i;
4a2fec
 
4a2fec
+    if (virtio_host_has_feature(vdev, VIRTIO_F_IOMMU_PLATFORM)) {
4a2fec
+        error_setg(errp, "virtio-gpu does not support vIOMMU yet");
4a2fec
+        return;
4a2fec
+    }
4a2fec
+
4a2fec
     if (g->conf.max_outputs > VIRTIO_GPU_MAX_SCANOUTS) {
4a2fec
         error_setg(errp, "invalid max_outputs > %d", VIRTIO_GPU_MAX_SCANOUTS);
4a2fec
         return;
4a2fec
-- 
4a2fec
1.8.3.1
4a2fec