On Fri, Feb 23, 2018 at 2:34 AM, Tian, Kevin <kevin.t...@intel.com> wrote:
>> From: Peter Xu
>> Sent: Friday, February 23, 2018 3:09 PM
>> > Right. I think my question was not clear. My question was that why don’t
>> > IOMMU invalidate device-iotlb along with its mappings in one go. Then
>> > device driver doesn’t need to flush device-iotlb explicitly. Maybe the
>> > reason is that ATS and IOMMU are not always coupled.. but I guess it’s
>> > for me to get some more background :)
>> Ah, I see your point.
>> I don't know the answer. My wild guess is that IOMMU is just trying
>> to be simple and only provide most basic functionalities, leaving
>> complex stuff to CPU. For example, if IOMMU takes over the ownership
>> to deliever device-iotlb invalidations when receiving iotlb
>> invalidations, it possibly needs to traverse the device tree sometimes
>> (e.g., for domain invalidations) to know what device is under what
>> domain, which is really compliated. While it'll be simpler for CPU to
>> do this since it's very possible that the OS keeps a list of devices
>> for a domain already.
>> IMHO that follows the *nix philosophy too - Do One Thing And Do It
>> Well. Though again, it's wild guess and I may be wrong. :)
>> CCing Alex, in case he has quick answers.
> IOMMU and devices are de-coupled. You need a protocol so IOMMU
> knows which device enables translation caches and thus requires
> explicit invalidation, which is how ATS comes to play. ATS is not
> mandatory for vhost, but doing so provides more flexibility e.g.
> to enable I/O page fault if further emulating PCI PRS cap.
Thanks for the explanation!