Hi,

Some DesignWare PCIe endpoint platforms integrate a DesignWare eDMA
instance alongside the PCIe controller. In remote eDMA use cases, the
host needs access to the eDMA register block and the per-channel
linked-list (LL) regions via PCIe BARs, while the endpoint may still
boot with a standard EP configuration (and may also use dw-edma locally).

This series provides the following building blocks:

  * dmaengine:

    1. Add dw-edma-specific per-channel interrupt routing control via
       dma_slave_config.peripheral_config.
       => Patch 01/09

    2. Add interrupt emulation handling and expose per-channel channel info
       (IRQ number and doorbell register offset) via a new
       dw_edma_chan_info() helper, which will be used by Patch 06.
       => Patch 02/09 - 03/09

  * pci/endpoint:

    1. Add a generic remote resource enumeration API
       (pci_epc_get_remote_resources()) for EPF drivers to discover
       controller-owned resources that can be mapped into BAR space (e.g.
       an integrated DMA MMIO window and per-channel LL regions metadata).
       => Patch 04/09 - 06/09

    2. Add an embedded doorbell test variant and host/kselftest support
       for it.
       => Patch 07/09 - 09/09

This series evolved out of:
https://lore.kernel.org/linux-pci/[email protected]/


Kernel base
===========

Patches 1-9 cleanly apply to pci.git 'controller/dwc':
Commit 43d324eeb08c ("PCI: dwc: Fix missing iATU setup when ECAM is enabled")

If preferred, I can split the series into two.


Tested on
=========

I tested the new doorbell test variant, 'embedded', on R-Car Spider boards.

  #  RUN           pcie_ep_doorbell.embedded.DOORBELL_TEST ...
  #            OK  pcie_ep_doorbell.embedded.DOORBELL_TEST
  ok 2 pcie_ep_doorbell.embedded.DOORBELL_TEST

(Note: for the test to pass on R-Car Spider, one of the following was required:
  - echo 1048576 > functions/pci_epf_test/func1/pci_epf_test.0/bar2_size
  - apply 
https://lore.kernel.org/all/[email protected]/)


Changelog
=========

* v3->v4 changes:
  - Drop dma_slave_caps.hw_id and the dmaengine selfirq callback
    registration API. Instead, add a dw-edma specific dw_edma_chan_info()
    helper and extend the EPC remote resource metadata accordingly.
  - Add explicit acking for eDMA interrupt emulation and adjust the
    dw-edma IRQ path for embedded-doorbell usage.
  - Replace the previous EPC API smoke test with an embedded doorbell
    test variant (pci-epf-test + pci_endpoint_test/selftests).
  - Rebase onto pci.git controller/dwc commit 43d324eeb08c.

* v2->v3 changes:
  - Replace DWC-specific helpers with a generic EPC remote resource query API.
  - Add pci-epf-test smoke test and host/kselftest support for the new API.
  - Drop the dw-edma-specific notify-only channel and polling approach
    ([PATCH v2 4/7] and [PATCH v2 5/7]), and rework notification handling
    around a generic dmaengine_(un)register_selfirq() API implemented
    by dw-edma.

* v1->v2 changes:
  - Combine the two previously posted series into a single set (per Frank's
    suggestion). Order dmaengine/dw-edma patches first so hw_id support
    lands before the PCI LL-region helper, which assumes
    dma_slave_caps.hw_id availability.

v3: https://lore.kernel.org/all/[email protected]/
v2: https://lore.kernel.org/all/[email protected]/
v1: 
https://lore.kernel.org/dmaengine/[email protected]/
    +
    
https://lore.kernel.org/linux-pci/[email protected]/

Thanks for reviewing,

Many thanks to Frank for the continued review and constructive feedback
throughout the development of this series.


Koichiro Den (9):
  dmaengine: dw-edma: Add per-channel interrupt routing control
  dmaengine: dw-edma: Deassert emulated interrupts in the IRQ handler
  dmaengine: dw-edma: Export per-channel IRQ and doorbell register
    offset
  PCI: endpoint: Add remote resource query API
  PCI: dwc: Record integrated eDMA register window
  PCI: dwc: ep: Report integrated eDMA resources via EPC remote-resource
    API
  PCI: endpoint: pci-epf-test: Add embedded doorbell variant
  misc: pci_endpoint_test: Allow selecting embedded doorbell
  selftests: pci_endpoint: Exercise MSI and embedded doorbell

 drivers/dma/dw-edma/dw-edma-core.c            | 116 ++++++++++-
 drivers/dma/dw-edma/dw-edma-core.h            |  38 ++++
 drivers/dma/dw-edma/dw-edma-v0-core.c         |  44 +++-
 drivers/misc/pci_endpoint_test.c              |  11 +-
 .../pci/controller/dwc/pcie-designware-ep.c   |  85 ++++++++
 drivers/pci/controller/dwc/pcie-designware.c  |   4 +
 drivers/pci/controller/dwc/pcie-designware.h  |   2 +
 drivers/pci/endpoint/functions/pci-epf-test.c | 193 +++++++++++++++++-
 drivers/pci/endpoint/pci-epc-core.c           |  41 ++++
 include/linux/dma/edma.h                      |  48 +++++
 include/linux/pci-epc.h                       |  46 +++++
 .../pci_endpoint/pci_endpoint_test.c          |  17 +-
 12 files changed, 621 insertions(+), 24 deletions(-)

-- 
2.51.0


Reply via email to