qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Alexander Graf <agraf@suse.de>
Cc: Anthony Liguori <aliguori@us.ibm.com>,
	Alexey Kardashevskiy <aik@ozlabs.ru>,
	qemu-devel@nongnu.org,
	Alex Williamson <alex.williamson@redhat.com>,
	qemu-ppc@nongnu.org, David Gibson <david@gibson.dropbear.id.au>
Subject: Re: [Qemu-devel] [PATCH 1/3] spapr pci msi: rework
Date: Fri, 21 Jun 2013 22:02:13 +1000	[thread overview]
Message-ID: <1371816133.3944.57.camel@pasglop> (raw)
In-Reply-To: <37E1A8FA-6BFA-48D1-AA3E-118671C8638A@suse.de>

On Fri, 2013-06-21 at 12:31 +0200, Alexander Graf wrote:
> On 21.06.2013, at 11:22, Alexey Kardashevskiy wrote:
> 
> > Previously every PCI host bridge implemented its own MSI memory window
> > in order to catch msi_notify()/msix_notify() calls from various QEMU
> > MSI-capable devives such as virtio-pci or vfio and redirect them to
> > the guest via qemu_pulse_irq().
> 
> That's how hardware works, no?
> 
> > 
> > The encoded MSIMessage used to be encoded as:
> > * .addr - address in a MSI window, this is how QEMU knows which PHB
> > is the message for;
> > * .data - number of a device on a specific PHB and vector number.
> > 
> > As a PHB has a destriptor for every device, and every descriptor has
> > first IRQ number and the number of IRQs, it can calculate global IRQ
> > number to use in qemu_pulse_irq().
> 
> How does this work on real hardware?

Why would we care ?

The MSIs are established by an hcall anyway, the guest sees nothing of
that, we can encode what we want in there.

Now the way it works on real HW is different from Alex did originally.

The address of the MSI defines an MSI "port" which is purely a mechanism
for verifying that the device is authorized to do MSIs (to that port)
and associate a PE# with it, which is cross-match with the PHB-local MSI
index which is the message  value

That value is then ORed with a PHB-configured "BUID" which forms the
full global interrupt number.

At least on P7IOC ... P8 is a bit different. But we don't really need to
reproduce that exactly.

Ben.

> 
> Alex
> 
> > However the total number of IRQs is not really big (at the moment it is
> > 1024 IRQs which start from 4096) and the existing system looks overdesigned.
> > The patch simplifies it. Specifically:
> > 
> > 1. MSI windows were removed from PHB.
> > 2. Added one memory region for all MSIs.
> > 3. Now MSIMessage::addr is a number of first IRQ of a device,
> > MSIMessage:data is a number of a vector.
> > 
> > Putting IRQ number to .data and not using .addr would make it even simpler
> > for MSI-X but it will not work for MSI with multiple vectors unless a first
> > IRQ number of a device is aligned to the MSI vectors number.
> > 
> > The simplified scheme also allows easier MSIMessage->IRQ translation
> > for upcoming IRQFD support.
> > 
> > Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>

  parent reply	other threads:[~2013-06-21 12:02 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-21  9:22 [Qemu-devel] [PATCH 0/3] RFCv2 kvm irqfd: add directly mapped MSI IRQ support Alexey Kardashevskiy
2013-06-21  9:22 ` [Qemu-devel] [PATCH 1/3] spapr pci msi: rework Alexey Kardashevskiy
2013-06-21 10:31   ` Alexander Graf
2013-06-21 10:52     ` Alexey Kardashevskiy
2013-06-21 11:58       ` Anthony Liguori
2013-06-21 11:59         ` Alexander Graf
2013-06-21 12:09         ` Benjamin Herrenschmidt
2013-06-21 12:02     ` Benjamin Herrenschmidt [this message]
2013-06-21  9:22 ` [Qemu-devel] [PATCH 2/3] KVM: add kvm_arch_irqchip_add_msi_route Alexey Kardashevskiy
2013-06-21 10:33   ` Alexander Graf
2013-06-21 12:03     ` Benjamin Herrenschmidt
2013-06-21 12:05       ` Alexander Graf
2013-06-21 12:10         ` Benjamin Herrenschmidt
2013-06-21 13:46           ` Alexander Graf
2013-06-21 21:54             ` Benjamin Herrenschmidt
2013-06-21 22:12               ` Alexander Graf
2013-06-21 22:21                 ` Benjamin Herrenschmidt
2013-06-21 23:10                   ` Alex Williamson
2013-06-21 23:19                     ` Benjamin Herrenschmidt
2013-06-21  9:22 ` [Qemu-devel] [PATCH 3/3] KVM: PPC: enable irqfd Alexey Kardashevskiy
2013-06-21 17:52   ` Scott Wood
2013-06-22  1:12     ` Alexey Kardashevskiy

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=1371816133.3944.57.camel@pasglop \
    --to=benh@kernel.crashing.org \
    --cc=agraf@suse.de \
    --cc=aik@ozlabs.ru \
    --cc=alex.williamson@redhat.com \
    --cc=aliguori@us.ibm.com \
    --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).