[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250317134439.GX1322339@unreal>
Date: Mon, 17 Mar 2025 15:44:39 +0200
From: Leon Romanovsky <leon@...nel.org>
To: Niklas Schnelle <schnelle@...ux.ibm.com>
Cc: Christoph Hellwig <hch@....de>, Jason Gunthorpe <jgg@...pe.ca>,
Robin Murphy <robin.murphy@....com>, Jens Axboe <axboe@...nel.dk>,
Joerg Roedel <joro@...tes.org>, Will Deacon <will@...nel.org>,
Sagi Grimberg <sagi@...mberg.me>, Keith Busch <kbusch@...nel.org>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Logan Gunthorpe <logang@...tatee.com>,
Yishai Hadas <yishaih@...dia.com>,
Shameer Kolothum <shameerali.kolothum.thodi@...wei.com>,
Kevin Tian <kevin.tian@...el.com>,
Alex Williamson <alex.williamson@...hat.com>,
Marek Szyprowski <m.szyprowski@...sung.com>,
Jérôme Glisse <jglisse@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Jonathan Corbet <corbet@....net>, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-block@...r.kernel.org,
linux-rdma@...r.kernel.org, iommu@...ts.linux.dev,
linux-nvme@...ts.infradead.org, linux-pci@...r.kernel.org,
kvm@...r.kernel.org, linux-mm@...ck.org,
Randy Dunlap <rdunlap@...radead.org>
Subject: Re: [PATCH v7 03/17] iommu: generalize the batched sync after map
interface
On Mon, Mar 17, 2025 at 10:52:11AM +0100, Niklas Schnelle wrote:
> On Wed, 2025-02-05 at 16:40 +0200, Leon Romanovsky wrote:
> > From: Christoph Hellwig <hch@....de>
> >
> > 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@....de>
> > Acked-by: Will Deacon <will@...nel.org>
> > Signed-off-by: Leon Romanovsky <leonro@...dia.com>
> > ---
> > 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().
The naming came from refactoring different functions, one was simple *_map() and
another was iotlb_*_sync(), but yes we can name it consistently.
Thanks
>
> > 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,
>
Powered by blists - more mailing lists