> From: Jason Gunthorpe <jgg@xxxxxxxxxx> > Sent: Tuesday, April 12, 2022 9:21 PM > > On Tue, Apr 12, 2022 at 09:13:27PM +0800, Lu Baolu wrote: > > > > > > btw as discussed in last version it is not necessarily to recalculate > > > > > snoop control globally with this new approach. Will follow up to > > > > > clean it up after this series is merged. > > > > Agreed. But it also requires the enforce_cache_coherency() to be called > > > > only after domain being attached to a device just as VFIO is doing. > > > that actually makes sense, right? w/o device attached it's pointless to > > > call that interface on a domain... > > > > Agreed. Return -EOPNOTSUPP or -EINVAL to tell the caller that this > > operation is invalid before any device attachment. > > That is backwards. enforce_cache_coherency() succeeds on an empty > domain and attach of an incompatible device must fail. seems it's just a matter of the default policy on an empty domain. No matter we by default allow enforce_cache_coherency succeed or not the compatibility check against the default policy must be done anyway when attaching a device. given most IOMMUs supports force-snooping, allowing it succeed by default certainly makes more sense. Thanks Kevin