virtio-gpu: disallow vIOMMU

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 <kraxel@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Message-id: 20180131040401.3550-1-peterx@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
Peter Xu 2018-01-31 12:04:01 +08:00 committed by Gerd Hoffmann
parent b05631954d
commit 34e304e975
2 changed files with 12 additions and 1 deletions

View File

@ -28,10 +28,16 @@ static void virtio_gpu_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
VirtIOGPU *g = &vgpu->vdev; VirtIOGPU *g = &vgpu->vdev;
DeviceState *vdev = DEVICE(&vgpu->vdev); DeviceState *vdev = DEVICE(&vgpu->vdev);
int i; int i;
Error *local_error = NULL;
qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus)); qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus));
virtio_pci_force_virtio_1(vpci_dev); 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++) { for (i = 0; i < g->conf.max_outputs; i++) {
object_property_set_link(OBJECT(g->scanout[i].con), object_property_set_link(OBJECT(g->scanout[i].con),

View File

@ -1173,6 +1173,11 @@ static void virtio_gpu_device_realize(DeviceState *qdev, Error **errp)
Error *local_err = NULL; Error *local_err = NULL;
int i; 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) { if (g->conf.max_outputs > VIRTIO_GPU_MAX_SCANOUTS) {
error_setg(errp, "invalid max_outputs > %d", VIRTIO_GPU_MAX_SCANOUTS); error_setg(errp, "invalid max_outputs > %d", VIRTIO_GPU_MAX_SCANOUTS);
return; return;