On Tue, Sep 20, 2022 at 11:04:57PM +1000, Alexey Kardashevskiy wrote: > Up until now PPC64 managed to avoid using iommu_ops. The VFIO driver > uses a SPAPR TCE sub-driver and all iommu_ops uses were kept in > the Type1 VFIO driver. Recent development added 2 uses of iommu_ops to > the generic VFIO which broke POWER: > - a coherency capability check; > - blocking IOMMU domain - iommu_group_dma_owner_claimed()/... > > This adds a simple iommu_ops which reports support for cache > coherency and provides a basic support for blocking domains. No other > domain types are implemented so the default domain is NULL. > > Since now iommu_ops controls the group ownership, this takes it out of > VFIO. > > This adds an IOMMU device into a pci_controller (=PHB) and registers it > in the IOMMU subsystem, iommu_ops is registered at this point. > This setup is done in postcore_initcall_sync. > > This replaces iommu_group_add_device() with iommu_probe_device() as > the former misses necessary steps in connecting PCI devices to IOMMU > devices. This adds a comment about why explicit iommu_probe_device() > is still needed. > > Fixes: e8ae0e140c05 ("vfio: Require that devices support DMA cache coherence") > Fixes: 70693f470848 ("vfio: Set DMA ownership for VFIO devices") > Cc: Deming Wang <wangdeming@xxxxxxxxxx> > Cc: Robin Murphy <robin.murphy@xxxxxxx> > Cc: Jason Gunthorpe <jgg@xxxxxxxxxx> > Cc: Alex Williamson <alex.williamson@xxxxxxxxxx> > Cc: Daniel Henrique Barboza <danielhb413@xxxxxxxxx> > Cc: Fabiano Rosas <farosas@xxxxxxxxxxxxx> > Cc: Murilo Opsfelder Araujo <muriloo@xxxxxxxxxxxxx> > Cc: Nicholas Piggin <npiggin@xxxxxxxxx> > Signed-off-by: Alexey Kardashevskiy <aik@xxxxxxxxx> > --- > Changes: > v2: > * replaced a default domain with blocked Code wise this is much better.. But it is a bit unsettling to see the blocked domain co-opted to mean 'some platform specific VFIO behavior' - don't have a better idea for this series though. Reviewed-by: Jason Gunthorpe <jgg@xxxxxxxxxx> Jason