Message ID | 154774529254.1208625.8569916891242988294.stgit@bahia.lan |
---|---|
State | New |
Headers | show |
Series | spapr: Add support for PHB hotplug | expand |
On 1/17/19 6:14 PM, Greg Kurz wrote: > PHB hotplug will need to set the type of all LSIs at machine init. > Prepare for that by calling xive_source_irq_set() in the callers > of spapr_xive_irq_claim(). > > Signed-off-by: Greg Kurz <groug@kaod.org> Reviewed-by: Cédric Le Goater <clg@kaod.org> Thanks, C. > --- > hw/intc/spapr_xive.c | 5 +---- > hw/ppc/spapr_irq.c | 6 ++++-- > include/hw/ppc/spapr_xive.h | 2 +- > 3 files changed, 6 insertions(+), 7 deletions(-) > > diff --git a/hw/intc/spapr_xive.c b/hw/intc/spapr_xive.c > index d391177ab81f..aab63cfd1178 100644 > --- a/hw/intc/spapr_xive.c > +++ b/hw/intc/spapr_xive.c > @@ -471,16 +471,13 @@ static void spapr_xive_register_types(void) > > type_init(spapr_xive_register_types) > > -bool spapr_xive_irq_claim(sPAPRXive *xive, uint32_t lisn, bool lsi) > +bool spapr_xive_irq_claim(sPAPRXive *xive, uint32_t lisn) > { > - XiveSource *xsrc = &xive->source; > - > if (lisn >= xive->nr_irqs) { > return false; > } > > xive->eat[lisn].w |= cpu_to_be64(EAS_VALID); > - xive_source_irq_set(xsrc, lisn, lsi); > return true; > } > > diff --git a/hw/ppc/spapr_irq.c b/hw/ppc/spapr_irq.c > index 86c712d15382..bcd816c5a5fb 100644 > --- a/hw/ppc/spapr_irq.c > +++ b/hw/ppc/spapr_irq.c > @@ -285,7 +285,8 @@ static void spapr_irq_init_xive(sPAPRMachineState *spapr, Error **errp) > > /* Enable the CPU IPIs */ > for (i = 0; i < nr_servers; ++i) { > - spapr_xive_irq_claim(spapr->xive, SPAPR_IRQ_IPI + i, false); > + spapr_xive_irq_claim(spapr->xive, SPAPR_IRQ_IPI + i); > + xive_source_irq_set(&spapr->xive->source, SPAPR_IRQ_IPI + i, false); > } > > spapr_xive_hcall_init(spapr); > @@ -294,10 +295,11 @@ static void spapr_irq_init_xive(sPAPRMachineState *spapr, Error **errp) > static int spapr_irq_claim_xive(sPAPRMachineState *spapr, int irq, bool lsi, > Error **errp) > { > - if (!spapr_xive_irq_claim(spapr->xive, irq, lsi)) { > + if (!spapr_xive_irq_claim(spapr->xive, irq)) { > error_setg(errp, "IRQ %d is invalid", irq); > return -1; > } > + xive_source_irq_set(&spapr->xive->source, irq, lsi); > return 0; > } > > diff --git a/include/hw/ppc/spapr_xive.h b/include/hw/ppc/spapr_xive.h > index 7fdc25057420..f8854a4a6a18 100644 > --- a/include/hw/ppc/spapr_xive.h > +++ b/include/hw/ppc/spapr_xive.h > @@ -37,7 +37,7 @@ typedef struct sPAPRXive { > MemoryRegion tm_mmio; > } sPAPRXive; > > -bool spapr_xive_irq_claim(sPAPRXive *xive, uint32_t lisn, bool lsi); > +bool spapr_xive_irq_claim(sPAPRXive *xive, uint32_t lisn); > bool spapr_xive_irq_free(sPAPRXive *xive, uint32_t lisn); > void spapr_xive_pic_print_info(sPAPRXive *xive, Monitor *mon); > >
diff --git a/hw/intc/spapr_xive.c b/hw/intc/spapr_xive.c index d391177ab81f..aab63cfd1178 100644 --- a/hw/intc/spapr_xive.c +++ b/hw/intc/spapr_xive.c @@ -471,16 +471,13 @@ static void spapr_xive_register_types(void) type_init(spapr_xive_register_types) -bool spapr_xive_irq_claim(sPAPRXive *xive, uint32_t lisn, bool lsi) +bool spapr_xive_irq_claim(sPAPRXive *xive, uint32_t lisn) { - XiveSource *xsrc = &xive->source; - if (lisn >= xive->nr_irqs) { return false; } xive->eat[lisn].w |= cpu_to_be64(EAS_VALID); - xive_source_irq_set(xsrc, lisn, lsi); return true; } diff --git a/hw/ppc/spapr_irq.c b/hw/ppc/spapr_irq.c index 86c712d15382..bcd816c5a5fb 100644 --- a/hw/ppc/spapr_irq.c +++ b/hw/ppc/spapr_irq.c @@ -285,7 +285,8 @@ static void spapr_irq_init_xive(sPAPRMachineState *spapr, Error **errp) /* Enable the CPU IPIs */ for (i = 0; i < nr_servers; ++i) { - spapr_xive_irq_claim(spapr->xive, SPAPR_IRQ_IPI + i, false); + spapr_xive_irq_claim(spapr->xive, SPAPR_IRQ_IPI + i); + xive_source_irq_set(&spapr->xive->source, SPAPR_IRQ_IPI + i, false); } spapr_xive_hcall_init(spapr); @@ -294,10 +295,11 @@ static void spapr_irq_init_xive(sPAPRMachineState *spapr, Error **errp) static int spapr_irq_claim_xive(sPAPRMachineState *spapr, int irq, bool lsi, Error **errp) { - if (!spapr_xive_irq_claim(spapr->xive, irq, lsi)) { + if (!spapr_xive_irq_claim(spapr->xive, irq)) { error_setg(errp, "IRQ %d is invalid", irq); return -1; } + xive_source_irq_set(&spapr->xive->source, irq, lsi); return 0; } diff --git a/include/hw/ppc/spapr_xive.h b/include/hw/ppc/spapr_xive.h index 7fdc25057420..f8854a4a6a18 100644 --- a/include/hw/ppc/spapr_xive.h +++ b/include/hw/ppc/spapr_xive.h @@ -37,7 +37,7 @@ typedef struct sPAPRXive { MemoryRegion tm_mmio; } sPAPRXive; -bool spapr_xive_irq_claim(sPAPRXive *xive, uint32_t lisn, bool lsi); +bool spapr_xive_irq_claim(sPAPRXive *xive, uint32_t lisn); bool spapr_xive_irq_free(sPAPRXive *xive, uint32_t lisn); void spapr_xive_pic_print_info(sPAPRXive *xive, Monitor *mon);
PHB hotplug will need to set the type of all LSIs at machine init. Prepare for that by calling xive_source_irq_set() in the callers of spapr_xive_irq_claim(). Signed-off-by: Greg Kurz <groug@kaod.org> --- hw/intc/spapr_xive.c | 5 +---- hw/ppc/spapr_irq.c | 6 ++++-- include/hw/ppc/spapr_xive.h | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-)