kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v10 00/18] PCI/P2PDMA: Route peer-to-peer DMA by TLP class
@ 2026-10-12 13:07 Leon Romanovsky
  2026-10-12 13:07 ` [PATCH v10 01/18] PCI/P2PDMA: Document the TLP attribute assumptions Leon Romanovsky
                   ` (17 more replies)
  0 siblings, 18 replies; 38+ messages in thread
From: Leon Romanovsky @ 2026-10-12 13:07 UTC (permalink / raw)
  To: Bjorn Helgaas, Logan Gunthorpe, Leon Romanovsky, Jason Gunthorpe,
	Joerg Roedel (AMD), Will Deacon, Robin Murphy,
	Christian König, Thomas Hellström
  Cc: linux-pci, linux-kernel, linux-doc, iommu, Tushar Dave,
	linux-media, dri-devel, linaro-mm-sig, linux-rdma, kvm,
	Chaitanya Kulkarni, Greg Kroah-Hartman, Jens Axboe,
	Alex Williamson, Ankit Agrawal, Jonathan Corbet, Shuah Khan,
	Randy Dunlap, Sumit Semwal

PCI P2PDMA applies Request and Completion Redirect throughout both paths.
This misclassifies asymmetric and nested switches, and reports one answer
for every kind of TLP.

Three ACS controls act on TLP attributes the Requester chooses rather
than on the topology: Translation Blocking and Direct Translated P2P act on
a Request's Address Type, and Completion Redirect skips Completions carrying
Relaxed Ordering.

Evaluate each direction at the path divergence, decide every class from the
one walk, and treat a client with ATS enabled as translating unless its
driver declares per-mapping ATS.

This completes the P2PDMA side; dma-buf and mlx5 follow separately.

Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
---
Changes in v10:
- Fixed the Relaxed Ordering description: a Completion carries the
  attribute of its Request (PCIe r7.0 sec 2.2.9.1).
- Used the PCIe terms Requester and Completer for TLPs, ACS and ports;
  client and provider remain for P2PDMA objects.
- Rebased on pci/p2pdma, which includes the prerequisite P2PDMA fixes.
- Added a topology example to the path divergence patch.
- Removed a repeated sentence from the disable_acs_redir documentation.
- Explained the path divergence in the documentation.
- Link to v9: https://patch.msgid.link/20261001-fix-p2p-acs-v4-0-v9-0-1a8e0f50ddd9@nvidia.com

Changes in v9:
- Removed dmabuf patches for now.
- Removed mlx5 per-mapping ATS declaration for now; it comes back with
  the dmabuf patches.
- Link to v8: https://patch.msgid.link/20260928-fix-p2p-acs-v4-0-v8-0-404453b9c435@nvidia.com

Changes in v8:
- Added extra Reviewed-by from Logan.
- Added patches to take care of ATS per-device vs. per-mapping option
- Link to v7: https://patch.msgid.link/20260920-fix-p2p-acs-v4-0-v7-0-ca0828ab697c@nvidia.com

Changes in v7:
- Removed "Document pdev->p2pdma lifetime rules" patch, it gives nothing
  after p2pmem fix.
- Split dmabuf patch.
- Tushar retested the series, so added his Tested-by.
- Added Logan's ROB tags and fixed minor documentation issues pointed
  by him.
- Link to v6: https://lore.kernel.org/all/20260914-fix-p2p-acs-v4-0-v6-0-5ef07ec9ef06@nvidia.com/

Changes in v6:
- Changed DMABUF to use callbacks and not directly stored pointer.
- Link to v5: https://patch.msgid.link/20260910-fix-p2p-acs-v4-0-v5-0-856087f63c0d@nvidia.com

Changes in v5:
- Rebase on the posted fixes.
- Dropped tags from changed patches.
- Remove Egress Control Vector interpretation and coverage.
- Keep enabled Egress Control conservative as a Request redirect.
- Use pci_dbg()/dev_dbg() for diagnostics and drop the "debug" prefix.
- Removed code comments from "Document the pdev->p2pdma lifetime and RCU
  rules" patch and reduced description to actual lifetime explanation.
- Added note that Linux assumes that TLPs are in strict-ordering and
  untranslated.
- Added code to calculate p2p paths per-TLP type.
- Converted mlx5 to use that new proposed API.
- Link to https://patch.msgid.link/20260821-fix-p2p-acs-v4-0-v4-0-94426b96de73@nvidia.com

