All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] virtio-ccw: remove device declarations from virtio-ccw.h
@ 2022-03-28 14:30 Paolo Bonzini
  2022-03-28 14:30 ` [PATCH 1/4] s390x: follow qdev tree to detect SCSI device on a CCW bus Paolo Bonzini
                   ` (3 more replies)
  0 siblings, 4 replies; 15+ messages in thread
From: Paolo Bonzini @ 2022-03-28 14:30 UTC (permalink / raw)
  To: qemu-devel; +Cc: thuth, cohuck, farman, pasic, qemu-s390x, borntraeger

I have looked recently at moving some of the vhost-user definitions
from configure options to Kconfig symbols.  This made some of the vhost
symbols target-dependent (and thus poisoned) where they used to be
defined in config-host.h.

To fix this, this series removes these symbols (and all other code that
is not needed outside individual virtio-ccw device implementations)
from the virtio-ccw.h header.  I am sending it separately because I
think it's a worthwhile cleanup on its own.

Paolo

Paolo Bonzini (4):
  s390x: follow qdev tree to detect SCSI device on a CCW bus
  virtio-ccw: move vhost_ccw_scsi to a separate file
  virtio-ccw: move device type declarations to .c files
  virtio-ccw: do not include headers for all virtio devices

 hw/s390x/ipl.c                |  23 ++++--
 hw/s390x/meson.build          |   1 +
 hw/s390x/s390-virtio-ccw.c    |   1 +
 hw/s390x/vhost-scsi-ccw.c     |  73 +++++++++++++++++
 hw/s390x/vhost-vsock-ccw.c    |   9 ++
 hw/s390x/virtio-ccw-9p.c      |   9 ++
 hw/s390x/virtio-ccw-balloon.c |   9 ++
 hw/s390x/virtio-ccw-blk.c     |   9 ++
 hw/s390x/virtio-ccw-crypto.c  |   9 ++
 hw/s390x/virtio-ccw-gpu.c     |   9 ++
 hw/s390x/virtio-ccw-input.c   |  20 +++++
 hw/s390x/virtio-ccw-net.c     |   9 ++
 hw/s390x/virtio-ccw-rng.c     |   9 ++
 hw/s390x/virtio-ccw-scsi.c    |  56 ++-----------
 hw/s390x/virtio-ccw-serial.c  |   9 ++
 hw/s390x/virtio-ccw.c         |   2 +
 hw/s390x/virtio-ccw.h         | 149 ----------------------------------
 17 files changed, 202 insertions(+), 204 deletions(-)
 create mode 100644 hw/s390x/vhost-scsi-ccw.c

-- 
2.35.1



^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 1/4] s390x: follow qdev tree to detect SCSI device on a CCW bus
  2022-03-28 14:30 [PATCH 0/4] virtio-ccw: remove device declarations from virtio-ccw.h Paolo Bonzini
@ 2022-03-28 14:30 ` Paolo Bonzini
  2022-03-29 12:45   ` Thomas Huth
  2022-03-31  0:21   ` Halil Pasic
  2022-03-28 14:30 ` [PATCH 2/4] virtio-ccw: move vhost_ccw_scsi to a separate file Paolo Bonzini
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 15+ messages in thread
From: Paolo Bonzini @ 2022-03-28 14:30 UTC (permalink / raw)
  To: qemu-devel; +Cc: thuth, cohuck, farman, pasic, qemu-s390x, borntraeger

Do not make assumptions on the parent type of the SCSIDevice, instead
use object_dynamic_cast all the way up to the CcwDevice.  This is cleaner
because there is no guarantee that the bus is on a virtio-scsi device;
that is only the case for the default configuration of QEMU's s390x
target.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/s390x/ipl.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c
index 84971e537b..e21776822a 100644
--- a/hw/s390x/ipl.c
+++ b/hw/s390x/ipl.c
@@ -375,14 +375,18 @@ static CcwDevice *s390_get_ccw_device(DeviceState *dev_st, int *devtype)
                 object_dynamic_cast(OBJECT(dev_st),
                                     TYPE_SCSI_DEVICE);
             if (sd) {
-                SCSIBus *bus = scsi_bus_from_device(sd);
-                VirtIOSCSI *vdev = container_of(bus, VirtIOSCSI, bus);
-                VirtIOSCSICcw *scsi_ccw = container_of(vdev, VirtIOSCSICcw,
-                                                       vdev);
-
-                ccw_dev = (CcwDevice *)object_dynamic_cast(OBJECT(scsi_ccw),
-                                                           TYPE_CCW_DEVICE);
-                tmp_dt = CCW_DEVTYPE_SCSI;
+                SCSIBus *sbus = scsi_bus_from_device(sd);
+                VirtIODevice *vdev = (VirtIODevice *)
+                    object_dynamic_cast(OBJECT(sbus->qbus.parent),
+                                        TYPE_VIRTIO_DEVICE);
+		if (vdev) {
+                    ccw_dev = (CcwDevice *)
+                        object_dynamic_cast(OBJECT(qdev_get_parent_bus(DEVICE(vdev))->parent),
+                                            TYPE_CCW_DEVICE);
+                    if (ccw_dev) {
+                        tmp_dt = CCW_DEVTYPE_SCSI;
+                    }
+		}
             }
         }
     }
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 2/4] virtio-ccw: move vhost_ccw_scsi to a separate file
  2022-03-28 14:30 [PATCH 0/4] virtio-ccw: remove device declarations from virtio-ccw.h Paolo Bonzini
  2022-03-28 14:30 ` [PATCH 1/4] s390x: follow qdev tree to detect SCSI device on a CCW bus Paolo Bonzini
@ 2022-03-28 14:30 ` Paolo Bonzini
  2022-03-29 13:34   ` Thomas Huth
                     ` (3 more replies)
  2022-03-28 14:30 ` [PATCH 3/4] virtio-ccw: move device type declarations to .c files Paolo Bonzini
  2022-03-28 14:30 ` [PATCH 4/4] virtio-ccw: do not include headers for all virtio devices Paolo Bonzini
  3 siblings, 4 replies; 15+ messages in thread
From: Paolo Bonzini @ 2022-03-28 14:30 UTC (permalink / raw)
  To: qemu-devel; +Cc: thuth, cohuck, farman, pasic, qemu-s390x, borntraeger

Remove unecessary use of #ifdef CONFIG_VHOST_SCSI, instead just use a
separate file and a separate rule in meson.build.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/s390x/meson.build       |  1 +
 hw/s390x/vhost-scsi-ccw.c  | 64 ++++++++++++++++++++++++++++++++++++++
 hw/s390x/virtio-ccw-scsi.c | 47 ----------------------------
 3 files changed, 65 insertions(+), 47 deletions(-)
 create mode 100644 hw/s390x/vhost-scsi-ccw.c

