From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52283) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b2Zw2-00075G-0d for qemu-devel@nongnu.org; Tue, 17 May 2016 04:01:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b2Zvw-0000em-VJ for qemu-devel@nongnu.org; Tue, 17 May 2016 04:00:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55573) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b2Zvw-0000ei-Q4 for qemu-devel@nongnu.org; Tue, 17 May 2016 04:00:52 -0400 Date: Tue, 17 May 2016 16:00:47 +0800 From: Peter Xu Message-ID: <20160517080047.GC3285@pxdev.xzpeter.org> References: <1463467507-13358-1-git-send-email-peterx@redhat.com> <1463467507-13358-2-git-send-email-peterx@redhat.com> <20160517104414-mutt-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20160517104414-mutt-send-email-mst@redhat.com> Subject: Re: [Qemu-devel] [PATCH v3] pci: fix pci_requester_id() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: qemu-devel@nongnu.org, pbonzini@redhat.com, jan.kiszka@web.de, rkrcmar@redhat.com, alex.williamson@redhat.com On Tue, May 17, 2016 at 10:46:12AM +0300, Michael S. Tsirkin wrote: > On Tue, May 17, 2016 at 02:45:07PM +0800, Peter Xu wrote: > > This fix SID verification failure when IOMMU IR is enabled with PCI > > bridges. Existing pci_requester_id() is more like getting BDF info > > only. Renaming it to pci_get_bdf(). Meanwhile, we provide the correct > > implementation to get requester ID. VT-d spec 5.1.1 is a good reference > > to go, though it talks only about interrupt delivery, the rule works > > exactly the same for non-interrupt cases. > > > > Currently, there are three use cases for pci_requester_id(): > > > > - PCIX status bits: here we need BDF only, not requester ID. Replacing > > with pci_get_bdf(). > > - PCIe Error injection and MSI delivery: for both these cases, we are > > looking for requester IDs. Here we should use the new impl. > > > > To avoid a PCI walk every time we send MSI message, one requester_id > > field is added to PCIDevice to cache the result when we use it the first > > time. Here assumption is made that requester_id will never change > > during device lifecycle. > > That's wrong though. It can change if bus number changes. > > That's why I said add a pointer to the actual requester, > set it up during initialization, not on first use. Ah... So finally we need one more field for that... Will fix in v4. Thanks! -- peterx