Commit cf435df6 authored by Cédric Le Goater's avatar Cédric Le Goater Committed by David Gibson
Browse files

spapr/irq: initialize the IRQ device only once



Add a check to make sure that the routine initializing the emulated
IRQ device is called once. We don't have much to test on the XICS
side, so we introduce a 'init' boolean under ICSState.

Signed-off-by: default avatarCédric Le Goater <clg@kaod.org>
Message-Id: <20190513084245.25755-13-clg@kaod.org>
Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
parent ae805ea9
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -338,6 +338,15 @@ void spapr_xive_init(SpaprXive *xive, Error **errp)
    XiveSource *xsrc = &xive->source;
    XiveENDSource *end_xsrc = &xive->end_source;

    /*
     * The emulated XIVE device can only be initialized once. If the
     * ESB memory region has been already mapped, it means we have been
     * through there.
     */
    if (memory_region_is_mapped(&xsrc->esb_mmio)) {
        return;
    }

    /* TIMA initialization */
    memory_region_init_io(&xive->tm_mmio, OBJECT(xive), &xive_tm_ops, xive,
                          "xive.tima", 4ull << TM_SHIFT);
+7 −0
Original line number Diff line number Diff line
@@ -239,6 +239,13 @@ static void rtas_int_on(PowerPCCPU *cpu, SpaprMachineState *spapr,

void xics_spapr_init(SpaprMachineState *spapr)
{
    /* Emulated mode can only be initialized once. */
    if (spapr->ics->init) {
        return;
    }

    spapr->ics->init = true;

    /* Registration of global state belongs into realize */
    spapr_rtas_register(RTAS_IBM_SET_XIVE, "ibm,set-xive", rtas_set_xive);
    spapr_rtas_register(RTAS_IBM_GET_XIVE, "ibm,get-xive", rtas_get_xive);
+1 −0
Original line number Diff line number Diff line
@@ -119,6 +119,7 @@ struct ICSState {
    uint32_t offset;
    ICSIRQState *irqs;
    XICSFabric *xics;
    bool init; /* sPAPR ICS device initialized */
};

#define ICS_PROP_XICS "xics"