From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35545) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjPBR-0001qN-Hb for qemu-devel@nongnu.org; Mon, 12 Sep 2016 07:13:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bjPBN-0007cC-A6 for qemu-devel@nongnu.org; Mon, 12 Sep 2016 07:13:52 -0400 Received: from mail-yw0-f176.google.com ([209.85.161.176]:34229) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjPBN-0007c7-3Z for qemu-devel@nongnu.org; Mon, 12 Sep 2016 07:13:49 -0400 Received: by mail-yw0-f176.google.com with SMTP id g192so81692771ywh.1 for ; Mon, 12 Sep 2016 04:13:49 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <20160912110925.GF3776@pxdev.xzpeter.org> References: <1473674889-2727-1-git-send-email-davidkiarie4@gmail.com> <1473674889-2727-3-git-send-email-davidkiarie4@gmail.com> <20160912110925.GF3776@pxdev.xzpeter.org> From: David Kiarie Date: Mon, 12 Sep 2016 14:12:48 +0300 Message-ID: Content-Type: text/plain; charset=UTF-8 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: Peter Xu Cc: QEMU Developers , Jan Kiszka , "Michael S. Tsirkin" , rkrcmar@redhat.com, Eduardo Habkost , Paolo Bonzini , Alex Williamson On Mon, Sep 12, 2016 at 2:09 PM, Peter Xu wrote: > 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. > Yes, we did discuss this but didn't come up with a conclusion so I stuck with the check. I will remove the check in the next version. > Thanks, > > -- peterx >