From patchwork Mon Aug 21 21:11:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Jiang X-Patchwork-Id: 9913811 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BD271602A0 for ; Mon, 21 Aug 2017 21:11:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AF2E128799 for ; Mon, 21 Aug 2017 21:11:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A4187287DE; Mon, 21 Aug 2017 21:11:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 738B428799 for ; Mon, 21 Aug 2017 21:11:06 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 56FE921E7902B; Mon, 21 Aug 2017 14:08:34 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id CE80A21E79007 for ; Mon, 21 Aug 2017 14:08:32 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Aug 2017 14:11:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.41,409,1498546800"; d="scan'208"; a="1006154212" Received: from djiang5-desk3.ch.intel.com ([143.182.137.38]) by orsmga003.jf.intel.com with ESMTP; 21 Aug 2017 14:11:03 -0700 Subject: [PATCH v5 5/7] dmaengine: add function to provide per descriptor xfercap for dma engine From: Dave Jiang To: vinod.koul@intel.com, dan.j.williams@intel.com Date: Mon, 21 Aug 2017 14:11:03 -0700 Message-ID: <150334986374.55214.13718278546736297978.stgit@djiang5-desk3.ch.intel.com> In-Reply-To: <150333903164.55214.3813479680626005389.stgit@djiang5-desk3.ch.intel.com> References: <150333903164.55214.3813479680626005389.stgit@djiang5-desk3.ch.intel.com> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dmaengine@vger.kernel.org, hch@infradead.org, linux-nvdimm@lists.01.org Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP Adding a function that will export the transfer capability per descriptor for a DMA device for the dmaengine subsystem. Signed-off-by: Dave Jiang --- drivers/dma/ioat/init.c | 1 + include/linux/dmaengine.h | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/drivers/dma/ioat/init.c b/drivers/dma/ioat/init.c index 5c69ff6..4f24c36 100644 --- a/drivers/dma/ioat/init.c +++ b/drivers/dma/ioat/init.c @@ -596,6 +596,7 @@ static int ioat_enumerate_channels(struct ioatdma_device *ioat_dma) if (xfercap_log == 0) return 0; dev_dbg(dev, "%s: xfercap = %d\n", __func__, 1 << xfercap_log); + dma->xfercap = 1 << xfercap_log; for (i = 0; i < dma->chancnt; i++) { ioat_chan = devm_kzalloc(dev, sizeof(*ioat_chan), GFP_KERNEL); diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h index 0c91411..53356c4 100644 --- a/include/linux/dmaengine.h +++ b/include/linux/dmaengine.h @@ -743,6 +743,7 @@ struct dma_device { u32 max_burst; bool descriptor_reuse; enum dma_residue_granularity residue_granularity; + u64 xfercap; /* descriptor transfer capability limit */ int (*device_alloc_chan_resources)(struct dma_chan *chan); void (*device_free_chan_resources)(struct dma_chan *chan); @@ -1326,6 +1327,11 @@ struct dma_chan *dma_request_chan_by_mask(const dma_cap_mask_t *mask); void dma_release_channel(struct dma_chan *chan); int dma_get_slave_caps(struct dma_chan *chan, struct dma_slave_caps *caps); + +static inline u64 dma_get_desc_xfercap(struct dma_chan *chan) +{ + return chan->device->xfercap; +} #else static inline struct dma_chan *dma_find_channel(enum dma_transaction_type tx_type) { @@ -1370,6 +1376,10 @@ static inline int dma_get_slave_caps(struct dma_chan *chan, { return -ENXIO; } +static inline u64 dma_get_desc_xfercap(struct dma_chan *chan) +{ + return -ENXIO; +} #endif #define dma_request_slave_channel_reason(dev, name) dma_request_chan(dev, name)