From nobody Mon May 20 00:09:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1517371518707172.26039472637513; Tue, 30 Jan 2018 20:05:18 -0800 (PST) Received: from localhost ([::1]:59580 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1egje4-0006xi-FD for importer@patchew.org; Tue, 30 Jan 2018 23:05:12 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45705) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1egjd8-0006aG-J6 for qemu-devel@nongnu.org; Tue, 30 Jan 2018 23:04:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1egjd5-0006ef-CA for qemu-devel@nongnu.org; Tue, 30 Jan 2018 23:04:14 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56658) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1egjd5-0006df-6n for qemu-devel@nongnu.org; Tue, 30 Jan 2018 23:04:11 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DC9474B65 for ; Wed, 31 Jan 2018 04:04:09 +0000 (UTC) Received: from xz-mi.nay.redhat.com (dhcp-14-120.nay.redhat.com [10.66.14.120]) by smtp.corp.redhat.com (Postfix) with ESMTP id E406D60A9A; Wed, 31 Jan 2018 04:04:02 +0000 (UTC) From: Peter Xu To: qemu-devel@nongnu.org Date: Wed, 31 Jan 2018 12:04:01 +0800 Message-Id: <20180131040401.3550-1-peterx@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 31 Jan 2018 04:04:09 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH] virtio-gpu: disallow vIOMMU X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gerd Hoffmann , peterx@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 --- 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 ef92c4ad6f..3519dc80b1 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 =3D &vgpu->vdev; DeviceState *vdev =3D DEVICE(&vgpu->vdev); int i; + Error *local_error =3D NULL; =20 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; + } =20 for (i =3D 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 274e365713..6658f6c6a6 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -1173,6 +1173,11 @@ static void virtio_gpu_device_realize(DeviceState *q= dev, Error **errp) Error *local_err =3D NULL; int i; =20 + 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_SCANOU= TS); return; --=20 2.14.3