Skip to contentSkip to conversation

hw/s390x: Attach the sclpconsole to /machine/sclp/s390-sclp-event-facility

PATCH In review Thomas Huth 5 participants 6 messages Apr 30, 2024 – May 2, 2024

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 hw/s390x: Attach the sclpconsole to /machine/sclp/s390-sclp-event-facility

The sclpconsole currently does not have a proper parent in the QOM tree, so it shows up under /machine/unattached - which is somewhat ugly. We should rather attach it to /machine/sclp/s390-sclp-event-facility where the other devices of type TYPE_SCLP_EVENT already reside.

---
 hw/s390x/s390-virtio-ccw.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
hw/s390x/s390-virtio-ccw.c +3 -1
index 5c83d1ea17..41be8bf857 100644
@@ -242,11 +242,13 @@ static void s390_create_virtio_net(BusState *bus, const char *name)
 
 static void s390_create_sclpconsole(const char *type, Chardev *chardev)
 {
+    BusState *ev_fac_bus = sclp_get_event_facility_bus();
     DeviceState *dev;
 
     dev = qdev_new(type);
+    object_property_add_child(OBJECT(ev_fac_bus->parent), type, OBJECT(dev));
     qdev_prop_set_chr(dev, "chardev", chardev);
-    qdev_realize_and_unref(dev, sclp_get_event_facility_bus(), &error_fatal);
+    qdev_realize_and_unref(dev, ev_fac_bus, &error_fatal);
 }
 
 static void ccw_init(MachineState *machine)
Signature · 1 line
2.44.0
Reviewed-by on v2 1/1
#1 lore raw
Quoted 19 lines · Thomas Huth

The sclpconsole currently does not have a proper parent in the QOM tree, so it shows up under /machine/unattached - which is somewhat ugly. We should rather attach it to /machine/sclp/s390-sclp-event-facility where the other devices of type TYPE_SCLP_EVENT already reside.

---
  hw/s390x/s390-virtio-ccw.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
hw/s390x/s390-virtio-ccw.c +1 -0
index 5c83d1ea17..41be8bf857 100644
@@ -242,11 +242,13 @@ static void s390_create_virtio_net(BusState *bus, const char *name)
 
  static void s390_create_sclpconsole(const char *type, Chardev *chardev)
  {
+    BusState *ev_fac_bus = sclp_get_event_facility_bus();

hw/s390x/s390-virtio-ccw.c static void s390_create_virtio_net(BusState *bus, const char *name) · line 254

Quoted 10 lines
hw/s390x/s390-virtio-ccw.c +2 -1
      DeviceState *dev;
 
      dev = qdev_new(type);
+    object_property_add_child(OBJECT(ev_fac_bus->parent), type, OBJECT(dev));
      qdev_prop_set_chr(dev, "chardev", chardev);
-    qdev_realize_and_unref(dev, sclp_get_event_facility_bus(), &error_fatal);
+    qdev_realize_and_unref(dev, ev_fac_bus, &error_fatal);
  }
 
  static void ccw_init(MachineState *machine)
Signature · 3 lines
Cheers,

David / dhildenb
Reviewed-by on v2 1/1
#2 lore raw
In reply to Thomas Huth
Quoted 9 lines · Thomas Huth

The sclpconsole currently does not have a proper parent in the QOM tree, so it shows up under /machine/unattached - which is somewhat ugly. We should rather attach it to /machine/sclp/s390-sclp-event-facility where the other devices of type TYPE_SCLP_EVENT already reside.

---
  hw/s390x/s390-virtio-ccw.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
Reviewed-by on v2 1/1
#3 lore raw
In reply to Thomas Huth
Quoted 10 lines · Thomas Huth

The sclpconsole currently does not have a proper parent in the QOM tree, so it shows up under /machine/unattached - which is somewhat ugly. We should rather attach it to /machine/sclp/s390-sclp-event- facility
where the other devices of type TYPE_SCLP_EVENT already reside.

---
 hw/s390x/s390-virtio-ccw.c | 4 +++-

 1 file changed, 3 insertions(+), 1 deletion(-)
Reviewed-by on v2 1/1
#4 lore raw
In reply to Thomas Huth
Quoted 6 lines · Thomas Huth

The sclpconsole currently does not have a proper parent in the QOM tree, so it shows up under /machine/unattached - which is somewhat ugly. We should rather attach it to /machine/sclp/s390-sclp-event-facility where the other devices of type TYPE_SCLP_EVENT already reside.

hw/s390x/s390-virtio-ccw.c static void s390_create_virtio_net(BusState *bus, const char *name) · line 245

Quoted 13 lines
---
  hw/s390x/s390-virtio-ccw.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
hw/s390x/s390-virtio-ccw.c +1 -0
index 5c83d1ea17..41be8bf857 100644
@@ -242,11 +242,13 @@ static void s390_create_virtio_net(BusState *bus, const char *name)
 
  static void s390_create_sclpconsole(const char *type, Chardev *chardev)
  {
+    BusState *ev_fac_bus = sclp_get_event_facility_bus();

This routine sclp_get_event_facility_bus() which scans all the machine could be avoided and even removed. For that, SCLPDevice should be an attribute of the machine. This means reshuffling definitions and object instanciations a little in the code. Would you be OK with that ?

Other machine units/models could undergo the same kind of changes.

Thanks,

C.

Quoted 10 lines
hw/s390x/s390-virtio-ccw.c +2 -1
      DeviceState *dev;
 
      dev = qdev_new(type);
+    object_property_add_child(OBJECT(ev_fac_bus->parent), type, OBJECT(dev));
      qdev_prop_set_chr(dev, "chardev", chardev);
-    qdev_realize_and_unref(dev, sclp_get_event_facility_bus(), &error_fatal);
+    qdev_realize_and_unref(dev, ev_fac_bus, &error_fatal);
  }
 
  static void ccw_init(MachineState *machine)
#5 lore raw
Quoted 14 lines · Cédric Le Goater
Quoted 6 lines · Thomas Huth

The sclpconsole currently does not have a proper parent in the QOM tree, so it shows up under /machine/unattached - which is somewhat ugly. We should rather attach it to /machine/sclp/s390-sclp-event-facility where the other devices of type TYPE_SCLP_EVENT already reside.

Quoted 4 lines

---
  hw/s390x/s390-virtio-ccw.c | 4 +++-

  1 file changed, 3 insertions(+), 1 deletion(-)
Quoted 14 lines

hw/s390x/s390-virtio-ccw.c static void s390_create_virtio_net(BusState *bus, · line 245

Quoted 9 lines
hw/s390x/s390-virtio-ccw.c +1 -0
index 5c83d1ea17..41be8bf857 100644
@@ -242,11 +242,13 @@ static void s390_create_virtio_net(BusState *bus, 
 const char *name)
   static void s390_create_sclpconsole(const char *type, Chardev *chardev)
   {
+    BusState *ev_fac_bus = sclp_get_event_facility_bus();

This routine sclp_get_event_facility_bus() which scans all the machine could be avoided and even removed. For that, SCLPDevice should be an attribute of the machine. This means reshuffling definitions and object instanciations a little in the code. Would you be OK with that ?

Sounds like a good clean-up, yes!

Thomas