All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v7 00/10] PCI: endpoint: Add PCI DMA endpoint function
@ 2026-08-13  6:37 Koichiro Den
  2026-08-13  6:37 ` [PATCH v7 01/10] dmaengine: Allow drivers to assign static channel IDs Koichiro Den
                   ` (10 more replies)
  0 siblings, 11 replies; 25+ messages in thread
From: Koichiro Den @ 2026-08-13  6:37 UTC (permalink / raw)
  To: Manivannan Sadhasivam, Krzysztof Wilczyński,
	Kishon Vijay Abraham I, Frank Li, Bjorn Helgaas, Jonathan Corbet,
	Shuah Khan, Randy Dunlap, Vinod Koul, Jingoo Han,
	Lorenzo Pieralisi, Rob Herring, Niklas Cassel, Damien Le Moal,
	Arnd Bergmann
  Cc: Marek Vasut, Yoshihiro Shimoda, linux-pci, linux-doc,
	linux-kernel, dmaengine

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/20260810165136.2292436-1-den@valinux.co.jp/
  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/20260721062815.4117887-1-den@valinux.co.jp/

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/20260804033855.2115817-1-den@valinux.co.jp/
    (part 2 only; part 3 was not posted as v6)
v5: https://lore.kernel.org/r/20260717050635.2145014-1-den@valinux.co.jp/
    https://lore.kernel.org/r/20260717050953.2145851-1-den@valinux.co.jp/
v4: https://lore.kernel.org/r/20260710082156.2395844-1-den@valinux.co.jp/
    https://lore.kernel.org/r/20260710082727.2397253-1-den@valinux.co.jp/
v3: https://lore.kernel.org/r/20260620170438.3756593-1-den@valinux.co.jp/
    https://lore.kernel.org/r/20260620170844.3757241-1-den@valinux.co.jp/
v2: https://lore.kernel.org/r/20260525063129.3316894-1-den@valinux.co.jp/
    https://lore.kernel.org/r/20260525063456.3317509-1-den@valinux.co.jp/
v1: https://lore.kernel.org/r/20260521063405.2842644-1-den@valinux.co.jp/
    https://lore.kernel.org/r/20260521063638.2843021-1-den@valinux.co.jp/


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


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

end of thread, other threads:[~2026-08-13 16:00 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-13  6:37 [PATCH v7 00/10] PCI: endpoint: Add PCI DMA endpoint function Koichiro Den
2026-08-13  6:37 ` [PATCH v7 01/10] dmaengine: Allow drivers to assign static channel IDs Koichiro Den
2026-08-13  6:51   ` sashiko-bot
2026-08-13  6:37 ` [PATCH v7 02/10] PCI: endpoint: Define endpoint DMA BAR metadata format Koichiro Den
2026-08-13  6:40   ` sashiko-bot
2026-08-13  6:37 ` [PATCH v7 03/10] PCI: endpoint: Add DMA auxiliary resource metadata Koichiro Den
2026-08-13  6:41   ` sashiko-bot
2026-08-13  6:37 ` [PATCH v7 04/10] PCI: endpoint: Add API to delegate EPC DMA channels to the host Koichiro Den
2026-08-13  6:46   ` sashiko-bot
2026-08-13  6:37 ` [PATCH v7 05/10] dmaengine: dw-edma: Add channel delegation helpers Koichiro Den
2026-08-13  6:50   ` sashiko-bot
2026-08-13  6:37 ` [PATCH v7 06/10] PCI: dwc: Implement endpoint DMA channel delegation Koichiro Den
2026-08-13  6:47   ` sashiko-bot
2026-08-13  6:37 ` [PATCH v7 07/10] PCI: dwc: Expose endpoint DMA resources Koichiro Den
2026-08-13  6:45   ` sashiko-bot
2026-08-13  6:37 ` [PATCH v7 08/10] dmaengine: dw-edma-pcie: Discover endpoint DMA metadata Koichiro Den
2026-08-13  6:50   ` sashiko-bot
2026-08-13  6:37 ` [PATCH v7 09/10] PCI: endpoint: Add DMA endpoint function Koichiro Den
2026-08-13  6:53   ` sashiko-bot
2026-08-13  6:37 ` [PATCH v7 10/10] Documentation: PCI: Add PCI DMA endpoint function documentation Koichiro Den
2026-08-13  6:46   ` sashiko-bot
2026-08-13 11:46 ` [PATCH v7 00/10] PCI: endpoint: Add PCI DMA endpoint function Niklas Cassel
2026-08-13 12:50   ` Manivannan Sadhasivam
2026-08-13 14:15     ` Koichiro Den
2026-08-13 15:59       ` Frank Li

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.