On Wed, 2025-02-05 at 16:40 +0200, Leon Romanovsky wrote: > From: Christoph Hellwig <hch@xxxxxx> > > For the upcoming IOVA-based DMA API we want to use the interface batch the > sync after mapping multiple entries from dma-iommu without having a > scatterlist. > > For that move more sanity checks from the callers into __iommu_map and > make that function available outside of iommu.c as iommu_map_nosync. > > Add a wrapper for the map_sync as iommu_sync_map so that callers don't > need to poke into the methods directly. > > Signed-off-by: Christoph Hellwig <hch@xxxxxx> > Acked-by: Will Deacon <will@xxxxxxxxxx> > Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxx> > --- > drivers/iommu/iommu.c | 65 +++++++++++++++++++------------------------ > include/linux/iommu.h | 4 +++ > 2 files changed, 33 insertions(+), 36 deletions(-) > > --- snip --- > + > return mapped; > > out_err: > diff --git a/include/linux/iommu.h b/include/linux/iommu.h > index 38c65e92ecd0..7ae9aa3a1894 100644 > --- a/include/linux/iommu.h > +++ b/include/linux/iommu.h > @@ -857,6 +857,10 @@ extern struct iommu_domain *iommu_get_domain_for_dev(struct device *dev); > extern struct iommu_domain *iommu_get_dma_domain(struct device *dev); > extern int iommu_map(struct iommu_domain *domain, unsigned long iova, > phys_addr_t paddr, size_t size, int prot, gfp_t gfp); > +int iommu_map_nosync(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); There are two different word orders in the function names. iommu_sync_map() vs iommu_map_nosync(). I'd prefer to be consistent with e.g. iommu_map_sync() vs iommu_map_nosync(). > extern size_t iommu_unmap(struct iommu_domain *domain, unsigned long iova, > size_t size); > extern size_t iommu_unmap_fast(struct iommu_domain *domain,