mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 17:53:56 -06:00
spapr, xics, xive: Move cpu_intc_create from SpaprIrq to SpaprInterruptController
This method essentially represents code which belongs to the interrupt controller, but needs to be called on all possible intcs, rather than just the currently active one. The "dual" version therefore calls into the xics and xive versions confusingly. Handle this more directly, by making it instead a method on the intc backend, and always calling it on every backend that exists. While we're there, streamline the error reporting a bit. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Greg Kurz <groug@kaod.org> Reviewed-by: Cédric Le Goater <clg@kaod.org>
This commit is contained in:
parent
150e25f85b
commit
ebd6be089b
5 changed files with 79 additions and 61 deletions
|
@ -330,13 +330,31 @@ void spapr_dt_xics(SpaprMachineState *spapr, uint32_t nr_servers, void *fdt,
|
|||
_FDT(fdt_setprop_cell(fdt, node, "phandle", phandle));
|
||||
}
|
||||
|
||||
static int xics_spapr_cpu_intc_create(SpaprInterruptController *intc,
|
||||
PowerPCCPU *cpu, Error **errp)
|
||||
{
|
||||
ICSState *ics = ICS_SPAPR(intc);
|
||||
Object *obj;
|
||||
SpaprCpuState *spapr_cpu = spapr_cpu_state(cpu);
|
||||
|
||||
obj = icp_create(OBJECT(cpu), TYPE_ICP, ics->xics, errp);
|
||||
if (!obj) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
spapr_cpu->icp = ICP(obj);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void ics_spapr_class_init(ObjectClass *klass, void *data)
|
||||
{
|
||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||
ICSStateClass *isc = ICS_CLASS(klass);
|
||||
SpaprInterruptControllerClass *sicc = SPAPR_INTC_CLASS(klass);
|
||||
|
||||
device_class_set_parent_realize(dc, ics_spapr_realize,
|
||||
&isc->parent_realize);
|
||||
sicc->cpu_intc_create = xics_spapr_cpu_intc_create;
|
||||
}
|
||||
|
||||
static const TypeInfo ics_spapr_info = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue