From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34465) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjP7E-0006kI-IJ for qemu-devel@nongnu.org; Mon, 12 Sep 2016 07:09:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bjP7D-00067J-Kg for qemu-devel@nongnu.org; Mon, 12 Sep 2016 07:09:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35474) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjP7D-00067C-Ek for qemu-devel@nongnu.org; Mon, 12 Sep 2016 07:09:31 -0400 Date: Mon, 12 Sep 2016 19:09:25 +0800 From: Peter Xu Message-ID: <20160912110925.GF3776@pxdev.xzpeter.org> References: <1473674889-2727-1-git-send-email-davidkiarie4@gmail.com> <1473674889-2727-3-git-send-email-davidkiarie4@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1473674889-2727-3-git-send-email-davidkiarie4@gmail.com> Subject: Re: [Qemu-devel] [v4 2/6] hw/i386: enforce SID verification List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: David Kiarie Cc: qemu-devel@nongnu.org, jan.kiszka@web.de, mst@redhat.com, rkrcmar@redhat.com, ehabkost@redhat.com, pbonzini@redhat.com, alex.williamson@redhat.com On Mon, Sep 12, 2016 at 01:08:05PM +0300, David Kiarie wrote: [...] > @@ -2252,14 +2250,17 @@ static MemTxResult vtd_mem_ir_write(void *opaque, hwaddr addr, > { > int ret = 0; > MSIMessage from = {}, to = {}; > - uint16_t sid = X86_IOMMU_SID_INVALID; > + VTDAddressSpace *as = opaque; > + uint16_t sid = PCI_BUILD_BDF(pci_bus_num(as->bus), as->devfn); I remembered to have commented on this... PCI_BUILD_BDF() should be problematic. SID may not be built that way when with PCI bridges (or say, I think current code won't work with PCI bridges). Please see commit: commit 4a94b3aa6d97dfa67a20c7a0315c9773352f0e8e Author: Peter Xu Date: Tue May 17 19:26:10 2016 +0800 pci: fix pci_requester_id() That's why we explicitly differenciate BDF and SID. I would suggest to make it simpler: we just do not do this extra check, and pass attrs.requester_id to vtd_interrupt_remap_msi() directly. Thanks, -- peterx