From nobody Mon Apr 29 21:38:38 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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 150162858208494.64405021676316; Tue, 1 Aug 2017 16:03:02 -0700 (PDT) Received: from localhost ([::1]:44820 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcgBm-00006U-9F for importer@patchew.org; Tue, 01 Aug 2017 19:02:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36359) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcgAu-0008Gw-UB for qemu-devel@nongnu.org; Tue, 01 Aug 2017 19:02:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dcgAr-00073l-TF for qemu-devel@nongnu.org; Tue, 01 Aug 2017 19:02:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37672) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dcgAr-00072r-NV for qemu-devel@nongnu.org; Tue, 01 Aug 2017 19:02:01 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 163DBAE45B for ; Tue, 1 Aug 2017 23:01:59 +0000 (UTC) Received: from localhost (ovpn-116-37.gru2.redhat.com [10.97.116.37]) by smtp.corp.redhat.com (Postfix) with ESMTP id B831960467; Tue, 1 Aug 2017 23:01:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 163DBAE45B Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=ehabkost@redhat.com From: Eduardo Habkost To: qemu-devel@nongnu.org Date: Tue, 1 Aug 2017 20:01:55 -0300 Message-Id: <20170801230155.21083-1-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 01 Aug 2017 23:01:59 +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: Mark virtio-device as non-user-creatable 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: Markus Armbruster , "Michael S. Tsirkin" 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" TYPE_VIRTIO_DEVICE devices are already not usable with -device and device_add, but they are reported as user-creatable on "-device help" and through monitor interfaces. Mark them as not user-creatable to avoid confusing users, and to allow automated testing (e.g. scripts/device-crash-test) to skip them. Before this patch, device-crash-test will try to test virtio-device devices with all machine-types: $ time ./scripts/device-crash-test -D virtio-device -v ./x86_64-softmmu/q= emu-system-x86_64 [...] INFO: Total: 1088 test cases INFO: Skipped 408 test cases real 0m49.775s After this patch, the script won't try to test virtio-device devices: $ time ./scripts/device-crash-test -D virtio-device -v ./x86_64-softmmu/q= emu-system-x86_64 INFO: Total: 0 test cases real 0m0.092s Signed-off-by: Eduardo Habkost --- hw/virtio/virtio.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 464947f..c4bdb94 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -2653,6 +2653,17 @@ static void virtio_device_class_init(ObjectClass *kl= ass, void *data) dc->unrealize =3D virtio_device_unrealize; dc->bus_type =3D TYPE_VIRTIO_BUS; dc->props =3D virtio_properties; + /* + * Reason: + * - TYPE_VIRTIO_DEVICE devices are not visible to guests + * unless they are created and controlled by transport-specific + * devices (virtio-pci, virtio-mmio, and virtio-ccw). + * - A TYPE_VIRTIO_BUS bus is never available for plugging + * using -device/device_add, as virtio-bus buses are + * created on the fly and immediately populated by the + * transport-specific devices' realize methods. + */ + dc->user_creatable =3D false; vdc->start_ioeventfd =3D virtio_device_start_ioeventfd_impl; vdc->stop_ioeventfd =3D virtio_device_stop_ioeventfd_impl; =20 --=20 2.9.4