> From: Jason Gunthorpe <jgg@xxxxxxxx> > Sent: Tuesday, July 5, 2022 8:49 AM > > On Fri, Jul 01, 2022 at 07:10:45AM +0000, Tian, Kevin wrote: > > > From: Alexey Kardashevskiy <aik@xxxxxxxxx> > > > Sent: Friday, July 1, 2022 2:18 PM > > > > > > VFIO on POWER does not implement iommu_ops and therefore > > > iommu_capable() > > > always returns false and __iommu_group_alloc_blocking_domain() > always > > > fails. > > > > > > iommu_group_claim_dma_owner() in setting container fails for the same > > > reason - it cannot allocate a domain. > > > > > > This skips the check for platforms supporting VFIO without implementing > > > iommu_ops which to my best knowledge is POWER only. > > > > > > This also allows setting container in absence of iommu_ops. > > > > > > Fixes: 70693f470848 ("vfio: Set DMA ownership for VFIO devices") > > > Fixes: e8ae0e140c05 ("vfio: Require that devices support DMA cache > > > coherence") > > > Signed-off-by: Alexey Kardashevskiy <aik@xxxxxxxxx> > > > --- > > > > > > Not quite sure what the proper small fix is and implementing iommu_ops > > > on POWER is not going to happen any time soon or ever :-/ > > > > I'm not sure how others feel about checking bus->iommu_ops outside > > of iommu subsystem. This sounds a bit non-modular to me and it's not > > obvious from the caller side why lacking of iommu_ops implies the two > > relevant APIs are not usable. > > The more I think about this, the more I think POWER should implement > partial iommu_ops to make this work. It would not support an UNMANAGED > domain, or default domains, but it would support blocking and the > coherency probe. Yes, this sounds a better approach. > > This makes everything work properly and keeps the mess out of the core > code. > > It should not be hard to do if someone can share a bit about the ppc > code and test it.. > > Jason