From patchwork Tue Apr 11 10:17:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shunsuke Mie X-Patchwork-Id: 13207321 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9AF01C7619A for ; Tue, 11 Apr 2023 10:18:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229548AbjDKKSG (ORCPT ); Tue, 11 Apr 2023 06:18:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229522AbjDKKSE (ORCPT ); Tue, 11 Apr 2023 06:18:04 -0400 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C41018E for ; Tue, 11 Apr 2023 03:18:03 -0700 (PDT) Received: by mail-pj1-x1032.google.com with SMTP id jx2-20020a17090b46c200b002469a9ff94aso5628796pjb.3 for ; Tue, 11 Apr 2023 03:18:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=igel-co-jp.20210112.gappssmtp.com; s=20210112; t=1681208283; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=xCwSNc+RZNs4kaUNl6Q6MFm7xs7aEHy8Tuqz3FTq1lk=; b=kiJqAn9CYVGlR7ndEQ0HOiaOjGyDmrHw3F9l0BxFGxvfzfQg+jDcigcGPT9qq1VyRn JfBzGI3Ea7QNqgpuaVMrNO0xdO/Uq0hjft+zSfLCb9lQmuFv07G4mfEI9iH0MLiEkMPA SBo1E4oSGib2LgC04Fk+HtZjbkcpKOD28qnP5nqO/JfmEGY02doVzEZhbH2dARd8RdoQ gPAIMY4cagZn232gJZgAUQsgdL5yeJvkJyWfUcDNZpl70iBnlVh7bLwyqmGKH3W4M2mv i/Vy/iFoQSc68BTxo9YEdJbTUJU5PYZ8gfi525Agz9VDM8iN/CBP7aoRcfOEJ20sVW46 KGMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681208283; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=xCwSNc+RZNs4kaUNl6Q6MFm7xs7aEHy8Tuqz3FTq1lk=; b=QgaXhAo8+ue5SGsEbAK8bIAE10YJj0Ww7+Uxvk4eWOPClkvEyC2/CJmIQXOoOQD7m0 e7SvNIfOxIvE8xetPQPUqsk0hhO8fWP3dzqMbacnSu3z/461QpwG9CvhVrYIZ9zr9mp9 gpbsYvmQWMwfvKtc9d7aveSPZ2HURck43XCh7Mk9iVTMQvUAiSLJP8VuFIcfR66RtSsm c+XO2hEQAX0v+sEPvhdXG41J9Lmy48nIQKna5/oNAAlAEtLrK4OB4i/kfLFVrOlgwRVv fmkGEIuCeLaNJURolX+qQQuLpaHr/a61WF8jGI8Z44jePp+V94/6LlUM04k+jYGdzeSm 4Krg== X-Gm-Message-State: AAQBX9dMclkI3d+gSdVZ3nlLtaRBLaAvMTAht/Lqq4TJyVlXgmC2Dm/V 4eHYI+eT+C5bJsPkBMTvbwRxzjK6CGdEdbt7RWg= X-Google-Smtp-Source: AKy350bEGyfbtMXxQVd7FJ3cHLSPGYjkr7y7Bba7p3tW1TTHqROY1wKKT7s7ZjZ5WNl9v+y2v7cnlg== X-Received: by 2002:a17:903:288e:b0:19e:8075:5545 with SMTP id ku14-20020a170903288e00b0019e80755545mr15421707plb.54.1681208283110; Tue, 11 Apr 2023 03:18:03 -0700 (PDT) Received: from tyrell.hq.igel.co.jp (napt.igel.co.jp. [219.106.231.132]) by smtp.gmail.com with ESMTPSA id iz4-20020a170902ef8400b00195f0fb0c18sm7629794plb.31.2023.04.11.03.18.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Apr 2023 03:18:02 -0700 (PDT) From: Shunsuke Mie To: Gustavo Pimentel Cc: Vinod Koul , dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, Shunsuke Mie Subject: [PATCH v2 1/2] dmaengine: dw-edma: Fix to change for continuous transfer Date: Tue, 11 Apr 2023 19:17:57 +0900 Message-Id: <20230411101758.438472-1-mie@igel.co.jp> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org The dw-edma driver stops after processing a DMA request even if a request remains in the issued queue, which is not the expected behavior. The DMA engine API requires continuous processing. Add a trigger to start after one processing finished if there are requests remain. Fixes: e63d79d1ffcd ("dmaengine: Add Synopsys eDMA IP core driver") Signed-off-by: Shunsuke Mie --- Changes v2: - Refactor code - Rebase to next-20230411 v1: https://lore.kernel.org/dmaengine/20221223022608.550697-1-mie@igel.co.jp/ - Initial patch drivers/dma/dw-edma/dw-edma-core.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/drivers/dma/dw-edma/dw-edma-core.c b/drivers/dma/dw-edma/dw-edma-core.c index 1906a836f0aa..26a395d02f5d 100644 --- a/drivers/dma/dw-edma/dw-edma-core.c +++ b/drivers/dma/dw-edma/dw-edma-core.c @@ -181,7 +181,7 @@ static void vchan_free_desc(struct virt_dma_desc *vdesc) dw_edma_free_desc(vd2dw_edma_desc(vdesc)); } -static void dw_edma_start_transfer(struct dw_edma_chan *chan) +static int dw_edma_start_transfer(struct dw_edma_chan *chan) { struct dw_edma_chunk *child; struct dw_edma_desc *desc; @@ -189,16 +189,16 @@ static void dw_edma_start_transfer(struct dw_edma_chan *chan) vd = vchan_next_desc(&chan->vc); if (!vd) - return; + return 0; desc = vd2dw_edma_desc(vd); if (!desc) - return; + return 0; child = list_first_entry_or_null(&desc->chunk->list, struct dw_edma_chunk, list); if (!child) - return; + return 0; dw_edma_v0_core_start(child, !desc->xfer_sz); desc->xfer_sz += child->ll_region.sz; @@ -206,6 +206,8 @@ static void dw_edma_start_transfer(struct dw_edma_chan *chan) list_del(&child->list); kfree(child); desc->chunks_alloc--; + + return 1; } static void dw_edma_device_caps(struct dma_chan *dchan, @@ -602,14 +604,14 @@ static void dw_edma_done_interrupt(struct dw_edma_chan *chan) switch (chan->request) { case EDMA_REQ_NONE: desc = vd2dw_edma_desc(vd); - if (desc->chunks_alloc) { - chan->status = EDMA_ST_BUSY; - dw_edma_start_transfer(chan); - } else { + if (!desc->chunks_alloc) { list_del(&vd->node); vchan_cookie_complete(vd); - chan->status = EDMA_ST_IDLE; } + + /* Continue transferring if there are remaining chunks or issued requests. + */ + chan->status = dw_edma_start_transfer(chan) ? EDMA_ST_BUSY : EDMA_ST_IDLE; break; case EDMA_REQ_STOP: From patchwork Tue Apr 11 10:17:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shunsuke Mie X-Patchwork-Id: 13207322 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 69C8CC76196 for ; Tue, 11 Apr 2023 10:18:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229530AbjDKKSH (ORCPT ); Tue, 11 Apr 2023 06:18:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229571AbjDKKSG (ORCPT ); Tue, 11 Apr 2023 06:18:06 -0400 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5939D2D67 for ; Tue, 11 Apr 2023 03:18:05 -0700 (PDT) Received: by mail-pj1-x1031.google.com with SMTP id q15-20020a17090a2dcf00b0023efab0e3bfso10380353pjm.3 for ; Tue, 11 Apr 2023 03:18:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=igel-co-jp.20210112.gappssmtp.com; s=20210112; t=1681208285; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xishqwgXyYhfdvHtZU0pcOZOPc9q3eb4WhVoibR5fD0=; b=ZIgwG+osug0iQMZdWCcSaQhwgJjJ7UBhDHJgh7iySX2DUn5Emj4lpC+mQ10UZwAnsB 0QkIvRYZnEsqQ1/RqW9Dn3hhN+xvm1209jqgOOF3NvmC8RJBz5dYYgM2rKOlq3qEmiWd VEekxlqxpm4Gz0i1OXL3zLJ7a/6TLizp8o6KuavfIUtzl4uHmtSLl9ueV/CaO52tOEPE vuH2pE1ZIVKS9te0fwxOn5YGgIvQWNWDKuRzi4O7lmHuyVwNkUULKCI+nD44QrTmn+U+ t9YfE1cfWHdxqv4P8clvHZ4RKxnATEu3cclrMetgQzDQw5yqNtd5i4en68a1SKk3WNpw 9a+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681208285; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xishqwgXyYhfdvHtZU0pcOZOPc9q3eb4WhVoibR5fD0=; b=EWR7XJW5m7e0xUuqwh7FXsc/V7FSQtGCG0rCSv6gX2NCvRg4jjLnrxFnfQwYuJoyLk dq1QainHpsL5kpEFDOiGwOoQyf9FKRAHU4gf8GzcIZ4YglxPBcGyxm1uqgxeOqpTZDvf t7lUv9HP8nAL8u2e1FAR/rJZYL3AK/UGzjesBADslvO3dDQ7bQZJ5QIUvrD4fnjtqpeh FloManmTypSzj9OaNXkckkfx19oDM3WtglI2C4oYBGvXc/Q5Td/9PLEh8H878b+WjR9J EOu32XUgmf8KiaCXQWpHHijOC/iBnZlEHFpBNM+MvTmMdfHDFAV/ATUW4b8YTzhHHxx4 WSVg== X-Gm-Message-State: AAQBX9f+a6A3hWaDa0npm54IuvwolxYwnDv3P7C3pkWzVa16SqVTHWwO 0KTIs4szo91N3KdZoVgNlDunKw== X-Google-Smtp-Source: AKy350YbLhBJRnTxvPCNtIZg6/r3h5r3Fs+wFbUfl5bhUAkC7/VV1yvwvq+KsGil6IqyTt7Oze4ddw== X-Received: by 2002:a17:902:ecca:b0:19c:f232:21ca with SMTP id a10-20020a170902ecca00b0019cf23221camr17822391plh.3.1681208284833; Tue, 11 Apr 2023 03:18:04 -0700 (PDT) Received: from tyrell.hq.igel.co.jp (napt.igel.co.jp. [219.106.231.132]) by smtp.gmail.com with ESMTPSA id iz4-20020a170902ef8400b00195f0fb0c18sm7629794plb.31.2023.04.11.03.18.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Apr 2023 03:18:04 -0700 (PDT) From: Shunsuke Mie To: Gustavo Pimentel Cc: Vinod Koul , dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, Shunsuke Mie Subject: [PATCH v2 2/2] dmaengine: dw-edma: Fix to enable to issue dma request on DMA processing Date: Tue, 11 Apr 2023 19:17:58 +0900 Message-Id: <20230411101758.438472-2-mie@igel.co.jp> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230411101758.438472-1-mie@igel.co.jp> References: <20230411101758.438472-1-mie@igel.co.jp> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org The issue_pending request is ignored while driver is processing a DMA request. Fix to issue the pending requests on any dma channel status. Fixes: e63d79d1ffcd ("dmaengine: Add Synopsys eDMA IP core driver") Signed-off-by: Shunsuke Mie --- Changes v2: - Rebase to next-20230411 v1: https://lore.kernel.org/dmaengine/20221223022608.550697-2-mie@igel.co.jp/ - Initial patch drivers/dma/dw-edma/dw-edma-core.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/dma/dw-edma/dw-edma-core.c b/drivers/dma/dw-edma/dw-edma-core.c index 26a395d02f5d..7d2b73ef0872 100644 --- a/drivers/dma/dw-edma/dw-edma-core.c +++ b/drivers/dma/dw-edma/dw-edma-core.c @@ -308,9 +308,12 @@ static void dw_edma_device_issue_pending(struct dma_chan *dchan) struct dw_edma_chan *chan = dchan2dw_edma_chan(dchan); unsigned long flags; + if (!chan->configured) + return; + spin_lock_irqsave(&chan->vc.lock, flags); - if (chan->configured && chan->request == EDMA_REQ_NONE && - chan->status == EDMA_ST_IDLE && vchan_issue_pending(&chan->vc)) { + if (vchan_issue_pending(&chan->vc) && chan->request == EDMA_REQ_NONE && + chan->status == EDMA_ST_IDLE) { chan->status = EDMA_ST_BUSY; dw_edma_start_transfer(chan); }