[PATCH v5 0/3] PCI: endpoint: Add PCI DMA endpoint function (part 3/3)

Koichiro Den posted 3 patches 1 week, 1 day ago
Documentation/PCI/endpoint/index.rst          |    2 +
.../PCI/endpoint/pci-dma-function.rst         |  188 ++
Documentation/PCI/endpoint/pci-dma-howto.rst  |  201 +++
drivers/dma/dw-edma/dw-edma-pcie.c            |  401 ++++-
drivers/pci/endpoint/functions/Kconfig        |   13 +
drivers/pci/endpoint/functions/Makefile       |    1 +
drivers/pci/endpoint/functions/pci-epf-dma.c  | 1524 +++++++++++++++++
7 files changed, 2328 insertions(+), 2 deletions(-)
create mode 100644 Documentation/PCI/endpoint/pci-dma-function.rst
create mode 100644 Documentation/PCI/endpoint/pci-dma-howto.rst
create mode 100644 drivers/pci/endpoint/functions/pci-epf-dma.c
[PATCH v5 0/3] PCI: endpoint: Add PCI DMA endpoint function (part 3/3)
Posted by Koichiro Den 1 week, 1 day ago
Hi,

This is v5, part 3 of three series for PCI endpoint DMA.

The three series are:

  * part 1: dmaengine: dw-edma: Prepare for PCI EP DMA
  * part 2: PCI: endpoint: Expose endpoint DMA resources
  * part 3: PCI: endpoint: Add PCI DMA endpoint function

This series adds the host-side metadata parser, the pci-epf-dma
endpoint function driver, and documentation.

The endpoint function exposes selected endpoint-integrated DMA channels
as a separate PCI DMA controller function. The host-side dw-edma-pcie
driver discovers the BAR metadata and registers the exposed channels
with DMAengine. The endpoint function keeps the metadata BAR stable and
uses a separate DMA window BAR for resources that need dynamic subrange
mappings.

No fixed PCI ID is assigned. Users provide the PCI vendor/device ID
through configfs and bind dw-edma-pcie explicitly, for example with
driver_override.

This series depends on parts 1 and 2:

  [PATCH v5 00/14] dmaengine: dw-edma: Prepare for PCI EP DMA (part 1/3)
  https://lore.kernel.org/r/20260717050308.2144108-4-den@valinux.co.jp/

  [PATCH v5 0/6] PCI: endpoint: Expose endpoint DMA resources (part 2/3)
  https://lore.kernel.org/r/20260717050635.2145014-1-den@valinux.co.jp/

One open question is how to support endpoint controllers with only one
PF. Keeping DMA in a separate EPF requires multi-function endpoint
support. Folding it into vNTB would work on single-function
controllers, but would also couple the two implementations. This series
keeps the separate EPF model.

The v5 RC-to-EP path was retested with a small out-of-tree DMAengine
client on RK3588 and SpacemiT K3 endpoint setups.

Best regards,
Koichiro
---
Changes in v5:
  - Quiesce each shared-register direction once during channel release.

Changes in v4:
  - Rebased onto the new parts 1/2 series.
  - Support IOMMU-backed EPCs by DMA-mapping the dynamic DMA-control
    MMIO BAR submaps for the EPC parent, keeping descriptor DMA
    addresses unchanged.

Changes in v3:
  - Select endpoint DMA match data before copying DMA data and require
    driver_override for the generic endpoint DMA fallback. (Sashiko)
  - Accept HDMA native linked-list endpoint DMA metadata.
  - Consume logical DMA channels separately from descriptor memory
    resources.
    (Sashiko)
  - Delegate channels through the EPC DMA channel delegation API instead of
    v2's EPC-provided DMAengine filter callbacks.
  - Allow HDMA native linked-list channels to be delegated at channel
    granularity.
  - Preserve HOST_REQ across link-down and retry DMA window submaps on the
    next link-up.
  - Drop trailing colons from documentation subsection headings. (Randy)
  - Document HDMA native linked-list mode support and the current non-LL
    limitation.

Changes in v2:
  - Follow the part 1/3 and part 2/3 v2 channel-claim model: pci-epf-dma
    now claims delegated channels through DMAengine filter information from
    EPC auxiliary resources.
  - Select raw-address dw-edma-pcie platform ops from the endpoint DMA
    match entry instead of using a match flag.

v4: https://lore.kernel.org/r/20260710082727.2397253-1-den@valinux.co.jp/
v3: https://lore.kernel.org/r/20260620170844.3757241-1-den@valinux.co.jp/
v2: https://lore.kernel.org/r/20260525063456.3317509-1-den@valinux.co.jp/
v1: https://lore.kernel.org/r/20260521063638.2843021-1-den@valinux.co.jp/


Koichiro Den (3):
  dmaengine: dw-edma-pcie: Discover endpoint DMA metadata
  PCI: endpoint: Add DMA endpoint function
  Documentation: PCI: Add PCI DMA endpoint function documentation

 Documentation/PCI/endpoint/index.rst          |    2 +
 .../PCI/endpoint/pci-dma-function.rst         |  188 ++
 Documentation/PCI/endpoint/pci-dma-howto.rst  |  201 +++
 drivers/dma/dw-edma/dw-edma-pcie.c            |  401 ++++-
 drivers/pci/endpoint/functions/Kconfig        |   13 +
 drivers/pci/endpoint/functions/Makefile       |    1 +
 drivers/pci/endpoint/functions/pci-epf-dma.c  | 1524 +++++++++++++++++
 7 files changed, 2328 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/PCI/endpoint/pci-dma-function.rst
 create mode 100644 Documentation/PCI/endpoint/pci-dma-howto.rst
 create mode 100644 drivers/pci/endpoint/functions/pci-epf-dma.c

-- 
2.51.0