Changes in v4:
- Reject ACS Violations and unreadable routing state instead of treating
  them as host-bridge redirects
- Added Tested-by tags from Tushar Dave
- Added support to asymmetric ACS routing
- Limited redirect checks to the two ports at the path divergence
- Added standalone ACS routing diagnostics for hardware retesting
- Dropped " PCI: Account for Direct Translated P2P in ACS isolation checks" patch
- Link to v3: https://patch.msgid.link/20260811-fix-p2p-acs-v3-0-efc488ee7c03@nvidia.com

Changes in v3:
- Fixed pci_p2pdma_add_resource() error unwinding
- Made pdev->p2pdma teardown wait unconditionally for RCU readers
- Restricted pci_p2pmem_find_many() to pool-backed providers
- Documented the pdev->p2pdma lifetime and RCU rules
- Fixed calc_map_type_and_dist() handling of the verbose argument
- Required the ACS port and target to share a bus before indexing the
  Egress Control Vector
- Gave pci_acs_enabled() and pci_acs_path_enabled() a scope, so the ACS
  Direct Translated P2P rule no longer stops pci_enable_pasid() from
  enabling PASID
- Dropped "Report ACS ports when the paths share no upstream bridge":
  the mapping type cannot change without a shared upstream bridge, so
  the pci=disable_acs_redir= hint was not actionable there and the ACS
  walk only cost config space reads
- Folded the Request Redirect rule into pci_acs_rr_ineffective(), so
  pci_acs_flags_enabled() and the Intel SPT PCH quirk share one copy
- Renamed pci_acs_egress_ctrl_set() to pci_acs_egress_ctrl_is_set(), it
  reads the bit rather than setting it
- Reworded the blocked-path warning: ACS may also leave the direct route
  indeterminate rather than blocked
- Added KUnit coverage for the shared-bus guard, a device with no ACS
  capability and an unreadable ACS Control register
- Added the missing Fixes: tags, a second one on the
  pci_p2pdma_add_resource() unwinding fix (the dangling devres action
  dates to f58ef9d1d135) and one on the Egress Control isolation change
- Link to v2: https://patch.msgid.link/20260806-fix-p2p-acs-v2-0-0cec14812965@nvidia.com

Changes in v2:
- Added Logan's ROB tags
- Added commas in Documentation patch
- Link to v1: https://patch.msgid.link/20260802-fix-p2p-acs-v1-0-a7c5eb64fff6@nvidia.com

---
Leon Romanovsky (18):
      PCI/P2PDMA: Document the TLP attribute assumptions
      PCI/P2PDMA: Derive routing from directional ACS controls
      PCI: Reject unreadable ACS controls in isolation checks
      PCI/P2PDMA: Evaluate ACS controls at the path divergence
      PCI/P2PDMA: Document directional ACS routing
      PCI/P2PDMA: Collect the path's ACS controls before deciding
      PCI/P2PDMA: Answer routing per TLP class
      PCI/P2PDMA: Route Relaxed Ordering Completions directly
      PCI/P2PDMA: Reject Translated Requests blocked by Translation Blocking
      PCI/P2PDMA: Route Translated Requests under Direct Translated P2P
      PCI/P2PDMA: Log detailed ACS routing diagnostics
      PCI/P2PDMA: Add KUnit tests for the ACS routing decisions
      PCI/P2PDMA: Test the ACS P2P routing walk
      PCI: Add KUnit coverage for ACS isolation checks
      PCI/P2PDMA: Document TLP-class routing
      PCI/P2PDMA: Let a client declare that it selects ATS per mapping
      PCI/P2PDMA: Evaluate the ATS path for clients with ATS enabled
      PCI/P2PDMA: Test the routing of clients with ATS enabled

 Documentation/admin-guide/kernel-parameters.txt |  11 +-
 Documentation/driver-api/pci/p2pdma.rst         |  81 +++
 drivers/pci/Kconfig                             |  15 +
 drivers/pci/Makefile                            |   1 +
 drivers/pci/p2pdma.c                            | 719 ++++++++++++++++++--
 drivers/pci/pci.c                               |   7 +-
 drivers/pci/pci.h                               |  56 ++
 drivers/pci/pci_acs_test.c                      | 860 ++++++++++++++++++++++++
 drivers/pci/quirks.c                            |   6 +-
 include/linux/pci-p2pdma.h                      |  12 +-
 10 files changed, 1683 insertions(+), 85 deletions(-)
