From patchwork Fri Dec 23 02:26:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shunsuke Mie X-Patchwork-Id: 13080591 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 C9E1BC4332F for ; Fri, 23 Dec 2022 02:26:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229930AbiLWC0Z (ORCPT ); Thu, 22 Dec 2022 21:26:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229874AbiLWC0Y (ORCPT ); Thu, 22 Dec 2022 21:26:24 -0500 Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 461FC60F0 for ; Thu, 22 Dec 2022 18:26:23 -0800 (PST) Received: by mail-pg1-x535.google.com with SMTP id 78so2487118pgb.8 for ; Thu, 22 Dec 2022 18:26:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=igel-co-jp.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=XeWgt78fMtqOLf9jf/mlI1pe5FwR0D/kOgRYfZXjo1E=; b=Mcndd4qil61iXSG5wVtZG5gBfB6m4WfBGf/c6GDqh8S5UC0EEXrr3ndxASAg/wNzKL +ekYYApr3kSh4cm9ZbdlqjH1LaPy5oQempDyparknrRby21MUwd1fYegaVZlMSVJzHHR Q269D9koaP7+xVmFu3vu2LVwo3ni1h9Cyze1bE1sg8bsbaaY13cU4qGsUL5S+9egMFbA Hrn8SlFQLnRksWA0ak95NOYZ/ZfeD+Y2jO2vo47H30GR832Ir/1RtqEZve+BHVMvu/ey XP2fuayUXTNDFZxFLm0qLmNdhjkd/42kl8E8hSyUy3P+rZfniJUue2/no5hOJKiKr8wJ HWyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=XeWgt78fMtqOLf9jf/mlI1pe5FwR0D/kOgRYfZXjo1E=; b=w7VJW5mL/3CASdIFrS1gyRljLi0BXqvH6JtsbsieXgLRczV86BK9NDbNq8IhZF/FXr I+h2xBfk3IYN/dJdyM8Of15mdVNhLTq1Uv8dBfrZ/bVbwtXiDDKq0SL3XIN7ET148Pj1 KlS3y75zB6FBPB8a4WR7QWQ8HAoROjy9fUcLfFqZO7R1a7DMffIenYvTo0nbDw8qeavn xGE2K4P2ftUtuqMPtU75IjkieEoTnR5yzXJUd6MgKvEHZcnnlaGcaL4js7DfJxuma/+4 2dMfEd6P4MIOz1sX+9COWlk2xmSzdA0ehDRQErRf3SUjnXkkRRkcgJt/FdCdx47LaSxK wv4Q== X-Gm-Message-State: AFqh2krgEeKafb/r3IBP7Cc8x8ZWTtmXa49SUz47DV985ZtjcVtgWxS2 nyZLuSlmq4kRO+fdjLESsiN0QQ== X-Google-Smtp-Source: AMrXdXs1VLiXcv65qwumDiKVdqz8fFy7qHdw9UNURe6wo3ZdfzKABH2MDztpgWxWhxSGdIg6/7WWDg== X-Received: by 2002:aa7:9735:0:b0:57f:94e4:5a61 with SMTP id k21-20020aa79735000000b0057f94e45a61mr9351092pfg.16.1671762382736; Thu, 22 Dec 2022 18:26:22 -0800 (PST) Received: from tyrell.hq.igel.co.jp (napt.igel.co.jp. [219.106.231.132]) by smtp.gmail.com with ESMTPSA id w186-20020a6262c3000000b005772f762e43sm1418471pfb.13.2022.12.22.18.26.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Dec 2022 18:26:22 -0800 (PST) From: Shunsuke Mie To: Gustavo Pimentel Cc: Vinod Koul , dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, Shunsuke Mie Subject: [PATCH 1/2] dmaengine: dw-edma: Fix to change for continuous transfer Date: Fri, 23 Dec 2022 11:26:07 +0900 Message-Id: <20221223022608.550697-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. Fix it to 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 --- drivers/dma/dw-edma/dw-edma-core.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/drivers/dma/dw-edma/dw-edma-core.c b/drivers/dma/dw-edma/dw-edma-core.c index c54b24ff5206..669b97313911 100644 --- a/drivers/dma/dw-edma/dw-edma-core.c +++ b/drivers/dma/dw-edma/dw-edma-core.c @@ -170,7 +170,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; @@ -178,16 +178,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; @@ -195,6 +195,8 @@ static void dw_edma_start_transfer(struct dw_edma_chan *chan) list_del(&child->list); kfree(child); desc->chunks_alloc--; + + return 1; } static int dw_edma_device_config(struct dma_chan *dchan, @@ -568,14 +570,17 @@ 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 to transfer in case of there are rest chunks, or issued + * requests remain. + */ + chan->status = EDMA_ST_BUSY; + if (!dw_edma_start_transfer(chan)) + chan->status = EDMA_ST_IDLE; break; case EDMA_REQ_STOP: From patchwork Fri Dec 23 02:26:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shunsuke Mie X-Patchwork-Id: 13080592 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 6C6BBC4332F for ; Fri, 23 Dec 2022 02:26:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229524AbiLWC0d (ORCPT ); Thu, 22 Dec 2022 21:26:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229982AbiLWC0b (ORCPT ); Thu, 22 Dec 2022 21:26:31 -0500 Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4945462EF for ; Thu, 22 Dec 2022 18:26:30 -0800 (PST) Received: by mail-pf1-x42a.google.com with SMTP id t18so2433135pfq.13 for ; Thu, 22 Dec 2022 18:26:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=igel-co-jp.20210112.gappssmtp.com; s=20210112; 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=+PgePphIkJvS7Okl9Cj+x1SpvHHCufOw282m7NhoD9k=; b=GSlGi50L9w6iFdONQ34C/l/widp+H4tgsoFT87eYgfxSPJfOJAzdqdlwclCf+xEWJ7 hYus1zP3Q84bDBIyh4xRW6Eo9kRqSVygNeYgw9pNXbmNpA3YWhpH2BWPFpObE1jO7wfF 0AAOEvGuPboZm+NrS7bED9U+0k2v49wrFexhx3pGBJm1jDsx+oeD/aQVmG73Ae9Bnxc5 XnLOZUFlSN5ddedKnB+S0BxWnlcZlmofiLz1comF57iHEAaOr7tRZs9MznAGan9r3Mjp c2tXVXLvfFmqDeXJf8AcMt6sruNgItBH1HjH+b8oM00EySJaK3JGk8R1BYxtN7CzH5Cf Irtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=+PgePphIkJvS7Okl9Cj+x1SpvHHCufOw282m7NhoD9k=; b=riwDPz7NhfNFfbTdcIjg0YcEQLTOgTR0lZZZ/GDhV14NrBqbmu3+mwAmdq/c/SsAUB fHWLHoanBg2UnnC8FoM+Xvot3unttxo4S+Yr8OeUADbcheQfw2ibGo8pc78JiwV1ln1+ awpxvAKInO2uFyijGp40tkvwupaNoWxA4xa1FVyomNvsiFVAqY4R+q8bhEryySHAxzYl p7tZvoXcjxi+Yjzyoiru1zIbWCbinc2lpWL0Wv4fVW5SbXe6ZuRxJrea2Lm/kmIUh5es Oi/T+Nw6cJ8UwNj/69Fo9GMHp1HlIfIBMSODjApxip7nTTZu0JX8h0+4n7zaFF0H0FOn iu/A== X-Gm-Message-State: AFqh2kpq0m7H2hKjvbM3DNYEiAFuWsaRBvhQVLBnb4sLF4dXErLUUP8u DoGFNcy0xrjaGqw1tKfxfDnqyQ== X-Google-Smtp-Source: AMrXdXtZoqDXNrz8Az2mo7F6aXKG/yTYiRdDlROuqIHUtfwf0f/ELE/cbOdy+OQ/h19/XlWL6U0XFg== X-Received: by 2002:aa7:97ba:0:b0:576:d2cc:1ad2 with SMTP id d26-20020aa797ba000000b00576d2cc1ad2mr7689262pfq.6.1671762389794; Thu, 22 Dec 2022 18:26:29 -0800 (PST) Received: from tyrell.hq.igel.co.jp (napt.igel.co.jp. [219.106.231.132]) by smtp.gmail.com with ESMTPSA id w186-20020a6262c3000000b005772f762e43sm1418471pfb.13.2022.12.22.18.26.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Dec 2022 18:26:29 -0800 (PST) From: Shunsuke Mie To: Gustavo Pimentel Cc: Vinod Koul , dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, Shunsuke Mie Subject: [PATCH 2/2] dmaengine: dw-edma: Fix to enable to issue dma request on DMA processing Date: Fri, 23 Dec 2022 11:26:08 +0900 Message-Id: <20221223022608.550697-2-mie@igel.co.jp> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221223022608.550697-1-mie@igel.co.jp> References: <20221223022608.550697-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 --- 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 669b97313911..80323b7a8bce 100644 --- a/drivers/dma/dw-edma/dw-edma-core.c +++ b/drivers/dma/dw-edma/dw-edma-core.c @@ -279,9 +279,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); }