Linux PCI subsystem development
 help / color / mirror / Atom feed
* [PATCH v5 0/7] PCI: endpoint: Remote DMA support via vNTB
@ 2026-10-09  4:59 Koichiro Den
  2026-10-09  4:59 ` [PATCH v5 1/7] PCI: endpoint: Add DMA auxiliary resource metadata Koichiro Den
                   ` (6 more replies)
  0 siblings, 7 replies; 15+ messages in thread
From: Koichiro Den @ 2026-10-09  4:59 UTC (permalink / raw)
  To: Frank Li, Manivannan Sadhasivam, Krzysztof Wilczyński,
	Kishon Vijay Abraham I, Jon Mason, Dave Jiang, Allen Hubbe,
	Niklas Cassel
  Cc: Bjorn Helgaas, Jonathan Corbet, Shuah Khan, Randy Dunlap,
	Jingoo Han, Lorenzo Pieralisi, Rob Herring, Jerome Brunet,
	linux-pci, linux-doc, linux-kernel, ntb

Hi,

This series lets host Linux use EPC-local DMA read channels through
vNTB. I also tried a separate PCI DMA EPF, which reached v7 [1], but
came back to this vNTB-embedded approach after discussion.

An EPC-local DMA engine can use host DMA addresses (IOVAs when IOMMU
enabled), as PCI addresses to reach any host buffer mapped for the
endpoint. Letting the RC side drive its read channels also gives the RC
a direct path into endpoint-local buffers.

A major motivation is direct TX in ntb_transport. Both sides could use
the same dmaengine-based TX path, sending directly to RX buffer DMA
addresses supplied by the peer. This avoids MW bounce buffers and
per-transfer MW remapping for payloads in both directions.

This assumes both sides trust each other. The RC side still programs DMA
over MMIO, so this is expected to pay off for large data transfers.

DesignWare eDMA is the only supported dmaengine backend for now. Other
EPC-local DMA engines can be added if there is a need and they have a
suitable programming interface.

This series does not include a consumer for the dmaengine channels exposed
to RC Linux. Native HDMA support is also left out to keep the series from
growing too large.

Setting pci-epf-vntb's 'dma_bar' configfs attribute enables DMA export.
The default is -1, which leaves it disabled. pci-epf-ntb is unchanged.

(Re)based on next-20261007 (b01868671970), which includes the previous
dependencies.

Best regards,
Koichiro
---
Changes in v5:
  - Base the series onto next-20261007.
  - Simplify the implementation in several places. See individual patch
    trailers for details.

Changes in v4:
  - Base the series on the vNTB lifecycle fixes, so unbind removes NTB
    clients and the virtual PCI device before releasing DMA resources.
    (Sashiko)
    https://lore.kernel.org/r/20260901063238.631166-1-den@valinux.co.jp/
  - Keep DMA BAR submaps for the EPF bind lifetime and drop TEARDOWN_DMA.
    (Sashiko)
  - Rename CONFIGURE_DMA to SETUP_DMA_BAR to distinguish this bind-lifetime
    BAR setup from CONFIGURE_MW's outbound mapping.
  - Continue without DMA if no DMA IRQ is available or the advertised DMA
    type is unsupported. (Sashiko)

Changes in v3:
  - Rework DMA BAR setup around pci_epf_assign_bar_space() and submaps.
    Allocate backing only for uncovered BAR ranges. This handles the BAR
    backing alignment issue in pci-epf-vntb instead of adding a generic
    pci_epf_alloc_space() workaround. (Sashiko)
    https://lore.kernel.org/r/nvgnu3enktslxuiv7kdapcotoaxlfqhivar4jbf2tqvrk4otz5@exapzemrq37q/
  - Set up a shared DMA/MW BAR only once, preserve MW translations, and
    simplify error paths. (Sashiko)
  - Make dma_bar the explicit opt-in and drop use_dma and automatic BAR
    selection. Split BAR sharing into its own patch, then document the
    final interface at the end of the series instead of updating the
    documentation twice.
  - Validate peer-provided DW eDMA region offsets before MMIO mapping.
    (Sashiko)
  - Include several other minor cleanups and refactorings.

