From: Alexey Kardashevskiy <aik@ozlabs.ru>
To: Alex Williamson <alex.williamson@redhat.com>,
Jan Kiszka <jan.kiszka@siemens.com>
Cc: qemu-devel@nongnu.org, qemu-ppc@nongnu.org,
Alexander Graf <agraf@suse.de>,
David Gibson <david@gibson.dropbear.id.au>
Subject: Re: [Qemu-devel] [PATCH 0/2] RFC: powerpc-vfio: adding support
Date: Mon, 16 Jul 2012 13:51:57 +1000 [thread overview]
Message-ID: <50038FDD.6090409@ozlabs.ru> (raw)
In-Reply-To: <4FFE64D4.40808@ozlabs.ru>
Jan, Alex, ping?
On 12/07/12 15:47, Alexey Kardashevskiy wrote:
> On 12/07/12 15:29, Alex Williamson wrote:
>> On Thu, 2012-07-12 at 14:58 +1000, Alexey Kardashevskiy wrote:
>>> On 12/07/12 14:43, Alex Williamson wrote:
>>>> On Thu, 2012-07-12 at 14:38 +1000, Alexey Kardashevskiy wrote:
>>>>> On 12/07/12 14:31, Alex Williamson wrote:
>>>>>> On Thu, 2012-07-12 at 14:16 +1000, Alexey Kardashevskiy wrote:
>>>>>>> On 12/07/12 12:54, Alex Williamson wrote:
>>>>>>>> On Wed, 2012-07-11 at 12:25 +1000, Alexey Kardashevskiy wrote:
>>>>>>>>> On 11/07/12 02:57, Alex Williamson wrote:
>>>>>>>>>> On Tue, 2012-07-10 at 15:51 +1000, Alexey Kardashevskiy wrote:
>>>>>>>>>>> The two patches in this set are supposed to add VFIO support for POWER.
>>>>>>>>>>>
>>>>>>>>>>> The first one adds one more step in the initalizaion sequence which I am not
>>>>>>>>>>> sure is correct.
>>>>>>>>>>>
>>>>>>>>>>> The second patch adds actual VFIO support. It is not ready to submit but
>>>>>>>>>>> ready to discuss. I would like to get rid of all #ifdef TARGET_PPC64 in patch #2
>>>>>>>>>>> and I wonder if there is any plan to implement some generic EOI support code, etc.
>>>>>>>>>>
>>>>>>>>>> A generic EOI notifier is on my todo list, but I have no idea what it's
>>>>>>>>>> going to look like. As you know, I've got an ioapic specific notifier
>>>>>>>>>> in my tree, you add a spapr specific one. I welcome ideas on how to
>>>>>>>>>> create something generic that has a chance of being accepted. Thanks,
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> So far the only platform specific call is xxxx_add_gsi_eoi_notifier. The
>>>>>>>>> xxxx_remove_gsi_eoi_notifier only calls notifier_remove, you've got to fix yours
>>>>>>>>> ioapic_remove_gsi_eoi_notifier() as it does too much :)
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> The only place for placing "add_eoi" callback I can see right now is QEMUMachine as there is no
>>>>>>>>> unified machine interrupt controller - IOAPIC has its own type TYPE_IOAPIC_COMMON and XICS is not
>>>>>>>>> even a SysBusDevice. And the callback is not specific for any kind of bus so it cannot go to PCIBus.
>>>>>>>>>
>>>>>>>>> Does it sound reasonable?
>>>>>>>>
>>>>>>>> I suspect we'd need to somehow tie it into qemu_irq where both handlers
>>>>>>>> and notifiers are allocated so we don't really care the underlying
>>>>>>>> implementation. Something like qemu_add_irq_eoi_notifier(qemu_irq
>>>>>>>> irq, ...). It's another mess like adding the PCIBus interrupt line to
>>>>>>>> gsi effort though. Thanks,
>>>>>>>
>>>>>>>
>>>>>>> Tried. Added add_eoi_notifier() callback to qemu_irq, new IRQ allocator:
>>>>>>> qemu_irq *qemu_allocate_irqs2(qemu_irq_handler handler, void *opaque, int n,
>>>>>>> qemu_eoi_add_notifier add_notifier);
>>>>>>> and called it from the XICS initialization code.
>>>>>>>
>>>>>>> It could work out if pci_get_irq() or pci_route_irq_fn() returned qemu_irq but no, they just return
>>>>>>> a global IRQ number (pure or embedded in a struct) and there is no common way to resolve qemu_irq
>>>>>>> (and then add_eoi_notifier()) from that number within vfio_pci.
>>>>>>
>>>>>> Well GSI and qemu_irq are different address spaces. We still need GSI
>>>>>> for any kind of qemu bypass case.
>>>>>
>>>>> No, that is ok, we also need GSI because XICS and IOAPIC need it in the end.
>>>>>
>>>>>>> May be we could add the callback pointer into PCIINTxRoute?
>>>>>>
>>>>>> Maybe, but why is this PCI specific? Can't we call it as
>>>>>> qemu_add_irq_eoi_notifier(pdev->irq[0], Notifier)? That would work much
>>>>>> like qemu_set_irq, extracting the irq number from the IRQState and
>>>>>> passing it through to the add_notifier callback for IRQState until it
>>>>>> got to the ioapic/pic/xics.
>>>>>>
>>>>>> int qemu_add_irq_eoi_notifier(qemu_irq *irq, Notifier notifier)
>>>>>> {
>>>>>> if (!irq || !irq->add_eoi_notifier)
>>>>>> return -1;
>>>>>>
>>>>>> return irq->add_eoi_notifier(irq->opaque, irq->n, notifier);
>>>>>> }
>>>>>>
>>>>>
>>>>> Then we will have to entirely replace qemu_allocate_irqs() with qemu_allocate_irqs2() and pass some
>>>>> non-zero add_eoi_notifier() on every level, at least for PCI for now. I would like to avoid that if
>>>>> possible - hard to get accepted :)
>>>>
>>>> Yep, that's why I said it was the same kind of mess as the PCIBus intx
>>>> routing. It's intrusive, but qemu_irq is the common interrupt model so
>>>> we need to make use of it.
>>>
>>> There are 2 level of intrusion.
>>>
>>> 1. Fix PCIINTxRoute to return the GSI's qemu_irq as well.
>>
>> Slightly confusing because pdev->irq[] is a qemu_irq, but you want the
>> actual ioapic/pic/xics qemu_irq w/o walking through the various devices,
>> correct?
>
> Yes. The qemu_irq which corresponds to the GSI which pci_get_irq is returning.
>
>> I'm not sure what we do once we have it though. Do we get to
>> call something like the function outlined above on these "special"
>> qemu_irqs?
>
> They are not special but just "global". This is what hw/pc_piix.c allocates with qemu_allocate_irqs().
>
> Assuming we have properly initialized add_eoi_notifier() callback in the qemu_irq struct, we can
> easily add a notifier via this callback.
>
> Or I did not get the whole idea.
>
>>
>>> 2. Add add_eoi_notifier to all levels including PCI. As a part of this, we will have to add this
>>> callback to all pci_register_bus() calls to reach global interrupts via platform-specific PCI bus.
>>
>> Just like the PCI INTx route callback, most of these can just be
>> passthrough. We just need to get to the end qemu_irq that registered a
>> real add notifier. That might make it possible to do it w/o interfering
>> too much with other callers, I hope.
>
> Yes. This is why I propose to extend the PCIINTxRoute struct.
>
> Actually even adding a callback into QEMUMachine is not that bad idea.
>
> If a pointer to the struct QEMUMachine was passed into QEMUMachineInitFunc(), it would be the right
> place to init such callback, one per machine but not per every qemu_irq as it is the same for the
> whole machine and will not change.
>
>
>>> I would stay with 1). Is that bad?
>>
>> It still seems to present a rather large incongruity, but if we're
>> planning to cache the qemu_irq there anyway, maybe it's a secondary use.
>
> Cannot see how it is different from having pci_get_irq() or pci_route_irq_fn() though.
>
>
--
Alexey
next prev parent reply other threads:[~2012-07-16 3:52 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-10 5:51 [Qemu-devel] [PATCH 0/2] RFC: powerpc-vfio: adding support Alexey Kardashevskiy
2012-07-10 5:51 ` [Qemu-devel] [PATCH 1/2] pseries pci: spapr_finalize_pci_setup introduced Alexey Kardashevskiy
2012-07-10 5:51 ` [Qemu-devel] [PATCH 2/2] vfio-powerpc: added VFIO support Alexey Kardashevskiy
2012-07-10 16:55 ` Alex Williamson
2012-07-10 21:32 ` Benjamin Herrenschmidt
2012-07-10 21:48 ` Alex Williamson
2012-07-10 21:53 ` Benjamin Herrenschmidt
2012-07-11 2:54 ` Alexey Kardashevskiy
2012-07-11 3:10 ` Benjamin Herrenschmidt
2012-07-12 3:11 ` Alex Williamson
2012-07-12 8:47 ` Alexey Kardashevskiy
2012-07-10 22:26 ` Scott Wood
2012-07-10 23:55 ` Alexey Kardashevskiy
2012-07-11 0:04 ` Benjamin Herrenschmidt
2012-07-11 0:17 ` Alexey Kardashevskiy
2012-07-11 0:26 ` Benjamin Herrenschmidt
2012-07-10 16:57 ` [Qemu-devel] [PATCH 0/2] RFC: powerpc-vfio: adding support Alex Williamson
2012-07-11 2:25 ` Alexey Kardashevskiy
2012-07-12 2:54 ` Alex Williamson
2012-07-12 4:16 ` Alexey Kardashevskiy
2012-07-12 4:31 ` Alex Williamson
2012-07-12 4:38 ` Alexey Kardashevskiy
2012-07-12 4:43 ` Alex Williamson
2012-07-12 4:58 ` Alexey Kardashevskiy
2012-07-12 5:29 ` Alex Williamson
2012-07-12 5:47 ` Alexey Kardashevskiy
2012-07-16 3:51 ` Alexey Kardashevskiy [this message]
2012-07-23 5:32 ` [Qemu-devel] [PATCH 0/3] vfio-pci: reworking end-of-interrupt Alexey Kardashevskiy
2012-07-23 5:32 ` [Qemu-devel] [PATCH 1/3] xics: added end-of-interrupt (EOI) handlers Alexey Kardashevskiy
2012-07-23 5:32 ` [Qemu-devel] [PATCH 2/3] ioapic: removed obsolete ioapic_remove_gsi_eoi_notifier Alexey Kardashevskiy
2012-07-23 5:32 ` [Qemu-devel] [PATCH 3/3] vfio-pci: rework of EOI Alexey Kardashevskiy
2012-07-12 8:52 ` [Qemu-devel] [PATCH] RFC: vfio-powerpc: added VFIO support (v2) Alexey Kardashevskiy
2012-07-12 20:54 ` [Qemu-devel] [Qemu-ppc] " Blue Swirl
2012-07-12 21:37 ` Alex Williamson
2012-07-13 5:24 ` Alexey Kardashevskiy
2012-07-13 14:33 ` Blue Swirl
2012-07-12 22:35 ` Scott Wood
2012-07-13 5:31 ` Alexey Kardashevskiy
2012-07-13 3:47 ` [Qemu-devel] " Alex Williamson
2012-07-13 5:03 ` Alexey Kardashevskiy
2012-07-13 7:26 ` [Qemu-devel] [PATCH] RFC: vfio-powerpc: added VFIO support (v3) Alexey Kardashevskiy
2012-07-13 14:38 ` Blue Swirl
2012-07-13 15:07 ` Alex Williamson
2012-07-14 2:34 ` Alexey Kardashevskiy
2012-07-16 14:21 ` Alex Williamson
2012-07-16 21:17 ` Alex Williamson
2012-07-17 7:53 ` Alexey Kardashevskiy
2012-07-17 14:11 ` Alex Williamson
2012-07-18 11:09 ` [Qemu-devel] [PATCH] vfio-powerpc: added VFIO support (v4) Alexey Kardashevskiy
2012-07-18 14:14 ` Alex Williamson
2012-07-19 4:01 ` Alexey Kardashevskiy
2012-07-19 4:04 ` [Qemu-devel] [PATCH] vfio-powerpc: added VFIO support (v5) 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=50038FDD.6090409@ozlabs.ru \
--to=aik@ozlabs.ru \
--cc=agraf@suse.de \
--cc=alex.williamson@redhat.com \
--cc=david@gibson.dropbear.id.au \
--cc=jan.kiszka@siemens.com \
--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).