Skip to content

Commit 5ae4008

Browse files
LuBaolujoergroedel
authored andcommitted
iommu/vt-d: Move pfsid and ats_qdep calculation to device probe path
They should be part of the per-device iommu private data initialization. Reviewed-by: Jacob Pan <jacob.jun.pan@linux.intel.com> Reviewed-by: Kevin Tian <kevin.tian@intel.com> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com> Link: https://lore.kernel.org/r/20230324120234.313643-5-baolu.lu@linux.intel.com Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent 3d4c7cc commit 5ae4008

1 file changed

Lines changed: 11 additions & 15 deletions

File tree

drivers/iommu/intel/iommu.c

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1406,20 +1406,6 @@ static void iommu_enable_pci_caps(struct device_domain_info *info)
14061406
return;
14071407

14081408
pdev = to_pci_dev(info->dev);
1409-
/* For IOMMU that supports device IOTLB throttling (DIT), we assign
1410-
* PFSID to the invalidation desc of a VF such that IOMMU HW can gauge
1411-
* queue depth at PF level. If DIT is not set, PFSID will be treated as
1412-
* reserved, which should be set to 0.
1413-
*/
1414-
if (!ecap_dit(info->iommu->ecap))
1415-
info->pfsid = 0;
1416-
else {
1417-
struct pci_dev *pf_pdev;
1418-
1419-
/* pdev will be returned if device is not a vf */
1420-
pf_pdev = pci_physfn(pdev);
1421-
info->pfsid = pci_dev_id(pf_pdev);
1422-
}
14231409

14241410
/* The PCIe spec, in its wisdom, declares that the behaviour of
14251411
the device if you enable PASID support after ATS support is
@@ -1438,7 +1424,6 @@ static void iommu_enable_pci_caps(struct device_domain_info *info)
14381424
!pci_enable_ats(pdev, VTD_PAGE_SHIFT)) {
14391425
info->ats_enabled = 1;
14401426
domain_update_iotlb(info->domain);
1441-
info->ats_qdep = pci_ats_queue_depth(pdev);
14421427
}
14431428
}
14441429

@@ -4521,6 +4506,17 @@ static struct iommu_device *intel_iommu_probe_device(struct device *dev)
45214506
dmar_ats_supported(pdev, iommu)) {
45224507
info->ats_supported = 1;
45234508
info->dtlb_extra_inval = dev_needs_extra_dtlb_flush(pdev);
4509+
4510+
/*
4511+
* For IOMMU that supports device IOTLB throttling
4512+
* (DIT), we assign PFSID to the invalidation desc
4513+
* of a VF such that IOMMU HW can gauge queue depth
4514+
* at PF level. If DIT is not set, PFSID will be
4515+
* treated as reserved, which should be set to 0.
4516+
*/
4517+
if (ecap_dit(iommu->ecap))
4518+
info->pfsid = pci_dev_id(pci_physfn(pdev));
4519+
info->ats_qdep = pci_ats_queue_depth(pdev);
45244520
}
45254521
if (sm_supported(iommu)) {
45264522
if (pasid_supported(iommu)) {

0 commit comments

Comments
 (0)