From patchwork Fri Feb 24 00:08:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinod Koul X-Patchwork-Id: 9589173 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 32575601AE for ; Fri, 24 Feb 2017 00:18:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 366242875B for ; Fri, 24 Feb 2017 00:18:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2A2512876A; Fri, 24 Feb 2017 00:18:29 +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=ham 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 A57D62875B for ; Fri, 24 Feb 2017 00:18:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752068AbdBXAS2 (ORCPT ); Thu, 23 Feb 2017 19:18:28 -0500 Received: from mga04.intel.com ([192.55.52.120]:13043 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751454AbdBXAJq (ORCPT ); Thu, 23 Feb 2017 19:09:46 -0500 Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Feb 2017 16:09:04 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,199,1484035200"; d="scan'208";a="827834069" Received: from mjimen4x-mobl1.amr.corp.intel.com (HELO vkoul-mobl.gar.corp.intel.com) ([10.252.132.190]) by FMSMGA003.fm.intel.com with ESMTP; 23 Feb 2017 16:09:04 -0800 From: Vinod Koul To: dmaengine@vger.kernel.org Cc: Vinod Koul Subject: [RFD] dmaengine: add new sleepy alloc descriptor and slave sg APIs Date: Thu, 23 Feb 2017 16:08:36 -0800 Message-Id: <1487894916-5765-1-git-send-email-vinod.koul@intel.com> X-Mailer: git-send-email 2.7.4 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP There have been discussions on need for change of dmaengine API for a) allow sleepy invocation of the prepare descriptor so that drivers can do the runtime pm (maybe move into core as well) b) split the prepare operation to allocate and new prepare methods TBD: Should the new prepare be atomic or not TBD: Should we move the pm calls to core TBA: Documentaion and wrappers for these calls Signed-off-by: Vinod Koul --- include/linux/dmaengine.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h index 533680860865..33edcc5bc723 100644 --- a/include/linux/dmaengine.h +++ b/include/linux/dmaengine.h @@ -658,6 +658,11 @@ struct dma_filter { const struct dma_slave_map *map; }; +enum dmaengine_operation { + DMAENGINE_SLAVE_SG = 1, + DMAENGINE_SLAVE_LAST = DMAENGINE_SLAVE_SG, +}; + /** * struct dma_device - info on the entity supplying DMA services * @chancnt: how many DMA channels are supported @@ -700,6 +705,10 @@ struct dma_filter { * be called after period_len bytes have been transferred. * @device_prep_interleaved_dma: Transfer expression in a generic way. * @device_prep_dma_imm_data: DMA's 8 byte immediate data to the dst address + * @device_alloc_descriptor: Allocate a dma descriptor for dmaengine operation + * specfied. Can by invoked from sleepy context. + * Cannot be called from callback context. + * @device_desc_prep_slave_sg: Prepare a slave sg txn for a given descriptor * @device_config: Pushes a new configuration to a channel, return 0 or an error * code * @device_pause: Pauses any transfer happening on a channel. Returns @@ -792,6 +801,12 @@ struct dma_device { struct dma_chan *chan, dma_addr_t dst, u64 data, unsigned long flags); + struct dma_async_tx_descriptor *(*device_alloc_descriptor)( + struct dma_chan *chan, enum dmaengine_operation op); + int (*device_desc_prep_slave_sg)(struct dma_chan *chan, + struct scatterlist *sgl, unsigned int sg_len, + enum dma_transfer_direction direction, unsigned long flags); + int (*device_config)(struct dma_chan *chan, struct dma_slave_config *config); int (*device_pause)(struct dma_chan *chan);