---
base-commit: 36038f0e8377ef316b723d0d85b1510bc64069ab
change-id: 20260821-fix-p2p-acs-v4-0-e72455e3a261

Best regards,
--  
Leon Romanovsky <leonro@nvidia.com>


^ permalink raw reply	[flat|nested] 38+ messages in thread

end of thread, other threads:[~2026-10-12 18:08 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-12 13:07 [PATCH v10 00/18] PCI/P2PDMA: Route peer-to-peer DMA by TLP class Leon Romanovsky
2026-10-12 13:07 ` [PATCH v10 01/18] PCI/P2PDMA: Document the TLP attribute assumptions Leon Romanovsky
2026-10-12 13:11   ` sashiko-bot
2026-10-12 13:07 ` [PATCH v10 02/18] PCI/P2PDMA: Derive routing from directional ACS controls Leon Romanovsky
2026-10-12 13:16   ` sashiko-bot
2026-10-12 13:07 ` [PATCH v10 03/18] PCI: Reject unreadable ACS controls in isolation checks Leon Romanovsky
2026-10-12 13:20   ` sashiko-bot
2026-10-12 13:07 ` [PATCH v10 04/18] PCI/P2PDMA: Evaluate ACS controls at the path divergence Leon Romanovsky
2026-10-12 13:15   ` sashiko-bot
2026-10-12 13:07 ` [PATCH v10 05/18] PCI/P2PDMA: Document directional ACS routing Leon Romanovsky
2026-10-12 13:15   ` sashiko-bot
2026-10-12 13:07 ` [PATCH v10 06/18] PCI/P2PDMA: Collect the path's ACS controls before deciding Leon Romanovsky
2026-10-12 13:15   ` sashiko-bot
2026-10-12 13:07 ` [PATCH v10 07/18] PCI/P2PDMA: Answer routing per TLP class Leon Romanovsky
2026-10-12 13:18   ` sashiko-bot
2026-10-12 13:07 ` [PATCH v10 08/18] PCI/P2PDMA: Route Relaxed Ordering Completions directly Leon Romanovsky
2026-10-12 13:18   ` sashiko-bot
2026-10-12 13:07 ` [PATCH v10 09/18] PCI/P2PDMA: Reject Translated Requests blocked by Translation Blocking Leon Romanovsky
2026-10-12 13:20   ` sashiko-bot
2026-10-12 13:07 ` [PATCH v10 10/18] PCI/P2PDMA: Route Translated Requests under Direct Translated P2P Leon Romanovsky
2026-10-12 13:15   ` sashiko-bot
2026-10-12 13:07 ` [PATCH v10 11/18] PCI/P2PDMA: Log detailed ACS routing diagnostics Leon Romanovsky
2026-10-12 13:18   ` sashiko-bot
2026-10-12 13:07 ` [PATCH v10 12/18] PCI/P2PDMA: Add KUnit tests for the ACS routing decisions Leon Romanovsky
2026-10-12 13:19   ` sashiko-bot
2026-10-12 13:07 ` [PATCH v10 13/18] PCI/P2PDMA: Test the ACS P2P routing walk Leon Romanovsky
2026-10-12 13:23   ` sashiko-bot
2026-10-12 13:07 ` [PATCH v10 14/18] PCI: Add KUnit coverage for ACS isolation checks Leon Romanovsky
2026-10-12 13:20   ` sashiko-bot
2026-10-12 13:07 ` [PATCH v10 15/18] PCI/P2PDMA: Document TLP-class routing Leon Romanovsky
2026-10-12 13:16   ` sashiko-bot
2026-10-12 13:07 ` [PATCH v10 16/18] PCI/P2PDMA: Let a client declare that it selects ATS per mapping Leon Romanovsky
2026-10-12 13:26   ` sashiko-bot
2026-10-12 13:07 ` [PATCH v10 17/18] PCI/P2PDMA: Evaluate the ATS path for clients with ATS enabled Leon Romanovsky
2026-10-12 13:27   ` sashiko-bot
2026-10-12 18:08     ` Leon Romanovsky
2026-10-12 13:07 ` [PATCH v10 18/18] PCI/P2PDMA: Test the routing of " Leon Romanovsky
2026-10-12 13:24   ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).