aboutsummaryrefslogtreecommitdiff
path: root/hw/ppc/pnv_core.c
diff options
context:
space:
mode:
authorGreg Kurz <groug@kaod.org>2017-06-08 15:42:59 +0200
committerDavid Gibson <david@gibson.dropbear.id.au>2017-06-09 12:15:57 +1000
commit9ed656631d73a7564dfe178ca8c48bf049098aaf (patch)
tree8b0121c4ade2d731e07e873ed64a6ea9ef80e4c2 /hw/ppc/pnv_core.c
parent100f738850639a108d6767316ce4dcc1d1ea4ae4 (diff)
downloadqemu-9ed656631d73a7564dfe178ca8c48bf049098aaf.zip
qemu-9ed656631d73a7564dfe178ca8c48bf049098aaf.tar.gz
qemu-9ed656631d73a7564dfe178ca8c48bf049098aaf.tar.bz2
xics: setup cpu at realize time
Until recently, spapr used to allocate ICPState objects for the lifetime of the machine. They would only be associated to vCPUs in xics_cpu_setup() when plugging a CPU core. Now that ICPState objects have the same lifecycle as vCPUs, it is possible to associate them during realization. This patch hence open-codes xics_cpu_setup() in icp_realize(). The vCPU is passed as a property. Note that vCPU now needs to be realized first for the IRQs to be allocated. It also needs to resetted before ICPState realization in order to synchronize with KVM. Since ICPState objects are freed when unrealized, xics_cpu_destroy() isn't needed anymore and can be safely dropped. Signed-off-by: Greg Kurz <groug@kaod.org> Reviewed-by: Cédric Le Goater <clg@kaod.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'hw/ppc/pnv_core.c')
-rw-r--r--hw/ppc/pnv_core.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/hw/ppc/pnv_core.c b/hw/ppc/pnv_core.c
index 0b6e729..c7b00b6 100644
--- a/hw/ppc/pnv_core.c
+++ b/hw/ppc/pnv_core.c
@@ -118,20 +118,20 @@ static void pnv_core_realize_child(Object *child, XICSFabric *xi, Error **errp)
PowerPCCPU *cpu = POWERPC_CPU(cs);
Object *obj;
- obj = object_new(TYPE_PNV_ICP);
- object_property_add_child(OBJECT(cpu), "icp", obj, &error_abort);
- object_unref(obj);
- object_property_add_const_link(obj, ICP_PROP_XICS, OBJECT(xi),
- &error_abort);
- object_property_set_bool(obj, true, "realized", &local_err);
+ object_property_set_bool(child, true, "realized", &local_err);
if (local_err) {
error_propagate(errp, local_err);
return;
}
- object_property_set_bool(child, true, "realized", &local_err);
+ obj = object_new(TYPE_PNV_ICP);
+ object_property_add_child(child, "icp", obj, NULL);
+ object_unref(obj);
+ object_property_add_const_link(obj, ICP_PROP_XICS, OBJECT(xi),
+ &error_abort);
+ object_property_add_const_link(obj, ICP_PROP_CPU, child, &error_abort);
+ object_property_set_bool(obj, true, "realized", &local_err);
if (local_err) {
- object_unparent(obj);
error_propagate(errp, local_err);
return;
}
@@ -142,8 +142,6 @@ static void pnv_core_realize_child(Object *child, XICSFabric *xi, Error **errp)
error_propagate(errp, local_err);
return;
}
-
- xics_cpu_setup(xi, cpu, ICP(obj));
}
static void pnv_core_realize(DeviceState *dev, Error **errp)