Re: [PATCH v2 4/4] vfio: Require that devices support DMA cache coherence

Jason Gunthorpe
2022-04-08T13:37:34Z

On Fri, Apr 08, 2022 at 02:28:02PM +0100, Robin Murphy wrote:

> > > One nit. Is it logistically more reasonable to put this patch before
> > > changing VFIO to always set IOMMU_CACHE?
> >
> > For bisectability it has to be after
> >
> > iommu: Redefine IOMMU_CAP_CACHE_COHERENCY as the cap flag for IOMMU_CACHE
> >
> > Otherwise Intel iommu will stop working with VFIO
> >
> > The ordering is OK as is because no IOMMU that works with VFIO cares
> > about IOMMU_CACHE.
>
> The Arm SMMU drivers do (without it even coherent traffic would be
> downgraded to non-cacheable), but then they also handle
> IOMMU_CAP_CACHE_COHERENCY nonsensically, and it happens to work out since
> AFAIK there aren't (yet) any Arm-based systems where you can reasonably try
> to use VFIO that don't also have hardware-coherent PCI. Thus I don't think
> there's any risk of regression for us here.

Right, I was unclear, I meant 'requires IOMMU_CACHE to be unset to
work with VFIO'

Jason