From nobody Fri Nov 7 10:15:07 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1547516859183386.7092289673475; Mon, 14 Jan 2019 17:47:39 -0800 (PST) Received: from localhost ([127.0.0.1]:48893 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjDpK-0003bg-0H for importer@patchew.org; Mon, 14 Jan 2019 20:47:38 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36782) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjDji-0007oZ-6w for qemu-devel@nongnu.org; Mon, 14 Jan 2019 20:41:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjDek-0008KI-JS for qemu-devel@nongnu.org; Mon, 14 Jan 2019 20:36:44 -0500 Received: from mx1.redhat.com ([209.132.183.28]:42802) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjDek-0008F7-73 for qemu-devel@nongnu.org; Mon, 14 Jan 2019 20:36:42 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A6E4781E05; Tue, 15 Jan 2019 01:36:33 +0000 (UTC) Received: from redhat.com (ovpn-124-229.rdu2.redhat.com [10.10.124.229]) by smtp.corp.redhat.com (Postfix) with SMTP id DB11C5D776; Tue, 15 Jan 2019 01:36:32 +0000 (UTC) Date: Mon, 14 Jan 2019 20:36:32 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Message-ID: <20190115003812.11329-29-mst@redhat.com> References: <20190115003812.11329-1-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190115003812.11329-1-mst@redhat.com> X-Mutt-Fcc: =sent X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 15 Jan 2019 01:36:33 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 28/44] virtio: split virtio blk bits from virtio-pci 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: Laurent Vivier , Peter Maydell , Thomas Huth , Juan Quintela Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Juan Quintela Reviewed-by: Thomas Huth Reviewed-by: Laurent Vivier Signed-off-by: Juan Quintela Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/virtio-pci.h | 14 ---------- hw/virtio/virtio-pci.c | 61 ----------------------------------------- hw/virtio/Makefile.objs | 1 + tests/Makefile.include | 4 +-- 4 files changed, 3 insertions(+), 77 deletions(-) diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h index d00f6d6b9d..b805c02c11 100644 --- a/hw/virtio/virtio-pci.h +++ b/hw/virtio/virtio-pci.h @@ -16,7 +16,6 @@ #define QEMU_VIRTIO_PCI_H =20 #include "hw/pci/msi.h" -#include "hw/virtio/virtio-blk.h" #include "hw/virtio/virtio-net.h" #include "hw/virtio/virtio-serial.h" #include "hw/virtio/virtio-bus.h" @@ -24,7 +23,6 @@ #include "hw/virtio/virtio-crypto.h" =20 typedef struct VirtIOPCIProxy VirtIOPCIProxy; -typedef struct VirtIOBlkPCI VirtIOBlkPCI; typedef struct VirtIOSerialPCI VirtIOSerialPCI; typedef struct VirtIONetPCI VirtIONetPCI; typedef struct VirtIOGPUPCI VirtIOGPUPCI; @@ -185,18 +183,6 @@ static inline void virtio_pci_disable_modern(VirtIOPCI= Proxy *proxy) proxy->disable_modern =3D true; } =20 -/* - * virtio-blk-pci: This extends VirtioPCIProxy. - */ -#define TYPE_VIRTIO_BLK_PCI "virtio-blk-pci-base" -#define VIRTIO_BLK_PCI(obj) \ - OBJECT_CHECK(VirtIOBlkPCI, (obj), TYPE_VIRTIO_BLK_PCI) - -struct VirtIOBlkPCI { - VirtIOPCIProxy parent_obj; - VirtIOBlock vdev; -}; - /* * virtio-serial-pci: This extends VirtioPCIProxy. */ diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index da812b7844..859b03ae5b 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -19,7 +19,6 @@ =20 #include "standard-headers/linux/virtio_pci.h" #include "hw/virtio/virtio.h" -#include "hw/virtio/virtio-blk.h" #include "hw/virtio/virtio-net.h" #include "hw/virtio/virtio-serial.h" #include "hw/pci/pci.h" @@ -2001,65 +2000,6 @@ void virtio_pci_types_register(const VirtioPCIDevice= TypeInfo *t) } } =20 -/* virtio-blk-pci */ - -static Property virtio_blk_pci_properties[] =3D { - DEFINE_PROP_UINT32("class", VirtIOPCIProxy, class_code, 0), - DEFINE_PROP_BIT("ioeventfd", VirtIOPCIProxy, flags, - VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT, true), - DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, - DEV_NVECTORS_UNSPECIFIED), - DEFINE_PROP_END_OF_LIST(), -}; - -static void virtio_blk_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp) -{ - VirtIOBlkPCI *dev =3D VIRTIO_BLK_PCI(vpci_dev); - DeviceState *vdev =3D DEVICE(&dev->vdev); - - if (vpci_dev->nvectors =3D=3D DEV_NVECTORS_UNSPECIFIED) { - vpci_dev->nvectors =3D dev->vdev.conf.num_queues + 1; - } - - qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus)); - object_property_set_bool(OBJECT(vdev), true, "realized", errp); -} - -static void virtio_blk_pci_class_init(ObjectClass *klass, void *data) -{ - DeviceClass *dc =3D DEVICE_CLASS(klass); - VirtioPCIClass *k =3D VIRTIO_PCI_CLASS(klass); - PCIDeviceClass *pcidev_k =3D PCI_DEVICE_CLASS(klass); - - set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); - dc->props =3D virtio_blk_pci_properties; - k->realize =3D virtio_blk_pci_realize; - pcidev_k->vendor_id =3D PCI_VENDOR_ID_REDHAT_QUMRANET; - pcidev_k->device_id =3D PCI_DEVICE_ID_VIRTIO_BLOCK; - pcidev_k->revision =3D VIRTIO_PCI_ABI_VERSION; - pcidev_k->class_id =3D PCI_CLASS_STORAGE_SCSI; -} - -static void virtio_blk_pci_instance_init(Object *obj) -{ - VirtIOBlkPCI *dev =3D VIRTIO_BLK_PCI(obj); - - virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), - TYPE_VIRTIO_BLK); - object_property_add_alias(obj, "bootindex", OBJECT(&dev->vdev), - "bootindex", &error_abort); -} - -static const VirtioPCIDeviceTypeInfo virtio_blk_pci_info =3D { - .base_name =3D TYPE_VIRTIO_BLK_PCI, - .generic_name =3D "virtio-blk-pci", - .transitional_name =3D "virtio-blk-pci-transitional", - .non_transitional_name =3D "virtio-blk-pci-non-transitional", - .instance_size =3D sizeof(VirtIOBlkPCI), - .instance_init =3D virtio_blk_pci_instance_init, - .class_init =3D virtio_blk_pci_class_init, -}; - /* virtio-serial-pci */ =20 static void virtio_serial_pci_realize(VirtIOPCIProxy *vpci_dev, Error **er= rp) @@ -2244,7 +2184,6 @@ static void virtio_pci_register_types(void) type_register_static(&virtio_pci_info); =20 /* Implementations: */ - virtio_pci_types_register(&virtio_blk_pci_info); virtio_pci_types_register(&virtio_serial_pci_info); virtio_pci_types_register(&virtio_net_pci_info); } diff --git a/hw/virtio/Makefile.objs b/hw/virtio/Makefile.objs index 012b6f74a7..557ad06231 100644 --- a/hw/virtio/Makefile.objs +++ b/hw/virtio/Makefile.objs @@ -22,6 +22,7 @@ obj-$(CONFIG_VIRTIO_RNG) +=3D virtio-rng-pci.o obj-$(CONFIG_VIRTIO_BALLOON) +=3D virtio-balloon-pci.o obj-$(CONFIG_VIRTIO_9P) +=3D virtio-9p-pci.o obj-$(CONFIG_VIRTIO_SCSI) +=3D virtio-scsi-pci.o +obj-$(CONFIG_VIRTIO_BLK) +=3D virtio-blk-pci.o endif endif =20 diff --git a/tests/Makefile.include b/tests/Makefile.include index ba82235bd4..03dbc6bfde 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -148,7 +148,7 @@ check-qtest-virtioserial-y +=3D tests/virtio-console-te= st$(EXESUF) =20 check-qtest-virtio-y +=3D tests/virtio-net-test$(EXESUF) check-qtest-virtio-$(CONFIG_VIRTIO_BALLOON) +=3D tests/virtio-balloon-test= $(EXESUF) -check-qtest-virtio-y +=3D tests/virtio-blk-test$(EXESUF) +check-qtest-virtio-$(CONFIG_VIRTIO_BLK) +=3D tests/virtio-blk-test$(EXESUF) check-qtest-virtio-$(CONFIG_VIRTIO_RNG) +=3D tests/virtio-rng-test$(EXESUF) check-qtest-virtio-$(CONFIG_VIRTIO_SCSI) +=3D tests/virtio-scsi-test$(EXES= UF) ifeq ($(CONFIG_VIRTIO)$(CONFIG_VIRTFS)$(CONFIG_PCI),yyy) @@ -285,7 +285,7 @@ check-qtest-arm-y +=3D tests/pca9552-test$(EXESUF) check-qtest-arm-y +=3D tests/ds1338-test$(EXESUF) check-qtest-arm-y +=3D tests/microbit-test$(EXESUF) check-qtest-arm-y +=3D tests/m25p80-test$(EXESUF) -check-qtest-arm-y +=3D tests/virtio-blk-test$(EXESUF) +check-qtest-arm-$(CONFIG_VIRTIO_BLK) +=3D tests/virtio-blk-test$(EXESUF) check-qtest-arm-y +=3D tests/test-arm-mptimer$(EXESUF) check-qtest-arm-y +=3D tests/boot-serial-test$(EXESUF) check-qtest-arm-$(CONFIG_SDHCI) +=3D tests/sdhci-test$(EXESUF) --=20 MST