stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 07/33] dmaengine: at_hdmac: Fix at_lli struct definition
       [not found] <20220820125717.588722-1-tudor.ambarus@microchip.com>
@ 2022-08-20 12:56 ` Tudor Ambarus
  2022-10-19 16:38   ` Vinod Koul
  2022-08-20 12:56 ` [PATCH 08/33] dmaengine: at_hdmac: Don't start transactions at tx_submit level Tudor Ambarus
                   ` (12 subsequent siblings)
  13 siblings, 1 reply; 16+ messages in thread
From: Tudor Ambarus @ 2022-08-20 12:56 UTC (permalink / raw)
  To: vkoul, peda, du, regressions
  Cc: ludovic.desroches, maciej.sosnowski, tudor.ambarus,
	dan.j.williams, nicolas.ferre, mripard, torfl6749, linux-kernel,
	dmaengine, linux-arm-kernel, Tudor Ambarus, stable

From: Tudor Ambarus <tudor.ambarus@gmail.com>

Those hardware registers are all of 32 bits, while dma_addr_t ca be of
type u64 or u32 depending on CONFIG_ARCH_DMA_ADDR_T_64BIT. Force u32 to
comply with what the hardware expects.

Fixes: dc78baa2b90b ("dmaengine: at_hdmac: new driver for the Atmel AHB DMA Controller")
Signed-off-by: Tudor Ambarus <tudor.ambarus@gmail.com>
Cc: stable@vger.kernel.org
---
 drivers/dma/at_hdmac.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index 91e53a590d5f..e89facf14fab 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -187,13 +187,13 @@
 /* LLI == Linked List Item; aka DMA buffer descriptor */
 struct at_lli {
 	/* values that are not changed by hardware */
-	dma_addr_t	saddr;
-	dma_addr_t	daddr;
+	u32 saddr;
+	u32 daddr;
 	/* value that may get written back: */
-	u32		ctrla;
+	u32 ctrla;
 	/* more values that are not changed by hardware */
-	u32		ctrlb;
-	dma_addr_t	dscr;	/* chain to next lli */
+	u32 ctrlb;
+	u32 dscr;	/* chain to next lli */
 };
 
 /**
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 08/33] dmaengine: at_hdmac: Don't start transactions at tx_submit level
       [not found] <20220820125717.588722-1-tudor.ambarus@microchip.com>
  2022-08-20 12:56 ` [PATCH 07/33] dmaengine: at_hdmac: Fix at_lli struct definition Tudor Ambarus
@ 2022-08-20 12:56 ` Tudor Ambarus
  2022-08-20 12:56 ` [PATCH 09/33] dmaengine: at_hdmac: Start transfer for cyclic channels in issue_pending Tudor Ambarus
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Tudor Ambarus @ 2022-08-20 12:56 UTC (permalink / raw)
  To: vkoul, peda, du, regressions
  Cc: ludovic.desroches, maciej.sosnowski, tudor.ambarus,
	dan.j.williams, nicolas.ferre, mripard, torfl6749, linux-kernel,
	dmaengine, linux-arm-kernel, stable

tx_submit is supposed to push the current transaction descriptor to a
pending queue, waiting for issue_pending() to be called. issue_pending()
must start the transfer, not tx_submit(), thus remove atc_dostart() from
atc_tx_submit(). Clients of at_xdmac that  assume that tx_submit() starts
the transfer must be updated and call dma_async_issue_pending() if they
miss to call it.
The vdbg print was moved to after the lock is released. It is desirable to
do the prints without the lock held if possible, and because the if
statement disappears there's no reason why to do the print while holding
the lock.

Fixes: dc78baa2b90b ("dmaengine: at_hdmac: new driver for the Atmel AHB DMA Controller")
Reported-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/lkml/13c6c9a2-6db5-c3bf-349b-4c127ad3496a@axentia.se/
---
 drivers/dma/at_hdmac.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index e89facf14fab..b6b1d2dcfc4c 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -1126,19 +1126,11 @@ static dma_cookie_t atc_tx_submit(struct dma_async_tx_descriptor *tx)
 	spin_lock_irqsave(&atchan->lock, flags);
 	cookie = dma_cookie_assign(tx);
 
-	if (list_empty(&atchan->active_list)) {
-		dev_vdbg(chan2dev(tx->chan), "tx_submit: started %u\n",
-				desc->txd.cookie);
-		atc_dostart(atchan, desc);
-		list_add_tail(&desc->desc_node, &atchan->active_list);
-	} else {
-		dev_vdbg(chan2dev(tx->chan), "tx_submit: queued %u\n",
-				desc->txd.cookie);
-		list_add_tail(&desc->desc_node, &atchan->queue);
-	}
-
+	list_add_tail(&desc->desc_node, &atchan->queue);
 	spin_unlock_irqrestore(&atchan->lock, flags);
 
+	dev_vdbg(chan2dev(tx->chan), "tx_submit: queued %u\n",
+		 desc->txd.cookie);
 	return cookie;
 }
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 09/33] dmaengine: at_hdmac: Start transfer for cyclic channels in issue_pending
       [not found] <20220820125717.588722-1-tudor.ambarus@microchip.com>
  2022-08-20 12:56 ` [PATCH 07/33] dmaengine: at_hdmac: Fix at_lli struct definition Tudor Ambarus
  2022-08-20 12:56 ` [PATCH 08/33] dmaengine: at_hdmac: Don't start transactions at tx_submit level Tudor Ambarus
@ 2022-08-20 12:56 ` Tudor Ambarus
  2022-08-20 12:56 ` [PATCH 10/33] dmaengine: at_hdmac: Fix premature completion of desc " Tudor Ambarus
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Tudor Ambarus @ 2022-08-20 12:56 UTC (permalink / raw)
  To: vkoul, peda, du, regressions
  Cc: ludovic.desroches, maciej.sosnowski, tudor.ambarus,
	dan.j.williams, nicolas.ferre, mripard, torfl6749, linux-kernel,
	dmaengine, linux-arm-kernel, stable

Cyclic channels must too call issue_pending in order to start a transfer.
Start the transfer in issue_pending regardless of the type of channel.
This wrongly worked before, because in the past the transfer was started
at tx_submit level when only a desc in the transfer list.

Fixes: 53830cc75974 ("dmaengine: at_hdmac: add cyclic DMA operation support")
Reported-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/lkml/13c6c9a2-6db5-c3bf-349b-4c127ad3496a@axentia.se/
---
 drivers/dma/at_hdmac.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index b6b1d2dcfc4c..d9f492081e76 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -1972,10 +1972,6 @@ static void atc_issue_pending(struct dma_chan *chan)
 
 	dev_vdbg(chan2dev(chan), "issue_pending\n");
 
-	/* Not needed for cyclic transfers */
-	if (atc_chan_is_cyclic(atchan))
-		return;
-
 	atc_advance_work(atchan);
 }
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 10/33] dmaengine: at_hdmac: Fix premature completion of desc in issue_pending
       [not found] <20220820125717.588722-1-tudor.ambarus@microchip.com>
                   ` (2 preceding siblings ...)
  2022-08-20 12:56 ` [PATCH 09/33] dmaengine: at_hdmac: Start transfer for cyclic channels in issue_pending Tudor Ambarus
