iommu/amd: Use pci_ats_supported()
authorJean-Philippe Brucker <jean-philippe@linaro.org>
Wed, 20 May 2020 15:22:01 +0000 (17:22 +0200)
committerJoerg Roedel <jroedel@suse.de>
Wed, 27 May 2020 12:35:41 +0000 (14:35 +0200)
commit7a441b2110527851f630144ec76ab8409e1d6c61
tree31988a75f053d89f24a343d2ca8925786e459ec4
parent521376741b2c26fe53a1ec24d02da24d477eb739
iommu/amd: Use pci_ats_supported()

The pci_ats_supported() function checks if a device supports ATS and is
allowed to use it. In addition to checking that the device has an ATS
capability and that the global pci=noats is not set
(pci_ats_disabled()), it also checks if a device is untrusted.

A device is untrusted if it is plugged into an external-facing port such
as Thunderbolt and could be spoofing an existing device to exploit
weaknesses in the IOMMU configuration. By calling pci_ats_supported() we
keep DTE[I]=0 for untrusted devices and abort transactions with
Pretranslated Addresses.

Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
Reviewed-by: Joerg Roedel <jroedel@suse.de>
Link: https://lore.kernel.org/r/20200520152201.3309416-3-jean-philippe@linaro.org
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/amd_iommu.c