Changes in v2:
  - Rewrite most of v1 and move the dw-edma preparation into the
    companion series. Drop the generic pci-ep-dma API, auxiliary-bus
    child/frontend, test ntb client, and preparatory MW-state
    refactoring.
  - Replace v1's post-registration channel-ID cache with driver-supplied
    static IDs. (Frank)
    https://lore.kernel.org/r/abMcgQOHDD55Yv0e@lizhi-Precision-Tower-5810/
  - Let pci-epf-vntb reserve channels with dma_request_channel() and
    configure interrupt routing with dmaengine_slave_config(). This
    removes the PCI EPC DMA delegation API. (Frank)
    https://lore.kernel.org/r/ao2nHoCwfTEEiFSr@SMW015318/
  - Drop v1's dma_offset and dma_num_chans attributes. use_dma now enables
    export of the complete eDMA read direction as a group.

v4: https://lore.kernel.org/r/20260903082327.2345602-1-den@valinux.co.jp/
v3: https://lore.kernel.org/r/20260831182657.329614-1-den@valinux.co.jp/
v2: https://lore.kernel.org/r/20260828170932.2735807-1-den@valinux.co.jp/
v1: https://lore.kernel.org/r/20260312165005.1148676-1-den@valinux.co.jp/

[1] Superseded approach, PCI DMA EPF, v7:
    https://lore.kernel.org/r/20260813063757.3131865-1-den@valinux.co.jp/


Koichiro Den (7):
  PCI: endpoint: Add DMA auxiliary resource metadata
  PCI: dwc: Expose endpoint DMA resources
  PCI: endpoint: pci-epf-vntb: Move epf_ntb_is_bar_used() up
  PCI: endpoint: pci-epf-vntb: Export endpoint DMA channels
  PCI: endpoint: pci-epf-vntb: Allow DMA and MW to share a BAR
  NTB: ntb_hw_epf: Discover vNTB-embedded DMA
  Documentation: PCI: endpoint: Document vNTB DMA export

 Documentation/PCI/endpoint/pci-vntb-howto.rst |  31 +-
 drivers/ntb/hw/epf/ntb_hw_epf.c               | 336 ++++++++-
 .../pci/controller/dwc/pcie-designware-ep.c   | 107 ++-
 drivers/pci/endpoint/functions/pci-epf-vntb.c | 678 ++++++++++++++++--
 include/linux/pci-epc.h                       |  34 +-
 5 files changed, 1106 insertions(+), 80 deletions(-)


base-commit: b018686719706a781c45a874ed51374a2dc4b767
-- 
2.51.0


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

end of thread, other threads:[~2026-10-09  5:14 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-09  4:59 [PATCH v5 0/7] PCI: endpoint: Remote DMA support via vNTB Koichiro Den
2026-10-09  4:59 ` [PATCH v5 1/7] PCI: endpoint: Add DMA auxiliary resource metadata Koichiro Den
2026-10-09  5:03   ` sashiko-bot
2026-10-09  4:59 ` [PATCH v5 2/7] PCI: dwc: Expose endpoint DMA resources Koichiro Den
2026-10-09  5:05   ` sashiko-bot
2026-10-09  4:59 ` [PATCH v5 3/7] PCI: endpoint: pci-epf-vntb: Move epf_ntb_is_bar_used() up Koichiro Den
2026-10-09  5:09   ` sashiko-bot
2026-10-09  4:59 ` [PATCH v5 4/7] PCI: endpoint: pci-epf-vntb: Export endpoint DMA channels Koichiro Den
2026-10-09  5:11   ` sashiko-bot
2026-10-09  4:59 ` [PATCH v5 5/7] PCI: endpoint: pci-epf-vntb: Allow DMA and MW to share a BAR Koichiro Den
2026-10-09  5:12   ` sashiko-bot
2026-10-09  4:59 ` [PATCH v5 6/7] NTB: ntb_hw_epf: Discover vNTB-embedded DMA Koichiro Den
2026-10-09  5:14   ` sashiko-bot
2026-10-09  4:59 ` [PATCH v5 7/7] Documentation: PCI: endpoint: Document vNTB DMA export Koichiro Den
2026-10-09  5:01   ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox