PCI/ATS: PASID and PRI are only enumerated in PF devices.
Subsystems (4)
PATCH 1/1 PCI/ATS: PASID and PRI are only enumerated in PF devices.
PASID and PRI capabilities are only enumerated in PF devices. VF devices do not enumerate these capabilites. IOMMU drivers also need to enumerate them before enabling features in the IOMMU. Extending the same support as PASID feature discovery (pci_pasid_features) for PRI.
Signed-off-by Ashok Raj <[email protected]>
v2: Fixed build failure from lkp when CONFIG_PRI=n
Almost all the PRI functions were called only when CONFIG_PASID is set. Except the new pci_pri_supported().
To: Bjorn Helgaas <[email protected]>
To: Joerg Roedel <[email protected]>
To: Lu Baolu <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: Ashok Raj <[email protected]>
Cc: [email protected]
--- drivers/iommu/intel/iommu.c | 2 +- drivers/pci/ats.c | 14 ++++++++++++++ include/linux/pci-ats.h | 4 ++++ 3 files changed, 19 insertions(+), 1 deletion(-)
drivers/iommu/intel/iommu.c +1 -1
@@ -2560,7 +2560,7 @@ static struct dmar_domain *dmar_insert_one_dev_info(struct intel_iommu *iommu, }if (info->ats_supported &&ecap_prs (iommu->ecap) && -pci_find_ext_capability (pdev,PCI_EXT_CAP_ID_PRI )) +pci_pri_supported (pdev)) info->pri_supported =1 ; } }
drivers/pci/ats.c +14 -0
@@ -461,6 +461,20 @@ int pci_pasid_features(struct pci_dev *pdev) }EXPORT_SYMBOL_GPL (pci_pasid_features); +/** +* pci_pri_supported - Check if PRI is supported. +* @pdev: PCI device structure +* +* Returns false when no PRI capability is present. +* Returns true if PRI feature is supported and enabled +*/ +bool pci_pri_supported (struct pci_dev *pdev) +{ +/* VFs share the PF PRI configuration */ +return !!(pci_physfn (pdev)->pri_cap); +} +EXPORT_SYMBOL_GPL (pci_pri_supported); +#define PASID_NUMBER_SHIFT 8#define PASID_NUMBER_MASK (0x1f << PASID_NUMBER_SHIFT)/**
include/linux/pci-ats.h +4 -0
@@ -28,6 +28,10 @@ int pci_enable_pri(struct pci_dev *pdev, u32 reqs);void pci_disable_pri (struct pci_dev *pdev);int pci_reset_pri (struct pci_dev *pdev);int pci_prg_resp_pasid_required (struct pci_dev *pdev); +bool pci_pri_supported (struct pci_dev *pdev); +#else +bool pci_pri_supported (struct pci_dev *pdev) +{return false; }#endif /* CONFIG_PCI_PRI */ #ifdef CONFIG_PCI_PASID
Signature · 1 line
2.7.4