@ 2022-08-20 12:56 ` Tudor Ambarus
  2022-08-20 12:56 ` [PATCH 11/33] dmaengine: at_hdmac: Do not call the complete callback on device_terminate_all Tudor Ambarus
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Tudor Ambarus @ 2022-08-20 12:56 UTC (permalink / raw)
  To: vkoul, peda, du, regressions
  Cc: ludovic.desroches, maciej.sosnowski, tudor.ambarus,
	dan.j.williams, nicolas.ferre, mripard, torfl6749, linux-kernel,
	dmaengine, linux-arm-kernel, stable

Multiple calls to atc_issue_pending() could result in a premature
completion of a descriptor from the atchan->active list, as the method
always completed the first active descriptor from the list. Instead,
issue_pending() should just take the first transaction descriptor from the
pending queue, move it to active_list and start the transfer.

Fixes: dc78baa2b90b ("dmaengine: at_hdmac: new driver for the Atmel AHB DMA Controller")
Reported-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/lkml/13c6c9a2-6db5-c3bf-349b-4c127ad3496a@axentia.se/
---
 drivers/dma/at_hdmac.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index d9f492081e76..c445575f8646 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -1963,16 +1963,26 @@ atc_tx_status(struct dma_chan *chan,
 }
 
 /**
- * atc_issue_pending - try to finish work
+ * atc_issue_pending - takes the first transaction descriptor in the pending
+ * queue and starts the transfer.
  * @chan: target DMA channel
  */
 static void atc_issue_pending(struct dma_chan *chan)
 {
-	struct at_dma_chan	*atchan = to_at_dma_chan(chan);
+	struct at_dma_chan *atchan = to_at_dma_chan(chan);
+	struct at_desc *desc;
+	unsigned long flags;
 
 	dev_vdbg(chan2dev(chan), "issue_pending\n");
 
-	atc_advance_work(atchan);
+	spin_lock_irqsave(&atchan->lock, flags);
+	if (atc_chan_is_enabled(atchan) || list_empty(&atchan->queue))
+		return spin_unlock_irqrestore(&atchan->lock, flags);
+
+	desc = atc_first_queued(atchan);
+	list_move_tail(&desc->desc_node, &atchan->active_list);
+	atc_dostart(atchan, desc);
+	spin_unlock_irqrestore(&atchan->lock, flags);
 }
 
 /**
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 11/33] dmaengine: at_hdmac: Do not call the complete callback on device_terminate_all
       [not found] <20220820125717.588722-1-tudor.ambarus@microchip.com>
                   ` (3 preceding siblings ...)
  2022-08-20 12:56 ` [PATCH 10/33] dmaengine: at_hdmac: Fix premature completion of desc " Tudor Ambarus
@ 2022-08-20 12:56 ` Tudor Ambarus
  2022-08-20 12:56 ` [PATCH 12/33] dmaengine: at_hdmac: Protect atchan->status with the channel lock Tudor Ambarus
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Tudor Ambarus @ 2022-08-20 12:56 UTC (permalink / raw)
  To: vkoul, peda, du, regressions
  Cc: ludovic.desroches, maciej.sosnowski, tudor.ambarus,
	dan.j.williams, nicolas.ferre, mripard, torfl6749, linux-kernel,
	dmaengine, linux-arm-kernel, stable

The method was wrong because it violated the dmaengine API. For aborted
transfers the complete callback should not be called. Fix the behavior and
do not call the complete callback on device_terminate_all.

Fixes: 808347f6a317 ("dmaengine: at_hdmac: add DMA slave transfers")
Reported-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/lkml/13c6c9a2-6db5-c3bf-349b-4c127ad3496a@axentia.se/
---
 drivers/dma/at_hdmac.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index c445575f8646..b3895e5d2ae9 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -1879,11 +1879,8 @@ static int atc_terminate_all(struct dma_chan *chan)
 	struct at_dma_chan	*atchan = to_at_dma_chan(chan);
 	struct at_dma		*atdma = to_at_dma(chan->device);
 	int			chan_id = atchan->dma_chan.chan_id;
-	struct at_desc		*desc, *_desc;
 	unsigned long		flags;
 
-	LIST_HEAD(list);
-
 	dev_vdbg(chan2dev(chan), "%s\n", __func__);
 
 	/*
@@ -1902,15 +1899,11 @@ static int atc_terminate_all(struct dma_chan *chan)
 		cpu_relax();
 
 	/* active_list entries will end up before queued entries */
