From patchwork Wed Aug 30 20:55:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Jiang X-Patchwork-Id: 9930761 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 6E90E603B4 for ; Wed, 30 Aug 2017 20:56:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5DD7F287CD for ; Wed, 30 Aug 2017 20:56:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4E1C6287D3; Wed, 30 Aug 2017 20:56:37 +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=ham 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 E705D287A7 for ; Wed, 30 Aug 2017 20:56:35 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 80CF721E95DE4; Wed, 30 Aug 2017 13:55:53 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (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 4A9A221E70D54 for ; Wed, 30 Aug 2017 13:55:52 -0700 (PDT) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Aug 2017 13:55:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,450,1498546800"; d="scan'208";a="146442268" Received: from djiang5-desk3.ch.intel.com ([143.182.137.38]) by fmsmga006.fm.intel.com with ESMTP; 30 Aug 2017 13:55:55 -0700 Subject: [PATCH v7 4/9] 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: Wed, 30 Aug 2017 13:55:55 -0700 Message-ID: <150412655540.69288.8062792128406896734.stgit@djiang5-desk3.ch.intel.com> In-Reply-To: <150412628764.69288.12074115435918322858.stgit@djiang5-desk3.ch.intel.com> References: <150412628764.69288.12074115435918322858.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)