Skip to content

Commit 2e34673

Browse files
Kuppuswamy Sathyanarayananbjorn-helgaas
authored andcommitted
PCI/ATS: Use PF PASID for VFs
Per PCIe r5.0, sec 9.3.7.14, if a PF implements the PASID Capability, the PF PASID configuration is shared by its VFs, and VFs must not implement their own PASID Capability. But commit 751035b ("PCI/ATS: Cache PASID Capability offset") changed pci_max_pasids() and pci_pasid_features() to use the PASID Capability of the VF device instead of the associated PF device. This leads to IOMMU bind failures when pci_max_pasids() and pci_pasid_features() are called for VFs. In pci_max_pasids() and pci_pasid_features(), always use the PF PASID Capability. Fixes: 751035b ("PCI/ATS: Cache PASID Capability offset") Link: https://lore.kernel.org/r/fe891f9755cb18349389609e7fed9940fc5b081a.1580325170.git.sathyanarayanan.kuppuswamy@linux.intel.com Signed-off-by: Kuppuswamy Sathyanarayanan <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> CC: [email protected] # v5.5+
1 parent b9303bb commit 2e34673

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/pci/ats.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -424,11 +424,12 @@ void pci_restore_pasid_state(struct pci_dev *pdev)
424424
int pci_pasid_features(struct pci_dev *pdev)
425425
{
426426
u16 supported;
427-
int pasid = pdev->pasid_cap;
427+
int pasid;
428428

429429
if (pdev->is_virtfn)
430430
pdev = pci_physfn(pdev);
431431

432+
pasid = pdev->pasid_cap;
432433
if (!pasid)
433434
return -EINVAL;
434435

@@ -451,11 +452,12 @@ int pci_pasid_features(struct pci_dev *pdev)
451452
int pci_max_pasids(struct pci_dev *pdev)
452453
{
453454
u16 supported;
454-
int pasid = pdev->pasid_cap;
455+
int pasid;
455456

456457
if (pdev->is_virtfn)
457458
pdev = pci_physfn(pdev);
458459

460+
pasid = pdev->pasid_cap;
459461
if (!pasid)
460462
return -EINVAL;
461463

0 commit comments

Comments
 (0)