diff --git a/hw/s390x/meson.build b/hw/s390x/meson.build
index 28484256ec..feefe0717e 100644
--- a/hw/s390x/meson.build
+++ b/hw/s390x/meson.build
@@ -44,6 +44,7 @@ virtio_ss.add(when: 'CONFIG_VIRTIO_SERIAL', if_true: files('virtio-ccw-serial.c'
 if have_virtfs
   virtio_ss.add(when: 'CONFIG_VIRTIO_9P', if_true: files('virtio-ccw-9p.c'))
 endif
+virtio_ss.add(when: 'CONFIG_VHOST_SCSI', if_true: files('vhost-scsi-ccw.c'))
 virtio_ss.add(when: 'CONFIG_VHOST_VSOCK', if_true: files('vhost-vsock-ccw.c'))
 virtio_ss.add(when: 'CONFIG_VHOST_USER_FS', if_true: files('vhost-user-fs-ccw.c'))
 s390x_ss.add_all(when: 'CONFIG_VIRTIO_CCW', if_true: virtio_ss)
diff --git a/hw/s390x/vhost-scsi-ccw.c b/hw/s390x/vhost-scsi-ccw.c
new file mode 100644
index 0000000000..b68ddddd1c
--- /dev/null
+++ b/hw/s390x/vhost-scsi-ccw.c
@@ -0,0 +1,64 @@
+/*
+ * vhost 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/qdev-properties.h"
+#include "hw/virtio/virtio.h"
+#include "qapi/error.h"
+#include "qemu/module.h"
+#include "virtio-ccw.h"
+
+static void vhost_ccw_scsi_realize(VirtioCcwDevice *ccw_dev, Error **errp)
+{
+    VHostSCSICcw *dev = VHOST_SCSI_CCW(ccw_dev);
+    DeviceState *vdev = DEVICE(&dev->vdev);
+
+    qdev_realize(vdev, BUS(&ccw_dev->bus), 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;
+    device_class_set_props(dc, 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,
+};
+
+static void virtio_ccw_scsi_register(void)
+{
+    type_register_static(&vhost_ccw_scsi);
+}
+
+type_init(virtio_ccw_scsi_register)
diff --git a/hw/s390x/virtio-ccw-scsi.c b/hw/s390x/virtio-ccw-scsi.c
index 6e4beef700..fa706eb550 100644
--- a/hw/s390x/virtio-ccw-scsi.c
+++ b/hw/s390x/virtio-ccw-scsi.c
@@ -70,56 +70,9 @@ static const TypeInfo virtio_ccw_scsi = {
     .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_realize(vdev, BUS(&ccw_dev->bus), 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;
-    device_class_set_props(dc, 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)
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 3/4] virtio-ccw: move device type declarations to .c files
  2022-03-28 14:30 [PATCH 0/4] virtio-ccw: remove device declarations from virtio-ccw.h Paolo Bonzini
  2022-03-28 14:30 ` [PATCH 1/4] s390x: follow qdev tree to detect SCSI device on a CCW bus Paolo Bonzini
  2022-03-28 14:30 ` [PATCH 2/4] virtio-ccw: move vhost_ccw_scsi to a separate file Paolo Bonzini
@ 2022-03-28 14:30 ` Paolo Bonzini
  2022-03-30  7:11   ` Thomas Huth
  2022-03-31 12:14   ` Halil Pasic
  2022-03-28 14:30 ` [PATCH 4/4] virtio-ccw: do not include headers for all virtio devices Paolo Bonzini
  3 siblings, 2 replies; 15+ messages in thread
From: Paolo Bonzini @ 2022-03-28 14:30 UTC (permalink / raw)
  To: qemu-devel; +Cc: thuth, cohuck, farman, pasic, qemu-s390x, borntraeger

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/s390x/s390-virtio-ccw.c    |   1 +
 hw/s390x/vhost-scsi-ccw.c     |   9 +++
 hw/s390x/vhost-vsock-ccw.c    |   9 +++
 hw/s390x/virtio-ccw-9p.c      |   9 +++
 hw/s390x/virtio-ccw-balloon.c |   9 +++
 hw/s390x/virtio-ccw-blk.c     |   9 +++
 hw/s390x/virtio-ccw-crypto.c  |   9 +++
 hw/s390x/virtio-ccw-gpu.c     |   9 +++
 hw/s390x/virtio-ccw-input.c   |  20 +++++
 hw/s390x/virtio-ccw-net.c     |   9 +++
 hw/s390x/virtio-ccw-rng.c     |   9 +++
 hw/s390x/virtio-ccw-scsi.c    |   9 +++
 hw/s390x/virtio-ccw-serial.c  |   9 +++
 hw/s390x/virtio-ccw.c         |   2 +
 hw/s390x/virtio-ccw.h         | 133 ----------------------------------
 15 files changed, 122 insertions(+), 133 deletions(-)

diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
index 90480e7cf9..2d32647d08 100644
--- a/hw/s390x/s390-virtio-ccw.c
+++ b/hw/s390x/s390-virtio-ccw.c
@@ -25,6 +25,7 @@
 #include "qemu/error-report.h"
 #include "qemu/option.h"
 #include "qemu/qemu-print.h"
+#include "qemu/units.h"
 #include "hw/s390x/s390-pci-bus.h"
 #include "sysemu/reset.h"
 #include "hw/s390x/storage-keys.h"
diff --git a/hw/s390x/vhost-scsi-ccw.c b/hw/s390x/vhost-scsi-ccw.c
index b68ddddd1c..40dc14bbc7 100644
--- a/hw/s390x/vhost-scsi-ccw.c
+++ b/hw/s390x/vhost-scsi-ccw.c
@@ -15,6 +15,15 @@
 #include "qapi/error.h"
 #include "qemu/module.h"
 #include "virtio-ccw.h"
+#include "hw/virtio/vhost-scsi.h"
+
+#define TYPE_VHOST_SCSI_CCW "vhost-scsi-ccw"
+OBJECT_DECLARE_SIMPLE_TYPE(VHostSCSICcw, VHOST_SCSI_CCW)
+
+struct VHostSCSICcw {
+    VirtioCcwDevice parent_obj;
+    VHostSCSI vdev;
+};
 
 static void vhost_ccw_scsi_realize(VirtioCcwDevice *ccw_dev, Error **errp)
 {
diff --git a/hw/s390x/vhost-vsock-ccw.c b/hw/s390x/vhost-vsock-ccw.c
index 246416a8f9..07845a9a00 100644
--- a/hw/s390x/vhost-vsock-ccw.c
+++ b/hw/s390x/vhost-vsock-ccw.c
@@ -12,6 +12,15 @@
 #include "qapi/error.h"
 #include "qemu/module.h"
 #include "virtio-ccw.h"
+#include "hw/virtio/vhost-vsock.h"
+
+#define TYPE_VHOST_VSOCK_CCW "vhost-vsock-ccw"
+OBJECT_DECLARE_SIMPLE_TYPE(VHostVSockCCWState, VHOST_VSOCK_CCW)
+
+struct VHostVSockCCWState {
+    VirtioCcwDevice parent_obj;
+    VHostVSock vdev;
+};
 
 static Property vhost_vsock_ccw_properties[] = {
     DEFINE_PROP_UINT32("max_revision", VirtioCcwDevice, max_rev,
diff --git a/hw/s390x/virtio-ccw-9p.c b/hw/s390x/virtio-ccw-9p.c
index 88c8884fc5..6f931f5994 100644
--- a/hw/s390x/virtio-ccw-9p.c
+++ b/hw/s390x/virtio-ccw-9p.c
@@ -15,6 +15,15 @@
 #include "qapi/error.h"
 #include "qemu/module.h"
 #include "virtio-ccw.h"
+#include "hw/9pfs/virtio-9p.h"
+
+#define TYPE_VIRTIO_9P_CCW "virtio-9p-ccw"
+OBJECT_DECLARE_SIMPLE_TYPE(V9fsCCWState, VIRTIO_9P_CCW)
+
+struct V9fsCCWState {
+    VirtioCcwDevice parent_obj;
+    V9fsVirtioState vdev;
+};
 
 static void virtio_ccw_9p_realize(VirtioCcwDevice *ccw_dev, Error **errp)
 {
diff --git a/hw/s390x/virtio-ccw-balloon.c b/hw/s390x/virtio-ccw-balloon.c
index 4c7631a433..44287b9bbe 100644
--- a/hw/s390x/virtio-ccw-balloon.c
+++ b/hw/s390x/virtio-ccw-balloon.c
@@ -15,6 +15,15 @@
 #include "qapi/error.h"
 #include "qemu/module.h"
 #include "virtio-ccw.h"
+#include "hw/virtio/virtio-balloon.h"
+
+#define TYPE_VIRTIO_BALLOON_CCW "virtio-balloon-ccw"
+OBJECT_DECLARE_SIMPLE_TYPE(VirtIOBalloonCcw, VIRTIO_BALLOON_CCW)
+
+struct VirtIOBalloonCcw {
+    VirtioCcwDevice parent_obj;
+    VirtIOBalloon vdev;
+};
 
 static void virtio_ccw_balloon_realize(VirtioCcwDevice *ccw_dev, Error **errp)
 {
diff --git a/hw/s390x/virtio-ccw-blk.c b/hw/s390x/virtio-ccw-blk.c
index 2294ce1ce4..8e0e58b77d 100644
--- a/hw/s390x/virtio-ccw-blk.c
+++ b/hw/s390x/virtio-ccw-blk.c
@@ -15,6 +15,15 @@
 #include "qapi/error.h"
 #include "qemu/module.h"
 #include "virtio-ccw.h"
+#include "hw/virtio/virtio-blk.h"
+
+#define TYPE_VIRTIO_BLK_CCW "virtio-blk-ccw"
+OBJECT_DECLARE_SIMPLE_TYPE(VirtIOBlkCcw, VIRTIO_BLK_CCW)
+
+struct VirtIOBlkCcw {
+    VirtioCcwDevice parent_obj;
+    VirtIOBlock vdev;
+};
 
 static void virtio_ccw_blk_realize(VirtioCcwDevice *ccw_dev, Error **errp)
 {
diff --git a/hw/s390x/virtio-ccw-crypto.c b/hw/s390x/virtio-ccw-crypto.c
index 358c74fb4b..0fa2f89443 100644
--- a/hw/s390x/virtio-ccw-crypto.c
+++ b/hw/s390x/virtio-ccw-crypto.c
@@ -14,6 +14,15 @@
 #include "qapi/error.h"
 #include "qemu/module.h"
 #include "virtio-ccw.h"
+#include "hw/virtio/virtio-crypto.h"
+
+#define TYPE_VIRTIO_CRYPTO_CCW "virtio-crypto-ccw"
+OBJECT_DECLARE_SIMPLE_TYPE(VirtIOCryptoCcw, VIRTIO_CRYPTO_CCW)
+
+struct VirtIOCryptoCcw {
+    VirtioCcwDevice parent_obj;
+    VirtIOCrypto vdev;
+};
 
 static void virtio_ccw_crypto_realize(VirtioCcwDevice *ccw_dev, Error **errp)
 {
diff --git a/hw/s390x/virtio-ccw-gpu.c b/hw/s390x/virtio-ccw-gpu.c
index 5868a2a070..8d995fcb33 100644
--- a/hw/s390x/virtio-ccw-gpu.c
+++ b/hw/s390x/virtio-ccw-gpu.c
@@ -14,6 +14,15 @@
 #include "qapi/error.h"
 #include "qemu/module.h"
 #include "virtio-ccw.h"
+#include "hw/virtio/virtio-gpu.h"
+
+#define TYPE_VIRTIO_GPU_CCW "virtio-gpu-ccw"
+OBJECT_DECLARE_SIMPLE_TYPE(VirtIOGPUCcw, VIRTIO_GPU_CCW)
+
+struct VirtIOGPUCcw {
+    VirtioCcwDevice parent_obj;
+    VirtIOGPU vdev;
+};
 
 static void virtio_ccw_gpu_realize(VirtioCcwDevice *ccw_dev, Error **errp)
 {
diff --git a/hw/s390x/virtio-ccw-input.c b/hw/s390x/virtio-ccw-input.c
index 83136fbba1..61a07ba38d 100644
--- a/hw/s390x/virtio-ccw-input.c
+++ b/hw/s390x/virtio-ccw-input.c
@@ -14,6 +14,26 @@
 #include "qapi/error.h"
 #include "qemu/module.h"
 #include "virtio-ccw.h"
+#include "hw/virtio/virtio-input.h"
+
+#define TYPE_VIRTIO_INPUT_CCW "virtio-input-ccw"
+OBJECT_DECLARE_SIMPLE_TYPE(VirtIOInputCcw, VIRTIO_INPUT_CCW)
+
+struct VirtIOInputCcw {
+    VirtioCcwDevice parent_obj;
+    VirtIOInput vdev;
+};
+
+#define TYPE_VIRTIO_INPUT_HID_CCW "virtio-input-hid-ccw"
+#define TYPE_VIRTIO_KEYBOARD_CCW "virtio-keyboard-ccw"
+#define TYPE_VIRTIO_MOUSE_CCW "virtio-mouse-ccw"
+#define TYPE_VIRTIO_TABLET_CCW "virtio-tablet-ccw"
+OBJECT_DECLARE_SIMPLE_TYPE(VirtIOInputHIDCcw, VIRTIO_INPUT_HID_CCW)
+
+struct VirtIOInputHIDCcw {
+    VirtioCcwDevice parent_obj;
+    VirtIOInputHID vdev;
+};
 
 static void virtio_ccw_input_realize(VirtioCcwDevice *ccw_dev, Error **errp)
 {
diff --git a/hw/s390x/virtio-ccw-net.c b/hw/s390x/virtio-ccw-net.c
index 3860d4e6ea..484e617659 100644
--- a/hw/s390x/virtio-ccw-net.c
+++ b/hw/s390x/virtio-ccw-net.c
@@ -15,6 +15,15 @@
 #include "qapi/error.h"
 #include "qemu/module.h"
 #include "virtio-ccw.h"
+#include "hw/virtio/virtio-net.h"
+
+#define TYPE_VIRTIO_NET_CCW "virtio-net-ccw"
+OBJECT_DECLARE_SIMPLE_TYPE(VirtIONetCcw, VIRTIO_NET_CCW)
+
+struct VirtIONetCcw {
+    VirtioCcwDevice parent_obj;
+    VirtIONet vdev;
+};
 
 static void virtio_ccw_net_realize(VirtioCcwDevice *ccw_dev, Error **errp)
 {
diff --git a/hw/s390x/virtio-ccw-rng.c b/hw/s390x/virtio-ccw-rng.c
index 2e3a9da5e8..a3fffb5138 100644
--- a/hw/s390x/virtio-ccw-rng.c
+++ b/hw/s390x/virtio-ccw-rng.c
@@ -15,6 +15,15 @@
 #include "qapi/error.h"
 #include "qemu/module.h"
 #include "virtio-ccw.h"
+#include "hw/virtio/virtio-rng.h"
+
+#define TYPE_VIRTIO_RNG_CCW "virtio-rng-ccw"
+OBJECT_DECLARE_SIMPLE_TYPE(VirtIORNGCcw, VIRTIO_RNG_CCW)
+
+struct VirtIORNGCcw {
+    VirtioCcwDevice parent_obj;
+    VirtIORNG vdev;
+};
 
 static void virtio_ccw_rng_realize(VirtioCcwDevice *ccw_dev, Error **errp)
 {
diff --git a/hw/s390x/virtio-ccw-scsi.c b/hw/s390x/virtio-ccw-scsi.c
index fa706eb550..d003f89f43 100644
--- a/hw/s390x/virtio-ccw-scsi.c
+++ b/hw/s390x/virtio-ccw-scsi.c
@@ -15,6 +15,15 @@
 #include "qapi/error.h"
 #include "qemu/module.h"
 #include "virtio-ccw.h"
+#include "hw/virtio/virtio-scsi.h"
+
+#define TYPE_VIRTIO_SCSI_CCW "virtio-scsi-ccw"
+OBJECT_DECLARE_SIMPLE_TYPE(VirtIOSCSICcw, VIRTIO_SCSI_CCW)
+
+struct VirtIOSCSICcw {
+    VirtioCcwDevice parent_obj;
+    VirtIOSCSI vdev;
+};
 
 static void virtio_ccw_scsi_realize(VirtioCcwDevice *ccw_dev, Error **errp)
 {
diff --git a/hw/s390x/virtio-ccw-serial.c b/hw/s390x/virtio-ccw-serial.c
index 61958228d1..bf8057880f 100644
--- a/hw/s390x/virtio-ccw-serial.c
+++ b/hw/s390x/virtio-ccw-serial.c
@@ -15,6 +15,15 @@
 #include "hw/qdev-properties.h"
 #include "hw/virtio/virtio-serial.h"
 #include "virtio-ccw.h"
+#include "hw/virtio/virtio-serial.h"
+
+#define TYPE_VIRTIO_SERIAL_CCW "virtio-serial-ccw"
+OBJECT_DECLARE_SIMPLE_TYPE(VirtioSerialCcw, VIRTIO_SERIAL_CCW)
+
+struct VirtioSerialCcw {
+    VirtioCcwDevice parent_obj;
+    VirtIOSerial vdev;
+};
 
 static void virtio_ccw_serial_realize(VirtioCcwDevice *ccw_dev, Error **errp)
 {
diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c
index c845a92c3a..15b458527e 100644
--- a/hw/s390x/virtio-ccw.c
+++ b/hw/s390x/virtio-ccw.c
@@ -12,6 +12,7 @@
 
 #include "qemu/osdep.h"
 #include "qapi/error.h"
+#include "exec/address-spaces.h"
 #include "sysemu/kvm.h"
 #include "net/net.h"
 #include "hw/virtio/virtio.h"
@@ -19,6 +20,7 @@
 #include "hw/virtio/virtio-net.h"
 #include "qemu/bitops.h"
 #include "qemu/error-report.h"
+#include "qemu/log.h"
 #include "qemu/module.h"
 #include "hw/virtio/virtio-access.h"
 #include "hw/virtio/virtio-bus.h"
diff --git a/hw/s390x/virtio-ccw.h b/hw/s390x/virtio-ccw.h
index 0168232e3b..fc131194bf 100644
--- a/hw/s390x/virtio-ccw.h
+++ b/hw/s390x/virtio-ccw.h
@@ -104,139 +104,6 @@ static inline int virtio_ccw_rev_max(VirtioCcwDevice *dev)
     return dev->max_rev;
 }
 
-/* virtio-scsi-ccw */
-
-#define TYPE_VIRTIO_SCSI_CCW "virtio-scsi-ccw"
-OBJECT_DECLARE_SIMPLE_TYPE(VirtIOSCSICcw, VIRTIO_SCSI_CCW)
-
-struct VirtIOSCSICcw {
-    VirtioCcwDevice parent_obj;
-    VirtIOSCSI vdev;
-};
-
-#ifdef CONFIG_VHOST_SCSI
-/* vhost-scsi-ccw */
-
-#define TYPE_VHOST_SCSI_CCW "vhost-scsi-ccw"
-OBJECT_DECLARE_SIMPLE_TYPE(VHostSCSICcw, VHOST_SCSI_CCW)
-
-struct VHostSCSICcw {
-    VirtioCcwDevice parent_obj;
-    VHostSCSI vdev;
-};
-#endif
-
-/* virtio-blk-ccw */
-
-#define TYPE_VIRTIO_BLK_CCW "virtio-blk-ccw"
-OBJECT_DECLARE_SIMPLE_TYPE(VirtIOBlkCcw, VIRTIO_BLK_CCW)
-
-struct VirtIOBlkCcw {
-    VirtioCcwDevice parent_obj;
-    VirtIOBlock vdev;
-};
-
-/* virtio-balloon-ccw */
-
-#define TYPE_VIRTIO_BALLOON_CCW "virtio-balloon-ccw"
-OBJECT_DECLARE_SIMPLE_TYPE(VirtIOBalloonCcw, VIRTIO_BALLOON_CCW)
-
-struct VirtIOBalloonCcw {
-    VirtioCcwDevice parent_obj;
-    VirtIOBalloon vdev;
-};
-
-/* virtio-serial-ccw */
-
-#define TYPE_VIRTIO_SERIAL_CCW "virtio-serial-ccw"
-OBJECT_DECLARE_SIMPLE_TYPE(VirtioSerialCcw, VIRTIO_SERIAL_CCW)
-
-struct VirtioSerialCcw {
-    VirtioCcwDevice parent_obj;
-    VirtIOSerial vdev;
-};
-
-/* virtio-net-ccw */
-
-#define TYPE_VIRTIO_NET_CCW "virtio-net-ccw"
-OBJECT_DECLARE_SIMPLE_TYPE(VirtIONetCcw, VIRTIO_NET_CCW)
-
-struct VirtIONetCcw {
-    VirtioCcwDevice parent_obj;
-    VirtIONet vdev;
-};
-
-/* virtio-rng-ccw */
-
-#define TYPE_VIRTIO_RNG_CCW "virtio-rng-ccw"
-OBJECT_DECLARE_SIMPLE_TYPE(VirtIORNGCcw, VIRTIO_RNG_CCW)
-
-struct VirtIORNGCcw {
-    VirtioCcwDevice parent_obj;
-    VirtIORNG vdev;
-};
-
-/* virtio-crypto-ccw */
-
-#define TYPE_VIRTIO_CRYPTO_CCW "virtio-crypto-ccw"
-OBJECT_DECLARE_SIMPLE_TYPE(VirtIOCryptoCcw, VIRTIO_CRYPTO_CCW)
-
-struct VirtIOCryptoCcw {
-    VirtioCcwDevice parent_obj;
-    VirtIOCrypto vdev;
-};
-
 VirtIODevice *virtio_ccw_get_vdev(SubchDev *sch);
 
-#ifdef CONFIG_VIRTFS
-#include "hw/9pfs/virtio-9p.h"
-
-#define TYPE_VIRTIO_9P_CCW "virtio-9p-ccw"
-OBJECT_DECLARE_SIMPLE_TYPE(V9fsCCWState, VIRTIO_9P_CCW)
-
-struct V9fsCCWState {
-    VirtioCcwDevice parent_obj;
-    V9fsVirtioState vdev;
-};
-
-#endif /* CONFIG_VIRTFS */
-
-#ifdef CONFIG_VHOST_VSOCK
-#define TYPE_VHOST_VSOCK_CCW "vhost-vsock-ccw"
-OBJECT_DECLARE_SIMPLE_TYPE(VHostVSockCCWState, VHOST_VSOCK_CCW)
-
-struct VHostVSockCCWState {
-    VirtioCcwDevice parent_obj;
-    VHostVSock vdev;
-};
-
-#endif /* CONFIG_VHOST_VSOCK */
-
-#define TYPE_VIRTIO_GPU_CCW "virtio-gpu-ccw"
-OBJECT_DECLARE_SIMPLE_TYPE(VirtIOGPUCcw, VIRTIO_GPU_CCW)
-
-struct VirtIOGPUCcw {
-    VirtioCcwDevice parent_obj;
-    VirtIOGPU vdev;
-};
-
-#define TYPE_VIRTIO_INPUT_CCW "virtio-input-ccw"
-OBJECT_DECLARE_SIMPLE_TYPE(VirtIOInputCcw, VIRTIO_INPUT_CCW)
-
-struct VirtIOInputCcw {
-    VirtioCcwDevice parent_obj;
-    VirtIOInput vdev;
-};
-
-#define TYPE_VIRTIO_INPUT_HID_CCW "virtio-input-hid-ccw"
-#define TYPE_VIRTIO_KEYBOARD_CCW "virtio-keyboard-ccw"
-#define TYPE_VIRTIO_MOUSE_CCW "virtio-mouse-ccw"
-#define TYPE_VIRTIO_TABLET_CCW "virtio-tablet-ccw"
-OBJECT_DECLARE_SIMPLE_TYPE(VirtIOInputHIDCcw, VIRTIO_INPUT_HID_CCW)
-
-struct VirtIOInputHIDCcw {
-    VirtioCcwDevice parent_obj;
-    VirtIOInputHID vdev;
-};
-
 #endif
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 4/4] virtio-ccw: do not include headers for all virtio devices
  2022-03-28 14:30 [PATCH 0/4] virtio-ccw: remove device declarations from virtio-ccw.h Paolo Bonzini
                   ` (2 preceding siblings ...)
  2022-03-28 14:30 ` [PATCH 3/4] virtio-ccw: move device type declarations to .c files Paolo Bonzini
@ 2022-03-28 14:30 ` Paolo Bonzini
  2022-03-30  7:12   ` Thomas Huth
  2022-03-31 13:50   ` Halil Pasic
  3 siblings, 2 replies; 15+ messages in thread
From: Paolo Bonzini @ 2022-03-28 14:30 UTC (permalink / raw)
  To: qemu-devel; +Cc: thuth, cohuck, farman, pasic, qemu-s390x, borntraeger

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/s390x/ipl.c        |  3 +++
 hw/s390x/virtio-ccw.h | 16 ----------------
 2 files changed, 3 insertions(+), 16 deletions(-)

diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c
index e21776822a..ca56a1b29a 100644
--- a/hw/s390x/ipl.c
+++ b/hw/s390x/ipl.c
@@ -27,11 +27,14 @@
 #include "hw/s390x/css.h"
 #include "hw/s390x/ebcdic.h"
 #include "hw/s390x/pv.h"
+#include "hw/scsi/scsi.h"
+#include "hw/virtio/virtio-net.h"
 #include "ipl.h"
 #include "qemu/error-report.h"
 #include "qemu/config-file.h"
 #include "qemu/cutils.h"
 #include "qemu/option.h"
+#include "standard-headers/linux/virtio_ids.h"
 #include "exec/exec-all.h"
 
 #define KERN_IMAGE_START                0x010000UL
diff --git a/hw/s390x/virtio-ccw.h b/hw/s390x/virtio-ccw.h
index fc131194bf..fac186c8f6 100644
--- a/hw/s390x/virtio-ccw.h
+++ b/hw/s390x/virtio-ccw.h
@@ -13,24 +13,8 @@
 #ifndef HW_S390X_VIRTIO_CCW_H
 #define HW_S390X_VIRTIO_CCW_H
 
-#include "hw/virtio/virtio-blk.h"
-#include "hw/virtio/virtio-net.h"
-#include "hw/virtio/virtio-serial.h"
-#include "hw/virtio/virtio-scsi.h"
 #include "qom/object.h"
-#ifdef CONFIG_VHOST_SCSI
-#include "hw/virtio/vhost-scsi.h"
-#endif
-#include "hw/virtio/virtio-balloon.h"
-#include "hw/virtio/virtio-rng.h"
-#include "hw/virtio/virtio-crypto.h"
 #include "hw/virtio/virtio-bus.h"
-#ifdef CONFIG_VHOST_VSOCK
-#include "hw/virtio/vhost-vsock.h"
-#endif /* CONFIG_VHOST_VSOCK */
-#include "hw/virtio/virtio-gpu.h"
-#include "hw/virtio/virtio-input.h"
-
 #include "hw/s390x/s390_flic.h"
 #include "hw/s390x/css.h"
 #include "ccw-device.h"
-- 
2.35.1



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/4] s390x: follow qdev tree to detect SCSI device on a CCW bus
  2022-03-28 14:30 ` [PATCH 1/4] s390x: follow qdev tree to detect SCSI device on a CCW bus Paolo Bonzini
@ 2022-03-29 12:45   ` Thomas Huth
  2022-03-31  0:21   ` Halil Pasic
  1 sibling, 0 replies; 15+ messages in thread
From: Thomas Huth @ 2022-03-29 12:45 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: pasic, borntraeger, farman, cohuck, qemu-s390x

On 28/03/2022 16.30, Paolo Bonzini wrote:
> Do not make assumptions on the parent type of the SCSIDevice, instead
> use object_dynamic_cast all the way up to the CcwDevice.  This is cleaner
> because there is no guarantee that the bus is on a virtio-scsi device;
> that is only the case for the default configuration of QEMU's s390x
> target.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   hw/s390x/ipl.c | 20 ++++++++++++--------
>   1 file changed, 12 insertions(+), 8 deletions(-)
> 
> diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c
> index 84971e537b..e21776822a 100644
> --- a/hw/s390x/ipl.c
> +++ b/hw/s390x/ipl.c
> @@ -375,14 +375,18 @@ static CcwDevice *s390_get_ccw_device(DeviceState *dev_st, int *devtype)
>                   object_dynamic_cast(OBJECT(dev_st),
>                                       TYPE_SCSI_DEVICE);
>               if (sd) {
> -                SCSIBus *bus = scsi_bus_from_device(sd);
> -                VirtIOSCSI *vdev = container_of(bus, VirtIOSCSI, bus);
> -                VirtIOSCSICcw *scsi_ccw = container_of(vdev, VirtIOSCSICcw,
> -                                                       vdev);
> -
> -                ccw_dev = (CcwDevice *)object_dynamic_cast(OBJECT(scsi_ccw),
> -                                                           TYPE_CCW_DEVICE);
> -                tmp_dt = CCW_DEVTYPE_SCSI;
> +                SCSIBus *sbus = scsi_bus_from_device(sd);
> +                VirtIODevice *vdev = (VirtIODevice *)
> +                    object_dynamic_cast(OBJECT(sbus->qbus.parent),
> +                                        TYPE_VIRTIO_DEVICE);
> +		if (vdev) {

Seems like you accidentally used TABs for indentation here?

With TABs replaced by spaces:

  Reviewed-by: Thomas Huth <thuth@redhat.com>


> +                    ccw_dev = (CcwDevice *)
> +                        object_dynamic_cast(OBJECT(qdev_get_parent_bus(DEVICE(vdev))->parent),
> +                                            TYPE_CCW_DEVICE);
> +                    if (ccw_dev) {
> +                        tmp_dt = CCW_DEVTYPE_SCSI;
> +                    }
> +		}
>               }
>           }
>       }



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 2/4] virtio-ccw: move vhost_ccw_scsi to a separate file
  2022-03-28 14:30 ` [PATCH 2/4] virtio-ccw: move vhost_ccw_scsi to a separate file Paolo Bonzini
@ 2022-03-29 13:34   ` Thomas Huth
  2022-03-29 20:09   ` Eric Farman
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 15+ messages in thread
From: Thomas Huth @ 2022-03-29 13:34 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: pasic, borntraeger, farman, cohuck, qemu-s390x

On 28/03/2022 16.30, Paolo Bonzini wrote:
> Remove unecessary use of #ifdef CONFIG_VHOST_SCSI, instead just use a
> separate file and a separate rule in meson.build.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   hw/s390x/meson.build       |  1 +
>   hw/s390x/vhost-scsi-ccw.c  | 64 ++++++++++++++++++++++++++++++++++++++
>   hw/s390x/virtio-ccw-scsi.c | 47 ----------------------------
>   3 files changed, 65 insertions(+), 47 deletions(-)
>   create mode 100644 hw/s390x/vhost-scsi-ccw.c

Reviewed-by: Thomas Huth <thuth@redhat.com>



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 2/4] virtio-ccw: move vhost_ccw_scsi to a separate file
  2022-03-28 14:30 ` [PATCH 2/4] virtio-ccw: move vhost_ccw_scsi to a separate file Paolo Bonzini
  2022-03-29 13:34   ` Thomas Huth
@ 2022-03-29 20:09   ` Eric Farman
  2022-03-31 11:46   ` Halil Pasic
  2022-04-04 14:43   ` Cornelia Huck
  3 siblings, 0 replies; 15+ messages in thread
