qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] hw/s390x/ccw: Register qbus type in abstract TYPE_CCW_DEVICE parent
@ 2021-04-24 14:53 Philippe Mathieu-Daudé
  2021-04-27 20:07 ` Eric Farman
  2021-04-28 11:45 ` Cornelia Huck
  0 siblings, 2 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-04-24 14:53 UTC (permalink / raw)
  To: qemu-devel
  Cc: Eric Farman, Matthew Rosato, Michael S. Tsirkin, Cornelia Huck,
	Richard Henderson, Markus Armbruster, Philippe Mathieu-Daudé,
	Halil Pasic, Christian Borntraeger, qemu-s390x, Thomas Huth,
	David Hildenbrand

Instead of having all TYPE_CCW_DEVICE children set the bus type to
TYPE_VIRTUAL_CSS_BUS, do it once in the abstract parent.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
RFC because I don't know these devices, maybe there is a reason
for setting the bus type in the children (but it should be documented
IMO).
---
 hw/s390x/ccw-device.h | 1 +
 hw/s390x/3270-ccw.c   | 1 -
 hw/s390x/ccw-device.c | 1 +
 hw/s390x/s390-ccw.c   | 2 --
 hw/s390x/virtio-ccw.c | 1 -
 5 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/hw/s390x/ccw-device.h b/hw/s390x/ccw-device.h
index 832c78cd421..6dff95225df 100644
--- a/hw/s390x/ccw-device.h
+++ b/hw/s390x/ccw-device.h
@@ -14,6 +14,7 @@
 #include "qom/object.h"
 #include "hw/qdev-core.h"
 #include "hw/s390x/css.h"
+#include "hw/s390x/css-bridge.h"
 
 struct CcwDevice {
     DeviceState parent_obj;
diff --git a/hw/s390x/3270-ccw.c b/hw/s390x/3270-ccw.c
index f3e7342b1e8..0757af60632 100644
--- a/hw/s390x/3270-ccw.c
+++ b/hw/s390x/3270-ccw.c
@@ -159,7 +159,6 @@ static void emulated_ccw_3270_class_init(ObjectClass *klass, void *data)
     DeviceClass *dc = DEVICE_CLASS(klass);
 
     device_class_set_props(dc, emulated_ccw_3270_properties);
-    dc->bus_type = TYPE_VIRTUAL_CSS_BUS;
     dc->realize = emulated_ccw_3270_realize;
     dc->hotpluggable = false;
     set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories);
diff --git a/hw/s390x/ccw-device.c b/hw/s390x/ccw-device.c
index c9707110e9c..95f269ab441 100644
--- a/hw/s390x/ccw-device.c
+++ b/hw/s390x/ccw-device.c
@@ -59,6 +59,7 @@ static void ccw_device_class_init(ObjectClass *klass, void *data)
     k->refill_ids = ccw_device_refill_ids;
     device_class_set_props(dc, ccw_device_properties);
     dc->reset = ccw_device_reset;
+    dc->bus_type = TYPE_VIRTUAL_CSS_BUS;
 }
 
 const VMStateDescription vmstate_ccw_dev = {
diff --git a/hw/s390x/s390-ccw.c b/hw/s390x/s390-ccw.c
index b497571863f..cb49f380a6b 100644
--- a/hw/s390x/s390-ccw.c
+++ b/hw/s390x/s390-ccw.c
@@ -177,10 +177,8 @@ static void s390_ccw_instance_init(Object *obj)
 
 static void s390_ccw_class_init(ObjectClass *klass, void *data)
 {
-    DeviceClass *dc = DEVICE_CLASS(klass);
     S390CCWDeviceClass *cdc = S390_CCW_DEVICE_CLASS(klass);
 
-    dc->bus_type = TYPE_VIRTUAL_CSS_BUS;
     cdc->realize = s390_ccw_realize;
     cdc->unrealize = s390_ccw_unrealize;
 }
diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c
index 8195f3546e4..71ec2bdcc31 100644
--- a/hw/s390x/virtio-ccw.c
+++ b/hw/s390x/virtio-ccw.c
@@ -1235,7 +1235,6 @@ static void virtio_ccw_device_class_init(ObjectClass *klass, void *data)
     k->unplug = virtio_ccw_busdev_unplug;
     dc->realize = virtio_ccw_busdev_realize;
     dc->unrealize = virtio_ccw_busdev_unrealize;
-    dc->bus_type = TYPE_VIRTUAL_CSS_BUS;
     device_class_set_parent_reset(dc, virtio_ccw_reset, &vdc->parent_reset);
 }
 
