> From: David Gibson < david@xxxxxxxxxxxxxxxxxxxxx > > Sent: Friday, February 14, 2020 1:36 PM > To: Liu, Yi L <yi.l.liu@xxxxxxxxx> > Subject: Re: [RFC v3 03/25] hw/iommu: introduce IOMMUContext > > On Wed, Feb 12, 2020 at 07:15:13AM +0000, Liu, Yi L wrote: > > Hi Peter, > > > > > From: Peter Xu <peterx@xxxxxxxxxx> > > > Sent: Wednesday, February 12, 2020 12:59 AM > > > To: Liu, Yi L <yi.l.liu@xxxxxxxxx> > > > 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. Thanks for the example, David. :-) BTW. I'll drop IOMMUContext in next version as the email below mentioned. Please feel free let me know your opinion. https://lists.gnu.org/archive/html/qemu-devel/2020-02/msg02874.html Regards, Yi Liu