[PATCH v7 00/10] PCI: endpoint: Add PCI DMA endpoint function
Koichiro Den <[email protected]>
| Newsgroups | org.kernel.vger.dmaengine,org.kernel.vger.linux-doc,org.kernel.vger.linux-kernel,org.kernel.vger.linux-pci |
|---|---|
| Message-ID | <[email protected]> |
Hi, This is v7, the remaining patch set for PCI endpoint DMA. Parts 2 and 3 were merged per Frank's suggestion. This series defines an extensible endpoint DMA BAR metadata format and controller-neutral EPC auxiliary-resource and delegation interfaces. It then adds DesignWare eDMA/HDMA as the first implementation. The infrastructure itself is not tied to dw-edma. Other endpoint DMA controllers can use the same model by publishing their resources through the EPC auxiliary-resource interface, adding their metadata-layout support to pci-epf-dma, and providing the corresponding host-side driver. The metadata lives in an endpoint BAR rather than a VSEC in PCIe extended configuration space. This avoids requiring endpoint controllers to provide writable configuration-space backing storage for an EPF-defined VSEC. 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. The endpoint function reserves each selected local channel through dmaengine before asking the EPC backend to hand its hardware programming ownership to the host. A new static channel-ID helper lets the endpoint function select the exact channel without exposing a controller-specific filter. 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. 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. I retested v7 with: - small out-of-tree dmaengine client that uses delegated read channels on SpacemiT K3 (HDMA). - heavy load on delegated read channels on R-Car S4 (eDMA) with: https://lore.kernel.org/r/[email protected]/ Note: the entire read direction needs to be delegated because it's eDMA. Part 1 v6 has landed in linux-next via dmaengine/next: https://lore.kernel.org/all/[email protected]/ v7 is based off of next-20260811. Best regards, Koichiro --- Changes in v7: - Merge parts 2 and 3. Part 3 was last posted as v5; no v6 was sent. (Frank) - Let DMA engine drivers assign static channel IDs. pci-epf-dma now reserves exact channels itself, while EPC backends only perform the hardware ownership handoff. (Frank) - Put HOST_REQ in a dedicated host-request metadata word, avoiding a host read-modify-write of endpoint-owned fields. (Frank) - Restore automatic BAR selection when an EPF is rebound. v6: https://lore.kernel.org/r/[email protected]/ (part 2 only; part 3 was not posted as v6) v5: https://lore.kernel.org/r/[email protected]/ https://lore.kernel.org/r/[email protected]/ v4: https://lore.kernel.org/r/[email protected]/ https://lore.kernel.org/r/[email protected]/ v3: https://lore.kernel.org/r/[email protected]/ https://lore.kernel.org/r/[email protected]/ v2: https://lore.kernel.org/r/[email protected]/ https://lore.kernel.org/r/[email protected]/ v1: https://lore.kernel.org/r/[email protected]/ https://lore.kernel.org/r/[email protected]/ Koichiro Den (10): dmaengine: Allow drivers to assign static channel IDs PCI: endpoint: Define endpoint DMA BAR metadata format PCI: endpoint: Add DMA auxiliary resource metadata PCI: endpoint: Add API to delegate EPC DMA channels to the host dmaengine: dw-edma: Add channel delegation helpers PCI: dwc: Implement endpoint DMA channel delegation PCI: dwc: Expose endpoint DMA resources 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 +++ MAINTAINERS | 1 + drivers/dma/dmaengine.c | 13 +- drivers/dma/dw-edma/dw-edma-core.c | 40 + drivers/dma/dw-edma/dw-edma-pcie.c | 394 +++- .../pci/controller/dwc/pcie-designware-ep.c | 184 +- drivers/pci/endpoint/functions/Kconfig | 13 + drivers/pci/endpoint/functions/Makefile | 1 + drivers/pci/endpoint/functions/pci-epf-dma.c | 1577 +++++++++++++++++ drivers/pci/endpoint/pci-epc-core.c | 70 + include/linux/dma/edma.h | 11 + include/linux/dmaengine.h | 20 + include/linux/pci-ep-dma.h | 175 ++ include/linux/pci-epc.h | 63 + 16 files changed, 2938 insertions(+), 15 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 create mode 100644 include/linux/pci-ep-dma.h base-commit: 5e6de6a2b522f659defacb1551d0465ba6ce13cf -- 2.51.0