From nobody Mon Feb 9 13:15:35 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 1535543976072479.3962704866078; Wed, 29 Aug 2018 04:59:36 -0700 (PDT) Received: from localhost ([::1]:42528 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fuz8I-0004Po-R7 for importer@patchew.org; Wed, 29 Aug 2018 07:59:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42857) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fuyqx-0001gO-Ft for qemu-devel@nongnu.org; Wed, 29 Aug 2018 07:41:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fuynC-0007LC-AN for qemu-devel@nongnu.org; Wed, 29 Aug 2018 07:37:48 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:56592 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fuynC-0007L2-4w for qemu-devel@nongnu.org; Wed, 29 Aug 2018 07:37:46 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CFCDB8574D for ; Wed, 29 Aug 2018 11:37:45 +0000 (UTC) Received: from secure.mitica (ovpn-116-35.ams2.redhat.com [10.36.116.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id 854CA2026D6D; Wed, 29 Aug 2018 11:37:44 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 29 Aug 2018 13:37:15 +0200 Message-Id: <20180829113730.14992-2-quintela@redhat.com> In-Reply-To: <20180829113730.14992-1-quintela@redhat.com> References: <20180829113730.14992-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Wed, 29 Aug 2018 11:37:45 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Wed, 29 Aug 2018 11:37:45 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'quintela@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH 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, mst@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- 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 3a01fe90f0..66e280aea1 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.17.1 From nobody Mon Feb 9 13:15:35 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 1535543435037294.0134994484662; Wed, 29 Aug 2018 04:50:35 -0700 (PDT) Received: from localhost ([::1]:42476 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fuyzX-0002VQ-Qp for importer@patchew.org; Wed, 29 Aug 2018 07:50:31 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42929) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fuyqx-0001kp-F6 for qemu-devel@nongnu.org; Wed, 29 Aug 2018 07:41:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fuynD-0007LX-S2 for qemu-devel@nongnu.org; Wed, 29 Aug 2018 07:37:48 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:47506 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fuynD-0007LR-Mq for qemu-devel@nongnu.org; Wed, 29 Aug 2018 07:37:47 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 604DFB5CA for ; Wed, 29 Aug 2018 11:37:47 +0000 (UTC) Received: from secure.mitica (ovpn-116-35.ams2.redhat.com [10.36.116.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id 21BC02026D6D; Wed, 29 Aug 2018 11:37:45 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 29 Aug 2018 13:37:16 +0200 Message-Id: <20180829113730.14992-3-quintela@redhat.com> In-Reply-To: <20180829113730.14992-1-quintela@redhat.com> References: <20180829113730.14992-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Wed, 29 Aug 2018 11:37:47 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Wed, 29 Aug 2018 11:37:47 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'quintela@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH 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, mst@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- 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 66e280aea1..3ecd5954b2 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.17.1 From nobody Mon Feb 9 13:15:35 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 1535543038903522.8258321886959; Wed, 29 Aug 2018 04:43:58 -0700 (PDT) Received: from localhost ([::1]:42444 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fuytB-0004dA-7G for importer@patchew.org; Wed, 29 Aug 2018 07:43:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42829) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fuyqx-0001cf-Dk for qemu-devel@nongnu.org; Wed, 29 Aug 2018 07:41:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fuynF-0007M2-Cv for qemu-devel@nongnu.org; Wed, 29 Aug 2018 07:37:51 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:35892 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fuynF-0007Lt-71 for qemu-devel@nongnu.org; Wed, 29 Aug 2018 07:37:49 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DF7ED40216F9 for ; Wed, 29 Aug 2018 11:37:48 +0000 (UTC) Received: from secure.mitica (ovpn-116-35.ams2.redhat.com [10.36.116.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id A5A802026D6D; Wed, 29 Aug 2018 11:37:47 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 29 Aug 2018 13:37:17 +0200 Message-Id: <20180829113730.14992-4-quintela@redhat.com> In-Reply-To: <20180829113730.14992-1-quintela@redhat.com> References: <20180829113730.14992-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Wed, 29 Aug 2018 11:37:48 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Wed, 29 Aug 2018 11:37:48 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'quintela@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH 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, mst@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- 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 3ecd5954b2..7c19a6f1a5 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.17.1 From nobody Mon Feb 9 13:15:35 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 1535544098547750.0780979813892; Wed, 29 Aug 2018 05:01:38 -0700 (PDT) Received: from localhost ([::1]:42591 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fuzA8-0005fb-UN for importer@patchew.org; Wed, 29 Aug 2018 08:01:28 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42693) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fuyqx-0001VR-CY for qemu-devel@nongnu.org; Wed, 29 Aug 2018 07:41:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fuynI-0007Mh-5b for qemu-devel@nongnu.org; Wed, 29 Aug 2018 07:37:53 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:49626 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fuynI-0007MZ-06 for qemu-devel@nongnu.org; Wed, 29 Aug 2018 07:37:52 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AC63640241C0 for ; Wed, 29 Aug 2018 11:37:51 +0000 (UTC) Received: from secure.mitica (ovpn-116-35.ams2.redhat.com [10.36.116.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id 309F22026D6D; Wed, 29 Aug 2018 11:37:49 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 29 Aug 2018 13:37:18 +0200 Message-Id: <20180829113730.14992-5-quintela@redhat.com> In-Reply-To: <20180829113730.14992-1-quintela@redhat.com> References: <20180829113730.14992-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 29 Aug 2018 11:37:51 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 29 Aug 2018 11:37:51 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'quintela@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH 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, mst@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- 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 | 4 +- 5 files changed, 89 insertions(+), 68 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 7c19a6f1a5..63700f5548 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 87c81d1dcc..739124b540 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -203,8 +203,8 @@ check-qtest-virtio-y +=3D tests/virtio-balloon-test$(EX= ESUF) gcov-files-virtio-y +=3D i386-softmmu/hw/virtio/virtio-balloon.c check-qtest-virtio-y +=3D tests/virtio-blk-test$(EXESUF) gcov-files-virtio-y +=3D i386-softmmu/hw/block/virtio-blk.c -check-qtest-virtio-y +=3D tests/virtio-rng-test$(EXESUF) -gcov-files-virtio-y +=3D hw/virtio/virtio-rng.c +check-qtest-virtio-$(CONFIG_VIRTIO_RNG) +=3D tests/virtio-rng-test$(EXESUF) +gcov-files-virtio-$(CONFIG_VIRTIO_RNG) +=3D hw/virtio/virtio-rng.c check-qtest-virtio-y +=3D tests/virtio-scsi-test$(EXESUF) gcov-files-virtio-y +=3D i386-softmmu/hw/scsi/virtio-scsi.c ifeq ($(CONFIG_VIRTIO)$(CONFIG_VIRTFS)$(CONFIG_PCI),yyy) --=20 2.17.1 From nobody Mon Feb 9 13:15:35 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 1535543869946979.3232853375933; Wed, 29 Aug 2018 04:57:49 -0700 (PDT) Received: from localhost ([::1]:42522 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fuz6a-0002RZ-MW for importer@patchew.org; Wed, 29 Aug 2018 07:57:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42929) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fuyqt-0001kp-Bj for qemu-devel@nongnu.org; Wed, 29 Aug 2018 07:41:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fuynJ-0007N5-NO for qemu-devel@nongnu.org; Wed, 29 Aug 2018 07:37:55 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:51490 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fuynJ-0007Mx-HO for qemu-devel@nongnu.org; Wed, 29 Aug 2018 07:37:53 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 381A68077102 for ; Wed, 29 Aug 2018 11:37:53 +0000 (UTC) Received: from secure.mitica (ovpn-116-35.ams2.redhat.com [10.36.116.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id F11982026D6D; Wed, 29 Aug 2018 11:37:51 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 29 Aug 2018 13:37:19 +0200 Message-Id: <20180829113730.14992-6-quintela@redhat.com> In-Reply-To: <20180829113730.14992-1-quintela@redhat.com> References: <20180829113730.14992-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Wed, 29 Aug 2018 11:37:53 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Wed, 29 Aug 2018 11:37:53 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'quintela@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH 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, mst@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Thomas Huth Signed-off-by: Juan Quintela --- 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 | 4 +- 5 files changed, 97 insertions(+), 74 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 63700f5548..4bb2a5aab2 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 739124b540..8c23270d4c 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -199,8 +199,8 @@ gcov-files-virtioserial-y +=3D hw/char/virtio-console.c gcov-files-virtio-y +=3D i386-softmmu/hw/virtio/virtio.c check-qtest-virtio-y +=3D tests/virtio-net-test$(EXESUF) gcov-files-virtio-y +=3D i386-softmmu/hw/net/virtio-net.c -check-qtest-virtio-y +=3D tests/virtio-balloon-test$(EXESUF) -gcov-files-virtio-y +=3D i386-softmmu/hw/virtio/virtio-balloon.c +check-qtest-virtio-$(CONFIG_VIRTIO_BALLOON) +=3D tests/virtio-balloon-test= $(EXESUF) +gcov-files-virtio-$(CONFIG_VIRTIO_BALLOON) +=3D i386-softmmu/hw/virtio/vir= tio-balloon.c check-qtest-virtio-y +=3D tests/virtio-blk-test$(EXESUF) gcov-files-virtio-y +=3D i386-softmmu/hw/block/virtio-blk.c check-qtest-virtio-$(CONFIG_VIRTIO_RNG) +=3D tests/virtio-rng-test$(EXESUF) --=20 2.17.1 From nobody Mon Feb 9 13:15:35 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 1535543238259843.4405515147511; Wed, 29 Aug 2018 04:47:18 -0700 (PDT) Received: from localhost ([::1]:42464 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fuywP-00072J-0V for importer@patchew.org; Wed, 29 Aug 2018 07:47:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42829) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fuyqr-0001cf-1w for qemu-devel@nongnu.org; Wed, 29 Aug 2018 07:41:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fuynL-0007NZ-88 for qemu-devel@nongnu.org; Wed, 29 Aug 2018 07:37:58 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:56600 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fuynL-0007NN-2G for qemu-devel@nongnu.org; Wed, 29 Aug 2018 07:37:55 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BB5398574D for ; Wed, 29 Aug 2018 11:37:54 +0000 (UTC) Received: from secure.mitica (ovpn-116-35.ams2.redhat.com [10.36.116.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7D4E52026D6D; Wed, 29 Aug 2018 11:37:53 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 29 Aug 2018 13:37:20 +0200 Message-Id: <20180829113730.14992-7-quintela@redhat.com> In-Reply-To: <20180829113730.14992-1-quintela@redhat.com> References: <20180829113730.14992-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Wed, 29 Aug 2018 11:37:54 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Wed, 29 Aug 2018 11:37:54 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'quintela@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH 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, mst@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- 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 4bb2a5aab2..ab2f5c93cf 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.17.1 From nobody Mon Feb 9 13:15:35 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 1535543583590158.35340997038372; Wed, 29 Aug 2018 04:53:03 -0700 (PDT) Received: from localhost ([::1]:42493 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fuz1x-0004yU-HZ for importer@patchew.org; Wed, 29 Aug 2018 07:53:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42857) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fuyqr-0001gO-0Z for qemu-devel@nongnu.org; Wed, 29 Aug 2018 07:41:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fuynM-0007Ns-PM for qemu-devel@nongnu.org; Wed, 29 Aug 2018 07:37:58 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:47510 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fuynM-0007Nm-Jh for qemu-devel@nongnu.org; Wed, 29 Aug 2018 07:37:56 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 49B3F9BA91 for ; Wed, 29 Aug 2018 11:37:56 +0000 (UTC) Received: from secure.mitica (ovpn-116-35.ams2.redhat.com [10.36.116.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0C1092026D6D; Wed, 29 Aug 2018 11:37:54 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 29 Aug 2018 13:37:21 +0200 Message-Id: <20180829113730.14992-8-quintela@redhat.com> In-Reply-To: <20180829113730.14992-1-quintela@redhat.com> References: <20180829113730.14992-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Wed, 29 Aug 2018 11:37:56 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Wed, 29 Aug 2018 11:37:56 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'quintela@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH 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, mst@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Reviewed-by: Thomas Huth Signed-off-by: Juan Quintela --- 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 ab2f5c93cf..64f53471d4 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.17.1 From nobody Mon Feb 9 13:15:35 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 1535543420235931.3544490828451; Wed, 29 Aug 2018 04:50:20 -0700 (PDT) Received: from localhost ([::1]:42475 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fuyzK-0002MF-Ub for importer@patchew.org; Wed, 29 Aug 2018 07:50:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42693) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fuyqq-0001VR-Vh for qemu-devel@nongnu.org; Wed, 29 Aug 2018 07:41:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fuynQ-0007Oc-2c for qemu-devel@nongnu.org; Wed, 29 Aug 2018 07:38:01 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:49640 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fuynP-0007OU-TQ for qemu-devel@nongnu.org; Wed, 29 Aug 2018 07:38:00 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9707E4000783 for ; Wed, 29 Aug 2018 11:37:59 +0000 (UTC) Received: from secure.mitica (ovpn-116-35.ams2.redhat.com [10.36.116.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8E13E2026D6D; Wed, 29 Aug 2018 11:37:56 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 29 Aug 2018 13:37:22 +0200 Message-Id: <20180829113730.14992-9-quintela@redhat.com> In-Reply-To: <20180829113730.14992-1-quintela@redhat.com> References: <20180829113730.14992-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Wed, 29 Aug 2018 11:37:59 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Wed, 29 Aug 2018 11:37:59 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'quintela@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH 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, mst@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- 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 64f53471d4..7bc2ba6cb2 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.17.1 From nobody Mon Feb 9 13:15:35 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 1535543742550697.0841279356096; Wed, 29 Aug 2018 04:55:42 -0700 (PDT) Received: from localhost ([::1]:42509 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fuz4O-0008Bw-8x for importer@patchew.org; Wed, 29 Aug 2018 07:55:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42829) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fuyqm-0001cf-H4 for qemu-devel@nongnu.org; Wed, 29 Aug 2018 07:41:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fuynT-0007Qt-EB for qemu-devel@nongnu.org; Wed, 29 Aug 2018 07:38:04 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:51492 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fuynT-0007QU-8Y for qemu-devel@nongnu.org; Wed, 29 Aug 2018 07:38:03 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id ED6B68076895 for ; Wed, 29 Aug 2018 11:38:02 +0000 (UTC) Received: from secure.mitica (ovpn-116-35.ams2.redhat.com [10.36.116.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id DBB352026D6D; Wed, 29 Aug 2018 11:37:59 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 29 Aug 2018 13:37:23 +0200 Message-Id: <20180829113730.14992-10-quintela@redhat.com> In-Reply-To: <20180829113730.14992-1-quintela@redhat.com> References: <20180829113730.14992-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Wed, 29 Aug 2018 11:38:02 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Wed, 29 Aug 2018 11:38:02 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'quintela@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH 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, mst@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- 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 7bc2ba6cb2..fa37f36e02 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.17.1 From nobody Mon Feb 9 13:15:35 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 1535543225835443.2374275589723; Wed, 29 Aug 2018 04:47:05 -0700 (PDT) Received: from localhost ([::1]:42463 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fuywC-0006uQ-FV for importer@patchew.org; Wed, 29 Aug 2018 07:47:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42693) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fuyqm-0001VR-9s for qemu-devel@nongnu.org; Wed, 29 Aug 2018 07:41:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fuynU-0007RG-Vq for qemu-devel@nongnu.org; Wed, 29 Aug 2018 07:38:08 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:35904 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fuynU-0007R9-QD for qemu-devel@nongnu.org; Wed, 29 Aug 2018 07:38:04 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7BB2B40216E7 for ; Wed, 29 Aug 2018 11:38:04 +0000 (UTC) Received: from secure.mitica (ovpn-116-35.ams2.redhat.com [10.36.116.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3E9AD2026D6D; Wed, 29 Aug 2018 11:38:03 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 29 Aug 2018 13:37:24 +0200 Message-Id: <20180829113730.14992-11-quintela@redhat.com> In-Reply-To: <20180829113730.14992-1-quintela@redhat.com> References: <20180829113730.14992-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Wed, 29 Aug 2018 11:38:04 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Wed, 29 Aug 2018 11:38:04 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'quintela@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH 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, mst@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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 --- 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 | 4 +- 5 files changed, 109 insertions(+), 85 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 fa37f36e02..9fc3dd5bf6 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 8c23270d4c..0d46fa5b74 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -205,8 +205,8 @@ check-qtest-virtio-y +=3D tests/virtio-blk-test$(EXESUF) gcov-files-virtio-y +=3D i386-softmmu/hw/block/virtio-blk.c check-qtest-virtio-$(CONFIG_VIRTIO_RNG) +=3D tests/virtio-rng-test$(EXESUF) gcov-files-virtio-$(CONFIG_VIRTIO_RNG) +=3D hw/virtio/virtio-rng.c -check-qtest-virtio-y +=3D tests/virtio-scsi-test$(EXESUF) -gcov-files-virtio-y +=3D i386-softmmu/hw/scsi/virtio-scsi.c +check-qtest-virtio-$(CONFIG_VIRTIO_SCSI) +=3D tests/virtio-scsi-test$(EXES= UF) +gcov-files-virtio-$(CONFIG_VIRTIO_SCSI) +=3D i386-softmmu/hw/scsi/virtio-s= csi.c ifeq ($(CONFIG_VIRTIO)$(CONFIG_VIRTFS)$(CONFIG_PCI),yyy) check-qtest-virtio-y +=3D tests/virtio-9p-test$(EXESUF) gcov-files-virtio-y +=3D hw/9pfs/virtio-9p.c --=20 2.17.1 From nobody Mon Feb 9 13:15:35 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 1535543402100668.3580386380735; Wed, 29 Aug 2018 04:50:02 -0700 (PDT) Received: from localhost ([::1]:42474 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fuyyx-000271-Re for importer@patchew.org; Wed, 29 Aug 2018 07:49:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42857) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fuyqm-0001gO-2B for qemu-devel@nongnu.org; Wed, 29 Aug 2018 07:41:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fuynW-0007Rj-Fn for qemu-devel@nongnu.org; Wed, 29 Aug 2018 07:38:08 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:49634 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fuynW-0007Rb-A5 for qemu-devel@nongnu.org; Wed, 29 Aug 2018 07:38:06 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0193A40241C0 for ; Wed, 29 Aug 2018 11:38:06 +0000 (UTC) Received: from secure.mitica (ovpn-116-35.ams2.redhat.com [10.36.116.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id BCB372026D6D; Wed, 29 Aug 2018 11:38:04 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 29 Aug 2018 13:37:25 +0200 Message-Id: <20180829113730.14992-12-quintela@redhat.com> In-Reply-To: <20180829113730.14992-1-quintela@redhat.com> References: <20180829113730.14992-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 29 Aug 2018 11:38:06 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 29 Aug 2018 11:38:06 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'quintela@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH 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, mst@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Reviewed-by: Thomas Huth Signed-off-by: Juan Quintela --- 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 | 4 +- 5 files changed, 100 insertions(+), 75 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 9fc3dd5bf6..bbb8f8e216 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 0d46fa5b74..405755b2de 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -201,8 +201,8 @@ check-qtest-virtio-y +=3D tests/virtio-net-test$(EXESUF) gcov-files-virtio-y +=3D i386-softmmu/hw/net/virtio-net.c check-qtest-virtio-$(CONFIG_VIRTIO_BALLOON) +=3D tests/virtio-balloon-test= $(EXESUF) gcov-files-virtio-$(CONFIG_VIRTIO_BALLOON) +=3D i386-softmmu/hw/virtio/vir= tio-balloon.c -check-qtest-virtio-y +=3D tests/virtio-blk-test$(EXESUF) -gcov-files-virtio-y +=3D i386-softmmu/hw/block/virtio-blk.c +check-qtest-virtio-$(CONFIG_VIRTIO_BLK) +=3D tests/virtio-blk-test$(EXESUF) +gcov-files-virtio-$(CONFIG_VIRTIO_BLK) +=3D i386-softmmu/hw/block/virtio-b= lk.c check-qtest-virtio-$(CONFIG_VIRTIO_RNG) +=3D tests/virtio-rng-test$(EXESUF) gcov-files-virtio-$(CONFIG_VIRTIO_RNG) +=3D hw/virtio/virtio-rng.c check-qtest-virtio-$(CONFIG_VIRTIO_SCSI) +=3D tests/virtio-scsi-test$(EXES= UF) --=20 2.17.1 From nobody Mon Feb 9 13:15:35 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 1535543396788295.31176758884317; Wed, 29 Aug 2018 04:49:56 -0700 (PDT) Received: from localhost ([::1]:42473 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fuyys-000238-Ss for importer@patchew.org; Wed, 29 Aug 2018 07:49:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42693) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fuyqk-0001VR-Sg for qemu-devel@nongnu.org; Wed, 29 Aug 2018 07:41:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fuynY-0007SB-0I for qemu-devel@nongnu.org; Wed, 29 Aug 2018 07:38:09 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:47514 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fuynX-0007S5-R8 for qemu-devel@nongnu.org; Wed, 29 Aug 2018 07:38:07 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 840D087A82 for ; Wed, 29 Aug 2018 11:38:07 +0000 (UTC) Received: from secure.mitica (ovpn-116-35.ams2.redhat.com [10.36.116.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id 458DC2026D6D; Wed, 29 Aug 2018 11:38:06 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 29 Aug 2018 13:37:26 +0200 Message-Id: <20180829113730.14992-13-quintela@redhat.com> In-Reply-To: <20180829113730.14992-1-quintela@redhat.com> References: <20180829113730.14992-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Wed, 29 Aug 2018 11:38:07 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Wed, 29 Aug 2018 11:38:07 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'quintela@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH 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, mst@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Reviewed-by: Thomas Huth Signed-off-by: Juan Quintela --- 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 | 4 +- 5 files changed, 99 insertions(+), 73 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 bbb8f8e216..5c075f0887 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 405755b2de..a9140043ed 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -197,8 +197,8 @@ check-qtest-virtioserial-y +=3D tests/virtio-console-te= st$(EXESUF) gcov-files-virtioserial-y +=3D hw/char/virtio-console.c =20 gcov-files-virtio-y +=3D i386-softmmu/hw/virtio/virtio.c -check-qtest-virtio-y +=3D tests/virtio-net-test$(EXESUF) -gcov-files-virtio-y +=3D i386-softmmu/hw/net/virtio-net.c +check-qtest-virtio-$(CONFIG_VIRTIO_NET) +=3D tests/virtio-net-test$(EXESUF) +gcov-files-virtio-$(CONFIG_VIRTIO_NET) +=3D i386-softmmu/hw/net/virtio-net= .c check-qtest-virtio-$(CONFIG_VIRTIO_BALLOON) +=3D tests/virtio-balloon-test= $(EXESUF) gcov-files-virtio-$(CONFIG_VIRTIO_BALLOON) +=3D i386-softmmu/hw/virtio/vir= tio-balloon.c check-qtest-virtio-$(CONFIG_VIRTIO_BLK) +=3D tests/virtio-blk-test$(EXESUF) --=20 2.17.1 From nobody Mon Feb 9 13:15:35 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 153554358011622.285425749021897; Wed, 29 Aug 2018 04:53:00 -0700 (PDT) Received: from localhost ([::1]:42492 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fuz1u-0004hk-RO for importer@patchew.org; Wed, 29 Aug 2018 07:52:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42829) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fuyqk-0001cf-Ro for qemu-devel@nongnu.org; Wed, 29 Aug 2018 07:41:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fuynZ-0007Sh-Io for qemu-devel@nongnu.org; Wed, 29 Aug 2018 07:38:11 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:35910 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fuynZ-0007SZ-Ce for qemu-devel@nongnu.org; Wed, 29 Aug 2018 07:38:09 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 10EF240216E7 for ; Wed, 29 Aug 2018 11:38:09 +0000 (UTC) Received: from secure.mitica (ovpn-116-35.ams2.redhat.com [10.36.116.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id C70E92026D6D; Wed, 29 Aug 2018 11:38:07 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 29 Aug 2018 13:37:27 +0200 Message-Id: <20180829113730.14992-14-quintela@redhat.com> In-Reply-To: <20180829113730.14992-1-quintela@redhat.com> References: <20180829113730.14992-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Wed, 29 Aug 2018 11:38:09 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Wed, 29 Aug 2018 11:38:09 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'quintela@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH 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, mst@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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 --- 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 | 10 +-- 5 files changed, 118 insertions(+), 94 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 5c075f0887..21a3fdb605 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 a9140043ed..2c36afe7d9 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -149,7 +149,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) @@ -193,8 +193,8 @@ gcov-files-ipack-y +=3D hw/ipack/ipack.c check-qtest-ipack-y +=3D tests/ipoctal232-test$(EXESUF) gcov-files-ipack-y +=3D hw/char/ipoctal232.c =20 -check-qtest-virtioserial-y +=3D tests/virtio-console-test$(EXESUF) -gcov-files-virtioserial-y +=3D hw/char/virtio-console.c +check-qtest-virtioserial-$(CONFIG_VIRTIO_SERIAL) +=3D tests/virtio-console= -test$(EXESUF) +gcov-files-virtioserial-$(CONFIG_VIRTIO_SERIAL) +=3D hw/char/virtio-consol= e.c =20 gcov-files-virtio-y +=3D i386-softmmu/hw/virtio/virtio.c check-qtest-virtio-$(CONFIG_VIRTIO_NET) +=3D tests/virtio-net-test$(EXESUF) @@ -212,8 +212,8 @@ check-qtest-virtio-y +=3D tests/virtio-9p-test$(EXESUF) gcov-files-virtio-y +=3D hw/9pfs/virtio-9p.c gcov-files-virtio-y +=3D i386-softmmu/hw/9pfs/virtio-9p-device.c endif -check-qtest-virtio-y +=3D tests/virtio-serial-test$(EXESUF) -gcov-files-virtio-y +=3D i386-softmmu/hw/char/virtio-serial-bus.c +check-qtest-virtio-$(CONFIG_VIRTIO_SERIAL) +=3D tests/virtio-serial-test$(= EXESUF) +gcov-files-virtio-$(CONFIG_VIRTIO_SERIAL) +=3D i386-softmmu/hw/char/virtio= -serial-bus.c check-qtest-virtio-y +=3D $(check-qtest-virtioserial-y) gcov-files-virtio-y +=3D $(gcov-files-virtioserial-y) =20 --=20 2.17.1 From nobody Mon Feb 9 13:15:35 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 1535543029132173.1344317691943; Wed, 29 Aug 2018 04:43:49 -0700 (PDT) Received: from localhost ([::1]:42443 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fuysy-0004W3-8F for importer@patchew.org; Wed, 29 Aug 2018 07:43:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42857) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fuyqk-0001gO-QE for qemu-devel@nongnu.org; Wed, 29 Aug 2018 07:41:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fuynb-0007V3-9L for qemu-devel@nongnu.org; Wed, 29 Aug 2018 07:38:12 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:35912 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fuynb-0007Tj-0n for qemu-devel@nongnu.org; Wed, 29 Aug 2018 07:38:11 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A776440216E7 for ; Wed, 29 Aug 2018 11:38:10 +0000 (UTC) Received: from secure.mitica (ovpn-116-35.ams2.redhat.com [10.36.116.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id 55DD12026D6D; Wed, 29 Aug 2018 11:38:09 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 29 Aug 2018 13:37:28 +0200 Message-Id: <20180829113730.14992-15-quintela@redhat.com> In-Reply-To: <20180829113730.14992-1-quintela@redhat.com> References: <20180829113730.14992-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Wed, 29 Aug 2018 11:38:10 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Wed, 29 Aug 2018 11:38:10 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'quintela@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH 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, mst@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- hw/display/virtio-gpu-pci.c | 14 ++++++++++++++ hw/display/virtio-vga.c | 1 + hw/virtio/virtio-pci.h | 14 -------------- tests/Makefile.include | 4 ++-- 4 files changed, 17 insertions(+), 16 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 701d980872..15576be290 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. */ diff --git a/tests/Makefile.include b/tests/Makefile.include index 2c36afe7d9..30c493190d 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -246,8 +246,8 @@ check-qtest-pci-y +=3D tests/display-vga-test$(EXESUF) gcov-files-pci-y +=3D hw/display/vga.c gcov-files-pci-y +=3D hw/display/cirrus_vga.c gcov-files-pci-y +=3D hw/display/vga-pci.c -gcov-files-pci-y +=3D hw/display/virtio-gpu.c -gcov-files-pci-y +=3D hw/display/virtio-gpu-pci.c +gcov-files-pci-$(CONFIG_VIRTIO_GPU) +=3D hw/display/virtio-gpu.c +gcov-files-pci-$(CONFIG_VIRTIO_GPU) +=3D hw/display/virtio-gpu-pci.c gcov-files-pci-$(CONFIG_VIRTIO_VGA) +=3D hw/display/virtio-vga.c check-qtest-pci-$(CONFIG_HDA) +=3D tests/intel-hda-test$(EXESUF) gcov-files-pci-$(CONFIG_HDA) +=3D hw/audio/intel-hda.c hw/audio/hda-codec.c --=20 2.17.1 From nobody Mon Feb 9 13:15:35 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 1535543204412969.2652312145265; Wed, 29 Aug 2018 04:46:44 -0700 (PDT) Received: from localhost ([::1]:42462 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fuyvr-0006eC-7x for importer@patchew.org; Wed, 29 Aug 2018 07:46:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42829) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fuyqf-0001cf-Ue for qemu-devel@nongnu.org; Wed, 29 Aug 2018 07:41:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fuync-0007a6-TX for qemu-devel@nongnu.org; Wed, 29 Aug 2018 07:38:13 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:49654 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fuync-0007XV-NL for qemu-devel@nongnu.org; Wed, 29 Aug 2018 07:38:12 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4E03140241C0 for ; Wed, 29 Aug 2018 11:38:12 +0000 (UTC) Received: from secure.mitica (ovpn-116-35.ams2.redhat.com [10.36.116.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id EC68E2026D6D; Wed, 29 Aug 2018 11:38:10 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 29 Aug 2018 13:37:29 +0200 Message-Id: <20180829113730.14992-16-quintela@redhat.com> In-Reply-To: <20180829113730.14992-1-quintela@redhat.com> References: <20180829113730.14992-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 29 Aug 2018 11:38:12 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 29 Aug 2018 11:38:12 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'quintela@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH 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, mst@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- 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.17.1 From nobody Mon Feb 9 13:15:35 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 1535543200936191.99167944858743; Wed, 29 Aug 2018 04:46:40 -0700 (PDT) Received: from localhost ([::1]:42461 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fuyvn-0006aR-Lw for importer@patchew.org; Wed, 29 Aug 2018 07:46:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42693) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fuyqf-0001VR-Q9 for qemu-devel@nongnu.org; Wed, 29 Aug 2018 07:41:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fuyne-0007dJ-8y for qemu-devel@nongnu.org; Wed, 29 Aug 2018 07:38:17 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:51504 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fuyne-0007d7-4U for qemu-devel@nongnu.org; Wed, 29 Aug 2018 07:38:14 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CE0F68076895 for ; Wed, 29 Aug 2018 11:38:13 +0000 (UTC) Received: from secure.mitica (ovpn-116-35.ams2.redhat.com [10.36.116.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9187D2027056; Wed, 29 Aug 2018 11:38:12 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 29 Aug 2018 13:37:30 +0200 Message-Id: <20180829113730.14992-17-quintela@redhat.com> In-Reply-To: <20180829113730.14992-1-quintela@redhat.com> References: <20180829113730.14992-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Wed, 29 Aug 2018 11:38:13 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Wed, 29 Aug 2018 11:38:13 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'quintela@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH 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, mst@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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.17.1