-	list_splice_init(&atchan->queue, &list);
-	list_splice_init(&atchan->active_list, &list);
+	list_splice_tail_init(&atchan->queue, &atchan->free_list);
+	list_splice_tail_init(&atchan->active_list, &atchan->free_list);
 
 	spin_unlock_irqrestore(&atchan->lock, flags);
 
-	/* Flush all pending and queued descriptors */
-	list_for_each_entry_safe(desc, _desc, &list, desc_node)
-		atc_chain_complete(atchan, desc);
-
 	clear_bit(ATC_IS_PAUSED, &atchan->status);
 	/* if channel dedicated to cyclic operations, free it */
 	clear_bit(ATC_IS_CYCLIC, &atchan->status);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 12/33] dmaengine: at_hdmac: Protect atchan->status with the channel lock
       [not found] <20220820125717.588722-1-tudor.ambarus@microchip.com>
                   ` (4 preceding siblings ...)
  2022-08-20 12:56 ` [PATCH 11/33] dmaengine: at_hdmac: Do not call the complete callback on device_terminate_all Tudor Ambarus
@ 2022-08-20 12:56 ` Tudor Ambarus
  2022-08-20 12:56 ` [PATCH 13/33] dmaengine: at_hdmac: Fix concurrency problems by removing atc_complete_all() Tudor Ambarus
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Tudor Ambarus @ 2022-08-20 12:56 UTC (permalink / raw)
  To: vkoul, peda, du, regressions
  Cc: ludovic.desroches, maciej.sosnowski, tudor.ambarus,
	dan.j.williams, nicolas.ferre, mripard, torfl6749, linux-kernel,
	dmaengine, linux-arm-kernel, stable

Now that the complete callback call was removed from
device_terminate_all(), we can protect the atchan->status with the channel
lock. The atomic bitops on atchan->status do not substitute proper locking
on the status, as one could still modify the status after the lock was
dropped in atc_terminate_all() but before the atomic bitops were executed.

Fixes: 078a6506141a ("dmaengine: at_hdmac: Fix deadlocks")
Reported-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/lkml/13c6c9a2-6db5-c3bf-349b-4c127ad3496a@axentia.se/
---
 drivers/dma/at_hdmac.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index b3895e5d2ae9..aeb241832c52 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -1902,12 +1902,12 @@ static int atc_terminate_all(struct dma_chan *chan)
 	list_splice_tail_init(&atchan->queue, &atchan->free_list);
 	list_splice_tail_init(&atchan->active_list, &atchan->free_list);
 
-	spin_unlock_irqrestore(&atchan->lock, flags);
-
 	clear_bit(ATC_IS_PAUSED, &atchan->status);
 	/* if channel dedicated to cyclic operations, free it */
 	clear_bit(ATC_IS_CYCLIC, &atchan->status);
 
+	spin_unlock_irqrestore(&atchan->lock, flags);
+
 	return 0;
 }
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 13/33] dmaengine: at_hdmac: Fix concurrency problems by removing atc_complete_all()
       [not found] <20220820125717.588722-1-tudor.ambarus@microchip.com>
                   ` (5 preceding siblings ...)
  2022-08-20 12:56 ` [PATCH 12/33] dmaengine: at_hdmac: Protect atchan->status with the channel lock Tudor Ambarus
@ 2022-08-20 12:56 ` Tudor Ambarus
  2022-08-20 12:56 ` [PATCH 14/33] dmaengine: at_hdmac: Fix concurrency over descriptor Tudor Ambarus
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Tudor Ambarus @ 2022-08-20 12:56 UTC (permalink / raw)
  To: vkoul, peda, du, regressions
  Cc: ludovic.desroches, maciej.sosnowski, tudor.ambarus,
	dan.j.williams, nicolas.ferre, mripard, torfl6749, linux-kernel,
	dmaengine, linux-arm-kernel, stable

atc_complete_all() had concurrency bugs, thus remove it:
1/ atc_complete_all() in its entirety was buggy, as when the atchan->queue
list (the one that contains descriptors that are not yet issued to the
hardware) contained descriptors, it fired just the first from the
atchan->queue, but moved all the desc from atchan->queue to
atchan->active_list and considered them all as fired. This could result in
calling the completion of a descriptor that was not yet issued to the
hardware.
2/ when in tasklet at atc_advance_work() time, atchan->active_list was
queried without holding the lock of the chan. This can result in
atchan->active_list concurrency problems between the tasklet and
issue_pending().

Fixes: dc78baa2b90b ("dmaengine: at_hdmac: new driver for the Atmel AHB DMA Controller")
Reported-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/lkml/13c6c9a2-6db5-c3bf-349b-4c127ad3496a@axentia.se/
---
 drivers/dma/at_hdmac.c | 49 ++++--------------------------------------
 1 file changed, 4 insertions(+), 45 deletions(-)

diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index aeb241832c52..10424a6fcbbf 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -920,42 +920,6 @@ atc_chain_complete(struct at_dma_chan *atchan, struct at_desc *desc)
 	dma_run_dependencies(txd);
 }
 
-/**
- * atc_complete_all - finish work for all transactions
- * @atchan: channel to complete transactions for
- *
- * Eventually submit queued descriptors if any
- *
- * Assume channel is idle while calling this function
- * Called with atchan->lock held and bh disabled
- */
-static void atc_complete_all(struct at_dma_chan *atchan)
-{
-	struct at_desc *desc, *_desc;
-	LIST_HEAD(list);
-	unsigned long flags;
-
-	dev_vdbg(chan2dev(&atchan->dma_chan), "complete all\n");
-
-	spin_lock_irqsave(&atchan->lock, flags);
-
-	/*
-	 * Submit queued descriptors ASAP, i.e. before we go through
-	 * the completed ones.
-	 */
-	if (!list_empty(&atchan->queue))
-		atc_dostart(atchan, atc_first_queued(atchan));
-	/* empty active_list now it is completed */
-	list_splice_init(&atchan->active_list, &list);
-	/* empty queue list by moving descriptors (if any) to active_list */
-	list_splice_init(&atchan->queue, &atchan->active_list);
-
-	spin_unlock_irqrestore(&atchan->lock, flags);
-
-	list_for_each_entry_safe(desc, _desc, &list, desc_node)
-		atc_chain_complete(atchan, desc);
-}
-
 /**
  * atc_advance_work - at the end of a transaction, move forward
  * @atchan: channel where the transaction ended
@@ -963,25 +927,20 @@ static void atc_complete_all(struct at_dma_chan *atchan)
 static void atc_advance_work(struct at_dma_chan *atchan)
 {
 	unsigned long flags;
-	int ret;
 
 	dev_vdbg(chan2dev(&atchan->dma_chan), "advance_work\n");
 
 	spin_lock_irqsave(&atchan->lock, flags);
-	ret = atc_chan_is_enabled(atchan);
+	if (atc_chan_is_enabled(atchan) || list_empty(&atchan->active_list))
+		return spin_unlock_irqrestore(&atchan->lock, flags);
 	spin_unlock_irqrestore(&atchan->lock, flags);
-	if (ret)
-		return;
-
-	if (list_empty(&atchan->active_list) ||
-	    list_is_singular(&atchan->active_list))
-		return atc_complete_all(atchan);
 
 	atc_chain_complete(atchan, atc_first_active(atchan));
 
 	/* advance work */
 	spin_lock_irqsave(&atchan->lock, flags);
-	atc_dostart(atchan, atc_first_active(atchan));
+	if (!list_empty(&atchan->active_list))
+		atc_dostart(atchan, atc_first_active(atchan));
 	spin_unlock_irqrestore(&atchan->lock, flags);
 }
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 14/33] dmaengine: at_hdmac: Fix concurrency over descriptor
       [not found] <20220820125717.588722-1-tudor.ambarus@microchip.com>
                   ` (6 preceding siblings ...)
  2022-08-20 12:56 ` [PATCH 13/33] dmaengine: at_hdmac: Fix concurrency problems by removing atc_complete_all() Tudor Ambarus
@ 2022-08-20 12:56 ` Tudor Ambarus
  2022-08-20 12:56 ` [PATCH 15/33] dmaengine: at_hdmac: Free the memset buf without holding the chan lock Tudor Ambarus
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Tudor Ambarus @ 2022-08-20 12:56 UTC (permalink / raw)
  To: vkoul, peda, du, regressions
  Cc: ludovic.desroches, maciej.sosnowski, tudor.ambarus,
	dan.j.williams, nicolas.ferre, mripard, torfl6749, linux-kernel,
	dmaengine, linux-arm-kernel, stable

The descriptor was added to the free_list before calling the callback,
which could result in reissuing of the same descriptor and calling of a
single callback for both. Move the decriptor to the free list after the
callback is invoked.

Fixes: dc78baa2b90b ("dmaengine: at_hdmac: new driver for the Atmel AHB DMA Controller")
Reported-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/lkml/13c6c9a2-6db5-c3bf-349b-4c127ad3496a@axentia.se/
---
 drivers/dma/at_hdmac.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index 10424a6fcbbf..b3184da7ced4 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -904,11 +904,8 @@ atc_chain_complete(struct at_dma_chan *atchan, struct at_desc *desc)
 		desc->memset_buffer = false;
 	}
 
-	/* move children to free_list */
-	list_splice_init(&desc->tx_list, &atchan->free_list);
-	/* move myself to free_list */
-	list_move(&desc->desc_node, &atchan->free_list);
-
+	/* Remove transfer node from the active list. */
+	list_del_init(&desc->desc_node);
 	spin_unlock_irqrestore(&atchan->lock, flags);
 
 	dma_descriptor_unmap(txd);
@@ -918,6 +915,13 @@ atc_chain_complete(struct at_dma_chan *atchan, struct at_desc *desc)
 		dmaengine_desc_get_callback_invoke(txd, NULL);
 
 	dma_run_dependencies(txd);
+
+	spin_lock_irqsave(&atchan->lock, flags);
+	/* move children to free_list */
+	list_splice_init(&desc->tx_list, &atchan->free_list);
+	/* add myself to free_list */
+	list_add(&desc->desc_node, &atchan->free_list);
+	spin_unlock_irqrestore(&atchan->lock, flags);
 }
 
 /**
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 15/33] dmaengine: at_hdmac: Free the memset buf without holding the chan lock
       [not found] <20220820125717.588722-1-tudor.ambarus@microchip.com>
                   ` (7 preceding siblings ...)
  2022-08-20 12:56 ` [PATCH 14/33] dmaengine: at_hdmac: Fix concurrency over descriptor Tudor Ambarus
@ 2022-08-20 12:56 ` Tudor Ambarus
  2022-08-20 12:57 ` [PATCH 16/33] dmaengine: at_hdmac: Fix concurrency over the active list Tudor Ambarus
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Tudor Ambarus @ 2022-08-20 12:56 UTC (permalink / raw)
  To: vkoul, peda, du, regressions
  Cc: ludovic.desroches, maciej.sosnowski, tudor.ambarus,
	dan.j.williams, nicolas.ferre, mripard, torfl6749, linux-kernel,
	dmaengine, linux-arm-kernel, stable

There's no need to hold the channel lock when freeing the memset buf, as
the operation has already completed. Free the memset buf without holding
the channel lock.

Fixes: 4d112426c344 ("dmaengine: hdmac: Add memset capabilities")
Reported-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/lkml/13c6c9a2-6db5-c3bf-349b-4c127ad3496a@axentia.se/
---
 drivers/dma/at_hdmac.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index b3184da7ced4..c2b3d7b63920 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -897,13 +897,6 @@ atc_chain_complete(struct at_dma_chan *atchan, struct at_desc *desc)
 	if (!atc_chan_is_cyclic(atchan))
 		dma_cookie_complete(txd);
 
-	/* If the transfer was a memset, free our temporary buffer */
-	if (desc->memset_buffer) {
-		dma_pool_free(atdma->memset_pool, desc->memset_vaddr,
-			      desc->memset_paddr);
-		desc->memset_buffer = false;
-	}
-
 	/* Remove transfer node from the active list. */
 	list_del_init(&desc->desc_node);
 	spin_unlock_irqrestore(&atchan->lock, flags);
