From: Alex Williamson <alex.williamson@redhat.com>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Alexey Kardashevskiy <aik@ozlabs.ru>,
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 21:38:12 -0600 [thread overview]
Message-ID: <1337225892.6954.294.camel@bling.home> (raw)
In-Reply-To: <1337223641.30558.40.camel@pasglop>
On Thu, 2012-05-17 at 13:00 +1000, Benjamin Herrenschmidt wrote:
> On Thu, 2012-05-17 at 12:16 +1000, Alexey Kardashevskiy wrote:
>
> > > 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.
> >
> >
> > You mean notifiers like these: ioapic_add_gsi_eoi_notifier?
> > I did not drop them, we need them so I implemented them for XICS interrupt controller.
>
> So I haven't completely understood the problem, however:
>
> .../...
>
> > So it stores global IRQs in the config space but it really unclear who writes these _global_ numbers
> > there. Is it the guest who allocates IRQs and writes the numbers into the config space so QEMU knows
> > what pin is what IRQ? If so, I am wrong, you are right :)
Yes, from the piix4 spec:
4.1.10.
PIRQRC[A:D]—PIRQX ROUTE CONTROL REGISTERS (FUNCTION 0)
Address Offset: 60h (PIRQRCA#)–63h (PIRQRCD#)
Default Value: 80h
Attribute: R/W
These registers control the routing of the PIRQ[A:D]# signals to
the IRQ inputs of the interrupt controller. Each PIRQx# can be
independently routed to any one of 11 interrupts. All four
PIRQx# lines can be routed to the same IRQx input. Note that the
IRQ that is selected through bits [3:0] must be set to level
sensitive mode in the corresponding ELCR Register. When a PIRQ
signal is routed to an interrupt controller IRQ, PIIX4 masks the
corresponding IRQ signal.
Touching this register directly by the guest might be discouraged, but
we provide PCI interrupt link devices in ACPI namespace that allows the
guest to mess with this in a more indirect way.
> So you can certainly not write our global irq numbers in the config
> space, since the config space IRQ_LINE register is only 8 bits long
> which means it's not long enough.
>
> In general we don't use that register on ppc anyways, it's just a
> storage, it should have no actual effect on HW.
>
> The IRQ_PIN register however is important and needs to indicate
> which of the 4 interrupt lines associated with the bus the
> device will trigger, so we need to get that right especially
> vs. swizzling performed by intermediary bridges.
>
> Here, we can either show all the bridges to the guest (emulate
> them is fine) and keep the original PIN numbers, or we need
> to filter config space to change the PIN numbers seen by the
> guest to match the lack of appropriate swizzling.
That's a different problem. For this it doesn't matter which IRQ_PIN
the device claims to pull when signaling an interrupt so long as qemu
and the config space exposed to the guest are in agreement. We should
be able to easily virtualize IRQ_PIN if we want to avoid swizzling
problems. The problem here is that we've told qemu to fire the
interrupt to the guest for the device and have disabled the interrupt
for the physical device; how do we know when to re-enable it? An
emulated device sets the interrupt level back when the guest has
interacted with the device and there's nothing left to do. This happens
in the emulated driver code. For an assigned device we have no idea
what guest access indicates that the interrupt is done, so we try to
take advantage of PCI using level interrupts and figure out which EOI
corresponds to the interrupt we triggered. Thanks,
Alex
next prev parent reply other threads:[~2012-05-17 3:38 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
2012-05-17 2:16 ` Alexey Kardashevskiy
2012-05-17 3:00 ` Benjamin Herrenschmidt
2012-05-17 3:38 ` Alex Williamson [this message]
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=1337225892.6954.294.camel@bling.home \
--to=alex.williamson@redhat.com \
--cc=agraf@suse.de \
--cc=aik@ozlabs.ru \
--cc=anthony@codemonkey.ws \
--cc=benh@kernel.crashing.org \
--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).