Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp5747471ybx; Sun, 10 Nov 2019 20:43:58 -0800 (PST) X-Google-Smtp-Source: APXvYqw0Rfd4oSzlzQLiXO2SnsGFSwRPzm6Xdge47j6dJCKnN3rSjRfl4BcwEb2J1lBCsUpPT/68 X-Received: by 2002:a17:906:5959:: with SMTP id g25mr4862975ejr.248.1573447437970; Sun, 10 Nov 2019 20:43:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573447437; cv=none; d=google.com; s=arc-20160816; b=SSEZ4jVat/bi5rqk4Ip+JH/NVG3NtLz06J30pYR9UpTX+7FXjq0tZRGYV4OrTwwa4m XZtcNwbhuYLk2ISCC6XTiro+IewGNLzkKBzreVdKfBIZFn8j9gxrMd7S8+QXOP6XwCOp yLojry+vQgemtjpLvTIaXYQu1DJpcOoy98SuwWFA8pKp4H0mHtetOR+x24QmrqPbxrCV 9UTLBQf+wmW3ww4fZwB5exp+9k11jaTQUm3PV2zPFgx6gL3Lf1lh/4uNl5UrxULxfOtO lkzvD6p4qm5O0A1bIu5y0inXldQkF+5qNWsvEvN3mLIbbiv+fMV3SXqwybyfBXJMPv8J eO9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=dtEkqiVtHjnKzaapaJJiCYGb760VP27Un/58iEKgKGU=; b=NG5NQ6cDn66Wtvx3SDPWpEagT2NscHtg1h3Me56bIgc5ofKiQhqQyRVieijseYNMml G0SqphQoBOn5AQqwomPE40rYL5mJ7LSSRuKUTdqHS5SqjgebeZ8rk+nN5iBfsXu3sMw1 FXdvi2cHpNyCD6nPCSnfXQHK9xj/tjXWoYaewSNg/OyRhogVRfjzstwKx8Sk/41ZVSg8 Zv7pisvx0vMi+dN0FvQYgtOLjo5rqKg9pK+iaCUILyhg4dJ3t1+ggUe7ZYiuTAsV6gWT YroH4hvDMf8o2Dioa3SKwkHvXdCKmoIzDN/hw/vUiHuRnv9+RuFhePXaKc1hIkSrxFOV JNKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=pMA4xX1c; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 26si10845754edz.340.2019.11.10.20.43.34; Sun, 10 Nov 2019 20:43:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=pMA4xX1c; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726857AbfKKEkD (ORCPT + 99 others); Sun, 10 Nov 2019 23:40:03 -0500 Received: from mail.kernel.org ([198.145.29.99]:60956 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726793AbfKKEkD (ORCPT ); Sun, 10 Nov 2019 23:40:03 -0500 Received: from localhost (unknown [106.201.42.77]) (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 88B0F20856; Mon, 11 Nov 2019 04:40:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573447202; bh=IbqTizAofEr4fAlNvQZJC9e5XYpXENQc/RRIOCFORfQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=pMA4xX1cvwbWOJT0hA/nZrCBydq0lxFRgimzmpVnyya2HCzceOyfJkrKVI8G/SZS1 98tvL1CrGZrU4BECstDOm7rjbgm7pHuDnrSM4/IncQsFOABV/RhsR9m3RcCNUoojCx RG3iHH00fUKscPWTdoARJf3TIlsMeDNz1/Yk8GbU= Date: Mon, 11 Nov 2019 10:09:57 +0530 From: Vinod Koul To: Peter Ujfalusi Cc: robh+dt@kernel.org, nm@ti.com, ssantosh@kernel.org, dan.j.williams@intel.com, dmaengine@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, grygorii.strashko@ti.com, lokeshvutla@ti.com, t-kristo@ti.com, tony@atomide.com, j-keerthy@ti.com Subject: Re: [PATCH v4 05/15] dmaengine: Add support for reporting DMA cached data amount Message-ID: <20191111043957.GL952516@vkoul-mobl> References: <20191101084135.14811-1-peter.ujfalusi@ti.com> <20191101084135.14811-6-peter.ujfalusi@ti.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191101084135.14811-6-peter.ujfalusi@ti.com> User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01-11-19, 10:41, Peter Ujfalusi wrote: > A DMA hardware can have big cache or FIFO and the amount of data sitting in > the DMA fabric can be an interest for the clients. > > For example in audio we want to know the delay in the data flow and in case > the DMA have significantly large FIFO/cache, it can affect the latenc/delay > > Signed-off-by: Peter Ujfalusi > Reviewed-by: Tero Kristo > --- > drivers/dma/dmaengine.h | 8 ++++++++ > include/linux/dmaengine.h | 2 ++ > 2 files changed, 10 insertions(+) > > diff --git a/drivers/dma/dmaengine.h b/drivers/dma/dmaengine.h > index 501c0b063f85..b0b97475707a 100644 > --- a/drivers/dma/dmaengine.h > +++ b/drivers/dma/dmaengine.h > @@ -77,6 +77,7 @@ static inline enum dma_status dma_cookie_status(struct dma_chan *chan, > state->last = complete; > state->used = used; > state->residue = 0; > + state->in_flight_bytes = 0; > } > return dma_async_is_complete(cookie, complete, used); > } > @@ -87,6 +88,13 @@ static inline void dma_set_residue(struct dma_tx_state *state, u32 residue) > state->residue = residue; > } > > +static inline void dma_set_in_flight_bytes(struct dma_tx_state *state, > + u32 in_flight_bytes) > +{ > + if (state) > + state->in_flight_bytes = in_flight_bytes; > +} > + > struct dmaengine_desc_callback { > dma_async_tx_callback callback; > dma_async_tx_callback_result callback_result; > diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h > index 0e8b426bbde9..c4c5219030a6 100644 > --- a/include/linux/dmaengine.h > +++ b/include/linux/dmaengine.h > @@ -682,11 +682,13 @@ static inline struct dma_async_tx_descriptor *txd_next(struct dma_async_tx_descr > * @residue: the remaining number of bytes left to transmit > * on the selected transfer for states DMA_IN_PROGRESS and > * DMA_PAUSED if this is implemented in the driver, else 0 > + * @in_flight_bytes: amount of data in bytes cached by the DMA. > */ > struct dma_tx_state { > dma_cookie_t last; > dma_cookie_t used; > u32 residue; > + u32 in_flight_bytes; Should we add this here or use the dmaengine_result() -- ~Vinod