@@ -922,6 +915,13 @@ atc_chain_complete(struct at_dma_chan *atchan, struct at_desc *desc)
 	/* add myself to free_list */
 	list_add(&desc->desc_node, &atchan->free_list);
 	spin_unlock_irqrestore(&atchan->lock, flags);
+
+	/* If the transfer was a memset, free our temporary buffer */
+	if (desc->memset_buffer) {
+		dma_pool_free(atdma->memset_pool, desc->memset_vaddr,
+			      desc->memset_paddr);
+		desc->memset_buffer = false;
+	}
 }
 
 /**
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 16/33] dmaengine: at_hdmac: Fix concurrency over the active list
       [not found] <20220820125717.588722-1-tudor.ambarus@microchip.com>
                   ` (8 preceding siblings ...)
  2022-08-20 12:56 ` [PATCH 15/33] dmaengine: at_hdmac: Free the memset buf without holding the chan lock Tudor Ambarus
@ 2022-08-20 12:57 ` Tudor Ambarus
  2022-08-20 12:57 ` [PATCH 17/33] dmaengine: at_hdmac: Fix descriptor handling when issuing it to hardware Tudor Ambarus
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Tudor Ambarus @ 2022-08-20 12:57 UTC (permalink / raw)
  To: vkoul, peda, du, regressions
  Cc: ludovic.desroches, maciej.sosnowski, tudor.ambarus,
	dan.j.williams, nicolas.ferre, mripard, torfl6749, linux-kernel,
	dmaengine, linux-arm-kernel, stable

The tasklet did not held the channel lock when retrieving the first active
descriptor, causing concurrency problems if issue_pending() was called in
between. If issue_pending() was called exactly after the lock was released
in the tasklet, atc_chain_complete() could complete a descriptor for which
the controller has not yet raised an interrupt.

Fixes: dc78baa2b90b ("dmaengine: at_hdmac: new driver for the Atmel AHB DMA Controller")
Reported-by: Peter Rosin <peda@axentia.se>
Cc: stable@vger.kernel.org
Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
Link: https://lore.kernel.org/lkml/13c6c9a2-6db5-c3bf-349b-4c127ad3496a@axentia.se/
---
 drivers/dma/at_hdmac.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index c2b3d7b63920..635c3be74399 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -897,8 +897,6 @@ atc_chain_complete(struct at_dma_chan *atchan, struct at_desc *desc)
 	if (!atc_chan_is_cyclic(atchan))
 		dma_cookie_complete(txd);
 
-	/* Remove transfer node from the active list. */
-	list_del_init(&desc->desc_node);
 	spin_unlock_irqrestore(&atchan->lock, flags);
 
 	dma_descriptor_unmap(txd);
@@ -930,6 +928,7 @@ atc_chain_complete(struct at_dma_chan *atchan, struct at_desc *desc)
  */
 static void atc_advance_work(struct at_dma_chan *atchan)
 {
+	struct at_desc *desc;
 	unsigned long flags;
 
 	dev_vdbg(chan2dev(&atchan->dma_chan), "advance_work\n");
@@ -937,9 +936,12 @@ static void atc_advance_work(struct at_dma_chan *atchan)
 	spin_lock_irqsave(&atchan->lock, flags);
 	if (atc_chan_is_enabled(atchan) || list_empty(&atchan->active_list))
 		return spin_unlock_irqrestore(&atchan->lock, flags);
-	spin_unlock_irqrestore(&atchan->lock, flags);
 
-	atc_chain_complete(atchan, atc_first_active(atchan));
+	desc = atc_first_active(atchan);
+	/* Remove the transfer node from the active list. */
+	list_del_init(&desc->desc_node);
+	spin_unlock_irqrestore(&atchan->lock, flags);
+	atc_chain_complete(atchan, desc);
 
 	/* advance work */
 	spin_lock_irqsave(&atchan->lock, flags);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 17/33] dmaengine: at_hdmac: Fix descriptor handling when issuing it to hardware
       [not found] <20220820125717.588722-1-tudor.ambarus@microchip.com>
                   ` (9 preceding siblings ...)
  2022-08-20 12:57 ` [PATCH 16/33] dmaengine: at_hdmac: Fix concurrency over the active list Tudor Ambarus
@ 2022-08-20 12:57 ` Tudor Ambarus
  2022-08-20 12:57 ` [PATCH 18/33] dmaengine: at_hdmac: Fix completion of unissued descriptor in case of errors Tudor Ambarus
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Tudor Ambarus @ 2022-08-20 12:57 UTC (permalink / raw)
  To: vkoul, peda, du, regressions
  Cc: ludovic.desroches, maciej.sosnowski, tudor.ambarus,
	dan.j.williams, nicolas.ferre, mripard, torfl6749, linux-kernel,
	dmaengine, linux-arm-kernel, stable

