On Wed, Mar 08, 2023 at 09:04:47PM +0800, Baolu Lu wrote: > > + /* Try to upgrade the domain we have */ > > + if (idev->enforce_cache_coherency) { > > + rc = iommufd_hw_pagetable_enforce_cc(hwpt); > > + if (rc) > > + return rc; > > As "HWPT should have the coherency set properly for the device that it > is being created for when it is created", is it an incompatible case if > > idev->enforce_cache_coherency && !hwpt->enforce_cache_coherency > > ? > > If so, why not, > > if (idev->enforce_cache_coherency && !hwpt->enforce_cache_coherency) > return -EINVAL; In principle you can create a HWPT for device A and then later attach it to device B If B requires coherency then we try to upgrade the existing domain. This is an effort to try an minimize the number of domains that we need to have for simpe IOAS based cases where we don't want to spawn two auto domains Jason