]> asedeno.scripts.mit.edu Git - linux.git/commit
iommu/arm-smmu-v3: Add support for PCI ATS
authorJean-Philippe Brucker <jean-philippe.brucker@arm.com>
Wed, 17 Apr 2019 18:24:47 +0000 (19:24 +0100)
committerWill Deacon <will.deacon@arm.com>
Tue, 23 Apr 2019 11:23:13 +0000 (12:23 +0100)
commit9ce27afc0830fca07daa3baeb4da44423b0673ef
treed1a3e2122eea21803fd0d16b296622e3e1bea69a
parent2a7e62f51696ad476b7fb8157d73307e20257df7
iommu/arm-smmu-v3: Add support for PCI ATS

PCIe devices can implement their own TLB, named Address Translation Cache
(ATC). Enable Address Translation Service (ATS) for devices that support
it and send them invalidation requests whenever we invalidate the IOTLBs.

ATC invalidation is allowed to take up to 90 seconds, according to the
PCIe spec, so it is possible to get a SMMU command queue timeout during
normal operations. However we expect implementations to complete
invalidation in reasonable time.

We only enable ATS for "trusted" devices, and currently rely on the
pci_dev->untrusted bit. For ATS we have to trust that:

(a) The device doesn't issue "translated" memory requests for addresses
    that weren't returned by the SMMU in a Translation Completion. In
    particular, if we give control of a device or device partition to a VM
    or userspace, software cannot program the device to access arbitrary
    "translated" addresses.

(b) The device follows permissions granted by the SMMU in a Translation
    Completion. If the device requested read+write permission and only
    got read, then it doesn't write.

(c) The device doesn't send Translated transactions for an address that
    was invalidated by an ATC invalidation.

Note that the PCIe specification explicitly requires all of these, so we
can assume that implementations will cleanly shield ATCs from software.

All ATS translated requests still go through the SMMU, to walk the stream
table and check that the device is actually allowed to send translated
requests.

Signed-off-by: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
drivers/iommu/arm-smmu-v3.c