mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 09:13:55 -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
|
@ -495,10 +495,33 @@ static Property spapr_xive_properties[] = {
|
|||
DEFINE_PROP_END_OF_LIST(),
|
||||
};
|
||||
|
||||
static int spapr_xive_cpu_intc_create(SpaprInterruptController *intc,
|
||||
PowerPCCPU *cpu, Error **errp)
|
||||
{
|
||||
SpaprXive *xive = SPAPR_XIVE(intc);
|
||||
Object *obj;
|
||||
SpaprCpuState *spapr_cpu = spapr_cpu_state(cpu);
|
||||
|
||||
obj = xive_tctx_create(OBJECT(cpu), XIVE_ROUTER(xive), errp);
|
||||
if (!obj) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
spapr_cpu->tctx = XIVE_TCTX(obj);
|
||||
|
||||
/*
|
||||
* (TCG) Early setting the OS CAM line for hotplugged CPUs as they
|
||||
* don't beneficiate from the reset of the XIVE IRQ backend
|
||||
*/
|
||||
spapr_xive_set_tctx_os_cam(spapr_cpu->tctx);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void spapr_xive_class_init(ObjectClass *klass, void *data)
|
||||
{
|
||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||
XiveRouterClass *xrc = XIVE_ROUTER_CLASS(klass);
|
||||
SpaprInterruptControllerClass *sicc = SPAPR_INTC_CLASS(klass);
|
||||
|
||||
dc->desc = "sPAPR XIVE Interrupt Controller";
|
||||
dc->props = spapr_xive_properties;
|
||||
|
@ -511,6 +534,8 @@ static void spapr_xive_class_init(ObjectClass *klass, void *data)
|
|||
xrc->get_nvt = spapr_xive_get_nvt;
|
||||
xrc->write_nvt = spapr_xive_write_nvt;
|
||||
xrc->get_tctx = spapr_xive_get_tctx;
|
||||
|
||||
sicc->cpu_intc_create = spapr_xive_cpu_intc_create;
|
||||
}
|
||||
|
||||
static const TypeInfo spapr_xive_info = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue