Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1632878 > unrolled thread

[PATCH] Allow to use DMA_CTRL_REUSE flag for all channel types

Started byEugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
First post2017-04-28 15:40 +0200
Last post2017-05-10 06:00 +0200
Articles 4 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] Allow to use DMA_CTRL_REUSE flag for all channel types Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com> - 2017-04-28 15:40 +0200
    Re: [PATCH] Allow to use DMA_CTRL_REUSE flag for all channel types Vinod Koul <vinod.koul@intel.com> - 2017-05-01 07:50 +0200
      Re: [PATCH] Allow to use DMA_CTRL_REUSE flag for all channel types Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com> - 2017-05-02 17:20 +0200
        Re: [PATCH] Allow to use DMA_CTRL_REUSE flag for all channel types Vinod Koul <vinod.koul@intel.com> - 2017-05-10 06:00 +0200

#1632878 — [PATCH] Allow to use DMA_CTRL_REUSE flag for all channel types

FromEugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Date2017-04-28 15:40 +0200
Subject[PATCH] Allow to use DMA_CTRL_REUSE flag for all channel types
Message-ID<tBehP-7VW-9@gated-at.bofh.it>
In the current implementation dma_get_slave_caps is used to check
state of descriptor_reuse option. But dma_get_slave_caps includes
check if the channel supports slave transactions.
So DMA_CTRL_REUSE flag can be set (even for MEM-TO-MEM tranfers)
only if channel supports slave transactions.

