From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753052AbdASOWk (ORCPT ); Thu, 19 Jan 2017 09:22:40 -0500 Received: from mail-ot0-f170.google.com ([74.125.82.170]:35937 "EHLO mail-ot0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753006AbdASOWi (ORCPT ); Thu, 19 Jan 2017 09:22:38 -0500 Date: Thu, 19 Jan 2017 08:13:17 -0600 From: Andy Gross To: Vinod Koul Cc: Abhishek Sahu , dan.j.williams@intel.com, stanimir.varbanov@linaro.org, mcgrof@suse.com, okaya@codeaurora.org, pramod.gurav@linaro.org, arnd@arndb.de, linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org, linux-arm-msm@vger.kernel.org Subject: Re: [PATCH 2/5] dmaengine: Add support for custom data mapping Message-ID: <20170119141317.GA9631@hector.attlocal.net> References: <20161219050642.GA3047@hector.attlocal.net> <20161219154923.GT25795@localhost> <20161219175210.GB3047@hector.attlocal.net> <20161220202511.GD3047@hector.attlocal.net> <61cb961a6f448cfc48b983329e329b34@codeaurora.org> <20161229175450.GB17770@hector.attlocal.net> <8055fa20b35139e7d13831583ebf4f4f@codeaurora.org> <20170102161233.GC17770@hector.attlocal.net> <20170119050150.GI3573@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170119050150.GI3573@localhost> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 19, 2017 at 10:31:50AM +0530, Vinod Koul wrote: > > > > > > > >I really think that we need some additional API that allows for the flag > > > >munging > > > >for the descriptors instead of overriding the prep_slave_sg. We already > > > >needed > > > >to change the way the flags are passed anyway. And instead of building up > > > >a > > > >special sg list, the API should take a structure that has a 1:1 mapping of > > > >the > > > >flags to the descriptors. And you would call this API on your descriptor > > > >before > > > >issuing it. > > Munging wont be a good idea, but for some of the cases current flags can be > used, and if need be, we can add additional flags Is adding flags a possibility? I tried to match up BAM flags to ones that made sense that were currently defined, but adding a CMD flag would be kind of odd. It was kind of a stretch to use the PREP_FENCE for the notify when done flag. > > > > > > > >So build up the sglist. Call the prep_slave_sg. You get back a tx > > > >descriptor > > > >that underneath is a bam descriptor. Then call the API giving the > > > >descriptor > > > >and the structure that defines the flags for the descriptors. Then submit > > > >the > > > >descriptor. > > > > > > > >Something like: > > > >int qcom_bam_apply_descriptor_flags(struct dma_async_tx_descriptor *tx, > > > > u16 *flags) > > > >{ > > > > struct bam_async_desc async_desc = container_of(tx, > > > > struct bam_async_desc, > > > > vd.tx); > > > > int i; > > > > > > > > for (i = 0; i < async_desc->num_desc; i++) > > > > async_desc->desc[i].flags = cpu_to_le16(flags[i]); > > > >} > > > > > > > >EXPORT_SYMBOL(qcom_bam_apply_descriptor_flags) > > This makes it bam specific and causes issues if we want to use this code in > generic libs, but yes this is an option but should be last resort. If adding flags is a possibility (which it didn't seem to be in the past), that would make things much easier. Regards, Andy