From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50804) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UtCCB-00037W-SK for qemu-devel@nongnu.org; Sun, 30 Jun 2013 03:37:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UtCCA-0004GT-QX for qemu-devel@nongnu.org; Sun, 30 Jun 2013 03:37:15 -0400 Received: from mail-pd0-f178.google.com ([209.85.192.178]:39589) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UtCCA-0004G7-L6 for qemu-devel@nongnu.org; Sun, 30 Jun 2013 03:37:14 -0400 Received: by mail-pd0-f178.google.com with SMTP id w11so1862120pde.9 for ; Sun, 30 Jun 2013 00:37:13 -0700 (PDT) Message-ID: <51CFE022.1000600@ozlabs.ru> Date: Sun, 30 Jun 2013 17:37:06 +1000 From: Alexey Kardashevskiy MIME-Version: 1.0 References: <1372513521-10050-1-git-send-email-aik@ozlabs.ru> In-Reply-To: Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] RFCv3 kvm irqfd: support msimessage to irq translation in PHB List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: Anthony Liguori , "Michael S . Tsirkin" , Jan Kiszka , Alexander Graf , qemu-devel , Alex Williamson , qemu-ppc@nongnu.org, Paolo Bonzini , Paul Mackerras , David Gibson On 06/30/2013 12:28 AM, Anthony Liguori wrote: > On Sat, Jun 29, 2013 at 8:45 AM, Alexey Kardashevskiy wrote: >> On PPC64 systems MSI Messages are translated to system IRQ in a PCI >> host bridge. This is already supported for emulated MSI/MSIX but >> not for irqfd where the current QEMU allocates IRQ numbers from >> irqchip and maps MSIMessages to those IRQ in the host kernel. >> >> The patch extends irqfd support in order to avoid unnecessary >> mapping and reuse the one which already exists in a PCI host bridge. >> >> Specifically, a map_msi callback is added to PCIBus and pci_bus_map_msi() >> to PCI API. The latter returns -1 if a specific PHB does not provide >> with any trsnslation so the existing code will work. > > I think there's a bit of confusion here. The kernel needs a "virq" > number to create an eventfd. virq is just a KVM concept, it doesn't > correspond to anything useful in hardware. > > On pseries, there is a 1-1 mapping between XICS IRQs and VIRQs and MSI > can be trivially mapped to a virq. > > On x86, we need to call a special kernel function which essentially > creates an apic message->virq mapping such that we can deliver the > irqfd. > > So what this should look like is: > > 1) A PCI bus function to do the MSI -> virq mapping > 2) On x86 (and e500), this is implemented by calling kvm_irqchip_add_msi_route() > 3) On pseries, this just returns msi->data > > Perhaps (2) can just be the default PCI bus implementation to simplify things. > >> Signed-off-by: Alexey Kardashevskiy >> >> --- >> >> Looks like we agreed that in general PHB is the right place for this, >> not KVM, so I am trying again. >> >> Probably something should be done to kvm_irqchip_update_msi_route() >> as well but I do not really understand what exactly. Any suggestions? Ah. Everybody ignored, I'll try asking again :) kvm_irqchip_update_msi_route() - where should it go? What is it for? virtio-pci and pci device assignment use it but vfio does not - is it a bug of vfio? Thanks. -- Alexey