spapr: introduce a spapr_irq_init() routine

Initialize the MSI bitmap from it as this will be necessary for the
sPAPR IRQ backend for XIVE.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
Cédric Le Goater 2018-12-06 00:22:27 +01:00 committed by David Gibson
parent 482969d680
commit fab397d84a
3 changed files with 13 additions and 6 deletions

View File

@ -2593,7 +2593,7 @@ static void spapr_machine_init(MachineState *machine)
spapr_set_vsmt_mode(spapr, &error_fatal); spapr_set_vsmt_mode(spapr, &error_fatal);
/* Set up Interrupt Controller before we create the VCPUs */ /* Set up Interrupt Controller before we create the VCPUs */
smc->irq->init(spapr, &error_fatal); spapr_irq_init(spapr, &error_fatal);
/* Set up containers for ibm,client-architecture-support negotiated options /* Set up containers for ibm,client-architecture-support negotiated options
*/ */

View File

@ -97,11 +97,6 @@ static void spapr_irq_init_xics(sPAPRMachineState *spapr, Error **errp)
int nr_irqs = smc->irq->nr_irqs; int nr_irqs = smc->irq->nr_irqs;
Error *local_err = NULL; Error *local_err = NULL;
/* Initialize the MSI IRQ allocator. */
if (!SPAPR_MACHINE_GET_CLASS(spapr)->legacy_irq_allocation) {
spapr_irq_msi_init(spapr, smc->irq->nr_msis);
}
if (kvm_enabled()) { if (kvm_enabled()) {
if (machine_kernel_irqchip_allowed(machine) && if (machine_kernel_irqchip_allowed(machine) &&
!xics_kvm_init(spapr, &local_err)) { !xics_kvm_init(spapr, &local_err)) {
@ -213,6 +208,17 @@ sPAPRIrq spapr_irq_xics = {
/* /*
* sPAPR IRQ frontend routines for devices * sPAPR IRQ frontend routines for devices
*/ */
void spapr_irq_init(sPAPRMachineState *spapr, Error **errp)
{
sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(spapr);
/* Initialize the MSI IRQ allocator. */
if (!SPAPR_MACHINE_GET_CLASS(spapr)->legacy_irq_allocation) {
spapr_irq_msi_init(spapr, smc->irq->nr_msis);
}
smc->irq->init(spapr, errp);
}
int spapr_irq_claim(sPAPRMachineState *spapr, int irq, bool lsi, Error **errp) int spapr_irq_claim(sPAPRMachineState *spapr, int irq, bool lsi, Error **errp)
{ {

View File

@ -43,6 +43,7 @@ typedef struct sPAPRIrq {
extern sPAPRIrq spapr_irq_xics; extern sPAPRIrq spapr_irq_xics;
extern sPAPRIrq spapr_irq_xics_legacy; extern sPAPRIrq spapr_irq_xics_legacy;
void spapr_irq_init(sPAPRMachineState *spapr, Error **errp);
int spapr_irq_claim(sPAPRMachineState *spapr, int irq, bool lsi, Error **errp); int spapr_irq_claim(sPAPRMachineState *spapr, int irq, bool lsi, Error **errp);
void spapr_irq_free(sPAPRMachineState *spapr, int irq, int num); void spapr_irq_free(sPAPRMachineState *spapr, int irq, int num);
qemu_irq spapr_qirq(sPAPRMachineState *spapr, int irq); qemu_irq spapr_qirq(sPAPRMachineState *spapr, int irq);