diff mbox series

[v4] dma: ti: k3-udma: Use ring_idx to pair k3 nav rings

Message ID 20240130061804.2342672-1-danishanwar@ti.com
State Accepted
Commit 4312a1dfca26a0b5c30ac6890b0078e8d31ff6bf
Delegated to: Tom Rini
Headers show
Series [v4] dma: ti: k3-udma: Use ring_idx to pair k3 nav rings | expand

Commit Message

MD Danish Anwar Jan. 30, 2024, 6:18 a.m. UTC
Use ring_idx to pair rings. ring_idx will be same as tx flow_id for all
non-negative flow_ids. For negative flow_ids, ring_idx will be tchan->id
added with bchan_cnt.

Signed-off-by: MD Danish Anwar <danishanwar@ti.com>
---
Changes from v3 to v4:
*) No functional change. Splitted the patch out of the series as suggested
   by Nishant.

v3: https://lore.kernel.org/all/20240124064930.1787929-2-danishanwar@ti.com/

 drivers/dma/ti/k3-udma.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

Comments

Ravi Gunasekaran Feb. 2, 2024, 5:01 a.m. UTC | #1
On 1/30/2024 11:48 AM, MD Danish Anwar wrote:
> Use ring_idx to pair rings. ring_idx will be same as tx flow_id for all
> non-negative flow_ids. For negative flow_ids, ring_idx will be tchan->id
> added with bchan_cnt.
>
> Signed-off-by: MD Danish Anwar <danishanwar@ti.com>
> ---
> Changes from v3 to v4:
> *) No functional change. Splitted the patch out of the series as suggested
>    by Nishant.
>
> v3: https://lore.kernel.org/all/20240124064930.1787929-2-danishanwar@ti.com/
>
>  drivers/dma/ti/k3-udma.c | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c
> index 8a62d63dfe..eea9ec9659 100644
> --- a/drivers/dma/ti/k3-udma.c
> +++ b/drivers/dma/ti/k3-udma.c
> @@ -876,13 +876,20 @@ static int udma_alloc_tx_resources(struct udma_chan *uc)
>  {
>  	struct k3_nav_ring_cfg ring_cfg;
>  	struct udma_dev *ud = uc->ud;
> -	int ret;
> +	struct udma_tchan *tchan;
> +	int ring_idx, ret;
>  
>  	ret = udma_get_tchan(uc);
>  	if (ret)
>  		return ret;
>  
> -	ret = k3_nav_ringacc_request_rings_pair(ud->ringacc, uc->tchan->id, -1,
> +	tchan = uc->tchan;
> +	if (tchan->tflow_id >= 0)
> +		ring_idx = tchan->tflow_id;
> +	else
> +		ring_idx = ud->bchan_cnt + tchan->id;
> +
> +	ret = k3_nav_ringacc_request_rings_pair(ud->ringacc, ring_idx, -1,
>  						&uc->tchan->t_ring,
>  						&uc->tchan->tc_ring);
>  	if (ret) {

I see this change present in upstream linux kernel as well.
You could consider providing the link to kernel if such changes are already
merged there.

Reviewed-by: Ravi Gunasekaran <r-gunasekaran@ti.com>
Anwar, Md Danish Feb. 2, 2024, 5:07 a.m. UTC | #2
On 2/2/2024 10:31 AM, Ravi Gunasekaran wrote:
> 
> 
> On 1/30/2024 11:48 AM, MD Danish Anwar wrote:
>> Use ring_idx to pair rings. ring_idx will be same as tx flow_id for all
>> non-negative flow_ids. For negative flow_ids, ring_idx will be tchan->id
>> added with bchan_cnt.
>>
>> Signed-off-by: MD Danish Anwar <danishanwar@ti.com>
>> ---
>> Changes from v3 to v4:
>> *) No functional change. Splitted the patch out of the series as suggested
>>    by Nishant.
>>
>> v3: https://lore.kernel.org/all/20240124064930.1787929-2-danishanwar@ti.com/
>>
>>  drivers/dma/ti/k3-udma.c | 11 +++++++++--
>>  1 file changed, 9 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c
>> index 8a62d63dfe..eea9ec9659 100644
>> --- a/drivers/dma/ti/k3-udma.c
>> +++ b/drivers/dma/ti/k3-udma.c
>> @@ -876,13 +876,20 @@ static int udma_alloc_tx_resources(struct udma_chan *uc)
>>  {
>>  	struct k3_nav_ring_cfg ring_cfg;
>>  	struct udma_dev *ud = uc->ud;
>> -	int ret;
>> +	struct udma_tchan *tchan;
>> +	int ring_idx, ret;
>>  
>>  	ret = udma_get_tchan(uc);
>>  	if (ret)
>>  		return ret;
>>  
>> -	ret = k3_nav_ringacc_request_rings_pair(ud->ringacc, uc->tchan->id, -1,
>> +	tchan = uc->tchan;
>> +	if (tchan->tflow_id >= 0)
>> +		ring_idx = tchan->tflow_id;
>> +	else
>> +		ring_idx = ud->bchan_cnt + tchan->id;
>> +
>> +	ret = k3_nav_ringacc_request_rings_pair(ud->ringacc, ring_idx, -1,
>>  						&uc->tchan->t_ring,
>>  						&uc->tchan->tc_ring);
>>  	if (ret) {
> 
> I see this change present in upstream linux kernel as well.
> You could consider providing the link to kernel if such changes are already
> merged there.

Sure Ravi,

Link to upstream kernel code for the same [1].
Upstream Commit: d2abc982333c02f9e1ff1c6b3782174f5b7662d7

[1]
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/dma/ti/k3-udma.c?h=v6.8-rc2#n1686

> 
> Reviewed-by: Ravi Gunasekaran <r-gunasekaran@ti.com>
Tom Rini Feb. 7, 2024, 3:45 p.m. UTC | #3
On Tue, Jan 30, 2024 at 11:48:04AM +0530, MD Danish Anwar wrote:

> Use ring_idx to pair rings. ring_idx will be same as tx flow_id for all
> non-negative flow_ids. For negative flow_ids, ring_idx will be tchan->id
> added with bchan_cnt.
> 
> Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/dma/ti/k3-udma.c?h=v6.8-rc2#n1686
> Signed-off-by: MD Danish Anwar <danishanwar@ti.com>
> Reviewed-by: Ravi Gunasekaran <r-gunasekaran@ti.com>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c
index 8a62d63dfe..eea9ec9659 100644
--- a/drivers/dma/ti/k3-udma.c
+++ b/drivers/dma/ti/k3-udma.c
@@ -876,13 +876,20 @@  static int udma_alloc_tx_resources(struct udma_chan *uc)
 {
 	struct k3_nav_ring_cfg ring_cfg;
 	struct udma_dev *ud = uc->ud;
-	int ret;
+	struct udma_tchan *tchan;
+	int ring_idx, ret;
 
 	ret = udma_get_tchan(uc);
 	if (ret)
 		return ret;
 
-	ret = k3_nav_ringacc_request_rings_pair(ud->ringacc, uc->tchan->id, -1,
+	tchan = uc->tchan;
+	if (tchan->tflow_id >= 0)
+		ring_idx = tchan->tflow_id;
+	else
+		ring_idx = ud->bchan_cnt + tchan->id;
+
+	ret = k3_nav_ringacc_request_rings_pair(ud->ringacc, ring_idx, -1,
 						&uc->tchan->t_ring,
 						&uc->tchan->tc_ring);
 	if (ret) {