Re: [PATCH 3/5] x86/mm: Introduce and export interface arch_clean_nonsnoop_dma()

From: Christoph Hellwig
Date: Tue May 28 2024 - 02:37:48 EST


On Tue, May 21, 2024 at 01:00:16PM -0300, Jason Gunthorpe wrote:
> > > Err, no. There should really be no exported cache manipulation macros,
> > > as drivers are almost guaranteed to get this wrong. I've added
> > > Russell to the Cc list who has been extremtly vocal about this at least
> > > for arm.
> >
> > We could possibly move this under some IOMMU core API (ie flush and
> > map, unmap and flush), the iommu APIs are non-modular so this could
> > avoid the exported symbol.
>
> Though this would be pretty difficult for unmap as we don't have the
> pfns in the core code to flush. I don't think we have alot of good
> options but to make iommufd & VFIO handle this directly as they have
> the list of pages to flush on the unmap side. Use a namespace?

Just have a unmap version that also takes a list of PFNs that you'd
need for non-coherent mappings?