[PATCH 3/5] iommu: Introduce the domain op enforce_cache_coherency()

Jason Gunthorpe jgg at nvidia.com
Wed Apr 6 05:27:38 PDT 2022


On Wed, Apr 06, 2022 at 07:09:49AM +0000, Tian, Kevin wrote:
> > From: Jason Gunthorpe <jgg at nvidia.com>
> > Sent: Wednesday, April 6, 2022 12:16 AM
> > 
> > This new mechanism will replace using IOMMU_CAP_CACHE_COHERENCY
> > and
> > IOMMU_CACHE to control the no-snoop blocking behavior of the IOMMU.
> > 
> > Currently only Intel and AMD IOMMUs are known to support this
> > feature. They both implement it as an IOPTE bit, that when set, will cause
> > PCIe TLPs to that IOVA with the no-snoop bit set to be treated as though
> > the no-snoop bit was clear.
> > 
> > The new API is triggered by calling enforce_cache_coherency() before
> > mapping any IOVA to the domain which globally switches on no-snoop
> > blocking. This allows other implementations that might block no-snoop
> > globally and outside the IOPTE - AMD also documents such an HW capability.
> > 
> > Leave AMD out of sync with Intel and have it block no-snoop even for
> > in-kernel users. This can be trivially resolved in a follow up patch.
> > 
> > Only VFIO will call this new API.
> 
> Is it too restrictive? In theory vdpa may also implement a contract with
> KVM and then wants to call this new API too?

I expect iommufd to handle this for all kernel users eventually.

Certainly vdpa should not be calling kvm functions.

Jason



More information about the linux-arm-kernel mailing list