From: Greg Kurz <groug@kaod.org>
To: David Gibson <david@gibson.dropbear.id.au>
Cc: qemu-devel@nongnu.org, qemu-ppc@nongnu.org,
qemu-s390x@nongnu.org, "Alexey Kardashevskiy" <aik@ozlabs.ru>,
"Cédric Le Goater" <clg@kaod.org>,
"Michael Roth" <mdroth@linux.vnet.ibm.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Marcel Apfelbaum" <marcel@redhat.com>,
"Eduardo Habkost" <ehabkost@redhat.com>,
"David Hildenbrand" <david@redhat.com>,
"Cornelia Huck" <cohuck@redhat.com>,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Dmitry Fleytman" <dmitry.fleytman@gmail.com>,
"Thomas Huth" <thuth@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v4 01/15] spapr_irq: Add an @xics_offset field to sPAPRIrq
Date: Wed, 13 Feb 2019 13:23:52 +0100 [thread overview]
Message-ID: <20190213132352.77670675@bahia.lan> (raw)
In-Reply-To: <20190213032601.GZ1884@umbus.fritz.box>
[-- Attachment #1: Type: text/plain, Size: 7150 bytes --]
On Wed, 13 Feb 2019 14:26:01 +1100
David Gibson <david@gibson.dropbear.id.au> wrote:
> On Tue, Feb 12, 2019 at 07:24:00PM +0100, Greg Kurz wrote:
> > Only pseries machines, either recent ones started with ic-mode=xics
> > or older ones using the legacy irq allocation scheme, need to set the
> > @offset of the ICS to XICS_IRQ_BASE. Recent pseries started with
> > ic-mode=dual set it to 0 and powernv machines set it to some other
> > value at runtime.
> >
> > It thus doesn't really help to set the default value of the ICS offset
> > to XICS_IRQ_BASE in ics_base_instance_init().
> >
> > Drop that code from XICS and let the pseries code set the offset
> > explicitely for clarity.
> >
> > Signed-off-by: Greg Kurz <groug@kaod.org>
>
> So this actually relates to a discussion I've had on some of Cédric's
> more recent patches. Changing the ics offset in ic-mode=dual doesn't
> make sense to me. The global (guest) interrupt numbers need to match
> between XICS and XIVE, but the global interrupt numbers don't have to
> match the ICS source numbers, which is what ics->offset is about.
>
Yeah. We'll see what comes out of the discussion at:
https://patchwork.ozlabs.org/patch/1021496/
> > ---
> > hw/intc/xics.c | 8 --------
> > hw/ppc/spapr_irq.c | 33 ++++++++++++++++++++-------------
> > include/hw/ppc/spapr_irq.h | 1 +
> > 3 files changed, 21 insertions(+), 21 deletions(-)
> >
> > diff --git a/hw/intc/xics.c b/hw/intc/xics.c
> > index 16e8ffa2aaf7..7cac138067e2 100644
> > --- a/hw/intc/xics.c
> > +++ b/hw/intc/xics.c
> > @@ -638,13 +638,6 @@ static void ics_base_realize(DeviceState *dev, Error **errp)
> > ics->irqs = g_malloc0(ics->nr_irqs * sizeof(ICSIRQState));
> > }
> >
> > -static void ics_base_instance_init(Object *obj)
> > -{
> > - ICSState *ics = ICS_BASE(obj);
> > -
> > - ics->offset = XICS_IRQ_BASE;
> > -}
> > -
> > static int ics_base_dispatch_pre_save(void *opaque)
> > {
> > ICSState *ics = opaque;
> > @@ -720,7 +713,6 @@ static const TypeInfo ics_base_info = {
> > .parent = TYPE_DEVICE,
> > .abstract = true,
> > .instance_size = sizeof(ICSState),
> > - .instance_init = ics_base_instance_init,
> > .class_init = ics_base_class_init,
> > .class_size = sizeof(ICSStateClass),
> > };
> > diff --git a/hw/ppc/spapr_irq.c b/hw/ppc/spapr_irq.c
> > index 80b0083b8e38..8217e0215411 100644
> > --- a/hw/ppc/spapr_irq.c
> > +++ b/hw/ppc/spapr_irq.c
> > @@ -68,10 +68,11 @@ void spapr_irq_msi_reset(sPAPRMachineState *spapr)
> >
> > static ICSState *spapr_ics_create(sPAPRMachineState *spapr,
> > const char *type_ics,
> > - int nr_irqs, Error **errp)
> > + int nr_irqs, int offset, Error **errp)
> > {
> > Error *local_err = NULL;
> > Object *obj;
> > + ICSState *ics;
> >
> > obj = object_new(type_ics);
> > object_property_add_child(OBJECT(spapr), "ics", obj, &error_abort);
> > @@ -86,7 +87,10 @@ static ICSState *spapr_ics_create(sPAPRMachineState *spapr,
> > goto error;
> > }
> >
> > - return ICS_BASE(obj);
> > + ics = ICS_BASE(obj);
> > + ics->offset = offset;
> > +
> > + return ics;
> >
> > error:
> > error_propagate(errp, local_err);
> > @@ -104,6 +108,7 @@ static void spapr_irq_init_xics(sPAPRMachineState *spapr, Error **errp)
> > !xics_kvm_init(spapr, &local_err)) {
> > spapr->icp_type = TYPE_KVM_ICP;
> > spapr->ics = spapr_ics_create(spapr, TYPE_ICS_KVM, nr_irqs,
> > + spapr->irq->xics_offset,
> > &local_err);
> > }
> > if (machine_kernel_irqchip_required(machine) && !spapr->ics) {
> > @@ -119,6 +124,7 @@ static void spapr_irq_init_xics(sPAPRMachineState *spapr, Error **errp)
> > xics_spapr_init(spapr);
> > spapr->icp_type = TYPE_ICP;
> > spapr->ics = spapr_ics_create(spapr, TYPE_ICS_SIMPLE, nr_irqs,
> > + spapr->irq->xics_offset,
> > &local_err);
> > }
> >
> > @@ -246,6 +252,7 @@ sPAPRIrq spapr_irq_xics = {
> > .nr_irqs = SPAPR_IRQ_XICS_NR_IRQS,
> > .nr_msis = SPAPR_IRQ_XICS_NR_MSIS,
> > .ov5 = SPAPR_OV5_XIVE_LEGACY,
> > + .xics_offset = XICS_IRQ_BASE,
> >
> > .init = spapr_irq_init_xics,
> > .claim = spapr_irq_claim_xics,
> > @@ -451,17 +458,6 @@ static void spapr_irq_init_dual(sPAPRMachineState *spapr, Error **errp)
> > return;
> > }
> >
> > - /*
> > - * Align the XICS and the XIVE IRQ number space under QEMU.
> > - *
> > - * However, the XICS KVM device still considers that the IRQ
> > - * numbers should start at XICS_IRQ_BASE (0x1000). Either we
> > - * should introduce a KVM device ioctl to set the offset or ignore
> > - * the lower 4K numbers when using the get/set ioctl of the XICS
> > - * KVM device. The second option seems the least intrusive.
> > - */
> > - spapr->ics->offset = 0;
> > -
> > spapr_irq_xive.init(spapr, &local_err);
> > if (local_err) {
> > error_propagate(errp, local_err);
> > @@ -582,6 +578,16 @@ sPAPRIrq spapr_irq_dual = {
> > .nr_irqs = SPAPR_IRQ_DUAL_NR_IRQS,
> > .nr_msis = SPAPR_IRQ_DUAL_NR_MSIS,
> > .ov5 = SPAPR_OV5_XIVE_BOTH,
> > + /*
> > + * Align the XICS and the XIVE IRQ number space under QEMU.
> > + *
> > + * However, the XICS KVM device still considers that the IRQ
> > + * numbers should start at XICS_IRQ_BASE (0x1000). Either we
> > + * should introduce a KVM device ioctl to set the offset or ignore
> > + * the lower 4K numbers when using the get/set ioctl of the XICS
> > + * KVM device. The second option seems the least intrusive.
> > + */
> > + .xics_offset = 0,
> >
> > .init = spapr_irq_init_dual,
> > .claim = spapr_irq_claim_dual,
> > @@ -712,6 +718,7 @@ sPAPRIrq spapr_irq_xics_legacy = {
> > .nr_irqs = SPAPR_IRQ_XICS_LEGACY_NR_IRQS,
> > .nr_msis = SPAPR_IRQ_XICS_LEGACY_NR_IRQS,
> > .ov5 = SPAPR_OV5_XIVE_LEGACY,
> > + .xics_offset = XICS_IRQ_BASE,
> >
> > .init = spapr_irq_init_xics,
> > .claim = spapr_irq_claim_xics,
> > diff --git a/include/hw/ppc/spapr_irq.h b/include/hw/ppc/spapr_irq.h
> > index 14b02c3aca33..5e30858dc22a 100644
> > --- a/include/hw/ppc/spapr_irq.h
> > +++ b/include/hw/ppc/spapr_irq.h
> > @@ -34,6 +34,7 @@ typedef struct sPAPRIrq {
> > uint32_t nr_irqs;
> > uint32_t nr_msis;
> > uint8_t ov5;
> > + uint32_t xics_offset;
> >
> > void (*init)(sPAPRMachineState *spapr, Error **errp);
> > int (*claim)(sPAPRMachineState *spapr, int irq, bool lsi, Error **errp);
> >
>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2019-02-13 12:33 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-12 18:23 [Qemu-devel] [PATCH v4 00/15] spapr: Add support for PHB hotplug Greg Kurz
2019-02-12 18:24 ` [Qemu-devel] [PATCH v4 01/15] spapr_irq: Add an @xics_offset field to sPAPRIrq Greg Kurz
2019-02-12 20:07 ` Cédric Le Goater
2019-02-13 3:26 ` David Gibson
2019-02-13 12:23 ` Greg Kurz [this message]
2019-02-12 18:24 ` [Qemu-devel] [PATCH v4 02/15] xive: Only set source type for LSIs Greg Kurz
2019-02-13 3:27 ` David Gibson
2019-02-12 18:24 ` [Qemu-devel] [PATCH v4 03/15] spapr_irq: Set LSIs at interrupt controller init Greg Kurz
2019-02-12 20:17 ` Cédric Le Goater
2019-02-13 3:48 ` David Gibson
2019-02-13 12:44 ` Greg Kurz
2019-02-12 18:24 ` [Qemu-devel] [PATCH v4 04/15] spapr: Expose the name of the interrupt controller node Greg Kurz
2019-02-13 3:50 ` David Gibson
2019-02-12 18:24 ` [Qemu-devel] [PATCH v4 05/15] spapr_irq: Expose the phandle of the interrupt controller Greg Kurz
2019-02-13 3:52 ` David Gibson
2019-02-13 13:11 ` Greg Kurz
2019-02-12 18:24 ` [Qemu-devel] [PATCH v4 06/15] spapr_pci: add PHB unrealize Greg Kurz
2019-02-13 3:56 ` David Gibson
2019-02-12 18:24 ` [Qemu-devel] [PATCH v4 07/15] spapr: create DR connectors for PHBs Greg Kurz
2019-02-12 18:24 ` [Qemu-devel] [PATCH v4 08/15] spapr: populate PHB DRC entries for root DT node Greg Kurz
2019-02-12 18:24 ` [Qemu-devel] [PATCH v4 09/15] spapr_events: add support for phb hotplug events Greg Kurz
2019-02-12 18:24 ` [Qemu-devel] [PATCH v4 10/15] qdev: pass an Object * to qbus_set_hotplug_handler() Greg Kurz
2019-02-13 3:59 ` David Gibson
2019-02-12 18:25 ` [Qemu-devel] [PATCH v4 11/15] spapr_pci: provide node start offset via spapr_populate_pci_dt() Greg Kurz
2019-02-12 18:25 ` [Qemu-devel] [PATCH v4 12/15] spapr_pci: add ibm, my-drc-index property for PHB hotplug Greg Kurz
2019-02-12 18:25 ` [Qemu-devel] [PATCH v4 13/15] spapr_drc: Allow FDT fragment to be added later Greg Kurz
2019-02-13 4:05 ` David Gibson
2019-02-13 13:15 ` Greg Kurz
2019-02-12 18:25 ` [Qemu-devel] [PATCH v4 14/15] spapr: add hotplug hooks for PHB hotplug Greg Kurz
2019-02-13 4:13 ` David Gibson
2019-02-13 13:24 ` Greg Kurz
2019-02-13 9:25 ` David Hildenbrand
2019-02-13 13:25 ` Greg Kurz
2019-02-12 18:25 ` [Qemu-devel] [PATCH v4 15/15] spapr: enable PHB hotplug for default pseries machine type Greg Kurz
2019-02-13 4:13 ` David Gibson
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=20190213132352.77670675@bahia.lan \
--to=groug@kaod.org \
--cc=aik@ozlabs.ru \
--cc=clg@kaod.org \
--cc=cohuck@redhat.com \
--cc=david@gibson.dropbear.id.au \
--cc=david@redhat.com \
--cc=dmitry.fleytman@gmail.com \
--cc=ehabkost@redhat.com \
--cc=kraxel@redhat.com \
--cc=marcel@redhat.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=thuth@redhat.com \
/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).