From: sashiko-bot@kernel.org
To: "Leon Romanovsky" <leon@kernel.org>
Cc: linux-pci@vger.kernel.org, dri-devel@lists.freedesktop.org,
linux-rdma@vger.kernel.org, kvm@vger.kernel.org,
media-ci@linuxtv.org
Subject: Re: [PATCH v12 10/19] PCI/P2PDMA: Reject Translated Requests blocked by Translation Blocking
Date: Tue, 03 Nov 2026 10:34:54 +0000 [thread overview]
Message-ID: <sashiko-outbox-195058@kernel.org> (raw)
In-Reply-To: <20261103-fix-p2p-acs-v4-0-v12-10-912101f93517@nvidia.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] PCI/P2PDMA: missing Intel SPT PCH ACS Control offset check for PCI_ACS_TB
--
commit b8a9e833dab26624045a5e241b8edb8d281747c8
Author: Leon Romanovsky <leon@kernel.org>
PCI/P2PDMA: Reject Translated Requests blocked by Translation Blocking
This commit teaches P2PDMA to check ACS Translation Blocking across the
ports traversed by a peer-to-peer route and reject Translated Requests
when any port along the path blocks them.
> diff --git a/drivers/pci/p2pdma.c b/drivers/pci/p2pdma.c
> index 785e4668a2af5..fc4dea28c8606 100644
> --- a/drivers/pci/p2pdma.c
> +++ b/drivers/pci/p2pdma.c
[ ... ]
> @@ -678,6 +691,39 @@ pci_acs_p2pdma_no_upstream_forwarding(struct pci_dev *common)
> return NULL;
> }
>
> +/*
> + * Report whether any port between @client and @common rejects Translated
> + * addresses. If @common is NULL, every port up to the host bridge is walked.
> + * A port whose ACS Control cannot be read counts as blocking, which withdraws
> + * only the Translated classes because an Untranslated Request is routed by the
> + * redirect controls instead.
> + */
> +static bool pci_p2pdma_path_blocks_translation(struct pci_dev *client,
> + struct pci_dev *common)
> +{
> + struct pci_dev *pdev;
> + u16 ctrl;
> +
> + /*
> + * @common is @client itself when the provider is the client or sits
> + * below it. The Request never travels upstream then, so no port sees
> + * it and none can reject its Address Type.
> + */
> + if (client == common)
> + return false;
> +
> + for (pdev = pci_upstream_bridge(client); pdev && pdev != common;
> + pdev = pci_upstream_bridge(pdev)) {
> + if (!pci_acs_p2pdma_ctrl(pdev, &ctrl))
> + return true;
> +
> + if (ctrl & PCI_ACS_TB)
> + return true;
> + }
[Severity: Medium]
When calc_map_type_and_dist() calls pci_p2pdma_path_blocks_translation()
with common set to NULL (either when path.no_common_bridge is true or
when checking path.tb_above_divergence from b_child up to the root bus),
this loop walks all the way up to the Root Port.
On Intel Sunrise Point, Union Point, and 7th/8th Gen Mobile PCH Root
Ports matched by pci_quirk_intel_spt_pch_acs_match(), pdev->acs_cap is
non-zero, but due to hardware errata the ACS Capability and Control
registers are 32-bit dwords rather than 16-bit words. As a result,
pci_quirk_enable_intel_spt_pch_acs() programs PCI_ACS_TB into
pos + INTEL_SPT_ACS_CTRL (offset 8):
drivers/pci/quirks.c:pci_quirk_enable_intel_spt_pch_acs() {
...
pci_read_config_dword(dev, pos + PCI_ACS_CAP, &cap);
pci_read_config_dword(dev, pos + INTEL_SPT_ACS_CTRL, &ctrl);
...
if (pci_ats_disabled() || dev->external_facing || dev->untrusted)
ctrl |= (cap & PCI_ACS_TB);
pci_write_config_dword(dev, pos + INTEL_SPT_ACS_CTRL, ctrl);
...
}
However, pci_acs_p2pdma_ctrl() reads the 16-bit word at pos + PCI_ACS_CTRL
(offset 6), which on these Root Ports is the upper 16 bits of the 32-bit
ACS Capability register (reading as 0):
drivers/pci/p2pdma.c:pci_acs_p2pdma_ctrl() {
...
if (pci_read_config_word(pdev, pos + PCI_ACS_CTRL, ctrl) ||
PCI_POSSIBLE_ERROR(*ctrl))
return false;
*ctrl = pci_acs_p2pdma_quirk_redirect(pdev, *ctrl);
return true;
}
Unlike pci_acs_p2pdma_no_upstream_forwarding(), which consults
pci_dev_specific_acs_enabled() when walking to the Root Port,
pci_p2pdma_path_blocks_translation() only inspects ctrl from
pci_acs_p2pdma_ctrl().
Won't pci_p2pdma_path_blocks_translation() miss PCI_ACS_TB on these
Intel PCH Root Ports and allow calc_map_type_and_dist() to return
PCI_P2PDMA_MAP_THRU_HOST_BRIDGE instead of
PCI_P2PDMA_MAP_NOT_SUPPORTED for Translated Requests that the Root Port
will reject?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261103-fix-p2p-acs-v4-0-v12-0-912101f93517@nvidia.com?part=10
next prev parent reply other threads:[~2026-11-03 10:34 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 8:29 [PATCH v12 00/19] PCI/P2PDMA: Route peer-to-peer DMA by TLP class Leon Romanovsky
2026-11-03 8:29 ` [PATCH v12 01/19] PCI/P2PDMA: Honor device-specific ACS redirection Leon Romanovsky
2026-11-03 8:43 ` sashiko-bot
2026-11-03 8:29 ` [PATCH v12 02/19] PCI/P2PDMA: Document the TLP attribute assumptions Leon Romanovsky
2026-11-03 8:45 ` sashiko-bot
2026-11-03 8:29 ` [PATCH v12 03/19] PCI/P2PDMA: Derive routing from directional ACS controls Leon Romanovsky
2026-11-03 9:02 ` sashiko-bot
2026-11-03 8:29 ` [PATCH v12 04/19] PCI: Reject unreadable ACS controls in isolation checks Leon Romanovsky
2026-11-03 9:09 ` sashiko-bot
2026-11-03 8:29 ` [PATCH v12 05/19] PCI/P2PDMA: Evaluate ACS controls at the path divergence Leon Romanovsky
2026-11-03 9:31 ` sashiko-bot
2026-11-03 8:29 ` [PATCH v12 06/19] PCI/P2PDMA: Document directional ACS routing Leon Romanovsky
2026-11-03 9:39 ` sashiko-bot
2026-11-03 8:29 ` [PATCH v12 07/19] PCI/P2PDMA: Collect the path's ACS controls before deciding Leon Romanovsky
2026-11-03 9:53 ` sashiko-bot
2026-11-03 8:29 ` [PATCH v12 08/19] PCI/P2PDMA: Answer routing per TLP class Leon Romanovsky
2026-11-03 10:06 ` sashiko-bot
2026-11-03 8:29 ` [PATCH v12 09/19] PCI/P2PDMA: Route Relaxed Ordering Completions directly Leon Romanovsky
2026-11-03 10:10 ` sashiko-bot
2026-11-03 8:29 ` [PATCH v12 10/19] PCI/P2PDMA: Reject Translated Requests blocked by Translation Blocking Leon Romanovsky
2026-11-03 10:34 ` sashiko-bot [this message]
2026-11-03 8:29 ` [PATCH v12 11/19] PCI/P2PDMA: Route Translated Requests under Direct Translated P2P Leon Romanovsky
2026-11-03 10:45 ` sashiko-bot
2026-11-03 8:29 ` [PATCH v12 12/19] PCI/P2PDMA: Log detailed ACS routing diagnostics Leon Romanovsky
2026-11-03 11:01 ` sashiko-bot
2026-11-03 8:29 ` [PATCH v12 13/19] PCI/P2PDMA: Add KUnit tests for the ACS routing decisions Leon Romanovsky
2026-11-03 11:03 ` sashiko-bot
2026-11-03 8:29 ` [PATCH v12 14/19] PCI/P2PDMA: Test the ACS P2P routing walk Leon Romanovsky
2026-11-03 11:07 ` sashiko-bot
2026-11-03 8:29 ` [PATCH v12 15/19] PCI: Add KUnit coverage for ACS isolation checks Leon Romanovsky
2026-11-03 11:11 ` sashiko-bot
2026-11-03 8:29 ` [PATCH v12 16/19] PCI/P2PDMA: Document TLP-class routing Leon Romanovsky
2026-11-03 11:12 ` sashiko-bot
2026-11-03 8:29 ` [PATCH v12 17/19] PCI/P2PDMA: Let a client declare that it selects ATS per mapping Leon Romanovsky
2026-11-03 11:15 ` sashiko-bot
2026-11-03 8:29 ` [PATCH v12 18/19] PCI/P2PDMA: Evaluate the ATS path for clients with ATS enabled Leon Romanovsky
2026-11-03 11:34 ` sashiko-bot
2026-11-03 8:29 ` [PATCH v12 19/19] PCI/P2PDMA: Test the routing of " Leon Romanovsky
2026-11-03 11:37 ` sashiko-bot
2026-11-03 23:37 ` [PATCH v12 00/19] PCI/P2PDMA: Route peer-to-peer DMA by TLP class Bjorn Helgaas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-195058@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=kvm@vger.kernel.org \
--cc=leon@kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=media-ci@linuxtv.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox