hw/isa/isa-superio: Fix IDE controller realization
When realizing a Super I/O with IDE controller [*], we get:
qom/object.c:1684: object_property_try_add_child: Assertion `!child->parent' failed. Aborted (core dumped)
This is because the device is already realized when we try to add the QOM property to the parent. Fix by realizing *after* adding the QOM relationship.
[*] Set ISASuperIOClass::ide.count = N with N not zero
--- hw/isa/isa-superio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/isa/isa-superio.c +1 -1
@@ -158,8 +158,8 @@ static void isa_superio_realize(DeviceState *dev, Error **errp)if (k->ide.get_irq) {qdev_prop_set_uint32 (d,"irq" , k->ide.get_irq (sio,0 )); } -isa_realize_and_unref (isa, bus, &error_fatal);object_property_add_child (OBJECT (sio),"isa-ide" ,OBJECT (isa)); +isa_realize_and_unref (isa, bus, &error_fatal); sio->ide = isa; trace_superio_create_ide(0, k->ide.get_iobase ?
Signature · 1 line
2.21.3
Richard Henderson
Reviewed-byQuoted 9 lines · Philippe Mathieu-Daudé
When realizing a Super I/O with IDE controller [*], we get:
qom/object.c:1684:object_property_try_add_child: Assertion `!child->parent' failed. Aborted (core dumped)This is because the device is already realized when we try to add the QOM property to the parent. Fix by realizing *after* adding the QOM relationship.
Quoted 7 lines
[*] Set
ISASuperIOClass::ide.count= N with N not zeroFixes e508430619 ("hw/isa/superio: Make the components QOM children")Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/isa/isa-superio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
r~
Quoted 10 lines · Philippe Mathieu-Daudé
When realizing a Super I/O with IDE controller [*], we get:
qom/object.c:1684:object_property_try_add_child: Assertion `!child->parent' failed. Aborted (core dumped)This is because the device is already realized when we try to add the QOM property to the parent. Fix by realizing *after* adding the QOM relationship.
[*] Set
ISASuperIOClass::ide.count= N with N not zero
Is this a latent bug, or can it bite in master? If the latter, can you show how to reproduce?
Quoted 20 lines
Fixes e508430619 ("hw/isa/superio: Make the components QOM children")Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/isa/isa-superio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/isa/isa-superio.c +1
-1@@ -158,8 +158,8 @@ static void isa_superio_realize(DeviceState *dev, Error **errp)if (k->ide.get_irq) {qdev_prop_set_uint32 (d,"irq" , k->ide.get_irq (sio,0 )); } -isa_realize_and_unref (isa, bus, &error_fatal);object_property_add_child (OBJECT (sio),"isa-ide" ,OBJECT (isa)); +isa_realize_and_unref (isa, bus, &error_fatal); sio->ide = isa; trace_superio_create_ide(0, k->ide.get_iobase ?
Quoted 7 lines · Markus Armbruster
Quoted 5 lines · Philippe Mathieu-Daudé
When realizing a Super I/O with IDE controller [*], we get:
qom/object.c:1684:object_property_try_add_child: Assertion `!child->parent' failed. Aborted (core dumped)
Quoted 8 lines
Quoted 5 lines
This is because the device is already realized when we try to add the QOM property to the parent. Fix by realizing *after* adding the QOM relationship.
[*] Set
ISASuperIOClass::ide.count= N with N not zeroIs this a latent bug, or can it bite in master? If the latter, can you show how to reproduce?
Latent bug for master:
$ git grep ide.count
hw/isa/isa-superio.c:149: if (k->ide.count && (!k->ide.is_enabled ||
k->ide.is_enabled(sio, 0))) {
hw/isa/isa-superio.c:197: sc->ide.count = 0;
hw/isa/smc37c669-superio.c:100: sc->ide.count = 0;
hw/isa/vt82c686.c:529: sc->ide.count = 0;I hit it rebasing undergoing series for 5.2 and testing them.
Quoted 23 lines
Quoted 21 lines
Fixes e508430619 ("hw/isa/superio: Make the components QOM children")Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/isa/isa-superio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/isa/isa-superio.c +1
-1@@ -158,8 +158,8 @@ static void isa_superio_realize(DeviceState *dev, Error **errp)if (k->ide.get_irq) {qdev_prop_set_uint32 (d,"irq" , k->ide.get_irq (sio,0 )); } -isa_realize_and_unref (isa, bus, &error_fatal);object_property_add_child (OBJECT (sio),"isa-ide" ,OBJECT (isa)); +isa_realize_and_unref (isa, bus, &error_fatal); sio->ide = isa; trace_superio_create_ide(0, k->ide.get_iobase ?
Markus Armbruster
Reviewed-byQuoted 19 lines · Philippe Mathieu-Daudé
Quoted 7 lines · Markus Armbruster
Quoted 5 lines · Philippe Mathieu-Daudé
When realizing a Super I/O with IDE controller [*], we get:
qom/object.c:1684:object_property_try_add_child: Assertion `!child->parent' failed. Aborted (core dumped)Quoted 8 lines
Quoted 5 lines
This is because the device is already realized when we try to add the QOM property to the parent. Fix by realizing *after* adding the QOM relationship.
[*] Set
ISASuperIOClass::ide.count= N with N not zeroIs this a latent bug, or can it bite in master? If the latter, can you show how to reproduce?
Latent bug for master:
Quoted 8 lines
$ git grep ide.count hw/isa/isa-superio.c:149: if (k->ide.count && (!k->ide.is_enabled || k->ide.is_enabled(sio, 0))) { hw/isa/isa-superio.c:197: sc->ide.count = 0; hw/isa/smc37c669-superio.c:100: sc->ide.count = 0; hw/isa/vt82c686.c:529: sc->ide.count = 0;I hit it rebasing undergoing series for 5.2 and testing them.
Let's tweak the commit message like this
[*] Set ISASuperIOClass::ide.count = N with N not zero (no such thing currently exists; the bug is latent)
Preferably with that or something like it:
Quoted 30 lines · Markus Armbruster
Quoted 19 lines · Philippe Mathieu-Daudé
Quoted 7 lines · Markus Armbruster
Quoted 5 lines · Philippe Mathieu-Daudé
When realizing a Super I/O with IDE controller [*], we get:
qom/object.c:1684:object_property_try_add_child: Assertion `!child->parent' failed. Aborted (core dumped)Quoted 8 lines
Quoted 5 lines
This is because the device is already realized when we try to add the QOM property to the parent. Fix by realizing *after* adding the QOM relationship.
[*] Set
ISASuperIOClass::ide.count= N with N not zeroIs this a latent bug, or can it bite in master? If the latter, can you show how to reproduce?
Latent bug for master:
Quoted 8 lines
$ git grep ide.count hw/isa/isa-superio.c:149: if (k->ide.count && (!k->ide.is_enabled || k->ide.is_enabled(sio, 0))) { hw/isa/isa-superio.c:197: sc->ide.count = 0; hw/isa/smc37c669-superio.c:100: sc->ide.count = 0; hw/isa/vt82c686.c:529: sc->ide.count = 0;I hit it rebasing undergoing series for 5.2 and testing them.
Quoted 7 lines
Let's tweak the commit message like this
[*] Set
ISASuperIOClass::ide.count= N with N not zero (no such thing currently exists; the bug is latent)Preferably with that or something like it:
Reviewed-by Markus Armbruster <[email protected]>
OK. I still consider it worthwhile fixing for 5.1, as while it doesn't bite master, forks might be affected, since the bug is in master.