Skip to contentSkip to conversation

dmaengine: ti: k3-udma: Fix the TR initialization for prep_slave_sg

PATCH In review Peter Ujfalusi 2 participants 3 messages Aug 24, 2020 – Aug 25, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dmaengine: ti: k3-udma: Fix the TR initialization for prep_slave_sg

The TR which needs to be initialized for the next sg entry is indexed by tr_idx and not by the running i counter.

In case any sub element in the SG needs more than one TR, the code would corrupt an already configured TR.

---
 drivers/dma/ti/k3-udma.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/dma/ti/k3-udma.c +3 -3
index c14e6cb105cd..30cb514cee54 100644
@@ -2059,9 +2059,9 @@ udma_prep_slave_sg_tr(struct udma_chan *uc, struct scatterlist *sgl,
 			return NULL;
 		}
 
-		cppi5_tr_init(&tr_req[i].flags, CPPI5_TR_TYPE1, false, false,
-			      CPPI5_TR_EVENT_SIZE_COMPLETION, 0);
-		cppi5_tr_csf_set(&tr_req[i].flags, CPPI5_TR_CSF_SUPR_EVT);
+		cppi5_tr_init(&tr_req[tr_idx].flags, CPPI5_TR_TYPE1, false,
+			      false, CPPI5_TR_EVENT_SIZE_COMPLETION, 0);
+		cppi5_tr_csf_set(&tr_req[tr_idx].flags, CPPI5_TR_CSF_SUPR_EVT);
 
 		tr_req[tr_idx].addr = sg_addr;
 		tr_req[tr_idx].icnt0 = tr0_cnt0;
Signature · 4 lines
Peter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
#1 lore raw

Vinod,

Quoted 5 lines · Peter Ujfalusi

The TR which needs to be initialized for the next sg entry is indexed by tr_idx and not by the running i counter.

In case any sub element in the SG needs more than one TR, the code would corrupt an already configured TR.

I forgot to add the Fixes tag:

Fixes 6cf668a4ef829 ("dmaengine: ti: k3-udma: Use the TR counter helper for slave_sg and cyclic")

Can you add it or I can resend with the tag.

Quoted 13 lines
---
 drivers/dma/ti/k3-udma.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/dma/ti/k3-udma.c +0 -0
index c14e6cb105cd..30cb514cee54 100644
@@ -2059,9 +2059,9 @@ udma_prep_slave_sg_tr(struct udma_chan *uc, struct scatterlist *sgl,
 			return NULL;
 		}

drivers/dma/ti/k3-udma.c udma_prep_slave_sg_tr(struct udma_chan *uc, struct scatterlist *sgl, · line 2067

Quoted 10 lines
drivers/dma/ti/k3-udma.c +3 -3
 
-		cppi5_tr_init(&tr_req[i].flags, CPPI5_TR_TYPE1, false, false,
-			      CPPI5_TR_EVENT_SIZE_COMPLETION, 0);
-		cppi5_tr_csf_set(&tr_req[i].flags, CPPI5_TR_CSF_SUPR_EVT);
+		cppi5_tr_init(&tr_req[tr_idx].flags, CPPI5_TR_TYPE1, false,
+			      false, CPPI5_TR_EVENT_SIZE_COMPLETION, 0);
+		cppi5_tr_csf_set(&tr_req[tr_idx].flags, CPPI5_TR_CSF_SUPR_EVT);
 
 		tr_req[tr_idx].addr = sg_addr;
 		tr_req[tr_idx].icnt0 = tr0_cnt0;

- Péter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

maintainer
#2 lore raw
Quoted 6 lines · Peter Ujfalusi

Vinod,

Quoted 3 lines · Peter Ujfalusi

The TR which needs to be initialized for the next sg entry is indexed by tr_idx and not by the running i counter.

Quoted 7 lines
Quoted 2 lines

In case any sub element in the SG needs more than one TR, the code would corrupt an already configured TR.

I forgot to add the Fixes tag:

Fixes 6cf668a4ef829 ("dmaengine: ti: k3-udma: Use the TR counter helper for slave_sg and cyclic")

Can you add it or I can resend with the tag.

Applied with fixes line, thanks

Signature · 1 line
~Vinod