2022-07-08 17:44:23

by Ben Dooks

[permalink] [raw]
Subject: dw-axi-dmac updates (debug, minor bugfixes)

During some recent testing, it was useful to have a dump of the
registers during an channel dump and a couple of minor bugs were
found with issues where a slow response or race condition occured.



2022-07-08 17:46:17

by Ben Dooks

[permalink] [raw]
Subject: [PATCH 3/3] dmaengine: dw-axi-dmac: ignore interrupt if no descriptor

If the channel has no descriptor and the interrupt is raised then the
kernel will OOPS. Check the result of vchan_next_desc() in the handler
axi_chan_block_xfer_complete() to avoid the error happening.

Signed-off-by: Ben Dooks <[email protected]>
---
drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
index d6ef5f49f281..1fedf4376678 100644
--- a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
+++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
@@ -1082,6 +1082,11 @@ static void axi_chan_block_xfer_complete(struct axi_dma_chan *chan)

/* The completed descriptor currently is in the head of vc list */
vd = vchan_next_desc(&chan->vc);
+ if (!vd) {
+ dev_err(chan2dev(chan), "BUG: %s, IRQ with no descriptors\n",
+ axi_chan_name(chan));
+ goto out;
+ }

if (chan->cyclic) {
desc = vd_to_axi_desc(vd);
@@ -1111,6 +1116,7 @@ static void axi_chan_block_xfer_complete(struct axi_dma_chan *chan)
axi_chan_start_first_queued(chan);
}

+out:
spin_unlock_irqrestore(&chan->vc.lock, flags);
}

--
2.35.1

2022-07-21 13:15:43

by Vinod Koul

[permalink] [raw]
Subject: Re: [PATCH 3/3] dmaengine: dw-axi-dmac: ignore interrupt if no descriptor

On 08-07-22, 18:01, Ben Dooks wrote:
> If the channel has no descriptor and the interrupt is raised then the
> kernel will OOPS. Check the result of vchan_next_desc() in the handler
> axi_chan_block_xfer_complete() to avoid the error happening.

Applied, thanks

>
> Signed-off-by: Ben Dooks <[email protected]>
> ---
> drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
> index d6ef5f49f281..1fedf4376678 100644
> --- a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
> +++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
> @@ -1082,6 +1082,11 @@ static void axi_chan_block_xfer_complete(struct axi_dma_chan *chan)
>
> /* The completed descriptor currently is in the head of vc list */
> vd = vchan_next_desc(&chan->vc);
> + if (!vd) {
> + dev_err(chan2dev(chan), "BUG: %s, IRQ with no descriptors\n",
> + axi_chan_name(chan));
> + goto out;
> + }
>
> if (chan->cyclic) {
> desc = vd_to_axi_desc(vd);
> @@ -1111,6 +1116,7 @@ static void axi_chan_block_xfer_complete(struct axi_dma_chan *chan)
> axi_chan_start_first_queued(chan);
> }
>
> +out:
> spin_unlock_irqrestore(&chan->vc.lock, flags);
> }
>
> --
> 2.35.1

--
~Vinod