Skip to content

Commit 201007e

Browse files
LuBaolujoergroedel
authored andcommitted
PCI: Enable PASID only when ACS RR & UF enabled on upstream path
The Requester ID/Process Address Space ID (PASID) combination identifies an address space distinct from the PCI bus address space, e.g., an address space defined by an IOMMU. But the PCIe fabric routes Memory Requests based on the TLP address, ignoring any PASID (PCIe r6.0, sec 2.2.10.4), so a TLP with PASID that SHOULD go upstream to the IOMMU may instead be routed as a P2P Request if its address falls in a bridge window. To ensure that all Memory Requests with PASID are routed upstream, only enable PASID if ACS P2P Request Redirect and Upstream Forwarding are enabled for the path leading to the device. Suggested-by: Jason Gunthorpe <[email protected]> Suggested-by: Kevin Tian <[email protected]> Signed-off-by: Lu Baolu <[email protected]> Acked-by: Bjorn Helgaas <[email protected]> Reviewed-by: Jason Gunthorpe <[email protected]> Tested-by: Tony Zhu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent 942fd54 commit 201007e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/pci/ats.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,9 @@ int pci_enable_pasid(struct pci_dev *pdev, int features)
382382
if (!pasid)
383383
return -EINVAL;
384384

385+
if (!pci_acs_path_enabled(pdev, NULL, PCI_ACS_RR | PCI_ACS_UF))
386+
return -EINVAL;
387+
385388
pci_read_config_word(pdev, pasid + PCI_PASID_CAP, &supported);
386389
supported &= PCI_PASID_CAP_EXEC | PCI_PASID_CAP_PRIV;
387390

0 commit comments

Comments
 (0)