From patchwork Tue Oct 1 06:16:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 174811 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp8116078ill; Mon, 30 Sep 2019 23:16:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqwoEJ2MkCT/cYNcs0hHTVpWL5WLBdBrMxTwJhraHkeO2GryT0+XOjc2X8AKNo70dU29ZmXT X-Received: by 2002:a50:918d:: with SMTP id g13mr23597041eda.64.1569910611134; Mon, 30 Sep 2019 23:16:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569910611; cv=none; d=google.com; s=arc-20160816; b=NfhdTLDWsr99G/leqhpK28FGStQ2IdfisixBhbO85gft2vtnwVQvvFGwD6uD8IV9lz uUYaJbqZH3AxgAWgu2Amk0X0PZDpQVGrDjnl1tTJRKOQn+lPMWT370kv4XBFTYfb5U1g kbMGdki0W0zrjKmF6bc7+h3m0uPg5FS82z70qMGJAKu1dQ9sYDPZggGSPllNLbJSu0Ih FkY0dvt0PBn4+/V7UXSx9hZNxv61p69n7muO5VKnzFePml48HzDGufM7YNCVX4Xrnml6 L9Ya50OuyaJHaIXNByNg1oLaC6tXs633u/fQ4QVAxuUnzzTUMV0ZWvvZjdqPB/3AfT2A 9zZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=l1+HONjf2p2srVPl+q2lau+bAc7cFYjjd944yTl+xYo=; b=tmnDE8d5FRiSJVIqClMenhh2q3tMpuBB7ZPF0TmMUJB3mC4TNJ0j+cMbUCz+ElOjX3 hywLFJHRfOSlWSH+VtPpK6N+76bChIC5kefa1Wsz6kJFtuTvA1cAD0XvaXzl8i3cUmn9 hsit/FvFoXDHlri8RfvO7qmaHMpsJ9CHXDAWVqIwaujF9FQjLAi6VUPSQ91RtxKBkCAz 00/FeeV3wDE9PgCKcyjkxeoAc0fghSCXe5tpvQfvqAW5SpnnWcWgTpx+2/R+D36PbutE CVmWVGR1ywajdwsN2LzgVwflkvyEOBJ7g6TsDkxDyXk8i1/NfbYzalxBt0iyUqCL0VPU K6rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=hL+UaXFF; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a3si8272090edr.20.2019.09.30.23.16.50; Mon, 30 Sep 2019 23:16:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-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=@ti.com header.s=ti-com-17Q1 header.b=hL+UaXFF; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732636AbfJAGQt (ORCPT + 8 others); Tue, 1 Oct 2019 02:16:49 -0400 Received: from lelv0143.ext.ti.com ([198.47.23.248]:47920 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726822AbfJAGQs (ORCPT ); Tue, 1 Oct 2019 02:16:48 -0400 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id x916GcbI009292; Tue, 1 Oct 2019 01:16:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1569910598; bh=l1+HONjf2p2srVPl+q2lau+bAc7cFYjjd944yTl+xYo=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=hL+UaXFFHREoscPViu4LECe+8+aIJ95GVzMzuPjcoAotEs9PiTWnlMXVsjZmodCIv Wos9b6b9yMDc1Gd/JK96xOOAa2kv1oUvC4Djh0DmEQT83Ilu2vYdK5JE+J/Fc4qc4p 6xZ7kXEvX9zZo+72i4AeFw8JcOniD4g7GULdGFto= Received: from DFLE104.ent.ti.com (dfle104.ent.ti.com [10.64.6.25]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTP id x916GcH2053983; Tue, 1 Oct 2019 01:16:38 -0500 Received: from DFLE109.ent.ti.com (10.64.6.30) by DFLE104.ent.ti.com (10.64.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Tue, 1 Oct 2019 01:16:38 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DFLE109.ent.ti.com (10.64.6.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Tue, 1 Oct 2019 01:16:28 -0500 Received: from feketebors.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id x916GGXA090310; Tue, 1 Oct 2019 01:16:34 -0500 From: Peter Ujfalusi To: , , , CC: , , , , , , , , , Subject: [PATCH v3 05/14] dmaengine: Add support for reporting DMA cached data amount Date: Tue, 1 Oct 2019 09:16:55 +0300 Message-ID: <20191001061704.2399-6-peter.ujfalusi@ti.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191001061704.2399-1-peter.ujfalusi@ti.com> References: <20191001061704.2399-1-peter.ujfalusi@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org 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 --- drivers/dma/dmaengine.h | 8 ++++++++ include/linux/dmaengine.h | 2 ++ 2 files changed, 10 insertions(+) -- Peter Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki 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 40d062c3b359..02ceef95340a 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; }; /**