From: Alexey Kardashevskiy <aik@ozlabs.ru>
To: Anthony Liguori <aliguori@us.ibm.com>
Cc: "Michael S . Tsirkin" <mst@redhat.com>,
qemu-trivial@nongnu.org, qemu-devel@nongnu.org,
Alexander Graf <agraf@suse.de>,
Alex Williamson <alex.williamson@redhat.com>,
qemu-ppc@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>,
Paul Mackerras <paulus@samba.org>,
David Gibson <david@gibson.dropbear.id.au>
Subject: Re: [Qemu-devel] [PATCH] RFC kvm irqfd: add directly mapped MSI IRQ support
Date: Fri, 21 Jun 2013 09:51:20 +1000 [thread overview]
Message-ID: <51C39578.6020204@ozlabs.ru> (raw)
In-Reply-To: <874ncshh67.fsf@codemonkey.ws>
On 06/21/2013 02:37 AM, Anthony Liguori wrote:
> Alexey Kardashevskiy <aik@ozlabs.ru> writes:
>
>> At the moment QEMU creates a route for every MSI IRQ.
>>
>> Now we are about to add IRQFD support on PPC64-pseries platform.
>> pSeries already has in-kernel emulated interrupt controller with
>> 8192 IRQs. Also, pSeries PHB already supports MSIMessage to IRQ
>> mapping as a part of PAPR requirements for MSI/MSIX guests.
>> Specifically, the pSeries guest does not touch MSIMessage's at
>> all, instead it uses rtas_ibm_change_msi and rtas_ibm_query_interrupt_source
>> rtas calls to do the mapping.
>>
>> Therefore we do not really need more routing than we got already.
>> The patch introduces the infrastructure to enable direct IRQ mapping.
>>
>> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
>>
>> ---
>>
>> The patch is raw and ugly indeed, I made it only to demonstrate
>> the idea and see if it has right to live or not.
>>
>> For some reason which I do not really understand (limited GSI numbers?)
>> the existing code always adds routing and I do not see why we would need it.
>>
>> Thanks!
>> ---
>> hw/misc/vfio.c | 11 +++++++++--
>> hw/pci/pci.c | 13 +++++++++++++
>> hw/ppc/spapr_pci.c | 13 +++++++++++++
>> hw/virtio/virtio-pci.c | 26 ++++++++++++++++++++------
>> include/hw/pci/pci.h | 4 ++++
>> include/hw/pci/pci_bus.h | 1 +
>> 6 files changed, 60 insertions(+), 8 deletions(-)
>>
>> diff --git a/hw/misc/vfio.c b/hw/misc/vfio.c
>> index 14aac04..2d9eef7 100644
>> --- a/hw/misc/vfio.c
>> +++ b/hw/misc/vfio.c
>> @@ -639,7 +639,11 @@ static int vfio_msix_vector_do_use(PCIDevice *pdev, unsigned int nr,
>> * Attempt to enable route through KVM irqchip,
>> * default to userspace handling if unavailable.
>> */
>> - vector->virq = msg ? kvm_irqchip_add_msi_route(kvm_state, *msg) : -1;
>> +
>> + vector->virq = msg ? pci_bus_map_msi(vdev->pdev.bus, *msg) : -1;
>> + if (vector->virq < 0) {
>> + vector->virq = msg ? kvm_irqchip_add_msi_route(kvm_state, *msg) : -1;
>> + }
>> if (vector->virq < 0 ||
>> kvm_irqchip_add_irqfd_notifier(kvm_state, &vector->interrupt,
>> vector->virq) < 0) {
>> @@ -807,7 +811,10 @@ retry:
>> * Attempt to enable route through KVM irqchip,
>> * default to userspace handling if unavailable.
>> */
>> - vector->virq = kvm_irqchip_add_msi_route(kvm_state, msg);
>> + vector->virq = pci_bus_map_msi(vdev->pdev.bus, msg);
>> + if (vector->virq < 0) {
>> + vector->virq = kvm_irqchip_add_msi_route(kvm_state, msg);
>> + }
>
> I don't understand why you're adding a pci level hook verses just having
> a kvmppc specific hook in the kvm_irqchip_add_msi_route function..
Me neither :) I am just asking. The existing mapping code already exists in
sPAPR PCI host bridge and it is not going anywhere else.
And kvm_irqchip_add_msi_route does not have any link to a device or a bus
so I'll have to walk through all PHBs in system and see if PHB's MSI window
is the one from MSIMessage and convert MSIMessage to virq. Pretty easy and
quick but still dirty hack, would it be better?
--
Alexey
next prev parent reply other threads:[~2013-06-20 23:51 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-20 14:08 [Qemu-devel] [PATCH] RFC kvm irqfd: add directly mapped MSI IRQ support Alexey Kardashevskiy
2013-06-20 15:38 ` Michael S. Tsirkin
2013-06-20 16:37 ` Anthony Liguori
2013-06-20 23:51 ` Alexey Kardashevskiy [this message]
2013-06-23 14:07 ` Michael S. Tsirkin
2013-06-23 15:02 ` Anthony Liguori
2013-06-23 21:39 ` [Qemu-devel] [Qemu-ppc] " Benjamin Herrenschmidt
2013-06-23 21:58 ` Anthony Liguori
2013-06-24 4:46 ` Alex Williamson
2013-06-24 12:24 ` Anthony Liguori
2013-06-24 12:39 ` Gleb Natapov
2013-06-23 21:36 ` [Qemu-devel] " Benjamin Herrenschmidt
2013-06-24 12:10 ` Michael S. Tsirkin
2013-06-20 16:51 ` Alex Williamson
2013-06-21 1:56 ` Alexey Kardashevskiy
2013-06-21 2:34 ` Alex Williamson
2013-06-21 2:49 ` Alexey Kardashevskiy
2013-06-21 4:46 ` Alex Williamson
2013-06-21 5:12 ` Benjamin Herrenschmidt
2013-06-21 6:03 ` Alex Williamson
2013-06-21 6:12 ` Benjamin Herrenschmidt
2013-06-21 6:40 ` Alexey Kardashevskiy
2013-06-23 15:06 ` Anthony Liguori
2013-06-24 4:44 ` Alex Williamson
2013-06-24 12:25 ` Anthony Liguori
2013-06-24 7:13 ` Gleb Natapov
2013-06-24 12:32 ` Anthony Liguori
2013-06-24 12:37 ` Alexander Graf
2013-06-24 13:06 ` Gleb Natapov
2013-06-24 13:34 ` Anthony Liguori
2013-06-24 13:41 ` Michael S. Tsirkin
2013-06-24 14:31 ` Anthony Liguori
2013-06-24 14:34 ` Alexander Graf
2013-06-24 15:17 ` Anthony Liguori
2013-06-24 16:48 ` Gleb Natapov
2013-06-24 16:35 ` Gleb Natapov
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=51C39578.6020204@ozlabs.ru \
--to=aik@ozlabs.ru \
--cc=agraf@suse.de \
--cc=alex.williamson@redhat.com \
--cc=aliguori@us.ibm.com \
--cc=david@gibson.dropbear.id.au \
--cc=mst@redhat.com \
--cc=paulus@samba.org \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=qemu-trivial@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).