As it was before, the descriptor was issued to the hardware without adding
it to the active (issued) list. This could result in a completion of other
descriptor, or/and in the descriptor never being completed.

Fixes: dc78baa2b90b ("dmaengine: at_hdmac: new driver for the Atmel AHB DMA Controller")
Reported-by: Peter Rosin <peda@axentia.se>
Cc: stable@vger.kernel.org
Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
Link: https://lore.kernel.org/lkml/13c6c9a2-6db5-c3bf-349b-4c127ad3496a@axentia.se/
---
 drivers/dma/at_hdmac.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index 635c3be74399..e5ac73768d13 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -945,8 +945,11 @@ static void atc_advance_work(struct at_dma_chan *atchan)
 
 	/* advance work */
 	spin_lock_irqsave(&atchan->lock, flags);
-	if (!list_empty(&atchan->active_list))
-		atc_dostart(atchan, atc_first_active(atchan));
+	if (!list_empty(&atchan->active_list)) {
+		desc = atc_first_queued(atchan);
+		list_move_tail(&desc->desc_node, &atchan->active_list);
+		atc_dostart(atchan, desc);
+	}
 	spin_unlock_irqrestore(&atchan->lock, flags);
 }
 
@@ -958,6 +961,7 @@ static void atc_advance_work(struct at_dma_chan *atchan)
 static void atc_handle_error(struct at_dma_chan *atchan)
 {
 	struct at_desc *bad_desc;
+	struct at_desc *desc;
 	struct at_desc *child;
 	unsigned long flags;
 
@@ -975,8 +979,11 @@ static void atc_handle_error(struct at_dma_chan *atchan)
 	list_splice_init(&atchan->queue, atchan->active_list.prev);
 
 	/* Try to restart the controller */
-	if (!list_empty(&atchan->active_list))
-		atc_dostart(atchan, atc_first_active(atchan));
+	if (!list_empty(&atchan->active_list)) {
+		desc = atc_first_queued(atchan);
+		list_move_tail(&desc->desc_node, &atchan->active_list);
+		atc_dostart(atchan, desc);
+	}
 
 	/*
 	 * KERN_CRITICAL may seem harsh, but since this only happens
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 18/33] dmaengine: at_hdmac: Fix completion of unissued descriptor in case of errors
       [not found] <20220820125717.588722-1-tudor.ambarus@microchip.com>
                   ` (10 preceding siblings ...)
  2022-08-20 12:57 ` [PATCH 17/33] dmaengine: at_hdmac: Fix descriptor handling when issuing it to hardware Tudor Ambarus
@ 2022-08-20 12:57 ` Tudor Ambarus
  2022-08-20 12:57 ` [PATCH 19/33] dmaengine: at_hdmac: Don't allow CPU to reorder channel enable Tudor Ambarus
  2022-08-20 12:57 ` [PATCH 21/33] dmaengine: at_hdmac: Fix impossible condition Tudor Ambarus
  13 siblings, 0 replies; 16+ messages in thread
From: Tudor Ambarus @ 2022-08-20 12:57 UTC (permalink / raw)
  To: vkoul, peda, du, regressions
  Cc: ludovic.desroches, maciej.sosnowski, tudor.ambarus,
	dan.j.williams, nicolas.ferre, mripard, torfl6749, linux-kernel,
	dmaengine, linux-arm-kernel, stable

In case the controller detected an error, the code took the chance to move
all the queued (submitted) descriptors to the active (issued) list. This
was wrong as if there were any descriptors in the submitted list they were
moved to the issued list without actually issuing them to the controller,
thus a completion could be raised without even fireing the descriptor.

Fixes: dc78baa2b90b ("dmaengine: at_hdmac: new driver for the Atmel AHB DMA Controller")
Reported-by: Peter Rosin <peda@axentia.se>
Cc: stable@vger.kernel.org
Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
Link: https://lore.kernel.org/lkml/13c6c9a2-6db5-c3bf-349b-4c127ad3496a@axentia.se/
---
 drivers/dma/at_hdmac.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index e5ac73768d13..825a29ede35e 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -974,10 +974,6 @@ static void atc_handle_error(struct at_dma_chan *atchan)
 	bad_desc = atc_first_active(atchan);
 	list_del_init(&bad_desc->desc_node);
 
-	/* As we are stopped, take advantage to push queued descriptors
-	 * in active_list */
-	list_splice_init(&atchan->queue, atchan->active_list.prev);
-
 	/* Try to restart the controller */
 	if (!list_empty(&atchan->active_list)) {
 		desc = atc_first_queued(atchan);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 19/33] dmaengine: at_hdmac: Don't allow CPU to reorder channel enable
       [not found] <20220820125717.588722-1-tudor.ambarus@microchip.com>
                   ` (11 preceding siblings ...)
  2022-08-20 12:57 ` [PATCH 18/33] dmaengine: at_hdmac: Fix completion of unissued descriptor in case of errors Tudor Ambarus
@ 2022-08-20 12:57 ` Tudor Ambarus
  2022-08-20 12:57 ` [PATCH 21/33] dmaengine: at_hdmac: Fix impossible condition Tudor Ambarus
  13 siblings, 0 replies; 16+ messages in thread
From: Tudor Ambarus @ 2022-08-20 12:57 UTC (permalink / raw)
  To: vkoul, peda, du, regressions
  Cc: ludovic.desroches, maciej.sosnowski, tudor.ambarus,
	dan.j.williams, nicolas.ferre, mripard, torfl6749, linux-kernel,
	dmaengine, linux-arm-kernel, stable

at_hdmac uses __raw_writel for register writes. In the absence of a
barrier, the CPU may reorder the register operations.
Introduce a write memory barrier so that the CPU does not reorder the
channel enable, thus the start of the transfer, without making sure that
all the pre-required register fields are already written.

Fixes: dc78baa2b90b ("dmaengine: at_hdmac: new driver for the Atmel AHB DMA Controller")
Reported-by: Peter Rosin <peda@axentia.se>
Cc: stable@vger.kernel.org
Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
Link: https://lore.kernel.org/lkml/13c6c9a2-6db5-c3bf-349b-4c127ad3496a@axentia.se/
---
 drivers/dma/at_hdmac.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index 825a29ede35e..1cb0d26d30ed 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -691,6 +691,8 @@ static void atc_dostart(struct at_dma_chan *atchan, struct at_desc *first)
 	channel_writel(atchan, DPIP, FIELD_PREP(ATC_DPIP_HOLE,
 						first->dst_hole) |
 		       FIELD_PREP(ATC_DPIP_BOUNDARY, first->boundary));
+	/* Don't allow CPU to reorder channel enable. */
+	wmb();
 	dma_writel(atdma, CHER, atchan->mask);
 
 	vdbg_dump_regs(atchan);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 21/33] dmaengine: at_hdmac: Fix impossible condition
       [not found] <20220820125717.588722-1-tudor.ambarus@microchip.com>
                   ` (12 preceding siblings ...)
  2022-08-20 12:57 ` [PATCH 19/33] dmaengine: at_hdmac: Don't allow CPU to reorder channel enable Tudor Ambarus
