From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43840) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjPoi-0007Wr-KL for qemu-devel@nongnu.org; Mon, 12 Sep 2016 07:54:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bjPod-0002uT-1U for qemu-devel@nongnu.org; Mon, 12 Sep 2016 07:54:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43642) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjPoc-0002uK-Rt for qemu-devel@nongnu.org; Mon, 12 Sep 2016 07:54:22 -0400 Date: Mon, 12 Sep 2016 19:54:16 +0800 From: Peter Xu Message-ID: <20160912115416.GI3776@pxdev.xzpeter.org> References: <1473674889-2727-1-git-send-email-davidkiarie4@gmail.com> <1473674889-2727-2-git-send-email-davidkiarie4@gmail.com> <20160912110227.GE3776@pxdev.xzpeter.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [v4 1/6] hw/msi: Allow platform devices to use explicit SID List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: David Kiarie Cc: QEMU Developers , Jan Kiszka , "Michael S. Tsirkin" , rkrcmar@redhat.com, Eduardo Habkost , Paolo Bonzini , Alex Williamson On Mon, Sep 12, 2016 at 02:26:14PM +0300, David Kiarie wrote: [...] > > > -int kvm_irqchip_add_msi_route(KVMState *s, int vector, PCIDevice *dev) > > > +int kvm_irqchip_add_msi_route(KVMState *s, int vector, PCIDevice *dev, > > uint16_t requester_id) > > > { > > > struct kvm_irq_routing_entry kroute = {}; > > > int virq; > > > @@ -1275,7 +1275,8 @@ int kvm_irqchip_add_msi_route(KVMState *s, int > > vector, PCIDevice *dev) > > > kroute.u.msi.address_lo = (uint32_t)msg.address; > > > kroute.u.msi.address_hi = msg.address >> 32; > > > kroute.u.msi.data = le32_to_cpu(msg.data); > > > - if (kvm_arch_fixup_msi_route(&kroute, msg.address, msg.data, dev)) > > { > > > + if (kvm_arch_fixup_msi_route(&kroute, msg.address, msg.data, > > > + requester_id)) { > > > > Can we just remove the PCIDevice parameter directly? I didn't go > > deeper, but it seems to be explicitly introduced here: > > > > commit dc9f06ca81e6e16d062ec382701142a3a2ab3f7d > > Author: Pavel Fedin > > Date: Thu Oct 15 16:44:52 2015 +0300 > > > > kvm: Pass PCI device pointer to MSI routing functions > > > > And we'd better make sure we really wanted to remove it. > > > > Also, I think we need to modify all target-*/kvm.c for this interface > > change? > > > > The current code keeps track of PCI devices for purposes of easily > constructing MSI messages > > e.g in kvm_update_msi_routes_all which means to get rid of PCI device > pointer means we need another way to keep track of PCI devices. Actually I mean kvm_arch_fixup_msi_route(), not kvm_{add|update}_msi_routes_all(). It looks like above commit (dc9f06ca81e) was preparing to pass in SID in the future for ARM (though still haven't implemented on QEMU side). So maybe removing PCIDevice is okay in this one since you are passing in the SID directly. However I think possibly Paolo is the best one to know the truth... No matter what, you may still need to change the interface for other platforms. Just try to grep kvm_arch_fixup_msi_route() in target-*/ directories. Thanks, -- peterx