From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751219AbdEBPQX (ORCPT ); Tue, 2 May 2017 11:16:23 -0400 Received: from smtprelay4.synopsys.com ([198.182.47.9]:47145 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750727AbdEBPQW (ORCPT ); Tue, 2 May 2017 11:16:22 -0400 From: Eugeniy Paltsev To: "vinod.koul@intel.com" CC: "dmaengine@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "andriy.shevchenko@linux.intel.com" , "dan.j.williams@intel.com" , "Alexey.Brodkin@synopsys.com" , "Eugeniy.Paltsev@synopsys.com" , "linux-snps-arc@lists.infradead.org" Subject: Re: [PATCH] Allow to use DMA_CTRL_REUSE flag for all channel types Thread-Topic: [PATCH] Allow to use DMA_CTRL_REUSE flag for all channel types Thread-Index: AQHSwCSj7sadFL2qPkqnD/szE8RwiaHe3CAAgAIwJQA= Date: Tue, 2 May 2017 15:16:18 +0000 Message-ID: <1493738176.25985.23.camel@synopsys.com> References: <20170428133746.1855-1-Eugeniy.Paltsev@synopsys.com> <20170501055125.GN6263@localhost> In-Reply-To: <20170501055125.GN6263@localhost> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.121.8.113] Content-Type: text/plain; charset="utf-8" Content-ID: MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id v42FGRfK011705 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 > > --- > >  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