-- 
2.26.3



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

* Re: [RFC PATCH] hw/s390x/ccw: Register qbus type in abstract TYPE_CCW_DEVICE parent
  2021-04-24 14:53 [RFC PATCH] hw/s390x/ccw: Register qbus type in abstract TYPE_CCW_DEVICE parent Philippe Mathieu-Daudé
@ 2021-04-27 20:07 ` Eric Farman
  2021-04-28 11:45 ` Cornelia Huck
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Farman @ 2021-04-27 20:07 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Thomas Huth, Matthew Rosato, Michael S. Tsirkin, Cornelia Huck,
	Richard Henderson, Markus Armbruster, Halil Pasic,
	Christian Borntraeger, qemu-s390x, David Hildenbrand

On Sat, 2021-04-24 at 16:53 +0200, Philippe Mathieu-Daudé wrote:
> Instead of having all TYPE_CCW_DEVICE children set the bus type to
> TYPE_VIRTUAL_CSS_BUS, do it once in the abstract parent.
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> RFC because I don't know these devices, maybe there is a reason
> for setting the bus type in the children (but it should be documented
> IMO).

I don't know the history behind it, but don't see an obvious reason for
doing it the current way. I sure do like the end result.

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

> ---
>  hw/s390x/ccw-device.h | 1 +
>  hw/s390x/3270-ccw.c   | 1 -
>  hw/s390x/ccw-device.c | 1 +
>  hw/s390x/s390-ccw.c   | 2 --
>  hw/s390x/virtio-ccw.c | 1 -
>  5 files changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/s390x/ccw-device.h b/hw/s390x/ccw-device.h
> index 832c78cd421..6dff95225df 100644
> --- a/hw/s390x/ccw-device.h
> +++ b/hw/s390x/ccw-device.h
> @@ -14,6 +14,7 @@
>  #include "qom/object.h"
>  #include "hw/qdev-core.h"
>  #include "hw/s390x/css.h"
> +#include "hw/s390x/css-bridge.h"
>  
>  struct CcwDevice {
>      DeviceState parent_obj;
> diff --git a/hw/s390x/3270-ccw.c b/hw/s390x/3270-ccw.c
> index f3e7342b1e8..0757af60632 100644
> --- a/hw/s390x/3270-ccw.c
> +++ b/hw/s390x/3270-ccw.c
> @@ -159,7 +159,6 @@ static void
> emulated_ccw_3270_class_init(ObjectClass *klass, void *data)
>      DeviceClass *dc = DEVICE_CLASS(klass);
>  
>      device_class_set_props(dc, emulated_ccw_3270_properties);
> -    dc->bus_type = TYPE_VIRTUAL_CSS_BUS;
>      dc->realize = emulated_ccw_3270_realize;
>      dc->hotpluggable = false;
>      set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories);
> diff --git a/hw/s390x/ccw-device.c b/hw/s390x/ccw-device.c
> index c9707110e9c..95f269ab441 100644
> --- a/hw/s390x/ccw-device.c
> +++ b/hw/s390x/ccw-device.c
> @@ -59,6 +59,7 @@ static void ccw_device_class_init(ObjectClass
> *klass, void *data)
>      k->refill_ids = ccw_device_refill_ids;
>      device_class_set_props(dc, ccw_device_properties);
>      dc->reset = ccw_device_reset;
> +    dc->bus_type = TYPE_VIRTUAL_CSS_BUS;
>  }
>  
>  const VMStateDescription vmstate_ccw_dev = {
> diff --git a/hw/s390x/s390-ccw.c b/hw/s390x/s390-ccw.c
> index b497571863f..cb49f380a6b 100644
> --- a/hw/s390x/s390-ccw.c
> +++ b/hw/s390x/s390-ccw.c
> @@ -177,10 +177,8 @@ static void s390_ccw_instance_init(Object *obj)
>  
>  static void s390_ccw_class_init(ObjectClass *klass, void *data)
>  {
> -    DeviceClass *dc = DEVICE_CLASS(klass);
>      S390CCWDeviceClass *cdc = S390_CCW_DEVICE_CLASS(klass);
>  
> -    dc->bus_type = TYPE_VIRTUAL_CSS_BUS;
>      cdc->realize = s390_ccw_realize;
>      cdc->unrealize = s390_ccw_unrealize;
>  }
> diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c
> index 8195f3546e4..71ec2bdcc31 100644
> --- a/hw/s390x/virtio-ccw.c
> +++ b/hw/s390x/virtio-ccw.c
> @@ -1235,7 +1235,6 @@ static void
> virtio_ccw_device_class_init(ObjectClass *klass, void *data)
>      k->unplug = virtio_ccw_busdev_unplug;
>      dc->realize = virtio_ccw_busdev_realize;
>      dc->unrealize = virtio_ccw_busdev_unrealize;
> -    dc->bus_type = TYPE_VIRTUAL_CSS_BUS;
>      device_class_set_parent_reset(dc, virtio_ccw_reset, &vdc-
> >parent_reset);
>  }
>  



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

