aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2018-06-13 12:08:42 +1000
committerDavid Gibson <david@gibson.dropbear.id.au>2018-06-16 16:32:33 +1000
commit5e22e29201d80124bca0124f2034e72b698cbb6f (patch)
tree4ce5249ec62e91be777ab36b59c54960b5ec5fa7
parent3a24752112a046a5f9745b6b72e16646b4b0bcfd (diff)
downloadqemu-5e22e29201d80124bca0124f2034e72b698cbb6f.zip
qemu-5e22e29201d80124bca0124f2034e72b698cbb6f.tar.gz
qemu-5e22e29201d80124bca0124f2034e72b698cbb6f.tar.bz2
pnv: Add cpu unrealize path
Currently we don't have any unrealize path for pnv cpu cores. We get away with this because we don't yet support cpu hotplug for pnv. However, we're going to want it eventually, and in the meantime, it makes it non-obvious why there are a bunch of allocations on the realize() path that don't have matching frees. So, implement the missing unrealize path. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Cédric Le Goater <clg@kaod.org> Reviewed-by: Greg Kurz <groug@kaod.org>
-rw-r--r--hw/ppc/pnv_core.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/hw/ppc/pnv_core.c b/hw/ppc/pnv_core.c
index f4c41d8..f7cf33f 100644
--- a/hw/ppc/pnv_core.c
+++ b/hw/ppc/pnv_core.c
@@ -186,6 +186,26 @@ err:
error_propagate(errp, local_err);
}
+static void pnv_unrealize_vcpu(PowerPCCPU *cpu)
+{
+ qemu_unregister_reset(pnv_cpu_reset, cpu);
+ object_unparent(cpu->intc);
+ cpu_remove_sync(CPU(cpu));
+ object_unparent(OBJECT(cpu));
+}
+
+static void pnv_core_unrealize(DeviceState *dev, Error **errp)
+{
+ PnvCore *pc = PNV_CORE(dev);
+ CPUCore *cc = CPU_CORE(dev);
+ int i;
+
+ for (i = 0; i < cc->nr_threads; i++) {
+ pnv_unrealize_vcpu(pc->threads[i]);
+ }
+ g_free(pc->threads);
+}
+
static Property pnv_core_properties[] = {
DEFINE_PROP_UINT32("pir", PnvCore, pir, 0),
DEFINE_PROP_END_OF_LIST(),
@@ -196,6 +216,7 @@ static void pnv_core_class_init(ObjectClass *oc, void *data)
DeviceClass *dc = DEVICE_CLASS(oc);
dc->realize = pnv_core_realize;
+ dc->unrealize = pnv_core_unrealize;
dc->props = pnv_core_properties;
}