From: Eric Farman @ 2022-03-29 20:09 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: pasic, borntraeger, thuth, cohuck, qemu-s390x

On Mon, 2022-03-28 at 16:30 +0200, Paolo Bonzini wrote:
> Remove unecessary use of #ifdef CONFIG_VHOST_SCSI, instead just use a
> separate file and a separate rule in meson.build.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  hw/s390x/meson.build       |  1 +
>  hw/s390x/vhost-scsi-ccw.c  | 64
> ++++++++++++++++++++++++++++++++++++++
>  hw/s390x/virtio-ccw-scsi.c | 47 ----------------------------
>  3 files changed, 65 insertions(+), 47 deletions(-)
>  create mode 100644 hw/s390x/vhost-scsi-ccw.c
> 
> diff --git a/hw/s390x/meson.build b/hw/s390x/meson.build
> index 28484256ec..feefe0717e 100644
> --- a/hw/s390x/meson.build
> +++ b/hw/s390x/meson.build
> @@ -44,6 +44,7 @@ virtio_ss.add(when: 'CONFIG_VIRTIO_SERIAL',
> if_true: files('virtio-ccw-serial.c'
>  if have_virtfs
>    virtio_ss.add(when: 'CONFIG_VIRTIO_9P', if_true: files('virtio-
> ccw-9p.c'))
>  endif
> +virtio_ss.add(when: 'CONFIG_VHOST_SCSI', if_true: files('vhost-scsi-
> ccw.c'))
>  virtio_ss.add(when: 'CONFIG_VHOST_VSOCK', if_true: files('vhost-
> vsock-ccw.c'))
>  virtio_ss.add(when: 'CONFIG_VHOST_USER_FS', if_true: files('vhost-
> user-fs-ccw.c'))
>  s390x_ss.add_all(when: 'CONFIG_VIRTIO_CCW', if_true: virtio_ss)
> diff --git a/hw/s390x/vhost-scsi-ccw.c b/hw/s390x/vhost-scsi-ccw.c
> new file mode 100644
> index 0000000000..b68ddddd1c
> --- /dev/null
> +++ b/hw/s390x/vhost-scsi-ccw.c

Entries exist in the "virtio-ccw" section of MAINTAINERS for the two
vhost files that live in hw/s390x/ today (also covered by the wildcard
entry for vhost). I'd guess this means we should add another to cover
the new file?

Besides that, looks fine.

Reviewed-by: Eric Farman <farman@linux.ibm.com>

Thanks,
Eric

> @@ -0,0 +1,64 @@
> +/*
> + * vhost 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/qdev-properties.h"
> +#include "hw/virtio/virtio.h"
> +#include "qapi/error.h"
> +#include "qemu/module.h"
> +#include "virtio-ccw.h"
> +
> +static void vhost_ccw_scsi_realize(VirtioCcwDevice *ccw_dev, Error
> **errp)
> +{
> +    VHostSCSICcw *dev = VHOST_SCSI_CCW(ccw_dev);
> +    DeviceState *vdev = DEVICE(&dev->vdev);
> +
> +    qdev_realize(vdev, BUS(&ccw_dev->bus), 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;
> +    device_class_set_props(dc, 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,
> +};
> +
> +static void virtio_ccw_scsi_register(void)
> +{
> +    type_register_static(&vhost_ccw_scsi);
> +}
> +
> +type_init(virtio_ccw_scsi_register)
> diff --git a/hw/s390x/virtio-ccw-scsi.c b/hw/s390x/virtio-ccw-scsi.c
> index 6e4beef700..fa706eb550 100644
> --- a/hw/s390x/virtio-ccw-scsi.c
> +++ b/hw/s390x/virtio-ccw-scsi.c
> @@ -70,56 +70,9 @@ static const TypeInfo virtio_ccw_scsi = {
>      .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_realize(vdev, BUS(&ccw_dev->bus), 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;
> -    device_class_set_props(dc, 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)



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 3/4] virtio-ccw: move device type declarations to .c files
  2022-03-28 14:30 ` [PATCH 3/4] virtio-ccw: move device type declarations to .c files Paolo Bonzini
@ 2022-03-30  7:11   ` Thomas Huth
  2022-03-31 12:14   ` Halil Pasic
  1 sibling, 0 replies; 15+ messages in thread
From: Thomas Huth @ 2022-03-30  7:11 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: pasic, borntraeger, farman, cohuck, qemu-s390x

On 28/03/2022 16.30, Paolo Bonzini wrote:
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   hw/s390x/s390-virtio-ccw.c    |   1 +
>   hw/s390x/vhost-scsi-ccw.c     |   9 +++
>   hw/s390x/vhost-vsock-ccw.c    |   9 +++
>   hw/s390x/virtio-ccw-9p.c      |   9 +++
>   hw/s390x/virtio-ccw-balloon.c |   9 +++
>   hw/s390x/virtio-ccw-blk.c     |   9 +++
>   hw/s390x/virtio-ccw-crypto.c  |   9 +++
>   hw/s390x/virtio-ccw-gpu.c     |   9 +++
>   hw/s390x/virtio-ccw-input.c   |  20 +++++
>   hw/s390x/virtio-ccw-net.c     |   9 +++
>   hw/s390x/virtio-ccw-rng.c     |   9 +++
>   hw/s390x/virtio-ccw-scsi.c    |   9 +++
>   hw/s390x/virtio-ccw-serial.c  |   9 +++
>   hw/s390x/virtio-ccw.c         |   2 +
>   hw/s390x/virtio-ccw.h         | 133 ----------------------------------
>   15 files changed, 122 insertions(+), 133 deletions(-)

Reviewed-by: Thomas Huth <thuth@redhat.com>



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 4/4] virtio-ccw: do not include headers for all virtio devices
  2022-03-28 14:30 ` [PATCH 4/4] virtio-ccw: do not include headers for all virtio devices Paolo Bonzini
@ 2022-03-30  7:12   ` Thomas Huth
  2022-03-31 13:50   ` Halil Pasic
  1 sibling, 0 replies; 15+ messages in thread
From: Thomas Huth @ 2022-03-30  7:12 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: pasic, borntraeger, farman, cohuck, qemu-s390x

On 28/03/2022 16.30, Paolo Bonzini wrote:
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   hw/s390x/ipl.c        |  3 +++
>   hw/s390x/virtio-ccw.h | 16 ----------------
>   2 files changed, 3 insertions(+), 16 deletions(-)
> 
> diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c
> index e21776822a..ca56a1b29a 100644
> --- a/hw/s390x/ipl.c
> +++ b/hw/s390x/ipl.c
> @@ -27,11 +27,14 @@
>   #include "hw/s390x/css.h"
>   #include "hw/s390x/ebcdic.h"
>   #include "hw/s390x/pv.h"
> +#include "hw/scsi/scsi.h"
> +#include "hw/virtio/virtio-net.h"
>   #include "ipl.h"
>   #include "qemu/error-report.h"
>   #include "qemu/config-file.h"
>   #include "qemu/cutils.h"
>   #include "qemu/option.h"
> +#include "standard-headers/linux/virtio_ids.h"
>   #include "exec/exec-all.h"
>   
>   #define KERN_IMAGE_START                0x010000UL
> diff --git a/hw/s390x/virtio-ccw.h b/hw/s390x/virtio-ccw.h
> index fc131194bf..fac186c8f6 100644
> --- a/hw/s390x/virtio-ccw.h
> +++ b/hw/s390x/virtio-ccw.h
> @@ -13,24 +13,8 @@
>   #ifndef HW_S390X_VIRTIO_CCW_H
>   #define HW_S390X_VIRTIO_CCW_H
>   
> -#include "hw/virtio/virtio-blk.h"
> -#include "hw/virtio/virtio-net.h"
> -#include "hw/virtio/virtio-serial.h"
> -#include "hw/virtio/virtio-scsi.h"
>   #include "qom/object.h"
> -#ifdef CONFIG_VHOST_SCSI
> -#include "hw/virtio/vhost-scsi.h"
> -#endif
> -#include "hw/virtio/virtio-balloon.h"
> -#include "hw/virtio/virtio-rng.h"
> -#include "hw/virtio/virtio-crypto.h"
>   #include "hw/virtio/virtio-bus.h"
> -#ifdef CONFIG_VHOST_VSOCK
> -#include "hw/virtio/vhost-vsock.h"
> -#endif /* CONFIG_VHOST_VSOCK */
> -#include "hw/virtio/virtio-gpu.h"
> -#include "hw/virtio/virtio-input.h"
> -
>   #include "hw/s390x/s390_flic.h"
>   #include "hw/s390x/css.h"
>   #include "ccw-device.h"

Reviewed-by: Thomas Huth <thuth@redhat.com>




^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/4] s390x: follow qdev tree to detect SCSI device on a CCW bus
  2022-03-28 14:30 ` [PATCH 1/4] s390x: follow qdev tree to detect SCSI device on a CCW bus Paolo Bonzini
  2022-03-29 12:45   ` Thomas Huth
@ 2022-03-31  0:21   ` Halil Pasic
  1 sibling, 0 replies; 15+ messages in thread
From: Halil Pasic @ 2022-03-31  0:21 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: farman, cohuck, thuth, qemu-devel, Halil Pasic, qemu-s390x, borntraeger

On Mon, 28 Mar 2022 16:30:16 +0200
Paolo Bonzini <pbonzini@redhat.com> wrote:

> Do not make assumptions on the parent type of the SCSIDevice, instead
> use object_dynamic_cast all the way up to the CcwDevice.  This is cleaner
> because there is no guarantee that the bus is on a virtio-scsi device;
> that is only the case for the default configuration of QEMU's s390x
> target.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Halil Pasic <pasic@linux.ibm.com>


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 2/4] virtio-ccw: move vhost_ccw_scsi to a separate file
  2022-03-28 14:30 ` [PATCH 2/4] virtio-ccw: move vhost_ccw_scsi to a separate file Paolo Bonzini
  2022-03-29 13:34   ` Thomas Huth
  2022-03-29 20:09   ` Eric Farman
@ 2022-03-31 11:46   ` Halil Pasic
  2022-04-04 14:43   ` Cornelia Huck
  3 siblings, 0 replies; 15+ messages in thread
From: Halil Pasic @ 2022-03-31 11:46 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: farman, cohuck, thuth, qemu-devel, Halil Pasic, qemu-s390x, borntraeger

On Mon, 28 Mar 2022 16:30:17 +0200
Paolo Bonzini <pbonzini@redhat.com> wrote:

> Remove unecessary use of #ifdef CONFIG_VHOST_SCSI, instead just use a
> separate file and a separate rule in meson.build.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Halil Pasic <pasic@linux.ibm.com>


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 3/4] virtio-ccw: move device type declarations to .c files
  2022-03-28 14:30 ` [PATCH 3/4] virtio-ccw: move device type declarations to .c files Paolo Bonzini
  2022-03-30  7:11   ` Thomas Huth
@ 2022-03-31 12:14   ` Halil Pasic
  1 sibling, 0 replies; 15+ messages in thread
From: Halil Pasic @ 2022-03-31 12:14 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: farman, cohuck, thuth, qemu-devel, Halil Pasic, qemu-s390x, borntraeger

On Mon, 28 Mar 2022 16:30:18 +0200
Paolo Bonzini <pbonzini@redhat.com> wrote:

> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Just curious: is device type declarations for
leaf device types should be private a best practice in QEMU?

> ---
>  hw/s390x/s390-virtio-ccw.c    |   1 +
>  hw/s390x/vhost-scsi-ccw.c     |   9 +++
>  hw/s390x/vhost-vsock-ccw.c    |   9 +++
>  hw/s390x/virtio-ccw-9p.c      |   9 +++
>  hw/s390x/virtio-ccw-balloon.c |   9 +++
>  hw/s390x/virtio-ccw-blk.c     |   9 +++
>  hw/s390x/virtio-ccw-crypto.c  |   9 +++
>  hw/s390x/virtio-ccw-gpu.c     |   9 +++
>  hw/s390x/virtio-ccw-input.c   |  20 +++++
>  hw/s390x/virtio-ccw-net.c     |   9 +++
>  hw/s390x/virtio-ccw-rng.c     |   9 +++
>  hw/s390x/virtio-ccw-scsi.c    |   9 +++
>  hw/s390x/virtio-ccw-serial.c  |   9 +++
>  hw/s390x/virtio-ccw.c         |   2 +
>  hw/s390x/virtio-ccw.h         | 133 ----------------------------------
>  15 files changed, 122 insertions(+), 133 deletions(-)
> 
> diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
> index 90480e7cf9..2d32647d08 100644
> --- a/hw/s390x/s390-virtio-ccw.c
> +++ b/hw/s390x/s390-virtio-ccw.c
> @@ -25,6 +25,7 @@
>  #include "qemu/error-report.h"
>  #include "qemu/option.h"
>  #include "qemu/qemu-print.h"
> +#include "qemu/units.h"

Unrelated?

[..]
> diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c
> index c845a92c3a..15b458527e 100644
> --- a/hw/s390x/virtio-ccw.c
> +++ b/hw/s390x/virtio-ccw.c
> @@ -12,6 +12,7 @@
>  
>  #include "qemu/osdep.h"
>  #include "qapi/error.h"
> +#include "exec/address-spaces.h"

Unrelated?

>  #include "sysemu/kvm.h"
>  #include "net/net.h"
>  #include "hw/virtio/virtio.h"
> @@ -19,6 +20,7 @@
>  #include "hw/virtio/virtio-net.h"
>  #include "qemu/bitops.h"
>  #include "qemu/error-report.h"
> +#include "qemu/log.h"

Unrelated?

Reviewed-by: Halil Pasic <pasic@linux.ibm.com>


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 4/4] virtio-ccw: do not include headers for all virtio devices
  2022-03-28 14:30 ` [PATCH 4/4] virtio-ccw: do not include headers for all virtio devices Paolo Bonzini
  2022-03-30  7:12   ` Thomas Huth
@ 2022-03-31 13:50   ` Halil Pasic
  1 sibling, 0 replies; 15+ messages in thread
From: Halil Pasic @ 2022-03-31 13:50 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: farman, cohuck, thuth, qemu-devel, Halil Pasic, qemu-s390x, borntraeger

On Mon, 28 Mar 2022 16:30:19 +0200
Paolo Bonzini <pbonzini@redhat.com> wrote:

> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Halil Pasic <pasic@linux.ibm.com>


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 2/4] virtio-ccw: move vhost_ccw_scsi to a separate file
  2022-03-28 14:30 ` [PATCH 2/4] virtio-ccw: move vhost_ccw_scsi to a separate file Paolo Bonzini
                     ` (2 preceding siblings ...)
  2022-03-31 11:46   ` Halil Pasic
@ 2022-04-04 14:43   ` Cornelia Huck
  3 siblings, 0 replies; 15+ messages in thread
From: Cornelia Huck @ 2022-04-04 14:43 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: pasic, thuth, borntraeger, farman, qemu-s390x

On Mon, Mar 28 2022, Paolo Bonzini <pbonzini@redhat.com> wrote:

> Remove unecessary use of #ifdef CONFIG_VHOST_SCSI, instead just use a
> separate file and a separate rule in meson.build.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  hw/s390x/meson.build       |  1 +
>  hw/s390x/vhost-scsi-ccw.c  | 64 ++++++++++++++++++++++++++++++++++++++
>  hw/s390x/virtio-ccw-scsi.c | 47 ----------------------------
>  3 files changed, 65 insertions(+), 47 deletions(-)
>  create mode 100644 hw/s390x/vhost-scsi-ccw.c
>

> diff --git a/hw/s390x/vhost-scsi-ccw.c b/hw/s390x/vhost-scsi-ccw.c

As Eric already noted, please add an entry in MAINTAINERS under
virtio-ccw for this file.

> new file mode 100644
> index 0000000000..b68ddddd1c
> --- /dev/null
> +++ b/hw/s390x/vhost-scsi-ccw.c
> @@ -0,0 +1,64 @@
> +/*
> + * vhost ccw scsi implementation
> + *
> + * Copyright 2012, 2015 IBM Corp.
> + * Author(s): Cornelia Huck <cornelia.huck@de.ibm.com>

That old copyright notice gets copied around a lot; what I find funny
here is that you actually introduced the device in the first place :)
(commit ccf6916c843edd30ea4ecfaaac68faa865529c97)

(I believe we really can't do any better, and I probably did touch this
while still wearing my IBM hat.)

> + *
> + * 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.
> + */



^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2022-04-04 14:44 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-28 14:30 [PATCH 0/4] virtio-ccw: remove device declarations from virtio-ccw.h Paolo Bonzini
2022-03-28 14:30 ` [PATCH 1/4] s390x: follow qdev tree to detect SCSI device on a CCW bus Paolo Bonzini
2022-03-29 12:45   ` Thomas Huth
2022-03-31  0:21   ` Halil Pasic
2022-03-28 14:30 ` [PATCH 2/4] virtio-ccw: move vhost_ccw_scsi to a separate file Paolo Bonzini
2022-03-29 13:34   ` Thomas Huth
2022-03-29 20:09   ` Eric Farman
2022-03-31 11:46   ` Halil Pasic
2022-04-04 14:43   ` Cornelia Huck
2022-03-28 14:30 ` [PATCH 3/4] virtio-ccw: move device type declarations to .c files Paolo Bonzini
2022-03-30  7:11   ` Thomas Huth
2022-03-31 12:14   ` Halil Pasic
2022-03-28 14:30 ` [PATCH 4/4] virtio-ccw: do not include headers for all virtio devices Paolo Bonzini
2022-03-30  7:12   ` Thomas Huth
2022-03-31 13:50   ` Halil Pasic

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.