Re: [PATCH v2 1/4] iommu: Introduce the domain op enforce_cache_coherency()

Jason Gunthorpe
2022-04-11T14:11:19Z

On Fri, Apr 08, 2022 at 08:05:38AM +0000, Tian, Kevin wrote:
> > From: Jason Gunthorpe <jgg@nvidia.com>
> > Sent: Thursday, April 7, 2022 11:24 PM
> >
> > 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 a 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.
>
> I still didn't see the point of mandating a caller for a new API (and as
> you pointed out iommufd will call it too).

The language is not to mandate, but to explain why this hasn't come
with a core iommu wrapper function to call it.

> it reads like no_snoop is the result of the enforcement... Probably
> force_snooping better matches the intention here.

Done

Thanks,
Jason