mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 09:13:55 -06:00
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>
This commit is contained in:
parent
100f738850
commit
9ed656631d
4 changed files with 53 additions and 71 deletions
|
@ -53,9 +53,6 @@ static void spapr_cpu_reset(void *opaque)
|
|||
|
||||
static void spapr_cpu_destroy(PowerPCCPU *cpu)
|
||||
{
|
||||
sPAPRMachineState *spapr = SPAPR_MACHINE(qdev_get_machine());
|
||||
|
||||
xics_cpu_destroy(XICS_FABRIC(spapr), cpu);
|
||||
qemu_unregister_reset(spapr_cpu_reset, cpu);
|
||||
}
|
||||
|
||||
|
@ -140,17 +137,7 @@ static void spapr_cpu_core_realize_child(Object *child, Error **errp)
|
|||
sPAPRMachineState *spapr = SPAPR_MACHINE(qdev_get_machine());
|
||||
CPUState *cs = CPU(child);
|
||||
PowerPCCPU *cpu = POWERPC_CPU(cs);
|
||||
Object *obj;
|
||||
|
||||
obj = object_new(spapr->icp_type);
|
||||
object_property_add_child(OBJECT(cpu), "icp", obj, &error_abort);
|
||||
object_unref(obj);
|
||||
object_property_add_const_link(obj, ICP_PROP_XICS, OBJECT(spapr),
|
||||
&error_abort);
|
||||
object_property_set_bool(obj, true, "realized", &local_err);
|
||||
if (local_err) {
|
||||
goto error;
|
||||
}
|
||||
Object *obj = NULL;
|
||||
|
||||
object_property_set_bool(child, true, "realized", &local_err);
|
||||
if (local_err) {
|
||||
|
@ -162,7 +149,17 @@ static void spapr_cpu_core_realize_child(Object *child, Error **errp)
|
|||
goto error;
|
||||
}
|
||||
|
||||
xics_cpu_setup(XICS_FABRIC(spapr), cpu, ICP(obj));
|
||||
obj = object_new(spapr->icp_type);
|
||||
object_property_add_child(child, "icp", obj, &error_abort);
|
||||
object_unref(obj);
|
||||
object_property_add_const_link(obj, ICP_PROP_XICS, OBJECT(spapr),
|
||||
&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) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
error:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue