ppc/pnv: introduce a CPU machine_data
Include the interrupt presenter under the machine_data as we plan to remove it from under PowerPCCPU Signed-off-by: Cédric Le Goater <clg@kaod.org> Reviewed-by: Greg Kurz <groug@kaod.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
40a5056c41
commit
8907fc25cf
@ -673,6 +673,7 @@ static void pnv_chip_power8_intc_create(PnvChip *chip, PowerPCCPU *cpu,
|
||||
{
|
||||
Error *local_err = NULL;
|
||||
Object *obj;
|
||||
PnvCPUState *pnv_cpu = pnv_cpu_state(cpu);
|
||||
|
||||
obj = icp_create(OBJECT(cpu), TYPE_PNV_ICP, XICS_FABRIC(qdev_get_machine()),
|
||||
&local_err);
|
||||
@ -681,7 +682,7 @@ static void pnv_chip_power8_intc_create(PnvChip *chip, PowerPCCPU *cpu,
|
||||
return;
|
||||
}
|
||||
|
||||
cpu->icp = ICP(obj);
|
||||
pnv_cpu->icp = ICP(obj);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1099,7 +1100,7 @@ static ICPState *pnv_icp_get(XICSFabric *xi, int pir)
|
||||
{
|
||||
PowerPCCPU *cpu = ppc_get_vcpu_by_pir(pir);
|
||||
|
||||
return cpu ? cpu->icp : NULL;
|
||||
return cpu ? pnv_cpu_state(cpu)->icp : NULL;
|
||||
}
|
||||
|
||||
static void pnv_pic_print_info(InterruptStatsProvider *obj,
|
||||
@ -1112,7 +1113,7 @@ static void pnv_pic_print_info(InterruptStatsProvider *obj,
|
||||
CPU_FOREACH(cs) {
|
||||
PowerPCCPU *cpu = POWERPC_CPU(cs);
|
||||
|
||||
icp_pic_print_info(cpu->icp, mon);
|
||||
icp_pic_print_info(pnv_cpu_state(cpu)->icp, mon);
|
||||
}
|
||||
|
||||
for (i = 0; i < pnv->num_chips; i++) {
|
||||
|
@ -155,7 +155,10 @@ static void pnv_core_realize(DeviceState *dev, Error **errp)
|
||||
|
||||
pc->threads = g_new(PowerPCCPU *, cc->nr_threads);
|
||||
for (i = 0; i < cc->nr_threads; i++) {
|
||||
PowerPCCPU *cpu;
|
||||
|
||||
obj = object_new(typename);
|
||||
cpu = POWERPC_CPU(obj);
|
||||
|
||||
pc->threads[i] = POWERPC_CPU(obj);
|
||||
|
||||
@ -163,6 +166,9 @@ static void pnv_core_realize(DeviceState *dev, Error **errp)
|
||||
object_property_add_child(OBJECT(pc), name, obj, &error_abort);
|
||||
object_property_add_alias(obj, "core-pir", OBJECT(pc),
|
||||
"pir", &error_abort);
|
||||
|
||||
cpu->machine_data = g_new0(PnvCPUState, 1);
|
||||
|
||||
object_unref(obj);
|
||||
}
|
||||
|
||||
@ -189,9 +195,13 @@ err:
|
||||
|
||||
static void pnv_unrealize_vcpu(PowerPCCPU *cpu)
|
||||
{
|
||||
PnvCPUState *pnv_cpu = pnv_cpu_state(cpu);
|
||||
|
||||
qemu_unregister_reset(pnv_cpu_reset, cpu);
|
||||
object_unparent(OBJECT(cpu->icp));
|
||||
object_unparent(OBJECT(pnv_cpu_state(cpu)->icp));
|
||||
cpu_remove_sync(CPU(cpu));
|
||||
cpu->machine_data = NULL;
|
||||
g_free(pnv_cpu);
|
||||
object_unparent(OBJECT(cpu));
|
||||
}
|
||||
|
||||
|
@ -47,4 +47,13 @@ typedef struct PnvCoreClass {
|
||||
#define PNV_CORE_TYPE_SUFFIX "-" TYPE_PNV_CORE
|
||||
#define PNV_CORE_TYPE_NAME(cpu_model) cpu_model PNV_CORE_TYPE_SUFFIX
|
||||
|
||||
typedef struct PnvCPUState {
|
||||
struct ICPState *icp;
|
||||
} PnvCPUState;
|
||||
|
||||
static inline PnvCPUState *pnv_cpu_state(PowerPCCPU *cpu)
|
||||
{
|
||||
return (PnvCPUState *)cpu->machine_data;
|
||||
}
|
||||
|
||||
#endif /* _PPC_PNV_CORE_H */
|
||||
|
Loading…
Reference in New Issue
Block a user