On Tue, Jul 05, 2022 at 04:22:35PM +1000, Alexey Kardashevskiy wrote: > I have not looked into the domains for ages, what is missing here? With this > on top of 5.19-rc1 VFIO works again on my POWER9 box. Thanks, Does this solve all the problems or just coherency? It seems like it should solve everything now as there will be a IOMMU_DOMAIN_BLOCKED and the ref logic will succeed to assign it? > +static struct iommu_domain *spapr_tce_iommu_domain_alloc(unsigned int type) > +{ > + struct iommu_domain *domain = kzalloc(sizeof(*domain), GFP_KERNEL); > + > + if (!domain) > + return NULL; This should only succeed if type is IOMMU_DOMAIN_BLOCKED > +static struct iommu_group *spapr_tce_iommu_device_group(struct device *dev) > +{ > + struct iommu_group *grp = dev->iommu_group; > + > + if (!grp) > + grp = ERR_PTR(-ENODEV); It looks like this should just always fail since the code code already checks iommu_group before calling this? (Arguably ppc should be refactored to use the normal probe_device and device_group ops to create groups, but that doesn't seem critical for this. Thanks Jason