qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, berrange@redhat.com, ehabkost@redhat.com,
	"Michael S . Tsirkin" <mst@redhat.com>
Subject: [PATCH 09/17] hw/isa/superio: Make the components QOM children
Date: Tue, 28 Apr 2020 18:34:11 +0200	[thread overview]
Message-ID: <20200428163419.4483-10-armbru@redhat.com> (raw)
In-Reply-To: <20200428163419.4483-1-armbru@redhat.com>

isa_superio_realize() attempts to make isa-parallel and isa-serial QOM
children, but this does not work, because it calls
object_property_add_child() after realizing with qdev_init_nofail().
Realizing a device without a parent gives it one: it gets put into the
"/machine/unattached/" orphanage.  The extra
object_property_add_child() fails, and isa_superio_realize() ignores
the error.

Move the object_property_add_child() before qdev_init_nofail(), and
pass &error_abort.

For the other components, isa_superio_realize() doesn't even try.  Add
object_property_add_child() there.

This affects machines 40p, clipper and fulong2e.

For instance, fulong2e has its vt82c686b-superio (which is an
isa-superio) at /machine/unattached/device[9].  Before the patch, its
components are at /machine/unattached/device[10] .. [14].  Afterwards,
they are at
/machine/unattached/device[9]/{parallel0,serial0,serial1,isa-fdc,i8042}.

Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 hw/isa/isa-superio.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/hw/isa/isa-superio.c b/hw/isa/isa-superio.c
index 180a8b9625..0d9d848280 100644
--- a/hw/isa/isa-superio.c
+++ b/hw/isa/isa-superio.c
@@ -62,6 +62,8 @@ static void isa_superio_realize(DeviceState *dev, Error **errp)
                 qdev_prop_set_uint32(d, "irq", k->parallel.get_irq(sio, i));
             }
             qdev_prop_set_chr(d, "chardev", chr);
+            object_property_add_child(OBJECT(sio), name, OBJECT(isa),
+                                      &error_abort);
             qdev_init_nofail(d);
             sio->parallel[i] = isa;
             trace_superio_create_parallel(i,
@@ -69,8 +71,6 @@ static void isa_superio_realize(DeviceState *dev, Error **errp)
                                           k->parallel.get_iobase(sio, i) : -1,
                                           k->parallel.get_irq ?
                                           k->parallel.get_irq(sio, i) : -1);
-            object_property_add_child(OBJECT(dev), name,
-                                      OBJECT(sio->parallel[i]), NULL);
             g_free(name);
         }
     }
@@ -102,6 +102,8 @@ static void isa_superio_realize(DeviceState *dev, Error **errp)
                 qdev_prop_set_uint32(d, "irq", k->serial.get_irq(sio, i));
             }
             qdev_prop_set_chr(d, "chardev", chr);
+            object_property_add_child(OBJECT(sio), name, OBJECT(isa),
+                                      &error_abort);
             qdev_init_nofail(d);
             sio->serial[i] = isa;
             trace_superio_create_serial(i,
@@ -109,8 +111,6 @@ static void isa_superio_realize(DeviceState *dev, Error **errp)
                                         k->serial.get_iobase(sio, i) : -1,
                                         k->serial.get_irq ?
                                         k->serial.get_irq(sio, i) : -1);
-            object_property_add_child(OBJECT(dev), name,
-                                      OBJECT(sio->serial[0]), NULL);
             g_free(name);
         }
     }
@@ -137,6 +137,8 @@ static void isa_superio_realize(DeviceState *dev, Error **errp)
             qdev_prop_set_drive(d, "driveB", blk_by_legacy_dinfo(drive),
                                 &error_fatal);
         }
+        object_property_add_child(OBJECT(sio), "isa-fdc", OBJECT(isa),
+                                  &error_abort);
         qdev_init_nofail(d);
         sio->floppy = isa;
         trace_superio_create_floppy(0,
@@ -147,7 +149,11 @@ static void isa_superio_realize(DeviceState *dev, Error **errp)
     }
 
     /* Keyboard, mouse */
-    sio->kbc = isa_create_simple(bus, TYPE_I8042);
+    isa = isa_create(bus, TYPE_I8042);
+    object_property_add_child(OBJECT(sio), TYPE_I8042, OBJECT(isa),
+                              &error_abort);
+    qdev_init_nofail(DEVICE(isa));
+    sio->kbc = isa;
 
     /* IDE */
     if (k->ide.count && (!k->ide.is_enabled || k->ide.is_enabled(sio, 0))) {
@@ -163,6 +169,8 @@ static void isa_superio_realize(DeviceState *dev, Error **errp)
             qdev_prop_set_uint32(d, "irq", k->ide.get_irq(sio, 0));
         }
         qdev_init_nofail(d);