* Re: [RFC PATCH] hw/s390x/ccw: Register qbus type in abstract TYPE_CCW_DEVICE parent
  2021-04-24 14:53 [RFC PATCH] hw/s390x/ccw: Register qbus type in abstract TYPE_CCW_DEVICE parent Philippe Mathieu-Daudé
  2021-04-27 20:07 ` Eric Farman
@ 2021-04-28 11:45 ` Cornelia Huck
  1 sibling, 0 replies; 3+ messages in thread
From: Cornelia Huck @ 2021-04-28 11:45 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Eric Farman, Matthew Rosato, Michael S. Tsirkin,
	David Hildenbrand, Richard Henderson, qemu-devel,
	Markus Armbruster, Halil Pasic, Christian Borntraeger,
	qemu-s390x, Thomas Huth

On Sat, 24 Apr 2021 16:53:13 +0200
Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:

> Instead of having all TYPE_CCW_DEVICE children set the bus type to
> TYPE_VIRTUAL_CSS_BUS, do it once in the abstract parent.
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> RFC because I don't know these devices, maybe there is a reason
> for setting the bus type in the children (but it should be documented
> IMO).

We just missed moving the setup from the virtio-ccw device to the ccw
device when we introduced the latter; this is a nice cleanup.

> ---
>  hw/s390x/ccw-device.h | 1 +
>  hw/s390x/3270-ccw.c   | 1 -
>  hw/s390x/ccw-device.c | 1 +
>  hw/s390x/s390-ccw.c   | 2 --
>  hw/s390x/virtio-ccw.c | 1 -
>  5 files changed, 2 insertions(+), 4 deletions(-)

Thanks, applied.



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

end of thread, other threads:[~2021-04-28 11:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-24 14:53 [RFC PATCH] hw/s390x/ccw: Register qbus type in abstract TYPE_CCW_DEVICE parent Philippe Mathieu-Daudé
2021-04-27 20:07 ` Eric Farman
2021-04-28 11:45 ` Cornelia Huck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).