@@ -63,7 +63,7 @@ struct SpaprInterruptControllerClass {
void (*set_irq)(SpaprInterruptController *intc, int irq, int val);
void (*print_info)(SpaprInterruptController *intc, Monitor *mon);
void (*dt)(SpaprInterruptController *intc, uint32_t max_vcpu_ids,
- void *fdt, uint32_t phandle);
+ uint32_t max_cpus, void *fdt, uint32_t phandle);
int (*post_load)(SpaprInterruptController *intc, int version_id);
};
@@ -75,7 +75,7 @@ void spapr_irq_cpu_intc_reset(struct SpaprMachineState *spapr, PowerPCCPU *cpu);
void spapr_irq_cpu_intc_destroy(struct SpaprMachineState *spapr, PowerPCCPU *cpu);
void spapr_irq_print_info(struct SpaprMachineState *spapr, Monitor *mon);
void spapr_irq_dt(struct SpaprMachineState *spapr, uint32_t max_vcpu_ids,
- void *fdt, uint32_t phandle);
+ uint32_t max_cpus, void *fdt, uint32_t phandle);
uint32_t spapr_irq_nr_msis(struct SpaprMachineState *spapr);
int spapr_irq_msi_alloc(struct SpaprMachineState *spapr, uint32_t num, bool align,
@@ -670,6 +670,7 @@ static void spapr_xive_print_info(SpaprInterruptController *intc, Monitor *mon)
}
static void spapr_xive_dt(SpaprInterruptController *intc, uint32_t max_vcpu_ids,
+ uint32_t max_cpus,
void *fdt, uint32_t phandle)
{
SpaprXive *xive = SPAPR_XIVE(intc);
@@ -678,7 +679,7 @@ static void spapr_xive_dt(SpaprInterruptController *intc, uint32_t max_vcpu_ids,
/* Interrupt number ranges for the IPIs */
uint32_t lisn_ranges[] = {
cpu_to_be32(SPAPR_IRQ_IPI),
- cpu_to_be32(SPAPR_IRQ_IPI + max_vcpu_ids),
+ cpu_to_be32(SPAPR_IRQ_IPI + max_cpus),
};
/*
* EQ size - the sizes of pages supported by the system 4K, 64K,
@@ -309,7 +309,8 @@ static void ics_spapr_realize(DeviceState *dev, Error **errp)
}
static void xics_spapr_dt(SpaprInterruptController *intc, uint32_t max_vcpu_ids,
- void *fdt, uint32_t phandle)
+ uint32_t max_cpus, void *fdt,
+ uint32_t phandle)
{
uint32_t interrupt_server_ranges_prop[] = {
0, cpu_to_be32(max_vcpu_ids),
@@ -1164,7 +1164,8 @@ void *spapr_build_fdt(SpaprMachineState *spapr, bool reset, size_t space)
_FDT(fdt_setprop_cell(fdt, 0, "#size-cells", 2));
/* /interrupt controller */
- spapr_irq_dt(spapr, spapr_max_vcpu_ids(spapr), fdt, PHANDLE_INTC);
+ spapr_irq_dt(spapr, spapr_max_vcpu_ids(spapr), machine->smp.max_cpus,
+ fdt, PHANDLE_INTC);
ret = spapr_dt_memory(spapr, fdt);
if (ret < 0) {
@@ -272,12 +272,16 @@ void spapr_irq_print_info(SpaprMachineState *spapr, Monitor *mon)
}
void spapr_irq_dt(SpaprMachineState *spapr, uint32_t max_vcpu_ids,
- void *fdt, uint32_t phandle)
+ uint32_t max_cpus, void *fdt, uint32_t phandle)
{
SpaprInterruptControllerClass *sicc
= SPAPR_INTC_GET_CLASS(spapr->active_intc);
- sicc->dt(spapr->active_intc, max_vcpu_ids, fdt, phandle);
+ /* For older machine types in case they have an unusual VSMT setting */
+ if (SPAPR_MACHINE_GET_CLASS(spapr)->pre_6_0_xive_max_cpus) {
+ max_cpus = spapr_max_vcpu_ids(spapr);
+ }
+ sicc->dt(spapr->active_intc, max_vcpu_ids, max_cpus, fdt, phandle);
}
uint32_t spapr_irq_nr_msis(SpaprMachineState *spapr)
The dt() callback of the sPAPR IC class has a "nr_servers" argument which is used by both XIVE and XICS to setup the "interrupt-controller" node in the DT. The machine currently passes spapr_max_server_number() to spapr_irq_dt(). This is perfectly fine to populate the range of vCPU ids in the "ibm,interrupt-server-ranges" property for XICS. However, this doesn't makes sense for XIVE's "ibm,xive-lisn-ranges" property which really expects the maximum number of vCPUs instead. Add a new "max_cpus" argument to spapr_irq_dt() and the dt() handler to convey the maximum number of vCPUs. Have the latest machine type to pass smp.max_cpus and sPAPR XIVE to use that for "ibm,xive-lisn-ranges". Older machine types go on with the previous behavior since this is guest visible. Signed-off-by: Greg Kurz <groug@kaod.org> --- include/hw/ppc/spapr_irq.h | 4 ++-- hw/intc/spapr_xive.c | 3 ++- hw/intc/xics_spapr.c | 3 ++- hw/ppc/spapr.c | 3 ++- hw/ppc/spapr_irq.c | 8 ++++++-- 5 files changed, 14 insertions(+), 7 deletions(-)