qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@redhat.com>
To: Alexey Kardashevskiy <aik@ozlabs.ru>
Cc: qemu-devel@nongnu.org, Alex Graf <agraf@suse.de>,
	anthony@codemonkey.ws, kvm@vger.kernel.org
Subject: Re: [Qemu-devel] [RFC PATCH] qemu spapr-pci: added IRQ list to PCIBus
Date: Wed, 16 May 2012 14:39:15 -0600	[thread overview]
Message-ID: <1337200755.6954.269.camel@bling.home> (raw)
In-Reply-To: <4FB08867.9070103@ozlabs.ru>

On Mon, 2012-05-14 at 14:21 +1000, Alexey Kardashevskiy wrote:
> On 14/05/12 11:58, David Gibson wrote:
> > On Sat, May 12, 2012 at 05:29:53PM +1000, Alexey Kardashevskiy wrote:
> >> There is a need for a mechanism to obtain an IRQ line number to
> >> initialize End-Of-Interrupt handler.
> >>
> >> There is another proposed solution (commit
> >> b7790763828b732059ad24ba0e64ce327563fe1a "pci: Add callbacks
> >> to support retrieving and updating interrupts") which adds pci_get_irq
> >> callback to every PCI bus to allow an external caller to calculate
> >> IRQ number from IRQ line (ABDD).
> >>
> >> However it seems to be too complicated as it affects all PCI buses
> >> while the only user of it is VFIO-PCI so this could be done simpler
> >> by an array of 4 IRQs (lines A, B, C, D) in struct PCIBus which
> >> every platform would initialize in its own way.
> > 
> > I think you need to pin down the definition of what's going on here a
> > bit better.  Not all platforms have a concept of global IRQ number,
> > and the usual qemu_irq model supports that.  So for this function who
> > is it that is defining the number space in which pci_get_irq() is
> > returning values.
> 
> 
> The idea is that legacy interrupt (INTx) is caught by a host driver (for example, vfio-pci). A
> driver disables it and transfers to a guest. In order to enable it back, a host driver has to make
> sure that the interrupt has been handled by a guest. It is done by an End-Of-Interrupt (EOI) message
> sent by a guest. Then QEMU forwards the message to a host driver which enables INTx back.

Right, the gap is that we can signal the interrupt in qemu, but don't
know which EOI to look for to re-enable the physical device.  Later
we'll want to know the interrupt when we inject it so we can do so via
an irqfd directly into kvm.

> At the moment this mechanism - EOI callbacks - operates with global IRQ numbers, both on x86 (acpi)
> and power (xics). So pci_get_irq returns only global numbers which PCIBus receives from the calling
> code somehow (platform specific code knows how to initialize them, a bus cannot resolve it itself
> anyway). And this is not dynamically changing information as PCI _domain_ hotplug does not exist (am
> I right? :) ).

It actually can change dynamically on x86 due to acpi interrupt links
which allow the guest a generic way to select from a set of possible
interrupt routing schemes.  And of course a chipset driver could twiddle
bits if it wanted as well.  So, we really do need the update notifiers
from my tree that this patch drops.  pci_get_irq is one of the few
things a qemu chipset needs to implement to get device assignment with
vfio.  Doing it this way with a common array in PCIBus makes the patch
smaller, but I don't know that it really simplifies anything.  The
chipset function is trivial on x86, it's just knowing what to do that's
the problem.

> If we do not want pci_get_irq to return global IRQ numbers than it makes more sense to keep using
> pins (A,B,C,D) plus some bus ID and not introduce any new numbers at all.

How does that solve the initial problem of getting the EOI?

> How can PCIBus::pci_get_irq() _callbacks_ be useful?

It indicates support?  Thanks,

Alex

  reply	other threads:[~2012-05-16 20:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-12  7:29 [Qemu-devel] [RFC PATCH] qemu spapr-pci: added IRQ list to PCIBus Alexey Kardashevskiy
2012-05-14  1:58 ` David Gibson
2012-05-14  4:21   ` Alexey Kardashevskiy
2012-05-16 20:39     ` Alex Williamson [this message]
2012-05-17  2:16       ` Alexey Kardashevskiy
2012-05-17  3:00         ` Benjamin Herrenschmidt
2012-05-17  3:38           ` Alex Williamson
2012-05-17  3:39           ` 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=1337200755.6954.269.camel@bling.home \
    --to=alex.williamson@redhat.com \
    --cc=agraf@suse.de \
    --cc=aik@ozlabs.ru \
    --cc=anthony@codemonkey.ws \
    --cc=kvm@vger.kernel.org \
    --cc=qemu-devel@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).