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: 9930765 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 7EA1D603B4 for ; Wed, 30 Aug 2017 20:56:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6A996287CF for ; Wed, 30 Aug 2017 20:56:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4FDB8287E2; Wed, 30 Aug 2017 20:56:38 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 809FB287B5 for ; Wed, 30 Aug 2017 20:56:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751100AbdH3Uz5 (ORCPT ); Wed, 30 Aug 2017 16:55:57 -0400 Received: from mga14.intel.com ([192.55.52.115]:45606 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750855AbdH3Uz5 (ORCPT ); Wed, 30 Aug 2017 16:55:57 -0400 Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Aug 2017 13:55:56 -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 Cc: dmaengine@vger.kernel.org, hch@infradead.org, ross.zwisler@linux.intel.com, elliott@hpe.com, linux-nvdimm@lists.01.org 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 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org 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(+) -- To unsubscribe from this list: send the line "unsubscribe dmaengine" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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)