From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43070) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b02lD-0000SN-ET for qemu-devel@nongnu.org; Tue, 10 May 2016 04:11:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b02l9-0005sR-10 for qemu-devel@nongnu.org; Tue, 10 May 2016 04:11:18 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53890) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b02l8-0005sH-Ro for qemu-devel@nongnu.org; Tue, 10 May 2016 04:11:14 -0400 Date: Tue, 10 May 2016 16:11:08 +0800 From: Peter Xu Message-ID: <20160510081108.GC22463@pxdev.xzpeter.org> References: <1462418761-12714-1-git-send-email-peterx@redhat.com> <1462418761-12714-25-git-send-email-peterx@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1462418761-12714-25-git-send-email-peterx@redhat.com> Subject: Re: [Qemu-devel] [PATCH v6 24/26] kvm-irqchip: i386: add hook for add/remove virq List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: imammedo@redhat.com, rth@twiddle.net, ehabkost@redhat.com, jasowang@redhat.com, marcel@redhat.com, mst@redhat.com, pbonzini@redhat.com, jan.kiszka@web.de, rkrcmar@redhat.com, alex.williamson@redhat.com, wexu@redhat.com, davidkiarie4@gmail.com On Thu, May 05, 2016 at 11:25:59AM +0800, Peter Xu wrote: > Adding two hooks to be notified when adding/removing msi routes. On x86 > platform, one list is maintained for all existing msi routes. > > Signed-off-by: Peter Xu > --- > include/sysemu/kvm.h | 6 ++++++ > kvm-all.c | 2 ++ > target-arm/kvm.c | 11 +++++++++++ > target-i386/kvm.c | 38 ++++++++++++++++++++++++++++++++++++++ > target-mips/kvm.c | 11 +++++++++++ > target-ppc/kvm.c | 11 +++++++++++ > target-s390x/kvm.c | 11 +++++++++++ > trace-events | 2 ++ > 8 files changed, 92 insertions(+) [...] > diff --git a/target-i386/kvm.c b/target-i386/kvm.c > index d1a4d77..f043e45 100644 > --- a/target-i386/kvm.c > +++ b/target-i386/kvm.c > @@ -3355,6 +3355,44 @@ int kvm_arch_fixup_msi_route(struct kvm_irq_routing_entry *route, > return 0; > } > > +typedef struct MSIRouteEntry MSIRouteEntry; > + > +struct MSIRouteEntry { > + PCIDevice *dev; /* Device pointer */ > + int vector; /* MSI/MSIX vector index */ > + int virq; /* Virtual IRQ index */ > + QLIST_ENTRY(MSIRouteEntry) list; > +}; > + > +/* List of used GSI routes */ > +static QLIST_HEAD(, MSIRouteEntry) msi_route_list = \ > + QLIST_HEAD_INITIALIZER(msi_route_list); > + > +int kvm_arch_add_msi_route_post(struct kvm_irq_routing_entry *route, > + int vector, PCIDevice *dev) > +{ > + MSIRouteEntry *entry = g_new0(MSIRouteEntry, 1); Ah... Here, I should skip all IOAPIC msi routes by checking whether dev == NULL. We should only care about irqfd users, while IOAPIC has its own notifier. Will fix this in next version. -- peterx