+        object_property_add_child(OBJECT(sio), "isa-ide", OBJECT(isa),
+                                  &error_abort);
         sio->ide = isa;
         trace_superio_create_ide(0,
                                  k->ide.get_iobase ?
-- 
2.21.1



  parent reply	other threads:[~2020-04-28 16:50 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-28 16:34 [PATCH 00/17] qom: Spring cleaning Markus Armbruster
2020-04-28 16:34 ` [PATCH 01/17] qom: Clearer reference counting in object_initialize_childv() Markus Armbruster
2020-04-28 17:38   ` Eric Blake
2020-04-28 16:34 ` [PATCH 02/17] qom: Clean up inconsistent use of gchar * vs. char * Markus Armbruster
2020-04-28 17:41   ` Eric Blake
2020-05-02  5:06     ` Markus Armbruster
2020-05-04  9:32       ` Daniel P. Berrangé
2020-05-04 15:27         ` Markus Armbruster
2020-04-28 16:34 ` [PATCH 03/17] qom: Drop object_property_del_child()'s unused parameter @errp Markus Armbruster
2020-04-28 17:42   ` Eric Blake
2020-04-28 16:34 ` [PATCH 04/17] qom: Change object_property_get_uint16List() to match its doc Markus Armbruster
2020-04-28 17:46   ` Eric Blake
2020-05-02  5:06     ` Markus Armbruster
2020-04-28 16:34 ` [PATCH 05/17] qom: Make all the object_property_add_FOO() return the property Markus Armbruster
2020-04-28 17:51   ` Eric Blake
2020-04-28 16:34 ` [PATCH 06/17] qom: Drop object_property_set_description() parameter @errp Markus Armbruster
2020-04-28 18:00   ` Eric Blake
2020-04-28 16:34 ` [PATCH 07/17] tests/check-qom-proplist: Improve iterator coverage Markus Armbruster
2020-04-28 18:27   ` Eric Blake
2020-04-28 16:34 ` [PATCH 08/17] s390x/cpumodel: Fix UI to CPU features pcc-cmac-{aes, eaes}-256 Markus Armbruster
2020-04-28 17:13   ` [PATCH 08/17] s390x/cpumodel: Fix UI to CPU features pcc-cmac-{aes,eaes}-256 David Hildenbrand
2020-04-29  8:54     ` Christian Borntraeger
2020-04-30 18:47       ` Christian Borntraeger
2020-05-02  5:15         ` [PATCH 08/17] s390x/cpumodel: Fix UI to CPU features pcc-cmac-{aes, eaes}-256 Markus Armbruster
2020-05-04  8:33           ` [PATCH 08/17] s390x/cpumodel: Fix UI to CPU features pcc-cmac-{aes,eaes}-256 Christian Borntraeger
2020-04-30 18:22     ` [PATCH 08/17] s390x/cpumodel: Fix UI to CPU features pcc-cmac-{aes, eaes}-256 Markus Armbruster
2020-05-01  9:06       ` [PATCH 08/17] s390x/cpumodel: Fix UI to CPU features pcc-cmac-{aes,eaes}-256 David Hildenbrand
2020-05-02  6:26         ` [PATCH 08/17] s390x/cpumodel: Fix UI to CPU features pcc-cmac-{aes, eaes}-256 Markus Armbruster
2020-05-02  8:39           ` [PATCH 08/17] s390x/cpumodel: Fix UI to CPU features pcc-cmac-{aes,eaes}-256 David Hildenbrand
2020-05-05 14:23             ` [PATCH 08/17] s390x/cpumodel: Fix UI to CPU features pcc-cmac-{aes, eaes}-256 Markus Armbruster
2020-05-05 14:46               ` [PATCH 08/17] s390x/cpumodel: Fix UI to CPU features pcc-cmac-{aes,eaes}-256 David Hildenbrand
2020-05-05 15:23                 ` [PATCH 08/17] s390x/cpumodel: Fix UI to CPU features pcc-cmac-{aes, eaes}-256 Markus Armbruster
2020-04-28 16:34 ` Markus Armbruster [this message]
2020-05-04 16:21   ` [PATCH 09/17] hw/isa/superio: Make the components QOM children Philippe Mathieu-Daudé
2020-04-28 16:34 ` [PATCH 10/17] e1000: Don't run e1000_instance_init() twice Markus Armbruster
2020-04-29  8:55   ` Jason Wang
2020-04-28 16:34 ` [PATCH 11/17] hw/arm/bcm2835: Drop futile attempts at QOM-adopting memory Markus Armbruster
2020-04-28 17:27   ` Philippe Mathieu-Daudé
2020-04-28 16:34 ` [PATCH 12/17] qdev: Clean up qdev_connect_gpio_out_named() Markus Armbruster
2020-05-05 14:40   ` Philippe Mathieu-Daudé
2020-05-05 15:25     ` Markus Armbruster
2020-04-28 16:34 ` [PATCH 13/17] qom: Drop parameter @errp of object_property_add() & friends Markus Armbruster
2020-04-28 18:43   ` Eric Blake
2020-05-02  5:09     ` Markus Armbruster
2020-04-28 16:34 ` [PATCH 14/17] Drop more @errp parameters after previous commit Markus Armbruster
2020-04-28 18:44   ` Eric Blake
2020-04-28 16:34 ` [PATCH 15/17] qdev: Unrealize must not fail Markus Armbruster
2020-05-04 16:28   ` Philippe Mathieu-Daudé
2020-04-28 16:34 ` [PATCH 16/17] spapr_pci: Drop some dead error handling Markus Armbruster
2020-04-29  1:22   ` David Gibson
2020-04-29  7:03   ` Greg Kurz
2020-04-29  7:35   ` Philippe Mathieu-Daudé
2020-04-28 16:34 ` [PATCH 17/17] qom: Drop @errp parameter of object_property_del() Markus Armbruster
2020-04-28 18:50   ` Eric Blake
2020-05-02  5:09     ` Markus Armbruster
2020-04-28 23:24 ` [PATCH 00/17] qom: Spring cleaning no-reply
2020-05-04 12:48 ` Paolo Bonzini
2020-05-04 15:28   ` Markus Armbruster
2020-05-04 15:57     ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200428163419.4483-10-armbru@redhat.com \
    --to=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).