@ 2022-08-20 12:57 ` Tudor Ambarus
  13 siblings, 0 replies; 16+ messages in thread
From: Tudor Ambarus @ 2022-08-20 12:57 UTC (permalink / raw)
  To: vkoul, peda, du, regressions
  Cc: ludovic.desroches, maciej.sosnowski, tudor.ambarus,
	dan.j.williams, nicolas.ferre, mripard, torfl6749, linux-kernel,
	dmaengine, linux-arm-kernel, stable

The iterator can not be greater than ATC_MAX_DSCR_TRIALS, as the for loop
will stop when i == ATC_MAX_DSCR_TRIALS. While here, use the common "i"
name for the iterator.

Fixes: 93dce3a6434f ("dmaengine: at_hdmac: fix residue computation")
Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
Cc: stable@vger.kernel.org
---
 drivers/dma/at_hdmac.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index 16cea65a708d..c72c796d58bc 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -753,7 +753,8 @@ static int atc_get_bytes_left(struct dma_chan *chan, dma_cookie_t cookie)
 	struct at_desc *desc_first = atc_first_active(atchan);
 	struct at_desc *desc;
 	int ret;
-	u32 ctrla, dscr, trials;
+	u32 ctrla, dscr;
+	unsigned int i;
 
 	/*
 	 * If the cookie doesn't match to the currently running transfer then
@@ -823,7 +824,7 @@ static int atc_get_bytes_left(struct dma_chan *chan, dma_cookie_t cookie)
 		dscr = channel_readl(atchan, DSCR);
 		rmb(); /* ensure DSCR is read before CTRLA */
 		ctrla = channel_readl(atchan, CTRLA);
-		for (trials = 0; trials < ATC_MAX_DSCR_TRIALS; ++trials) {
+		for (i = 0; i < ATC_MAX_DSCR_TRIALS; ++i) {
 			u32 new_dscr;
 
 			rmb(); /* ensure DSCR is read after CTRLA */
@@ -849,7 +850,7 @@ static int atc_get_bytes_left(struct dma_chan *chan, dma_cookie_t cookie)
 			rmb(); /* ensure DSCR is read before CTRLA */
 			ctrla = channel_readl(atchan, CTRLA);
 		}
-		if (unlikely(trials >= ATC_MAX_DSCR_TRIALS))
+		if (unlikely(i == ATC_MAX_DSCR_TRIALS))
 			return -ETIMEDOUT;
 
 		/* for the first descriptor we can be more accurate */
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH 07/33] dmaengine: at_hdmac: Fix at_lli struct definition
  2022-08-20 12:56 ` [PATCH 07/33] dmaengine: at_hdmac: Fix at_lli struct definition Tudor Ambarus
@ 2022-10-19 16:38   ` Vinod Koul
  2022-10-20  7:08     ` Tudor.Ambarus
  0 siblings, 1 reply; 16+ messages in thread
From: Vinod Koul @ 2022-10-19 16:38 UTC (permalink / raw)
  To: Tudor Ambarus
  Cc: peda, du, regressions, ludovic.desroches, maciej.sosnowski,
	dan.j.williams, nicolas.ferre, mripard, torfl6749, linux-kernel,
	dmaengine, linux-arm-kernel, Tudor Ambarus, stable

On 20-08-22, 15:56, Tudor Ambarus wrote:
> From: Tudor Ambarus <tudor.ambarus@gmail.com>
> 
> Those hardware registers are all of 32 bits, while dma_addr_t ca be of
> type u64 or u32 depending on CONFIG_ARCH_DMA_ADDR_T_64BIT. Force u32 to
> comply with what the hardware expects.
> 
> Fixes: dc78baa2b90b ("dmaengine: at_hdmac: new driver for the Atmel AHB DMA Controller")
> Signed-off-by: Tudor Ambarus <tudor.ambarus@gmail.com>
> Cc: stable@vger.kernel.org

Okay

