>> +static void spapr_irq_init_xics(sPAPRMachineState *spapr, Error **errp)
>> +{
>> +    MachineState *machine = MACHINE(spapr);
>> +    sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(spapr);
>> +    int nr_irqs = smc->irq->nr_irqs;
>> +    Error *local_err = NULL;
>> +
>> +    /* Initialize the MSI IRQ allocator. */
>> +    if (!SPAPR_MACHINE_GET_CLASS(spapr)->legacy_irq_allocation) {
>> +        spapr_irq_msi_init(spapr, XICS_IRQ_BASE + nr_irqs - SPAPR_IRQ_MSI);
>> +    }
> 
> I think this belongs in common code, rather than xics specific.

The XIVE IRQ backend will also need to initialize the MSI allocator but 
the XIVE IRQ number space covers the full number space, it has no IRQ 
number offset. The initialization will differ slightly :

+    /* Initialize the MSI IRQ allocator */
+    spapr_irq_msi_init(spapr, nr_irqs - SPAPR_IRQ_MSI);
+

So I rather keep the call where it is today. This is really a small
duplication.

Thanks,

C. 

Reply via email to