From: Kory Maincent <[email protected]>
This patch series fix the support of dw-edma HDMA NATIVE IP.
I can only test it in remote HDMA IP setup with single dma transfer, but
with these fixes it works properly.
Few fixes has also been added for eDMA version. Similarly to HDMA I have
tested only eDMA in remote setup.
Kory Maincent (9):
dmaengine: dw-edma: Fix the ch_count hdma callback
dmaengine: dw-edma: Typos fixes
dmaengine: dw-edma: Add HDMA remote interrupt configuration
dmaengine: dw-edma: HDMA: Add memory barrier before starting the DMA
transfer in remote setup
dmaengine: dw-edma: HDMA: Fix possible race condition in remote setup
dmaengine: dw-edma: HDMA: Fix possible race condition in local setup
dmaengine: dw-edma: eDMA: Add memory barrier before starting the DMA
transfer in remote setup
dmaengine: dw-edma: eDMA: Fix possible race condition in remote setup
dmaengine: dw-edma: eDMA: Fix possible race condition in local setup
drivers/dma/dw-edma/dw-edma-v0-core.c | 23 ++++++++++++---
drivers/dma/dw-edma/dw-hdma-v0-core.c | 40 +++++++++++++++------------
drivers/dma/dw-edma/dw-hdma-v0-regs.h | 2 +-
3 files changed, 43 insertions(+), 22 deletions(-)
--
2.25.1
From: Kory Maincent <[email protected]>
When writing the linked list elements and pointer the control need to be
written at the end. If the control is written and the SAR and DAR not
stored we could face a race condition.
Fixes: 7e4b8a4fbe2c ("dmaengine: Add Synopsys eDMA IP version 0 support")
Signed-off-by: Kory Maincent <[email protected]>
---
drivers/dma/dw-edma/dw-edma-v0-core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/dma/dw-edma/dw-edma-v0-core.c b/drivers/dma/dw-edma/dw-edma-v0-core.c
index 2e872d6f2c04..a5d921ef54ec 100644
--- a/drivers/dma/dw-edma/dw-edma-v0-core.c
+++ b/drivers/dma/dw-edma/dw-edma-v0-core.c
@@ -291,10 +291,10 @@ static void dw_edma_v0_write_ll_data(struct dw_edma_chunk *chunk, int i,
} else {
struct dw_edma_v0_lli __iomem *lli = chunk->ll_region.vaddr.io + ofs;
- writel(control, &lli->control);
writel(size, &lli->transfer_size);
writeq(sar, &lli->sar.reg);
writeq(dar, &lli->dar.reg);
+ writel(control, &lli->control);
}
}
@@ -311,8 +311,8 @@ static void dw_edma_v0_write_ll_link(struct dw_edma_chunk *chunk,
} else {
struct dw_edma_v0_llp __iomem *llp = chunk->ll_region.vaddr.io + ofs;
- writel(control, &llp->control);
writeq(pointer, &llp->llp.reg);
+ writel(control, &llp->control);
}
}
--
2.25.1
From: Kory Maincent <[email protected]>
The Linked list element and pointer are not stored in the same memory as
the eDMA controller register. If the doorbell register is toggled before
the full write of the linked list a race condition error can appears.
In remote setup we can only use a readl to the memory to assured the full
write has occurred.
Fixes: 7e4b8a4fbe2c ("dmaengine: Add Synopsys eDMA IP version 0 support")
Signed-off-by: Kory Maincent <[email protected]>
---
drivers/dma/dw-edma/dw-edma-v0-core.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/dma/dw-edma/dw-edma-v0-core.c b/drivers/dma/dw-edma/dw-edma-v0-core.c
index b38786f0ad79..2e872d6f2c04 100644
--- a/drivers/dma/dw-edma/dw-edma-v0-core.c
+++ b/drivers/dma/dw-edma/dw-edma-v0-core.c
@@ -412,6 +412,15 @@ static void dw_edma_v0_core_start(struct dw_edma_chunk *chunk, bool first)
SET_CH_32(dw, chan->dir, chan->id, llp.msb,
upper_32_bits(chunk->ll_region.paddr));
}
+
+ if (!(chunk->chan->dw->chip->flags & DW_EDMA_CHIP_LOCAL))
+ /* Make sure Linked List has been written.
+ * Linux memory barriers don't cater for what's required here.
+ * What's required is what's here - a read of the linked
+ * list region.
+ */
+ readl(chunk->ll_region.vaddr.io);
+
/* Doorbell */
SET_RW_32(dw, chan->dir, doorbell,
FIELD_PREP(EDMA_V0_DOORBELL_CH_MASK, chan->id));
--
2.25.1
On Fri, 9 Jun 2023 10:16:45 +0200
Köry Maincent <[email protected]> wrote:
> From: Kory Maincent <[email protected]>
>
> This patch series fix the support of dw-edma HDMA NATIVE IP.
> I can only test it in remote HDMA IP setup with single dma transfer, but
> with these fixes it works properly.
>
> Few fixes has also been added for eDMA version. Similarly to HDMA I have
> tested only eDMA in remote setup.
FYI it seems several patches of this series has been categorized as spam.
I think it is because the code of these patches are quite similar.
Köry
Hi K?ry
On Mon, Jun 12, 2023 at 10:59:42AM +0200, K?ry Maincent wrote:
> On Fri, 9 Jun 2023 10:16:45 +0200
> K?ry Maincent <[email protected]> wrote:
>
> > From: Kory Maincent <[email protected]>
> >
> > This patch series fix the support of dw-edma HDMA NATIVE IP.
> > I can only test it in remote HDMA IP setup with single dma transfer, but
> > with these fixes it works properly.
> >
> > Few fixes has also been added for eDMA version. Similarly to HDMA I have
> > tested only eDMA in remote setup.
>
> FYI it seems several patches of this series has been categorized as spam.
> I think it is because the code of these patches are quite similar.
>
> K?ry
Thanks for notifying about that. The entire series landed in my inbox.
So no problem has been spotted on my side. I'll have a closer look at
the patchset sometime on this week.
-Serge(y)