> ---
>  drivers/dma/at_hdmac.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
> index 91e53a590d5f..e89facf14fab 100644
> --- a/drivers/dma/at_hdmac.c
> +++ b/drivers/dma/at_hdmac.c
> @@ -187,13 +187,13 @@
>  /* LLI == Linked List Item; aka DMA buffer descriptor */
>  struct at_lli {
>  	/* values that are not changed by hardware */
> -	dma_addr_t	saddr;
> -	dma_addr_t	daddr;
> +	u32 saddr;
> +	u32 daddr;

I think you should add fixes first in the series and then do header
move, that way we can backport this and other fixes to stable kernels...

>  	/* value that may get written back: */
> -	u32		ctrla;
> +	u32 ctrla;
>  	/* more values that are not changed by hardware */
> -	u32		ctrlb;
> -	dma_addr_t	dscr;	/* chain to next lli */
> +	u32 ctrlb;
> +	u32 dscr;	/* chain to next lli */
>  };
>  
>  /**
> -- 
> 2.25.1

-- 
~Vinod

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 07/33] dmaengine: at_hdmac: Fix at_lli struct definition
  2022-10-19 16:38   ` Vinod Koul
@ 2022-10-20  7:08     ` Tudor.Ambarus
  0 siblings, 0 replies; 16+ messages in thread
From: Tudor.Ambarus @ 2022-10-20  7:08 UTC (permalink / raw)
  To: vkoul
  Cc: peda, du, regressions, Ludovic.Desroches, maciej.sosnowski,
	dan.j.williams, Nicolas.Ferre, mripard, torfl6749, linux-kernel,
	dmaengine, linux-arm-kernel, tudor.ambarus, stable

On 10/19/22 19:38, Vinod Koul wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> On 20-08-22, 15:56, Tudor Ambarus wrote:
>> From: Tudor Ambarus <tudor.ambarus@gmail.com>
>>
>> Those hardware registers are all of 32 bits, while dma_addr_t ca be of
>> type u64 or u32 depending on CONFIG_ARCH_DMA_ADDR_T_64BIT. Force u32 to
>> comply with what the hardware expects.
>>
>> Fixes: dc78baa2b90b ("dmaengine: at_hdmac: new driver for the Atmel AHB DMA Controller")
>> Signed-off-by: Tudor Ambarus <tudor.ambarus@gmail.com>
>> Cc: stable@vger.kernel.org
> 
> Okay
> 
>> ---
>>  drivers/dma/at_hdmac.c | 10 +++++-----
>>  1 file changed, 5 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
>> index 91e53a590d5f..e89facf14fab 100644
>> --- a/drivers/dma/at_hdmac.c
>> +++ b/drivers/dma/at_hdmac.c
>> @@ -187,13 +187,13 @@
>>  /* LLI == Linked List Item; aka DMA buffer descriptor */
>>  struct at_lli {
>>       /* values that are not changed by hardware */
>> -     dma_addr_t      saddr;
>> -     dma_addr_t      daddr;
>> +     u32 saddr;
>> +     u32 daddr;
> 
> I think you should add fixes first in the series and then do header
> move, that way we can backport this and other fixes to stable kernels...

Right, would be easier indeed. Will do, thanks.

Cheers,
ta
> 
>>       /* value that may get written back: */
>> -     u32             ctrla;
>> +     u32 ctrla;
>>       /* more values that are not changed by hardware */
>> -     u32             ctrlb;
>> -     dma_addr_t      dscr;   /* chain to next lli */
>> +     u32 ctrlb;
>> +     u32 dscr;       /* chain to next lli */
>>  };
>>
>>  /**
>> --
>> 2.25.1
> 
> --
> ~Vinod

-- 
Cheers,
ta


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2022-10-20  7:09 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20220820125717.588722-1-tudor.ambarus@microchip.com>
2022-08-20 12:56 ` [PATCH 07/33] dmaengine: at_hdmac: Fix at_lli struct definition Tudor Ambarus
2022-10-19 16:38   ` Vinod Koul
2022-10-20  7:08     ` Tudor.Ambarus
2022-08-20 12:56 ` [PATCH 08/33] dmaengine: at_hdmac: Don't start transactions at tx_submit level Tudor Ambarus
2022-08-20 12:56 ` [PATCH 09/33] dmaengine: at_hdmac: Start transfer for cyclic channels in issue_pending Tudor Ambarus
2022-08-20 12:56 ` [PATCH 10/33] dmaengine: at_hdmac: Fix premature completion of desc " Tudor Ambarus
2022-08-20 12:56 ` [PATCH 11/33] dmaengine: at_hdmac: Do not call the complete callback on device_terminate_all Tudor Ambarus
2022-08-20 12:56 ` [PATCH 12/33] dmaengine: at_hdmac: Protect atchan->status with the channel lock Tudor Ambarus
2022-08-20 12:56 ` [PATCH 13/33] dmaengine: at_hdmac: Fix concurrency problems by removing atc_complete_all() Tudor Ambarus
2022-08-20 12:56 ` [PATCH 14/33] dmaengine: at_hdmac: Fix concurrency over descriptor Tudor Ambarus
2022-08-20 12:56 ` [PATCH 15/33] dmaengine: at_hdmac: Free the memset buf without holding the chan lock Tudor Ambarus
2022-08-20 12:57 ` [PATCH 16/33] dmaengine: at_hdmac: Fix concurrency over the active list Tudor Ambarus
2022-08-20 12:57 ` [PATCH 17/33] dmaengine: at_hdmac: Fix descriptor handling when issuing it to hardware Tudor Ambarus
2022-08-20 12:57 ` [PATCH 18/33] dmaengine: at_hdmac: Fix completion of unissued descriptor in case of errors Tudor Ambarus
2022-08-20 12:57 ` [PATCH 19/33] dmaengine: at_hdmac: Don't allow CPU to reorder channel enable Tudor Ambarus
2022-08-20 12:57 ` [PATCH 21/33] dmaengine: at_hdmac: Fix impossible condition Tudor Ambarus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).