virtio-ccw: remove device declarations from virtio-ccw.h
cover virtio-ccw: remove device declarations from virtio-ccw.h
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
Signature · 1 line
2.35.1
PATCH 1/4 s390x: follow qdev tree to detect SCSI device on a CCW bus
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.
--- hw/s390x/ipl.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)
hw/s390x/ipl.c +12 -8
@@ -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 ; + } + } } } }
Signature · 1 line
2.35.1
Re: [PATCH 1/4] s390x: follow qdev tree to detect SCSI device on a CCW bus
Quoted 22 lines · Paolo Bonzini
Do not make assumptions on the parent type of the SCSIDevice, instead use
object_dynamic_castall 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 <[email protected]>--- hw/s390x/ipl.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)hw/s390x/ipl.c +0
-3@@ -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,
hw/s390x/ipl.c static CcwDevice *s390_get_ccw_device(DeviceState *dev_st, int *devtype) · line 382
Quoted 10 lines
hw/s390x/ipl.c +5
-5- 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:
Quoted 10 lines
hw/s390x/ipl.c +7
-0+ 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 ; + } + } } } }
Re: [PATCH 1/4] s390x: follow qdev tree to detect SCSI device on a CCW bus
In reply to Paolo BonziniQuoted 7 lines · On Mon, 28 Mar 2022 16:30:16 +0200 Paolo Bonzini <[email protected]> wrote:
Do not make assumptions on the parent type of the SCSIDevice, instead use
object_dynamic_castall 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 <[email protected]>
PATCH 2/4 virtio-ccw: move vhost_ccw_scsi to a separate file
In reply to Paolo BonziniRemove unecessary use of #ifdef CONFIG_VHOST_SCSI, instead just use a separate file and a separate rule in meson.build.
--- 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
hw/s390x/meson.build +1 -0
@@ -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)
hw/s390x/vhost-scsi-ccw.c new file +64 -0
64 lines not on this page · raw message
hw/s390x/virtio-ccw-scsi.c +0 -47
56 lines not on this page · raw message
Signature · 1 line
2.35.1
Re: [PATCH 2/4] virtio-ccw: move vhost_ccw_scsi to a separate file
Quoted 10 lines · Paolo Bonzini
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 <[email protected]>--- 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
Re: [PATCH 2/4] virtio-ccw: move vhost_ccw_scsi to a separate file
In reply to Paolo Bonzinihw/s390x/vhost-scsi-ccw.c
Quoted 34 lines · Paolo Bonzini
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 <[email protected]>--- 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.chw/s390x/meson.build +0
-0@@ -44,6 +44,7 @@ virtio_ss.add(when: 'CONFIG_VIRTIO_SERIAL',
if_true: files('virtio-ccw-serial.c'
ifhave_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)hw/s390x/vhost-scsi-ccw.c new file +0
-0
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.
Thanks,
Eric
Quoted 132 lines
hw/s390x/vhost-scsi-ccw.c new file +7
-0@@ -0,0 +1,64 @@ +/* +* vhost ccw scsi implementation +* +* Copyright 2012, 2015 IBM Corp. +* Author(s): Cornelia Huck <[email protected]> +* +* 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.
+ */hw/s390x/vhost-scsi-ccw.c new file +9
-0+ +#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)
hw/s390x/vhost-scsi-ccw.c new file +22
-0+{ +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)
hw/s390x/vhost-scsi-ccw.c new file +23
-0+{ +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)hw/s390x/virtio-ccw-scsi.c +0
-47@@ -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)
Re: [PATCH 2/4] virtio-ccw: move vhost_ccw_scsi to a separate file
In reply to Paolo BonziniQuoted 4 lines · On Mon, 28 Mar 2022 16:30:17 +0200 Paolo Bonzini <[email protected]> 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 <[email protected]>
Re: [PATCH 2/4] virtio-ccw: move vhost_ccw_scsi to a separate file
In reply to Paolo Bonzinihw/s390x/vhost-scsi-ccw.c
Quoted 13 lines · Paolo Bonzini
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 <[email protected]>--- 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.chw/s390x/vhost-scsi-ccw.c +0
-0
As Eric already noted, please add an entry in MAINTAINERS under virtio-ccw for this file.
hw/s390x/vhost-scsi-ccw.c line 5
Quoted 10 lines
new file mode 100644
index 0000000000..b68ddddd1chw/s390x/vhost-scsi-ccw.c new file +5
-0@@ -0,0 +1,64 @@ +/* +* vhost ccw scsi implementation +* +* Copyright 2012, 2015 IBM Corp. +* Author(s): Cornelia Huck <[email protected]>
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.)
Quoted 5 lines
hw/s390x/vhost-scsi-ccw.c new file +5
-0+* +* 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. +*/
PATCH 3/4 virtio-ccw: move device type declarations to .c files
In reply to Paolo Bonzini--- 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(-)
hw/s390x/s390-virtio-ccw.c +1 -0
@@ -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"
hw/s390x/vhost-scsi-ccw.c +9 -0
@@ -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) {
hw/s390x/vhost-vsock-ccw.c +9 -0
@@ -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,
hw/s390x/virtio-ccw-9p.c +9 -0
@@ -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) {
hw/s390x/virtio-ccw-balloon.c +9 -0
@@ -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) {
hw/s390x/virtio-ccw-blk.c +9 -0
@@ -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) {
hw/s390x/virtio-ccw-crypto.c +9 -0
@@ -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) {
hw/s390x/virtio-ccw-gpu.c +9 -0
@@ -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) {
hw/s390x/virtio-ccw-input.c +20 -0
@@ -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) {
hw/s390x/virtio-ccw-net.c +9 -0
@@ -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) {
hw/s390x/virtio-ccw-rng.c +9 -0
@@ -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) {
hw/s390x/virtio-ccw-scsi.c +9 -0
@@ -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) {
hw/s390x/virtio-ccw-serial.c +9 -0
@@ -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) {
hw/s390x/virtio-ccw.c +2 -0
@@ -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"
hw/s390x/virtio-ccw.h +0 -133
139 lines not on this page · raw message
Signature · 1 line
2.35.1
Re: [PATCH 3/4] virtio-ccw: move device type declarations to .c files
Quoted 10 lines · Paolo Bonzini
Signed-off-by Paolo Bonzini <[email protected]>--- 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 +++
Quoted 8 lines
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(-)
Re: [PATCH 3/4] virtio-ccw: move device type declarations to .c files
In reply to Paolo BonziniQuoted 1 line · On Mon, 28 Mar 2022 16:30:18 +0200 Paolo Bonzini <[email protected]> wrote:
Signed-off-by Paolo Bonzini <[email protected]>
Just curious: is device type declarations for
leaf device types should be private a best practice in QEMU?
Quoted 23 lines
--- 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(-)hw/s390x/s390-virtio-ccw.c +0
-0
hw/s390x/s390-virtio-ccw.c line 28
Quoted 4 lines
hw/s390x/s390-virtio-ccw.c +1
-0@@ -25,6 +25,7 @@#include "qemu/error-report.h" #include "qemu/option.h" #include "qemu/qemu-print.h" +#include "qemu/units.h"
Unrelated?
[..]
hw/s390x/virtio-ccw.c line 15
Quoted 9 lines
hw/s390x/virtio-ccw.c +1
-0@@ -12,6 +12,7 @@#include "qemu/osdep.h" #include "qapi/error.h" +#include "exec/address-spaces.h"
Unrelated?
hw/s390x/virtio-ccw.c line 23
Quoted 8 lines
hw/s390x/virtio-ccw.c +1
-0#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?
PATCH 4/4 virtio-ccw: do not include headers for all virtio devices
In reply to Paolo Bonzini--- hw/s390x/ipl.c | 3 +++ hw/s390x/virtio-ccw.h | 16 ---------------- 2 files changed, 3 insertions(+), 16 deletions(-)
hw/s390x/ipl.c +3 -0
@@ -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
hw/s390x/virtio-ccw.h +0 -16
@@ -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"
Signature · 1 line
2.35.1
Re: [PATCH 4/4] virtio-ccw: do not include headers for all virtio devices
Quoted 44 lines · Paolo Bonzini
Signed-off-by Paolo Bonzini <[email protected]>--- hw/s390x/ipl.c | 3 +++ hw/s390x/virtio-ccw.h | 16 ---------------- 2 files changed, 3 insertions(+), 16 deletions(-)hw/s390x/ipl.c +3
-0@@ -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 0x010000ULhw/s390x/virtio-ccw.h +0
-10@@ -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"
hw/s390x/virtio-ccw.h line 20
Quoted 10 lines
hw/s390x/virtio-ccw.h +0
-6#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"
Re: [PATCH 4/4] virtio-ccw: do not include headers for all virtio devices
In reply to Paolo BonziniQuoted 1 line · On Mon, 28 Mar 2022 16:30:19 +0200 Paolo Bonzini <[email protected]> wrote:
Signed-off-by Paolo Bonzini <[email protected]>