* [Qemu-devel] [PATCH for-3.1 01/10] hw/s390x/virtio-ccw: Consolidate calls to virtio_ccw_unrealize()
2018-07-25 12:20 [Qemu-devel] [PATCH for-3.1 00/10] Move virtio-ccw devices to separate files Thomas Huth
@ 2018-07-25 12:20 ` Thomas Huth
2018-07-26 9:15 ` Cornelia Huck
2018-07-25 12:20 ` [Qemu-devel] [PATCH for-3.1 02/10] hw/s390x: Move virtio-ccw-serial code to a separate file Thomas Huth
` (14 subsequent siblings)
15 siblings, 1 reply; 23+ messages in thread
From: Thomas Huth @ 2018-07-25 12:20 UTC (permalink / raw)
To: Cornelia Huck, David Hildenbrand, qemu-s390x
Cc: Christian Borntraeger, qemu-devel, Juan Quintela
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 <thuth@redhat.com>
---
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);
}
-static void virtio_ccw_unrealize(VirtioCcwDevice *dev, Error **errp)
+static void virtio_ccw_device_unrealize(VirtioCcwDevice *dev, Error **errp)
{
+ VirtIOCCWDeviceClass *dc = VIRTIO_CCW_DEVICE_GET_CLASS(dev);
CcwDevice *ccw_dev = CCW_DEVICE(dev);
SubchDev *sch = ccw_dev->sch;
+ if (dc->unrealize) {
+ dc->unrealize(dev, errp);
+ }
+
if (sch) {
css_subch_assign(sch->cssid, sch->ssid, sch->schid, sch->devno, NULL);
g_free(sch);
@@ -1349,7 +1354,6 @@ static void virtio_ccw_net_class_init(ObjectClass *klass, void *data)
VirtIOCCWDeviceClass *k = VIRTIO_CCW_DEVICE_CLASS(klass);
k->realize = virtio_ccw_net_realize;
- k->unrealize = virtio_ccw_unrealize;
dc->props = virtio_ccw_net_properties;
set_bit(DEVICE_CATEGORY_NETWORK, dc->categories);
}
@@ -1376,7 +1380,6 @@ static void virtio_ccw_blk_class_init(ObjectClass *klass, void *data)
VirtIOCCWDeviceClass *k = VIRTIO_CCW_DEVICE_CLASS(klass);
k->realize = virtio_ccw_blk_realize;
- k->unrealize = virtio_ccw_unrealize;
dc->props = 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 = VIRTIO_CCW_DEVICE_CLASS(klass);
k->realize = virtio_ccw_serial_realize;
- k->unrealize = virtio_ccw_unrealize;
dc->props = 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 = VIRTIO_CCW_DEVICE_CLASS(klass);
k->realize = virtio_ccw_balloon_realize;
- k->unrealize = virtio_ccw_unrealize;
dc->props = virtio_ccw_balloon_properties;
set_bit(DEVICE_CATEGORY_MISC, dc->categories);
}
@@ -1457,7 +1458,6 @@ static void virtio_ccw_scsi_class_init(ObjectClass *klass, void *data)
VirtIOCCWDeviceClass *k = VIRTIO_CCW_DEVICE_CLASS(klass);
k->realize = virtio_ccw_scsi_realize;
- k->unrealize = virtio_ccw_unrealize;
dc->props = virtio_ccw_scsi_properties;
set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
}
@@ -1483,7 +1483,6 @@ static void vhost_ccw_scsi_class_init(ObjectClass *klass, void *data)
VirtIOCCWDeviceClass *k = VIRTIO_CCW_DEVICE_CLASS(klass);
k->realize = vhost_ccw_scsi_realize;
- k->unrealize = virtio_ccw_unrealize;
dc->props = vhost_ccw_scsi_properties;
set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
}
@@ -1519,7 +1518,6 @@ static void virtio_ccw_rng_class_init(ObjectClass *klass, void *data)
VirtIOCCWDeviceClass *k = VIRTIO_CCW_DEVICE_CLASS(klass);
k->realize = virtio_ccw_rng_realize;
- k->unrealize = virtio_ccw_unrealize;
dc->props = 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 = VIRTIO_CCW_DEVICE_CLASS(klass);
k->realize = virtio_ccw_crypto_realize;
- k->unrealize = virtio_ccw_unrealize;
dc->props = virtio_ccw_crypto_properties;
set_bit(DEVICE_CATEGORY_MISC, dc->categories);
}
@@ -1593,7 +1590,6 @@ static void virtio_ccw_gpu_class_init(ObjectClass *klass, void *data)
VirtIOCCWDeviceClass *k = VIRTIO_CCW_DEVICE_CLASS(klass);
k->realize = virtio_ccw_gpu_realize;
- k->unrealize = virtio_ccw_unrealize;
dc->props = virtio_ccw_gpu_properties;
dc->hotpluggable = 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 = VIRTIO_CCW_DEVICE_CLASS(klass);
k->realize = virtio_ccw_input_realize;
- k->unrealize = virtio_ccw_unrealize;
dc->props = virtio_ccw_input_properties;
set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
}
@@ -1703,9 +1698,8 @@ static void virtio_ccw_busdev_realize(DeviceState *dev, Error **errp)
static void virtio_ccw_busdev_unrealize(DeviceState *dev, Error **errp)
{
VirtioCcwDevice *_dev = (VirtioCcwDevice *)dev;
- VirtIOCCWDeviceClass *_info = VIRTIO_CCW_DEVICE_GET_CLASS(dev);
- _info->unrealize(_dev, errp);
+ virtio_ccw_device_unrealize(_dev, errp);
}
static void virtio_ccw_busdev_unplug(HotplugHandler *hotplug_dev,
@@ -1801,7 +1795,6 @@ static void virtio_ccw_9p_class_init(ObjectClass *klass, void *data)
DeviceClass *dc = DEVICE_CLASS(klass);
VirtIOCCWDeviceClass *k = VIRTIO_CCW_DEVICE_CLASS(klass);
- k->unrealize = virtio_ccw_unrealize;
k->realize = virtio_ccw_9p_realize;
dc->props = virtio_ccw_9p_properties;
set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
@@ -1847,7 +1840,6 @@ static void vhost_vsock_ccw_class_init(ObjectClass *klass, void *data)
VirtIOCCWDeviceClass *k = VIRTIO_CCW_DEVICE_CLASS(klass);
k->realize = vhost_vsock_ccw_realize;
- k->unrealize = virtio_ccw_unrealize;
set_bit(DEVICE_CATEGORY_MISC, dc->categories);
dc->props = vhost_vsock_ccw_properties;
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* Re: [Qemu-devel] [PATCH for-3.1 01/10] hw/s390x/virtio-ccw: Consolidate calls to virtio_ccw_unrealize()
2018-07-25 12:20 ` [Qemu-devel] [PATCH for-3.1 01/10] hw/s390x/virtio-ccw: Consolidate calls to virtio_ccw_unrealize() Thomas Huth
@ 2018-07-26 9:15 ` Cornelia Huck
0 siblings, 0 replies; 23+ messages in thread
From: Cornelia Huck @ 2018-07-26 9:15 UTC (permalink / raw)
To: Thomas Huth
Cc: David Hildenbrand, qemu-s390x, Christian Borntraeger, qemu-devel,
Juan Quintela
On Wed, 25 Jul 2018 14:20:15 +0200
Thomas Huth <thuth@redhat.com> wrote:
> 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 <thuth@redhat.com>
> ---
> hw/s390x/virtio-ccw.c | 22 +++++++---------------
> 1 file changed, 7 insertions(+), 15 deletions(-)
LGTM now :)
^ permalink raw reply [flat|nested] 23+ messages in thread
* [Qemu-devel] [PATCH for-3.1 02/10] hw/s390x: Move virtio-ccw-serial code to a separate file
2018-07-25 12:20 [Qemu-devel] [PATCH for-3.1 00/10] Move virtio-ccw devices to separate files Thomas Huth
2018-07-25 12:20 ` [Qemu-devel] [PATCH for-3.1 01/10] hw/s390x/virtio-ccw: Consolidate calls to virtio_ccw_unrealize() Thomas Huth
@ 2018-07-25 12:20 ` Thomas Huth
2018-07-25 12:20 ` [Qemu-devel] [PATCH for-3.1 03/10] hw/s390x: Move virtio-ccw-balloon " Thomas Huth
` (13 subsequent siblings)
15 siblings, 0 replies; 23+ messages in thread
From: Thomas Huth @ 2018-07-25 12:20 UTC (permalink / raw)
To: Cornelia Huck, David Hildenbrand, qemu-s390x
Cc: Christian Borntraeger, qemu-devel, Juan Quintela
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 <thuth@redhat.com>
---
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 <cohuck@redhat.com>
M: Christian Borntraeger <borntraeger@de.ibm.com>
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 += css.o
obj-y += s390-virtio-ccw.o
obj-y += 3270-ccw.o
obj-y += virtio-ccw.o
+obj-$(CONFIG_VIRTIO_SERIAL) += virtio-ccw-serial.o
obj-y += css-bridge.o
obj-y += ccw-device.o
obj-$(CONFIG_PCI) += 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 <cornelia.huck@de.ibm.com>
+ *
+ * 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 **errp)
+{
+ VirtioSerialCcw *dev = VIRTIO_SERIAL_CCW(ccw_dev);
+ DeviceState *vdev = DEVICE(&dev->vdev);
+ DeviceState *proxy = 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 = 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 = VIRTIO_SERIAL_CCW(obj);
+
+ virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
+ TYPE_VIRTIO_SERIAL);
+}
+
+static Property virtio_ccw_serial_properties[] = {
+ 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 = DEVICE_CLASS(klass);
+ VirtIOCCWDeviceClass *k = VIRTIO_CCW_DEVICE_CLASS(klass);
+
+ k->realize = virtio_ccw_serial_realize;
+ dc->props = virtio_ccw_serial_properties;
+ set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
+}
+
+static const TypeInfo virtio_ccw_serial = {
+ .name = TYPE_VIRTIO_SERIAL_CCW,
+ .parent = TYPE_VIRTIO_CCW_DEVICE,
+ .instance_size = sizeof(VirtioSerialCcw),
+ .instance_init = virtio_ccw_serial_instance_init,
+ .class_init = 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);
}
-static void virtio_ccw_serial_realize(VirtioCcwDevice *ccw_dev, Error **errp)
-{
- VirtioSerialCcw *dev = VIRTIO_SERIAL_CCW(ccw_dev);
- DeviceState *vdev = DEVICE(&dev->vdev);
- DeviceState *proxy = 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 = 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 = 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 **errp)
{
VirtIOBalloonCcw *dev = VIRTIO_BALLOON_CCW(ccw_dev);
@@ -1392,32 +1361,6 @@ static const TypeInfo virtio_ccw_blk = {
.class_init = virtio_ccw_blk_class_init,
};
-static Property virtio_ccw_serial_properties[] = {
- 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 = DEVICE_CLASS(klass);
- VirtIOCCWDeviceClass *k = VIRTIO_CCW_DEVICE_CLASS(klass);
-
- k->realize = virtio_ccw_serial_realize;
- dc->props = virtio_ccw_serial_properties;
- set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
-}
-
-static const TypeInfo virtio_ccw_serial = {
- .name = TYPE_VIRTIO_SERIAL_CCW,
- .parent = TYPE_VIRTIO_CCW_DEVICE,
- .instance_size = sizeof(VirtioSerialCcw),
- .instance_init = virtio_ccw_serial_instance_init,
- .class_init = virtio_ccw_serial_class_init,
-};
-
static Property virtio_ccw_balloon_properties[] = {
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);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [Qemu-devel] [PATCH for-3.1 03/10] hw/s390x: Move virtio-ccw-balloon code to a separate file
2018-07-25 12:20 [Qemu-devel] [PATCH for-3.1 00/10] Move virtio-ccw devices to separate files Thomas Huth
2018-07-25 12:20 ` [Qemu-devel] [PATCH for-3.1 01/10] hw/s390x/virtio-ccw: Consolidate calls to virtio_ccw_unrealize() Thomas Huth
2018-07-25 12:20 ` [Qemu-devel] [PATCH for-3.1 02/10] hw/s390x: Move virtio-ccw-serial code to a separate file Thomas Huth
@ 2018-07-25 12:20 ` Thomas Huth
2018-07-25 12:20 ` [Qemu-devel] [PATCH for-3.1 04/10] hw/s390x: Move virtio-ccw-scsi " Thomas Huth
` (12 subsequent siblings)
15 siblings, 0 replies; 23+ messages in thread
From: Thomas Huth @ 2018-07-25 12:20 UTC (permalink / raw)
To: Cornelia Huck, David Hildenbrand, qemu-s390x
Cc: Christian Borntraeger, qemu-devel, Juan Quintela
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 <thuth@redhat.com>
---
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 += s390-virtio-ccw.o
obj-y += 3270-ccw.o
obj-y += virtio-ccw.o
obj-$(CONFIG_VIRTIO_SERIAL) += virtio-ccw-serial.o
+obj-$(CONFIG_VIRTIO_BALLOON) += virtio-ccw-balloon.o
obj-y += css-bridge.o
obj-y += ccw-device.o
obj-$(CONFIG_PCI) += 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 <cornelia.huck@de.ibm.com>
+ *
+ * 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 **errp)
+{
+ VirtIOBalloonCcw *dev = VIRTIO_BALLOON_CCW(ccw_dev);
+ DeviceState *vdev = 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 = 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[] = {
+ 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 = DEVICE_CLASS(klass);
+ VirtIOCCWDeviceClass *k = VIRTIO_CCW_DEVICE_CLASS(klass);
+
+ k->realize = virtio_ccw_balloon_realize;
+ dc->props = virtio_ccw_balloon_properties;
+ set_bit(DEVICE_CATEGORY_MISC, dc->categories);
+}
+
+static const TypeInfo virtio_ccw_balloon = {
+ .name = TYPE_VIRTIO_BALLOON_CCW,
+ .parent = TYPE_VIRTIO_CCW_DEVICE,
+ .instance_size = sizeof(VirtIOBalloonCcw),
+ .instance_init = virtio_ccw_balloon_instance_init,
+ .class_init = 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);
}
-static void virtio_ccw_balloon_realize(VirtioCcwDevice *ccw_dev, Error **errp)
-{
- VirtIOBalloonCcw *dev = VIRTIO_BALLOON_CCW(ccw_dev);
- DeviceState *vdev = 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 = 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 = VIRTIO_SCSI_CCW(ccw_dev);
@@ -1361,32 +1339,6 @@ static const TypeInfo virtio_ccw_blk = {
.class_init = virtio_ccw_blk_class_init,
};
-static Property virtio_ccw_balloon_properties[] = {
- 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 = DEVICE_CLASS(klass);
- VirtIOCCWDeviceClass *k = VIRTIO_CCW_DEVICE_CLASS(klass);
-
- k->realize = virtio_ccw_balloon_realize;
- dc->props = virtio_ccw_balloon_properties;
- set_bit(DEVICE_CATEGORY_MISC, dc->categories);
-}
-
-static const TypeInfo virtio_ccw_balloon = {
- .name = TYPE_VIRTIO_BALLOON_CCW,
- .parent = TYPE_VIRTIO_CCW_DEVICE,
- .instance_size = sizeof(VirtIOBalloonCcw),
- .instance_init = virtio_ccw_balloon_instance_init,
- .class_init = virtio_ccw_balloon_class_init,
-};
-
static Property virtio_ccw_scsi_properties[] = {
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);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [Qemu-devel] [PATCH for-3.1 04/10] hw/s390x: Move virtio-ccw-scsi code to a separate file
2018-07-25 12:20 [Qemu-devel] [PATCH for-3.1 00/10] Move virtio-ccw devices to separate files Thomas Huth
` (2 preceding siblings ...)
2018-07-25 12:20 ` [Qemu-devel] [PATCH for-3.1 03/10] hw/s390x: Move virtio-ccw-balloon " Thomas Huth
@ 2018-07-25 12:20 ` Thomas Huth
2018-07-25 12:20 ` [Qemu-devel] [PATCH for-3.1 05/10] hw/s390x: Move virtio-ccw-rng " Thomas Huth
` (11 subsequent siblings)
15 siblings, 0 replies; 23+ messages in thread
From: Thomas Huth @ 2018-07-25 12:20 UTC (permalink / raw)
To: Cornelia Huck, David Hildenbrand, qemu-s390x
Cc: Christian Borntraeger, qemu-devel, Juan Quintela
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 <thuth@redhat.com>
---
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 += 3270-ccw.o
obj-y += virtio-ccw.o
obj-$(CONFIG_VIRTIO_SERIAL) += virtio-ccw-serial.o
obj-$(CONFIG_VIRTIO_BALLOON) += virtio-ccw-balloon.o
+obj-$(CONFIG_VIRTIO_SCSI) += virtio-ccw-scsi.o
obj-y += css-bridge.o
obj-y += ccw-device.o
obj-$(CONFIG_PCI) += 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 <cornelia.huck@de.ibm.com>
+ *
+ * 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 = VIRTIO_SCSI_CCW(ccw_dev);
+ DeviceState *vdev = DEVICE(&dev->vdev);
+ DeviceState *qdev = 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 = 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 = VIRTIO_SCSI_CCW(obj);
+
+ virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
+ TYPE_VIRTIO_SCSI);
+}
+
+static Property virtio_ccw_scsi_properties[] = {
+ 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 = DEVICE_CLASS(klass);
+ VirtIOCCWDeviceClass *k = VIRTIO_CCW_DEVICE_CLASS(klass);
+
+ k->realize = virtio_ccw_scsi_realize;
+ dc->props = virtio_ccw_scsi_properties;
+ set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
+}
+
+static const TypeInfo virtio_ccw_scsi = {
+ .name = TYPE_VIRTIO_SCSI_CCW,
+ .parent = TYPE_VIRTIO_CCW_DEVICE,
+ .instance_size = sizeof(VirtIOSCSICcw),
+ .instance_init = virtio_ccw_scsi_instance_init,
+ .class_init = virtio_ccw_scsi_class_init,
+};
+
+#ifdef CONFIG_VHOST_SCSI
+
+static void vhost_ccw_scsi_realize(VirtioCcwDevice *ccw_dev, Error **errp)
+{
+ VHostSCSICcw *dev = VHOST_SCSI_CCW(ccw_dev);
+ DeviceState *vdev = 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 = VHOST_SCSI_CCW(obj);
+
+ virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
+ TYPE_VHOST_SCSI);
+}
+
+static Property vhost_ccw_scsi_properties[] = {
+ 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 = DEVICE_CLASS(klass);
+ VirtIOCCWDeviceClass *k = VIRTIO_CCW_DEVICE_CLASS(klass);
+
+ k->realize = vhost_ccw_scsi_realize;
+ dc->props = vhost_ccw_scsi_properties;
+ set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
+}
+
+static const TypeInfo vhost_ccw_scsi = {
+ .name = TYPE_VHOST_SCSI_CCW,
+ .parent = TYPE_VIRTIO_CCW_DEVICE,
+ .instance_size = sizeof(VHostSCSICcw),
+ .instance_init = vhost_ccw_scsi_instance_init,
+ .class_init = 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);
}
-static void virtio_ccw_scsi_realize(VirtioCcwDevice *ccw_dev, Error **errp)
-{
- VirtIOSCSICcw *dev = VIRTIO_SCSI_CCW(ccw_dev);
- DeviceState *vdev = DEVICE(&dev->vdev);
- DeviceState *qdev = 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 = 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 = 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 = VHOST_SCSI_CCW(ccw_dev);
- DeviceState *vdev = 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 = 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 = VIRTIO_RNG_CCW(ccw_dev);
@@ -1339,58 +1291,6 @@ static const TypeInfo virtio_ccw_blk = {
.class_init = virtio_ccw_blk_class_init,
};
-static Property virtio_ccw_scsi_properties[] = {
- 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 = DEVICE_CLASS(klass);
- VirtIOCCWDeviceClass *k = VIRTIO_CCW_DEVICE_CLASS(klass);
-
- k->realize = virtio_ccw_scsi_realize;
- dc->props = virtio_ccw_scsi_properties;
- set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
-}
-
-static const TypeInfo virtio_ccw_scsi = {
- .name = TYPE_VIRTIO_SCSI_CCW,
- .parent = TYPE_VIRTIO_CCW_DEVICE,
- .instance_size = sizeof(VirtIOSCSICcw),
- .instance_init = virtio_ccw_scsi_instance_init,
- .class_init = virtio_ccw_scsi_class_init,
-};
-
-#ifdef CONFIG_VHOST_SCSI
-static Property vhost_ccw_scsi_properties[] = {
- 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 = DEVICE_CLASS(klass);
- VirtIOCCWDeviceClass *k = VIRTIO_CCW_DEVICE_CLASS(klass);
-
- k->realize = vhost_ccw_scsi_realize;
- dc->props = vhost_ccw_scsi_properties;
- set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
-}
-
-static const TypeInfo vhost_ccw_scsi = {
- .name = TYPE_VHOST_SCSI_CCW,
- .parent = TYPE_VIRTIO_CCW_DEVICE,
- .instance_size = sizeof(VHostSCSICcw),
- .instance_init = vhost_ccw_scsi_instance_init,
- .class_init = vhost_ccw_scsi_class_init,
-};
-#endif
-
static void virtio_ccw_rng_instance_init(Object *obj)
{
VirtIORNGCcw *dev = 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);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [Qemu-devel] [PATCH for-3.1 05/10] hw/s390x: Move virtio-ccw-rng code to a separate file
2018-07-25 12:20 [Qemu-devel] [PATCH for-3.1 00/10] Move virtio-ccw devices to separate files Thomas Huth
` (3 preceding siblings ...)
2018-07-25 12:20 ` [Qemu-devel] [PATCH for-3.1 04/10] hw/s390x: Move virtio-ccw-scsi " Thomas Huth
@ 2018-07-25 12:20 ` Thomas Huth
2018-07-25 12:20 ` [Qemu-devel] [PATCH for-3.1 06/10] hw/s390x: Move virtio-ccw-9p " Thomas Huth
` (10 subsequent siblings)
15 siblings, 0 replies; 23+ messages in thread
From: Thomas Huth @ 2018-07-25 12:20 UTC (permalink / raw)
To: Cornelia Huck, David Hildenbrand, qemu-s390x
Cc: Christian Borntraeger, qemu-devel, Juan Quintela
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 <thuth@redhat.com>
---
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 += virtio-ccw.o
obj-$(CONFIG_VIRTIO_SERIAL) += virtio-ccw-serial.o
obj-$(CONFIG_VIRTIO_BALLOON) += virtio-ccw-balloon.o
obj-$(CONFIG_VIRTIO_SCSI) += virtio-ccw-scsi.o
+obj-$(CONFIG_VIRTIO_RNG) += virtio-ccw-rng.o
obj-y += css-bridge.o
obj-y += ccw-device.o
obj-$(CONFIG_PCI) += 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 <cornelia.huck@de.ibm.com>
+ *
+ * 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 = VIRTIO_RNG_CCW(ccw_dev);
+ DeviceState *vdev = DEVICE(&dev->vdev);
+ Error *err = 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 = VIRTIO_RNG_CCW(obj);
+
+ virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
+ TYPE_VIRTIO_RNG);
+}
+
+static Property virtio_ccw_rng_properties[] = {
+ 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 = DEVICE_CLASS(klass);
+ VirtIOCCWDeviceClass *k = VIRTIO_CCW_DEVICE_CLASS(klass);
+
+ k->realize = virtio_ccw_rng_realize;
+ dc->props = virtio_ccw_rng_properties;
+ set_bit(DEVICE_CATEGORY_MISC, dc->categories);
+}
+
+static const TypeInfo virtio_ccw_rng = {
+ .name = TYPE_VIRTIO_RNG_CCW,
+ .parent = TYPE_VIRTIO_CCW_DEVICE,
+ .instance_size = sizeof(VirtIORNGCcw),
+ .instance_init = virtio_ccw_rng_instance_init,
+ .class_init = 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);
}
-static void virtio_ccw_rng_realize(VirtioCcwDevice *ccw_dev, Error **errp)
-{
- VirtIORNGCcw *dev = VIRTIO_RNG_CCW(ccw_dev);
- DeviceState *vdev = DEVICE(&dev->vdev);
- Error *err = 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 **errp)
{
VirtIOCryptoCcw *dev = VIRTIO_CRYPTO_CCW(ccw_dev);
@@ -1291,40 +1273,6 @@ static const TypeInfo virtio_ccw_blk = {
.class_init = virtio_ccw_blk_class_init,
};
-static void virtio_ccw_rng_instance_init(Object *obj)
-{
- VirtIORNGCcw *dev = VIRTIO_RNG_CCW(obj);
-
- virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
- TYPE_VIRTIO_RNG);
-}
-
-static Property virtio_ccw_rng_properties[] = {
- 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 = DEVICE_CLASS(klass);
- VirtIOCCWDeviceClass *k = VIRTIO_CCW_DEVICE_CLASS(klass);
-
- k->realize = virtio_ccw_rng_realize;
- dc->props = virtio_ccw_rng_properties;
- set_bit(DEVICE_CATEGORY_MISC, dc->categories);
-}
-
-static const TypeInfo virtio_ccw_rng = {
- .name = TYPE_VIRTIO_RNG_CCW,
- .parent = TYPE_VIRTIO_CCW_DEVICE,
- .instance_size = sizeof(VirtIORNGCcw),
- .instance_init = virtio_ccw_rng_instance_init,
- .class_init = virtio_ccw_rng_class_init,
-};
-
static Property virtio_ccw_crypto_properties[] = {
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
--
1.8.3.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [Qemu-devel] [PATCH for-3.1 06/10] hw/s390x: Move virtio-ccw-9p code to a separate file
2018-07-25 12:20 [Qemu-devel] [PATCH for-3.1 00/10] Move virtio-ccw devices to separate files Thomas Huth
` (4 preceding siblings ...)
2018-07-25 12:20 ` [Qemu-devel] [PATCH for-3.1 05/10] hw/s390x: Move virtio-ccw-rng " Thomas Huth
@ 2018-07-25 12:20 ` Thomas Huth
2018-07-25 12:20 ` [Qemu-devel] [PATCH for-3.1 07/10] hw/s390x: Move virtio-ccw-crypto " Thomas Huth
` (9 subsequent siblings)
15 siblings, 0 replies; 23+ messages in thread
From: Thomas Huth @ 2018-07-25 12:20 UTC (permalink / raw)
To: Cornelia Huck, David Hildenbrand, qemu-s390x
Cc: Christian Borntraeger, qemu-devel, Juan Quintela
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 <thuth@redhat.com>
---
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) += virtio-ccw-serial.o
obj-$(CONFIG_VIRTIO_BALLOON) += virtio-ccw-balloon.o
obj-$(CONFIG_VIRTIO_SCSI) += virtio-ccw-scsi.o
obj-$(CONFIG_VIRTIO_RNG) += virtio-ccw-rng.o
+obj-$(call land,$(CONFIG_VIRTIO_9P),$(CONFIG_VIRTFS)) += virtio-ccw-9p.o
obj-y += css-bridge.o
obj-y += ccw-device.o
obj-$(CONFIG_PCI) += 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 <pmorel@linux.vnet.ibm.com>
+ *
+ * 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 = VIRTIO_9P_CCW(ccw_dev);
+ DeviceState *vdev = 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 = VIRTIO_9P_CCW(obj);
+
+ virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
+ TYPE_VIRTIO_9P);
+}
+
+static Property virtio_ccw_9p_properties[] = {
+ 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 = DEVICE_CLASS(klass);
+ VirtIOCCWDeviceClass *k = VIRTIO_CCW_DEVICE_CLASS(klass);
+
+ k->realize = virtio_ccw_9p_realize;
+ dc->props = virtio_ccw_9p_properties;
+ set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
+}
+
+static const TypeInfo virtio_ccw_9p_info = {
+ .name = TYPE_VIRTIO_9P_CCW,
+ .parent = TYPE_VIRTIO_CCW_DEVICE,
+ .instance_size = sizeof(V9fsCCWState),
+ .instance_init = virtio_ccw_9p_instance_init,
+ .class_init = 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 = {
.class_init = virtio_ccw_bus_class_init,
};
-#ifdef CONFIG_VIRTFS
-static Property virtio_ccw_9p_properties[] = {
- 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 = VIRTIO_9P_CCW(ccw_dev);
- DeviceState *vdev = 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 = DEVICE_CLASS(klass);
- VirtIOCCWDeviceClass *k = VIRTIO_CCW_DEVICE_CLASS(klass);
-
- k->realize = virtio_ccw_9p_realize;
- dc->props = virtio_ccw_9p_properties;
- set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
-}
-
-static void virtio_ccw_9p_instance_init(Object *obj)
-{
- V9fsCCWState *dev = VIRTIO_9P_CCW(obj);
-
- virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
- TYPE_VIRTIO_9P);
-}
-
-static const TypeInfo virtio_ccw_9p_info = {
- .name = TYPE_VIRTIO_9P_CCW,
- .parent = TYPE_VIRTIO_CCW_DEVICE,
- .instance_size = sizeof(V9fsCCWState),
- .instance_init = virtio_ccw_9p_instance_init,
- .class_init = virtio_ccw_9p_class_init,
-};
-#endif
-
#ifdef CONFIG_VHOST_VSOCK
static Property vhost_vsock_ccw_properties[] = {
@@ -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
--
1.8.3.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [Qemu-devel] [PATCH for-3.1 07/10] hw/s390x: Move virtio-ccw-crypto code to a separate file
2018-07-25 12:20 [Qemu-devel] [PATCH for-3.1 00/10] Move virtio-ccw devices to separate files Thomas Huth
` (5 preceding siblings ...)
2018-07-25 12:20 ` [Qemu-devel] [PATCH for-3.1 06/10] hw/s390x: Move virtio-ccw-9p " Thomas Huth
@ 2018-07-25 12:20 ` Thomas Huth
2018-07-25 12:20 ` [Qemu-devel] [PATCH for-3.1 08/10] hw/s390x: Move vhost-vsock-ccw " Thomas Huth
` (8 subsequent siblings)
15 siblings, 0 replies; 23+ messages in thread
From: Thomas Huth @ 2018-07-25 12:20 UTC (permalink / raw)
To: Cornelia Huck, David Hildenbrand, qemu-s390x
Cc: Christian Borntraeger, qemu-devel, Juan Quintela
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 <thuth@redhat.com>
---
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) += virtio-ccw-serial.o
obj-$(CONFIG_VIRTIO_BALLOON) += virtio-ccw-balloon.o
obj-$(CONFIG_VIRTIO_SCSI) += virtio-ccw-scsi.o
obj-$(CONFIG_VIRTIO_RNG) += virtio-ccw-rng.o
+obj-$(CONFIG_VIRTIO_CRYPTO) += virtio-ccw-crypto.o
obj-$(call land,$(CONFIG_VIRTIO_9P),$(CONFIG_VIRTFS)) += virtio-ccw-9p.o
obj-y += css-bridge.o
obj-y += 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 **errp)
+{
+ VirtIOCryptoCcw *dev = VIRTIO_CRYPTO_CCW(ccw_dev);
+ DeviceState *vdev = DEVICE(&dev->vdev);
+ Error *err = 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 = VIRTIO_CRYPTO_CCW(obj);
+ VirtioCcwDevice *ccw_dev = VIRTIO_CCW_DEVICE(obj);
+
+ ccw_dev->force_revision_1 = true;
+ virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
+ TYPE_VIRTIO_CRYPTO);
+}
+
+static Property virtio_ccw_crypto_properties[] = {
+ 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 = DEVICE_CLASS(klass);
+ VirtIOCCWDeviceClass *k = VIRTIO_CCW_DEVICE_CLASS(klass);
+
+ k->realize = virtio_ccw_crypto_realize;
+ dc->props = virtio_ccw_crypto_properties;
+ set_bit(DEVICE_CATEGORY_MISC, dc->categories);
+}
+
+static const TypeInfo virtio_ccw_crypto = {
+ .name = TYPE_VIRTIO_CRYPTO_CCW,
+ .parent = TYPE_VIRTIO_CCW_DEVICE,
+ .instance_size = sizeof(VirtIOCryptoCcw),
+ .instance_init = virtio_ccw_crypto_instance_init,
+ .class_init = 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);
}
-static void virtio_ccw_crypto_realize(VirtioCcwDevice *ccw_dev, Error **errp)
-{
- VirtIOCryptoCcw *dev = VIRTIO_CRYPTO_CCW(ccw_dev);
- DeviceState *vdev = DEVICE(&dev->vdev);
- Error *err = 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 = VIRTIO_GPU_CCW(ccw_dev);
@@ -1273,42 +1255,6 @@ static const TypeInfo virtio_ccw_blk = {
.class_init = virtio_ccw_blk_class_init,
};
-static Property virtio_ccw_crypto_properties[] = {
- 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 = VIRTIO_CRYPTO_CCW(obj);
- VirtioCcwDevice *ccw_dev = VIRTIO_CCW_DEVICE(obj);
-
- ccw_dev->force_revision_1 = 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 = DEVICE_CLASS(klass);
- VirtIOCCWDeviceClass *k = VIRTIO_CCW_DEVICE_CLASS(klass);
-
- k->realize = virtio_ccw_crypto_realize;
- dc->props = virtio_ccw_crypto_properties;
- set_bit(DEVICE_CATEGORY_MISC, dc->categories);
-}
-
-static const TypeInfo virtio_ccw_crypto = {
- .name = TYPE_VIRTIO_CRYPTO_CCW,
- .parent = TYPE_VIRTIO_CCW_DEVICE,
- .instance_size = sizeof(VirtIOCryptoCcw),
- .instance_init = virtio_ccw_crypto_instance_init,
- .class_init = virtio_ccw_crypto_class_init,
-};
-
static Property virtio_ccw_gpu_properties[] = {
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);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [Qemu-devel] [PATCH for-3.1 08/10] hw/s390x: Move vhost-vsock-ccw code to a separate file
2018-07-25 12:20 [Qemu-devel] [PATCH for-3.1 00/10] Move virtio-ccw devices to separate files Thomas Huth
` (6 preceding siblings ...)
2018-07-25 12:20 ` [Qemu-devel] [PATCH for-3.1 07/10] hw/s390x: Move virtio-ccw-crypto " Thomas Huth
@ 2018-07-25 12:20 ` Thomas Huth
2018-08-23 14:13 ` Cornelia Huck
2018-07-25 12:20 ` [Qemu-devel] [PATCH for-3.1 09/10] hw/s390x: Move virtio-ccw-gpu " Thomas Huth
` (7 subsequent siblings)
15 siblings, 1 reply; 23+ messages in thread
From: Thomas Huth @ 2018-07-25 12:20 UTC (permalink / raw)
To: Cornelia Huck, David Hildenbrand, qemu-s390x
Cc: Christian Borntraeger, qemu-devel, Juan Quintela
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 <thuth@redhat.com>
---
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) += virtio-ccw-scsi.o
obj-$(CONFIG_VIRTIO_RNG) += virtio-ccw-rng.o
obj-$(CONFIG_VIRTIO_CRYPTO) += virtio-ccw-crypto.o
obj-$(call land,$(CONFIG_VIRTIO_9P),$(CONFIG_VIRTFS)) += virtio-ccw-9p.o
+obj-$(CONFIG_VHOST_VSOCK) += vhost-vsock-ccw.o
obj-y += css-bridge.o
obj-y += ccw-device.o
obj-$(CONFIG_PCI) += 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[] = {
+ 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 = VHOST_VSOCK_CCW(ccw_dev);
+ DeviceState *vdev = 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 = DEVICE_CLASS(klass);
+ VirtIOCCWDeviceClass *k = VIRTIO_CCW_DEVICE_CLASS(klass);
+
+ k->realize = vhost_vsock_ccw_realize;
+ set_bit(DEVICE_CATEGORY_MISC, dc->categories);
+ dc->props = vhost_vsock_ccw_properties;
+}
+
+static void vhost_vsock_ccw_instance_init(Object *obj)
+{
+ VHostVSockCCWState *dev = VHOST_VSOCK_CCW(obj);
+
+ virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
+ TYPE_VHOST_VSOCK);
+}
+
+static const TypeInfo vhost_vsock_ccw_info = {
+ .name = TYPE_VHOST_VSOCK_CCW,
+ .parent = TYPE_VIRTIO_CCW_DEVICE,
+ .instance_size = sizeof(VHostVSockCCWState),
+ .instance_init = vhost_vsock_ccw_instance_init,
+ .class_init = 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 = {
.class_init = virtio_ccw_bus_class_init,
};
-#ifdef CONFIG_VHOST_VSOCK
-
-static Property vhost_vsock_ccw_properties[] = {
- 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 = VHOST_VSOCK_CCW(ccw_dev);
- DeviceState *vdev = 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 = DEVICE_CLASS(klass);
- VirtIOCCWDeviceClass *k = VIRTIO_CCW_DEVICE_CLASS(klass);
-
- k->realize = vhost_vsock_ccw_realize;
- set_bit(DEVICE_CATEGORY_MISC, dc->categories);
- dc->props = vhost_vsock_ccw_properties;
-}
-
-static void vhost_vsock_ccw_instance_init(Object *obj)
-{
- VHostVSockCCWState *dev = VHOST_VSOCK_CCW(obj);
-
- virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
- TYPE_VHOST_VSOCK);
-}
-
-static const TypeInfo vhost_vsock_ccw_info = {
- .name = TYPE_VHOST_VSOCK_CCW,
- .parent = TYPE_VIRTIO_CCW_DEVICE,
- .instance_size = sizeof(VHostVSockCCWState),
- .instance_init = vhost_vsock_ccw_instance_init,
- .class_init = 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);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* Re: [Qemu-devel] [PATCH for-3.1 08/10] hw/s390x: Move vhost-vsock-ccw code to a separate file
2018-07-25 12:20 ` [Qemu-devel] [PATCH for-3.1 08/10] hw/s390x: Move vhost-vsock-ccw " Thomas Huth
@ 2018-08-23 14:13 ` Cornelia Huck
0 siblings, 0 replies; 23+ messages in thread
From: Cornelia Huck @ 2018-08-23 14:13 UTC (permalink / raw)
To: Thomas Huth
Cc: David Hildenbrand, qemu-s390x, Christian Borntraeger, qemu-devel,
Juan Quintela
On Wed, 25 Jul 2018 14:20:22 +0200
Thomas Huth <thuth@redhat.com> wrote:
> 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 <thuth@redhat.com>
> ---
> hw/s390x/Makefile.objs | 1 +
> hw/s390x/vhost-vsock-ccw.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++
Small nit: The existing MAINTAINERS entry for virtio-ccw doesn't catch
this (although the virtio-ccw machine one does). I'll squash in the
following:
diff --git a/MAINTAINERS b/MAINTAINERS
index f823fdec91..6d01cd00af 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1228,6 +1228,7 @@ M: Cornelia Huck <cohuck@redhat.com>
M: Christian Borntraeger <borntraeger@de.ibm.com>
S: Supported
F: hw/s390x/virtio-ccw*.[hc]
+F: hw/s390x/vhost-vsock-ccw.c
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
> hw/s390x/virtio-ccw.c | 47 ------------------------------------
> 3 files changed, 61 insertions(+), 47 deletions(-)
> create mode 100644 hw/s390x/vhost-vsock-ccw.c
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [Qemu-devel] [PATCH for-3.1 09/10] hw/s390x: Move virtio-ccw-gpu code to a separate file
2018-07-25 12:20 [Qemu-devel] [PATCH for-3.1 00/10] Move virtio-ccw devices to separate files Thomas Huth
` (7 preceding siblings ...)
2018-07-25 12:20 ` [Qemu-devel] [PATCH for-3.1 08/10] hw/s390x: Move vhost-vsock-ccw " Thomas Huth
@ 2018-07-25 12:20 ` Thomas Huth
2018-07-25 12:20 ` [Qemu-devel] [PATCH for-3.1 10/10] hw/s390x: Move virtio-ccw-input " Thomas Huth
` (6 subsequent siblings)
15 siblings, 0 replies; 23+ messages in thread
From: Thomas Huth @ 2018-07-25 12:20 UTC (permalink / raw)
To: Cornelia Huck, David Hildenbrand, qemu-s390x
Cc: Christian Borntraeger, qemu-devel, Juan Quintela
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 <thuth@redhat.com>
---
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) += virtio-ccw-balloon.o
obj-$(CONFIG_VIRTIO_SCSI) += virtio-ccw-scsi.o
obj-$(CONFIG_VIRTIO_RNG) += virtio-ccw-rng.o
obj-$(CONFIG_VIRTIO_CRYPTO) += virtio-ccw-crypto.o
+obj-$(CONFIG_VIRTIO_GPU) += virtio-ccw-gpu.o
obj-$(call land,$(CONFIG_VIRTIO_9P),$(CONFIG_VIRTFS)) += virtio-ccw-9p.o
obj-$(CONFIG_VHOST_VSOCK) += vhost-vsock-ccw.o
obj-y += 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 = VIRTIO_GPU_CCW(ccw_dev);
+ DeviceState *vdev = 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 = VIRTIO_GPU_CCW(obj);
+ VirtioCcwDevice *ccw_dev = VIRTIO_CCW_DEVICE(obj);
+
+ ccw_dev->force_revision_1 = true;
+ virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
+ TYPE_VIRTIO_GPU);
+}
+
+static Property virtio_ccw_gpu_properties[] = {
+ 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 = DEVICE_CLASS(klass);
+ VirtIOCCWDeviceClass *k = VIRTIO_CCW_DEVICE_CLASS(klass);
+
+ k->realize = virtio_ccw_gpu_realize;
+ dc->props = virtio_ccw_gpu_properties;
+ dc->hotpluggable = false;
+ set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories);
+}
+
+static const TypeInfo virtio_ccw_gpu = {
+ .name = TYPE_VIRTIO_GPU_CCW,
+ .parent = TYPE_VIRTIO_CCW_DEVICE,
+ .instance_size = sizeof(VirtIOGPUCcw),
+ .instance_init = virtio_ccw_gpu_instance_init,
+ .class_init = 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);
}
-static void virtio_ccw_gpu_realize(VirtioCcwDevice *ccw_dev, Error **errp)
-{
- VirtIOGPUCcw *dev = VIRTIO_GPU_CCW(ccw_dev);
- DeviceState *vdev = 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 **errp)
{
VirtIOInputCcw *dev = VIRTIO_INPUT_CCW(ccw_dev);
@@ -1255,43 +1246,6 @@ static const TypeInfo virtio_ccw_blk = {
.class_init = virtio_ccw_blk_class_init,
};
-static Property virtio_ccw_gpu_properties[] = {
- 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 = VIRTIO_GPU_CCW(obj);
- VirtioCcwDevice *ccw_dev = VIRTIO_CCW_DEVICE(obj);
-
- ccw_dev->force_revision_1 = 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 = DEVICE_CLASS(klass);
- VirtIOCCWDeviceClass *k = VIRTIO_CCW_DEVICE_CLASS(klass);
-
- k->realize = virtio_ccw_gpu_realize;
- dc->props = virtio_ccw_gpu_properties;
- dc->hotpluggable = false;
- set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories);
-}
-
-static const TypeInfo virtio_ccw_gpu = {
- .name = TYPE_VIRTIO_GPU_CCW,
- .parent = TYPE_VIRTIO_CCW_DEVICE,
- .instance_size = sizeof(VirtIOGPUCcw),
- .instance_init = virtio_ccw_gpu_instance_init,
- .class_init = virtio_ccw_gpu_class_init,
-};
-
static Property virtio_ccw_input_properties[] = {
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);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [Qemu-devel] [PATCH for-3.1 10/10] hw/s390x: Move virtio-ccw-input code to a separate file
2018-07-25 12:20 [Qemu-devel] [PATCH for-3.1 00/10] Move virtio-ccw devices to separate files Thomas Huth
` (8 preceding siblings ...)
2018-07-25 12:20 ` [Qemu-devel] [PATCH for-3.1 09/10] hw/s390x: Move virtio-ccw-gpu " Thomas Huth
@ 2018-07-25 12:20 ` Thomas Huth
2018-07-25 13:48 ` [Qemu-devel] [PATCH for-3.1 00/10] Move virtio-ccw devices to separate files Cornelia Huck
` (5 subsequent siblings)
15 siblings, 0 replies; 23+ messages in thread
From: Thomas Huth @ 2018-07-25 12:20 UTC (permalink / raw)
To: Cornelia Huck, David Hildenbrand, qemu-s390x
Cc: Christian Borntraeger, qemu-devel, Juan Quintela
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 <thuth@redhat.com>
---
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) += virtio-ccw-scsi.o
obj-$(CONFIG_VIRTIO_RNG) += virtio-ccw-rng.o
obj-$(CONFIG_VIRTIO_CRYPTO) += virtio-ccw-crypto.o
obj-$(CONFIG_VIRTIO_GPU) += virtio-ccw-gpu.o
+obj-$(CONFIG_VIRTIO_INPUT) += virtio-ccw-input.o
obj-$(call land,$(CONFIG_VIRTIO_9P),$(CONFIG_VIRTFS)) += virtio-ccw-9p.o
obj-$(CONFIG_VHOST_VSOCK) += vhost-vsock-ccw.o
obj-y += 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 **errp)
+{
+ VirtIOInputCcw *dev = VIRTIO_INPUT_CCW(ccw_dev);
+ DeviceState *vdev = 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[] = {
+ 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 = DEVICE_CLASS(klass);
+ VirtIOCCWDeviceClass *k = VIRTIO_CCW_DEVICE_CLASS(klass);
+
+ k->realize = virtio_ccw_input_realize;
+ dc->props = virtio_ccw_input_properties;
+ set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
+}
+
+static void virtio_ccw_keyboard_instance_init(Object *obj)
+{
+ VirtIOInputHIDCcw *dev = VIRTIO_INPUT_HID_CCW(obj);
+ VirtioCcwDevice *ccw_dev = VIRTIO_CCW_DEVICE(obj);
+
+ ccw_dev->force_revision_1 = 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 = VIRTIO_INPUT_HID_CCW(obj);
+ VirtioCcwDevice *ccw_dev = VIRTIO_CCW_DEVICE(obj);
+
+ ccw_dev->force_revision_1 = 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 = VIRTIO_INPUT_HID_CCW(obj);
+ VirtioCcwDevice *ccw_dev = VIRTIO_CCW_DEVICE(obj);
+
+ ccw_dev->force_revision_1 = true;
+ virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
+ TYPE_VIRTIO_TABLET);
+}
+
+static const TypeInfo virtio_ccw_input = {
+ .name = TYPE_VIRTIO_INPUT_CCW,
+ .parent = TYPE_VIRTIO_CCW_DEVICE,
+ .instance_size = sizeof(VirtIOInputCcw),
+ .class_init = virtio_ccw_input_class_init,
+ .abstract = true,
+};
+
+static const TypeInfo virtio_ccw_input_hid = {
+ .name = TYPE_VIRTIO_INPUT_HID_CCW,
+ .parent = TYPE_VIRTIO_INPUT_CCW,
+ .instance_size = sizeof(VirtIOInputHIDCcw),
+ .abstract = true,
+};
+
+static const TypeInfo virtio_ccw_keyboard = {
+ .name = TYPE_VIRTIO_KEYBOARD_CCW,
+ .parent = TYPE_VIRTIO_INPUT_HID_CCW,
+ .instance_size = sizeof(VirtIOInputHIDCcw),
+ .instance_init = virtio_ccw_keyboard_instance_init,
+};
+
+static const TypeInfo virtio_ccw_mouse = {
+ .name = TYPE_VIRTIO_MOUSE_CCW,
+ .parent = TYPE_VIRTIO_INPUT_HID_CCW,
+ .instance_size = sizeof(VirtIOInputHIDCcw),
+ .instance_init = virtio_ccw_mouse_instance_init,
+};
+
+static const TypeInfo virtio_ccw_tablet = {
+ .name = TYPE_VIRTIO_TABLET_CCW,
+ .parent = TYPE_VIRTIO_INPUT_HID_CCW,
+ .instance_size = sizeof(VirtIOInputHIDCcw),
+ .instance_init = 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);
}
-static void virtio_ccw_input_realize(VirtioCcwDevice *ccw_dev, Error **errp)
-{
- VirtIOInputCcw *dev = VIRTIO_INPUT_CCW(ccw_dev);
- DeviceState *vdev = 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 = {
.class_init = virtio_ccw_blk_class_init,
};
-static Property virtio_ccw_input_properties[] = {
- 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 = DEVICE_CLASS(klass);
- VirtIOCCWDeviceClass *k = VIRTIO_CCW_DEVICE_CLASS(klass);
-
- k->realize = virtio_ccw_input_realize;
- dc->props = virtio_ccw_input_properties;
- set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
-}
-
-static void virtio_ccw_keyboard_instance_init(Object *obj)
-{
- VirtIOInputHIDCcw *dev = VIRTIO_INPUT_HID_CCW(obj);
- VirtioCcwDevice *ccw_dev = VIRTIO_CCW_DEVICE(obj);
-
- ccw_dev->force_revision_1 = 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 = VIRTIO_INPUT_HID_CCW(obj);
- VirtioCcwDevice *ccw_dev = VIRTIO_CCW_DEVICE(obj);
-
- ccw_dev->force_revision_1 = 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 = VIRTIO_INPUT_HID_CCW(obj);
- VirtioCcwDevice *ccw_dev = VIRTIO_CCW_DEVICE(obj);
-
- ccw_dev->force_revision_1 = true;
- virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
- TYPE_VIRTIO_TABLET);
-}
-
-static const TypeInfo virtio_ccw_input = {
- .name = TYPE_VIRTIO_INPUT_CCW,
- .parent = TYPE_VIRTIO_CCW_DEVICE,
- .instance_size = sizeof(VirtIOInputCcw),
- .class_init = virtio_ccw_input_class_init,
- .abstract = true,
-};
-
-static const TypeInfo virtio_ccw_input_hid = {
- .name = TYPE_VIRTIO_INPUT_HID_CCW,
- .parent = TYPE_VIRTIO_INPUT_CCW,
- .instance_size = sizeof(VirtIOInputHIDCcw),
- .abstract = true,
-};
-
-static const TypeInfo virtio_ccw_keyboard = {
- .name = TYPE_VIRTIO_KEYBOARD_CCW,
- .parent = TYPE_VIRTIO_INPUT_HID_CCW,
- .instance_size = sizeof(VirtIOInputHIDCcw),
- .instance_init = virtio_ccw_keyboard_instance_init,
-};
-
-static const TypeInfo virtio_ccw_mouse = {
- .name = TYPE_VIRTIO_MOUSE_CCW,
- .parent = TYPE_VIRTIO_INPUT_HID_CCW,
- .instance_size = sizeof(VirtIOInputHIDCcw),
- .instance_init = virtio_ccw_mouse_instance_init,
-};
-
-static const TypeInfo virtio_ccw_tablet = {
- .name = TYPE_VIRTIO_TABLET_CCW,
- .parent = TYPE_VIRTIO_INPUT_HID_CCW,
- .instance_size = sizeof(VirtIOInputHIDCcw),
- .instance_init = virtio_ccw_tablet_instance_init,
-};
-
static void virtio_ccw_busdev_realize(DeviceState *dev, Error **errp)
{
VirtioCcwDevice *_dev = (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);
}
type_init(virtio_ccw_register)
--
1.8.3.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* Re: [Qemu-devel] [PATCH for-3.1 00/10] Move virtio-ccw devices to separate files
2018-07-25 12:20 [Qemu-devel] [PATCH for-3.1 00/10] Move virtio-ccw devices to separate files Thomas Huth
` (9 preceding siblings ...)
2018-07-25 12:20 ` [Qemu-devel] [PATCH for-3.1 10/10] hw/s390x: Move virtio-ccw-input " Thomas Huth
@ 2018-07-25 13:48 ` Cornelia Huck
2018-07-25 17:20 ` Thomas Huth
2018-07-25 13:52 ` Christian Borntraeger
` (4 subsequent siblings)
15 siblings, 1 reply; 23+ messages in thread
From: Cornelia Huck @ 2018-07-25 13:48 UTC (permalink / raw)
To: Thomas Huth
Cc: David Hildenbrand, qemu-s390x, Christian Borntraeger, qemu-devel,
Juan Quintela
On Wed, 25 Jul 2018 14:20:14 +0200
Thomas Huth <thuth@redhat.com> wrote:
> For more fine-grained control over the build process, it would be good
> to have the possibility to disable single virtio devices, too. We already
> have CONFIG_VIRTIO_* switches in the Makefiles, but currently all
> virtio-ccw devices are compiled in anyway. Move them to separate files
> so we can disable them in the Makefile more easily.
>
> NB: I did not move virtio-blk-ccw and virtio-net-ccw to a separate file
> yet since they are essential for the s390x-virtio machine and thus it
> does IMHO not make much sense to disable net and blk. But if somebody
> needs that possibility, too, I can add two more patches on top...
I understand virtio-net-ccw (autogenerated network devices), but why
virtio-blk-ccw?
Regardless, it might make sense to split them out so that we get a
slimmed-down virtio-ccw.c.
>
> Thomas Huth (10):
> hw/s390x/virtio-ccw: Consolidate calls to virtio_ccw_unrealize()
> hw/s390x: Move virtio-ccw-serial code to a separate file
> hw/s390x: Move virtio-ccw-balloon code to a separate file
> hw/s390x: Move virtio-ccw-scsi code to a separate file
> hw/s390x: Move virtio-ccw-rng code to a separate file
> hw/s390x: Move virtio-ccw-9p code to a separate file
> hw/s390x: Move virtio-ccw-crypto code to a separate file
> hw/s390x: Move vhost-vsock-ccw code to a separate file
> hw/s390x: Move virtio-ccw-gpu code to a separate file
> hw/s390x: Move virtio-ccw-input code to a separate file
>
> MAINTAINERS | 2 +-
> hw/s390x/Makefile.objs | 9 +
> hw/s390x/vhost-vsock-ccw.c | 60 +++++
> hw/s390x/virtio-ccw-9p.c | 65 +++++
> hw/s390x/virtio-ccw-balloon.c | 70 +++++
> hw/s390x/virtio-ccw-crypto.c | 75 ++++++
> hw/s390x/virtio-ccw-gpu.c | 67 +++++
> hw/s390x/virtio-ccw-input.c | 118 +++++++++
> hw/s390x/virtio-ccw-rng.c | 74 ++++++
> hw/s390x/virtio-ccw-scsi.c | 125 +++++++++
> hw/s390x/virtio-ccw-serial.c | 78 ++++++
> hw/s390x/virtio-ccw.c | 581 +-----------------------------------------
> 12 files changed, 749 insertions(+), 575 deletions(-)
> create mode 100644 hw/s390x/vhost-vsock-ccw.c
> create mode 100644 hw/s390x/virtio-ccw-9p.c
> create mode 100644 hw/s390x/virtio-ccw-balloon.c
> create mode 100644 hw/s390x/virtio-ccw-crypto.c
> create mode 100644 hw/s390x/virtio-ccw-gpu.c
> create mode 100644 hw/s390x/virtio-ccw-input.c
> create mode 100644 hw/s390x/virtio-ccw-rng.c
> create mode 100644 hw/s390x/virtio-ccw-scsi.c
> create mode 100644 hw/s390x/virtio-ccw-serial.c
>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [Qemu-devel] [PATCH for-3.1 00/10] Move virtio-ccw devices to separate files
2018-07-25 13:48 ` [Qemu-devel] [PATCH for-3.1 00/10] Move virtio-ccw devices to separate files Cornelia Huck
@ 2018-07-25 17:20 ` Thomas Huth
2018-07-26 9:07 ` Cornelia Huck
0 siblings, 1 reply; 23+ messages in thread
From: Thomas Huth @ 2018-07-25 17:20 UTC (permalink / raw)
To: Cornelia Huck
Cc: David Hildenbrand, qemu-s390x, Christian Borntraeger, qemu-devel,
Juan Quintela
On 25.07.2018 15:48, Cornelia Huck wrote:
> On Wed, 25 Jul 2018 14:20:14 +0200
> Thomas Huth <thuth@redhat.com> wrote:
>
>> For more fine-grained control over the build process, it would be good
>> to have the possibility to disable single virtio devices, too. We already
>> have CONFIG_VIRTIO_* switches in the Makefiles, but currently all
>> virtio-ccw devices are compiled in anyway. Move them to separate files
>> so we can disable them in the Makefile more easily.
>>
>> NB: I did not move virtio-blk-ccw and virtio-net-ccw to a separate file
>> yet since they are essential for the s390x-virtio machine and thus it
>> does IMHO not make much sense to disable net and blk. But if somebody
>> needs that possibility, too, I can add two more patches on top...
>
> I understand virtio-net-ccw (autogenerated network devices), but why
> virtio-blk-ccw?
Because we set mc->block_default_type = IF_VIRTIO ==> if you disable
virtio-blk, the CLI options like -hda and -cdrom would not work anymore.
> Regardless, it might make sense to split them out so that we get a
> slimmed-down virtio-ccw.c.
OK.
Thomas
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [Qemu-devel] [PATCH for-3.1 00/10] Move virtio-ccw devices to separate files
2018-07-25 17:20 ` Thomas Huth
@ 2018-07-26 9:07 ` Cornelia Huck
0 siblings, 0 replies; 23+ messages in thread
From: Cornelia Huck @ 2018-07-26 9:07 UTC (permalink / raw)
To: Thomas Huth
Cc: David Hildenbrand, qemu-s390x, Christian Borntraeger, qemu-devel,
Juan Quintela
On Wed, 25 Jul 2018 19:20:59 +0200
Thomas Huth <thuth@redhat.com> wrote:
> On 25.07.2018 15:48, Cornelia Huck wrote:
> > On Wed, 25 Jul 2018 14:20:14 +0200
> > Thomas Huth <thuth@redhat.com> wrote:
> >
> >> For more fine-grained control over the build process, it would be good
> >> to have the possibility to disable single virtio devices, too. We already
> >> have CONFIG_VIRTIO_* switches in the Makefiles, but currently all
> >> virtio-ccw devices are compiled in anyway. Move them to separate files
> >> so we can disable them in the Makefile more easily.
> >>
> >> NB: I did not move virtio-blk-ccw and virtio-net-ccw to a separate file
> >> yet since they are essential for the s390x-virtio machine and thus it
> >> does IMHO not make much sense to disable net and blk. But if somebody
> >> needs that possibility, too, I can add two more patches on top...
> >
> > I understand virtio-net-ccw (autogenerated network devices), but why
> > virtio-blk-ccw?
>
> Because we set mc->block_default_type = IF_VIRTIO ==> if you disable
> virtio-blk, the CLI options like -hda and -cdrom would not work anymore.
I see. Maybe we need some strategic #ifdefs to deal with this.
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [Qemu-devel] [PATCH for-3.1 00/10] Move virtio-ccw devices to separate files
2018-07-25 12:20 [Qemu-devel] [PATCH for-3.1 00/10] Move virtio-ccw devices to separate files Thomas Huth
` (10 preceding siblings ...)
2018-07-25 13:48 ` [Qemu-devel] [PATCH for-3.1 00/10] Move virtio-ccw devices to separate files Cornelia Huck
@ 2018-07-25 13:52 ` Christian Borntraeger
2018-07-25 16:21 ` Juan Quintela
2018-07-25 18:07 ` [Qemu-devel] [PATCH for-3.1 11/10] hw/s390x: Move virtio-ccw-net code to a separate file Thomas Huth
` (3 subsequent siblings)
15 siblings, 1 reply; 23+ messages in thread
From: Christian Borntraeger @ 2018-07-25 13:52 UTC (permalink / raw)
To: Thomas Huth, Cornelia Huck, David Hildenbrand, qemu-s390x
Cc: qemu-devel, Juan Quintela
Are you planning to do a similar thing for virtio-pci? I think it would be good
to keep virtio-ccw similar to virtio-pci when it makes sense.
On 07/25/2018 02:20 PM, Thomas Huth wrote:
> For more fine-grained control over the build process, it would be good
> to have the possibility to disable single virtio devices, too. We already
> have CONFIG_VIRTIO_* switches in the Makefiles, but currently all
> virtio-ccw devices are compiled in anyway. Move them to separate files
> so we can disable them in the Makefile more easily.
>
> NB: I did not move virtio-blk-ccw and virtio-net-ccw to a separate file
> yet since they are essential for the s390x-virtio machine and thus it
> does IMHO not make much sense to disable net and blk. But if somebody
> needs that possibility, too, I can add two more patches on top...
>
> Thomas Huth (10):
> hw/s390x/virtio-ccw: Consolidate calls to virtio_ccw_unrealize()
> hw/s390x: Move virtio-ccw-serial code to a separate file
> hw/s390x: Move virtio-ccw-balloon code to a separate file
> hw/s390x: Move virtio-ccw-scsi code to a separate file
> hw/s390x: Move virtio-ccw-rng code to a separate file
> hw/s390x: Move virtio-ccw-9p code to a separate file
> hw/s390x: Move virtio-ccw-crypto code to a separate file
> hw/s390x: Move vhost-vsock-ccw code to a separate file
> hw/s390x: Move virtio-ccw-gpu code to a separate file
> hw/s390x: Move virtio-ccw-input code to a separate file
>
> MAINTAINERS | 2 +-
> hw/s390x/Makefile.objs | 9 +
> hw/s390x/vhost-vsock-ccw.c | 60 +++++
> hw/s390x/virtio-ccw-9p.c | 65 +++++
> hw/s390x/virtio-ccw-balloon.c | 70 +++++
> hw/s390x/virtio-ccw-crypto.c | 75 ++++++
> hw/s390x/virtio-ccw-gpu.c | 67 +++++
> hw/s390x/virtio-ccw-input.c | 118 +++++++++
> hw/s390x/virtio-ccw-rng.c | 74 ++++++
> hw/s390x/virtio-ccw-scsi.c | 125 +++++++++
> hw/s390x/virtio-ccw-serial.c | 78 ++++++
> hw/s390x/virtio-ccw.c | 581 +-----------------------------------------
> 12 files changed, 749 insertions(+), 575 deletions(-)
> create mode 100644 hw/s390x/vhost-vsock-ccw.c
> create mode 100644 hw/s390x/virtio-ccw-9p.c
> create mode 100644 hw/s390x/virtio-ccw-balloon.c
> create mode 100644 hw/s390x/virtio-ccw-crypto.c
> create mode 100644 hw/s390x/virtio-ccw-gpu.c
> create mode 100644 hw/s390x/virtio-ccw-input.c
> create mode 100644 hw/s390x/virtio-ccw-rng.c
> create mode 100644 hw/s390x/virtio-ccw-scsi.c
> create mode 100644 hw/s390x/virtio-ccw-serial.c
>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [Qemu-devel] [PATCH for-3.1 00/10] Move virtio-ccw devices to separate files
2018-07-25 13:52 ` Christian Borntraeger
@ 2018-07-25 16:21 ` Juan Quintela
2018-07-25 17:15 ` Thomas Huth
0 siblings, 1 reply; 23+ messages in thread
From: Juan Quintela @ 2018-07-25 16:21 UTC (permalink / raw)
To: Christian Borntraeger
Cc: Thomas Huth, Cornelia Huck, David Hildenbrand, qemu-s390x,
qemu-devel
Christian Borntraeger <borntraeger@de.ibm.com> wrote:
> Are you planning to do a similar thing for virtio-pci? I think it would be good
> to keep virtio-ccw similar to virtio-pci when it makes sense.
+1 to that.
Later, Juan.
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [Qemu-devel] [PATCH for-3.1 00/10] Move virtio-ccw devices to separate files
2018-07-25 16:21 ` Juan Quintela
@ 2018-07-25 17:15 ` Thomas Huth
0 siblings, 0 replies; 23+ messages in thread
From: Thomas Huth @ 2018-07-25 17:15 UTC (permalink / raw)
To: quintela, Christian Borntraeger
Cc: Cornelia Huck, David Hildenbrand, qemu-s390x, qemu-devel
On 25.07.2018 18:21, Juan Quintela wrote:
> Christian Borntraeger <borntraeger@de.ibm.com> wrote:
>> Are you planning to do a similar thing for virtio-pci? I think it would be good
>> to keep virtio-ccw similar to virtio-pci when it makes sense.
Somebody™ should do it, yes. For the context, see:
https://lists.gnu.org/archive/html/qemu-devel/2018-07/msg03935.html
> +1 to that.
I was hoping that you would take care of the pci while I'm handling the
ccw part, Juan ;-) But if you don't have spare time for this at all, I
can also put it on my todo list.
Thomas
^ permalink raw reply [flat|nested] 23+ messages in thread
* [Qemu-devel] [PATCH for-3.1 11/10] hw/s390x: Move virtio-ccw-net code to a separate file
2018-07-25 12:20 [Qemu-devel] [PATCH for-3.1 00/10] Move virtio-ccw devices to separate files Thomas Huth
` (11 preceding siblings ...)
2018-07-25 13:52 ` Christian Borntraeger
@ 2018-07-25 18:07 ` Thomas Huth
2018-07-25 18:08 ` [Qemu-devel] [PATCH for-3.1 12/10] hw/s390x: Move virtio-ccw-blk " Thomas Huth
` (2 subsequent siblings)
15 siblings, 0 replies; 23+ messages in thread
From: Thomas Huth @ 2018-07-25 18:07 UTC (permalink / raw)
To: Cornelia Huck, David Hildenbrand, qemu-s390x
Cc: Christian Borntraeger, qemu-devel, Juan Quintela
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 <thuth@redhat.com>
---
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) += virtio-ccw-rng.o
obj-$(CONFIG_VIRTIO_CRYPTO) += virtio-ccw-crypto.o
obj-$(CONFIG_VIRTIO_GPU) += virtio-ccw-gpu.o
obj-$(CONFIG_VIRTIO_INPUT) += virtio-ccw-input.o
+obj-$(CONFIG_VIRTIO_NET) += virtio-ccw-net.o
obj-$(call land,$(CONFIG_VIRTIO_9P),$(CONFIG_VIRTFS)) += virtio-ccw-9p.o
obj-$(CONFIG_VHOST_VSOCK) += vhost-vsock-ccw.o
obj-y += 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 <cornelia.huck@de.ibm.com>
+ *
+ * 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 = DEVICE(ccw_dev);
+ VirtIONetCcw *dev = VIRTIO_NET_CCW(ccw_dev);
+ DeviceState *vdev = 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 = 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[] = {
+ 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 = DEVICE_CLASS(klass);
+ VirtIOCCWDeviceClass *k = VIRTIO_CCW_DEVICE_CLASS(klass);
+
+ k->realize = virtio_ccw_net_realize;
+ dc->props = virtio_ccw_net_properties;
+ set_bit(DEVICE_CATEGORY_NETWORK, dc->categories);
+}
+
+static const TypeInfo virtio_ccw_net = {
+ .name = TYPE_VIRTIO_NET_CCW,
+ .parent = TYPE_VIRTIO_CCW_DEVICE,
+ .instance_size = sizeof(VirtIONetCcw),
+ .instance_init = virtio_ccw_net_instance_init,
+ .class_init = 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(VirtioCcwDevice *dev, Error **errp)
}
}
-static void virtio_ccw_net_realize(VirtioCcwDevice *ccw_dev, Error **errp)
-{
- DeviceState *qdev = DEVICE(ccw_dev);
- VirtIONetCcw *dev = VIRTIO_NET_CCW(ccw_dev);
- DeviceState *vdev = 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 = 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 = VIRTIO_BLK_CCW(ccw_dev);
@@ -1185,32 +1163,6 @@ static void virtio_ccw_device_unplugged(DeviceState *d)
}
/**************** Virtio-ccw Bus Device Descriptions *******************/
-static Property virtio_ccw_net_properties[] = {
- 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 = DEVICE_CLASS(klass);
- VirtIOCCWDeviceClass *k = VIRTIO_CCW_DEVICE_CLASS(klass);
-
- k->realize = virtio_ccw_net_realize;
- dc->props = virtio_ccw_net_properties;
- set_bit(DEVICE_CATEGORY_NETWORK, dc->categories);
-}
-
-static const TypeInfo virtio_ccw_net = {
- .name = TYPE_VIRTIO_NET_CCW,
- .parent = TYPE_VIRTIO_CCW_DEVICE,
- .instance_size = sizeof(VirtIONetCcw),
- .instance_init = virtio_ccw_net_instance_init,
- .class_init = virtio_ccw_net_class_init,
-};
-
static Property virtio_ccw_blk_properties[] = {
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);
}
type_init(virtio_ccw_register)
--
1.8.3.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [Qemu-devel] [PATCH for-3.1 12/10] hw/s390x: Move virtio-ccw-blk code to a separate file
2018-07-25 12:20 [Qemu-devel] [PATCH for-3.1 00/10] Move virtio-ccw devices to separate files Thomas Huth
` (12 preceding siblings ...)
2018-07-25 18:07 ` [Qemu-devel] [PATCH for-3.1 11/10] hw/s390x: Move virtio-ccw-net code to a separate file Thomas Huth
@ 2018-07-25 18:08 ` Thomas Huth
2018-08-15 11:45 ` [Qemu-devel] [PATCH for-3.1 00/10] Move virtio-ccw devices to separate files Cornelia Huck
2018-08-23 14:25 ` Cornelia Huck
15 siblings, 0 replies; 23+ messages in thread
From: Thomas Huth @ 2018-07-25 18:08 UTC (permalink / raw)
To: Cornelia Huck, David Hildenbrand, qemu-s390x
Cc: Christian Borntraeger, qemu-devel, Juan Quintela
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 <thuth@redhat.com>
---
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) += virtio-ccw-crypto.o
obj-$(CONFIG_VIRTIO_GPU) += virtio-ccw-gpu.o
obj-$(CONFIG_VIRTIO_INPUT) += virtio-ccw-input.o
obj-$(CONFIG_VIRTIO_NET) += virtio-ccw-net.o
+obj-$(CONFIG_VIRTIO_BLK) += virtio-ccw-blk.o
obj-$(call land,$(CONFIG_VIRTIO_9P),$(CONFIG_VIRTFS)) += virtio-ccw-9p.o
obj-$(CONFIG_VHOST_VSOCK) += vhost-vsock-ccw.o
obj-y += 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 <cornelia.huck@de.ibm.com>
+ *
+ * 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 = VIRTIO_BLK_CCW(ccw_dev);
+ DeviceState *vdev = 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 = 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[] = {
+ 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 = DEVICE_CLASS(klass);
+ VirtIOCCWDeviceClass *k = VIRTIO_CCW_DEVICE_CLASS(klass);
+
+ k->realize = virtio_ccw_blk_realize;
+ dc->props = virtio_ccw_blk_properties;
+ set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
+}
+
+static const TypeInfo virtio_ccw_blk = {
+ .name = TYPE_VIRTIO_BLK_CCW,
+ .parent = TYPE_VIRTIO_CCW_DEVICE,
+ .instance_size = sizeof(VirtIOBlkCcw),
+ .instance_init = virtio_ccw_blk_instance_init,
+ .class_init = 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(VirtioCcwDevice *dev, Error **errp)
}
}
-static void virtio_ccw_blk_realize(VirtioCcwDevice *ccw_dev, Error **errp)
-{
- VirtIOBlkCcw *dev = VIRTIO_BLK_CCW(ccw_dev);
- DeviceState *vdev = 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 = 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 *******************/
-static Property virtio_ccw_blk_properties[] = {
- 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 = DEVICE_CLASS(klass);
- VirtIOCCWDeviceClass *k = VIRTIO_CCW_DEVICE_CLASS(klass);
-
- k->realize = virtio_ccw_blk_realize;
- dc->props = virtio_ccw_blk_properties;
- set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
-}
-
-static const TypeInfo virtio_ccw_blk = {
- .name = TYPE_VIRTIO_BLK_CCW,
- .parent = TYPE_VIRTIO_CCW_DEVICE,
- .instance_size = sizeof(VirtIOBlkCcw),
- .instance_init = virtio_ccw_blk_instance_init,
- .class_init = virtio_ccw_blk_class_init,
-};
-
static void virtio_ccw_busdev_realize(DeviceState *dev, Error **errp)
{
VirtioCcwDevice *_dev = (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);
}
type_init(virtio_ccw_register)
--
1.8.3.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* Re: [Qemu-devel] [PATCH for-3.1 00/10] Move virtio-ccw devices to separate files
2018-07-25 12:20 [Qemu-devel] [PATCH for-3.1 00/10] Move virtio-ccw devices to separate files Thomas Huth
` (13 preceding siblings ...)
2018-07-25 18:08 ` [Qemu-devel] [PATCH for-3.1 12/10] hw/s390x: Move virtio-ccw-blk " Thomas Huth
@ 2018-08-15 11:45 ` Cornelia Huck
2018-08-23 14:25 ` Cornelia Huck
15 siblings, 0 replies; 23+ messages in thread
From: Cornelia Huck @ 2018-08-15 11:45 UTC (permalink / raw)
To: Thomas Huth
Cc: David Hildenbrand, qemu-s390x, Christian Borntraeger, qemu-devel,
Juan Quintela
On Wed, 25 Jul 2018 14:20:14 +0200
Thomas Huth <thuth@redhat.com> wrote:
> For more fine-grained control over the build process, it would be good
> to have the possibility to disable single virtio devices, too. We already
> have CONFIG_VIRTIO_* switches in the Makefiles, but currently all
> virtio-ccw devices are compiled in anyway. Move them to separate files
> so we can disable them in the Makefile more easily.
>
> NB: I did not move virtio-blk-ccw and virtio-net-ccw to a separate file
> yet since they are essential for the s390x-virtio machine and thus it
> does IMHO not make much sense to disable net and blk. But if somebody
> needs that possibility, too, I can add two more patches on top...
>
> Thomas Huth (10):
> hw/s390x/virtio-ccw: Consolidate calls to virtio_ccw_unrealize()
> hw/s390x: Move virtio-ccw-serial code to a separate file
> hw/s390x: Move virtio-ccw-balloon code to a separate file
> hw/s390x: Move virtio-ccw-scsi code to a separate file
> hw/s390x: Move virtio-ccw-rng code to a separate file
> hw/s390x: Move virtio-ccw-9p code to a separate file
> hw/s390x: Move virtio-ccw-crypto code to a separate file
> hw/s390x: Move vhost-vsock-ccw code to a separate file
> hw/s390x: Move virtio-ccw-gpu code to a separate file
> hw/s390x: Move virtio-ccw-input code to a separate file
>
> MAINTAINERS | 2 +-
> hw/s390x/Makefile.objs | 9 +
> hw/s390x/vhost-vsock-ccw.c | 60 +++++
> hw/s390x/virtio-ccw-9p.c | 65 +++++
> hw/s390x/virtio-ccw-balloon.c | 70 +++++
> hw/s390x/virtio-ccw-crypto.c | 75 ++++++
> hw/s390x/virtio-ccw-gpu.c | 67 +++++
> hw/s390x/virtio-ccw-input.c | 118 +++++++++
> hw/s390x/virtio-ccw-rng.c | 74 ++++++
> hw/s390x/virtio-ccw-scsi.c | 125 +++++++++
> hw/s390x/virtio-ccw-serial.c | 78 ++++++
> hw/s390x/virtio-ccw.c | 581 +-----------------------------------------
> 12 files changed, 749 insertions(+), 575 deletions(-)
> create mode 100644 hw/s390x/vhost-vsock-ccw.c
> create mode 100644 hw/s390x/virtio-ccw-9p.c
> create mode 100644 hw/s390x/virtio-ccw-balloon.c
> create mode 100644 hw/s390x/virtio-ccw-crypto.c
> create mode 100644 hw/s390x/virtio-ccw-gpu.c
> create mode 100644 hw/s390x/virtio-ccw-input.c
> create mode 100644 hw/s390x/virtio-ccw-rng.c
> create mode 100644 hw/s390x/virtio-ccw-scsi.c
> create mode 100644 hw/s390x/virtio-ccw-serial.c
>
Trawling through my backlog... I don't think there were any issues with
this? I think I'll just go ahead and queue this (would not mind
reviews, though).
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [Qemu-devel] [PATCH for-3.1 00/10] Move virtio-ccw devices to separate files
2018-07-25 12:20 [Qemu-devel] [PATCH for-3.1 00/10] Move virtio-ccw devices to separate files Thomas Huth
` (14 preceding siblings ...)
2018-08-15 11:45 ` [Qemu-devel] [PATCH for-3.1 00/10] Move virtio-ccw devices to separate files Cornelia Huck
@ 2018-08-23 14:25 ` Cornelia Huck
15 siblings, 0 replies; 23+ messages in thread
From: Cornelia Huck @ 2018-08-23 14:25 UTC (permalink / raw)
To: Thomas Huth
Cc: David Hildenbrand, qemu-s390x, Christian Borntraeger, qemu-devel,
Juan Quintela
On Wed, 25 Jul 2018 14:20:14 +0200
Thomas Huth <thuth@redhat.com> wrote:
> For more fine-grained control over the build process, it would be good
> to have the possibility to disable single virtio devices, too. We already
> have CONFIG_VIRTIO_* switches in the Makefiles, but currently all
> virtio-ccw devices are compiled in anyway. Move them to separate files
> so we can disable them in the Makefile more easily.
>
> NB: I did not move virtio-blk-ccw and virtio-net-ccw to a separate file
> yet since they are essential for the s390x-virtio machine and thus it
> does IMHO not make much sense to disable net and blk. But if somebody
> needs that possibility, too, I can add two more patches on top...
Thanks, applied (including the two patches on top.)
^ permalink raw reply [flat|nested] 23+ messages in thread