Now we can use DMA_CTRL_REUSE flag for all channel types.
Also it allows to test reusing mechanism with simply mem-to-mem dma
test.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
---
 include/linux/dmaengine.h | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 5336808..92cf8b0 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -1376,11 +1376,7 @@ static inline int dma_get_slave_caps(struct dma_chan *chan,
 
 static inline int dmaengine_desc_set_reuse(struct dma_async_tx_descriptor *tx)
 {
-	struct dma_slave_caps caps;
-
-	dma_get_slave_caps(tx->chan, &caps);
-
-	if (caps.descriptor_reuse) {
+	if (tx->chan->device->descriptor_reuse) {
 		tx->flags |= DMA_CTRL_REUSE;
 		return 0;
 	} else {
-- 
2.9.3

[toc] | [next] | [standalone]


#1633556

FromVinod Koul <vinod.koul@intel.com>
Date2017-05-01 07:50 +0200
Message-ID<tCcnE-51S-17@gated-at.bofh.it>
In reply to#1632878
On Fri, Apr 28, 2017 at 04:37:46PM +0300, Eugeniy Paltsev wrote:
> In the current implementation dma_get_slave_caps is used to check
> state of descriptor_reuse option. But dma_get_slave_caps includes
> check if the channel supports slave transactions.
> So DMA_CTRL_REUSE flag can be set (even for MEM-TO-MEM tranfers)
> only if channel supports slave transactions.
> 
> Now we can use DMA_CTRL_REUSE flag for all channel types.
> Also it allows to test reusing mechanism with simply mem-to-mem dma
> test.

We do not want to allow that actually. Slave is always treated as a special
case, so resue was allowed.

With memcpy the assumptions are different and clients can do reuse.

> 
> Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
> ---
>  include/linux/dmaengine.h | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
> index 5336808..92cf8b0 100644
> --- a/include/linux/dmaengine.h
> +++ b/include/linux/dmaengine.h
> @@ -1376,11 +1376,7 @@ static inline int dma_get_slave_caps(struct dma_chan *chan,
>  
>  static inline int dmaengine_desc_set_reuse(struct dma_async_tx_descriptor *tx)
>  {
> -	struct dma_slave_caps caps;
> -
> -	dma_get_slave_caps(tx->chan, &caps);
> -
> -	if (caps.descriptor_reuse) {
> +	if (tx->chan->device->descriptor_reuse) {
>  		tx->flags |= DMA_CTRL_REUSE;
>  		return 0;
>  	} else {
> -- 
> 2.9.3
> 
> --
> To unsubscribe from this list: send the line "unsubscribe dmaengine" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
~Vinod

[toc] | [prev] | [next] | [standalone]


#1634480

FromEugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Date2017-05-02 17:20 +0200
Message-ID<tCHKN-8mq-13@gated-at.bofh.it>
In reply to#1633556
Hi Vinod,

On Mon, 2017-05-01 at 11:21 +0530, Vinod Koul wrote:
> On Fri, Apr 28, 2017 at 04:37:46PM +0300, Eugeniy Paltsev wrote:
> > In the current implementation dma_get_slave_caps is used to check
> > state of descriptor_reuse option. But dma_get_slave_caps includes
> > check if the channel supports slave transactions.
> > So DMA_CTRL_REUSE flag can be set (even for MEM-TO-MEM tranfers)
> > only if channel supports slave transactions.
> > 
> > Now we can use DMA_CTRL_REUSE flag for all channel types.
> > Also it allows to test reusing mechanism with simply mem-to-mem dma
> > test.
> 
> We do not want to allow that actually. Slave is always treated as a
> special
> case, so resue was allowed.
> 
> With memcpy the assumptions are different and clients can do reuse.

Could you please clarify why don't we want to allow use DMA_CTRL_REUSE
for mem-to-mem transfers?

Reusing of mem-to-mem (MEMCPY and DMA_SG) descriptors will work fine on
virt-dma based drivers.

Anyway the current implementation behaviour is quite strange:
If channel supports *slave* transfers DMA_CTRL_REUSE can be set to
slave and *mem-to-mem* transfers.

And, of course, we can pass DMA_CTRL_REUSE flag to device_prep_dma_sg
or device_prep_dma_memcpy directly without checks.

> > 
> > Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
> > ---
> >  include/linux/dmaengine.h | 6 +-----
> >  1 file changed, 1 insertion(+), 5 deletions(-)
> > 
> > diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
> > index 5336808..92cf8b0 100644
> > --- a/include/linux/dmaengine.h
> > +++ b/include/linux/dmaengine.h
> > @@ -1376,11 +1376,7 @@ static inline int dma_get_slave_caps(struct
> > dma_chan *chan,
> >  
> >  static inline int dmaengine_desc_set_reuse(struct
> > dma_async_tx_descriptor *tx)
> >  {
> > -	struct dma_slave_caps caps;
> > -
> > -	dma_get_slave_caps(tx->chan, &caps);
> > -
> > -	if (caps.descriptor_reuse) {
> > +	if (tx->chan->device->descriptor_reuse) {
> >  		tx->flags |= DMA_CTRL_REUSE;
> >  		return 0;
> >  	} else {
> > -- 
> > 2.9.3
> > 
> > --
-- 
 Eugeniy Paltsev

[toc] | [prev] | [next] | [standalone]


#1638545

FromVinod Koul <vinod.koul@intel.com>
Date2017-05-10 06:00 +0200
Message-ID<tFqX8-3rf-13@gated-at.bofh.it>
In reply to#1634480
On Tue, May 02, 2017 at 03:16:18PM +0000, Eugeniy Paltsev wrote:
> Hi Vinod,
> 
> On Mon, 2017-05-01 at 11:21 +0530, Vinod Koul wrote:
> > On Fri, Apr 28, 2017 at 04:37:46PM +0300, Eugeniy Paltsev wrote:
> > > In the current implementation dma_get_slave_caps is used to check
> > > state of descriptor_reuse option. But dma_get_slave_caps includes
> > > check if the channel supports slave transactions.
> > > So DMA_CTRL_REUSE flag can be set (even for MEM-TO-MEM tranfers)
> > > only if channel supports slave transactions.
> > > 
> > > Now we can use DMA_CTRL_REUSE flag for all channel types.
> > > Also it allows to test reusing mechanism with simply mem-to-mem dma
> > > test.
> > 
> > We do not want to allow that actually. Slave is always treated as a
> > special
> > case, so resue was allowed.
> > 
> > With memcpy the assumptions are different and clients can do reuse.
> 
> Could you please clarify why don't we want to allow use DMA_CTRL_REUSE
> for mem-to-mem transfers?
> 
> Reusing of mem-to-mem (MEMCPY and DMA_SG) descriptors will work fine on
> virt-dma based drivers.

Precisely, the client does not know if you have a virt-dma or some other
kind if implementation

For them they see a channel and use it!

> Anyway the current implementation behaviour is quite strange:
> If channel supports *slave* transfers DMA_CTRL_REUSE can be set to
> slave and *mem-to-mem* transfers.
> 
> And, of course, we can pass DMA_CTRL_REUSE flag to device_prep_dma_sg
> or device_prep_dma_memcpy directly without checks.

Yeah thats bad, do send a patch to forbid that..

-- 
~Vinod

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web