From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.5 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75041C433EF for ; Sun, 8 Sep 2019 14:13:35 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 49420214DB for ; Sun, 8 Sep 2019 14:13:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="WRF29RvL"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="WoBiJ481" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 49420214DB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Za2mz2fJzzZs10oCxj7zvuwUQbbxrsqn8eEqg0eCcso=; b=WRF29RvLNGor3i dP6MLhNwoby6VbhVCV0C5jGsdXp6uUhO2LJIAO+4eGyCcD7hB1TYZbI5djTNCELXAc9WOZnb3pu9Q L1fpCTIQeWAXEnlJnEP6xmzKFwYl2B40mx3aRopljsFIPeVfKtG2JjSBJC6GguuqafckT85jsW4ge pOHWToAC9FJmpwC2BnHT0aXAhFZJlWokUmA7l2h8YmC8+pKvRQehN8+kVHdk02xM5ku5/qJTRQygi erPx2iQJlW3gOLuKL76sdMOHG6W5UsZdLC2TvY34GT5m5iVHfEMFNEPVVJpGMxbyuKbMavjKnafBJ Su8fxpSjkMd+WHBMdEgg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1i6xwX-0000Hh-A8; Sun, 08 Sep 2019 14:13:29 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i6xwU-0000H9-Uu for linux-arm-kernel@lists.infradead.org; Sun, 08 Sep 2019 14:13:28 +0000 Received: from localhost (unknown [122.182.221.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 69EE0214DB; Sun, 8 Sep 2019 14:13:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567952005; bh=g9RxzkYEfVpKOAJwV3oEn7y/61ZfPHD/mrK3hZzuHnQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=WoBiJ481LdXQmZDqTPxZwAiFcq3EBZGBJ46sim865WlLmOJowtKJuxb6YLB6trmmn zupdUdIULJ2hiBhVxS4HtyhqHAfXPBEt2D6AHChVbR25Mt0yfNoLZNBc5SbMXXl8we 3HmSm+7QUehQ2Xx+PdHsAyJNKOTu76to2aq2y9F4= Date: Sun, 8 Sep 2019 19:42:07 +0530 From: Vinod Koul To: Peter Ujfalusi Subject: Re: [PATCH v2 04/14] dmaengine: Add metadata_ops for dma_async_tx_descriptor Message-ID: <20190908141207.GO2672@vkoul-mobl> References: <20190730093450.12664-1-peter.ujfalusi@ti.com> <20190730093450.12664-5-peter.ujfalusi@ti.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190730093450.12664-5-peter.ujfalusi@ti.com> User-Agent: Mutt/1.12.0 (2019-05-25) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190908_071327_019620_72516590 X-CRM114-Status: GOOD ( 19.60 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: nm@ti.com, devicetree@vger.kernel.org, grygorii.strashko@ti.com, lokeshvutla@ti.com, j-keerthy@ti.com, linux-kernel@vger.kernel.org, t-kristo@ti.com, tony@atomide.com, robh+dt@kernel.org, ssantosh@kernel.org, dmaengine@vger.kernel.org, dan.j.williams@intel.com, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 30-07-19, 12:34, Peter Ujfalusi wrote: > The metadata is best described as side band data or parameters traveling > alongside the data DMAd by the DMA engine. It is data > which is understood by the peripheral and the peripheral driver only, the > DMA engine see it only as data block and it is not interpreting it in any > way. > > The metadata can be different per descriptor as it is a parameter for the > data being transferred. > > If the DMA supports per descriptor metadata it can implement the attach, > get_ptr/set_len callbacks. > > Client drivers must only use either attach or get_ptr/set_len to avoid > misconfiguration. > > Client driver can check if a given metadata mode is supported by the > channel during probe time with > dmaengine_is_metadata_mode_supported(chan, DESC_METADATA_CLIENT); > dmaengine_is_metadata_mode_supported(chan, DESC_METADATA_ENGINE); > > and based on this information can use either mode. > > Wrappers are also added for the metadata_ops. > > To be used in DESC_METADATA_CLIENT mode: > dmaengine_desc_attach_metadata() > > To be used in DESC_METADATA_ENGINE mode: > dmaengine_desc_get_metadata_ptr() > dmaengine_desc_set_metadata_len() > > Signed-off-by: Peter Ujfalusi > --- > drivers/dma/dmaengine.c | 73 ++++++++++++++++++++++++++ > include/linux/dmaengine.h | 108 ++++++++++++++++++++++++++++++++++++++ > 2 files changed, 181 insertions(+) > > diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c > index 03ac4b96117c..6baddf7dcbfd 100644 > --- a/drivers/dma/dmaengine.c > +++ b/drivers/dma/dmaengine.c > @@ -1302,6 +1302,79 @@ void dma_async_tx_descriptor_init(struct dma_async_tx_descriptor *tx, > } > EXPORT_SYMBOL(dma_async_tx_descriptor_init); > > +static inline int desc_check_and_set_metadata_mode( > + struct dma_async_tx_descriptor *desc, enum dma_desc_metadata_mode mode) > +{ > + /* Make sure that the metadata mode is not mixed */ > + if (!desc->desc_metadata_mode) { > + if (dmaengine_is_metadata_mode_supported(desc->chan, mode)) > + desc->desc_metadata_mode = mode; So do we have different descriptors supporting different modes or is it controlled based? For latter we can do this check at controller registration! -- ~Vinod _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel