Skip to contentSkip to conversation

spapr_rng: disable hotpluggability

PATCH In review Greg Kurz 3 participants 3 messages Feb 25, 2016

lore
Share & tools
lore

Greg Kurz

author
#0 lore raw

PATCH 1/1 spapr_rng: disable hotpluggability

It is currently possible to hotplug a spapr_rng device but QEMU crashes when we try to hot unplug:

ERROR:hw/core/qdev.c:295:qdev_unplug: assertion failed: (hotplug_ctrl) Aborted

This happens because spapr_rng isn't plugged to any bus and sPAPR does not provide hotplug support for it: qdev_get_hotplug_handler() hence return NULL and we hit the assertion.

And anyway, it doesn't make much sense to unplug this device since hcalls cannot be unregistered. Even the idea of hotplugging a RNG device instead of declaring it on the QEMU command line looks weird.

This patch simply disables hotpluggability for the spapr-rng class.

---
 hw/ppc/spapr_rng.c |    1 +
 1 file changed, 1 insertion(+)
hw/ppc/spapr_rng.c +1 -0
index 8484fcf54774..a39d472b66fd 100644
@@ -170,6 +170,7 @@ static void spapr_rng_class_init(ObjectClass *oc, void *data)
     dc->realize = spapr_rng_realize;
     set_bit(DEVICE_CATEGORY_MISC, dc->categories);
     dc->props = spapr_rng_properties;
+    dc->hotpluggable = false;
 }
 
 static const TypeInfo spapr_rng_info = {
Reviewed-by on v1 1/1
#1 lore raw
Quoted 26 lines · Greg Kurz

It is currently possible to hotplug a spapr_rng device but QEMU crashes when we try to hot unplug:

ERROR:hw/core/qdev.c:295:qdev_unplug: assertion failed: (hotplug_ctrl) Aborted

This happens because spapr_rng isn't plugged to any bus and sPAPR does not provide hotplug support for it: qdev_get_hotplug_handler() hence return NULL and we hit the assertion.

And anyway, it doesn't make much sense to unplug this device since hcalls cannot be unregistered. Even the idea of hotplugging a RNG device instead of declaring it on the QEMU command line looks weird.

This patch simply disables hotpluggability for the spapr-rng class.

---
 hw/ppc/spapr_rng.c |    1 +
 1 file changed, 1 insertion(+)
hw/ppc/spapr_rng.c +0 -0
index 8484fcf54774..a39d472b66fd 100644

hw/ppc/spapr_rng.c static void spapr_rng_class_init(ObjectClass *oc, void *data) · line 174

Quoted 5 lines
hw/ppc/spapr_rng.c +1 -0
@@ -170,6 +170,7 @@ static void spapr_rng_class_init(ObjectClass *oc, void *data)
     dc->realize = spapr_rng_realize;
     set_bit(DEVICE_CATEGORY_MISC, dc->categories);
     dc->props = spapr_rng_properties;
+    dc->hotpluggable = false;
 }

That makes sense!

#2 lore raw
Quoted 35 lines · Thomas Huth
Quoted 26 lines · Greg Kurz

It is currently possible to hotplug a spapr_rng device but QEMU crashes when we try to hot unplug:

ERROR:hw/core/qdev.c:295:qdev_unplug: assertion failed: (hotplug_ctrl) Aborted

This happens because spapr_rng isn't plugged to any bus and sPAPR does not provide hotplug support for it: qdev_get_hotplug_handler() hence return NULL and we hit the assertion.

And anyway, it doesn't make much sense to unplug this device since hcalls cannot be unregistered. Even the idea of hotplugging a RNG device instead of declaring it on the QEMU command line looks weird.

This patch simply disables hotpluggability for the spapr-rng class.

---
 hw/ppc/spapr_rng.c |    1 +
 1 file changed, 1 insertion(+)
hw/ppc/spapr_rng.c +0 -0
index 8484fcf54774..a39d472b66fd 100644

hw/ppc/spapr_rng.c static void spapr_rng_class_init(ObjectClass *oc, void *data) · line 174

Quoted 5 lines
hw/ppc/spapr_rng.c +1 -0
@@ -170,6 +170,7 @@ static void spapr_rng_class_init(ObjectClass *oc, void *data)
     dc->realize = spapr_rng_realize;
     set_bit(DEVICE_CATEGORY_MISC, dc->categories);
     dc->props = spapr_rng_properties;
+    dc->hotpluggable = false;
 }

That makes sense!

Quoted 1 line

Indeed. Merged to ppc-for-2.6, thanks.

Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson