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

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