From nobody Mon Feb 9 15:10:39 2026 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543262642444329.4802034621936; Mon, 26 Nov 2018 12:04:02 -0800 (PST) Received: from localhost ([::1]:38534 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRN6m-0000I1-JN for importer@patchew.org; Mon, 26 Nov 2018 15:03:52 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52399) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRN4k-0006eR-SO for qemu-devel@nongnu.org; Mon, 26 Nov 2018 15:01:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRN4g-00083m-T2 for qemu-devel@nongnu.org; Mon, 26 Nov 2018 15:01:46 -0500 Received: from mx1.redhat.com ([209.132.183.28]:32826) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRN4g-00083P-Im for qemu-devel@nongnu.org; Mon, 26 Nov 2018 15:01:42 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 885DE9F722 for ; Mon, 26 Nov 2018 20:01:41 +0000 (UTC) Received: from localhost.localdomain (unknown [10.36.118.114]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2770D19C65; Mon, 26 Nov 2018 20:01:39 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Mon, 26 Nov 2018 20:59:54 +0100 Message-Id: <20181126200009.862-2-quintela@redhat.com> In-Reply-To: <20181126200009.862-1-quintela@redhat.com> References: <20181126200009.862-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 26 Nov 2018 20:01:41 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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 v2 01/16] virtio: split vhost vsock 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: lvivier@redhat.com, dgilbert@redhat.com, peterx@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Laurent Vivier --- Updated copyright info Also split virtio-pci.h bits --- hw/virtio/Makefile.objs | 2 +- hw/virtio/vhost-vsock-pci.c | 82 +++++++++++++++++++++++++++++++++++++ hw/virtio/virtio-pci.c | 51 ----------------------- hw/virtio/virtio-pci.h | 18 -------- 4 files changed, 83 insertions(+), 70 deletions(-) create mode 100644 hw/virtio/vhost-vsock-pci.c diff --git a/hw/virtio/Makefile.objs b/hw/virtio/Makefile.objs index 1b2799cfd8..4fbf7de84b 100644 --- a/hw/virtio/Makefile.objs +++ b/hw/virtio/Makefile.objs @@ -10,7 +10,7 @@ obj-$(CONFIG_VIRTIO_CRYPTO) +=3D virtio-crypto.o obj-$(call land,$(CONFIG_VIRTIO_CRYPTO),$(CONFIG_VIRTIO_PCI)) +=3D virtio-= crypto-pci.o =20 obj-$(CONFIG_LINUX) +=3D vhost.o vhost-backend.o vhost-user.o -obj-$(CONFIG_VHOST_VSOCK) +=3D vhost-vsock.o +obj-$(CONFIG_VHOST_VSOCK) +=3D vhost-vsock.o vhost-vsock-pci.o endif =20 common-obj-$(call lnot,$(call land,$(CONFIG_VIRTIO),$(CONFIG_LINUX))) +=3D= vhost-stub.o diff --git a/hw/virtio/vhost-vsock-pci.c b/hw/virtio/vhost-vsock-pci.c new file mode 100644 index 0000000000..5cafa8335c --- /dev/null +++ b/hw/virtio/vhost-vsock-pci.c @@ -0,0 +1,82 @@ +/* + * Vhost vsock PCI Bindings + * + * Copyright 2015 Red Hat, Inc. + * + * Authors: + * Stefan Hajnoczi + * + * This work is licensed under the terms of the GNU GPL, version 2 or + * (at your option) any later version. See the COPYING file in the + * top-level directory. + */ + +#include "qemu/osdep.h" + +#include "virtio-pci.h" +#include "hw/virtio/vhost-vsock.h" + +typedef struct VHostVSockPCI VHostVSockPCI; + +/* + * vhost-vsock-pci: This extends VirtioPCIProxy. + */ +#define TYPE_VHOST_VSOCK_PCI "vhost-vsock-pci" +#define VHOST_VSOCK_PCI(obj) \ + OBJECT_CHECK(VHostVSockPCI, (obj), TYPE_VHOST_VSOCK_PCI) + +struct VHostVSockPCI { + VirtIOPCIProxy parent_obj; + VHostVSock vdev; +}; + +static Property vhost_vsock_pci_properties[] =3D { + DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 3), + DEFINE_PROP_END_OF_LIST(), +}; + +static void vhost_vsock_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp) +{ + VHostVSockPCI *dev =3D VHOST_VSOCK_PCI(vpci_dev); + DeviceState *vdev =3D DEVICE(&dev->vdev); + + qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus)); + object_property_set_bool(OBJECT(vdev), true, "realized", errp); +} + +static void vhost_vsock_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); + k->realize =3D vhost_vsock_pci_realize; + set_bit(DEVICE_CATEGORY_MISC, dc->categories); + dc->props =3D vhost_vsock_pci_properties; + pcidev_k->vendor_id =3D PCI_VENDOR_ID_REDHAT_QUMRANET; + pcidev_k->device_id =3D PCI_DEVICE_ID_VIRTIO_VSOCK; + pcidev_k->revision =3D 0x00; + pcidev_k->class_id =3D PCI_CLASS_COMMUNICATION_OTHER; +} + +static void vhost_vsock_pci_instance_init(Object *obj) +{ + VHostVSockPCI *dev =3D VHOST_VSOCK_PCI(obj); + + virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), + TYPE_VHOST_VSOCK); +} + +static const TypeInfo vhost_vsock_pci_info =3D { + .name =3D TYPE_VHOST_VSOCK_PCI, + .parent =3D TYPE_VIRTIO_PCI, + .instance_size =3D sizeof(VHostVSockPCI), + .instance_init =3D vhost_vsock_pci_instance_init, + .class_init =3D vhost_vsock_pci_class_init, +}; + +static void virtio_pci_vhost_register(void) +{ + type_register_static(&vhost_vsock_pci_info); +} + +type_init(virtio_pci_vhost_register) diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index a954799267..56b39a3699 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -2238,54 +2238,6 @@ static const TypeInfo vhost_user_scsi_pci_info =3D { }; #endif =20 -/* vhost-vsock-pci */ - -#ifdef CONFIG_VHOST_VSOCK -static Property vhost_vsock_pci_properties[] =3D { - DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 3), - DEFINE_PROP_END_OF_LIST(), -}; - -static void vhost_vsock_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp) -{ - VHostVSockPCI *dev =3D VHOST_VSOCK_PCI(vpci_dev); - DeviceState *vdev =3D DEVICE(&dev->vdev); - - qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus)); - object_property_set_bool(OBJECT(vdev), true, "realized", errp); -} - -static void vhost_vsock_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); - k->realize =3D vhost_vsock_pci_realize; - set_bit(DEVICE_CATEGORY_MISC, dc->categories); - dc->props =3D vhost_vsock_pci_properties; - pcidev_k->vendor_id =3D PCI_VENDOR_ID_REDHAT_QUMRANET; - pcidev_k->device_id =3D PCI_DEVICE_ID_VIRTIO_VSOCK; - pcidev_k->revision =3D 0x00; - pcidev_k->class_id =3D PCI_CLASS_COMMUNICATION_OTHER; -} - -static void vhost_vsock_pci_instance_init(Object *obj) -{ - VHostVSockPCI *dev =3D VHOST_VSOCK_PCI(obj); - - virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), - TYPE_VHOST_VSOCK); -} - -static const TypeInfo vhost_vsock_pci_info =3D { - .name =3D TYPE_VHOST_VSOCK_PCI, - .parent =3D TYPE_VIRTIO_PCI, - .instance_size =3D sizeof(VHostVSockPCI), - .instance_init =3D vhost_vsock_pci_instance_init, - .class_init =3D vhost_vsock_pci_class_init, -}; -#endif - /* virtio-balloon-pci */ =20 static Property virtio_balloon_pci_properties[] =3D { @@ -2720,9 +2672,6 @@ static void virtio_pci_register_types(void) #if defined(CONFIG_VHOST_USER) && defined(CONFIG_LINUX) type_register_static(&vhost_user_scsi_pci_info); #endif -#ifdef CONFIG_VHOST_VSOCK - type_register_static(&vhost_vsock_pci_info); -#endif } =20 type_init(virtio_pci_register_types) diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h index 813082b0d7..25d225bc7d 100644 --- a/hw/virtio/virtio-pci.h +++ b/hw/virtio/virtio-pci.h @@ -37,9 +37,6 @@ #ifdef CONFIG_VHOST_SCSI #include "hw/virtio/vhost-scsi.h" #endif -#ifdef CONFIG_VHOST_VSOCK -#include "hw/virtio/vhost-vsock.h" -#endif =20 typedef struct VirtIOPCIProxy VirtIOPCIProxy; typedef struct VirtIOBlkPCI VirtIOBlkPCI; @@ -55,7 +52,6 @@ typedef struct VirtIOInputPCI VirtIOInputPCI; typedef struct VirtIOInputHIDPCI VirtIOInputHIDPCI; typedef struct VirtIOInputHostPCI VirtIOInputHostPCI; typedef struct VirtIOGPUPCI VirtIOGPUPCI; -typedef struct VHostVSockPCI VHostVSockPCI; typedef struct VirtIOCryptoPCI VirtIOCryptoPCI; =20 /* virtio-pci-bus */ @@ -388,20 +384,6 @@ struct VirtIOGPUPCI { VirtIOGPU vdev; }; =20 -#ifdef CONFIG_VHOST_VSOCK -/* - * vhost-vsock-pci: This extends VirtioPCIProxy. - */ -#define TYPE_VHOST_VSOCK_PCI "vhost-vsock-pci" -#define VHOST_VSOCK_PCI(obj) \ - OBJECT_CHECK(VHostVSockPCI, (obj), TYPE_VHOST_VSOCK_PCI) - -struct VHostVSockPCI { - VirtIOPCIProxy parent_obj; - VHostVSock vdev; -}; -#endif - /* * virtio-crypto-pci: This extends VirtioPCIProxy. */ --=20 2.19.1 From nobody Mon Feb 9 15:10:39 2026 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543262643504299.83731358956834; Mon, 26 Nov 2018 12:04:03 -0800 (PST) Received: from localhost ([::1]:38533 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRN6k-0000HF-CF for importer@patchew.org; Mon, 26 Nov 2018 15:03:50 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52395) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRN4k-0006eP-Rr for qemu-devel@nongnu.org; Mon, 26 Nov 2018 15:01:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRN4i-000841-9y for qemu-devel@nongnu.org; Mon, 26 Nov 2018 15:01:46 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60728) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRN4i-00083q-1f for qemu-devel@nongnu.org; Mon, 26 Nov 2018 15:01:44 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 49A90316468F for ; Mon, 26 Nov 2018 20:01:43 +0000 (UTC) Received: from localhost.localdomain (unknown [10.36.118.114]) by smtp.corp.redhat.com (Postfix) with ESMTP id DD1F519C65; Mon, 26 Nov 2018 20:01:41 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Mon, 26 Nov 2018 20:59:55 +0100 Message-Id: <20181126200009.862-3-quintela@redhat.com> In-Reply-To: <20181126200009.862-1-quintela@redhat.com> References: <20181126200009.862-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Mon, 26 Nov 2018 20:01:43 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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 v2 02/16] virtio: split virtio input host 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: lvivier@redhat.com, dgilbert@redhat.com, peterx@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Laurent Vivier --- default-configs/virtio.mak | 1 + hw/virtio/Makefile.objs | 1 + hw/virtio/virtio-input-host-pci.c | 45 +++++++++++++++++++++++++++++++ hw/virtio/virtio-pci.c | 20 -------------- hw/virtio/virtio-pci.h | 14 ---------- 5 files changed, 47 insertions(+), 34 deletions(-) create mode 100644 hw/virtio/virtio-input-host-pci.c diff --git a/default-configs/virtio.mak b/default-configs/virtio.mak index 1304849018..5ae4a61018 100644 --- a/default-configs/virtio.mak +++ b/default-configs/virtio.mak @@ -12,3 +12,4 @@ CONFIG_VIRTIO_RNG=3Dy CONFIG_SCSI=3Dy CONFIG_VIRTIO_SCSI=3Dy CONFIG_VIRTIO_SERIAL=3Dy +CONFIG_VIRTIO_INPUT_HOST=3D$(CONFIG_LINUX) diff --git a/hw/virtio/Makefile.objs b/hw/virtio/Makefile.objs index 4fbf7de84b..685ae1d866 100644 --- a/hw/virtio/Makefile.objs +++ b/hw/virtio/Makefile.objs @@ -11,6 +11,7 @@ obj-$(call land,$(CONFIG_VIRTIO_CRYPTO),$(CONFIG_VIRTIO_P= CI)) +=3D virtio-crypto-p =20 obj-$(CONFIG_LINUX) +=3D vhost.o vhost-backend.o vhost-user.o obj-$(CONFIG_VHOST_VSOCK) +=3D vhost-vsock.o vhost-vsock-pci.o +obj-$(CONFIG_VIRTIO_INPUT_HOST) +=3D virtio-input-host-pci.o endif =20 common-obj-$(call lnot,$(call land,$(CONFIG_VIRTIO),$(CONFIG_LINUX))) +=3D= vhost-stub.o diff --git a/hw/virtio/virtio-input-host-pci.c b/hw/virtio/virtio-input-hos= t-pci.c new file mode 100644 index 0000000000..4048e2f01e --- /dev/null +++ b/hw/virtio/virtio-input-host-pci.c @@ -0,0 +1,45 @@ +/* + * Virtio input host PCI Bindings + * + * This work is licensed under the terms of the GNU GPL, version 2 or + * (at your option) any later version. See the COPYING file in the + * top-level directory. + */ + +#include "qemu/osdep.h" + +#include "virtio-pci.h" +#include "hw/virtio/virtio-input.h" + +typedef struct VirtIOInputHostPCI VirtIOInputHostPCI; + +#define TYPE_VIRTIO_INPUT_HOST_PCI "virtio-input-host-pci" +#define VIRTIO_INPUT_HOST_PCI(obj) \ + OBJECT_CHECK(VirtIOInputHostPCI, (obj), TYPE_VIRTIO_INPUT_HOST_PCI) + +struct VirtIOInputHostPCI { + VirtIOPCIProxy parent_obj; + VirtIOInputHost vdev; +}; + +static void virtio_input_host_initfn(Object *obj) +{ + VirtIOInputHostPCI *dev =3D VIRTIO_INPUT_HOST_PCI(obj); + + virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), + TYPE_VIRTIO_INPUT_HOST); +} + +static const TypeInfo virtio_input_host_pci_info =3D { + .name =3D TYPE_VIRTIO_INPUT_HOST_PCI, + .parent =3D TYPE_VIRTIO_INPUT_PCI, + .instance_size =3D sizeof(VirtIOInputHostPCI), + .instance_init =3D virtio_input_host_initfn, +}; + +static void virtio_input_host_pci_register(void) +{ + type_register_static(&virtio_input_host_pci_info); +} + +type_init(virtio_input_host_pci_register) diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index 56b39a3699..97e40da9e8 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -2580,23 +2580,6 @@ static const TypeInfo virtio_tablet_pci_info =3D { .instance_init =3D virtio_tablet_initfn, }; =20 -#ifdef CONFIG_LINUX -static void virtio_host_initfn(Object *obj) -{ - VirtIOInputHostPCI *dev =3D VIRTIO_INPUT_HOST_PCI(obj); - - virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), - TYPE_VIRTIO_INPUT_HOST); -} - -static const TypeInfo virtio_host_pci_info =3D { - .name =3D TYPE_VIRTIO_INPUT_HOST_PCI, - .parent =3D TYPE_VIRTIO_INPUT_PCI, - .instance_size =3D sizeof(VirtIOInputHostPCI), - .instance_init =3D virtio_host_initfn, -}; -#endif - /* virtio-pci-bus */ =20 static void virtio_pci_bus_new(VirtioBusState *bus, size_t bus_size, @@ -2650,9 +2633,6 @@ static void virtio_pci_register_types(void) type_register_static(&virtio_keyboard_pci_info); type_register_static(&virtio_mouse_pci_info); type_register_static(&virtio_tablet_pci_info); -#ifdef CONFIG_LINUX - type_register_static(&virtio_host_pci_info); -#endif type_register_static(&virtio_pci_bus_info); type_register_static(&virtio_pci_info); #ifdef CONFIG_VIRTFS diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h index 25d225bc7d..cf4cbecfab 100644 --- a/hw/virtio/virtio-pci.h +++ b/hw/virtio/virtio-pci.h @@ -50,7 +50,6 @@ typedef struct VHostUserBlkPCI VHostUserBlkPCI; typedef struct VirtIORngPCI VirtIORngPCI; typedef struct VirtIOInputPCI VirtIOInputPCI; typedef struct VirtIOInputHIDPCI VirtIOInputHIDPCI; -typedef struct VirtIOInputHostPCI VirtIOInputHostPCI; typedef struct VirtIOGPUPCI VirtIOGPUPCI; typedef struct VirtIOCryptoPCI VirtIOCryptoPCI; =20 @@ -359,19 +358,6 @@ struct VirtIOInputHIDPCI { VirtIOInputHID vdev; }; =20 -#ifdef CONFIG_LINUX - -#define TYPE_VIRTIO_INPUT_HOST_PCI "virtio-input-host-pci" -#define VIRTIO_INPUT_HOST_PCI(obj) \ - OBJECT_CHECK(VirtIOInputHostPCI, (obj), TYPE_VIRTIO_INPUT_HOST_PCI) - -struct VirtIOInputHostPCI { - VirtIOPCIProxy parent_obj; - VirtIOInputHost vdev; -}; - -#endif - /* * virtio-gpu-pci: This extends VirtioPCIProxy. */ --=20 2.19.1 From nobody Mon Feb 9 15:10:39 2026 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543262643434989.5986433611396; Mon, 26 Nov 2018 12:04:03 -0800 (PST) Received: from localhost ([::1]:38535 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRN6q-0000M4-UI for importer@patchew.org; Mon, 26 Nov 2018 15:03:57 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52411) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRN4l-0006eS-K7 for qemu-devel@nongnu.org; Mon, 26 Nov 2018 15:01:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRN4k-00084E-5B for qemu-devel@nongnu.org; Mon, 26 Nov 2018 15:01:47 -0500 Received: from mx1.redhat.com ([209.132.183.28]:39736) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRN4j-000845-Sc for qemu-devel@nongnu.org; Mon, 26 Nov 2018 15:01:46 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 09742FDEF for ; Mon, 26 Nov 2018 20:01:45 +0000 (UTC) Received: from localhost.localdomain (unknown [10.36.118.114]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9CB4219C65; Mon, 26 Nov 2018 20:01:43 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Mon, 26 Nov 2018 20:59:56 +0100 Message-Id: <20181126200009.862-4-quintela@redhat.com> In-Reply-To: <20181126200009.862-1-quintela@redhat.com> References: <20181126200009.862-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 26 Nov 2018 20:01:45 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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 v2 03/16] virtio: split virtio input 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: lvivier@redhat.com, dgilbert@redhat.com, peterx@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Laurent Vivier --- hw/virtio/Makefile.objs | 1 + hw/virtio/virtio-input-pci.c | 154 +++++++++++++++++++++++++++++++++++ hw/virtio/virtio-pci.c | 113 ------------------------- hw/virtio/virtio-pci.h | 22 ----- 4 files changed, 155 insertions(+), 135 deletions(-) create mode 100644 hw/virtio/virtio-input-pci.c diff --git a/hw/virtio/Makefile.objs b/hw/virtio/Makefile.objs index 685ae1d866..6819ed4e14 100644 --- a/hw/virtio/Makefile.objs +++ b/hw/virtio/Makefile.objs @@ -12,6 +12,7 @@ obj-$(call land,$(CONFIG_VIRTIO_CRYPTO),$(CONFIG_VIRTIO_P= CI)) +=3D virtio-crypto-p obj-$(CONFIG_LINUX) +=3D vhost.o vhost-backend.o vhost-user.o obj-$(CONFIG_VHOST_VSOCK) +=3D vhost-vsock.o vhost-vsock-pci.o obj-$(CONFIG_VIRTIO_INPUT_HOST) +=3D virtio-input-host-pci.o +obj-$(CONFIG_VIRTIO_INPUT) +=3D virtio-input-pci.o endif =20 common-obj-$(call lnot,$(call land,$(CONFIG_VIRTIO),$(CONFIG_LINUX))) +=3D= vhost-stub.o diff --git a/hw/virtio/virtio-input-pci.c b/hw/virtio/virtio-input-pci.c new file mode 100644 index 0000000000..12fc46043e --- /dev/null +++ b/hw/virtio/virtio-input-pci.c @@ -0,0 +1,154 @@ +/* + * Virtio input PCI Bindings + * + * This work is licensed under the terms of the GNU GPL, version 2 or + * (at your option) any later version. See the COPYING file in the + * top-level directory. + */ + +#include "qemu/osdep.h" + +#include "virtio-pci.h" +#include "hw/virtio/virtio-input.h" + +typedef struct VirtIOInputPCI VirtIOInputPCI; +typedef struct VirtIOInputHIDPCI VirtIOInputHIDPCI; + +/* + * virtio-input-pci: This extends VirtioPCIProxy. + */ +#define VIRTIO_INPUT_PCI(obj) \ + OBJECT_CHECK(VirtIOInputPCI, (obj), TYPE_VIRTIO_INPUT_PCI) + +struct VirtIOInputPCI { + VirtIOPCIProxy parent_obj; + VirtIOInput vdev; +}; + +#define TYPE_VIRTIO_INPUT_HID_PCI "virtio-input-hid-pci" +#define TYPE_VIRTIO_KEYBOARD_PCI "virtio-keyboard-pci" +#define TYPE_VIRTIO_MOUSE_PCI "virtio-mouse-pci" +#define TYPE_VIRTIO_TABLET_PCI "virtio-tablet-pci" +#define VIRTIO_INPUT_HID_PCI(obj) \ + OBJECT_CHECK(VirtIOInputHIDPCI, (obj), TYPE_VIRTIO_INPUT_HID_PCI) + +struct VirtIOInputHIDPCI { + VirtIOPCIProxy parent_obj; + VirtIOInputHID vdev; +}; + +static Property virtio_input_pci_properties[] =3D { + DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 2), + DEFINE_PROP_END_OF_LIST(), +}; + +static void virtio_input_pci_realize(VirtIOPCIProxy *vpci_dev, Error **err= p) +{ + VirtIOInputPCI *vinput =3D VIRTIO_INPUT_PCI(vpci_dev); + DeviceState *vdev =3D DEVICE(&vinput->vdev); + + 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); +} + +static void virtio_input_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); + + dc->props =3D virtio_input_pci_properties; + k->realize =3D virtio_input_pci_realize; + set_bit(DEVICE_CATEGORY_INPUT, dc->categories); + + pcidev_k->class_id =3D PCI_CLASS_INPUT_OTHER; +} + +static void virtio_input_hid_kbd_pci_class_init(ObjectClass *klass, void *= data) +{ + PCIDeviceClass *pcidev_k =3D PCI_DEVICE_CLASS(klass); + + pcidev_k->class_id =3D PCI_CLASS_INPUT_KEYBOARD; +} + +static void virtio_input_hid_mouse_pci_class_init(ObjectClass *klass, + void *data) +{ + PCIDeviceClass *pcidev_k =3D PCI_DEVICE_CLASS(klass); + + pcidev_k->class_id =3D PCI_CLASS_INPUT_MOUSE; +} + +static void virtio_keyboard_initfn(Object *obj) +{ + VirtIOInputHIDPCI *dev =3D VIRTIO_INPUT_HID_PCI(obj); + + virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), + TYPE_VIRTIO_KEYBOARD); +} + +static void virtio_mouse_initfn(Object *obj) +{ + VirtIOInputHIDPCI *dev =3D VIRTIO_INPUT_HID_PCI(obj); + + virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), + TYPE_VIRTIO_MOUSE); +} + +static void virtio_tablet_initfn(Object *obj) +{ + VirtIOInputHIDPCI *dev =3D VIRTIO_INPUT_HID_PCI(obj); + + virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), + TYPE_VIRTIO_TABLET); +} + +static const TypeInfo virtio_input_pci_info =3D { + .name =3D TYPE_VIRTIO_INPUT_PCI, + .parent =3D TYPE_VIRTIO_PCI, + .instance_size =3D sizeof(VirtIOInputPCI), + .class_init =3D virtio_input_pci_class_init, + .abstract =3D true, +}; + +static const TypeInfo virtio_input_hid_pci_info =3D { + .name =3D TYPE_VIRTIO_INPUT_HID_PCI, + .parent =3D TYPE_VIRTIO_INPUT_PCI, + .instance_size =3D sizeof(VirtIOInputHIDPCI), + .abstract =3D true, +}; + +static const TypeInfo virtio_keyboard_pci_info =3D { + .name =3D TYPE_VIRTIO_KEYBOARD_PCI, + .parent =3D TYPE_VIRTIO_INPUT_HID_PCI, + .class_init =3D virtio_input_hid_kbd_pci_class_init, + .instance_size =3D sizeof(VirtIOInputHIDPCI), + .instance_init =3D virtio_keyboard_initfn, +}; + +static const TypeInfo virtio_mouse_pci_info =3D { + .name =3D TYPE_VIRTIO_MOUSE_PCI, + .parent =3D TYPE_VIRTIO_INPUT_HID_PCI, + .class_init =3D virtio_input_hid_mouse_pci_class_init, + .instance_size =3D sizeof(VirtIOInputHIDPCI), + .instance_init =3D virtio_mouse_initfn, +}; + +static const TypeInfo virtio_tablet_pci_info =3D { + .name =3D TYPE_VIRTIO_TABLET_PCI, + .parent =3D TYPE_VIRTIO_INPUT_HID_PCI, + .instance_size =3D sizeof(VirtIOInputHIDPCI), + .instance_init =3D virtio_tablet_initfn, +}; + +static void virtio_pci_input_register(void) +{ + type_register_static(&virtio_input_pci_info); + type_register_static(&virtio_input_hid_pci_info); + type_register_static(&virtio_keyboard_pci_info); + type_register_static(&virtio_mouse_pci_info); + type_register_static(&virtio_tablet_pci_info); +} + +type_init(virtio_pci_input_register) diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index 97e40da9e8..bb1d2db032 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -24,7 +24,6 @@ #include "hw/virtio/virtio-serial.h" #include "hw/virtio/virtio-scsi.h" #include "hw/virtio/virtio-balloon.h" -#include "hw/virtio/virtio-input.h" #include "hw/pci/pci.h" #include "qapi/error.h" #include "qemu/error-report.h" @@ -2473,113 +2472,6 @@ static const TypeInfo virtio_rng_pci_info =3D { .class_init =3D virtio_rng_pci_class_init, }; =20 -/* virtio-input-pci */ - -static Property virtio_input_pci_properties[] =3D { - DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 2), - DEFINE_PROP_END_OF_LIST(), -}; - -static void virtio_input_pci_realize(VirtIOPCIProxy *vpci_dev, Error **err= p) -{ - VirtIOInputPCI *vinput =3D VIRTIO_INPUT_PCI(vpci_dev); - DeviceState *vdev =3D DEVICE(&vinput->vdev); - - 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); -} - -static void virtio_input_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); - - dc->props =3D virtio_input_pci_properties; - k->realize =3D virtio_input_pci_realize; - set_bit(DEVICE_CATEGORY_INPUT, dc->categories); - - pcidev_k->class_id =3D PCI_CLASS_INPUT_OTHER; -} - -static void virtio_input_hid_kbd_pci_class_init(ObjectClass *klass, void *= data) -{ - PCIDeviceClass *pcidev_k =3D PCI_DEVICE_CLASS(klass); - - pcidev_k->class_id =3D PCI_CLASS_INPUT_KEYBOARD; -} - -static void virtio_input_hid_mouse_pci_class_init(ObjectClass *klass, - void *data) -{ - PCIDeviceClass *pcidev_k =3D PCI_DEVICE_CLASS(klass); - - pcidev_k->class_id =3D PCI_CLASS_INPUT_MOUSE; -} - -static void virtio_keyboard_initfn(Object *obj) -{ - VirtIOInputHIDPCI *dev =3D VIRTIO_INPUT_HID_PCI(obj); - - virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), - TYPE_VIRTIO_KEYBOARD); -} - -static void virtio_mouse_initfn(Object *obj) -{ - VirtIOInputHIDPCI *dev =3D VIRTIO_INPUT_HID_PCI(obj); - - virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), - TYPE_VIRTIO_MOUSE); -} - -static void virtio_tablet_initfn(Object *obj) -{ - VirtIOInputHIDPCI *dev =3D VIRTIO_INPUT_HID_PCI(obj); - - virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), - TYPE_VIRTIO_TABLET); -} - -static const TypeInfo virtio_input_pci_info =3D { - .name =3D TYPE_VIRTIO_INPUT_PCI, - .parent =3D TYPE_VIRTIO_PCI, - .instance_size =3D sizeof(VirtIOInputPCI), - .class_init =3D virtio_input_pci_class_init, - .abstract =3D true, -}; - -static const TypeInfo virtio_input_hid_pci_info =3D { - .name =3D TYPE_VIRTIO_INPUT_HID_PCI, - .parent =3D TYPE_VIRTIO_INPUT_PCI, - .instance_size =3D sizeof(VirtIOInputHIDPCI), - .abstract =3D true, -}; - -static const TypeInfo virtio_keyboard_pci_info =3D { - .name =3D TYPE_VIRTIO_KEYBOARD_PCI, - .parent =3D TYPE_VIRTIO_INPUT_HID_PCI, - .class_init =3D virtio_input_hid_kbd_pci_class_init, - .instance_size =3D sizeof(VirtIOInputHIDPCI), - .instance_init =3D virtio_keyboard_initfn, -}; - -static const TypeInfo virtio_mouse_pci_info =3D { - .name =3D TYPE_VIRTIO_MOUSE_PCI, - .parent =3D TYPE_VIRTIO_INPUT_HID_PCI, - .class_init =3D virtio_input_hid_mouse_pci_class_init, - .instance_size =3D sizeof(VirtIOInputHIDPCI), - .instance_init =3D virtio_mouse_initfn, -}; - -static const TypeInfo virtio_tablet_pci_info =3D { - .name =3D TYPE_VIRTIO_TABLET_PCI, - .parent =3D TYPE_VIRTIO_INPUT_HID_PCI, - .instance_size =3D sizeof(VirtIOInputHIDPCI), - .instance_init =3D virtio_tablet_initfn, -}; - /* virtio-pci-bus */ =20 static void virtio_pci_bus_new(VirtioBusState *bus, size_t bus_size, @@ -2628,11 +2520,6 @@ static const TypeInfo virtio_pci_bus_info =3D { static void virtio_pci_register_types(void) { type_register_static(&virtio_rng_pci_info); - type_register_static(&virtio_input_pci_info); - type_register_static(&virtio_input_hid_pci_info); - type_register_static(&virtio_keyboard_pci_info); - type_register_static(&virtio_mouse_pci_info); - type_register_static(&virtio_tablet_pci_info); type_register_static(&virtio_pci_bus_info); type_register_static(&virtio_pci_info); #ifdef CONFIG_VIRTFS diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h index cf4cbecfab..32d5f0fbff 100644 --- a/hw/virtio/virtio-pci.h +++ b/hw/virtio/virtio-pci.h @@ -23,7 +23,6 @@ #include "hw/virtio/virtio-scsi.h" #include "hw/virtio/virtio-balloon.h" #include "hw/virtio/virtio-bus.h" -#include "hw/virtio/virtio-input.h" #include "hw/virtio/virtio-gpu.h" #include "hw/virtio/virtio-crypto.h" #include "hw/virtio/vhost-user-scsi.h" @@ -48,8 +47,6 @@ typedef struct VHostSCSIPCI VHostSCSIPCI; typedef struct VHostUserSCSIPCI VHostUserSCSIPCI; typedef struct VHostUserBlkPCI VHostUserBlkPCI; typedef struct VirtIORngPCI VirtIORngPCI; -typedef struct VirtIOInputPCI VirtIOInputPCI; -typedef struct VirtIOInputHIDPCI VirtIOInputHIDPCI; typedef struct VirtIOGPUPCI VirtIOGPUPCI; typedef struct VirtIOCryptoPCI VirtIOCryptoPCI; =20 @@ -338,25 +335,6 @@ struct VirtIORngPCI { * virtio-input-pci: This extends VirtioPCIProxy. */ #define TYPE_VIRTIO_INPUT_PCI "virtio-input-pci" -#define VIRTIO_INPUT_PCI(obj) \ - OBJECT_CHECK(VirtIOInputPCI, (obj), TYPE_VIRTIO_INPUT_PCI) - -struct VirtIOInputPCI { - VirtIOPCIProxy parent_obj; - VirtIOInput vdev; -}; - -#define TYPE_VIRTIO_INPUT_HID_PCI "virtio-input-hid-pci" -#define TYPE_VIRTIO_KEYBOARD_PCI "virtio-keyboard-pci" -#define TYPE_VIRTIO_MOUSE_PCI "virtio-mouse-pci" -#define TYPE_VIRTIO_TABLET_PCI "virtio-tablet-pci" -#define VIRTIO_INPUT_HID_PCI(obj) \ - OBJECT_CHECK(VirtIOInputHIDPCI, (obj), TYPE_VIRTIO_INPUT_HID_PCI) - -struct VirtIOInputHIDPCI { - VirtIOPCIProxy parent_obj; - VirtIOInputHID vdev; -}; =20 /* * virtio-gpu-pci: This extends VirtioPCIProxy. --=20 2.19.1 From nobody Mon Feb 9 15:10:39 2026 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543262818213726.4843179218262; Mon, 26 Nov 2018 12:06:58 -0800 (PST) Received: from localhost ([::1]:38551 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRN9j-0002hk-OI for importer@patchew.org; Mon, 26 Nov 2018 15:06:55 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52432) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRN4r-0006hC-04 for qemu-devel@nongnu.org; Mon, 26 Nov 2018 15:01:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRN4p-000851-Kn for qemu-devel@nongnu.org; Mon, 26 Nov 2018 15:01:52 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33044) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRN4p-00084x-Cd for qemu-devel@nongnu.org; Mon, 26 Nov 2018 15:01:51 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8CE283084031 for ; Mon, 26 Nov 2018 20:01:50 +0000 (UTC) Received: from localhost.localdomain (unknown [10.36.118.114]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5C45819C65; Mon, 26 Nov 2018 20:01:45 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Mon, 26 Nov 2018 20:59:57 +0100 Message-Id: <20181126200009.862-5-quintela@redhat.com> In-Reply-To: <20181126200009.862-1-quintela@redhat.com> References: <20181126200009.862-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Mon, 26 Nov 2018 20:01:50 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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 v2 04/16] virtio: split virtio rng 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: lvivier@redhat.com, dgilbert@redhat.com, peterx@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Laurent Vivier --- Remove the "contributions after" clause. This is based on commit 59ccd20a9ac719cff82180429458728f03ec612f Author: KONRAD Frederic Date: Wed Apr 24 10:07:56 2013 +0200 --- hw/virtio/Makefile.objs | 1 + hw/virtio/virtio-pci.c | 52 ----------------------- hw/virtio/virtio-pci.h | 14 ------- hw/virtio/virtio-rng-pci.c | 86 ++++++++++++++++++++++++++++++++++++++ tests/Makefile.include | 1 + 5 files changed, 88 insertions(+), 66 deletions(-) create mode 100644 hw/virtio/virtio-rng-pci.c diff --git a/hw/virtio/Makefile.objs b/hw/virtio/Makefile.objs index 6819ed4e14..2efa544a2d 100644 --- a/hw/virtio/Makefile.objs +++ b/hw/virtio/Makefile.objs @@ -13,6 +13,7 @@ obj-$(CONFIG_LINUX) +=3D vhost.o vhost-backend.o vhost-us= er.o obj-$(CONFIG_VHOST_VSOCK) +=3D vhost-vsock.o vhost-vsock-pci.o obj-$(CONFIG_VIRTIO_INPUT_HOST) +=3D virtio-input-host-pci.o obj-$(CONFIG_VIRTIO_INPUT) +=3D virtio-input-pci.o +obj-$(CONFIG_VIRTIO_RNG) +=3D virtio-rng-pci.o endif =20 common-obj-$(call lnot,$(call land,$(CONFIG_VIRTIO),$(CONFIG_LINUX))) +=3D= vhost-stub.o diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index bb1d2db032..433ece611d 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -2421,57 +2421,6 @@ static const TypeInfo virtio_net_pci_info =3D { .class_init =3D virtio_net_pci_class_init, }; =20 -/* virtio-rng-pci */ - -static void virtio_rng_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp) -{ - VirtIORngPCI *vrng =3D VIRTIO_RNG_PCI(vpci_dev); - DeviceState *vdev =3D DEVICE(&vrng->vdev); - Error *err =3D NULL; - - qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus)); - object_property_set_bool(OBJECT(vdev), true, "realized", &err); - if (err) { - error_propagate(errp, err); - return; - } - - object_property_set_link(OBJECT(vrng), - OBJECT(vrng->vdev.conf.rng), "rng", - NULL); -} - -static void virtio_rng_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); - - k->realize =3D virtio_rng_pci_realize; - set_bit(DEVICE_CATEGORY_MISC, dc->categories); - - pcidev_k->vendor_id =3D PCI_VENDOR_ID_REDHAT_QUMRANET; - pcidev_k->device_id =3D PCI_DEVICE_ID_VIRTIO_RNG; - pcidev_k->revision =3D VIRTIO_PCI_ABI_VERSION; - pcidev_k->class_id =3D PCI_CLASS_OTHERS; -} - -static void virtio_rng_initfn(Object *obj) -{ - VirtIORngPCI *dev =3D VIRTIO_RNG_PCI(obj); - - virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), - TYPE_VIRTIO_RNG); -} - -static const TypeInfo virtio_rng_pci_info =3D { - .name =3D TYPE_VIRTIO_RNG_PCI, - .parent =3D TYPE_VIRTIO_PCI, - .instance_size =3D sizeof(VirtIORngPCI), - .instance_init =3D virtio_rng_initfn, - .class_init =3D virtio_rng_pci_class_init, -}; - /* virtio-pci-bus */ =20 static void virtio_pci_bus_new(VirtioBusState *bus, size_t bus_size, @@ -2519,7 +2468,6 @@ static const TypeInfo virtio_pci_bus_info =3D { =20 static void virtio_pci_register_types(void) { - type_register_static(&virtio_rng_pci_info); type_register_static(&virtio_pci_bus_info); type_register_static(&virtio_pci_info); #ifdef CONFIG_VIRTFS diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h index 32d5f0fbff..2415eb6a4d 100644 --- a/hw/virtio/virtio-pci.h +++ b/hw/virtio/virtio-pci.h @@ -18,7 +18,6 @@ #include "hw/pci/msi.h" #include "hw/virtio/virtio-blk.h" #include "hw/virtio/virtio-net.h" -#include "hw/virtio/virtio-rng.h" #include "hw/virtio/virtio-serial.h" #include "hw/virtio/virtio-scsi.h" #include "hw/virtio/virtio-balloon.h" @@ -46,7 +45,6 @@ typedef struct VirtIONetPCI VirtIONetPCI; typedef struct VHostSCSIPCI VHostSCSIPCI; typedef struct VHostUserSCSIPCI VHostUserSCSIPCI; typedef struct VHostUserBlkPCI VHostUserBlkPCI; -typedef struct VirtIORngPCI VirtIORngPCI; typedef struct VirtIOGPUPCI VirtIOGPUPCI; typedef struct VirtIOCryptoPCI VirtIOCryptoPCI; =20 @@ -319,18 +317,6 @@ typedef struct V9fsPCIState { =20 #endif =20 -/* - * virtio-rng-pci: This extends VirtioPCIProxy. - */ -#define TYPE_VIRTIO_RNG_PCI "virtio-rng-pci" -#define VIRTIO_RNG_PCI(obj) \ - OBJECT_CHECK(VirtIORngPCI, (obj), TYPE_VIRTIO_RNG_PCI) - -struct VirtIORngPCI { - VirtIOPCIProxy parent_obj; - VirtIORNG vdev; -}; - /* * virtio-input-pci: This extends VirtioPCIProxy. */ diff --git a/hw/virtio/virtio-rng-pci.c b/hw/virtio/virtio-rng-pci.c new file mode 100644 index 0000000000..60688fbea9 --- /dev/null +++ b/hw/virtio/virtio-rng-pci.c @@ -0,0 +1,86 @@ +/* + * Virtio rng PCI Bindings + * + * Copyright 2012 Red Hat, Inc. + * Copyright 2012 Amit Shah + * + * This work is licensed under the terms of the GNU GPL, version 2 or + * (at your option) any later version. See the COPYING file in the + * top-level directory. + */ + +#include "qemu/osdep.h" + +#include "virtio-pci.h" +#include "hw/virtio/virtio-rng.h" +#include "qapi/error.h" + +typedef struct VirtIORngPCI VirtIORngPCI; + +/* + * virtio-rng-pci: This extends VirtioPCIProxy. + */ +#define TYPE_VIRTIO_RNG_PCI "virtio-rng-pci" +#define VIRTIO_RNG_PCI(obj) \ + OBJECT_CHECK(VirtIORngPCI, (obj), TYPE_VIRTIO_RNG_PCI) + +struct VirtIORngPCI { + VirtIOPCIProxy parent_obj; + VirtIORNG vdev; +}; + +static void virtio_rng_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp) +{ + VirtIORngPCI *vrng =3D VIRTIO_RNG_PCI(vpci_dev); + DeviceState *vdev =3D DEVICE(&vrng->vdev); + Error *err =3D NULL; + + qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus)); + object_property_set_bool(OBJECT(vdev), true, "realized", &err); + if (err) { + error_propagate(errp, err); + return; + } + + object_property_set_link(OBJECT(vrng), + OBJECT(vrng->vdev.conf.rng), "rng", + NULL); +} + +static void virtio_rng_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); + + k->realize =3D virtio_rng_pci_realize; + set_bit(DEVICE_CATEGORY_MISC, dc->categories); + + pcidev_k->vendor_id =3D PCI_VENDOR_ID_REDHAT_QUMRANET; + pcidev_k->device_id =3D PCI_DEVICE_ID_VIRTIO_RNG; + pcidev_k->revision =3D VIRTIO_PCI_ABI_VERSION; + pcidev_k->class_id =3D PCI_CLASS_OTHERS; +} + +static void virtio_rng_initfn(Object *obj) +{ + VirtIORngPCI *dev =3D VIRTIO_RNG_PCI(obj); + + virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), + TYPE_VIRTIO_RNG); +} + +static const TypeInfo virtio_rng_pci_info =3D { + .name =3D TYPE_VIRTIO_RNG_PCI, + .parent =3D TYPE_VIRTIO_PCI, + .instance_size =3D sizeof(VirtIORngPCI), + .instance_init =3D virtio_rng_initfn, + .class_init =3D virtio_rng_pci_class_init, +}; + +static void virtio_rng_pci_register(void) +{ + type_register_static(&virtio_rng_pci_info); +} + +type_init(virtio_rng_pci_register) diff --git a/tests/Makefile.include b/tests/Makefile.include index fb0b449c02..e8235890ec 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -149,6 +149,7 @@ check-qtest-virtio-y +=3D tests/virtio-net-test$(EXESUF) check-qtest-virtio-y +=3D tests/virtio-balloon-test$(EXESUF) check-qtest-virtio-y +=3D tests/virtio-blk-test$(EXESUF) check-qtest-virtio-y +=3D tests/virtio-rng-test$(EXESUF) +check-qtest-virtio-$(CONFIG_VIRTIO_RNG) +=3D tests/virtio-rng-test$(EXESUF) check-qtest-virtio-y +=3D tests/virtio-scsi-test$(EXESUF) ifeq ($(CONFIG_VIRTIO)$(CONFIG_VIRTFS)$(CONFIG_PCI),yyy) check-qtest-virtio-y +=3D tests/virtio-9p-test$(EXESUF) --=20 2.19.1 From nobody Mon Feb 9 15:10:39 2026 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543263015074986.9798853938926; Mon, 26 Nov 2018 12:10:15 -0800 (PST) Received: from localhost ([::1]:38567 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRNCm-00060a-BG for importer@patchew.org; Mon, 26 Nov 2018 15:10:04 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52455) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRN4w-0006k0-0y for qemu-devel@nongnu.org; Mon, 26 Nov 2018 15:01:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRN4r-00085Q-B5 for qemu-devel@nongnu.org; Mon, 26 Nov 2018 15:01:57 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48652) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRN4r-000857-21 for qemu-devel@nongnu.org; Mon, 26 Nov 2018 15:01:53 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4B41689AD3 for ; Mon, 26 Nov 2018 20:01:52 +0000 (UTC) Received: from localhost.localdomain (unknown [10.36.118.114]) by smtp.corp.redhat.com (Postfix) with ESMTP id DE28C19C65; Mon, 26 Nov 2018 20:01:50 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Mon, 26 Nov 2018 20:59:58 +0100 Message-Id: <20181126200009.862-6-quintela@redhat.com> In-Reply-To: <20181126200009.862-1-quintela@redhat.com> References: <20181126200009.862-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 26 Nov 2018 20:01:52 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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 v2 05/16] virtio: split virtio balloon 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: lvivier@redhat.com, dgilbert@redhat.com, peterx@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Thomas Huth Signed-off-by: Juan Quintela Reviewed-by: Laurent Vivier --- hw/virtio/Makefile.objs | 1 + hw/virtio/virtio-balloon-pci.c | 94 ++++++++++++++++++++++++++++++++++ hw/virtio/virtio-pci.c | 58 --------------------- hw/virtio/virtio-pci.h | 14 ----- tests/Makefile.include | 2 +- 5 files changed, 96 insertions(+), 73 deletions(-) create mode 100644 hw/virtio/virtio-balloon-pci.c diff --git a/hw/virtio/Makefile.objs b/hw/virtio/Makefile.objs index 2efa544a2d..0f0b846a45 100644 --- a/hw/virtio/Makefile.objs +++ b/hw/virtio/Makefile.objs @@ -14,6 +14,7 @@ obj-$(CONFIG_VHOST_VSOCK) +=3D vhost-vsock.o vhost-vsock-= pci.o obj-$(CONFIG_VIRTIO_INPUT_HOST) +=3D virtio-input-host-pci.o obj-$(CONFIG_VIRTIO_INPUT) +=3D virtio-input-pci.o obj-$(CONFIG_VIRTIO_RNG) +=3D virtio-rng-pci.o +obj-$(CONFIG_VIRTIO_BALLOON) +=3D virtio-balloon-pci.o endif =20 common-obj-$(call lnot,$(call land,$(CONFIG_VIRTIO),$(CONFIG_LINUX))) +=3D= vhost-stub.o diff --git a/hw/virtio/virtio-balloon-pci.c b/hw/virtio/virtio-balloon-pci.c new file mode 100644 index 0000000000..2e9d92990b --- /dev/null +++ b/hw/virtio/virtio-balloon-pci.c @@ -0,0 +1,94 @@ +/* + * Virtio balloon PCI Bindings + * + * Copyright IBM, Corp. 2007 + * Copyright (c) 2009 CodeSourcery + * + * Authors: + * Anthony Liguori + * Paul Brook + * + * Contributions after 2012-01-13 are licensed under the terms of the + * GNU GPL, version 2 or (at your option) any later version. + */ + +#include "qemu/osdep.h" + +#include "virtio-pci.h" +#include "hw/virtio/virtio-balloon.h" +#include "qapi/error.h" + +typedef struct VirtIOBalloonPCI VirtIOBalloonPCI; + +/* + * virtio-balloon-pci: This extends VirtioPCIProxy. + */ +#define TYPE_VIRTIO_BALLOON_PCI "virtio-balloon-pci" +#define VIRTIO_BALLOON_PCI(obj) \ + OBJECT_CHECK(VirtIOBalloonPCI, (obj), TYPE_VIRTIO_BALLOON_PCI) + +struct VirtIOBalloonPCI { + VirtIOPCIProxy parent_obj; + VirtIOBalloon vdev; +}; + +static Property virtio_balloon_pci_properties[] =3D { + DEFINE_PROP_UINT32("class", VirtIOPCIProxy, class_code, 0), + DEFINE_PROP_END_OF_LIST(), +}; + +static void virtio_balloon_pci_realize(VirtIOPCIProxy *vpci_dev, Error **e= rrp) +{ + VirtIOBalloonPCI *dev =3D VIRTIO_BALLOON_PCI(vpci_dev); + DeviceState *vdev =3D DEVICE(&dev->vdev); + + if (vpci_dev->class_code !=3D PCI_CLASS_OTHERS && + vpci_dev->class_code !=3D PCI_CLASS_MEMORY_RAM) { /* qemu < 1.1 */ + vpci_dev->class_code =3D PCI_CLASS_OTHERS; + } + + qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus)); + object_property_set_bool(OBJECT(vdev), true, "realized", errp); +} + +static void virtio_balloon_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); + k->realize =3D virtio_balloon_pci_realize; + set_bit(DEVICE_CATEGORY_MISC, dc->categories); + dc->props =3D virtio_balloon_pci_properties; + pcidev_k->vendor_id =3D PCI_VENDOR_ID_REDHAT_QUMRANET; + pcidev_k->device_id =3D PCI_DEVICE_ID_VIRTIO_BALLOON; + pcidev_k->revision =3D VIRTIO_PCI_ABI_VERSION; + pcidev_k->class_id =3D PCI_CLASS_OTHERS; +} + +static void virtio_balloon_pci_instance_init(Object *obj) +{ + VirtIOBalloonPCI *dev =3D VIRTIO_BALLOON_PCI(obj); + + virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), + TYPE_VIRTIO_BALLOON); + object_property_add_alias(obj, "guest-stats", OBJECT(&dev->vdev), + "guest-stats", &error_abort); + object_property_add_alias(obj, "guest-stats-polling-interval", + OBJECT(&dev->vdev), + "guest-stats-polling-interval", &error_abort= ); +} + +static const TypeInfo virtio_balloon_pci_info =3D { + .name =3D TYPE_VIRTIO_BALLOON_PCI, + .parent =3D TYPE_VIRTIO_PCI, + .instance_size =3D sizeof(VirtIOBalloonPCI), + .instance_init =3D virtio_balloon_pci_instance_init, + .class_init =3D virtio_balloon_pci_class_init, +}; + +static void virtio_balloon_pci_register(void) +{ + type_register_static(&virtio_balloon_pci_info); +} + +type_init(virtio_balloon_pci_register) diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index 433ece611d..855a7fdd40 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -23,7 +23,6 @@ #include "hw/virtio/virtio-net.h" #include "hw/virtio/virtio-serial.h" #include "hw/virtio/virtio-scsi.h" -#include "hw/virtio/virtio-balloon.h" #include "hw/pci/pci.h" #include "qapi/error.h" #include "qemu/error-report.h" @@ -2237,62 +2236,6 @@ static const TypeInfo vhost_user_scsi_pci_info =3D { }; #endif =20 -/* virtio-balloon-pci */ - -static Property virtio_balloon_pci_properties[] =3D { - DEFINE_PROP_UINT32("class", VirtIOPCIProxy, class_code, 0), - DEFINE_PROP_END_OF_LIST(), -}; - -static void virtio_balloon_pci_realize(VirtIOPCIProxy *vpci_dev, Error **e= rrp) -{ - VirtIOBalloonPCI *dev =3D VIRTIO_BALLOON_PCI(vpci_dev); - DeviceState *vdev =3D DEVICE(&dev->vdev); - - if (vpci_dev->class_code !=3D PCI_CLASS_OTHERS && - vpci_dev->class_code !=3D PCI_CLASS_MEMORY_RAM) { /* qemu < 1.1 */ - vpci_dev->class_code =3D PCI_CLASS_OTHERS; - } - - qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus)); - object_property_set_bool(OBJECT(vdev), true, "realized", errp); -} - -static void virtio_balloon_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); - k->realize =3D virtio_balloon_pci_realize; - set_bit(DEVICE_CATEGORY_MISC, dc->categories); - dc->props =3D virtio_balloon_pci_properties; - pcidev_k->vendor_id =3D PCI_VENDOR_ID_REDHAT_QUMRANET; - pcidev_k->device_id =3D PCI_DEVICE_ID_VIRTIO_BALLOON; - pcidev_k->revision =3D VIRTIO_PCI_ABI_VERSION; - pcidev_k->class_id =3D PCI_CLASS_OTHERS; -} - -static void virtio_balloon_pci_instance_init(Object *obj) -{ - VirtIOBalloonPCI *dev =3D VIRTIO_BALLOON_PCI(obj); - - virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), - TYPE_VIRTIO_BALLOON); - object_property_add_alias(obj, "guest-stats", OBJECT(&dev->vdev), - "guest-stats", &error_abort); - object_property_add_alias(obj, "guest-stats-polling-interval", - OBJECT(&dev->vdev), - "guest-stats-polling-interval", &error_abort= ); -} - -static const TypeInfo virtio_balloon_pci_info =3D { - .name =3D TYPE_VIRTIO_BALLOON_PCI, - .parent =3D TYPE_VIRTIO_PCI, - .instance_size =3D sizeof(VirtIOBalloonPCI), - .instance_init =3D virtio_balloon_pci_instance_init, - .class_init =3D virtio_balloon_pci_class_init, -}; - /* virtio-serial-pci */ =20 static void virtio_serial_pci_realize(VirtIOPCIProxy *vpci_dev, Error **er= rp) @@ -2478,7 +2421,6 @@ static void virtio_pci_register_types(void) type_register_static(&vhost_user_blk_pci_info); #endif type_register_static(&virtio_scsi_pci_info); - type_register_static(&virtio_balloon_pci_info); type_register_static(&virtio_serial_pci_info); type_register_static(&virtio_net_pci_info); #ifdef CONFIG_VHOST_SCSI diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h index 2415eb6a4d..093fde7f4f 100644 --- a/hw/virtio/virtio-pci.h +++ b/hw/virtio/virtio-pci.h @@ -20,7 +20,6 @@ #include "hw/virtio/virtio-net.h" #include "hw/virtio/virtio-serial.h" #include "hw/virtio/virtio-scsi.h" -#include "hw/virtio/virtio-balloon.h" #include "hw/virtio/virtio-bus.h" #include "hw/virtio/virtio-gpu.h" #include "hw/virtio/virtio-crypto.h" @@ -39,7 +38,6 @@ typedef struct VirtIOPCIProxy VirtIOPCIProxy; typedef struct VirtIOBlkPCI VirtIOBlkPCI; typedef struct VirtIOSCSIPCI VirtIOSCSIPCI; -typedef struct VirtIOBalloonPCI VirtIOBalloonPCI; typedef struct VirtIOSerialPCI VirtIOSerialPCI; typedef struct VirtIONetPCI VirtIONetPCI; typedef struct VHostSCSIPCI VHostSCSIPCI; @@ -264,18 +262,6 @@ struct VirtIOBlkPCI { VirtIOBlock vdev; }; =20 -/* - * virtio-balloon-pci: This extends VirtioPCIProxy. - */ -#define TYPE_VIRTIO_BALLOON_PCI "virtio-balloon-pci" -#define VIRTIO_BALLOON_PCI(obj) \ - OBJECT_CHECK(VirtIOBalloonPCI, (obj), TYPE_VIRTIO_BALLOON_PCI) - -struct VirtIOBalloonPCI { - VirtIOPCIProxy parent_obj; - VirtIOBalloon vdev; -}; - /* * virtio-serial-pci: This extends VirtioPCIProxy. */ diff --git a/tests/Makefile.include b/tests/Makefile.include index e8235890ec..89800e76ca 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -146,7 +146,7 @@ check-qtest-ipack-y +=3D tests/ipoctal232-test$(EXESUF) check-qtest-virtioserial-y +=3D tests/virtio-console-test$(EXESUF) =20 check-qtest-virtio-y +=3D tests/virtio-net-test$(EXESUF) -check-qtest-virtio-y +=3D tests/virtio-balloon-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-y +=3D tests/virtio-rng-test$(EXESUF) check-qtest-virtio-$(CONFIG_VIRTIO_RNG) +=3D tests/virtio-rng-test$(EXESUF) --=20 2.19.1 From nobody Mon Feb 9 15:10:39 2026 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543263018039320.40715133437595; Mon, 26 Nov 2018 12:10:18 -0800 (PST) Received: from localhost ([::1]:38566 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRNCi-0005xW-Q6 for importer@patchew.org; Mon, 26 Nov 2018 15:10:00 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52456) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRN4w-0006k2-1M for qemu-devel@nongnu.org; Mon, 26 Nov 2018 15:01:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRN4t-00085l-1b for qemu-devel@nongnu.org; Mon, 26 Nov 2018 15:01:57 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35362) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRN4s-00085a-PM for qemu-devel@nongnu.org; Mon, 26 Nov 2018 15:01:54 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 094E1C04AC51 for ; Mon, 26 Nov 2018 20:01:54 +0000 (UTC) Received: from localhost.localdomain (unknown [10.36.118.114]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9E8E819936; Mon, 26 Nov 2018 20:01:52 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Mon, 26 Nov 2018 20:59:59 +0100 Message-Id: <20181126200009.862-7-quintela@redhat.com> In-Reply-To: <20181126200009.862-1-quintela@redhat.com> References: <20181126200009.862-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 26 Nov 2018 20:01:54 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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 v2 06/16] virtio: split virtio 9p 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: lvivier@redhat.com, dgilbert@redhat.com, peterx@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Laurent Vivier --- hw/virtio/Makefile.objs | 1 + hw/virtio/virtio-9p-pci.c | 86 +++++++++++++++++++++++++++++++++++++++ hw/virtio/virtio-pci.c | 52 ----------------------- hw/virtio/virtio-pci.h | 20 --------- 4 files changed, 87 insertions(+), 72 deletions(-) create mode 100644 hw/virtio/virtio-9p-pci.c diff --git a/hw/virtio/Makefile.objs b/hw/virtio/Makefile.objs index 0f0b846a45..bc802db4e8 100644 --- a/hw/virtio/Makefile.objs +++ b/hw/virtio/Makefile.objs @@ -15,6 +15,7 @@ obj-$(CONFIG_VIRTIO_INPUT_HOST) +=3D virtio-input-host-pc= i.o obj-$(CONFIG_VIRTIO_INPUT) +=3D virtio-input-pci.o 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 endif =20 common-obj-$(call lnot,$(call land,$(CONFIG_VIRTIO),$(CONFIG_LINUX))) +=3D= vhost-stub.o diff --git a/hw/virtio/virtio-9p-pci.c b/hw/virtio/virtio-9p-pci.c new file mode 100644 index 0000000000..74c6ca2ddb --- /dev/null +++ b/hw/virtio/virtio-9p-pci.c @@ -0,0 +1,86 @@ +/* + * Virtio 9p PCI Bindings + * + * Copyright IBM, Corp. 2010 + * + * Authors: + * Anthony Liguori + * + * This work is licensed under the terms of the GNU GPL, version 2. See + * the COPYING file in the top-level directory. + * + * Contributions after 2012-01-13 are licensed under the terms of the + * GNU GPL, version 2 or (at your option) any later version. + */ + +#include "qemu/osdep.h" + +#include "virtio-pci.h" +#include "hw/9pfs/virtio-9p.h" + +/* + * virtio-9p-pci: This extends VirtioPCIProxy. + */ + +#define TYPE_VIRTIO_9P_PCI "virtio-9p-pci" +#define VIRTIO_9P_PCI(obj) \ + OBJECT_CHECK(V9fsPCIState, (obj), TYPE_VIRTIO_9P_PCI) + +typedef struct V9fsPCIState { + VirtIOPCIProxy parent_obj; + V9fsVirtioState vdev; +} V9fsPCIState; + +static void virtio_9p_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp) +{ + V9fsPCIState *dev =3D VIRTIO_9P_PCI(vpci_dev); + DeviceState *vdev =3D DEVICE(&dev->vdev); + + qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus)); + object_property_set_bool(OBJECT(vdev), true, "realized", errp); +} + +static Property virtio_9p_pci_properties[] =3D { + DEFINE_PROP_BIT("ioeventfd", VirtIOPCIProxy, flags, + VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT, true), + DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 2), + DEFINE_PROP_END_OF_LIST(), +}; + +static void virtio_9p_pci_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + PCIDeviceClass *pcidev_k =3D PCI_DEVICE_CLASS(klass); + VirtioPCIClass *k =3D VIRTIO_PCI_CLASS(klass); + + k->realize =3D virtio_9p_pci_realize; + pcidev_k->vendor_id =3D PCI_VENDOR_ID_REDHAT_QUMRANET; + pcidev_k->device_id =3D PCI_DEVICE_ID_VIRTIO_9P; + pcidev_k->revision =3D VIRTIO_PCI_ABI_VERSION; + pcidev_k->class_id =3D 0x2; + set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); + dc->props =3D virtio_9p_pci_properties; +} + +static void virtio_9p_pci_instance_init(Object *obj) +{ + V9fsPCIState *dev =3D VIRTIO_9P_PCI(obj); + + virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), + TYPE_VIRTIO_9P); +} + +static const TypeInfo virtio_9p_pci_info =3D { + .name =3D TYPE_VIRTIO_9P_PCI, + .parent =3D TYPE_VIRTIO_PCI, + .instance_size =3D sizeof(V9fsPCIState), + .instance_init =3D virtio_9p_pci_instance_init, + .class_init =3D virtio_9p_pci_class_init, +}; + +static void virtio_9p_pci_register(void) +{ + type_register_static(&virtio_9p_pci_info); +} + +type_init(virtio_9p_pci_register) diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index 855a7fdd40..bad9279f19 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -1077,55 +1077,6 @@ static void virtio_pci_vmstate_change(DeviceState *d= , bool running) } } =20 -#ifdef CONFIG_VIRTFS -static void virtio_9p_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp) -{ - V9fsPCIState *dev =3D VIRTIO_9P_PCI(vpci_dev); - DeviceState *vdev =3D DEVICE(&dev->vdev); - - qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus)); - object_property_set_bool(OBJECT(vdev), true, "realized", errp); -} - -static Property virtio_9p_pci_properties[] =3D { - DEFINE_PROP_BIT("ioeventfd", VirtIOPCIProxy, flags, - VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT, true), - DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 2), - DEFINE_PROP_END_OF_LIST(), -}; - -static void virtio_9p_pci_class_init(ObjectClass *klass, void *data) -{ - DeviceClass *dc =3D DEVICE_CLASS(klass); - PCIDeviceClass *pcidev_k =3D PCI_DEVICE_CLASS(klass); - VirtioPCIClass *k =3D VIRTIO_PCI_CLASS(klass); - - k->realize =3D virtio_9p_pci_realize; - pcidev_k->vendor_id =3D PCI_VENDOR_ID_REDHAT_QUMRANET; - pcidev_k->device_id =3D PCI_DEVICE_ID_VIRTIO_9P; - pcidev_k->revision =3D VIRTIO_PCI_ABI_VERSION; - pcidev_k->class_id =3D 0x2; - set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); - dc->props =3D virtio_9p_pci_properties; -} - -static void virtio_9p_pci_instance_init(Object *obj) -{ - V9fsPCIState *dev =3D VIRTIO_9P_PCI(obj); - - virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), - TYPE_VIRTIO_9P); -} - -static const TypeInfo virtio_9p_pci_info =3D { - .name =3D TYPE_VIRTIO_9P_PCI, - .parent =3D TYPE_VIRTIO_PCI, - .instance_size =3D sizeof(V9fsPCIState), - .instance_init =3D virtio_9p_pci_instance_init, - .class_init =3D virtio_9p_pci_class_init, -}; -#endif /* CONFIG_VIRTFS */ - /* * virtio-pci: This is the PCIDevice which has a virtio-pci-bus. */ @@ -2413,9 +2364,6 @@ static void virtio_pci_register_types(void) { type_register_static(&virtio_pci_bus_info); type_register_static(&virtio_pci_info); -#ifdef CONFIG_VIRTFS - type_register_static(&virtio_9p_pci_info); -#endif type_register_static(&virtio_blk_pci_info); #if defined(CONFIG_VHOST_USER) && defined(CONFIG_LINUX) type_register_static(&vhost_user_blk_pci_info); diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h index 093fde7f4f..200950de0a 100644 --- a/hw/virtio/virtio-pci.h +++ b/hw/virtio/virtio-pci.h @@ -28,9 +28,6 @@ #include "hw/virtio/vhost-user-blk.h" #endif =20 -#ifdef CONFIG_VIRTFS -#include "hw/9pfs/virtio-9p.h" -#endif #ifdef CONFIG_VHOST_SCSI #include "hw/virtio/vhost-scsi.h" #endif @@ -286,23 +283,6 @@ struct VirtIONetPCI { VirtIONet vdev; }; =20 -/* - * virtio-9p-pci: This extends VirtioPCIProxy. - */ - -#ifdef CONFIG_VIRTFS - -#define TYPE_VIRTIO_9P_PCI "virtio-9p-pci" -#define VIRTIO_9P_PCI(obj) \ - OBJECT_CHECK(V9fsPCIState, (obj), TYPE_VIRTIO_9P_PCI) - -typedef struct V9fsPCIState { - VirtIOPCIProxy parent_obj; - V9fsVirtioState vdev; -} V9fsPCIState; - -#endif - /* * virtio-input-pci: This extends VirtioPCIProxy. */ --=20 2.19.1 From nobody Mon Feb 9 15:10:39 2026 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543262824381559.7720072504187; Mon, 26 Nov 2018 12:07:04 -0800 (PST) Received: from localhost ([::1]:38552 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRN9q-0002nT-Gn for importer@patchew.org; Mon, 26 Nov 2018 15:07:02 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52472) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRN50-0006na-5z for qemu-devel@nongnu.org; Mon, 26 Nov 2018 15:02:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRN4y-00086H-UC for qemu-devel@nongnu.org; Mon, 26 Nov 2018 15:02:02 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41316) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRN4y-00086B-NI for qemu-devel@nongnu.org; Mon, 26 Nov 2018 15:02:00 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0C71E30026D1 for ; Mon, 26 Nov 2018 20:02:00 +0000 (UTC) Received: from localhost.localdomain (unknown [10.36.118.114]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5DCC319936; Mon, 26 Nov 2018 20:01:54 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Mon, 26 Nov 2018 21:00:00 +0100 Message-Id: <20181126200009.862-8-quintela@redhat.com> In-Reply-To: <20181126200009.862-1-quintela@redhat.com> References: <20181126200009.862-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Mon, 26 Nov 2018 20:02:00 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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 v2 07/16] virtio: split vhost user 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: lvivier@redhat.com, dgilbert@redhat.com, peterx@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Reviewed-by: Thomas Huth Signed-off-by: Juan Quintela Reviewed-by: Laurent Vivier --- hw/virtio/Makefile.objs | 1 + hw/virtio/vhost-user-blk-pci.c | 101 +++++++++++++++++++++++++++++++++ hw/virtio/virtio-pci.c | 60 -------------------- hw/virtio/virtio-pci.h | 18 ------ 4 files changed, 102 insertions(+), 78 deletions(-) create mode 100644 hw/virtio/vhost-user-blk-pci.c diff --git a/hw/virtio/Makefile.objs b/hw/virtio/Makefile.objs index bc802db4e8..2c95c55bd0 100644 --- a/hw/virtio/Makefile.objs +++ b/hw/virtio/Makefile.objs @@ -11,6 +11,7 @@ obj-$(call land,$(CONFIG_VIRTIO_CRYPTO),$(CONFIG_VIRTIO_P= CI)) +=3D virtio-crypto-p =20 obj-$(CONFIG_LINUX) +=3D vhost.o vhost-backend.o vhost-user.o obj-$(CONFIG_VHOST_VSOCK) +=3D vhost-vsock.o vhost-vsock-pci.o +obj-$(CONFIG_VHOST_USER_BLK) +=3D vhost-user-blk-pci.o obj-$(CONFIG_VIRTIO_INPUT_HOST) +=3D virtio-input-host-pci.o obj-$(CONFIG_VIRTIO_INPUT) +=3D virtio-input-pci.o obj-$(CONFIG_VIRTIO_RNG) +=3D virtio-rng-pci.o diff --git a/hw/virtio/vhost-user-blk-pci.c b/hw/virtio/vhost-user-blk-pci.c new file mode 100644 index 0000000000..29ffcc4361 --- /dev/null +++ b/hw/virtio/vhost-user-blk-pci.c @@ -0,0 +1,101 @@ +/* + * Vhost user blk PCI Bindings + * + * Copyright(C) 2017 Intel Corporation. + * + * Authors: + * Changpeng Liu + * + * Largely based on the "vhost-user-scsi.c" and "vhost-scsi.c" implemented= by: + * Felipe Franciosi + * Stefan Hajnoczi + * Nicholas Bellinger + * + * This work is licensed under the terms of the GNU LGPL, version 2 or lat= er. + * See the COPYING.LIB file in the top-level directory. + * + */ + +#include "qemu/osdep.h" + +#include "standard-headers/linux/virtio_pci.h" +#include "hw/virtio/virtio.h" +#include "hw/virtio/vhost-user-blk.h" +#include "hw/pci/pci.h" +#include "qapi/error.h" +#include "qemu/error-report.h" +#include "virtio-pci.h" + +typedef struct VHostUserBlkPCI VHostUserBlkPCI; + +/* + * vhost-user-blk-pci: This extends VirtioPCIProxy. + */ +#define TYPE_VHOST_USER_BLK_PCI "vhost-user-blk-pci" +#define VHOST_USER_BLK_PCI(obj) \ + OBJECT_CHECK(VHostUserBlkPCI, (obj), TYPE_VHOST_USER_BLK_PCI) + +struct VHostUserBlkPCI { + VirtIOPCIProxy parent_obj; + VHostUserBlk vdev; +}; + +static Property vhost_user_blk_pci_properties[] =3D { + DEFINE_PROP_UINT32("class", VirtIOPCIProxy, class_code, 0), + DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, + DEV_NVECTORS_UNSPECIFIED), + DEFINE_PROP_END_OF_LIST(), +}; + +static void vhost_user_blk_pci_realize(VirtIOPCIProxy *vpci_dev, Error **e= rrp) +{ + VHostUserBlkPCI *dev =3D VHOST_USER_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.num_queues + 1; + } + + qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus)); + object_property_set_bool(OBJECT(vdev), true, "realized", errp); +} + +static void vhost_user_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 vhost_user_blk_pci_properties; + k->realize =3D vhost_user_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 vhost_user_blk_pci_instance_init(Object *obj) +{ + VHostUserBlkPCI *dev =3D VHOST_USER_BLK_PCI(obj); + + virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), + TYPE_VHOST_USER_BLK); + object_property_add_alias(obj, "bootindex", OBJECT(&dev->vdev), + "bootindex", &error_abort); +} + +static const TypeInfo vhost_user_blk_pci_info =3D { + .name =3D TYPE_VHOST_USER_BLK_PCI, + .parent =3D TYPE_VIRTIO_PCI, + .instance_size =3D sizeof(VHostUserBlkPCI), + .instance_init =3D vhost_user_blk_pci_instance_init, + .class_init =3D vhost_user_blk_pci_class_init, +}; + +static void vhost_user_blk_pci_register(void) +{ + type_register_static(&vhost_user_blk_pci_info); +} + +type_init(vhost_user_blk_pci_register) diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index bad9279f19..e9c562b1c0 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -1952,63 +1952,6 @@ static const TypeInfo virtio_blk_pci_info =3D { .class_init =3D virtio_blk_pci_class_init, }; =20 -#if defined(CONFIG_VHOST_USER) && defined(CONFIG_LINUX) -/* vhost-user-blk */ - -static Property vhost_user_blk_pci_properties[] =3D { - DEFINE_PROP_UINT32("class", VirtIOPCIProxy, class_code, 0), - DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, - DEV_NVECTORS_UNSPECIFIED), - DEFINE_PROP_END_OF_LIST(), -}; - -static void vhost_user_blk_pci_realize(VirtIOPCIProxy *vpci_dev, Error **e= rrp) -{ - VHostUserBlkPCI *dev =3D VHOST_USER_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.num_queues + 1; - } - - qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus)); - object_property_set_bool(OBJECT(vdev), true, "realized", errp); -} - -static void vhost_user_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 vhost_user_blk_pci_properties; - k->realize =3D vhost_user_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 vhost_user_blk_pci_instance_init(Object *obj) -{ - VHostUserBlkPCI *dev =3D VHOST_USER_BLK_PCI(obj); - - virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), - TYPE_VHOST_USER_BLK); - object_property_add_alias(obj, "bootindex", OBJECT(&dev->vdev), - "bootindex", &error_abort); -} - -static const TypeInfo vhost_user_blk_pci_info =3D { - .name =3D TYPE_VHOST_USER_BLK_PCI, - .parent =3D TYPE_VIRTIO_PCI, - .instance_size =3D sizeof(VHostUserBlkPCI), - .instance_init =3D vhost_user_blk_pci_instance_init, - .class_init =3D vhost_user_blk_pci_class_init, -}; -#endif - /* virtio-scsi-pci */ =20 static Property virtio_scsi_pci_properties[] =3D { @@ -2365,9 +2308,6 @@ static void virtio_pci_register_types(void) type_register_static(&virtio_pci_bus_info); type_register_static(&virtio_pci_info); type_register_static(&virtio_blk_pci_info); -#if defined(CONFIG_VHOST_USER) && defined(CONFIG_LINUX) - type_register_static(&vhost_user_blk_pci_info); -#endif type_register_static(&virtio_scsi_pci_info); type_register_static(&virtio_serial_pci_info); type_register_static(&virtio_net_pci_info); diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h index 200950de0a..5e37982f88 100644 --- a/hw/virtio/virtio-pci.h +++ b/hw/virtio/virtio-pci.h @@ -24,9 +24,6 @@ #include "hw/virtio/virtio-gpu.h" #include "hw/virtio/virtio-crypto.h" #include "hw/virtio/vhost-user-scsi.h" -#if defined(CONFIG_VHOST_USER) && defined(CONFIG_LINUX) -#include "hw/virtio/vhost-user-blk.h" -#endif =20 #ifdef CONFIG_VHOST_SCSI #include "hw/virtio/vhost-scsi.h" @@ -39,7 +36,6 @@ typedef struct VirtIOSerialPCI VirtIOSerialPCI; typedef struct VirtIONetPCI VirtIONetPCI; typedef struct VHostSCSIPCI VHostSCSIPCI; typedef struct VHostUserSCSIPCI VHostUserSCSIPCI; -typedef struct VHostUserBlkPCI VHostUserBlkPCI; typedef struct VirtIOGPUPCI VirtIOGPUPCI; typedef struct VirtIOCryptoPCI VirtIOCryptoPCI; =20 @@ -233,20 +229,6 @@ struct VHostUserSCSIPCI { VHostUserSCSI vdev; }; =20 -#if defined(CONFIG_VHOST_USER) && defined(CONFIG_LINUX) -/* - * vhost-user-blk-pci: This extends VirtioPCIProxy. - */ -#define TYPE_VHOST_USER_BLK_PCI "vhost-user-blk-pci" -#define VHOST_USER_BLK_PCI(obj) \ - OBJECT_CHECK(VHostUserBlkPCI, (obj), TYPE_VHOST_USER_BLK_PCI) - -struct VHostUserBlkPCI { - VirtIOPCIProxy parent_obj; - VHostUserBlk vdev; -}; -#endif - /* * virtio-blk-pci: This extends VirtioPCIProxy. */ --=20 2.19.1 From nobody Mon Feb 9 15:10:39 2026 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543263187176579.8109478883816; Mon, 26 Nov 2018 12:13:07 -0800 (PST) Received: from localhost ([::1]:38585 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRNFi-0008N6-0o for importer@patchew.org; Mon, 26 Nov 2018 15:13:06 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52556) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRN5O-00071y-Df for qemu-devel@nongnu.org; Mon, 26 Nov 2018 15:02:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRN5J-00089k-U5 for qemu-devel@nongnu.org; Mon, 26 Nov 2018 15:02:26 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55434) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRN5J-00089K-Dw for qemu-devel@nongnu.org; Mon, 26 Nov 2018 15:02:21 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B6E1CA705 for ; Mon, 26 Nov 2018 20:02:20 +0000 (UTC) Received: from localhost.localdomain (unknown [10.36.118.114]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5E8E319936; Mon, 26 Nov 2018 20:02:00 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Mon, 26 Nov 2018 21:00:01 +0100 Message-Id: <20181126200009.862-9-quintela@redhat.com> In-Reply-To: <20181126200009.862-1-quintela@redhat.com> References: <20181126200009.862-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 26 Nov 2018 20:02:20 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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 v2 08/16] virtio: split vhost user scsi 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: lvivier@redhat.com, dgilbert@redhat.com, peterx@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Laurent Vivier --- hw/virtio/Makefile.objs | 1 + hw/virtio/vhost-user-scsi-pci.c | 101 ++++++++++++++++++++++++++++++++ hw/virtio/virtio-pci.c | 58 ------------------ hw/virtio/virtio-pci.h | 11 ---- 4 files changed, 102 insertions(+), 69 deletions(-) create mode 100644 hw/virtio/vhost-user-scsi-pci.c diff --git a/hw/virtio/Makefile.objs b/hw/virtio/Makefile.objs index 2c95c55bd0..a5d2e38d3a 100644 --- a/hw/virtio/Makefile.objs +++ b/hw/virtio/Makefile.objs @@ -12,6 +12,7 @@ obj-$(call land,$(CONFIG_VIRTIO_CRYPTO),$(CONFIG_VIRTIO_P= CI)) +=3D virtio-crypto-p obj-$(CONFIG_LINUX) +=3D vhost.o vhost-backend.o vhost-user.o obj-$(CONFIG_VHOST_VSOCK) +=3D vhost-vsock.o vhost-vsock-pci.o obj-$(CONFIG_VHOST_USER_BLK) +=3D vhost-user-blk-pci.o +obj-$(CONFIG_VHOST_USER_SCSI) +=3D vhost-user-scsi-pci.o obj-$(CONFIG_VIRTIO_INPUT_HOST) +=3D virtio-input-host-pci.o obj-$(CONFIG_VIRTIO_INPUT) +=3D virtio-input-pci.o obj-$(CONFIG_VIRTIO_RNG) +=3D virtio-rng-pci.o diff --git a/hw/virtio/vhost-user-scsi-pci.c b/hw/virtio/vhost-user-scsi-pc= i.c new file mode 100644 index 0000000000..5baec9c356 --- /dev/null +++ b/hw/virtio/vhost-user-scsi-pci.c @@ -0,0 +1,101 @@ +/* + * Vhost user scsi PCI Bindings + * + * Copyright (c) 2016 Nutanix Inc. All rights reserved. + * + * Author: + * Felipe Franciosi + * + * This work is largely based on the "vhost-scsi" implementation by: + * Stefan Hajnoczi + * Nicholas Bellinger + * + * This work is licensed under the terms of the GNU LGPL, version 2 or lat= er. + * See the COPYING.LIB file in the top-level directory. + * + */ + +#include "qemu/osdep.h" + +#include "standard-headers/linux/virtio_pci.h" +#include "hw/virtio/vhost-user-scsi.h" +#include "hw/virtio/virtio.h" +#include "hw/virtio/virtio-scsi.h" +#include "hw/pci/pci.h" +#include "qapi/error.h" +#include "qemu/error-report.h" +#include "hw/pci/msi.h" +#include "hw/pci/msix.h" +#include "hw/loader.h" +#include "sysemu/kvm.h" +#include "virtio-pci.h" + +typedef struct VHostUserSCSIPCI VHostUserSCSIPCI; + +#define TYPE_VHOST_USER_SCSI_PCI "vhost-user-scsi-pci" +#define VHOST_USER_SCSI_PCI(obj) \ + OBJECT_CHECK(VHostUserSCSIPCI, (obj), TYPE_VHOST_USER_SCSI_PCI) + +struct VHostUserSCSIPCI { + VirtIOPCIProxy parent_obj; + VHostUserSCSI vdev; +}; + +static Property vhost_user_scsi_pci_properties[] =3D { + DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, + DEV_NVECTORS_UNSPECIFIED), + DEFINE_PROP_END_OF_LIST(), +}; + +static void vhost_user_scsi_pci_realize(VirtIOPCIProxy *vpci_dev, Error **= errp) +{ + VHostUserSCSIPCI *dev =3D VHOST_USER_SCSI_PCI(vpci_dev); + DeviceState *vdev =3D DEVICE(&dev->vdev); + VirtIOSCSICommon *vs =3D VIRTIO_SCSI_COMMON(vdev); + + if (vpci_dev->nvectors =3D=3D DEV_NVECTORS_UNSPECIFIED) { + vpci_dev->nvectors =3D vs->conf.num_queues + 3; + } + + qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus)); + object_property_set_bool(OBJECT(vdev), true, "realized", errp); +} + +static void vhost_user_scsi_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); + k->realize =3D vhost_user_scsi_pci_realize; + set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); + dc->props =3D vhost_user_scsi_pci_properties; + pcidev_k->vendor_id =3D PCI_VENDOR_ID_REDHAT_QUMRANET; + pcidev_k->device_id =3D PCI_DEVICE_ID_VIRTIO_SCSI; + pcidev_k->revision =3D 0x00; + pcidev_k->class_id =3D PCI_CLASS_STORAGE_SCSI; +} + +static void vhost_user_scsi_pci_instance_init(Object *obj) +{ + VHostUserSCSIPCI *dev =3D VHOST_USER_SCSI_PCI(obj); + + virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), + TYPE_VHOST_USER_SCSI); + object_property_add_alias(obj, "bootindex", OBJECT(&dev->vdev), + "bootindex", &error_abort); +} + +static const TypeInfo vhost_user_scsi_pci_info =3D { + .name =3D TYPE_VHOST_USER_SCSI_PCI, + .parent =3D TYPE_VIRTIO_PCI, + .instance_size =3D sizeof(VHostUserSCSIPCI), + .instance_init =3D vhost_user_scsi_pci_instance_init, + .class_init =3D vhost_user_scsi_pci_class_init, +}; + +static void vhost_user_scsi_pci_register(void) +{ + type_register_static(&vhost_user_scsi_pci_info); +} + +type_init(vhost_user_scsi_pci_register) diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index e9c562b1c0..7c99d9385a 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -2075,61 +2075,6 @@ static const TypeInfo vhost_scsi_pci_info =3D { }; #endif =20 -#if defined(CONFIG_VHOST_USER) && defined(CONFIG_LINUX) -/* vhost-user-scsi-pci */ -static Property vhost_user_scsi_pci_properties[] =3D { - DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, - DEV_NVECTORS_UNSPECIFIED), - DEFINE_PROP_END_OF_LIST(), -}; - -static void vhost_user_scsi_pci_realize(VirtIOPCIProxy *vpci_dev, Error **= errp) -{ - VHostUserSCSIPCI *dev =3D VHOST_USER_SCSI_PCI(vpci_dev); - DeviceState *vdev =3D DEVICE(&dev->vdev); - VirtIOSCSICommon *vs =3D VIRTIO_SCSI_COMMON(vdev); - - if (vpci_dev->nvectors =3D=3D DEV_NVECTORS_UNSPECIFIED) { - vpci_dev->nvectors =3D vs->conf.num_queues + 3; - } - - qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus)); - object_property_set_bool(OBJECT(vdev), true, "realized", errp); -} - -static void vhost_user_scsi_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); - k->realize =3D vhost_user_scsi_pci_realize; - set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); - dc->props =3D vhost_user_scsi_pci_properties; - pcidev_k->vendor_id =3D PCI_VENDOR_ID_REDHAT_QUMRANET; - pcidev_k->device_id =3D PCI_DEVICE_ID_VIRTIO_SCSI; - pcidev_k->revision =3D 0x00; - pcidev_k->class_id =3D PCI_CLASS_STORAGE_SCSI; -} - -static void vhost_user_scsi_pci_instance_init(Object *obj) -{ - VHostUserSCSIPCI *dev =3D VHOST_USER_SCSI_PCI(obj); - - virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), - TYPE_VHOST_USER_SCSI); - object_property_add_alias(obj, "bootindex", OBJECT(&dev->vdev), - "bootindex", &error_abort); -} - -static const TypeInfo vhost_user_scsi_pci_info =3D { - .name =3D TYPE_VHOST_USER_SCSI_PCI, - .parent =3D TYPE_VIRTIO_PCI, - .instance_size =3D sizeof(VHostUserSCSIPCI), - .instance_init =3D vhost_user_scsi_pci_instance_init, - .class_init =3D vhost_user_scsi_pci_class_init, -}; -#endif - /* virtio-serial-pci */ =20 static void virtio_serial_pci_realize(VirtIOPCIProxy *vpci_dev, Error **er= rp) @@ -2314,9 +2259,6 @@ static void virtio_pci_register_types(void) #ifdef CONFIG_VHOST_SCSI type_register_static(&vhost_scsi_pci_info); #endif -#if defined(CONFIG_VHOST_USER) && defined(CONFIG_LINUX) - type_register_static(&vhost_user_scsi_pci_info); -#endif } =20 type_init(virtio_pci_register_types) diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h index 5e37982f88..7f06d7f331 100644 --- a/hw/virtio/virtio-pci.h +++ b/hw/virtio/virtio-pci.h @@ -23,7 +23,6 @@ #include "hw/virtio/virtio-bus.h" #include "hw/virtio/virtio-gpu.h" #include "hw/virtio/virtio-crypto.h" -#include "hw/virtio/vhost-user-scsi.h" =20 #ifdef CONFIG_VHOST_SCSI #include "hw/virtio/vhost-scsi.h" @@ -35,7 +34,6 @@ typedef struct VirtIOSCSIPCI VirtIOSCSIPCI; typedef struct VirtIOSerialPCI VirtIOSerialPCI; typedef struct VirtIONetPCI VirtIONetPCI; typedef struct VHostSCSIPCI VHostSCSIPCI; -typedef struct VHostUserSCSIPCI VHostUserSCSIPCI; typedef struct VirtIOGPUPCI VirtIOGPUPCI; typedef struct VirtIOCryptoPCI VirtIOCryptoPCI; =20 @@ -220,15 +218,6 @@ struct VHostSCSIPCI { }; #endif =20 -#define TYPE_VHOST_USER_SCSI_PCI "vhost-user-scsi-pci" -#define VHOST_USER_SCSI_PCI(obj) \ - OBJECT_CHECK(VHostUserSCSIPCI, (obj), TYPE_VHOST_USER_SCSI_PCI) - -struct VHostUserSCSIPCI { - VirtIOPCIProxy parent_obj; - VHostUserSCSI vdev; -}; - /* * virtio-blk-pci: This extends VirtioPCIProxy. */ --=20 2.19.1 From nobody Mon Feb 9 15:10:39 2026 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543262677102364.277635336138; Mon, 26 Nov 2018 12:04:37 -0800 (PST) Received: from localhost ([::1]:38536 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRN7T-0000rD-Qs for importer@patchew.org; Mon, 26 Nov 2018 15:04:35 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52559) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRN5O-00072P-WD for qemu-devel@nongnu.org; Mon, 26 Nov 2018 15:02:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRN5M-0008AM-U0 for qemu-devel@nongnu.org; Mon, 26 Nov 2018 15:02:26 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40052) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRN5M-0008AH-Mz for qemu-devel@nongnu.org; Mon, 26 Nov 2018 15:02:24 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0E013308124B for ; Mon, 26 Nov 2018 20:02:24 +0000 (UTC) Received: from localhost.localdomain (unknown [10.36.118.114]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1681419936; Mon, 26 Nov 2018 20:02:20 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Mon, 26 Nov 2018 21:00:02 +0100 Message-Id: <20181126200009.862-10-quintela@redhat.com> In-Reply-To: <20181126200009.862-1-quintela@redhat.com> References: <20181126200009.862-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Mon, 26 Nov 2018 20:02:24 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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 v2 09/16] virtio: split vhost scsi 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: lvivier@redhat.com, dgilbert@redhat.com, peterx@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Laurent Vivier --- hw/virtio/Makefile.objs | 1 + hw/virtio/vhost-scsi-pci.c | 95 ++++++++++++++++++++++++++++++++++++++ hw/virtio/virtio-pci.c | 59 ----------------------- hw/virtio/virtio-pci.h | 19 -------- 4 files changed, 96 insertions(+), 78 deletions(-) create mode 100644 hw/virtio/vhost-scsi-pci.c diff --git a/hw/virtio/Makefile.objs b/hw/virtio/Makefile.objs index a5d2e38d3a..6e6e001449 100644 --- a/hw/virtio/Makefile.objs +++ b/hw/virtio/Makefile.objs @@ -13,6 +13,7 @@ obj-$(CONFIG_LINUX) +=3D vhost.o vhost-backend.o vhost-us= er.o obj-$(CONFIG_VHOST_VSOCK) +=3D vhost-vsock.o vhost-vsock-pci.o obj-$(CONFIG_VHOST_USER_BLK) +=3D vhost-user-blk-pci.o obj-$(CONFIG_VHOST_USER_SCSI) +=3D vhost-user-scsi-pci.o +obj-$(CONFIG_VHOST_SCSI) +=3D vhost-scsi-pci.o obj-$(CONFIG_VIRTIO_INPUT_HOST) +=3D virtio-input-host-pci.o obj-$(CONFIG_VIRTIO_INPUT) +=3D virtio-input-pci.o obj-$(CONFIG_VIRTIO_RNG) +=3D virtio-rng-pci.o diff --git a/hw/virtio/vhost-scsi-pci.c b/hw/virtio/vhost-scsi-pci.c new file mode 100644 index 0000000000..2be2c567ea --- /dev/null +++ b/hw/virtio/vhost-scsi-pci.c @@ -0,0 +1,95 @@ +/* + * Vhost scsi PCI bindings + * + * Copyright IBM, Corp. 2011 + * + * Authors: + * Stefan Hajnoczi + * + * Changes for QEMU mainline + tcm_vhost kernel upstream: + * Nicholas Bellinger + * + * This work is licensed under the terms of the GNU LGPL, version 2 or lat= er. + * See the COPYING.LIB file in the top-level directory. + * + */ + +#include "qemu/osdep.h" + +#include "standard-headers/linux/virtio_pci.h" +#include "hw/virtio/vhost-scsi.h" +#include "qapi/error.h" +#include "virtio-pci.h" + +typedef struct VHostSCSIPCI VHostSCSIPCI; + +/* + * vhost-scsi-pci: This extends VirtioPCIProxy. + */ +#define TYPE_VHOST_SCSI_PCI "vhost-scsi-pci" +#define VHOST_SCSI_PCI(obj) \ + OBJECT_CHECK(VHostSCSIPCI, (obj), TYPE_VHOST_SCSI_PCI) + +struct VHostSCSIPCI { + VirtIOPCIProxy parent_obj; + VHostSCSI vdev; +}; + +static Property vhost_scsi_pci_properties[] =3D { + DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, + DEV_NVECTORS_UNSPECIFIED), + DEFINE_PROP_END_OF_LIST(), +}; + +static void vhost_scsi_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp) +{ + VHostSCSIPCI *dev =3D VHOST_SCSI_PCI(vpci_dev); + DeviceState *vdev =3D DEVICE(&dev->vdev); + VirtIOSCSICommon *vs =3D VIRTIO_SCSI_COMMON(vdev); + + if (vpci_dev->nvectors =3D=3D DEV_NVECTORS_UNSPECIFIED) { + vpci_dev->nvectors =3D vs->conf.num_queues + 3; + } + + qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus)); + object_property_set_bool(OBJECT(vdev), true, "realized", errp); +} + +static void vhost_scsi_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); + k->realize =3D vhost_scsi_pci_realize; + set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); + dc->props =3D vhost_scsi_pci_properties; + pcidev_k->vendor_id =3D PCI_VENDOR_ID_REDHAT_QUMRANET; + pcidev_k->device_id =3D PCI_DEVICE_ID_VIRTIO_SCSI; + pcidev_k->revision =3D 0x00; + pcidev_k->class_id =3D PCI_CLASS_STORAGE_SCSI; +} + +static void vhost_scsi_pci_instance_init(Object *obj) +{ + VHostSCSIPCI *dev =3D VHOST_SCSI_PCI(obj); + + virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), + TYPE_VHOST_SCSI); + object_property_add_alias(obj, "bootindex", OBJECT(&dev->vdev), + "bootindex", &error_abort); +} + +static const TypeInfo vhost_scsi_pci_info =3D { + .name =3D TYPE_VHOST_SCSI_PCI, + .parent =3D TYPE_VIRTIO_PCI, + .instance_size =3D sizeof(VHostSCSIPCI), + .instance_init =3D vhost_scsi_pci_instance_init, + .class_init =3D vhost_scsi_pci_class_init, +}; + +static void vhost_scsi_pci_register(void) +{ + type_register_static(&vhost_scsi_pci_info); +} + +type_init(vhost_scsi_pci_register) diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index 7c99d9385a..6c42074d37 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -2019,62 +2019,6 @@ static const TypeInfo virtio_scsi_pci_info =3D { .class_init =3D virtio_scsi_pci_class_init, }; =20 -/* vhost-scsi-pci */ - -#ifdef CONFIG_VHOST_SCSI -static Property vhost_scsi_pci_properties[] =3D { - DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, - DEV_NVECTORS_UNSPECIFIED), - DEFINE_PROP_END_OF_LIST(), -}; - -static void vhost_scsi_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp) -{ - VHostSCSIPCI *dev =3D VHOST_SCSI_PCI(vpci_dev); - DeviceState *vdev =3D DEVICE(&dev->vdev); - VirtIOSCSICommon *vs =3D VIRTIO_SCSI_COMMON(vdev); - - if (vpci_dev->nvectors =3D=3D DEV_NVECTORS_UNSPECIFIED) { - vpci_dev->nvectors =3D vs->conf.num_queues + 3; - } - - qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus)); - object_property_set_bool(OBJECT(vdev), true, "realized", errp); -} - -static void vhost_scsi_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); - k->realize =3D vhost_scsi_pci_realize; - set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); - dc->props =3D vhost_scsi_pci_properties; - pcidev_k->vendor_id =3D PCI_VENDOR_ID_REDHAT_QUMRANET; - pcidev_k->device_id =3D PCI_DEVICE_ID_VIRTIO_SCSI; - pcidev_k->revision =3D 0x00; - pcidev_k->class_id =3D PCI_CLASS_STORAGE_SCSI; -} - -static void vhost_scsi_pci_instance_init(Object *obj) -{ - VHostSCSIPCI *dev =3D VHOST_SCSI_PCI(obj); - - virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), - TYPE_VHOST_SCSI); - object_property_add_alias(obj, "bootindex", OBJECT(&dev->vdev), - "bootindex", &error_abort); -} - -static const TypeInfo vhost_scsi_pci_info =3D { - .name =3D TYPE_VHOST_SCSI_PCI, - .parent =3D TYPE_VIRTIO_PCI, - .instance_size =3D sizeof(VHostSCSIPCI), - .instance_init =3D vhost_scsi_pci_instance_init, - .class_init =3D vhost_scsi_pci_class_init, -}; -#endif - /* virtio-serial-pci */ =20 static void virtio_serial_pci_realize(VirtIOPCIProxy *vpci_dev, Error **er= rp) @@ -2256,9 +2200,6 @@ static void virtio_pci_register_types(void) type_register_static(&virtio_scsi_pci_info); type_register_static(&virtio_serial_pci_info); type_register_static(&virtio_net_pci_info); -#ifdef CONFIG_VHOST_SCSI - type_register_static(&vhost_scsi_pci_info); -#endif } =20 type_init(virtio_pci_register_types) diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h index 7f06d7f331..eb7cdbad25 100644 --- a/hw/virtio/virtio-pci.h +++ b/hw/virtio/virtio-pci.h @@ -24,16 +24,11 @@ #include "hw/virtio/virtio-gpu.h" #include "hw/virtio/virtio-crypto.h" =20 -#ifdef CONFIG_VHOST_SCSI -#include "hw/virtio/vhost-scsi.h" -#endif - typedef struct VirtIOPCIProxy VirtIOPCIProxy; typedef struct VirtIOBlkPCI VirtIOBlkPCI; typedef struct VirtIOSCSIPCI VirtIOSCSIPCI; typedef struct VirtIOSerialPCI VirtIOSerialPCI; typedef struct VirtIONetPCI VirtIONetPCI; -typedef struct VHostSCSIPCI VHostSCSIPCI; typedef struct VirtIOGPUPCI VirtIOGPUPCI; typedef struct VirtIOCryptoPCI VirtIOCryptoPCI; =20 @@ -204,20 +199,6 @@ struct VirtIOSCSIPCI { VirtIOSCSI vdev; }; =20 -#ifdef CONFIG_VHOST_SCSI -/* - * vhost-scsi-pci: This extends VirtioPCIProxy. - */ -#define TYPE_VHOST_SCSI_PCI "vhost-scsi-pci" -#define VHOST_SCSI_PCI(obj) \ - OBJECT_CHECK(VHostSCSIPCI, (obj), TYPE_VHOST_SCSI_PCI) - -struct VHostSCSIPCI { - VirtIOPCIProxy parent_obj; - VHostSCSI vdev; -}; -#endif - /* * virtio-blk-pci: This extends VirtioPCIProxy. */ --=20 2.19.1 From nobody Mon Feb 9 15:10:39 2026 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543262866734955.7195107930999; Mon, 26 Nov 2018 12:07:46 -0800 (PST) Received: from localhost ([::1]:38553 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRNAW-0003IL-Nk for importer@patchew.org; Mon, 26 Nov 2018 15:07:44 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52572) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRN5P-000748-TL for qemu-devel@nongnu.org; Mon, 26 Nov 2018 15:02:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRN5O-0008Ah-La for qemu-devel@nongnu.org; Mon, 26 Nov 2018 15:02:27 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60696) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRN5O-0008AX-ET for qemu-devel@nongnu.org; Mon, 26 Nov 2018 15:02:26 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C2E5F356F5 for ; Mon, 26 Nov 2018 20:02:25 +0000 (UTC) Received: from localhost.localdomain (unknown [10.36.118.114]) by smtp.corp.redhat.com (Postfix) with ESMTP id 641EC19483; Mon, 26 Nov 2018 20:02:24 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Mon, 26 Nov 2018 21:00:03 +0100 Message-Id: <20181126200009.862-11-quintela@redhat.com> In-Reply-To: <20181126200009.862-1-quintela@redhat.com> References: <20181126200009.862-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 26 Nov 2018 20:02:25 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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 v2 10/16] virtio: split virtio scsi 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: lvivier@redhat.com, dgilbert@redhat.com, peterx@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Notice that we can't still run tests with it disabled. Both cdrom-test and drive_del-test use virtio-scsi without checking if it is enabled. Reviewed-by: Thomas Huth Signed-off-by: Juan Quintela Reviewed-by: Laurent Vivier --- hw/virtio/Makefile.objs | 1 + hw/virtio/virtio-pci.c | 69 ----------------------- hw/virtio/virtio-pci.h | 14 ----- hw/virtio/virtio-scsi-pci.c | 106 ++++++++++++++++++++++++++++++++++++ tests/Makefile.include | 2 +- 5 files changed, 108 insertions(+), 84 deletions(-) create mode 100644 hw/virtio/virtio-scsi-pci.c diff --git a/hw/virtio/Makefile.objs b/hw/virtio/Makefile.objs index 6e6e001449..5d59302f89 100644 --- a/hw/virtio/Makefile.objs +++ b/hw/virtio/Makefile.objs @@ -19,6 +19,7 @@ obj-$(CONFIG_VIRTIO_INPUT) +=3D virtio-input-pci.o 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 endif =20 common-obj-$(call lnot,$(call land,$(CONFIG_VIRTIO),$(CONFIG_LINUX))) +=3D= vhost-stub.o diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index 6c42074d37..debd764523 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -22,7 +22,6 @@ #include "hw/virtio/virtio-blk.h" #include "hw/virtio/virtio-net.h" #include "hw/virtio/virtio-serial.h" -#include "hw/virtio/virtio-scsi.h" #include "hw/pci/pci.h" #include "qapi/error.h" #include "qemu/error-report.h" @@ -1952,73 +1951,6 @@ static const TypeInfo virtio_blk_pci_info =3D { .class_init =3D virtio_blk_pci_class_init, }; =20 -/* virtio-scsi-pci */ - -static Property virtio_scsi_pci_properties[] =3D { - 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_scsi_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp) -{ - VirtIOSCSIPCI *dev =3D VIRTIO_SCSI_PCI(vpci_dev); - DeviceState *vdev =3D DEVICE(&dev->vdev); - VirtIOSCSICommon *vs =3D VIRTIO_SCSI_COMMON(vdev); - DeviceState *proxy =3D DEVICE(vpci_dev); - char *bus_name; - - if (vpci_dev->nvectors =3D=3D DEV_NVECTORS_UNSPECIFIED) { - vpci_dev->nvectors =3D vs->conf.num_queues + 3; - } - - /* - * For command line compatibility, this sets the virtio-scsi-device bus - * name as before. - */ - if (proxy->id) { - bus_name =3D g_strdup_printf("%s.0", proxy->id); - virtio_device_set_child_bus_name(VIRTIO_DEVICE(vdev), bus_name); - g_free(bus_name); - } - - qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus)); - object_property_set_bool(OBJECT(vdev), true, "realized", errp); -} - -static void virtio_scsi_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); - - k->realize =3D virtio_scsi_pci_realize; - set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); - dc->props =3D virtio_scsi_pci_properties; - pcidev_k->vendor_id =3D PCI_VENDOR_ID_REDHAT_QUMRANET; - pcidev_k->device_id =3D PCI_DEVICE_ID_VIRTIO_SCSI; - pcidev_k->revision =3D 0x00; - pcidev_k->class_id =3D PCI_CLASS_STORAGE_SCSI; -} - -static void virtio_scsi_pci_instance_init(Object *obj) -{ - VirtIOSCSIPCI *dev =3D VIRTIO_SCSI_PCI(obj); - - virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), - TYPE_VIRTIO_SCSI); -} - -static const TypeInfo virtio_scsi_pci_info =3D { - .name =3D TYPE_VIRTIO_SCSI_PCI, - .parent =3D TYPE_VIRTIO_PCI, - .instance_size =3D sizeof(VirtIOSCSIPCI), - .instance_init =3D virtio_scsi_pci_instance_init, - .class_init =3D virtio_scsi_pci_class_init, -}; - /* virtio-serial-pci */ =20 static void virtio_serial_pci_realize(VirtIOPCIProxy *vpci_dev, Error **er= rp) @@ -2197,7 +2129,6 @@ static void virtio_pci_register_types(void) type_register_static(&virtio_pci_bus_info); type_register_static(&virtio_pci_info); type_register_static(&virtio_blk_pci_info); - type_register_static(&virtio_scsi_pci_info); type_register_static(&virtio_serial_pci_info); type_register_static(&virtio_net_pci_info); } diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h index eb7cdbad25..5e13d87110 100644 --- a/hw/virtio/virtio-pci.h +++ b/hw/virtio/virtio-pci.h @@ -19,14 +19,12 @@ #include "hw/virtio/virtio-blk.h" #include "hw/virtio/virtio-net.h" #include "hw/virtio/virtio-serial.h" -#include "hw/virtio/virtio-scsi.h" #include "hw/virtio/virtio-bus.h" #include "hw/virtio/virtio-gpu.h" #include "hw/virtio/virtio-crypto.h" =20 typedef struct VirtIOPCIProxy VirtIOPCIProxy; typedef struct VirtIOBlkPCI VirtIOBlkPCI; -typedef struct VirtIOSCSIPCI VirtIOSCSIPCI; typedef struct VirtIOSerialPCI VirtIOSerialPCI; typedef struct VirtIONetPCI VirtIONetPCI; typedef struct VirtIOGPUPCI VirtIOGPUPCI; @@ -187,18 +185,6 @@ static inline void virtio_pci_disable_modern(VirtIOPCI= Proxy *proxy) proxy->disable_modern =3D true; } =20 -/* - * virtio-scsi-pci: This extends VirtioPCIProxy. - */ -#define TYPE_VIRTIO_SCSI_PCI "virtio-scsi-pci" -#define VIRTIO_SCSI_PCI(obj) \ - OBJECT_CHECK(VirtIOSCSIPCI, (obj), TYPE_VIRTIO_SCSI_PCI) - -struct VirtIOSCSIPCI { - VirtIOPCIProxy parent_obj; - VirtIOSCSI vdev; -}; - /* * virtio-blk-pci: This extends VirtioPCIProxy. */ diff --git a/hw/virtio/virtio-scsi-pci.c b/hw/virtio/virtio-scsi-pci.c new file mode 100644 index 0000000000..bc45b1bc32 --- /dev/null +++ b/hw/virtio/virtio-scsi-pci.c @@ -0,0 +1,106 @@ +/* + * Virtio scsi PCI Bindings + * + * Copyright IBM, Corp. 2007 + * Copyright (c) 2009 CodeSourcery + * + * Authors: + * Anthony Liguori + * Paul Brook + * + * This work is licensed under the terms of the GNU GPL, version 2 or + * (at your option) any later version. See the COPYING file in the + * top-level directory. + */ + +#include "qemu/osdep.h" + +#include "hw/virtio/virtio-scsi.h" +#include "virtio-pci.h" + +typedef struct VirtIOSCSIPCI VirtIOSCSIPCI; + +/* + * virtio-scsi-pci: This extends VirtioPCIProxy. + */ +#define TYPE_VIRTIO_SCSI_PCI "virtio-scsi-pci" +#define VIRTIO_SCSI_PCI(obj) \ + OBJECT_CHECK(VirtIOSCSIPCI, (obj), TYPE_VIRTIO_SCSI_PCI) + +struct VirtIOSCSIPCI { + VirtIOPCIProxy parent_obj; + VirtIOSCSI vdev; +}; + +static Property virtio_scsi_pci_properties[] =3D { + 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_scsi_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp) +{ + VirtIOSCSIPCI *dev =3D VIRTIO_SCSI_PCI(vpci_dev); + DeviceState *vdev =3D DEVICE(&dev->vdev); + VirtIOSCSICommon *vs =3D VIRTIO_SCSI_COMMON(vdev); + DeviceState *proxy =3D DEVICE(vpci_dev); + char *bus_name; + + if (vpci_dev->nvectors =3D=3D DEV_NVECTORS_UNSPECIFIED) { + vpci_dev->nvectors =3D vs->conf.num_queues + 3; + } + + /* + * For command line compatibility, this sets the virtio-scsi-device bus + * name as before. + */ + if (proxy->id) { + bus_name =3D g_strdup_printf("%s.0", proxy->id); + virtio_device_set_child_bus_name(VIRTIO_DEVICE(vdev), bus_name); + g_free(bus_name); + } + + qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus)); + object_property_set_bool(OBJECT(vdev), true, "realized", errp); +} + +static void virtio_scsi_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); + + k->realize =3D virtio_scsi_pci_realize; + set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); + dc->props =3D virtio_scsi_pci_properties; + pcidev_k->vendor_id =3D PCI_VENDOR_ID_REDHAT_QUMRANET; + pcidev_k->device_id =3D PCI_DEVICE_ID_VIRTIO_SCSI; + pcidev_k->revision =3D 0x00; + pcidev_k->class_id =3D PCI_CLASS_STORAGE_SCSI; +} + +static void virtio_scsi_pci_instance_init(Object *obj) +{ + VirtIOSCSIPCI *dev =3D VIRTIO_SCSI_PCI(obj); + + virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), + TYPE_VIRTIO_SCSI); +} + +static const TypeInfo virtio_scsi_pci_info =3D { + .name =3D TYPE_VIRTIO_SCSI_PCI, + .parent =3D TYPE_VIRTIO_PCI, + .instance_size =3D sizeof(VirtIOSCSIPCI), + .instance_init =3D virtio_scsi_pci_instance_init, + .class_init =3D virtio_scsi_pci_class_init, +}; + + +static void virtio_scsi_pci_register(void) +{ + type_register_static(&virtio_scsi_pci_info); +} + +type_init(virtio_scsi_pci_register) diff --git a/tests/Makefile.include b/tests/Makefile.include index 89800e76ca..9b3e7d7403 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -150,7 +150,7 @@ 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-y +=3D tests/virtio-rng-test$(EXESUF) check-qtest-virtio-$(CONFIG_VIRTIO_RNG) +=3D tests/virtio-rng-test$(EXESUF) -check-qtest-virtio-y +=3D tests/virtio-scsi-test$(EXESUF) +check-qtest-virtio-$(CONFIG_VIRTIO_SCSI) +=3D tests/virtio-scsi-test$(EXES= UF) ifeq ($(CONFIG_VIRTIO)$(CONFIG_VIRTFS)$(CONFIG_PCI),yyy) check-qtest-virtio-y +=3D tests/virtio-9p-test$(EXESUF) endif --=20 2.19.1 From nobody Mon Feb 9 15:10:39 2026 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543263376394156.35495648847677; Mon, 26 Nov 2018 12:16:16 -0800 (PST) Received: from localhost ([::1]:38609 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRNId-0003Op-8a for importer@patchew.org; Mon, 26 Nov 2018 15:16:07 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52587) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRN5R-000771-Nk for qemu-devel@nongnu.org; Mon, 26 Nov 2018 15:02:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRN5Q-0008B6-D2 for qemu-devel@nongnu.org; Mon, 26 Nov 2018 15:02:29 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33230) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRN5Q-0008Av-5y for qemu-devel@nongnu.org; Mon, 26 Nov 2018 15:02:28 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8038EA8BF5 for ; Mon, 26 Nov 2018 20:02:27 +0000 (UTC) Received: from localhost.localdomain (unknown [10.36.118.114]) by smtp.corp.redhat.com (Postfix) with ESMTP id 224EF19747; Mon, 26 Nov 2018 20:02:25 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Mon, 26 Nov 2018 21:00:04 +0100 Message-Id: <20181126200009.862-12-quintela@redhat.com> In-Reply-To: <20181126200009.862-1-quintela@redhat.com> References: <20181126200009.862-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 26 Nov 2018 20:02:27 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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 v2 11/16] virtio: split virtio blk bits rom 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: lvivier@redhat.com, dgilbert@redhat.com, peterx@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Reviewed-by: Thomas Huth Signed-off-by: Juan Quintela Reviewed-by: Laurent Vivier --- hw/virtio/Makefile.objs | 1 + hw/virtio/virtio-blk-pci.c | 97 ++++++++++++++++++++++++++++++++++++++ hw/virtio/virtio-pci.c | 59 ----------------------- hw/virtio/virtio-pci.h | 14 ------ tests/Makefile.include | 5 +- 5 files changed, 100 insertions(+), 76 deletions(-) create mode 100644 hw/virtio/virtio-blk-pci.c diff --git a/hw/virtio/Makefile.objs b/hw/virtio/Makefile.objs index 5d59302f89..c28b740dca 100644 --- a/hw/virtio/Makefile.objs +++ b/hw/virtio/Makefile.objs @@ -20,6 +20,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 =20 common-obj-$(call lnot,$(call land,$(CONFIG_VIRTIO),$(CONFIG_LINUX))) +=3D= vhost-stub.o diff --git a/hw/virtio/virtio-blk-pci.c b/hw/virtio/virtio-blk-pci.c new file mode 100644 index 0000000000..c1c41ad3f0 --- /dev/null +++ b/hw/virtio/virtio-blk-pci.c @@ -0,0 +1,97 @@ +/* + * Virtio blk PCI Bindings + * + * Copyright IBM, Corp. 2007 + * Copyright (c) 2009 CodeSourcery + * + * Authors: + * Anthony Liguori + * Paul Brook + * + * This work is licensed under the terms of the GNU GPL, version 2. See + * the COPYING file in the top-level directory. + * + * Contributions after 2012-01-13 are licensed under the terms of the + * GNU GPL, version 2 or (at your option) any later version. + */ + +#include "qemu/osdep.h" + +#include "hw/virtio/virtio-blk.h" +#include "virtio-pci.h" +#include "qapi/error.h" + +typedef struct VirtIOBlkPCI VirtIOBlkPCI; + +/* + * virtio-blk-pci: This extends VirtioPCIProxy. + */ +#define TYPE_VIRTIO_BLK_PCI "virtio-blk-pci" +#define VIRTIO_BLK_PCI(obj) \ + OBJECT_CHECK(VirtIOBlkPCI, (obj), TYPE_VIRTIO_BLK_PCI) + +struct VirtIOBlkPCI { + VirtIOPCIProxy parent_obj; + VirtIOBlock vdev; +}; + +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 TypeInfo virtio_blk_pci_info =3D { + .name =3D TYPE_VIRTIO_BLK_PCI, + .parent =3D TYPE_VIRTIO_PCI, + .instance_size =3D sizeof(VirtIOBlkPCI), + .instance_init =3D virtio_blk_pci_instance_init, + .class_init =3D virtio_blk_pci_class_init, +}; +static void virtio_blk_pci_register(void) +{ + type_register_static(&virtio_blk_pci_info); +} + +type_init(virtio_blk_pci_register) diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index debd764523..4fe71a56c8 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" @@ -1894,63 +1893,6 @@ static const TypeInfo virtio_pci_info =3D { }, }; =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 TypeInfo virtio_blk_pci_info =3D { - .name =3D TYPE_VIRTIO_BLK_PCI, - .parent =3D TYPE_VIRTIO_PCI, - .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) @@ -2128,7 +2070,6 @@ static void virtio_pci_register_types(void) { type_register_static(&virtio_pci_bus_info); type_register_static(&virtio_pci_info); - type_register_static(&virtio_blk_pci_info); type_register_static(&virtio_serial_pci_info); type_register_static(&virtio_net_pci_info); } diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h index 5e13d87110..3c9bbf9287 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" -#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/tests/Makefile.include b/tests/Makefile.include index 9b3e7d7403..36d95fe913 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -147,8 +147,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-y +=3D tests/virtio-rng-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) @@ -279,7 +278,7 @@ check-qtest-arm-y +=3D tests/tmp105-test$(EXESUF) check-qtest-arm-y +=3D tests/pca9552-test$(EXESUF) check-qtest-arm-y +=3D tests/ds1338-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 2.19.1 From nobody Mon Feb 9 15:10:39 2026 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543263191165391.47894124987374; Mon, 26 Nov 2018 12:13:11 -0800 (PST) Received: from localhost ([::1]:38586 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRNFl-0008Oq-Qn for importer@patchew.org; Mon, 26 Nov 2018 15:13:09 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52598) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRN5T-00079G-KV for qemu-devel@nongnu.org; Mon, 26 Nov 2018 15:02:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRN5S-0008BP-6H for qemu-devel@nongnu.org; Mon, 26 Nov 2018 15:02:31 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40082) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRN5R-0008BE-UU for qemu-devel@nongnu.org; Mon, 26 Nov 2018 15:02:30 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3C87D3086272 for ; Mon, 26 Nov 2018 20:02:29 +0000 (UTC) Received: from localhost.localdomain (unknown [10.36.118.114]) by smtp.corp.redhat.com (Postfix) with ESMTP id D3A1719483; Mon, 26 Nov 2018 20:02:27 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Mon, 26 Nov 2018 21:00:05 +0100 Message-Id: <20181126200009.862-13-quintela@redhat.com> In-Reply-To: <20181126200009.862-1-quintela@redhat.com> References: <20181126200009.862-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Mon, 26 Nov 2018 20:02:29 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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 v2 12/16] virtio: split virtio net bits rom 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: lvivier@redhat.com, dgilbert@redhat.com, peterx@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Reviewed-by: Thomas Huth Signed-off-by: Juan Quintela Reviewed-by: Laurent Vivier --- hw/virtio/Makefile.objs | 1 + hw/virtio/virtio-net-pci.c | 96 ++++++++++++++++++++++++++++++++++++++ hw/virtio/virtio-pci.c | 57 ---------------------- hw/virtio/virtio-pci.h | 14 ------ tests/Makefile.include | 2 +- 5 files changed, 98 insertions(+), 72 deletions(-) create mode 100644 hw/virtio/virtio-net-pci.c diff --git a/hw/virtio/Makefile.objs b/hw/virtio/Makefile.objs index c28b740dca..0810553ab8 100644 --- a/hw/virtio/Makefile.objs +++ b/hw/virtio/Makefile.objs @@ -21,6 +21,7 @@ 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 +obj-$(CONFIG_VIRTIO_NET) +=3D virtio-net-pci.o endif =20 common-obj-$(call lnot,$(call land,$(CONFIG_VIRTIO),$(CONFIG_LINUX))) +=3D= vhost-stub.o diff --git a/hw/virtio/virtio-net-pci.c b/hw/virtio/virtio-net-pci.c new file mode 100644 index 0000000000..0b676f078d --- /dev/null +++ b/hw/virtio/virtio-net-pci.c @@ -0,0 +1,96 @@ +/* + * Virtio net PCI Bindings + * + * Copyright IBM, Corp. 2007 + * Copyright (c) 2009 CodeSourcery + * + * Authors: + * Anthony Liguori + * Paul Brook + * + * This work is licensed under the terms of the GNU GPL, version 2. See + * the COPYING file in the top-level directory. + * + * Contributions after 2012-01-13 are licensed under the terms of the + * GNU GPL, version 2 or (at your option) any later version. + */ + +#include "qemu/osdep.h" + +#include "hw/virtio/virtio-net.h" +#include "virtio-pci.h" +#include "qapi/error.h" + +typedef struct VirtIONetPCI VirtIONetPCI; + +/* + * virtio-net-pci: This extends VirtioPCIProxy. + */ +#define TYPE_VIRTIO_NET_PCI "virtio-net-pci" +#define VIRTIO_NET_PCI(obj) \ + OBJECT_CHECK(VirtIONetPCI, (obj), TYPE_VIRTIO_NET_PCI) + +struct VirtIONetPCI { + VirtIOPCIProxy parent_obj; + VirtIONet vdev; +}; + +static Property virtio_net_properties[] =3D { + DEFINE_PROP_BIT("ioeventfd", VirtIOPCIProxy, flags, + VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT, true), + DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 3), + DEFINE_PROP_END_OF_LIST(), +}; + +static void virtio_net_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp) +{ + DeviceState *qdev =3D DEVICE(vpci_dev); + VirtIONetPCI *dev =3D VIRTIO_NET_PCI(vpci_dev); + DeviceState *vdev =3D DEVICE(&dev->vdev); + + virtio_net_set_netclient_name(&dev->vdev, qdev->id, + object_get_typename(OBJECT(qdev))); + qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus)); + object_property_set_bool(OBJECT(vdev), true, "realized", errp); +} + +static void virtio_net_pci_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + PCIDeviceClass *k =3D PCI_DEVICE_CLASS(klass); + VirtioPCIClass *vpciklass =3D VIRTIO_PCI_CLASS(klass); + + k->romfile =3D "efi-virtio.rom"; + k->vendor_id =3D PCI_VENDOR_ID_REDHAT_QUMRANET; + k->device_id =3D PCI_DEVICE_ID_VIRTIO_NET; + k->revision =3D VIRTIO_PCI_ABI_VERSION; + k->class_id =3D PCI_CLASS_NETWORK_ETHERNET; + set_bit(DEVICE_CATEGORY_NETWORK, dc->categories); + dc->props =3D virtio_net_properties; + vpciklass->realize =3D virtio_net_pci_realize; +} + +static void virtio_net_pci_instance_init(Object *obj) +{ + VirtIONetPCI *dev =3D VIRTIO_NET_PCI(obj); + + virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), + TYPE_VIRTIO_NET); + object_property_add_alias(obj, "bootindex", OBJECT(&dev->vdev), + "bootindex", &error_abort); +} + +static const TypeInfo virtio_net_pci_info =3D { + .name =3D TYPE_VIRTIO_NET_PCI, + .parent =3D TYPE_VIRTIO_PCI, + .instance_size =3D sizeof(VirtIONetPCI), + .instance_init =3D virtio_net_pci_instance_init, + .class_init =3D virtio_net_pci_class_init, +}; + +static void virtio_net_pci_register(void) +{ + type_register_static(&virtio_net_pci_info); +} + +type_init(virtio_net_pci_register) diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index 4fe71a56c8..cb03bfa597 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-net.h" #include "hw/virtio/virtio-serial.h" #include "hw/pci/pci.h" #include "qapi/error.h" @@ -1966,61 +1965,6 @@ static const TypeInfo virtio_serial_pci_info =3D { .class_init =3D virtio_serial_pci_class_init, }; =20 -/* virtio-net-pci */ - -static Property virtio_net_properties[] =3D { - DEFINE_PROP_BIT("ioeventfd", VirtIOPCIProxy, flags, - VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT, true), - DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 3), - DEFINE_PROP_END_OF_LIST(), -}; - -static void virtio_net_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp) -{ - DeviceState *qdev =3D DEVICE(vpci_dev); - VirtIONetPCI *dev =3D VIRTIO_NET_PCI(vpci_dev); - DeviceState *vdev =3D DEVICE(&dev->vdev); - - virtio_net_set_netclient_name(&dev->vdev, qdev->id, - object_get_typename(OBJECT(qdev))); - qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus)); - object_property_set_bool(OBJECT(vdev), true, "realized", errp); -} - -static void virtio_net_pci_class_init(ObjectClass *klass, void *data) -{ - DeviceClass *dc =3D DEVICE_CLASS(klass); - PCIDeviceClass *k =3D PCI_DEVICE_CLASS(klass); - VirtioPCIClass *vpciklass =3D VIRTIO_PCI_CLASS(klass); - - k->romfile =3D "efi-virtio.rom"; - k->vendor_id =3D PCI_VENDOR_ID_REDHAT_QUMRANET; - k->device_id =3D PCI_DEVICE_ID_VIRTIO_NET; - k->revision =3D VIRTIO_PCI_ABI_VERSION; - k->class_id =3D PCI_CLASS_NETWORK_ETHERNET; - set_bit(DEVICE_CATEGORY_NETWORK, dc->categories); - dc->props =3D virtio_net_properties; - vpciklass->realize =3D virtio_net_pci_realize; -} - -static void virtio_net_pci_instance_init(Object *obj) -{ - VirtIONetPCI *dev =3D VIRTIO_NET_PCI(obj); - - virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), - TYPE_VIRTIO_NET); - object_property_add_alias(obj, "bootindex", OBJECT(&dev->vdev), - "bootindex", &error_abort); -} - -static const TypeInfo virtio_net_pci_info =3D { - .name =3D TYPE_VIRTIO_NET_PCI, - .parent =3D TYPE_VIRTIO_PCI, - .instance_size =3D sizeof(VirtIONetPCI), - .instance_init =3D virtio_net_pci_instance_init, - .class_init =3D virtio_net_pci_class_init, -}; - /* virtio-pci-bus */ =20 static void virtio_pci_bus_new(VirtioBusState *bus, size_t bus_size, @@ -2071,7 +2015,6 @@ static void virtio_pci_register_types(void) type_register_static(&virtio_pci_bus_info); type_register_static(&virtio_pci_info); type_register_static(&virtio_serial_pci_info); - type_register_static(&virtio_net_pci_info); } =20 type_init(virtio_pci_register_types) diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h index 3c9bbf9287..ab0c7907e4 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-net.h" #include "hw/virtio/virtio-serial.h" #include "hw/virtio/virtio-bus.h" #include "hw/virtio/virtio-gpu.h" @@ -24,7 +23,6 @@ =20 typedef struct VirtIOPCIProxy VirtIOPCIProxy; typedef struct VirtIOSerialPCI VirtIOSerialPCI; -typedef struct VirtIONetPCI VirtIONetPCI; typedef struct VirtIOGPUPCI VirtIOGPUPCI; typedef struct VirtIOCryptoPCI VirtIOCryptoPCI; =20 @@ -195,18 +193,6 @@ struct VirtIOSerialPCI { VirtIOSerial vdev; }; =20 -/* - * virtio-net-pci: This extends VirtioPCIProxy. - */ -#define TYPE_VIRTIO_NET_PCI "virtio-net-pci" -#define VIRTIO_NET_PCI(obj) \ - OBJECT_CHECK(VirtIONetPCI, (obj), TYPE_VIRTIO_NET_PCI) - -struct VirtIONetPCI { - VirtIOPCIProxy parent_obj; - VirtIONet vdev; -}; - /* * virtio-input-pci: This extends VirtioPCIProxy. */ diff --git a/tests/Makefile.include b/tests/Makefile.include index 36d95fe913..0a3878f3ab 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -145,7 +145,7 @@ check-qtest-ipack-y +=3D tests/ipoctal232-test$(EXESUF) =20 check-qtest-virtioserial-y +=3D tests/virtio-console-test$(EXESUF) =20 -check-qtest-virtio-y +=3D tests/virtio-net-test$(EXESUF) +check-qtest-virtio-$(CONFIG_VIRTIO_NET) +=3D tests/virtio-net-test$(EXESUF) check-qtest-virtio-$(CONFIG_VIRTIO_BALLOON) +=3D tests/virtio-balloon-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) --=20 2.19.1 From nobody Mon Feb 9 15:10:39 2026 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543263576303752.0741928202792; Mon, 26 Nov 2018 12:19:36 -0800 (PST) Received: from localhost ([::1]:38622 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRNLy-0005r5-G7 for importer@patchew.org; Mon, 26 Nov 2018 15:19:34 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52610) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRN5V-0007Az-BR for qemu-devel@nongnu.org; Mon, 26 Nov 2018 15:02:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRN5T-0008Bi-Tw for qemu-devel@nongnu.org; Mon, 26 Nov 2018 15:02:33 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48900) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRN5T-0008BX-MT for qemu-devel@nongnu.org; Mon, 26 Nov 2018 15:02:31 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F011C307D96E for ; Mon, 26 Nov 2018 20:02:30 +0000 (UTC) Received: from localhost.localdomain (unknown [10.36.118.114]) by smtp.corp.redhat.com (Postfix) with ESMTP id 90C0919936; Mon, 26 Nov 2018 20:02:29 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Mon, 26 Nov 2018 21:00:06 +0100 Message-Id: <20181126200009.862-14-quintela@redhat.com> In-Reply-To: <20181126200009.862-1-quintela@redhat.com> References: <20181126200009.862-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Mon, 26 Nov 2018 20:02:31 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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 v2 13/16] virtio: split virtio serial bits rom 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: lvivier@redhat.com, dgilbert@redhat.com, peterx@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Virtio console and qga tests also depend on CONFIG_VIRTIO_SERIAL. Reviewed-by: Thomas Huth Signed-off-by: Juan Quintela Reviewed-by: Laurent Vivier --- hw/virtio/Makefile.objs | 1 + hw/virtio/virtio-pci.c | 75 ----------------------- hw/virtio/virtio-pci.h | 14 ----- hw/virtio/virtio-serial-pci.c | 112 ++++++++++++++++++++++++++++++++++ tests/Makefile.include | 6 +- 5 files changed, 116 insertions(+), 92 deletions(-) create mode 100644 hw/virtio/virtio-serial-pci.c diff --git a/hw/virtio/Makefile.objs b/hw/virtio/Makefile.objs index 0810553ab8..3d88b60d27 100644 --- a/hw/virtio/Makefile.objs +++ b/hw/virtio/Makefile.objs @@ -22,6 +22,7 @@ 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 obj-$(CONFIG_VIRTIO_NET) +=3D virtio-net-pci.o +obj-$(CONFIG_VIRTIO_SERIAL) +=3D virtio-serial-pci.o endif =20 common-obj-$(call lnot,$(call land,$(CONFIG_VIRTIO),$(CONFIG_LINUX))) +=3D= vhost-stub.o diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index cb03bfa597..5a54b144a5 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-serial.h" #include "hw/pci/pci.h" #include "qapi/error.h" #include "qemu/error-report.h" @@ -1892,79 +1891,6 @@ static const TypeInfo virtio_pci_info =3D { }, }; =20 -/* virtio-serial-pci */ - -static void virtio_serial_pci_realize(VirtIOPCIProxy *vpci_dev, Error **er= rp) -{ - VirtIOSerialPCI *dev =3D VIRTIO_SERIAL_PCI(vpci_dev); - DeviceState *vdev =3D DEVICE(&dev->vdev); - DeviceState *proxy =3D DEVICE(vpci_dev); - char *bus_name; - - if (vpci_dev->class_code !=3D PCI_CLASS_COMMUNICATION_OTHER && - vpci_dev->class_code !=3D PCI_CLASS_DISPLAY_OTHER && /* qemu 0.10 = */ - vpci_dev->class_code !=3D PCI_CLASS_OTHERS) { /* qemu-kvm = */ - vpci_dev->class_code =3D PCI_CLASS_COMMUNICATION_OTHER; - } - - /* backwards-compatibility with machines that were created with - DEV_NVECTORS_UNSPECIFIED */ - if (vpci_dev->nvectors =3D=3D DEV_NVECTORS_UNSPECIFIED) { - vpci_dev->nvectors =3D dev->vdev.serial.max_virtserial_ports + 1; - } - - /* - * For command line compatibility, this sets the virtio-serial-device = bus - * name as before. - */ - if (proxy->id) { - bus_name =3D g_strdup_printf("%s.0", proxy->id); - virtio_device_set_child_bus_name(VIRTIO_DEVICE(vdev), bus_name); - g_free(bus_name); - } - - qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus)); - object_property_set_bool(OBJECT(vdev), true, "realized", errp); -} - -static Property virtio_serial_pci_properties[] =3D { - DEFINE_PROP_BIT("ioeventfd", VirtIOPCIProxy, flags, - VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT, true), - DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 2), - DEFINE_PROP_UINT32("class", VirtIOPCIProxy, class_code, 0), - DEFINE_PROP_END_OF_LIST(), -}; - -static void virtio_serial_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); - k->realize =3D virtio_serial_pci_realize; - set_bit(DEVICE_CATEGORY_INPUT, dc->categories); - dc->props =3D virtio_serial_pci_properties; - pcidev_k->vendor_id =3D PCI_VENDOR_ID_REDHAT_QUMRANET; - pcidev_k->device_id =3D PCI_DEVICE_ID_VIRTIO_CONSOLE; - pcidev_k->revision =3D VIRTIO_PCI_ABI_VERSION; - pcidev_k->class_id =3D PCI_CLASS_COMMUNICATION_OTHER; -} - -static void virtio_serial_pci_instance_init(Object *obj) -{ - VirtIOSerialPCI *dev =3D VIRTIO_SERIAL_PCI(obj); - - virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), - TYPE_VIRTIO_SERIAL); -} - -static const TypeInfo virtio_serial_pci_info =3D { - .name =3D TYPE_VIRTIO_SERIAL_PCI, - .parent =3D TYPE_VIRTIO_PCI, - .instance_size =3D sizeof(VirtIOSerialPCI), - .instance_init =3D virtio_serial_pci_instance_init, - .class_init =3D virtio_serial_pci_class_init, -}; - /* virtio-pci-bus */ =20 static void virtio_pci_bus_new(VirtioBusState *bus, size_t bus_size, @@ -2014,7 +1940,6 @@ static void virtio_pci_register_types(void) { type_register_static(&virtio_pci_bus_info); type_register_static(&virtio_pci_info); - type_register_static(&virtio_serial_pci_info); } =20 type_init(virtio_pci_register_types) diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h index ab0c7907e4..59016d553b 100644 --- a/hw/virtio/virtio-pci.h +++ b/hw/virtio/virtio-pci.h @@ -16,13 +16,11 @@ #define QEMU_VIRTIO_PCI_H =20 #include "hw/pci/msi.h" -#include "hw/virtio/virtio-serial.h" #include "hw/virtio/virtio-bus.h" #include "hw/virtio/virtio-gpu.h" #include "hw/virtio/virtio-crypto.h" =20 typedef struct VirtIOPCIProxy VirtIOPCIProxy; -typedef struct VirtIOSerialPCI VirtIOSerialPCI; typedef struct VirtIOGPUPCI VirtIOGPUPCI; typedef struct VirtIOCryptoPCI VirtIOCryptoPCI; =20 @@ -181,18 +179,6 @@ static inline void virtio_pci_disable_modern(VirtIOPCI= Proxy *proxy) proxy->disable_modern =3D true; } =20 -/* - * virtio-serial-pci: This extends VirtioPCIProxy. - */ -#define TYPE_VIRTIO_SERIAL_PCI "virtio-serial-pci" -#define VIRTIO_SERIAL_PCI(obj) \ - OBJECT_CHECK(VirtIOSerialPCI, (obj), TYPE_VIRTIO_SERIAL_PCI) - -struct VirtIOSerialPCI { - VirtIOPCIProxy parent_obj; - VirtIOSerial vdev; -}; - /* * virtio-input-pci: This extends VirtioPCIProxy. */ diff --git a/hw/virtio/virtio-serial-pci.c b/hw/virtio/virtio-serial-pci.c new file mode 100644 index 0000000000..acb23427ac --- /dev/null +++ b/hw/virtio/virtio-serial-pci.c @@ -0,0 +1,112 @@ +/* + * Virtio serial PCI Bindings + * + * Copyright IBM, Corp. 2007 + * Copyright (c) 2009 CodeSourcery + * + * Authors: + * Anthony Liguori + * Paul Brook + * + * This work is licensed under the terms of the GNU GPL, version 2. See + * the COPYING file in the top-level directory. + * + * Contributions after 2012-01-13 are licensed under the terms of the + * GNU GPL, version 2 or (at your option) any later version. + */ + +#include "qemu/osdep.h" + +#include "hw/virtio/virtio-serial.h" +#include "virtio-pci.h" + +typedef struct VirtIOSerialPCI VirtIOSerialPCI; + +/* + * virtio-serial-pci: This extends VirtioPCIProxy. + */ +#define TYPE_VIRTIO_SERIAL_PCI "virtio-serial-pci" +#define VIRTIO_SERIAL_PCI(obj) \ + OBJECT_CHECK(VirtIOSerialPCI, (obj), TYPE_VIRTIO_SERIAL_PCI) + +struct VirtIOSerialPCI { + VirtIOPCIProxy parent_obj; + VirtIOSerial vdev; +}; + +static void virtio_serial_pci_realize(VirtIOPCIProxy *vpci_dev, Error **er= rp) +{ + VirtIOSerialPCI *dev =3D VIRTIO_SERIAL_PCI(vpci_dev); + DeviceState *vdev =3D DEVICE(&dev->vdev); + DeviceState *proxy =3D DEVICE(vpci_dev); + char *bus_name; + + if (vpci_dev->class_code !=3D PCI_CLASS_COMMUNICATION_OTHER && + vpci_dev->class_code !=3D PCI_CLASS_DISPLAY_OTHER && /* qemu 0.10 = */ + vpci_dev->class_code !=3D PCI_CLASS_OTHERS) { /* qemu-kvm = */ + vpci_dev->class_code =3D PCI_CLASS_COMMUNICATION_OTHER; + } + + /* backwards-compatibility with machines that were created with + DEV_NVECTORS_UNSPECIFIED */ + if (vpci_dev->nvectors =3D=3D DEV_NVECTORS_UNSPECIFIED) { + vpci_dev->nvectors =3D dev->vdev.serial.max_virtserial_ports + 1; + } + + /* + * For command line compatibility, this sets the virtio-serial-device = bus + * name as before. + */ + if (proxy->id) { + bus_name =3D g_strdup_printf("%s.0", proxy->id); + virtio_device_set_child_bus_name(VIRTIO_DEVICE(vdev), bus_name); + g_free(bus_name); + } + + qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus)); + object_property_set_bool(OBJECT(vdev), true, "realized", errp); +} + +static Property virtio_serial_pci_properties[] =3D { + DEFINE_PROP_BIT("ioeventfd", VirtIOPCIProxy, flags, + VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT, true), + DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 2), + DEFINE_PROP_UINT32("class", VirtIOPCIProxy, class_code, 0), + DEFINE_PROP_END_OF_LIST(), +}; + +static void virtio_serial_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); + k->realize =3D virtio_serial_pci_realize; + set_bit(DEVICE_CATEGORY_INPUT, dc->categories); + dc->props =3D virtio_serial_pci_properties; + pcidev_k->vendor_id =3D PCI_VENDOR_ID_REDHAT_QUMRANET; + pcidev_k->device_id =3D PCI_DEVICE_ID_VIRTIO_CONSOLE; + pcidev_k->revision =3D VIRTIO_PCI_ABI_VERSION; + pcidev_k->class_id =3D PCI_CLASS_COMMUNICATION_OTHER; +} + +static void virtio_serial_pci_instance_init(Object *obj) +{ + VirtIOSerialPCI *dev =3D VIRTIO_SERIAL_PCI(obj); + + virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), + TYPE_VIRTIO_SERIAL); +} + +static const TypeInfo virtio_serial_pci_info =3D { + .name =3D TYPE_VIRTIO_SERIAL_PCI, + .parent =3D TYPE_VIRTIO_PCI, + .instance_size =3D sizeof(VirtIOSerialPCI), + .instance_init =3D virtio_serial_pci_instance_init, + .class_init =3D virtio_serial_pci_class_init, +}; +static void virtio_serial_pci_register(void) +{ + type_register_static(&virtio_serial_pci_info); +} + +type_init(virtio_serial_pci_register) diff --git a/tests/Makefile.include b/tests/Makefile.include index 0a3878f3ab..d09a6af706 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -107,7 +107,7 @@ check-unit-y +=3D tests/test-crypto-secret$(EXESUF) check-unit-$(CONFIG_GNUTLS) +=3D tests/test-crypto-tlscredsx509$(EXESUF) check-unit-$(CONFIG_GNUTLS) +=3D tests/test-crypto-tlssession$(EXESUF) ifneq (,$(findstring qemu-ga,$(TOOLS))) -check-unit-$(CONFIG_LINUX) +=3D tests/test-qga$(EXESUF) +check-unit-$(land,$(CONFIG_LINUX),$(CONFIG_VIRTIO_SERIAL)) +=3D tests/test= -qga$(EXESUF) endif check-unit-y +=3D tests/test-timed-average$(EXESUF) check-unit-y +=3D tests/test-util-sockets$(EXESUF) @@ -143,7 +143,7 @@ check-qtest-generic-y +=3D tests/cdrom-test$(EXESUF) =20 check-qtest-ipack-y +=3D tests/ipoctal232-test$(EXESUF) =20 -check-qtest-virtioserial-y +=3D tests/virtio-console-test$(EXESUF) +check-qtest-virtioserial-$(CONFIG_VIRTIO_SERIAL) +=3D tests/virtio-console= -test$(EXESUF) =20 check-qtest-virtio-$(CONFIG_VIRTIO_NET) +=3D tests/virtio-net-test$(EXESUF) check-qtest-virtio-$(CONFIG_VIRTIO_BALLOON) +=3D tests/virtio-balloon-test= $(EXESUF) @@ -153,7 +153,7 @@ check-qtest-virtio-$(CONFIG_VIRTIO_SCSI) +=3D tests/vir= tio-scsi-test$(EXESUF) ifeq ($(CONFIG_VIRTIO)$(CONFIG_VIRTFS)$(CONFIG_PCI),yyy) check-qtest-virtio-y +=3D tests/virtio-9p-test$(EXESUF) endif -check-qtest-virtio-y +=3D tests/virtio-serial-test$(EXESUF) +check-qtest-virtio-$(CONFIG_VIRTIO_SERIAL) +=3D tests/virtio-serial-test$(= EXESUF) check-qtest-virtio-y +=3D $(check-qtest-virtioserial-y) =20 check-qtest-pci-y +=3D tests/e1000-test$(EXESUF) --=20 2.19.1 From nobody Mon Feb 9 15:10:39 2026 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543263737342727.8523028820883; Mon, 26 Nov 2018 12:22:17 -0800 (PST) Received: from localhost ([::1]:38643 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRNOV-0008B9-Vy for importer@patchew.org; Mon, 26 Nov 2018 15:22:12 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52649) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRN5a-0007FL-Bs for qemu-devel@nongnu.org; Mon, 26 Nov 2018 15:02:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRN5Y-0008Dv-9g for qemu-devel@nongnu.org; Mon, 26 Nov 2018 15:02:38 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60840) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRN5Y-0008Dh-3P for qemu-devel@nongnu.org; Mon, 26 Nov 2018 15:02:36 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 44CE13E2D2 for ; Mon, 26 Nov 2018 20:02:35 +0000 (UTC) Received: from localhost.localdomain (unknown [10.36.118.114]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4E70219483; Mon, 26 Nov 2018 20:02:31 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Mon, 26 Nov 2018 21:00:07 +0100 Message-Id: <20181126200009.862-15-quintela@redhat.com> In-Reply-To: <20181126200009.862-1-quintela@redhat.com> References: <20181126200009.862-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 26 Nov 2018 20:02:35 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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 v2 14/16] virtio: split virtio gpu bits rom virtio-pci.h 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: lvivier@redhat.com, dgilbert@redhat.com, peterx@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Laurent Vivier --- hw/display/virtio-gpu-pci.c | 14 ++++++++++++++ hw/display/virtio-vga.c | 1 + hw/virtio/virtio-pci.h | 14 -------------- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/hw/display/virtio-gpu-pci.c b/hw/display/virtio-gpu-pci.c index cece4aa495..fa126cf3e4 100644 --- a/hw/display/virtio-gpu-pci.c +++ b/hw/display/virtio-gpu-pci.c @@ -19,6 +19,20 @@ #include "hw/virtio/virtio-pci.h" #include "hw/virtio/virtio-gpu.h" =20 +typedef struct VirtIOGPUPCI VirtIOGPUPCI; + +/* + * virtio-gpu-pci: This extends VirtioPCIProxy. + */ +#define TYPE_VIRTIO_GPU_PCI "virtio-gpu-pci" +#define VIRTIO_GPU_PCI(obj) \ + OBJECT_CHECK(VirtIOGPUPCI, (obj), TYPE_VIRTIO_GPU_PCI) + +struct VirtIOGPUPCI { + VirtIOPCIProxy parent_obj; + VirtIOGPU vdev; +}; + static Property virtio_gpu_pci_properties[] =3D { DEFINE_VIRTIO_GPU_PCI_PROPERTIES(VirtIOPCIProxy), DEFINE_PROP_END_OF_LIST(), diff --git a/hw/display/virtio-vga.c b/hw/display/virtio-vga.c index ab2e369b28..797994cf00 100644 --- a/hw/display/virtio-vga.c +++ b/hw/display/virtio-vga.c @@ -3,6 +3,7 @@ #include "hw/pci/pci.h" #include "vga_int.h" #include "hw/virtio/virtio-pci.h" +#include "hw/virtio/virtio-gpu.h" #include "qapi/error.h" =20 /* diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h index 59016d553b..91981b39f9 100644 --- a/hw/virtio/virtio-pci.h +++ b/hw/virtio/virtio-pci.h @@ -17,11 +17,9 @@ =20 #include "hw/pci/msi.h" #include "hw/virtio/virtio-bus.h" -#include "hw/virtio/virtio-gpu.h" #include "hw/virtio/virtio-crypto.h" =20 typedef struct VirtIOPCIProxy VirtIOPCIProxy; -typedef struct VirtIOGPUPCI VirtIOGPUPCI; typedef struct VirtIOCryptoPCI VirtIOCryptoPCI; =20 /* virtio-pci-bus */ @@ -184,18 +182,6 @@ static inline void virtio_pci_disable_modern(VirtIOPCI= Proxy *proxy) */ #define TYPE_VIRTIO_INPUT_PCI "virtio-input-pci" =20 -/* - * virtio-gpu-pci: This extends VirtioPCIProxy. - */ -#define TYPE_VIRTIO_GPU_PCI "virtio-gpu-pci" -#define VIRTIO_GPU_PCI(obj) \ - OBJECT_CHECK(VirtIOGPUPCI, (obj), TYPE_VIRTIO_GPU_PCI) - -struct VirtIOGPUPCI { - VirtIOPCIProxy parent_obj; - VirtIOGPU vdev; -}; - /* * virtio-crypto-pci: This extends VirtioPCIProxy. */ --=20 2.19.1 From nobody Mon Feb 9 15:10:39 2026 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543263050893540.876719526989; Mon, 26 Nov 2018 12:10:50 -0800 (PST) Received: from localhost ([::1]:38570 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRNDV-0006ay-NA for importer@patchew.org; Mon, 26 Nov 2018 15:10:49 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52715) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRN5e-0007Hm-TJ for qemu-devel@nongnu.org; Mon, 26 Nov 2018 15:02:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRN5c-0008Fh-VL for qemu-devel@nongnu.org; Mon, 26 Nov 2018 15:02:42 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49092) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRN5c-0008FB-Nw for qemu-devel@nongnu.org; Mon, 26 Nov 2018 15:02:40 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 94F2D45CD2 for ; Mon, 26 Nov 2018 20:02:39 +0000 (UTC) Received: from localhost.localdomain (unknown [10.36.118.114]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9966D19C65; Mon, 26 Nov 2018 20:02:35 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Mon, 26 Nov 2018 21:00:08 +0100 Message-Id: <20181126200009.862-16-quintela@redhat.com> In-Reply-To: <20181126200009.862-1-quintela@redhat.com> References: <20181126200009.862-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 26 Nov 2018 20:02:39 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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 v2 15/16] virtio: split virtio crypto bits rom virtio-pci.h 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: lvivier@redhat.com, dgilbert@redhat.com, peterx@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Laurent Vivier --- hw/virtio/virtio-crypto-pci.c | 14 ++++++++++++++ hw/virtio/virtio-pci.h | 14 -------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/hw/virtio/virtio-crypto-pci.c b/hw/virtio/virtio-crypto-pci.c index bf64996e48..1b242d3037 100644 --- a/hw/virtio/virtio-crypto-pci.c +++ b/hw/virtio/virtio-crypto-pci.c @@ -19,6 +19,20 @@ #include "hw/virtio/virtio-crypto.h" #include "qapi/error.h" =20 +typedef struct VirtIOCryptoPCI VirtIOCryptoPCI; + +/* + * virtio-crypto-pci: This extends VirtioPCIProxy. + */ +#define TYPE_VIRTIO_CRYPTO_PCI "virtio-crypto-pci" +#define VIRTIO_CRYPTO_PCI(obj) \ + OBJECT_CHECK(VirtIOCryptoPCI, (obj), TYPE_VIRTIO_CRYPTO_PCI) + +struct VirtIOCryptoPCI { + VirtIOPCIProxy parent_obj; + VirtIOCrypto vdev; +}; + static Property virtio_crypto_pci_properties[] =3D { DEFINE_PROP_BIT("ioeventfd", VirtIOPCIProxy, flags, VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT, true), diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h index 91981b39f9..bead9e5fa5 100644 --- a/hw/virtio/virtio-pci.h +++ b/hw/virtio/virtio-pci.h @@ -17,10 +17,8 @@ =20 #include "hw/pci/msi.h" #include "hw/virtio/virtio-bus.h" -#include "hw/virtio/virtio-crypto.h" =20 typedef struct VirtIOPCIProxy VirtIOPCIProxy; -typedef struct VirtIOCryptoPCI VirtIOCryptoPCI; =20 /* virtio-pci-bus */ =20 @@ -182,18 +180,6 @@ static inline void virtio_pci_disable_modern(VirtIOPCI= Proxy *proxy) */ #define TYPE_VIRTIO_INPUT_PCI "virtio-input-pci" =20 -/* - * virtio-crypto-pci: This extends VirtioPCIProxy. - */ -#define TYPE_VIRTIO_CRYPTO_PCI "virtio-crypto-pci" -#define VIRTIO_CRYPTO_PCI(obj) \ - OBJECT_CHECK(VirtIOCryptoPCI, (obj), TYPE_VIRTIO_CRYPTO_PCI) - -struct VirtIOCryptoPCI { - VirtIOPCIProxy parent_obj; - VirtIOCrypto vdev; -}; - /* Virtio ABI version, if we increment this, we break the guest driver. */ #define VIRTIO_PCI_ABI_VERSION 0 =20 --=20 2.19.1 From nobody Mon Feb 9 15:10:39 2026 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543263089561169.1981642429031; Mon, 26 Nov 2018 12:11:29 -0800 (PST) Received: from localhost ([::1]:38574 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRNE8-00078j-5u for importer@patchew.org; Mon, 26 Nov 2018 15:11:28 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52729) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRN5g-0007JH-9X for qemu-devel@nongnu.org; Mon, 26 Nov 2018 15:02:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRN5e-0008GI-LZ for qemu-devel@nongnu.org; Mon, 26 Nov 2018 15:02:44 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40220) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRN5e-0008G0-E9 for qemu-devel@nongnu.org; Mon, 26 Nov 2018 15:02:42 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4F4B3308124B for ; Mon, 26 Nov 2018 20:02:41 +0000 (UTC) Received: from localhost.localdomain (unknown [10.36.118.114]) by smtp.corp.redhat.com (Postfix) with ESMTP id E8F9819C65; Mon, 26 Nov 2018 20:02:39 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Mon, 26 Nov 2018 21:00:09 +0100 Message-Id: <20181126200009.862-17-quintela@redhat.com> In-Reply-To: <20181126200009.862-1-quintela@redhat.com> References: <20181126200009.862-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Mon, 26 Nov 2018 20:02:41 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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 v2 16/16] virtio: virtio 9p really requires CONFIG_VIRTFS to work 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: lvivier@redhat.com, dgilbert@redhat.com, peterx@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Otherwise, it has no implementation. Signed-off-by: Juan Quintela --- default-configs/virtio.mak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/default-configs/virtio.mak b/default-configs/virtio.mak index 5ae4a61018..ecb4420e74 100644 --- a/default-configs/virtio.mak +++ b/default-configs/virtio.mak @@ -1,7 +1,7 @@ CONFIG_VHOST_USER_SCSI=3D$(call land,$(CONFIG_VHOST_USER),$(CONFIG_LINUX)) CONFIG_VHOST_USER_BLK=3D$(call land,$(CONFIG_VHOST_USER),$(CONFIG_LINUX)) CONFIG_VIRTIO=3Dy -CONFIG_VIRTIO_9P=3Dy +CONFIG_VIRTIO_9P=3D$(CONFIG_VIRTFS) CONFIG_VIRTIO_BALLOON=3Dy CONFIG_VIRTIO_BLK=3Dy CONFIG_VIRTIO_CRYPTO=3Dy --=20 2.19.1