[PATCH v2 02/13] PCI/P2PDMA: Report ACS ports when the paths share no upstream bridge

Leon Romanovsky <[email protected]>
Newsgroups gmane.linux.documentation,gmane.linux.kernel.pci,gmane.linux.kernel
Message-ID <[email protected]>
From: Leon Romanovsky <[email protected]>

A provider and a client below different Root Ports share no upstream
bridge, so the search ends without a match and the walk takes the
host-bridge route directly. Neither path is examined for ACS, so no
redirect diagnostic is emitted and the host-bridge whitelist warning
stays suppressed.

Examine the paths before taking that route, so every redirecting port is
named in the pci=disable_acs_redir= hint. The mapping type is unchanged.

Reviewed-by: Logan Gunthorpe <[email protected]>
Signed-off-by: Leon Romanovsky <[email protected]>
---
 drivers/pci/p2pdma.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/p2pdma.c b/drivers/pci/p2pdma.c
index 2d3b380cc578..801c183ae6b7 100644
--- a/drivers/pci/p2pdma.c
+++ b/drivers/pci/p2pdma.c
@@ -703,6 +703,7 @@ calc_map_type_and_dist(struct pci_dev *provider, struct pci_dev *client,
 {
 	enum pci_p2pdma_map_type map_type = PCI_P2PDMA_MAP_THRU_HOST_BRIDGE;
 	struct pci_dev *a = provider, *b = client, *bb;
+	bool no_common_upstream = false;
 	bool acs_redirects = false;
 	struct pci_p2pdma *p2pdma;
 	struct seq_buf acs_list;
@@ -740,8 +741,12 @@ calc_map_type_and_dist(struct pci_dev *provider, struct pci_dev *client,
 		dist_a++;
 	}
 
-	*dist = dist_a + dist_b;
-	goto map_through_host_bridge;
+	/*
+	 * The paths share no upstream bridge, so the request can only reach
+	 * the peer through the host bridge. Examine the client path anyway,
+	 * so the diagnostics below name every ACS port on both paths.
+	 */
+	no_common_upstream = true;
 
 check_b_path_acs:
 	bb = b;
@@ -761,6 +766,9 @@ calc_map_type_and_dist(struct pci_dev *provider, struct pci_dev *client,
 	*dist = dist_a + dist_b;
 
 	if (!acs_cnt) {
+		if (no_common_upstream)
+			goto map_through_host_bridge;
+
 		map_type = PCI_P2PDMA_MAP_BUS_ADDR;
 		goto done;
 	}

-- 
2.55.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.