Skip to content

Commit da656a0

Browse files
jpbruckerjoergroedel
authored andcommitted
iommu/vt-d: Use pci_ats_supported()
The pci_ats_supported() helper checks if a device supports ATS and is allowed to use it. By checking the ATS capability it also integrates the pci_ats_disabled() check from pci_ats_init(). Simplify the vt-d checks. Signed-off-by: Jean-Philippe Brucker <[email protected]> Acked-by: Lu Baolu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent 0b2527a commit da656a0

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

drivers/iommu/intel-iommu.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1454,8 +1454,7 @@ static void iommu_enable_dev_iotlb(struct device_domain_info *info)
14541454
!pci_reset_pri(pdev) && !pci_enable_pri(pdev, 32))
14551455
info->pri_enabled = 1;
14561456
#endif
1457-
if (!pdev->untrusted && info->ats_supported &&
1458-
pci_ats_page_aligned(pdev) &&
1457+
if (info->ats_supported && pci_ats_page_aligned(pdev) &&
14591458
!pci_enable_ats(pdev, VTD_PAGE_SHIFT)) {
14601459
info->ats_enabled = 1;
14611460
domain_update_iotlb(info->domain);
@@ -2611,10 +2610,8 @@ static struct dmar_domain *dmar_insert_one_dev_info(struct intel_iommu *iommu,
26112610
if (dev && dev_is_pci(dev)) {
26122611
struct pci_dev *pdev = to_pci_dev(info->dev);
26132612

2614-
if (!pdev->untrusted &&
2615-
!pci_ats_disabled() &&
2616-
ecap_dev_iotlb_support(iommu->ecap) &&
2617-
pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_ATS) &&
2613+
if (ecap_dev_iotlb_support(iommu->ecap) &&
2614+
pci_ats_supported(pdev) &&
26182615
dmar_find_matched_atsr_unit(pdev))
26192616
info->ats_supported = 1;
26202617

0 commit comments

Comments
 (0)