aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorGreg Kurz <groug@kaod.org>2017-07-25 19:59:44 +0200
committerDavid Gibson <david@gibson.dropbear.id.au>2017-09-08 09:30:54 +1000
commit379ae096f7ee7c8ae15886eeb4361008ac6ba1c4 (patch)
tree1d03bec3d85b8c732eb2abef02cabcdffa30caa0 /hw
parentdba95ebbf88a8b8f10f4691946b4406e4acc4f0f (diff)
downloadqemu-379ae096f7ee7c8ae15886eeb4361008ac6ba1c4.zip
qemu-379ae096f7ee7c8ae15886eeb4361008ac6ba1c4.tar.gz
qemu-379ae096f7ee7c8ae15886eeb4361008ac6ba1c4.tar.bz2
spapr_drc: add unrealize method to physical DRC class
When hot-unplugging a PHB, all its PCI DRC connectors get unrealized. This patch adds an unrealize method to the physical DRC class, in order to undo registrations performed in realize_physical(). Signed-off-by: Greg Kurz <groug@kaod.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'hw')
-rw-r--r--hw/ppc/spapr_drc.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c
index 644a6ff..b10f849 100644
--- a/hw/ppc/spapr_drc.c
+++ b/hw/ppc/spapr_drc.c
@@ -630,12 +630,28 @@ static void realize_physical(DeviceState *d, Error **errp)
qemu_register_reset(drc_physical_reset, drcp);
}
+static void unrealize_physical(DeviceState *d, Error **errp)
+{
+ sPAPRDRCPhysical *drcp = SPAPR_DRC_PHYSICAL(d);
+ Error *local_err = NULL;
+
+ unrealize(d, &local_err);
+ if (local_err) {
+ error_propagate(errp, local_err);
+ return;
+ }
+
+ vmstate_unregister(DEVICE(drcp), &vmstate_spapr_drc_physical, drcp);
+ qemu_unregister_reset(drc_physical_reset, drcp);
+}
+
static void spapr_drc_physical_class_init(ObjectClass *k, void *data)
{
DeviceClass *dk = DEVICE_CLASS(k);
sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_CLASS(k);
dk->realize = realize_physical;
+ dk->unrealize = unrealize_physical;
drck->dr_entity_sense = physical_entity_sense;
drck->isolate = drc_isolate_physical;
drck->unisolate = drc_unisolate_physical;