Re: [PATCH v9 23/27] dmaengine: dw-edma: Add mem-mapped LL-entries support

Bjorn Helgaas
2023-02-21T23:01:00Z

On Fri, Jan 13, 2023 at 08:14:05PM +0300, Serge Semin wrote:
> Currently the DW eDMA driver only supports the linked lists memory
> allocated locally with respect to the remote eDMA engine setup. It means
> the linked lists will be accessible by the CPU via the MMIO space only. If
> eDMA is embedded into the DW PCIe Root Ports or local End-points (which
> support will be added in one of the following up commits) the linked lists
> are supposed to be allocated in the CPU memory. In that case the
> LL-entries can be directly accessed meanwhile the former case implies
> using the MMIO-accessors for that.
>
> In order to have both cases supported by the driver the dw_edma_region
> descriptor should be fixed to contain the MMIO-backed and just
> memory-based virtual addresses. The linked lists initialization procedure
> will use one of them depending on the eDMA device nature. If the eDMA
> engine is embedded into the local DW PCIe RP/EP controllers then the list
> entries will be directly accessed by referencing the corresponding
> structure fields. Otherwise the MMIO accessors usage will be preserved.
>
> Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>

Hi Vinod, I just realized that I didn't solicit your ack for this
patch and the following one (which I ended up splitting into two), and
I hate to ask Linus to pull them without your OK.

Here are the current versions in the PCI tree:

https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git/commit/?id=b47364a83054
https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git/commit/?id=157ce95927c1
https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git/commit/?id=536e6529e975

If you ack them, I will update them to reflect that.

Thanks,
Bjorn

> Changelog v9:
> - This is a new patch added on v9 stage of the series.
> ---
> drivers/dma/dw-edma/dw-edma-pcie.c | 32 ++++++-------
> drivers/dma/dw-edma/dw-edma-v0-core.c | 69 +++++++++++++++++----------
> include/linux/dma/edma.h | 5 +-
> 3 files changed, 64 insertions(+), 42 deletions(-)
>
> diff --git a/drivers/dma/dw-edma/dw-edma-pcie.c b/drivers/dma/dw-edma/dw-edma-pcie.c
> index 3f9dadc73854..2b40f2b44f5e 100644
> --- a/drivers/dma/dw-edma/dw-edma-pcie.c
> +++ b/drivers/dma/dw-edma/dw-edma-pcie.c
> @@ -240,20 +240,20 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev,
> struct dw_edma_block *ll_block = &vsec_data.ll_wr[i];
> struct dw_edma_block *dt_block = &vsec_data.dt_wr[i];
>
> - ll_region->vaddr = pcim_iomap_table(pdev)[ll_block->bar];
> - if (!ll_region->vaddr)
> + ll_region->vaddr.io = pcim_iomap_table(pdev)[ll_block->bar];
> + if (!ll_region->vaddr.io)
> ...