From: Greg Kurz <groug@kaod.org>
To: David Gibson <david@gibson.dropbear.id.au>
Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org,
"Cédric Le Goater" <clg@kaod.org>
Subject: [PATCH for-6.0 v2 3/3] spapr/xive: Fix the "ibm, xive-lisn-ranges" property
Date: Mon, 30 Nov 2020 17:52:58 +0100 [thread overview]
Message-ID: <20201130165258.744611-4-groug@kaod.org> (raw)
In-Reply-To: <20201130165258.744611-1-groug@kaod.org>
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(-)
diff --git a/include/hw/ppc/spapr_irq.h b/include/hw/ppc/spapr_irq.h
index 2e53fc9e6cbb..1edf4851afa4 100644
--- a/include/hw/ppc/spapr_irq.h
+++ b/include/hw/ppc/spapr_irq.h
@@ -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,
diff --git a/hw/intc/spapr_xive.c b/hw/intc/spapr_xive.c
index d0a0ca822367..f9a563cd0a9b 100644
--- a/hw/intc/spapr_xive.c
+++ b/hw/intc/spapr_xive.c
@@ -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,
diff --git a/hw/intc/xics_spapr.c b/hw/intc/xics_spapr.c
index 8f753a858cc2..d9f887dfd303 100644
--- a/hw/intc/xics_spapr.c
+++ b/hw/intc/xics_spapr.c
@@ -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),
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 227a926dfd48..be3b4b9119b7 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -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) {
diff --git a/hw/ppc/spapr_irq.c b/hw/ppc/spapr_irq.c
index 4d9ecd5d0af8..e1fd777aff62 100644
--- a/hw/ppc/spapr_irq.c
+++ b/hw/ppc/spapr_irq.c
@@ -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)
--
2.26.2
next prev parent reply other threads:[~2020-11-30 16:54 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-30 16:52 [PATCH for-6.0 v2 0/3] spapr: Address the confusion between IPI numbers and vCPU ids Greg Kurz
2020-11-30 16:52 ` [PATCH for-6.0 v2 1/3] spapr: Improve naming of some vCPU id related items Greg Kurz
2020-11-30 17:32 ` Cédric Le Goater
2020-11-30 18:08 ` Cédric Le Goater
2020-11-30 18:30 ` Greg Kurz
2020-12-02 4:56 ` David Gibson
2020-12-03 9:06 ` Greg Kurz
2020-11-30 16:52 ` [PATCH for-6.0 v2 2/3] spapr/xive: Fix size of END table and number of claimed IPIs Greg Kurz
2020-11-30 18:07 ` Cédric Le Goater
2020-12-03 9:51 ` Cédric Le Goater
2020-12-03 10:50 ` Greg Kurz
2020-12-04 8:46 ` Cédric Le Goater
2020-12-04 9:11 ` Greg Kurz
2020-11-30 16:52 ` Greg Kurz [this message]
2020-11-30 17:28 ` [PATCH for-6.0 v2 0/3] spapr: Address the confusion between IPI numbers and vCPU ids Cédric Le Goater
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201130165258.744611-4-groug@kaod.org \
--to=groug@kaod.org \
--cc=clg@kaod.org \
--cc=david@gibson.dropbear.id.au \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).