Received: from eggs.gnu.org ([2001:4830:134:3::10]:54969) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XiNgI-0000Ez-LT for qemu-devel@nongnu.org; Sun, 26 Oct 2014 09:16:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XiNg9-0005Y1-R9 for qemu-devel@nongnu.org; Sun, 26 Oct 2014 09:16:26 -0400 Message-ID: <1414329324.24636.48.camel@ori.omang.mine.nu> From: Knut Omang Date: Sun, 26 Oct 2014 14:15:24 +0100 In-Reply-To: <544CE3D7.4060003@web.de> References: <1413844443-28894-1-git-send-email-knut.omang@oracle.com> <1413844443-28894-3-git-send-email-knut.omang@oracle.com> <544CE3D7.4060003@web.de> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 2/2] intel_iommu: Add support for translation for devices behind bridges. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jan Kiszka Cc: Marcel Apfelbaum , Michael Tokarev , "Michael S. Tsirkin" , Mark Cave-Ayland , Alexander Graf , qemu-devel@nongnu.org, Andreas =?ISO-8859-1?Q?F=E4rber?= , =?ISO-8859-1?Q?Herv=E9?= Poussineau , Anthony Liguori , Stefan Weil , qemu-ppc@nongnu.org, Markus Armbruster , Richard Henderson On Sun, 2014-10-26 at 13:06 +0100, Jan Kiszka wrote: > On 2014-10-21 00:34, Knut Omang wrote: > > @@ -65,11 +66,12 @@ struct VTDContextCacheEntry { > > }; > > > > struct VTDAddressSpace { > > - uint8_t bus_num; > > + PCIDevice *dev; > > This change is not helpful for clean handling of non-PCI devices (i.e. > platform device interrupt remapping => you had to pull > Q35_PSEUDO_BUS_PLATFORM into intel_iommu, which is violating the > layering). Please leave bus_num in place - or convert to a 16-bit SID. Hmm - I see.. - the problem I tried to solve is that the bus number of devices below a root port or downstream switch has not been initialized when q35_host_dma_iommu is called, so what happens is that the device in the root port gets indexed as if it were on bus 0. I am not that familiar with what type of non-pci devices that exists but I suppose moving this up to the most generic device type that has a bus associated with it is one way to go. An alternative implementation that would work in the intel case would be to keep the list in intel_iommu but provide a callback that iommus can subscribe to to get notifications when bus numbers change? Knut > > uint8_t devfn; > > AddressSpace as; > > MemoryRegion iommu; > > IntelIOMMUState *iommu_state; > > + QLIST_ENTRY(VTDAddressSpace) iommu_next; /* For traversal by the iommu */ > > VTDContextCacheEntry context_cache_entry; > > }; > > > > Jan > >