On Thu, 23 Nov 2017 14:29:32 +0100 Cédric Le Goater <c...@kaod.org> wrote:
> The 'intc' pointer of the CPU references the interrupt presenter in > the XICS interrupt mode. When the XIVE interrupt mode is available and > activated, the machine will need to reassign this pointer to reflect > the change. > > Moving this assignment under the realize routine of the CPU will ease > the process when the interrupt mode is toggled. > No surprise since this was violating CPU internals actually :) > Signed-off-by: Cédric Le Goater <c...@kaod.org> > --- Reviewed-by: Greg Kurz <gr...@kaod.org> > hw/intc/xics.c | 1 - > hw/ppc/pnv_core.c | 2 +- > hw/ppc/spapr_cpu_core.c | 2 +- > 3 files changed, 2 insertions(+), 3 deletions(-) > > diff --git a/hw/intc/xics.c b/hw/intc/xics.c > index e4ccdff8f577..0f2e7273bc8f 100644 > --- a/hw/intc/xics.c > +++ b/hw/intc/xics.c > @@ -334,7 +334,6 @@ static void icp_realize(DeviceState *dev, Error **errp) > } > > cpu = POWERPC_CPU(obj); > - cpu->intc = OBJECT(icp); > icp->cs = CPU(obj); > > env = &cpu->env; > diff --git a/hw/ppc/pnv_core.c b/hw/ppc/pnv_core.c > index a066736846f8..90acaac45889 100644 > --- a/hw/ppc/pnv_core.c > +++ b/hw/ppc/pnv_core.c > @@ -133,7 +133,7 @@ static void pnv_core_realize_child(Object *child, > XICSFabric *xi, Error **errp) > return; > } > > - icp_create(cs, TYPE_PNV_ICP, xi, &local_err); > + cpu->intc = icp_create(cs, TYPE_PNV_ICP, xi, &local_err); > if (local_err) { > error_propagate(errp, local_err); > return; > diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c > index f8a520a2fa2d..f7cc74512481 100644 > --- a/hw/ppc/spapr_cpu_core.c > +++ b/hw/ppc/spapr_cpu_core.c > @@ -122,7 +122,7 @@ static void spapr_cpu_core_realize_child(Object *child, > goto error; > } > > - icp_create(cs, spapr->icp_type, XICS_FABRIC(spapr), &local_err); > + cpu->intc = icp_create(cs, spapr->icp_type, XICS_FABRIC(spapr), > &local_err); > if (local_err) { > goto error; > }