On Tue, Apr 29, 2025 at 10:19:46AM +0800, Baolu Lu wrote: > > -int iommu_map(struct iommu_domain *domain, unsigned long iova, > > - phys_addr_t paddr, size_t size, int prot, gfp_t gfp) > > +int iommu_sync_map(struct iommu_domain *domain, unsigned long iova, size_t size) > > { > > const struct iommu_domain_ops *ops = domain->ops; > > - int ret; > > - > > - might_sleep_if(gfpflags_allow_blocking(gfp)); > > - /* Discourage passing strange GFP flags */ > > - if (WARN_ON_ONCE(gfp & (__GFP_COMP | __GFP_DMA | __GFP_DMA32 | > > - __GFP_HIGHMEM))) > > - return -EINVAL; > > + if (!ops->iotlb_sync_map) > > + return 0; > > + return ops->iotlb_sync_map(domain, iova, size); > > +} > > I am wondering whether iommu_sync_map() needs a return value. The > purpose of this callback is just to sync the TLB cache after new > mappings are created, which should effectively be a no-fail operation. Yeah, it is pretty much nonsense, the other flushes don't fail: void (*flush_iotlb_all)(struct iommu_domain *domain); int (*iotlb_sync_map)(struct iommu_domain *domain, unsigned long iova, size_t size); void (*iotlb_sync)(struct iommu_domain *domain, struct iommu_iotlb_gather *iotlb_gather); > Furthermore, currently no iommu driver implements this callback in a way > that returns a failure. Given s390 does weirdly fail sync_map but not sync this needs a bigger touch than just that. But what I really want to do is get rid of iotlb_sync_map and replace it with iotlb_sync, and feed the gather through the iommu_map path. It doesn't really make sense to have a special interface for this. So I think this patch is fine as is.. Jason