On Wed, Feb 12, 2020 at 07:15:13AM +0000, Liu, Yi L wrote: > Hi Peter, > > > From: Peter Xu > > Sent: Wednesday, February 12, 2020 12:59 AM > > To: Liu, Yi L > > Subject: Re: [RFC v3 03/25] hw/iommu: introduce IOMMUContext > > > > On Fri, Jan 31, 2020 at 11:42:13AM +0000, Liu, Yi L wrote: > > > > I'm not very clear on the relationship betwen an IOMMUContext and a > > > > DualStageIOMMUObject. Can there be many IOMMUContexts to a > > > > DualStageIOMMUOBject? The other way around? Or is it just > > > > zero-or-one DualStageIOMMUObjects to an IOMMUContext? > > > > > > It is possible. As the below patch shows, DualStageIOMMUObject is per vfio > > > container. IOMMUContext can be either per-device or shared across devices, > > > it depends on vendor specific vIOMMU emulators. > > > > Is there an example when an IOMMUContext can be not per-device? > > No, I don’t have such example so far. But as IOMMUContext is got from > pci_device_iommu_context(), in concept it possible to be not per-device. > It is kind of leave to vIOMMU to decide if different devices could share a > single IOMMUContext. On the "pseries" machine the vIOMMU only has one set of translations for a whole virtual PCI Host Bridge (vPHB). So if you attach multiple devices to a single vPHB, I believe you'd get multiple devices in an IOMMUContext. Well.. if we did the PASID stuff, which we don't at the moment. Note that on pseries on the other hand it's routine to create multiple vPHBs, rather than multiple PCI roots being an oddity as it is on x86. -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson