From: David Gibson <david@gibson.dropbear.id.au>
To: "Cédric Le Goater" <clg@kaod.org>
Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org,
Benjamin Herrenschmidt <benh@kernel.crashing.org>
Subject: Re: [Qemu-devel] [PATCH v3 07/35] spapr/xive: introduce the XIVE Event Queues
Date: Sat, 5 May 2018 14:29:44 +1000 [thread overview]
Message-ID: <20180505042944.GL13229@umbus.fritz.box> (raw)
In-Reply-To: <9cc1092b-6312-aa6c-1fcd-8e6e7756aab7@kaod.org>
[-- Attachment #1: Type: text/plain, Size: 7515 bytes --]
On Fri, May 04, 2018 at 03:29:02PM +0200, Cédric Le Goater wrote:
> On 05/04/2018 07:19 AM, David Gibson wrote:
> > On Thu, May 03, 2018 at 04:37:29PM +0200, Cédric Le Goater wrote:
> >> On 05/03/2018 08:25 AM, David Gibson wrote:
> >>> On Thu, May 03, 2018 at 08:07:54AM +0200, Cédric Le Goater wrote:
> >>>> On 05/03/2018 07:45 AM, David Gibson wrote:
> >>>>> On Thu, Apr 26, 2018 at 11:48:06AM +0200, Cédric Le Goater wrote:
> >>>>>> On 04/26/2018 09:25 AM, David Gibson wrote:
> >>>>>>> On Thu, Apr 19, 2018 at 02:43:03PM +0200, Cédric Le Goater wrote:
> >>>>>>>> The Event Queue Descriptor (EQD) table is an internal table of the
> >>>>>>>> XIVE routing sub-engine. It specifies on which Event Queue the event
> >>>>>>>> data should be posted when an exception occurs (later on pulled by the
> >>>>>>>> OS) and which Virtual Processor to notify.
> >>>>>>>
> >>>>>>> Uhhh.. I thought the IVT said which queue and vp to notify, and the
> >>>>>>> EQD gave metadata for event queues.
> >>>>>>
> >>>>>> yes. the above poorly written. The Event Queue Descriptor contains the
> >>>>>> guest address of the event queue in which the data is written. I will
> >>>>>> rephrase.
> >>>>>>
> >>>>>> The IVT contains IVEs which indeed define for an IRQ which EQ to notify
> >>>>>> and what data to push on the queue.
> >>>>>>
> >>>>>>>> The Event Queue is a much
> >>>>>>>> more complex structure but we start with a simple model for the sPAPR
> >>>>>>>> machine.
> >>>>>>>>
> >>>>>>>> There is one XiveEQ per priority and these are stored under the XIVE
> >>>>>>>> virtualization presenter (sPAPRXiveNVT). EQs are simply indexed with :
> >>>>>>>>
> >>>>>>>> (server << 3) | (priority & 0x7)
> >>>>>>>>
> >>>>>>>> This is not in the XIVE architecture but as the EQ index is never
> >>>>>>>> exposed to the guest, in the hcalls nor in the device tree, we are
> >>>>>>>> free to use what fits best the current model.
> >>>>>>
> >>>>>> This EQ indexing is important to notice because it will also show up
> >>>>>> in KVM to build the IVE from the KVM irq state.
> >>>>>
> >>>>> Ok, are you saying that while this combined EQ index will never appear
> >>>>> in guest <-> host interfaces,
> >>>>
> >>>> Indeed.
> >>>>
> >>>>> it might show up in qemu <-> KVM interfaces?
> >>>>
> >>>> Not directly but it is part of the IVE as the IVE_EQ_INDEX field. When
> >>>> dumped, it has to be built in some ways, compatible with the emulated
> >>>> mode in QEMU.
> >>>
> >>> Hrm. But is the exact IVE contents visible to qemu (for a PAPR
> >>> guest)?
> >>
> >> The guest only uses hcalls which arguments are :
> >>
> >> - cpu numbers,
> >> - priority numbers from defined ranges,
> >> - logical interrupt numbers.
> >> - physical address of the EQ
> >>
> >> The visible parts for the guest of the IVE are the 'priority', the 'cpu',
> >> and the 'eisn', which is the effective IRQ number the guest is assigning
> >> to the source. The 'eisn" will be pushed in the EQ.
> >
> > Ok.
> >
> >> The IVE EQ index is not visible.
> >
> > Good.
> >
> >>> I would have thought the qemu <-> KVM interfaces would have
> >>> abstracted this the same way the guest <-> KVM interfaces do. > Or is there a reason not to?
> >>
> >> It is practical to dump 64bit IVEs directly from KVM into the QEMU
> >> internal structures because it fits the emulated mode without doing
> >> any translation ... This might be seen as a shortcut. You will tell
> >> me when you reach the KVM part.
> >
> > Ugh.. exposing to qemu the raw IVEs sounds like a bad idea to me.
>
> You definitely need to in QEMU in emulation mode. The whole routing
> relies on it.
I'm not exactly sure what you mean by "emulation mode" here. Above,
I'm talking specifically about a KVM HV, PAPR guest.
> > When we migrate, we're going to have to assign the guest (server,
> > priority) tuples to host EQ indicies, and I think it makes more sense
> > to do that in KVM and hide the raw indices from qemu than to have qemu
> > mangle them explicitly on migration.
>
> We will need some mangling mechanism for the KVM ioctls saving and
> restoring state. This is very similar to XICS.
>
> >>>>>>>> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> >>>>>>>
> >>>>>>> Is the EQD actually modifiable by a guest? Or are the settings of the
> >>>>>>> EQs fixed by PAPR?
> >>>>>>
> >>>>>> The guest uses the H_INT_SET_QUEUE_CONFIG hcall to define the address
> >>>>>> of the event queue for a couple prio/server.
> >>>>>
> >>>>> Ok, so the EQD can be modified by the guest. In which case we need to
> >>>>> work out what object owns it, since it'll need to migrate it.
> >>>>
> >>>> Indeed. The EQD are CPU related as there is one EQD per couple (cpu,
> >>>> priority). The KVM patchset dumps/restores the eight XiveEQ struct
> >>>> using per cpu ioctls. The EQ in the OS RAM is marked dirty at that
> >>>> stage.
> >>>
> >>> To make sure I'm clear: for PAPR there's a strict relationship between
> >>> EQD and CPU (one EQD for each (cpu, priority) tuple).
> >>
> >> Yes.
> >>
> >>> But for powernv that's not the case, right?
> >>
> >> It is.
> >
> > Uh.. I don't think either of us phrased that well, I'm still not sure
> > which way you're answering that.
>
> there's a strict relationship between EQD and CPU (one EQD for each (cpu, priority) tuple) in spapr and in powernv.
For powernv that seems to be contradicted by what you say below.
AFAICT there might be a strict association at the host kernel or even
the OPAL level, but not at the hardware level.
> >>> AIUI the mapping of EQs to cpus was configurable, is that right?
> >>
> >> Each cpu has 8 EQD. Same for virtual cpus.
> >
> > Hmm.. but is that 8 EQD per cpu something built into the hardware, or
> > just a convention of how the host kernel and OPAL operate?
>
> It's not in the HW, it is used by the HW to route the notification.
> The EQD contains the EQ characteristics :
>
> * functional bits :
> - valid bit
> - enqueue bit, to update OS in RAM EQ or not
> - unconditional notification
> - backlog
> - escalation
> - ...
> * OS EQ fields
> - physical address
> - entry index
> - toggle bit
> * NVT fields
> - block/chip
> - index
> * etc.
>
> It's a big structure : 8 words.
Ok. So yeah, the cpu association of the EQ is there in the NVT
fields, not baked into the hardware.
> The EQD table is allocated by OPAL/skiboot and fed to the HW for
> its use. The OS powernv uses OPAL calls configure the EQD with its
> needs :
>
> int64_t opal_xive_set_queue_info(uint64_t vp, uint32_t prio,
> uint64_t qpage,
> uint64_t qsize,
> uint64_t qflags);
>
>
> sPAPR uses an hcall :
>
> static long plpar_int_set_queue_config(unsigned long flags,
> unsigned long target,
> unsigned long priority,
> unsigned long qpage,
> unsigned long qsize)
>
>
> but it is translated in an OPAL call in KVM.
>
> C.
>
>
> >
> >>
> >> I am not sure what you understood before ? It is surely something
> >> I wrote, my XIVE understanding is still making progress.
> >>
> >>
> >> C.
> >>
> >
>
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2018-05-05 4:33 UTC|newest]
Thread overview: 100+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-19 12:42 [Qemu-devel] [PATCH v3 00/35] ppc: support for the XIVE interrupt controller (POWER9) Cédric Le Goater
2018-04-19 12:42 ` [Qemu-devel] [PATCH v3 01/35] ppc/xive: introduce a XIVE interrupt source model Cédric Le Goater
2018-04-20 7:10 ` David Gibson
2018-04-20 8:27 ` Cédric Le Goater
2018-04-23 3:59 ` David Gibson
2018-04-23 7:11 ` Cédric Le Goater
2018-04-24 1:24 ` David Gibson
2018-04-19 12:42 ` [Qemu-devel] [PATCH v3 02/35] ppc/xive: add support for the LSI interrupt sources Cédric Le Goater
2018-04-23 6:44 ` David Gibson
2018-04-23 7:31 ` Cédric Le Goater
2018-04-24 6:41 ` David Gibson
2018-04-24 8:11 ` Cédric Le Goater
2018-04-26 3:28 ` David Gibson
2018-04-26 12:16 ` Cédric Le Goater
2018-04-27 2:43 ` David Gibson
2018-05-04 14:25 ` Cédric Le Goater
2018-05-05 4:32 ` David Gibson
2018-04-19 12:42 ` [Qemu-devel] [PATCH v3 03/35] ppc/xive: introduce the XiveFabric interface Cédric Le Goater
2018-04-23 6:46 ` David Gibson
2018-04-23 7:58 ` Cédric Le Goater
2018-04-24 6:46 ` David Gibson
2018-04-24 9:33 ` Cédric Le Goater
2018-04-26 3:54 ` David Gibson
2018-04-26 10:30 ` Cédric Le Goater
2018-04-27 6:32 ` David Gibson
2018-05-02 15:28 ` Cédric Le Goater
2018-05-03 5:13 ` David Gibson
2018-05-23 10:12 ` Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 04/35] spapr/xive: introduce a XIVE interrupt controller for sPAPR Cédric Le Goater
2018-04-24 6:51 ` David Gibson
2018-04-24 9:46 ` Cédric Le Goater
2018-04-26 4:20 ` David Gibson
2018-04-26 10:43 ` Cédric Le Goater
2018-05-03 5:22 ` David Gibson
2018-05-03 16:50 ` Cédric Le Goater
2018-05-04 3:33 ` David Gibson
2018-05-04 13:05 ` Cédric Le Goater
2018-05-05 4:26 ` David Gibson
2018-05-09 7:23 ` Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 05/35] spapr/xive: add a single source block to the sPAPR XIVE model Cédric Le Goater
2018-04-24 6:58 ` David Gibson
2018-04-24 8:19 ` Cédric Le Goater
2018-04-26 4:46 ` David Gibson
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 06/35] spapr/xive: introduce a XIVE interrupt presenter model Cédric Le Goater
2018-04-26 7:11 ` David Gibson
2018-04-26 9:27 ` Cédric Le Goater
2018-04-26 17:15 ` Cédric Le Goater
2018-05-03 5:39 ` David Gibson
2018-05-03 15:10 ` Cédric Le Goater
2018-05-04 4:44 ` David Gibson
2018-05-04 14:15 ` Cédric Le Goater
2018-05-03 5:35 ` David Gibson
2018-05-03 16:06 ` Cédric Le Goater
2018-05-04 4:51 ` David Gibson
2018-05-04 13:11 ` Cédric Le Goater
2018-05-05 4:27 ` David Gibson
2018-05-09 7:27 ` Cédric Le Goater
2018-05-02 7:39 ` Cédric Le Goater
2018-05-03 5:43 ` David Gibson
2018-05-03 14:42 ` Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 07/35] spapr/xive: introduce the XIVE Event Queues Cédric Le Goater
2018-04-26 7:25 ` David Gibson
2018-04-26 9:48 ` Cédric Le Goater
2018-05-03 5:45 ` David Gibson
2018-05-03 6:07 ` Cédric Le Goater
2018-05-03 6:25 ` David Gibson
2018-05-03 14:37 ` Cédric Le Goater
2018-05-04 5:19 ` David Gibson
2018-05-04 13:29 ` Cédric Le Goater
2018-05-05 4:29 ` David Gibson [this message]
2018-05-09 8:01 ` Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 08/35] spapr: push the XIVE EQ data in OS event queue Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 09/35] spapr: notify the CPU when the XIVE interrupt priority is more privileged Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 10/35] spapr: add support for the SET_OS_PENDING command (XIVE) Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 11/35] spapr: introduce a 'xive_exploitation' option to enable XIVE Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 12/35] spapr: add a sPAPRXive object to the machine Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 13/35] spapr: add hcalls support for the XIVE exploitation interrupt mode Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 14/35] spapr: add device tree support for the XIVE exploitation mode Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 15/35] sysbus: add a sysbus_mmio_unmap() helper Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 16/35] spapr: introduce a helper to map the XIVE memory regions Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 17/35] spapr: add XIVE support to spapr_qirq() Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 18/35] spapr: introduce a spapr_icp_create() helper Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 19/35] spapr: toggle the ICP depending on the selected interrupt mode Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 20/35] spapr: add support to dump XIVE information Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 21/35] spapr: advertise XIVE exploitation mode in CAS Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 22/35] spapr: add classes for the XIVE models Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 23/35] target/ppc/kvm: add Linux KVM definitions for XIVE Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 24/35] spapr/xive: add common realize routine for KVM Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 25/35] spapr/xive: add KVM support Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 26/35] spapr/xive: add a XIVE KVM device to the machine Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 27/35] migration: discard non-migratable RAMBlocks Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 28/35] intc: introduce a CPUIntc interface Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 29/35] spapr/xive, xics: use the CPU_INTC handlers to reset KVM Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 30/35] spapr/xive, xics: reset KVM at machine reset Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 31/35] spapr/xive: raise migration priority of the machine Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 32/35] ppc/pnv: introduce a pnv_icp_create() helper Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 33/35] ppc: externalize ppc_get_vcpu_by_pir() Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 34/35] ppc/pnv: add XIVE support Cédric Le Goater
2018-04-19 12:43 ` [Qemu-devel] [PATCH v3 35/35] ppc/pnv: add a PSI bridge model for POWER9 processor Cédric Le Goater
2018-04-19 13:28 ` [Qemu-devel] [PATCH v3 00/35] ppc: support for the XIVE interrupt controller (POWER9) no-reply
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=20180505042944.GL13229@umbus.fritz.box \
--to=david@gibson.dropbear.id.au \
--cc=benh@kernel.crashing.org \
--cc=clg@kaod.org \
--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).