From nobody Thu Dec 18 18:30:09 2025 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 AC392C7EE26 for ; Sun, 21 May 2023 11:49:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231497AbjEULtm (ORCPT ); Sun, 21 May 2023 07:49:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230466AbjEUK1S (ORCPT ); Sun, 21 May 2023 06:27:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FF7D10E0; Sun, 21 May 2023 03:23:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A91BD61237; Sun, 21 May 2023 10:23:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 410FFC4339B; Sun, 21 May 2023 10:23:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684664607; bh=iRI9Nbek5uu1qAv7VQcDDGQ/jUGkxcfTM3bdHx/73/4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T1wnG289rlegA31pfjTwhfCkzkkQREJxin57BHyMKFgwZslrkTJMBDYrqLldVEDJo L7IyA0vD/2U8mUe5DWd4rNKp2F3gjfORXPxdh9QwzkoZRcB7Jq83uuQFWsWQ9kMcZk gs32NhhV+TjGmeOQI5hw9Dk1Heuk2xK19/roDYZTxzkYkkRUUZ+9pB/zKXZ3zP03ZO 5Cj4XiIx/k3t+eN+awQoKFEsN8ArRfSfhiH8p3pLcNh6tvP4gIY+RIOE1GQ9NXTl7y 3UdKktY6e7edqUXCNubD0GU7v3FBf3jrFR/LSNo0T90GLR3mPnrm2foUnTTUnbBgJZ kvr+NWaTqea6A== From: Jisheng Zhang To: Eugeniy Paltsev , Vinod Koul Cc: dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 01/11] dmaengine: dw-axi-dmac: fix reading register when runtime suspended Date: Sun, 21 May 2023 18:12:06 +0800 Message-Id: <20230521101216.4084-2-jszhang@kernel.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230521101216.4084-1-jszhang@kernel.org> References: <20230521101216.4084-1-jszhang@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" We should runtime resume the device before calling axi_chan_is_hw_enable(), otherwise we may see cpu aborts when accessing registers in axi_chan_is_hw_enable(). Signed-off-by: Jisheng Zhang --- drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c b/drivers/dma/d= w-axi-dmac/dw-axi-dmac-platform.c index 796b6caf0bab..203be13499e3 100644 --- a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c +++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c @@ -469,13 +469,17 @@ static void dw_axi_dma_synchronize(struct dma_chan *d= chan) =20 static int dma_chan_alloc_chan_resources(struct dma_chan *dchan) { + int ret; struct axi_dma_chan *chan =3D dchan_to_axi_dma_chan(dchan); =20 + pm_runtime_get(chan->chip->dev); + /* ASSERT: channel is idle */ if (axi_chan_is_hw_enable(chan)) { dev_err(chan2dev(chan), "%s is non-idle!\n", axi_chan_name(chan)); - return -EBUSY; + ret =3D -EBUSY; + goto err_busy; } =20 /* LLI address must be aligned to a 64-byte boundary */ @@ -485,13 +489,16 @@ static int dma_chan_alloc_chan_resources(struct dma_c= han *dchan) 64, 0); if (!chan->desc_pool) { dev_err(chan2dev(chan), "No memory for descriptors\n"); - return -ENOMEM; + ret =3D -ENOMEM; + goto err_busy; } dev_vdbg(dchan2dev(dchan), "%s: allocating\n", axi_chan_name(chan)); =20 - pm_runtime_get(chan->chip->dev); - return 0; + +err_busy: + pm_runtime_put(chan->chip->dev); + return ret; } =20 static void dma_chan_free_chan_resources(struct dma_chan *dchan) --=20 2.40.0