[PATCH v5 0/7] PCI: endpoint: Remote DMA support via vNTB
From: Koichiro Den
Date: Fri Oct 09 2026 - 01:00:52 EST
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@xxxxxxxxxxxxx/
- 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@xxxxxxxxxxxxx/
v3: https://lore.kernel.org/r/20260831182657.329614-1-den@xxxxxxxxxxxxx/
v2: https://lore.kernel.org/r/20260828170932.2735807-1-den@xxxxxxxxxxxxx/
v1: https://lore.kernel.org/r/20260312165005.1148676-1-den@xxxxxxxxxxxxx/
[1] Superseded approach, PCI DMA EPF, v7:
https://lore.kernel.org/r/20260813063757.3131865-1-den@xxxxxxxxxxxxx/
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