From nobody Wed Nov 5 02:29:54 2025 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 1532523301237912.6137405561384; Wed, 25 Jul 2018 05:55:01 -0700 (PDT) Received: from localhost ([::1]:49504 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fiJJk-00026w-3b for importer@patchew.org; Wed, 25 Jul 2018 08:55:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40440) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fiImR-00060V-FT for qemu-devel@nongnu.org; Wed, 25 Jul 2018 08:20:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fiImN-00026S-RY for qemu-devel@nongnu.org; Wed, 25 Jul 2018 08:20:34 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:52244 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 1fiImN-00025U-LD; Wed, 25 Jul 2018 08:20:31 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3CA86805A530; Wed, 25 Jul 2018 12:20:31 +0000 (UTC) Received: from thh440s.redhat.com (ovpn-117-198.ams2.redhat.com [10.36.117.198]) by smtp.corp.redhat.com (Postfix) with ESMTP id CBB7C7C56; Wed, 25 Jul 2018 12:20:29 +0000 (UTC) From: Thomas Huth To: Cornelia Huck , David Hildenbrand , qemu-s390x@nongnu.org Date: Wed, 25 Jul 2018 14:20:15 +0200 Message-Id: <1532521224-27235-2-git-send-email-thuth@redhat.com> In-Reply-To: <1532521224-27235-1-git-send-email-thuth@redhat.com> References: <1532521224-27235-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Wed, 25 Jul 2018 12:20:31 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Wed, 25 Jul 2018 12:20:31 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'thuth@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH for-3.1 01/10] hw/s390x/virtio-ccw: Consolidate calls to virtio_ccw_unrealize() 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: Christian Borntraeger , qemu-devel@nongnu.org, Juan Quintela Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Currently, every virtio-ccw device explicitely sets its unrealize function to virtio_ccw_unrealize() in its class_init function. We can simplify this by using a common unrealize function, just like it is already done for the realize functions. Signed-off-by: Thomas Huth --- hw/s390x/virtio-ccw.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c index 7ddb378..7d35c77 100644 --- a/hw/s390x/virtio-ccw.c +++ b/hw/s390x/virtio-ccw.c @@ -750,11 +750,16 @@ out_err: g_free(sch); } =20 -static void virtio_ccw_unrealize(VirtioCcwDevice *dev, Error **errp) +static void virtio_ccw_device_unrealize(VirtioCcwDevice *dev, Error **errp) { + VirtIOCCWDeviceClass *dc =3D VIRTIO_CCW_DEVICE_GET_CLASS(dev); CcwDevice *ccw_dev =3D CCW_DEVICE(dev); SubchDev *sch =3D ccw_dev->sch; =20 + if (dc->unrealize) { + dc->unrealize(dev, errp); + } + if (sch) { css_subch_assign(sch->cssid, sch->ssid, sch->schid, sch->devno, NU= LL); g_free(sch); @@ -1349,7 +1354,6 @@ static void virtio_ccw_net_class_init(ObjectClass *kl= ass, void *data) VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); =20 k->realize =3D virtio_ccw_net_realize; - k->unrealize =3D virtio_ccw_unrealize; dc->props =3D virtio_ccw_net_properties; set_bit(DEVICE_CATEGORY_NETWORK, dc->categories); } @@ -1376,7 +1380,6 @@ static void virtio_ccw_blk_class_init(ObjectClass *kl= ass, void *data) VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); =20 k->realize =3D virtio_ccw_blk_realize; - k->unrealize =3D virtio_ccw_unrealize; dc->props =3D virtio_ccw_blk_properties; set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); } @@ -1403,7 +1406,6 @@ static void virtio_ccw_serial_class_init(ObjectClass = *klass, void *data) VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); =20 k->realize =3D virtio_ccw_serial_realize; - k->unrealize =3D virtio_ccw_unrealize; dc->props =3D virtio_ccw_serial_properties; set_bit(DEVICE_CATEGORY_INPUT, dc->categories); } @@ -1430,7 +1432,6 @@ static void virtio_ccw_balloon_class_init(ObjectClass= *klass, void *data) VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); =20 k->realize =3D virtio_ccw_balloon_realize; - k->unrealize =3D virtio_ccw_unrealize; dc->props =3D virtio_ccw_balloon_properties; set_bit(DEVICE_CATEGORY_MISC, dc->categories); } @@ -1457,7 +1458,6 @@ static void virtio_ccw_scsi_class_init(ObjectClass *k= lass, void *data) VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); =20 k->realize =3D virtio_ccw_scsi_realize; - k->unrealize =3D virtio_ccw_unrealize; dc->props =3D virtio_ccw_scsi_properties; set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); } @@ -1483,7 +1483,6 @@ static void vhost_ccw_scsi_class_init(ObjectClass *kl= ass, void *data) VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); =20 k->realize =3D vhost_ccw_scsi_realize; - k->unrealize =3D virtio_ccw_unrealize; dc->props =3D vhost_ccw_scsi_properties; set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); } @@ -1519,7 +1518,6 @@ static void virtio_ccw_rng_class_init(ObjectClass *kl= ass, void *data) VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); =20 k->realize =3D virtio_ccw_rng_realize; - k->unrealize =3D virtio_ccw_unrealize; dc->props =3D virtio_ccw_rng_properties; set_bit(DEVICE_CATEGORY_MISC, dc->categories); } @@ -1556,7 +1554,6 @@ static void virtio_ccw_crypto_class_init(ObjectClass = *klass, void *data) VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); =20 k->realize =3D virtio_ccw_crypto_realize; - k->unrealize =3D virtio_ccw_unrealize; dc->props =3D virtio_ccw_crypto_properties; set_bit(DEVICE_CATEGORY_MISC, dc->categories); } @@ -1593,7 +1590,6 @@ static void virtio_ccw_gpu_class_init(ObjectClass *kl= ass, void *data) VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); =20 k->realize =3D virtio_ccw_gpu_realize; - k->unrealize =3D virtio_ccw_unrealize; dc->props =3D virtio_ccw_gpu_properties; dc->hotpluggable =3D false; set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories); @@ -1621,7 +1617,6 @@ static void virtio_ccw_input_class_init(ObjectClass *= klass, void *data) VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); =20 k->realize =3D virtio_ccw_input_realize; - k->unrealize =3D virtio_ccw_unrealize; dc->props =3D virtio_ccw_input_properties; set_bit(DEVICE_CATEGORY_INPUT, dc->categories); } @@ -1703,9 +1698,8 @@ static void virtio_ccw_busdev_realize(DeviceState *de= v, Error **errp) static void virtio_ccw_busdev_unrealize(DeviceState *dev, Error **errp) { VirtioCcwDevice *_dev =3D (VirtioCcwDevice *)dev; - VirtIOCCWDeviceClass *_info =3D VIRTIO_CCW_DEVICE_GET_CLASS(dev); =20 - _info->unrealize(_dev, errp); + virtio_ccw_device_unrealize(_dev, errp); } =20 static void virtio_ccw_busdev_unplug(HotplugHandler *hotplug_dev, @@ -1801,7 +1795,6 @@ static void virtio_ccw_9p_class_init(ObjectClass *kla= ss, void *data) DeviceClass *dc =3D DEVICE_CLASS(klass); VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); =20 - k->unrealize =3D virtio_ccw_unrealize; k->realize =3D virtio_ccw_9p_realize; dc->props =3D virtio_ccw_9p_properties; set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); @@ -1847,7 +1840,6 @@ static void vhost_vsock_ccw_class_init(ObjectClass *k= lass, void *data) VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); =20 k->realize =3D vhost_vsock_ccw_realize; - k->unrealize =3D virtio_ccw_unrealize; set_bit(DEVICE_CATEGORY_MISC, dc->categories); dc->props =3D vhost_vsock_ccw_properties; } --=20 1.8.3.1 From nobody Wed Nov 5 02:29:54 2025 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 153252312276296.84915222479731; Wed, 25 Jul 2018 05:52:02 -0700 (PDT) Received: from localhost ([::1]:49448 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fiJGr-0008AC-Im for importer@patchew.org; Wed, 25 Jul 2018 08:52:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40453) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fiImT-00063n-0M for qemu-devel@nongnu.org; Wed, 25 Jul 2018 08:20:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fiImP-00028i-Pp for qemu-devel@nongnu.org; Wed, 25 Jul 2018 08:20:36 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:37386 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 1fiImP-00027m-Ca; Wed, 25 Jul 2018 08:20:33 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F0177402333A; Wed, 25 Jul 2018 12:20:32 +0000 (UTC) Received: from thh440s.redhat.com (ovpn-117-198.ams2.redhat.com [10.36.117.198]) by smtp.corp.redhat.com (Postfix) with ESMTP id 801837C56; Wed, 25 Jul 2018 12:20:31 +0000 (UTC) From: Thomas Huth To: Cornelia Huck , David Hildenbrand , qemu-s390x@nongnu.org Date: Wed, 25 Jul 2018 14:20:16 +0200 Message-Id: <1532521224-27235-3-git-send-email-thuth@redhat.com> In-Reply-To: <1532521224-27235-1-git-send-email-thuth@redhat.com> References: <1532521224-27235-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Wed, 25 Jul 2018 12:20:33 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Wed, 25 Jul 2018 12:20:33 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'thuth@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH for-3.1 02/10] hw/s390x: Move virtio-ccw-serial code to a separate file 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: Christian Borntraeger , qemu-devel@nongnu.org, Juan Quintela Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The code should only be enabled if CONFIG_VIRTIO_SERIAL has been set. This can be done best if the code resides in a separate file. Signed-off-by: Thomas Huth --- MAINTAINERS | 2 +- hw/s390x/Makefile.objs | 1 + hw/s390x/virtio-ccw-serial.c | 78 ++++++++++++++++++++++++++++++++++++++++= ++++ hw/s390x/virtio-ccw.c | 58 -------------------------------- 4 files changed, 80 insertions(+), 59 deletions(-) create mode 100644 hw/s390x/virtio-ccw-serial.c diff --git a/MAINTAINERS b/MAINTAINERS index 666e936..04aca42 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1221,7 +1221,7 @@ virtio-ccw M: Cornelia Huck M: Christian Borntraeger S: Supported -F: hw/s390x/virtio-ccw.[hc] +F: hw/s390x/virtio-ccw*.[hc] T: git git://github.com/cohuck/qemu.git s390-next T: git git://github.com/borntraeger/qemu.git s390-next L: qemu-s390x@nongnu.org diff --git a/hw/s390x/Makefile.objs b/hw/s390x/Makefile.objs index 93282f7..939b045 100644 --- a/hw/s390x/Makefile.objs +++ b/hw/s390x/Makefile.objs @@ -8,6 +8,7 @@ obj-y +=3D css.o obj-y +=3D s390-virtio-ccw.o obj-y +=3D 3270-ccw.o obj-y +=3D virtio-ccw.o +obj-$(CONFIG_VIRTIO_SERIAL) +=3D virtio-ccw-serial.o obj-y +=3D css-bridge.o obj-y +=3D ccw-device.o obj-$(CONFIG_PCI) +=3D s390-pci-bus.o s390-pci-inst.o diff --git a/hw/s390x/virtio-ccw-serial.c b/hw/s390x/virtio-ccw-serial.c new file mode 100644 index 0000000..3851fc9 --- /dev/null +++ b/hw/s390x/virtio-ccw-serial.c @@ -0,0 +1,78 @@ +/* + * virtio ccw serial implementation + * + * Copyright 2012, 2015 IBM Corp. + * Author(s): Cornelia Huck + * + * 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.h" +#include "hw/virtio/virtio-serial.h" +#include "virtio-ccw.h" + +static void virtio_ccw_serial_realize(VirtioCcwDevice *ccw_dev, Error **er= rp) +{ + VirtioSerialCcw *dev =3D VIRTIO_SERIAL_CCW(ccw_dev); + DeviceState *vdev =3D DEVICE(&dev->vdev); + DeviceState *proxy =3D DEVICE(ccw_dev); + char *bus_name; + + /* + * 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(&ccw_dev->bus)); + object_property_set_bool(OBJECT(vdev), true, "realized", errp); +} + + +static void virtio_ccw_serial_instance_init(Object *obj) +{ + VirtioSerialCcw *dev =3D VIRTIO_SERIAL_CCW(obj); + + virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), + TYPE_VIRTIO_SERIAL); +} + +static Property virtio_ccw_serial_properties[] =3D { + DEFINE_PROP_BIT("ioeventfd", VirtioCcwDevice, flags, + VIRTIO_CCW_FLAG_USE_IOEVENTFD_BIT, true), + DEFINE_PROP_UINT32("max_revision", VirtioCcwDevice, max_rev, + VIRTIO_CCW_MAX_REV), + DEFINE_PROP_END_OF_LIST(), +}; + +static void virtio_ccw_serial_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); + + k->realize =3D virtio_ccw_serial_realize; + dc->props =3D virtio_ccw_serial_properties; + set_bit(DEVICE_CATEGORY_INPUT, dc->categories); +} + +static const TypeInfo virtio_ccw_serial =3D { + .name =3D TYPE_VIRTIO_SERIAL_CCW, + .parent =3D TYPE_VIRTIO_CCW_DEVICE, + .instance_size =3D sizeof(VirtioSerialCcw), + .instance_init =3D virtio_ccw_serial_instance_init, + .class_init =3D virtio_ccw_serial_class_init, +}; + +static void virtio_ccw_serial_register(void) +{ + type_register_static(&virtio_ccw_serial); +} + +type_init(virtio_ccw_serial_register) diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c index 7d35c77..e5e18ad 100644 --- a/hw/s390x/virtio-ccw.c +++ b/hw/s390x/virtio-ccw.c @@ -17,7 +17,6 @@ #include "sysemu/kvm.h" #include "net/net.h" #include "hw/virtio/virtio.h" -#include "hw/virtio/virtio-serial.h" #include "hw/virtio/virtio-net.h" #include "hw/sysbus.h" #include "qemu/bitops.h" @@ -812,36 +811,6 @@ static void virtio_ccw_blk_instance_init(Object *obj) "bootindex", &error_abort); } =20 -static void virtio_ccw_serial_realize(VirtioCcwDevice *ccw_dev, Error **er= rp) -{ - VirtioSerialCcw *dev =3D VIRTIO_SERIAL_CCW(ccw_dev); - DeviceState *vdev =3D DEVICE(&dev->vdev); - DeviceState *proxy =3D DEVICE(ccw_dev); - char *bus_name; - - /* - * 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(&ccw_dev->bus)); - object_property_set_bool(OBJECT(vdev), true, "realized", errp); -} - - -static void virtio_ccw_serial_instance_init(Object *obj) -{ - VirtioSerialCcw *dev =3D VIRTIO_SERIAL_CCW(obj); - - virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), - TYPE_VIRTIO_SERIAL); -} - static void virtio_ccw_balloon_realize(VirtioCcwDevice *ccw_dev, Error **e= rrp) { VirtIOBalloonCcw *dev =3D VIRTIO_BALLOON_CCW(ccw_dev); @@ -1392,32 +1361,6 @@ static const TypeInfo virtio_ccw_blk =3D { .class_init =3D virtio_ccw_blk_class_init, }; =20 -static Property virtio_ccw_serial_properties[] =3D { - DEFINE_PROP_BIT("ioeventfd", VirtioCcwDevice, flags, - VIRTIO_CCW_FLAG_USE_IOEVENTFD_BIT, true), - DEFINE_PROP_UINT32("max_revision", VirtioCcwDevice, max_rev, - VIRTIO_CCW_MAX_REV), - DEFINE_PROP_END_OF_LIST(), -}; - -static void virtio_ccw_serial_class_init(ObjectClass *klass, void *data) -{ - DeviceClass *dc =3D DEVICE_CLASS(klass); - VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); - - k->realize =3D virtio_ccw_serial_realize; - dc->props =3D virtio_ccw_serial_properties; - set_bit(DEVICE_CATEGORY_INPUT, dc->categories); -} - -static const TypeInfo virtio_ccw_serial =3D { - .name =3D TYPE_VIRTIO_SERIAL_CCW, - .parent =3D TYPE_VIRTIO_CCW_DEVICE, - .instance_size =3D sizeof(VirtioSerialCcw), - .instance_init =3D virtio_ccw_serial_instance_init, - .class_init =3D virtio_ccw_serial_class_init, -}; - static Property virtio_ccw_balloon_properties[] =3D { DEFINE_PROP_BIT("ioeventfd", VirtioCcwDevice, flags, VIRTIO_CCW_FLAG_USE_IOEVENTFD_BIT, true), @@ -1865,7 +1808,6 @@ static void virtio_ccw_register(void) { type_register_static(&virtio_ccw_bus_info); type_register_static(&virtio_ccw_device_info); - type_register_static(&virtio_ccw_serial); type_register_static(&virtio_ccw_blk); type_register_static(&virtio_ccw_net); type_register_static(&virtio_ccw_balloon); --=20 1.8.3.1 From nobody Wed Nov 5 02:29:54 2025 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 1532522207950824.7772447708294; Wed, 25 Jul 2018 05:36:47 -0700 (PDT) Received: from localhost ([::1]:49262 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fiIzN-0000N0-C1 for importer@patchew.org; Wed, 25 Jul 2018 08:33:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40462) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fiImX-00065B-I2 for qemu-devel@nongnu.org; Wed, 25 Jul 2018 08:20:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fiImR-0002A8-D7 for qemu-devel@nongnu.org; Wed, 25 Jul 2018 08:20:38 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:60388 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 1fiImQ-00029h-ST; Wed, 25 Jul 2018 08:20:35 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7F93087A76; Wed, 25 Jul 2018 12:20:34 +0000 (UTC) Received: from thh440s.redhat.com (ovpn-117-198.ams2.redhat.com [10.36.117.198]) by smtp.corp.redhat.com (Postfix) with ESMTP id 462B017336; Wed, 25 Jul 2018 12:20:33 +0000 (UTC) From: Thomas Huth To: Cornelia Huck , David Hildenbrand , qemu-s390x@nongnu.org Date: Wed, 25 Jul 2018 14:20:17 +0200 Message-Id: <1532521224-27235-4-git-send-email-thuth@redhat.com> In-Reply-To: <1532521224-27235-1-git-send-email-thuth@redhat.com> References: <1532521224-27235-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Wed, 25 Jul 2018 12:20:34 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Wed, 25 Jul 2018 12:20:34 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'thuth@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH for-3.1 03/10] hw/s390x: Move virtio-ccw-balloon code to a separate file 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: Christian Borntraeger , qemu-devel@nongnu.org, Juan Quintela Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The code should only be enabled if CONFIG_VIRTIO_BALLOON has been set. This can be done best if the code resides in a separate file. Signed-off-by: Thomas Huth --- hw/s390x/Makefile.objs | 1 + hw/s390x/virtio-ccw-balloon.c | 70 +++++++++++++++++++++++++++++++++++++++= ++++ hw/s390x/virtio-ccw.c | 49 ------------------------------ 3 files changed, 71 insertions(+), 49 deletions(-) create mode 100644 hw/s390x/virtio-ccw-balloon.c diff --git a/hw/s390x/Makefile.objs b/hw/s390x/Makefile.objs index 939b045..ac98350 100644 --- a/hw/s390x/Makefile.objs +++ b/hw/s390x/Makefile.objs @@ -9,6 +9,7 @@ obj-y +=3D s390-virtio-ccw.o obj-y +=3D 3270-ccw.o obj-y +=3D virtio-ccw.o obj-$(CONFIG_VIRTIO_SERIAL) +=3D virtio-ccw-serial.o +obj-$(CONFIG_VIRTIO_BALLOON) +=3D virtio-ccw-balloon.o obj-y +=3D css-bridge.o obj-y +=3D ccw-device.o obj-$(CONFIG_PCI) +=3D s390-pci-bus.o s390-pci-inst.o diff --git a/hw/s390x/virtio-ccw-balloon.c b/hw/s390x/virtio-ccw-balloon.c new file mode 100644 index 0000000..28d171a --- /dev/null +++ b/hw/s390x/virtio-ccw-balloon.c @@ -0,0 +1,70 @@ +/* + * virtio ccw balloon implementation + * + * Copyright 2012, 2015 IBM Corp. + * Author(s): Cornelia Huck + * + * 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.h" +#include "qapi/error.h" +#include "virtio-ccw.h" + +static void virtio_ccw_balloon_realize(VirtioCcwDevice *ccw_dev, Error **e= rrp) +{ + VirtIOBalloonCcw *dev =3D VIRTIO_BALLOON_CCW(ccw_dev); + DeviceState *vdev =3D DEVICE(&dev->vdev); + + qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus)); + object_property_set_bool(OBJECT(vdev), true, "realized", errp); +} + +static void virtio_ccw_balloon_instance_init(Object *obj) +{ + VirtIOBalloonCcw *dev =3D VIRTIO_BALLOON_CCW(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 Property virtio_ccw_balloon_properties[] =3D { + DEFINE_PROP_BIT("ioeventfd", VirtioCcwDevice, flags, + VIRTIO_CCW_FLAG_USE_IOEVENTFD_BIT, true), + DEFINE_PROP_UINT32("max_revision", VirtioCcwDevice, max_rev, + VIRTIO_CCW_MAX_REV), + DEFINE_PROP_END_OF_LIST(), +}; + +static void virtio_ccw_balloon_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); + + k->realize =3D virtio_ccw_balloon_realize; + dc->props =3D virtio_ccw_balloon_properties; + set_bit(DEVICE_CATEGORY_MISC, dc->categories); +} + +static const TypeInfo virtio_ccw_balloon =3D { + .name =3D TYPE_VIRTIO_BALLOON_CCW, + .parent =3D TYPE_VIRTIO_CCW_DEVICE, + .instance_size =3D sizeof(VirtIOBalloonCcw), + .instance_init =3D virtio_ccw_balloon_instance_init, + .class_init =3D virtio_ccw_balloon_class_init, +}; + +static void virtio_ccw_balloon_register(void) +{ + type_register_static(&virtio_ccw_balloon); +} + +type_init(virtio_ccw_balloon_register) diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c index e5e18ad..3480a2e 100644 --- a/hw/s390x/virtio-ccw.c +++ b/hw/s390x/virtio-ccw.c @@ -811,28 +811,6 @@ static void virtio_ccw_blk_instance_init(Object *obj) "bootindex", &error_abort); } =20 -static void virtio_ccw_balloon_realize(VirtioCcwDevice *ccw_dev, Error **e= rrp) -{ - VirtIOBalloonCcw *dev =3D VIRTIO_BALLOON_CCW(ccw_dev); - DeviceState *vdev =3D DEVICE(&dev->vdev); - - qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus)); - object_property_set_bool(OBJECT(vdev), true, "realized", errp); -} - -static void virtio_ccw_balloon_instance_init(Object *obj) -{ - VirtIOBalloonCcw *dev =3D VIRTIO_BALLOON_CCW(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 void virtio_ccw_scsi_realize(VirtioCcwDevice *ccw_dev, Error **errp) { VirtIOSCSICcw *dev =3D VIRTIO_SCSI_CCW(ccw_dev); @@ -1361,32 +1339,6 @@ static const TypeInfo virtio_ccw_blk =3D { .class_init =3D virtio_ccw_blk_class_init, }; =20 -static Property virtio_ccw_balloon_properties[] =3D { - DEFINE_PROP_BIT("ioeventfd", VirtioCcwDevice, flags, - VIRTIO_CCW_FLAG_USE_IOEVENTFD_BIT, true), - DEFINE_PROP_UINT32("max_revision", VirtioCcwDevice, max_rev, - VIRTIO_CCW_MAX_REV), - DEFINE_PROP_END_OF_LIST(), -}; - -static void virtio_ccw_balloon_class_init(ObjectClass *klass, void *data) -{ - DeviceClass *dc =3D DEVICE_CLASS(klass); - VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); - - k->realize =3D virtio_ccw_balloon_realize; - dc->props =3D virtio_ccw_balloon_properties; - set_bit(DEVICE_CATEGORY_MISC, dc->categories); -} - -static const TypeInfo virtio_ccw_balloon =3D { - .name =3D TYPE_VIRTIO_BALLOON_CCW, - .parent =3D TYPE_VIRTIO_CCW_DEVICE, - .instance_size =3D sizeof(VirtIOBalloonCcw), - .instance_init =3D virtio_ccw_balloon_instance_init, - .class_init =3D virtio_ccw_balloon_class_init, -}; - static Property virtio_ccw_scsi_properties[] =3D { DEFINE_PROP_BIT("ioeventfd", VirtioCcwDevice, flags, VIRTIO_CCW_FLAG_USE_IOEVENTFD_BIT, true), @@ -1810,7 +1762,6 @@ static void virtio_ccw_register(void) type_register_static(&virtio_ccw_device_info); type_register_static(&virtio_ccw_blk); type_register_static(&virtio_ccw_net); - type_register_static(&virtio_ccw_balloon); type_register_static(&virtio_ccw_scsi); #ifdef CONFIG_VHOST_SCSI type_register_static(&vhost_ccw_scsi); --=20 1.8.3.1 From nobody Wed Nov 5 02:29:54 2025 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 15325254857271018.4642185527505; Wed, 25 Jul 2018 06:31:25 -0700 (PDT) Received: from localhost ([::1]:49763 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fiJLv-00045e-3g for importer@patchew.org; Wed, 25 Jul 2018 08:57:15 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40471) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fiImX-00065E-Hz for qemu-devel@nongnu.org; Wed, 25 Jul 2018 08:20:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fiImT-0002DB-4J for qemu-devel@nongnu.org; Wed, 25 Jul 2018 08:20:40 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:33206 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 1fiImS-0002BZ-Ol; Wed, 25 Jul 2018 08:20:37 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 574C7BF593; Wed, 25 Jul 2018 12:20:36 +0000 (UTC) Received: from thh440s.redhat.com (ovpn-117-198.ams2.redhat.com [10.36.117.198]) by smtp.corp.redhat.com (Postfix) with ESMTP id C9D6F1687E; Wed, 25 Jul 2018 12:20:34 +0000 (UTC) From: Thomas Huth To: Cornelia Huck , David Hildenbrand , qemu-s390x@nongnu.org Date: Wed, 25 Jul 2018 14:20:18 +0200 Message-Id: <1532521224-27235-5-git-send-email-thuth@redhat.com> In-Reply-To: <1532521224-27235-1-git-send-email-thuth@redhat.com> References: <1532521224-27235-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Wed, 25 Jul 2018 12:20:36 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Wed, 25 Jul 2018 12:20:36 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'thuth@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH for-3.1 04/10] hw/s390x: Move virtio-ccw-scsi code to a separate file 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: Christian Borntraeger , qemu-devel@nongnu.org, Juan Quintela Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The code should only be enabled if CONFIG_VIRTIO_SCSI has been set. This can be done best if the code resides in a separate file. Signed-off-by: Thomas Huth --- hw/s390x/Makefile.objs | 1 + hw/s390x/virtio-ccw-scsi.c | 125 +++++++++++++++++++++++++++++++++++++++++= ++++ hw/s390x/virtio-ccw.c | 104 ------------------------------------- 3 files changed, 126 insertions(+), 104 deletions(-) create mode 100644 hw/s390x/virtio-ccw-scsi.c diff --git a/hw/s390x/Makefile.objs b/hw/s390x/Makefile.objs index ac98350..9ca1ab0 100644 --- a/hw/s390x/Makefile.objs +++ b/hw/s390x/Makefile.objs @@ -10,6 +10,7 @@ obj-y +=3D 3270-ccw.o obj-y +=3D virtio-ccw.o obj-$(CONFIG_VIRTIO_SERIAL) +=3D virtio-ccw-serial.o obj-$(CONFIG_VIRTIO_BALLOON) +=3D virtio-ccw-balloon.o +obj-$(CONFIG_VIRTIO_SCSI) +=3D virtio-ccw-scsi.o obj-y +=3D css-bridge.o obj-y +=3D ccw-device.o obj-$(CONFIG_PCI) +=3D s390-pci-bus.o s390-pci-inst.o diff --git a/hw/s390x/virtio-ccw-scsi.c b/hw/s390x/virtio-ccw-scsi.c new file mode 100644 index 0000000..c9a804f --- /dev/null +++ b/hw/s390x/virtio-ccw-scsi.c @@ -0,0 +1,125 @@ +/* + * virtio ccw scsi implementation + * + * Copyright 2012, 2015 IBM Corp. + * Author(s): Cornelia Huck + * + * 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.h" +#include "qapi/error.h" +#include "virtio-ccw.h" + +static void virtio_ccw_scsi_realize(VirtioCcwDevice *ccw_dev, Error **errp) +{ + VirtIOSCSICcw *dev =3D VIRTIO_SCSI_CCW(ccw_dev); + DeviceState *vdev =3D DEVICE(&dev->vdev); + DeviceState *qdev =3D DEVICE(ccw_dev); + char *bus_name; + + /* + * For command line compatibility, this sets the virtio-scsi-device bus + * name as before. + */ + if (qdev->id) { + bus_name =3D g_strdup_printf("%s.0", qdev->id); + virtio_device_set_child_bus_name(VIRTIO_DEVICE(vdev), bus_name); + g_free(bus_name); + } + + qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus)); + object_property_set_bool(OBJECT(vdev), true, "realized", errp); +} + +static void virtio_ccw_scsi_instance_init(Object *obj) +{ + VirtIOSCSICcw *dev =3D VIRTIO_SCSI_CCW(obj); + + virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), + TYPE_VIRTIO_SCSI); +} + +static Property virtio_ccw_scsi_properties[] =3D { + DEFINE_PROP_BIT("ioeventfd", VirtioCcwDevice, flags, + VIRTIO_CCW_FLAG_USE_IOEVENTFD_BIT, true), + DEFINE_PROP_UINT32("max_revision", VirtioCcwDevice, max_rev, + VIRTIO_CCW_MAX_REV), + DEFINE_PROP_END_OF_LIST(), +}; + +static void virtio_ccw_scsi_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); + + k->realize =3D virtio_ccw_scsi_realize; + dc->props =3D virtio_ccw_scsi_properties; + set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); +} + +static const TypeInfo virtio_ccw_scsi =3D { + .name =3D TYPE_VIRTIO_SCSI_CCW, + .parent =3D TYPE_VIRTIO_CCW_DEVICE, + .instance_size =3D sizeof(VirtIOSCSICcw), + .instance_init =3D virtio_ccw_scsi_instance_init, + .class_init =3D virtio_ccw_scsi_class_init, +}; + +#ifdef CONFIG_VHOST_SCSI + +static void vhost_ccw_scsi_realize(VirtioCcwDevice *ccw_dev, Error **errp) +{ + VHostSCSICcw *dev =3D VHOST_SCSI_CCW(ccw_dev); + DeviceState *vdev =3D DEVICE(&dev->vdev); + + qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus)); + object_property_set_bool(OBJECT(vdev), true, "realized", errp); +} + +static void vhost_ccw_scsi_instance_init(Object *obj) +{ + VHostSCSICcw *dev =3D VHOST_SCSI_CCW(obj); + + virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), + TYPE_VHOST_SCSI); +} + +static Property vhost_ccw_scsi_properties[] =3D { + DEFINE_PROP_UINT32("max_revision", VirtioCcwDevice, max_rev, + VIRTIO_CCW_MAX_REV), + DEFINE_PROP_END_OF_LIST(), +}; + +static void vhost_ccw_scsi_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); + + k->realize =3D vhost_ccw_scsi_realize; + dc->props =3D vhost_ccw_scsi_properties; + set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); +} + +static const TypeInfo vhost_ccw_scsi =3D { + .name =3D TYPE_VHOST_SCSI_CCW, + .parent =3D TYPE_VIRTIO_CCW_DEVICE, + .instance_size =3D sizeof(VHostSCSICcw), + .instance_init =3D vhost_ccw_scsi_instance_init, + .class_init =3D vhost_ccw_scsi_class_init, +}; + +#endif + +static void virtio_ccw_scsi_register(void) +{ + type_register_static(&virtio_ccw_scsi); +#ifdef CONFIG_VHOST_SCSI + type_register_static(&vhost_ccw_scsi); +#endif +} + +type_init(virtio_ccw_scsi_register) diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c index 3480a2e..3e470a1 100644 --- a/hw/s390x/virtio-ccw.c +++ b/hw/s390x/virtio-ccw.c @@ -811,54 +811,6 @@ static void virtio_ccw_blk_instance_init(Object *obj) "bootindex", &error_abort); } =20 -static void virtio_ccw_scsi_realize(VirtioCcwDevice *ccw_dev, Error **errp) -{ - VirtIOSCSICcw *dev =3D VIRTIO_SCSI_CCW(ccw_dev); - DeviceState *vdev =3D DEVICE(&dev->vdev); - DeviceState *qdev =3D DEVICE(ccw_dev); - char *bus_name; - - /* - * For command line compatibility, this sets the virtio-scsi-device bus - * name as before. - */ - if (qdev->id) { - bus_name =3D g_strdup_printf("%s.0", qdev->id); - virtio_device_set_child_bus_name(VIRTIO_DEVICE(vdev), bus_name); - g_free(bus_name); - } - - qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus)); - object_property_set_bool(OBJECT(vdev), true, "realized", errp); -} - -static void virtio_ccw_scsi_instance_init(Object *obj) -{ - VirtIOSCSICcw *dev =3D VIRTIO_SCSI_CCW(obj); - - virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), - TYPE_VIRTIO_SCSI); -} - -#ifdef CONFIG_VHOST_SCSI -static void vhost_ccw_scsi_realize(VirtioCcwDevice *ccw_dev, Error **errp) -{ - VHostSCSICcw *dev =3D VHOST_SCSI_CCW(ccw_dev); - DeviceState *vdev =3D DEVICE(&dev->vdev); - - qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus)); - object_property_set_bool(OBJECT(vdev), true, "realized", errp); -} - -static void vhost_ccw_scsi_instance_init(Object *obj) -{ - VHostSCSICcw *dev =3D VHOST_SCSI_CCW(obj); - - virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), - TYPE_VHOST_SCSI); -} -#endif - static void virtio_ccw_rng_realize(VirtioCcwDevice *ccw_dev, Error **errp) { VirtIORNGCcw *dev =3D VIRTIO_RNG_CCW(ccw_dev); @@ -1339,58 +1291,6 @@ static const TypeInfo virtio_ccw_blk =3D { .class_init =3D virtio_ccw_blk_class_init, }; =20 -static Property virtio_ccw_scsi_properties[] =3D { - DEFINE_PROP_BIT("ioeventfd", VirtioCcwDevice, flags, - VIRTIO_CCW_FLAG_USE_IOEVENTFD_BIT, true), - DEFINE_PROP_UINT32("max_revision", VirtioCcwDevice, max_rev, - VIRTIO_CCW_MAX_REV), - DEFINE_PROP_END_OF_LIST(), -}; - -static void virtio_ccw_scsi_class_init(ObjectClass *klass, void *data) -{ - DeviceClass *dc =3D DEVICE_CLASS(klass); - VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); - - k->realize =3D virtio_ccw_scsi_realize; - dc->props =3D virtio_ccw_scsi_properties; - set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); -} - -static const TypeInfo virtio_ccw_scsi =3D { - .name =3D TYPE_VIRTIO_SCSI_CCW, - .parent =3D TYPE_VIRTIO_CCW_DEVICE, - .instance_size =3D sizeof(VirtIOSCSICcw), - .instance_init =3D virtio_ccw_scsi_instance_init, - .class_init =3D virtio_ccw_scsi_class_init, -}; - -#ifdef CONFIG_VHOST_SCSI -static Property vhost_ccw_scsi_properties[] =3D { - DEFINE_PROP_UINT32("max_revision", VirtioCcwDevice, max_rev, - VIRTIO_CCW_MAX_REV), - DEFINE_PROP_END_OF_LIST(), -}; - -static void vhost_ccw_scsi_class_init(ObjectClass *klass, void *data) -{ - DeviceClass *dc =3D DEVICE_CLASS(klass); - VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); - - k->realize =3D vhost_ccw_scsi_realize; - dc->props =3D vhost_ccw_scsi_properties; - set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); -} - -static const TypeInfo vhost_ccw_scsi =3D { - .name =3D TYPE_VHOST_SCSI_CCW, - .parent =3D TYPE_VIRTIO_CCW_DEVICE, - .instance_size =3D sizeof(VHostSCSICcw), - .instance_init =3D vhost_ccw_scsi_instance_init, - .class_init =3D vhost_ccw_scsi_class_init, -}; -#endif - static void virtio_ccw_rng_instance_init(Object *obj) { VirtIORNGCcw *dev =3D VIRTIO_RNG_CCW(obj); @@ -1762,10 +1662,6 @@ static void virtio_ccw_register(void) type_register_static(&virtio_ccw_device_info); type_register_static(&virtio_ccw_blk); type_register_static(&virtio_ccw_net); - type_register_static(&virtio_ccw_scsi); -#ifdef CONFIG_VHOST_SCSI - type_register_static(&vhost_ccw_scsi); -#endif type_register_static(&virtio_ccw_rng); #ifdef CONFIG_VIRTFS type_register_static(&virtio_ccw_9p_info); --=20 1.8.3.1 From nobody Wed Nov 5 02:29:54 2025 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 153252216941135.43007929536259; Wed, 25 Jul 2018 05:36:09 -0700 (PDT) Received: from localhost ([::1]:49260 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fiIyV-0008Cn-2a for importer@patchew.org; Wed, 25 Jul 2018 08:33:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40487) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fiImY-00065y-6D for qemu-devel@nongnu.org; Wed, 25 Jul 2018 08:20:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fiImU-0002G8-U6 for qemu-devel@nongnu.org; Wed, 25 Jul 2018 08:20:42 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:33210 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 1fiImU-0002F5-LY; Wed, 25 Jul 2018 08:20:38 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 49831BF593; Wed, 25 Jul 2018 12:20:38 +0000 (UTC) Received: from thh440s.redhat.com (ovpn-117-198.ams2.redhat.com [10.36.117.198]) by smtp.corp.redhat.com (Postfix) with ESMTP id A18A31C55D; Wed, 25 Jul 2018 12:20:36 +0000 (UTC) From: Thomas Huth To: Cornelia Huck , David Hildenbrand , qemu-s390x@nongnu.org Date: Wed, 25 Jul 2018 14:20:19 +0200 Message-Id: <1532521224-27235-6-git-send-email-thuth@redhat.com> In-Reply-To: <1532521224-27235-1-git-send-email-thuth@redhat.com> References: <1532521224-27235-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Wed, 25 Jul 2018 12:20:38 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Wed, 25 Jul 2018 12:20:38 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'thuth@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH for-3.1 05/10] hw/s390x: Move virtio-ccw-rng code to a separate file 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: Christian Borntraeger , qemu-devel@nongnu.org, Juan Quintela Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The code should only be enabled if CONFIG_VIRTIO_RNG has been set. This can be done best if the code resides in a separate file. Signed-off-by: Thomas Huth --- hw/s390x/Makefile.objs | 1 + hw/s390x/virtio-ccw-rng.c | 74 +++++++++++++++++++++++++++++++++++++++++++= ++++ hw/s390x/virtio-ccw.c | 53 --------------------------------- 3 files changed, 75 insertions(+), 53 deletions(-) create mode 100644 hw/s390x/virtio-ccw-rng.c diff --git a/hw/s390x/Makefile.objs b/hw/s390x/Makefile.objs index 9ca1ab0..181efd1 100644 --- a/hw/s390x/Makefile.objs +++ b/hw/s390x/Makefile.objs @@ -11,6 +11,7 @@ obj-y +=3D virtio-ccw.o obj-$(CONFIG_VIRTIO_SERIAL) +=3D virtio-ccw-serial.o obj-$(CONFIG_VIRTIO_BALLOON) +=3D virtio-ccw-balloon.o obj-$(CONFIG_VIRTIO_SCSI) +=3D virtio-ccw-scsi.o +obj-$(CONFIG_VIRTIO_RNG) +=3D virtio-ccw-rng.o obj-y +=3D css-bridge.o obj-y +=3D ccw-device.o obj-$(CONFIG_PCI) +=3D s390-pci-bus.o s390-pci-inst.o diff --git a/hw/s390x/virtio-ccw-rng.c b/hw/s390x/virtio-ccw-rng.c new file mode 100644 index 0000000..3f6abcc --- /dev/null +++ b/hw/s390x/virtio-ccw-rng.c @@ -0,0 +1,74 @@ +/* + * virtio ccw random number generator implementation + * + * Copyright 2012, 2015 IBM Corp. + * Author(s): Cornelia Huck + * + * 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.h" +#include "qapi/error.h" +#include "virtio-ccw.h" + +static void virtio_ccw_rng_realize(VirtioCcwDevice *ccw_dev, Error **errp) +{ + VirtIORNGCcw *dev =3D VIRTIO_RNG_CCW(ccw_dev); + DeviceState *vdev =3D DEVICE(&dev->vdev); + Error *err =3D NULL; + + qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus)); + object_property_set_bool(OBJECT(vdev), true, "realized", &err); + if (err) { + error_propagate(errp, err); + return; + } + + object_property_set_link(OBJECT(dev), + OBJECT(dev->vdev.conf.rng), "rng", + NULL); +} + +static void virtio_ccw_rng_instance_init(Object *obj) +{ + VirtIORNGCcw *dev =3D VIRTIO_RNG_CCW(obj); + + virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), + TYPE_VIRTIO_RNG); +} + +static Property virtio_ccw_rng_properties[] =3D { + DEFINE_PROP_BIT("ioeventfd", VirtioCcwDevice, flags, + VIRTIO_CCW_FLAG_USE_IOEVENTFD_BIT, true), + DEFINE_PROP_UINT32("max_revision", VirtioCcwDevice, max_rev, + VIRTIO_CCW_MAX_REV), + DEFINE_PROP_END_OF_LIST(), +}; + +static void virtio_ccw_rng_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); + + k->realize =3D virtio_ccw_rng_realize; + dc->props =3D virtio_ccw_rng_properties; + set_bit(DEVICE_CATEGORY_MISC, dc->categories); +} + +static const TypeInfo virtio_ccw_rng =3D { + .name =3D TYPE_VIRTIO_RNG_CCW, + .parent =3D TYPE_VIRTIO_CCW_DEVICE, + .instance_size =3D sizeof(VirtIORNGCcw), + .instance_init =3D virtio_ccw_rng_instance_init, + .class_init =3D virtio_ccw_rng_class_init, +}; + +static void virtio_ccw_rng_register(void) +{ + type_register_static(&virtio_ccw_rng); +} + +type_init(virtio_ccw_rng_register) diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c index 3e470a1..844c0a5 100644 --- a/hw/s390x/virtio-ccw.c +++ b/hw/s390x/virtio-ccw.c @@ -811,24 +811,6 @@ static void virtio_ccw_blk_instance_init(Object *obj) "bootindex", &error_abort); } =20 -static void virtio_ccw_rng_realize(VirtioCcwDevice *ccw_dev, Error **errp) -{ - VirtIORNGCcw *dev =3D VIRTIO_RNG_CCW(ccw_dev); - DeviceState *vdev =3D DEVICE(&dev->vdev); - Error *err =3D NULL; - - qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus)); - object_property_set_bool(OBJECT(vdev), true, "realized", &err); - if (err) { - error_propagate(errp, err); - return; - } - - object_property_set_link(OBJECT(dev), - OBJECT(dev->vdev.conf.rng), "rng", - NULL); -} - static void virtio_ccw_crypto_realize(VirtioCcwDevice *ccw_dev, Error **er= rp) { VirtIOCryptoCcw *dev =3D VIRTIO_CRYPTO_CCW(ccw_dev); @@ -1291,40 +1273,6 @@ static const TypeInfo virtio_ccw_blk =3D { .class_init =3D virtio_ccw_blk_class_init, }; =20 -static void virtio_ccw_rng_instance_init(Object *obj) -{ - VirtIORNGCcw *dev =3D VIRTIO_RNG_CCW(obj); - - virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), - TYPE_VIRTIO_RNG); -} - -static Property virtio_ccw_rng_properties[] =3D { - DEFINE_PROP_BIT("ioeventfd", VirtioCcwDevice, flags, - VIRTIO_CCW_FLAG_USE_IOEVENTFD_BIT, true), - DEFINE_PROP_UINT32("max_revision", VirtioCcwDevice, max_rev, - VIRTIO_CCW_MAX_REV), - DEFINE_PROP_END_OF_LIST(), -}; - -static void virtio_ccw_rng_class_init(ObjectClass *klass, void *data) -{ - DeviceClass *dc =3D DEVICE_CLASS(klass); - VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); - - k->realize =3D virtio_ccw_rng_realize; - dc->props =3D virtio_ccw_rng_properties; - set_bit(DEVICE_CATEGORY_MISC, dc->categories); -} - -static const TypeInfo virtio_ccw_rng =3D { - .name =3D TYPE_VIRTIO_RNG_CCW, - .parent =3D TYPE_VIRTIO_CCW_DEVICE, - .instance_size =3D sizeof(VirtIORNGCcw), - .instance_init =3D virtio_ccw_rng_instance_init, - .class_init =3D virtio_ccw_rng_class_init, -}; - static Property virtio_ccw_crypto_properties[] =3D { DEFINE_PROP_BIT("ioeventfd", VirtioCcwDevice, flags, VIRTIO_CCW_FLAG_USE_IOEVENTFD_BIT, true), @@ -1662,7 +1610,6 @@ static void virtio_ccw_register(void) type_register_static(&virtio_ccw_device_info); type_register_static(&virtio_ccw_blk); type_register_static(&virtio_ccw_net); - type_register_static(&virtio_ccw_rng); #ifdef CONFIG_VIRTFS type_register_static(&virtio_ccw_9p_info); #endif --=20 1.8.3.1 From nobody Wed Nov 5 02:29:54 2025 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 1532526170656215.66285155258572; Wed, 25 Jul 2018 06:42:50 -0700 (PDT) Received: from localhost ([::1]:49430 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fiJE3-0004yl-6n for importer@patchew.org; Wed, 25 Jul 2018 08:49:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40511) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fiImZ-00067h-Te for qemu-devel@nongnu.org; Wed, 25 Jul 2018 08:20:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fiImW-0002Jl-T2 for qemu-devel@nongnu.org; Wed, 25 Jul 2018 08:20:43 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:37394 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 1fiImW-0002IQ-ME; Wed, 25 Jul 2018 08:20:40 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 48C67402333A; Wed, 25 Jul 2018 12:20:40 +0000 (UTC) Received: from thh440s.redhat.com (ovpn-117-198.ams2.redhat.com [10.36.117.198]) by smtp.corp.redhat.com (Postfix) with ESMTP id AA71B1018F; Wed, 25 Jul 2018 12:20:38 +0000 (UTC) From: Thomas Huth To: Cornelia Huck , David Hildenbrand , qemu-s390x@nongnu.org Date: Wed, 25 Jul 2018 14:20:20 +0200 Message-Id: <1532521224-27235-7-git-send-email-thuth@redhat.com> In-Reply-To: <1532521224-27235-1-git-send-email-thuth@redhat.com> References: <1532521224-27235-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Wed, 25 Jul 2018 12:20:40 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Wed, 25 Jul 2018 12:20:40 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'thuth@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH for-3.1 06/10] hw/s390x: Move virtio-ccw-9p code to a separate file 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: Christian Borntraeger , qemu-devel@nongnu.org, Juan Quintela Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The code should only be enabled if CONFIG_VIRTIO_9P and CONFIG_VIRTFS have been set. This can be done best if the code resides in a separate file. Signed-off-by: Thomas Huth --- hw/s390x/Makefile.objs | 1 + hw/s390x/virtio-ccw-9p.c | 65 ++++++++++++++++++++++++++++++++++++++++++++= ++++ hw/s390x/virtio-ccw.c | 48 ----------------------------------- 3 files changed, 66 insertions(+), 48 deletions(-) create mode 100644 hw/s390x/virtio-ccw-9p.c diff --git a/hw/s390x/Makefile.objs b/hw/s390x/Makefile.objs index 181efd1..08a8c10 100644 --- a/hw/s390x/Makefile.objs +++ b/hw/s390x/Makefile.objs @@ -12,6 +12,7 @@ obj-$(CONFIG_VIRTIO_SERIAL) +=3D virtio-ccw-serial.o obj-$(CONFIG_VIRTIO_BALLOON) +=3D virtio-ccw-balloon.o obj-$(CONFIG_VIRTIO_SCSI) +=3D virtio-ccw-scsi.o obj-$(CONFIG_VIRTIO_RNG) +=3D virtio-ccw-rng.o +obj-$(call land,$(CONFIG_VIRTIO_9P),$(CONFIG_VIRTFS)) +=3D virtio-ccw-9p.o obj-y +=3D css-bridge.o obj-y +=3D ccw-device.o obj-$(CONFIG_PCI) +=3D s390-pci-bus.o s390-pci-inst.o diff --git a/hw/s390x/virtio-ccw-9p.c b/hw/s390x/virtio-ccw-9p.c new file mode 100644 index 0000000..d6be172 --- /dev/null +++ b/hw/s390x/virtio-ccw-9p.c @@ -0,0 +1,65 @@ +/* + * virtio ccw 9p implementation + * + * Copyright 2012, 2015 IBM Corp. + * Author(s): Pierre Morel + * + * 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.h" +#include "qapi/error.h" +#include "virtio-ccw.h" + +static void virtio_ccw_9p_realize(VirtioCcwDevice *ccw_dev, Error **errp) +{ + V9fsCCWState *dev =3D VIRTIO_9P_CCW(ccw_dev); + DeviceState *vdev =3D DEVICE(&dev->vdev); + + qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus)); + object_property_set_bool(OBJECT(vdev), true, "realized", errp); +} + +static void virtio_ccw_9p_instance_init(Object *obj) +{ + V9fsCCWState *dev =3D VIRTIO_9P_CCW(obj); + + virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), + TYPE_VIRTIO_9P); +} + +static Property virtio_ccw_9p_properties[] =3D { + DEFINE_PROP_BIT("ioeventfd", VirtioCcwDevice, flags, + VIRTIO_CCW_FLAG_USE_IOEVENTFD_BIT, true), + DEFINE_PROP_UINT32("max_revision", VirtioCcwDevice, max_rev, + VIRTIO_CCW_MAX_REV), + DEFINE_PROP_END_OF_LIST(), +}; + +static void virtio_ccw_9p_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); + + k->realize =3D virtio_ccw_9p_realize; + dc->props =3D virtio_ccw_9p_properties; + set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); +} + +static const TypeInfo virtio_ccw_9p_info =3D { + .name =3D TYPE_VIRTIO_9P_CCW, + .parent =3D TYPE_VIRTIO_CCW_DEVICE, + .instance_size =3D sizeof(V9fsCCWState), + .instance_init =3D virtio_ccw_9p_instance_init, + .class_init =3D virtio_ccw_9p_class_init, +}; + +static void virtio_ccw_9p_register(void) +{ + type_register_static(&virtio_ccw_9p_info); +} + +type_init(virtio_ccw_9p_register) diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c index 844c0a5..f8c1ca2 100644 --- a/hw/s390x/virtio-ccw.c +++ b/hw/s390x/virtio-ccw.c @@ -1515,51 +1515,6 @@ static const TypeInfo virtio_ccw_bus_info =3D { .class_init =3D virtio_ccw_bus_class_init, }; =20 -#ifdef CONFIG_VIRTFS -static Property virtio_ccw_9p_properties[] =3D { - DEFINE_PROP_BIT("ioeventfd", VirtioCcwDevice, flags, - VIRTIO_CCW_FLAG_USE_IOEVENTFD_BIT, true), - DEFINE_PROP_UINT32("max_revision", VirtioCcwDevice, max_rev, - VIRTIO_CCW_MAX_REV), - DEFINE_PROP_END_OF_LIST(), -}; - -static void virtio_ccw_9p_realize(VirtioCcwDevice *ccw_dev, Error **errp) -{ - V9fsCCWState *dev =3D VIRTIO_9P_CCW(ccw_dev); - DeviceState *vdev =3D DEVICE(&dev->vdev); - - qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus)); - object_property_set_bool(OBJECT(vdev), true, "realized", errp); -} - -static void virtio_ccw_9p_class_init(ObjectClass *klass, void *data) -{ - DeviceClass *dc =3D DEVICE_CLASS(klass); - VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); - - k->realize =3D virtio_ccw_9p_realize; - dc->props =3D virtio_ccw_9p_properties; - set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); -} - -static void virtio_ccw_9p_instance_init(Object *obj) -{ - V9fsCCWState *dev =3D VIRTIO_9P_CCW(obj); - - virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), - TYPE_VIRTIO_9P); -} - -static const TypeInfo virtio_ccw_9p_info =3D { - .name =3D TYPE_VIRTIO_9P_CCW, - .parent =3D TYPE_VIRTIO_CCW_DEVICE, - .instance_size =3D sizeof(V9fsCCWState), - .instance_init =3D virtio_ccw_9p_instance_init, - .class_init =3D virtio_ccw_9p_class_init, -}; -#endif - #ifdef CONFIG_VHOST_VSOCK =20 static Property vhost_vsock_ccw_properties[] =3D { @@ -1610,9 +1565,6 @@ static void virtio_ccw_register(void) type_register_static(&virtio_ccw_device_info); type_register_static(&virtio_ccw_blk); type_register_static(&virtio_ccw_net); -#ifdef CONFIG_VIRTFS - type_register_static(&virtio_ccw_9p_info); -#endif #ifdef CONFIG_VHOST_VSOCK type_register_static(&vhost_vsock_ccw_info); #endif --=20 1.8.3.1 From nobody Wed Nov 5 02:29:54 2025 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 1532524156094296.1342886694033; Wed, 25 Jul 2018 06:09:16 -0700 (PDT) Received: from localhost ([::1]:49874 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fiJOL-0005vT-Vg for importer@patchew.org; Wed, 25 Jul 2018 08:59:46 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40536) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fiImc-00068k-4h for qemu-devel@nongnu.org; Wed, 25 Jul 2018 08:20:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fiImZ-0002OT-42 for qemu-devel@nongnu.org; Wed, 25 Jul 2018 08:20:46 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:37398 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 1fiImY-0002NK-Px; Wed, 25 Jul 2018 08:20:43 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 61BFD402333A; Wed, 25 Jul 2018 12:20:42 +0000 (UTC) Received: from thh440s.redhat.com (ovpn-117-198.ams2.redhat.com [10.36.117.198]) by smtp.corp.redhat.com (Postfix) with ESMTP id B4DC91684A; Wed, 25 Jul 2018 12:20:40 +0000 (UTC) From: Thomas Huth To: Cornelia Huck , David Hildenbrand , qemu-s390x@nongnu.org Date: Wed, 25 Jul 2018 14:20:21 +0200 Message-Id: <1532521224-27235-8-git-send-email-thuth@redhat.com> In-Reply-To: <1532521224-27235-1-git-send-email-thuth@redhat.com> References: <1532521224-27235-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Wed, 25 Jul 2018 12:20:42 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Wed, 25 Jul 2018 12:20:42 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'thuth@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH for-3.1 07/10] hw/s390x: Move virtio-ccw-crypto code to a separate file 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: Christian Borntraeger , qemu-devel@nongnu.org, Juan Quintela Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The code should only be enabled if CONFIG_VIRTIO_CRYPTO has been set. This can be done best if the code resides in a separate file. Signed-off-by: Thomas Huth --- hw/s390x/Makefile.objs | 1 + hw/s390x/virtio-ccw-crypto.c | 75 ++++++++++++++++++++++++++++++++++++++++= ++++ hw/s390x/virtio-ccw.c | 55 -------------------------------- 3 files changed, 76 insertions(+), 55 deletions(-) create mode 100644 hw/s390x/virtio-ccw-crypto.c diff --git a/hw/s390x/Makefile.objs b/hw/s390x/Makefile.objs index 08a8c10..1073cfa 100644 --- a/hw/s390x/Makefile.objs +++ b/hw/s390x/Makefile.objs @@ -12,6 +12,7 @@ obj-$(CONFIG_VIRTIO_SERIAL) +=3D virtio-ccw-serial.o obj-$(CONFIG_VIRTIO_BALLOON) +=3D virtio-ccw-balloon.o obj-$(CONFIG_VIRTIO_SCSI) +=3D virtio-ccw-scsi.o obj-$(CONFIG_VIRTIO_RNG) +=3D virtio-ccw-rng.o +obj-$(CONFIG_VIRTIO_CRYPTO) +=3D virtio-ccw-crypto.o obj-$(call land,$(CONFIG_VIRTIO_9P),$(CONFIG_VIRTFS)) +=3D virtio-ccw-9p.o obj-y +=3D css-bridge.o obj-y +=3D ccw-device.o diff --git a/hw/s390x/virtio-ccw-crypto.c b/hw/s390x/virtio-ccw-crypto.c new file mode 100644 index 0000000..aab6a95 --- /dev/null +++ b/hw/s390x/virtio-ccw-crypto.c @@ -0,0 +1,75 @@ +/* + * virtio ccw crypto implementation + * + * Copyright 2012, 2015 IBM Corp. + * + * 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.h" +#include "qapi/error.h" +#include "virtio-ccw.h" + +static void virtio_ccw_crypto_realize(VirtioCcwDevice *ccw_dev, Error **er= rp) +{ + VirtIOCryptoCcw *dev =3D VIRTIO_CRYPTO_CCW(ccw_dev); + DeviceState *vdev =3D DEVICE(&dev->vdev); + Error *err =3D NULL; + + qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus)); + object_property_set_bool(OBJECT(vdev), true, "realized", &err); + if (err) { + error_propagate(errp, err); + return; + } + + object_property_set_link(OBJECT(vdev), + OBJECT(dev->vdev.conf.cryptodev), "cryptodev", + NULL); +} + +static void virtio_ccw_crypto_instance_init(Object *obj) +{ + VirtIOCryptoCcw *dev =3D VIRTIO_CRYPTO_CCW(obj); + VirtioCcwDevice *ccw_dev =3D VIRTIO_CCW_DEVICE(obj); + + ccw_dev->force_revision_1 =3D true; + virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), + TYPE_VIRTIO_CRYPTO); +} + +static Property virtio_ccw_crypto_properties[] =3D { + DEFINE_PROP_BIT("ioeventfd", VirtioCcwDevice, flags, + VIRTIO_CCW_FLAG_USE_IOEVENTFD_BIT, true), + DEFINE_PROP_UINT32("max_revision", VirtioCcwDevice, max_rev, + VIRTIO_CCW_MAX_REV), + DEFINE_PROP_END_OF_LIST(), +}; + +static void virtio_ccw_crypto_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); + + k->realize =3D virtio_ccw_crypto_realize; + dc->props =3D virtio_ccw_crypto_properties; + set_bit(DEVICE_CATEGORY_MISC, dc->categories); +} + +static const TypeInfo virtio_ccw_crypto =3D { + .name =3D TYPE_VIRTIO_CRYPTO_CCW, + .parent =3D TYPE_VIRTIO_CCW_DEVICE, + .instance_size =3D sizeof(VirtIOCryptoCcw), + .instance_init =3D virtio_ccw_crypto_instance_init, + .class_init =3D virtio_ccw_crypto_class_init, +}; + +static void virtio_ccw_crypto_register(void) +{ + type_register_static(&virtio_ccw_crypto); +} + +type_init(virtio_ccw_crypto_register) diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c index f8c1ca2..19c310c 100644 --- a/hw/s390x/virtio-ccw.c +++ b/hw/s390x/virtio-ccw.c @@ -811,24 +811,6 @@ static void virtio_ccw_blk_instance_init(Object *obj) "bootindex", &error_abort); } =20 -static void virtio_ccw_crypto_realize(VirtioCcwDevice *ccw_dev, Error **er= rp) -{ - VirtIOCryptoCcw *dev =3D VIRTIO_CRYPTO_CCW(ccw_dev); - DeviceState *vdev =3D DEVICE(&dev->vdev); - Error *err =3D NULL; - - qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus)); - object_property_set_bool(OBJECT(vdev), true, "realized", &err); - if (err) { - error_propagate(errp, err); - return; - } - - object_property_set_link(OBJECT(vdev), - OBJECT(dev->vdev.conf.cryptodev), "cryptodev", - NULL); -} - static void virtio_ccw_gpu_realize(VirtioCcwDevice *ccw_dev, Error **errp) { VirtIOGPUCcw *dev =3D VIRTIO_GPU_CCW(ccw_dev); @@ -1273,42 +1255,6 @@ static const TypeInfo virtio_ccw_blk =3D { .class_init =3D virtio_ccw_blk_class_init, }; =20 -static Property virtio_ccw_crypto_properties[] =3D { - DEFINE_PROP_BIT("ioeventfd", VirtioCcwDevice, flags, - VIRTIO_CCW_FLAG_USE_IOEVENTFD_BIT, true), - DEFINE_PROP_UINT32("max_revision", VirtioCcwDevice, max_rev, - VIRTIO_CCW_MAX_REV), - DEFINE_PROP_END_OF_LIST(), -}; - -static void virtio_ccw_crypto_instance_init(Object *obj) -{ - VirtIOCryptoCcw *dev =3D VIRTIO_CRYPTO_CCW(obj); - VirtioCcwDevice *ccw_dev =3D VIRTIO_CCW_DEVICE(obj); - - ccw_dev->force_revision_1 =3D true; - virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), - TYPE_VIRTIO_CRYPTO); -} - -static void virtio_ccw_crypto_class_init(ObjectClass *klass, void *data) -{ - DeviceClass *dc =3D DEVICE_CLASS(klass); - VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); - - k->realize =3D virtio_ccw_crypto_realize; - dc->props =3D virtio_ccw_crypto_properties; - set_bit(DEVICE_CATEGORY_MISC, dc->categories); -} - -static const TypeInfo virtio_ccw_crypto =3D { - .name =3D TYPE_VIRTIO_CRYPTO_CCW, - .parent =3D TYPE_VIRTIO_CCW_DEVICE, - .instance_size =3D sizeof(VirtIOCryptoCcw), - .instance_init =3D virtio_ccw_crypto_instance_init, - .class_init =3D virtio_ccw_crypto_class_init, -}; - static Property virtio_ccw_gpu_properties[] =3D { DEFINE_PROP_BIT("ioeventfd", VirtioCcwDevice, flags, VIRTIO_CCW_FLAG_USE_IOEVENTFD_BIT, true), @@ -1568,7 +1514,6 @@ static void virtio_ccw_register(void) #ifdef CONFIG_VHOST_VSOCK type_register_static(&vhost_vsock_ccw_info); #endif - type_register_static(&virtio_ccw_crypto); type_register_static(&virtio_ccw_gpu); type_register_static(&virtio_ccw_input); type_register_static(&virtio_ccw_input_hid); --=20 1.8.3.1 From nobody Wed Nov 5 02:29:54 2025 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 1532522198877683.1186878045512; Wed, 25 Jul 2018 05:36:38 -0700 (PDT) Received: from localhost ([::1]:49281 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fiJ1s-0002Ns-G7 for importer@patchew.org; Wed, 25 Jul 2018 08:36:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40597) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fiImg-0006CN-EG for qemu-devel@nongnu.org; Wed, 25 Jul 2018 08:20:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fiImd-0002VB-Ds for qemu-devel@nongnu.org; Wed, 25 Jul 2018 08:20:50 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:52258 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 1fiImd-0002UP-7P; Wed, 25 Jul 2018 08:20:47 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D1B688197003; Wed, 25 Jul 2018 12:20:46 +0000 (UTC) Received: from thh440s.redhat.com (ovpn-117-198.ams2.redhat.com [10.36.117.198]) by smtp.corp.redhat.com (Postfix) with ESMTP id 016A11018F; Wed, 25 Jul 2018 12:20:42 +0000 (UTC) From: Thomas Huth To: Cornelia Huck , David Hildenbrand , qemu-s390x@nongnu.org Date: Wed, 25 Jul 2018 14:20:22 +0200 Message-Id: <1532521224-27235-9-git-send-email-thuth@redhat.com> In-Reply-To: <1532521224-27235-1-git-send-email-thuth@redhat.com> References: <1532521224-27235-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Wed, 25 Jul 2018 12:20:46 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Wed, 25 Jul 2018 12:20:46 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'thuth@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH for-3.1 08/10] hw/s390x: Move vhost-vsock-ccw code to a separate file 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: Christian Borntraeger , qemu-devel@nongnu.org, Juan Quintela Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The code should only be enabled if CONFIG_VHOST_VSOCK has been set. This can be done best if the code resides in a separate file. Signed-off-by: Thomas Huth --- hw/s390x/Makefile.objs | 1 + hw/s390x/vhost-vsock-ccw.c | 60 ++++++++++++++++++++++++++++++++++++++++++= ++++ hw/s390x/virtio-ccw.c | 47 ------------------------------------ 3 files changed, 61 insertions(+), 47 deletions(-) create mode 100644 hw/s390x/vhost-vsock-ccw.c diff --git a/hw/s390x/Makefile.objs b/hw/s390x/Makefile.objs index 1073cfa..f1c058e 100644 --- a/hw/s390x/Makefile.objs +++ b/hw/s390x/Makefile.objs @@ -14,6 +14,7 @@ obj-$(CONFIG_VIRTIO_SCSI) +=3D virtio-ccw-scsi.o obj-$(CONFIG_VIRTIO_RNG) +=3D virtio-ccw-rng.o obj-$(CONFIG_VIRTIO_CRYPTO) +=3D virtio-ccw-crypto.o obj-$(call land,$(CONFIG_VIRTIO_9P),$(CONFIG_VIRTFS)) +=3D virtio-ccw-9p.o +obj-$(CONFIG_VHOST_VSOCK) +=3D vhost-vsock-ccw.o obj-y +=3D css-bridge.o obj-y +=3D ccw-device.o obj-$(CONFIG_PCI) +=3D s390-pci-bus.o s390-pci-inst.o diff --git a/hw/s390x/vhost-vsock-ccw.c b/hw/s390x/vhost-vsock-ccw.c new file mode 100644 index 0000000..cddc5cf --- /dev/null +++ b/hw/s390x/vhost-vsock-ccw.c @@ -0,0 +1,60 @@ +/* + * vhost vsock ccw implementation + * + * 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.h" +#include "qapi/error.h" +#include "virtio-ccw.h" + +static Property vhost_vsock_ccw_properties[] =3D { + DEFINE_PROP_UINT32("max_revision", VirtioCcwDevice, max_rev, + VIRTIO_CCW_MAX_REV), + DEFINE_PROP_END_OF_LIST(), +}; + +static void vhost_vsock_ccw_realize(VirtioCcwDevice *ccw_dev, Error **errp) +{ + VHostVSockCCWState *dev =3D VHOST_VSOCK_CCW(ccw_dev); + DeviceState *vdev =3D DEVICE(&dev->vdev); + + qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus)); + object_property_set_bool(OBJECT(vdev), true, "realized", errp); +} + +static void vhost_vsock_ccw_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); + + k->realize =3D vhost_vsock_ccw_realize; + set_bit(DEVICE_CATEGORY_MISC, dc->categories); + dc->props =3D vhost_vsock_ccw_properties; +} + +static void vhost_vsock_ccw_instance_init(Object *obj) +{ + VHostVSockCCWState *dev =3D VHOST_VSOCK_CCW(obj); + + virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), + TYPE_VHOST_VSOCK); +} + +static const TypeInfo vhost_vsock_ccw_info =3D { + .name =3D TYPE_VHOST_VSOCK_CCW, + .parent =3D TYPE_VIRTIO_CCW_DEVICE, + .instance_size =3D sizeof(VHostVSockCCWState), + .instance_init =3D vhost_vsock_ccw_instance_init, + .class_init =3D vhost_vsock_ccw_class_init, +}; + +static void vhost_vsock_ccw_register(void) +{ + type_register_static(&vhost_vsock_ccw_info); +} + +type_init(vhost_vsock_ccw_register) diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c index 19c310c..eff4214 100644 --- a/hw/s390x/virtio-ccw.c +++ b/hw/s390x/virtio-ccw.c @@ -1461,59 +1461,12 @@ static const TypeInfo virtio_ccw_bus_info =3D { .class_init =3D virtio_ccw_bus_class_init, }; =20 -#ifdef CONFIG_VHOST_VSOCK - -static Property vhost_vsock_ccw_properties[] =3D { - DEFINE_PROP_UINT32("max_revision", VirtioCcwDevice, max_rev, - VIRTIO_CCW_MAX_REV), - DEFINE_PROP_END_OF_LIST(), -}; - -static void vhost_vsock_ccw_realize(VirtioCcwDevice *ccw_dev, Error **errp) -{ - VHostVSockCCWState *dev =3D VHOST_VSOCK_CCW(ccw_dev); - DeviceState *vdev =3D DEVICE(&dev->vdev); - - qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus)); - object_property_set_bool(OBJECT(vdev), true, "realized", errp); -} - -static void vhost_vsock_ccw_class_init(ObjectClass *klass, void *data) -{ - DeviceClass *dc =3D DEVICE_CLASS(klass); - VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); - - k->realize =3D vhost_vsock_ccw_realize; - set_bit(DEVICE_CATEGORY_MISC, dc->categories); - dc->props =3D vhost_vsock_ccw_properties; -} - -static void vhost_vsock_ccw_instance_init(Object *obj) -{ - VHostVSockCCWState *dev =3D VHOST_VSOCK_CCW(obj); - - virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), - TYPE_VHOST_VSOCK); -} - -static const TypeInfo vhost_vsock_ccw_info =3D { - .name =3D TYPE_VHOST_VSOCK_CCW, - .parent =3D TYPE_VIRTIO_CCW_DEVICE, - .instance_size =3D sizeof(VHostVSockCCWState), - .instance_init =3D vhost_vsock_ccw_instance_init, - .class_init =3D vhost_vsock_ccw_class_init, -}; -#endif - static void virtio_ccw_register(void) { type_register_static(&virtio_ccw_bus_info); type_register_static(&virtio_ccw_device_info); type_register_static(&virtio_ccw_blk); type_register_static(&virtio_ccw_net); -#ifdef CONFIG_VHOST_VSOCK - type_register_static(&vhost_vsock_ccw_info); -#endif type_register_static(&virtio_ccw_gpu); type_register_static(&virtio_ccw_input); type_register_static(&virtio_ccw_input_hid); --=20 1.8.3.1 From nobody Wed Nov 5 02:29:54 2025 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 1532523141979519.7870103644452; Wed, 25 Jul 2018 05:52:21 -0700 (PDT) Received: from localhost ([::1]:49458 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fiJHA-0008PA-Rk for importer@patchew.org; Wed, 25 Jul 2018 08:52:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40633) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fiImi-0006Ej-Mj for qemu-devel@nongnu.org; Wed, 25 Jul 2018 08:20:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fiImf-0002Xx-MQ for qemu-devel@nongnu.org; Wed, 25 Jul 2018 08:20:52 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:52262 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 1fiImf-0002XS-GW; Wed, 25 Jul 2018 08:20:49 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 27BEB8197003; Wed, 25 Jul 2018 12:20:49 +0000 (UTC) Received: from thh440s.redhat.com (ovpn-117-198.ams2.redhat.com [10.36.117.198]) by smtp.corp.redhat.com (Postfix) with ESMTP id 37BD51018F; Wed, 25 Jul 2018 12:20:47 +0000 (UTC) From: Thomas Huth To: Cornelia Huck , David Hildenbrand , qemu-s390x@nongnu.org Date: Wed, 25 Jul 2018 14:20:23 +0200 Message-Id: <1532521224-27235-10-git-send-email-thuth@redhat.com> In-Reply-To: <1532521224-27235-1-git-send-email-thuth@redhat.com> References: <1532521224-27235-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Wed, 25 Jul 2018 12:20:49 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Wed, 25 Jul 2018 12:20:49 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'thuth@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH for-3.1 09/10] hw/s390x: Move virtio-ccw-gpu code to a separate file 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: Christian Borntraeger , qemu-devel@nongnu.org, Juan Quintela Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The code should only be enabled if CONFIG_VIRTIO_GPU has been set. This can be done best if the code resides in a separate file. Signed-off-by: Thomas Huth --- hw/s390x/Makefile.objs | 1 + hw/s390x/virtio-ccw-gpu.c | 67 +++++++++++++++++++++++++++++++++++++++++++= ++++ hw/s390x/virtio-ccw.c | 47 --------------------------------- 3 files changed, 68 insertions(+), 47 deletions(-) create mode 100644 hw/s390x/virtio-ccw-gpu.c diff --git a/hw/s390x/Makefile.objs b/hw/s390x/Makefile.objs index f1c058e..9c858c1 100644 --- a/hw/s390x/Makefile.objs +++ b/hw/s390x/Makefile.objs @@ -13,6 +13,7 @@ obj-$(CONFIG_VIRTIO_BALLOON) +=3D virtio-ccw-balloon.o obj-$(CONFIG_VIRTIO_SCSI) +=3D virtio-ccw-scsi.o obj-$(CONFIG_VIRTIO_RNG) +=3D virtio-ccw-rng.o obj-$(CONFIG_VIRTIO_CRYPTO) +=3D virtio-ccw-crypto.o +obj-$(CONFIG_VIRTIO_GPU) +=3D virtio-ccw-gpu.o obj-$(call land,$(CONFIG_VIRTIO_9P),$(CONFIG_VIRTFS)) +=3D virtio-ccw-9p.o obj-$(CONFIG_VHOST_VSOCK) +=3D vhost-vsock-ccw.o obj-y +=3D css-bridge.o diff --git a/hw/s390x/virtio-ccw-gpu.c b/hw/s390x/virtio-ccw-gpu.c new file mode 100644 index 0000000..71869b7 --- /dev/null +++ b/hw/s390x/virtio-ccw-gpu.c @@ -0,0 +1,67 @@ +/* + * virtio ccw gpu implementation + * + * Copyright 2012, 2015 IBM Corp. + * + * 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.h" +#include "qapi/error.h" +#include "virtio-ccw.h" + +static void virtio_ccw_gpu_realize(VirtioCcwDevice *ccw_dev, Error **errp) +{ + VirtIOGPUCcw *dev =3D VIRTIO_GPU_CCW(ccw_dev); + DeviceState *vdev =3D DEVICE(&dev->vdev); + + qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus)); + object_property_set_bool(OBJECT(vdev), true, "realized", errp); +} + +static void virtio_ccw_gpu_instance_init(Object *obj) +{ + VirtIOGPUCcw *dev =3D VIRTIO_GPU_CCW(obj); + VirtioCcwDevice *ccw_dev =3D VIRTIO_CCW_DEVICE(obj); + + ccw_dev->force_revision_1 =3D true; + virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), + TYPE_VIRTIO_GPU); +} + +static Property virtio_ccw_gpu_properties[] =3D { + DEFINE_PROP_BIT("ioeventfd", VirtioCcwDevice, flags, + VIRTIO_CCW_FLAG_USE_IOEVENTFD_BIT, true), + DEFINE_PROP_UINT32("max_revision", VirtioCcwDevice, max_rev, + VIRTIO_CCW_MAX_REV), + DEFINE_PROP_END_OF_LIST(), +}; + +static void virtio_ccw_gpu_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); + + k->realize =3D virtio_ccw_gpu_realize; + dc->props =3D virtio_ccw_gpu_properties; + dc->hotpluggable =3D false; + set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories); +} + +static const TypeInfo virtio_ccw_gpu =3D { + .name =3D TYPE_VIRTIO_GPU_CCW, + .parent =3D TYPE_VIRTIO_CCW_DEVICE, + .instance_size =3D sizeof(VirtIOGPUCcw), + .instance_init =3D virtio_ccw_gpu_instance_init, + .class_init =3D virtio_ccw_gpu_class_init, +}; + +static void virtio_ccw_gpu_register(void) +{ + type_register_static(&virtio_ccw_gpu); +} + +type_init(virtio_ccw_gpu_register) diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c index eff4214..f2aabb3 100644 --- a/hw/s390x/virtio-ccw.c +++ b/hw/s390x/virtio-ccw.c @@ -811,15 +811,6 @@ static void virtio_ccw_blk_instance_init(Object *obj) "bootindex", &error_abort); } =20 -static void virtio_ccw_gpu_realize(VirtioCcwDevice *ccw_dev, Error **errp) -{ - VirtIOGPUCcw *dev =3D VIRTIO_GPU_CCW(ccw_dev); - DeviceState *vdev =3D DEVICE(&dev->vdev); - - qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus)); - object_property_set_bool(OBJECT(vdev), true, "realized", errp); -} - static void virtio_ccw_input_realize(VirtioCcwDevice *ccw_dev, Error **err= p) { VirtIOInputCcw *dev =3D VIRTIO_INPUT_CCW(ccw_dev); @@ -1255,43 +1246,6 @@ static const TypeInfo virtio_ccw_blk =3D { .class_init =3D virtio_ccw_blk_class_init, }; =20 -static Property virtio_ccw_gpu_properties[] =3D { - DEFINE_PROP_BIT("ioeventfd", VirtioCcwDevice, flags, - VIRTIO_CCW_FLAG_USE_IOEVENTFD_BIT, true), - DEFINE_PROP_UINT32("max_revision", VirtioCcwDevice, max_rev, - VIRTIO_CCW_MAX_REV), - DEFINE_PROP_END_OF_LIST(), -}; - -static void virtio_ccw_gpu_instance_init(Object *obj) -{ - VirtIOGPUCcw *dev =3D VIRTIO_GPU_CCW(obj); - VirtioCcwDevice *ccw_dev =3D VIRTIO_CCW_DEVICE(obj); - - ccw_dev->force_revision_1 =3D true; - virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), - TYPE_VIRTIO_GPU); -} - -static void virtio_ccw_gpu_class_init(ObjectClass *klass, void *data) -{ - DeviceClass *dc =3D DEVICE_CLASS(klass); - VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); - - k->realize =3D virtio_ccw_gpu_realize; - dc->props =3D virtio_ccw_gpu_properties; - dc->hotpluggable =3D false; - set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories); -} - -static const TypeInfo virtio_ccw_gpu =3D { - .name =3D TYPE_VIRTIO_GPU_CCW, - .parent =3D TYPE_VIRTIO_CCW_DEVICE, - .instance_size =3D sizeof(VirtIOGPUCcw), - .instance_init =3D virtio_ccw_gpu_instance_init, - .class_init =3D virtio_ccw_gpu_class_init, -}; - static Property virtio_ccw_input_properties[] =3D { DEFINE_PROP_BIT("ioeventfd", VirtioCcwDevice, flags, VIRTIO_CCW_FLAG_USE_IOEVENTFD_BIT, true), @@ -1467,7 +1421,6 @@ static void virtio_ccw_register(void) type_register_static(&virtio_ccw_device_info); type_register_static(&virtio_ccw_blk); type_register_static(&virtio_ccw_net); - type_register_static(&virtio_ccw_gpu); type_register_static(&virtio_ccw_input); type_register_static(&virtio_ccw_input_hid); type_register_static(&virtio_ccw_keyboard); --=20 1.8.3.1 From nobody Wed Nov 5 02:29:54 2025 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 153252232798043.60557761775067; Wed, 25 Jul 2018 05:38:47 -0700 (PDT) Received: from localhost ([::1]:49314 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fiJ42-0004Dl-MU for importer@patchew.org; Wed, 25 Jul 2018 08:38:46 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40661) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fiIml-0006Hu-9l for qemu-devel@nongnu.org; Wed, 25 Jul 2018 08:20:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fiImi-0002aV-1q for qemu-devel@nongnu.org; Wed, 25 Jul 2018 08:20:55 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:52266 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 1fiImh-0002Zf-JK; Wed, 25 Jul 2018 08:20:51 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3807A8197003; Wed, 25 Jul 2018 12:20:51 +0000 (UTC) Received: from thh440s.redhat.com (ovpn-117-198.ams2.redhat.com [10.36.117.198]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8AB2C1684A; Wed, 25 Jul 2018 12:20:49 +0000 (UTC) From: Thomas Huth To: Cornelia Huck , David Hildenbrand , qemu-s390x@nongnu.org Date: Wed, 25 Jul 2018 14:20:24 +0200 Message-Id: <1532521224-27235-11-git-send-email-thuth@redhat.com> In-Reply-To: <1532521224-27235-1-git-send-email-thuth@redhat.com> References: <1532521224-27235-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Wed, 25 Jul 2018 12:20:51 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Wed, 25 Jul 2018 12:20:51 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'thuth@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH for-3.1 10/10] hw/s390x: Move virtio-ccw-input code to a separate file 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: Christian Borntraeger , qemu-devel@nongnu.org, Juan Quintela Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The code should only be enabled if CONFIG_VIRTIO_INPUT has been set. This can be done best if the code resides in a separate file. Signed-off-by: Thomas Huth --- hw/s390x/Makefile.objs | 1 + hw/s390x/virtio-ccw-input.c | 118 ++++++++++++++++++++++++++++++++++++++++= ++++ hw/s390x/virtio-ccw.c | 98 ------------------------------------ 3 files changed, 119 insertions(+), 98 deletions(-) create mode 100644 hw/s390x/virtio-ccw-input.c diff --git a/hw/s390x/Makefile.objs b/hw/s390x/Makefile.objs index 9c858c1..0d7e162 100644 --- a/hw/s390x/Makefile.objs +++ b/hw/s390x/Makefile.objs @@ -14,6 +14,7 @@ obj-$(CONFIG_VIRTIO_SCSI) +=3D virtio-ccw-scsi.o obj-$(CONFIG_VIRTIO_RNG) +=3D virtio-ccw-rng.o obj-$(CONFIG_VIRTIO_CRYPTO) +=3D virtio-ccw-crypto.o obj-$(CONFIG_VIRTIO_GPU) +=3D virtio-ccw-gpu.o +obj-$(CONFIG_VIRTIO_INPUT) +=3D virtio-ccw-input.o obj-$(call land,$(CONFIG_VIRTIO_9P),$(CONFIG_VIRTFS)) +=3D virtio-ccw-9p.o obj-$(CONFIG_VHOST_VSOCK) +=3D vhost-vsock-ccw.o obj-y +=3D css-bridge.o diff --git a/hw/s390x/virtio-ccw-input.c b/hw/s390x/virtio-ccw-input.c new file mode 100644 index 0000000..79c87cb --- /dev/null +++ b/hw/s390x/virtio-ccw-input.c @@ -0,0 +1,118 @@ +/* + * virtio ccw scsi implementation + * + * Copyright 2012, 2015 IBM Corp. + * + * 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.h" +#include "qapi/error.h" +#include "virtio-ccw.h" + +static void virtio_ccw_input_realize(VirtioCcwDevice *ccw_dev, Error **err= p) +{ + VirtIOInputCcw *dev =3D VIRTIO_INPUT_CCW(ccw_dev); + DeviceState *vdev =3D DEVICE(&dev->vdev); + + qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus)); + object_property_set_bool(OBJECT(vdev), true, "realized", errp); +} + +static Property virtio_ccw_input_properties[] =3D { + DEFINE_PROP_BIT("ioeventfd", VirtioCcwDevice, flags, + VIRTIO_CCW_FLAG_USE_IOEVENTFD_BIT, true), + DEFINE_PROP_UINT32("max_revision", VirtioCcwDevice, max_rev, + VIRTIO_CCW_MAX_REV), + DEFINE_PROP_END_OF_LIST(), +}; + +static void virtio_ccw_input_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); + + k->realize =3D virtio_ccw_input_realize; + dc->props =3D virtio_ccw_input_properties; + set_bit(DEVICE_CATEGORY_INPUT, dc->categories); +} + +static void virtio_ccw_keyboard_instance_init(Object *obj) +{ + VirtIOInputHIDCcw *dev =3D VIRTIO_INPUT_HID_CCW(obj); + VirtioCcwDevice *ccw_dev =3D VIRTIO_CCW_DEVICE(obj); + + ccw_dev->force_revision_1 =3D true; + virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), + TYPE_VIRTIO_KEYBOARD); +} + +static void virtio_ccw_mouse_instance_init(Object *obj) +{ + VirtIOInputHIDCcw *dev =3D VIRTIO_INPUT_HID_CCW(obj); + VirtioCcwDevice *ccw_dev =3D VIRTIO_CCW_DEVICE(obj); + + ccw_dev->force_revision_1 =3D true; + virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), + TYPE_VIRTIO_MOUSE); +} + +static void virtio_ccw_tablet_instance_init(Object *obj) +{ + VirtIOInputHIDCcw *dev =3D VIRTIO_INPUT_HID_CCW(obj); + VirtioCcwDevice *ccw_dev =3D VIRTIO_CCW_DEVICE(obj); + + ccw_dev->force_revision_1 =3D true; + virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), + TYPE_VIRTIO_TABLET); +} + +static const TypeInfo virtio_ccw_input =3D { + .name =3D TYPE_VIRTIO_INPUT_CCW, + .parent =3D TYPE_VIRTIO_CCW_DEVICE, + .instance_size =3D sizeof(VirtIOInputCcw), + .class_init =3D virtio_ccw_input_class_init, + .abstract =3D true, +}; + +static const TypeInfo virtio_ccw_input_hid =3D { + .name =3D TYPE_VIRTIO_INPUT_HID_CCW, + .parent =3D TYPE_VIRTIO_INPUT_CCW, + .instance_size =3D sizeof(VirtIOInputHIDCcw), + .abstract =3D true, +}; + +static const TypeInfo virtio_ccw_keyboard =3D { + .name =3D TYPE_VIRTIO_KEYBOARD_CCW, + .parent =3D TYPE_VIRTIO_INPUT_HID_CCW, + .instance_size =3D sizeof(VirtIOInputHIDCcw), + .instance_init =3D virtio_ccw_keyboard_instance_init, +}; + +static const TypeInfo virtio_ccw_mouse =3D { + .name =3D TYPE_VIRTIO_MOUSE_CCW, + .parent =3D TYPE_VIRTIO_INPUT_HID_CCW, + .instance_size =3D sizeof(VirtIOInputHIDCcw), + .instance_init =3D virtio_ccw_mouse_instance_init, +}; + +static const TypeInfo virtio_ccw_tablet =3D { + .name =3D TYPE_VIRTIO_TABLET_CCW, + .parent =3D TYPE_VIRTIO_INPUT_HID_CCW, + .instance_size =3D sizeof(VirtIOInputHIDCcw), + .instance_init =3D virtio_ccw_tablet_instance_init, +}; + +static void virtio_ccw_input_register(void) +{ + type_register_static(&virtio_ccw_input); + type_register_static(&virtio_ccw_input_hid); + type_register_static(&virtio_ccw_keyboard); + type_register_static(&virtio_ccw_mouse); + type_register_static(&virtio_ccw_tablet); +} + +type_init(virtio_ccw_input_register) diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c index f2aabb3..2c20434 100644 --- a/hw/s390x/virtio-ccw.c +++ b/hw/s390x/virtio-ccw.c @@ -811,15 +811,6 @@ static void virtio_ccw_blk_instance_init(Object *obj) "bootindex", &error_abort); } =20 -static void virtio_ccw_input_realize(VirtioCcwDevice *ccw_dev, Error **err= p) -{ - VirtIOInputCcw *dev =3D VIRTIO_INPUT_CCW(ccw_dev); - DeviceState *vdev =3D DEVICE(&dev->vdev); - - qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus)); - object_property_set_bool(OBJECT(vdev), true, "realized", errp); -} - /* DeviceState to VirtioCcwDevice. Note: used on datapath, * be careful and test performance if you change this. */ @@ -1246,90 +1237,6 @@ static const TypeInfo virtio_ccw_blk =3D { .class_init =3D virtio_ccw_blk_class_init, }; =20 -static Property virtio_ccw_input_properties[] =3D { - DEFINE_PROP_BIT("ioeventfd", VirtioCcwDevice, flags, - VIRTIO_CCW_FLAG_USE_IOEVENTFD_BIT, true), - DEFINE_PROP_UINT32("max_revision", VirtioCcwDevice, max_rev, - VIRTIO_CCW_MAX_REV), - DEFINE_PROP_END_OF_LIST(), -}; - -static void virtio_ccw_input_class_init(ObjectClass *klass, void *data) -{ - DeviceClass *dc =3D DEVICE_CLASS(klass); - VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); - - k->realize =3D virtio_ccw_input_realize; - dc->props =3D virtio_ccw_input_properties; - set_bit(DEVICE_CATEGORY_INPUT, dc->categories); -} - -static void virtio_ccw_keyboard_instance_init(Object *obj) -{ - VirtIOInputHIDCcw *dev =3D VIRTIO_INPUT_HID_CCW(obj); - VirtioCcwDevice *ccw_dev =3D VIRTIO_CCW_DEVICE(obj); - - ccw_dev->force_revision_1 =3D true; - virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), - TYPE_VIRTIO_KEYBOARD); -} - -static void virtio_ccw_mouse_instance_init(Object *obj) -{ - VirtIOInputHIDCcw *dev =3D VIRTIO_INPUT_HID_CCW(obj); - VirtioCcwDevice *ccw_dev =3D VIRTIO_CCW_DEVICE(obj); - - ccw_dev->force_revision_1 =3D true; - virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), - TYPE_VIRTIO_MOUSE); -} - -static void virtio_ccw_tablet_instance_init(Object *obj) -{ - VirtIOInputHIDCcw *dev =3D VIRTIO_INPUT_HID_CCW(obj); - VirtioCcwDevice *ccw_dev =3D VIRTIO_CCW_DEVICE(obj); - - ccw_dev->force_revision_1 =3D true; - virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), - TYPE_VIRTIO_TABLET); -} - -static const TypeInfo virtio_ccw_input =3D { - .name =3D TYPE_VIRTIO_INPUT_CCW, - .parent =3D TYPE_VIRTIO_CCW_DEVICE, - .instance_size =3D sizeof(VirtIOInputCcw), - .class_init =3D virtio_ccw_input_class_init, - .abstract =3D true, -}; - -static const TypeInfo virtio_ccw_input_hid =3D { - .name =3D TYPE_VIRTIO_INPUT_HID_CCW, - .parent =3D TYPE_VIRTIO_INPUT_CCW, - .instance_size =3D sizeof(VirtIOInputHIDCcw), - .abstract =3D true, -}; - -static const TypeInfo virtio_ccw_keyboard =3D { - .name =3D TYPE_VIRTIO_KEYBOARD_CCW, - .parent =3D TYPE_VIRTIO_INPUT_HID_CCW, - .instance_size =3D sizeof(VirtIOInputHIDCcw), - .instance_init =3D virtio_ccw_keyboard_instance_init, -}; - -static const TypeInfo virtio_ccw_mouse =3D { - .name =3D TYPE_VIRTIO_MOUSE_CCW, - .parent =3D TYPE_VIRTIO_INPUT_HID_CCW, - .instance_size =3D sizeof(VirtIOInputHIDCcw), - .instance_init =3D virtio_ccw_mouse_instance_init, -}; - -static const TypeInfo virtio_ccw_tablet =3D { - .name =3D TYPE_VIRTIO_TABLET_CCW, - .parent =3D TYPE_VIRTIO_INPUT_HID_CCW, - .instance_size =3D sizeof(VirtIOInputHIDCcw), - .instance_init =3D virtio_ccw_tablet_instance_init, -}; - static void virtio_ccw_busdev_realize(DeviceState *dev, Error **errp) { VirtioCcwDevice *_dev =3D (VirtioCcwDevice *)dev; @@ -1421,11 +1328,6 @@ static void virtio_ccw_register(void) type_register_static(&virtio_ccw_device_info); type_register_static(&virtio_ccw_blk); type_register_static(&virtio_ccw_net); - type_register_static(&virtio_ccw_input); - type_register_static(&virtio_ccw_input_hid); - type_register_static(&virtio_ccw_keyboard); - type_register_static(&virtio_ccw_mouse); - type_register_static(&virtio_ccw_tablet); } =20 type_init(virtio_ccw_register) --=20 1.8.3.1 From nobody Wed Nov 5 02:29:54 2025 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 1532542146152722.7199707431247; Wed, 25 Jul 2018 11:09:06 -0700 (PDT) Received: from localhost ([::1]:54251 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fiODg-00026o-OC for importer@patchew.org; Wed, 25 Jul 2018 14:09:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35660) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fiOCP-0001hC-G5 for qemu-devel@nongnu.org; Wed, 25 Jul 2018 14:07:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fiOCM-0004ND-Ew for qemu-devel@nongnu.org; Wed, 25 Jul 2018 14:07:45 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:53484 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 1fiOCM-0004Mz-9D; Wed, 25 Jul 2018 14:07:42 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 93E8140241C0; Wed, 25 Jul 2018 18:07:41 +0000 (UTC) Received: from thh440s.redhat.com (ovpn-116-124.ams2.redhat.com [10.36.116.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8ADD3111DCF5; Wed, 25 Jul 2018 18:07:37 +0000 (UTC) From: Thomas Huth To: Cornelia Huck , David Hildenbrand , qemu-s390x@nongnu.org Date: Wed, 25 Jul 2018 20:07:36 +0200 Message-Id: <1532542056-8927-1-git-send-email-thuth@redhat.com> In-Reply-To: <1532521224-27235-1-git-send-email-thuth@redhat.com> References: <1532521224-27235-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 25 Jul 2018 18:07:41 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 25 Jul 2018 18:07:41 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'thuth@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH for-3.1 11/10] hw/s390x: Move virtio-ccw-net code to a separate file 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: Christian Borntraeger , qemu-devel@nongnu.org, Juan Quintela Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The code should only be enabled if CONFIG_VIRTIO_NET has been set. This can be done best if the code resides in a separate file. Signed-off-by: Thomas Huth --- hw/s390x/Makefile.objs | 1 + hw/s390x/virtio-ccw-net.c | 70 +++++++++++++++++++++++++++++++++++++++++++= ++++ hw/s390x/virtio-ccw.c | 49 --------------------------------- 3 files changed, 71 insertions(+), 49 deletions(-) create mode 100644 hw/s390x/virtio-ccw-net.c diff --git a/hw/s390x/Makefile.objs b/hw/s390x/Makefile.objs index 0d7e162..172ba55 100644 --- a/hw/s390x/Makefile.objs +++ b/hw/s390x/Makefile.objs @@ -15,6 +15,7 @@ obj-$(CONFIG_VIRTIO_RNG) +=3D virtio-ccw-rng.o obj-$(CONFIG_VIRTIO_CRYPTO) +=3D virtio-ccw-crypto.o obj-$(CONFIG_VIRTIO_GPU) +=3D virtio-ccw-gpu.o obj-$(CONFIG_VIRTIO_INPUT) +=3D virtio-ccw-input.o +obj-$(CONFIG_VIRTIO_NET) +=3D virtio-ccw-net.o obj-$(call land,$(CONFIG_VIRTIO_9P),$(CONFIG_VIRTFS)) +=3D virtio-ccw-9p.o obj-$(CONFIG_VHOST_VSOCK) +=3D vhost-vsock-ccw.o obj-y +=3D css-bridge.o diff --git a/hw/s390x/virtio-ccw-net.c b/hw/s390x/virtio-ccw-net.c new file mode 100644 index 0000000..0c0410c --- /dev/null +++ b/hw/s390x/virtio-ccw-net.c @@ -0,0 +1,70 @@ +/* + * virtio ccw net implementation + * + * Copyright 2012, 2015 IBM Corp. + * Author(s): Cornelia Huck + * + * 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.h" +#include "qapi/error.h" +#include "virtio-ccw.h" + +static void virtio_ccw_net_realize(VirtioCcwDevice *ccw_dev, Error **errp) +{ + DeviceState *qdev =3D DEVICE(ccw_dev); + VirtIONetCcw *dev =3D VIRTIO_NET_CCW(ccw_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(&ccw_dev->bus)); + object_property_set_bool(OBJECT(vdev), true, "realized", errp); +} + +static void virtio_ccw_net_instance_init(Object *obj) +{ + VirtIONetCcw *dev =3D VIRTIO_NET_CCW(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 Property virtio_ccw_net_properties[] =3D { + DEFINE_PROP_BIT("ioeventfd", VirtioCcwDevice, flags, + VIRTIO_CCW_FLAG_USE_IOEVENTFD_BIT, true), + DEFINE_PROP_UINT32("max_revision", VirtioCcwDevice, max_rev, + VIRTIO_CCW_MAX_REV), + DEFINE_PROP_END_OF_LIST(), +}; + +static void virtio_ccw_net_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); + + k->realize =3D virtio_ccw_net_realize; + dc->props =3D virtio_ccw_net_properties; + set_bit(DEVICE_CATEGORY_NETWORK, dc->categories); +} + +static const TypeInfo virtio_ccw_net =3D { + .name =3D TYPE_VIRTIO_NET_CCW, + .parent =3D TYPE_VIRTIO_CCW_DEVICE, + .instance_size =3D sizeof(VirtIONetCcw), + .instance_init =3D virtio_ccw_net_instance_init, + .class_init =3D virtio_ccw_net_class_init, +}; + +static void virtio_ccw_net_register(void) +{ + type_register_static(&virtio_ccw_net); +} + +type_init(virtio_ccw_net_register) diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c index 2c20434..ca552d9 100644 --- a/hw/s390x/virtio-ccw.c +++ b/hw/s390x/virtio-ccw.c @@ -770,28 +770,6 @@ static void virtio_ccw_device_unrealize(VirtioCcwDevic= e *dev, Error **errp) } } =20 -static void virtio_ccw_net_realize(VirtioCcwDevice *ccw_dev, Error **errp) -{ - DeviceState *qdev =3D DEVICE(ccw_dev); - VirtIONetCcw *dev =3D VIRTIO_NET_CCW(ccw_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(&ccw_dev->bus)); - object_property_set_bool(OBJECT(vdev), true, "realized", errp); -} - -static void virtio_ccw_net_instance_init(Object *obj) -{ - VirtIONetCcw *dev =3D VIRTIO_NET_CCW(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 void virtio_ccw_blk_realize(VirtioCcwDevice *ccw_dev, Error **errp) { VirtIOBlkCcw *dev =3D VIRTIO_BLK_CCW(ccw_dev); @@ -1185,32 +1163,6 @@ static void virtio_ccw_device_unplugged(DeviceState = *d) } /**************** Virtio-ccw Bus Device Descriptions *******************/ =20 -static Property virtio_ccw_net_properties[] =3D { - DEFINE_PROP_BIT("ioeventfd", VirtioCcwDevice, flags, - VIRTIO_CCW_FLAG_USE_IOEVENTFD_BIT, true), - DEFINE_PROP_UINT32("max_revision", VirtioCcwDevice, max_rev, - VIRTIO_CCW_MAX_REV), - DEFINE_PROP_END_OF_LIST(), -}; - -static void virtio_ccw_net_class_init(ObjectClass *klass, void *data) -{ - DeviceClass *dc =3D DEVICE_CLASS(klass); - VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); - - k->realize =3D virtio_ccw_net_realize; - dc->props =3D virtio_ccw_net_properties; - set_bit(DEVICE_CATEGORY_NETWORK, dc->categories); -} - -static const TypeInfo virtio_ccw_net =3D { - .name =3D TYPE_VIRTIO_NET_CCW, - .parent =3D TYPE_VIRTIO_CCW_DEVICE, - .instance_size =3D sizeof(VirtIONetCcw), - .instance_init =3D virtio_ccw_net_instance_init, - .class_init =3D virtio_ccw_net_class_init, -}; - static Property virtio_ccw_blk_properties[] =3D { DEFINE_PROP_BIT("ioeventfd", VirtioCcwDevice, flags, VIRTIO_CCW_FLAG_USE_IOEVENTFD_BIT, true), @@ -1327,7 +1279,6 @@ static void virtio_ccw_register(void) type_register_static(&virtio_ccw_bus_info); type_register_static(&virtio_ccw_device_info); type_register_static(&virtio_ccw_blk); - type_register_static(&virtio_ccw_net); } =20 type_init(virtio_ccw_register) --=20 1.8.3.1 From nobody Wed Nov 5 02:29:54 2025 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 1532542215141170.03434350556404; Wed, 25 Jul 2018 11:10:15 -0700 (PDT) Received: from localhost ([::1]:54255 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fiOEd-0002lq-Su for importer@patchew.org; Wed, 25 Jul 2018 14:10:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35776) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fiODE-00024D-8a for qemu-devel@nongnu.org; Wed, 25 Jul 2018 14:08:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fiODB-0004lt-6f for qemu-devel@nongnu.org; Wed, 25 Jul 2018 14:08:36 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:53512 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 1fiODB-0004lg-0d; Wed, 25 Jul 2018 14:08:33 -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 AC56140241C0; Wed, 25 Jul 2018 18:08:32 +0000 (UTC) Received: from thh440s.redhat.com (ovpn-116-124.ams2.redhat.com [10.36.116.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id 027D82026D68; Wed, 25 Jul 2018 18:08:30 +0000 (UTC) From: Thomas Huth To: Cornelia Huck , David Hildenbrand , qemu-s390x@nongnu.org Date: Wed, 25 Jul 2018 20:08:30 +0200 Message-Id: <1532542110-9017-1-git-send-email-thuth@redhat.com> In-Reply-To: <1532521224-27235-1-git-send-email-thuth@redhat.com> References: <1532521224-27235-1-git-send-email-thuth@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, 25 Jul 2018 18:08:32 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 25 Jul 2018 18:08:32 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'thuth@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH for-3.1 12/10] hw/s390x: Move virtio-ccw-blk code to a separate file 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: Christian Borntraeger , qemu-devel@nongnu.org, Juan Quintela Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The code should only be enabled if CONFIG_VIRTIO_BLK has been set. This can be done best if the code resides in a separate file. Signed-off-by: Thomas Huth --- hw/s390x/Makefile.objs | 1 + hw/s390x/virtio-ccw-blk.c | 67 +++++++++++++++++++++++++++++++++++++++++++= ++++ hw/s390x/virtio-ccw.c | 46 -------------------------------- 3 files changed, 68 insertions(+), 46 deletions(-) create mode 100644 hw/s390x/virtio-ccw-blk.c diff --git a/hw/s390x/Makefile.objs b/hw/s390x/Makefile.objs index 172ba55..5dbc00c 100644 --- a/hw/s390x/Makefile.objs +++ b/hw/s390x/Makefile.objs @@ -16,6 +16,7 @@ obj-$(CONFIG_VIRTIO_CRYPTO) +=3D virtio-ccw-crypto.o obj-$(CONFIG_VIRTIO_GPU) +=3D virtio-ccw-gpu.o obj-$(CONFIG_VIRTIO_INPUT) +=3D virtio-ccw-input.o obj-$(CONFIG_VIRTIO_NET) +=3D virtio-ccw-net.o +obj-$(CONFIG_VIRTIO_BLK) +=3D virtio-ccw-blk.o obj-$(call land,$(CONFIG_VIRTIO_9P),$(CONFIG_VIRTFS)) +=3D virtio-ccw-9p.o obj-$(CONFIG_VHOST_VSOCK) +=3D vhost-vsock-ccw.o obj-y +=3D css-bridge.o diff --git a/hw/s390x/virtio-ccw-blk.c b/hw/s390x/virtio-ccw-blk.c new file mode 100644 index 0000000..1f3d09a --- /dev/null +++ b/hw/s390x/virtio-ccw-blk.c @@ -0,0 +1,67 @@ +/* + * virtio ccw block implementation + * + * Copyright 2012, 2015 IBM Corp. + * Author(s): Cornelia Huck + * + * 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.h" +#include "qapi/error.h" +#include "virtio-ccw.h" + +static void virtio_ccw_blk_realize(VirtioCcwDevice *ccw_dev, Error **errp) +{ + VirtIOBlkCcw *dev =3D VIRTIO_BLK_CCW(ccw_dev); + DeviceState *vdev =3D DEVICE(&dev->vdev); + + qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus)); + object_property_set_bool(OBJECT(vdev), true, "realized", errp); +} + +static void virtio_ccw_blk_instance_init(Object *obj) +{ + VirtIOBlkCcw *dev =3D VIRTIO_BLK_CCW(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 Property virtio_ccw_blk_properties[] =3D { + DEFINE_PROP_BIT("ioeventfd", VirtioCcwDevice, flags, + VIRTIO_CCW_FLAG_USE_IOEVENTFD_BIT, true), + DEFINE_PROP_UINT32("max_revision", VirtioCcwDevice, max_rev, + VIRTIO_CCW_MAX_REV), + DEFINE_PROP_END_OF_LIST(), +}; + +static void virtio_ccw_blk_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); + + k->realize =3D virtio_ccw_blk_realize; + dc->props =3D virtio_ccw_blk_properties; + set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); +} + +static const TypeInfo virtio_ccw_blk =3D { + .name =3D TYPE_VIRTIO_BLK_CCW, + .parent =3D TYPE_VIRTIO_CCW_DEVICE, + .instance_size =3D sizeof(VirtIOBlkCcw), + .instance_init =3D virtio_ccw_blk_instance_init, + .class_init =3D virtio_ccw_blk_class_init, +}; + +static void virtio_ccw_blk_register(void) +{ + type_register_static(&virtio_ccw_blk); +} + +type_init(virtio_ccw_blk_register) diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c index ca552d9..598de75 100644 --- a/hw/s390x/virtio-ccw.c +++ b/hw/s390x/virtio-ccw.c @@ -770,25 +770,6 @@ static void virtio_ccw_device_unrealize(VirtioCcwDevic= e *dev, Error **errp) } } =20 -static void virtio_ccw_blk_realize(VirtioCcwDevice *ccw_dev, Error **errp) -{ - VirtIOBlkCcw *dev =3D VIRTIO_BLK_CCW(ccw_dev); - DeviceState *vdev =3D DEVICE(&dev->vdev); - - qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus)); - object_property_set_bool(OBJECT(vdev), true, "realized", errp); -} - -static void virtio_ccw_blk_instance_init(Object *obj) -{ - VirtIOBlkCcw *dev =3D VIRTIO_BLK_CCW(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); -} - /* DeviceState to VirtioCcwDevice. Note: used on datapath, * be careful and test performance if you change this. */ @@ -1163,32 +1144,6 @@ static void virtio_ccw_device_unplugged(DeviceState = *d) } /**************** Virtio-ccw Bus Device Descriptions *******************/ =20 -static Property virtio_ccw_blk_properties[] =3D { - DEFINE_PROP_BIT("ioeventfd", VirtioCcwDevice, flags, - VIRTIO_CCW_FLAG_USE_IOEVENTFD_BIT, true), - DEFINE_PROP_UINT32("max_revision", VirtioCcwDevice, max_rev, - VIRTIO_CCW_MAX_REV), - DEFINE_PROP_END_OF_LIST(), -}; - -static void virtio_ccw_blk_class_init(ObjectClass *klass, void *data) -{ - DeviceClass *dc =3D DEVICE_CLASS(klass); - VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); - - k->realize =3D virtio_ccw_blk_realize; - dc->props =3D virtio_ccw_blk_properties; - set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); -} - -static const TypeInfo virtio_ccw_blk =3D { - .name =3D TYPE_VIRTIO_BLK_CCW, - .parent =3D TYPE_VIRTIO_CCW_DEVICE, - .instance_size =3D sizeof(VirtIOBlkCcw), - .instance_init =3D virtio_ccw_blk_instance_init, - .class_init =3D virtio_ccw_blk_class_init, -}; - static void virtio_ccw_busdev_realize(DeviceState *dev, Error **errp) { VirtioCcwDevice *_dev =3D (VirtioCcwDevice *)dev; @@ -1278,7 +1233,6 @@ static void virtio_ccw_register(void) { type_register_static(&virtio_ccw_bus_info); type_register_static(&virtio_ccw_device_info); - type_register_static(&virtio_ccw_blk); } =20 type_init(virtio_ccw_register) --=20 1.8.3.1