From patchwork Sun Feb 22 16:41:52 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Jarzmik X-Patchwork-Id: 5862251 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0DD76BF440 for ; Sun, 22 Feb 2015 16:45:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 017CF2058A for ; Sun, 22 Feb 2015 16:45:12 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1F43E2056E for ; Sun, 22 Feb 2015 16:45:11 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YPZbr-0006zh-RE; Sun, 22 Feb 2015 16:42:23 +0000 Received: from smtp03.smtpout.orange.fr ([80.12.242.125] helo=smtp.smtpout.orange.fr) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YPZbo-0006xk-GS for linux-arm-kernel@lists.infradead.org; Sun, 22 Feb 2015 16:42:21 +0000 Received: from beldin ([109.222.213.148]) by mwinf5d57 with ME id vUhs1p0023CgPMH03UhsDJ; Sun, 22 Feb 2015 17:41:57 +0100 X-ME-Helo: beldin X-ME-Date: Sun, 22 Feb 2015 17:41:57 +0100 X-ME-IP: 109.222.213.148 From: Robert Jarzmik To: Vinod Koul , Russell King - ARM Linux Subject: dmaengine, virt-dma and reusable transfers X-URL: http://belgarath.falguerolles.org/ Date: Sun, 22 Feb 2015 17:41:52 +0100 Message-ID: <87bnkl7van.fsf@free.fr> User-Agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3.92 (gnu/linux) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150222_084220_893117_6D9DEE7F X-CRM114-Status: GOOD ( 15.45 ) X-Spam-Score: 0.0 (/) Cc: dmaengine@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Daniel Mack X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Russell and Vinod, I've made the patch in [1] in order to be able to reuse descriptors, ie. resubmit completed transfers once they are completed. As I'm not sure I understand all the dmaengine slave API, nor the virt-dma fully, I'd like you to have an eye on it first. Thanks for your time. diff --git a/drivers/dma/virt-dma.c b/drivers/dma/virt-dma.c index 6f80432..1e4fd18 100644 --- a/drivers/dma/virt-dma.c +++ b/drivers/dma/virt-dma.c @@ -83,8 +83,10 @@ static void vchan_complete(unsigned long arg) cb_data = vd->tx.callback_param; list_del(&vd->node); - - vc->desc_free(vd); + if (vd->tx.flags & DMA_PREP_CONTINUE) + list_add(&vd->node, &vc->desc_submittable); + else + vc->desc_free(vd); if (cb) cb(cb_data); @@ -108,6 +110,7 @@ void vchan_init(struct virt_dma_chan *vc, struct dma_device *dmadev) dma_cookie_init(&vc->chan); spin_lock_init(&vc->lock); + INIT_LIST_HEAD(&vc->desc_submittable); INIT_LIST_HEAD(&vc->desc_submitted); INIT_LIST_HEAD(&vc->desc_issued); INIT_LIST_HEAD(&vc->desc_completed); diff --git a/drivers/dma/virt-dma.h b/drivers/dma/virt-dma.h index 181b952..3772032 100644 --- a/drivers/dma/virt-dma.h +++ b/drivers/dma/virt-dma.h @@ -29,6 +29,7 @@ struct virt_dma_chan { spinlock_t lock; /* protected by vc.lock */ + struct list_head desc_submittable; struct list_head desc_submitted; struct list_head desc_issued; struct list_head desc_completed; @@ -134,6 +135,7 @@ static inline struct virt_dma_desc *vchan_next_desc(struct virt_dma_chan *vc) static inline void vchan_get_all_descriptors(struct virt_dma_chan *vc, struct list_head *head) { + list_splice_tail_init(&vc->desc_submittable, head); list_splice_tail_init(&vc->desc_submitted, head); list_splice_tail_init(&vc->desc_issued, head); list_splice_tail_init(&vc->desc_completed, head);