Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4562664ybi; Tue, 30 Jul 2019 04:17:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqyRqw5uDT29DX1eJFeifSxdEqt8P/S6c2MDiqDVIpPplX6I9cPHUbk8Ofu1xjMc99ADInZg X-Received: by 2002:a17:90a:bf92:: with SMTP id d18mr119493982pjs.128.1564485441778; Tue, 30 Jul 2019 04:17:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564485441; cv=none; d=google.com; s=arc-20160816; b=f2n99pWfn4jJlUe5vg8pDeP1A24c0ZfN5YxRn0LWmyl1WRl6/j5jpROmODIHbG5g6O MOflnmFBYwQLcnA7tMteg8bSGGkrOU0cZDY8v7LuNNSM1B7afLZyLhlagiZ6b6MVoYiV yx6gZZ4LUBEUYsXSJVfcREG1g3mT5ljc9AjJ1i0DUt2lYGGapVCcFiEzPWShMJQIEuRh 2Rw+z/l7gZVMyyCq6CY2dE5VXBkEF9pUknZFb59W6OFgSW4A90AuSS9ltluw1WDX/zZM Q1LKLkO+ASu13B1ORDmpcCZXPw8VesZ9LnLg8q5msJAtbvE76VmI93DCX8Nzs6d1ze8B nIIw== 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=AFlSCbyvI2ND1bq2Z58U3oULFfKVnK0baWlBjTrS5sYAO4qAJ610C7sxOnRr4dwxMa cMuQ/XiL0zttcc3r7Pv1fa/gOFTEcF/A7iHXfgvUWJVZxoKnlEhfJeKFzmZYzVpgVV/q e6NGlBUvxJqxO6q+0OHDgJ3vwUldctGJURTTlIePe83WurlQ1Fvnrhz+MJKywFyAUzkG RdzUxZQNERUeK1yOps2K2MKKoWLpJKs7o8LQRAy5pVoe+SaTVe24onulqypnroIJpxsS msDCLvvqEthS2fAFeACpSuvAiwGtcWIWcw8fYFax6yk/NxLPQh50siBtmwZeR/3AA5j4 XJzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="uiCpVRG/"; 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=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 t16si26147471ply.133.2019.07.30.04.17.06; Tue, 30 Jul 2019 04:17:21 -0700 (PDT) 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=@ti.com header.s=ti-com-17Q1 header.b="uiCpVRG/"; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731463AbfG3JfQ (ORCPT + 99 others); Tue, 30 Jul 2019 05:35:16 -0400 Received: from lelv0143.ext.ti.com ([198.47.23.248]:51472 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731447AbfG3JfP (ORCPT ); Tue, 30 Jul 2019 05:35:15 -0400 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id x6U9Z97t046288; Tue, 30 Jul 2019 04:35:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1564479309; bh=l1+HONjf2p2srVPl+q2lau+bAc7cFYjjd944yTl+xYo=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=uiCpVRG/k6x5emdC4KnvD4W18zrgc4qih4Tqpa2+oQep04kaA99wHsa+y4yCqSYDN tKnTh65eNwTBaBNMwKUGrGHorv0TrR2WuonMyoJQkFhCEoD4cxlUihUyioWaaQzCfM Pa4Do4YIL/lBr6KQ3dsCaeYH2eIa0kaXSKKTE4qc= Received: from DFLE101.ent.ti.com (dfle101.ent.ti.com [10.64.6.22]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x6U9Z9Lt048660 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 30 Jul 2019 04:35:09 -0500 Received: from DFLE100.ent.ti.com (10.64.6.21) by DFLE101.ent.ti.com (10.64.6.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Tue, 30 Jul 2019 04:35:07 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DFLE100.ent.ti.com (10.64.6.21) 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, 30 Jul 2019 04:35:07 -0500 Received: from feketebors.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id x6U9YkU2027547; Tue, 30 Jul 2019 04:35:04 -0500 From: Peter Ujfalusi To: , , , CC: , , , , , , , , , Subject: [PATCH v2 05/14] dmaengine: Add support for reporting DMA cached data amount Date: Tue, 30 Jul 2019 12:34:41 +0300 Message-ID: <20190730093450.12664-6-peter.ujfalusi@ti.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190730093450.12664-1-peter.ujfalusi@ti.com> References: <20190730093450.12664-1-peter.ujfalusi@ti.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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(+) 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; }; /** -- Peter Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki