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