Message ID | 20231002131749.2977952-2-kory.maincent@bootlin.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp1612719vqb; Mon, 2 Oct 2023 11:27:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEWoW30KQLH/vmylrtlK6Uud1M0oAQUTNFIOC3vnMwdvaLOY9VmtDTQWACjkxr9UD7mGfEO X-Received: by 2002:a17:903:2348:b0:1c6:2fc0:9626 with SMTP id c8-20020a170903234800b001c62fc09626mr14352363plh.6.1696271266577; Mon, 02 Oct 2023 11:27:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696271266; cv=none; d=google.com; s=arc-20160816; b=bpqKqzcSZ9ciSIEgdO6sxKEPfCRbnGIbYY6d+q+7Tr6i2I+GIiI6sqJdbcSrtdMm3i xpt4DfsGjAwnqCKaFFXYrnKqeNO4EfdVMhzGc7w4vMH3kEFdMtvazENk96kwXFoS46de UF5Nb3a4+C+pIgQ8e9krb9QeZQgIFyOqXCIJ2mZl7nfvsbzHhw8jt0A41fjLxWCJJIFG LHKGwJV5WlrqY6stWhhvONUK64/X1v78L/fJQuSrqoBTc2aaarXVJKn02uAuT1Dpjxj+ FFN3hAiBsQTinF8MGv3LUeAx8mjktV2tQ2J5IYaQRKz2isPHwYBRQ550jSn/oIFMQMWU Tisg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=i7v32YcvbtKkSJ6srCUo4fO3a6wW8xsgEHf4MdRd9fI=; fh=3Wij1Nyq0kk9iFJBGjsMqOGfirL0oXoeYA+XKMkEeWg=; b=bqPLLzpH7jLlrdZ+FNjfP0dFhlHDFVQuffYMtny2JNu9YME8QmPcRki4Fv0y/MEIML YAbVdNMlKD003BbPEtghAgchse13Tn2KGExrbN3J9ERfQB6QV63Qkp/Ud/DV5TgrqpGb vkHHMobPvAULNRB71cQBEF9i1FVcvMceCBSZqTRRHS8lNXmmvARmGlpXRpBp7Z19s0ME R4DVX5LpgXQ6DhZZDl1TrQq1L3d8SdNh8q+kw1UACU3BkDtBUEOxAenUdQOoxA4UhjJI l+yCsdGWrwY2xB1lCQab6fAIqNDQg69gbFEvZX72431pR/aBqFIACR9ZEmXqkbD4d6y7 Mgow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=Jv8P35xM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id d12-20020a170902f14c00b001c732b6869csi10712165plb.63.2023.10.02.11.27.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 11:27:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=Jv8P35xM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 85B5780964F5; Mon, 2 Oct 2023 06:18:26 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237379AbjJBNSF (ORCPT <rfc822;pusanteemu@gmail.com> + 18 others); Mon, 2 Oct 2023 09:18:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237359AbjJBNR6 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 2 Oct 2023 09:17:58 -0400 Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::228]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92DF6D9; Mon, 2 Oct 2023 06:17:54 -0700 (PDT) Received: by mail.gandi.net (Postfix) with ESMTPSA id 78A041BF211; Mon, 2 Oct 2023 13:17:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1696252672; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=i7v32YcvbtKkSJ6srCUo4fO3a6wW8xsgEHf4MdRd9fI=; b=Jv8P35xM3G4fXx7JgcG2Da0TXIVsgzHvLMfuRfHn/jbHcHUi4gQrgW+ety+Vpty+xxh1MF BdT9SzwYIQG/IS1beObVyXa3lSu7QvWDXJtzvfOQh6vWXzIQ5h7jYwPp+kKAdU++uXs690 LiCYnrvnYfOA8v5a7ig+jyUjnJP2xNRAuqkiTgqGxtN3aVLyO4tKcTeCyJ7upUc61a6SNx aFzHd6M2Ejd481iPcyCDwbesZLMfk7uZJF6IkgVZXsqM6cilX7dk9iwAQlGXaYyJz6Busk MNixVt1qBTx4Y9GmEwU2fgQmf6E6nLhV18WPg32126x1k0Yu4ig78JN2L4mF/Q== From: =?utf-8?q?K=C3=B6ry_Maincent?= <kory.maincent@bootlin.com> To: Cai Huoqing <cai.huoqing@linux.dev>, Manivannan Sadhasivam <mani@kernel.org>, Serge Semin <fancer.lancer@gmail.com>, Vinod Koul <vkoul@kernel.org>, Gustavo Pimentel <Gustavo.Pimentel@synopsys.com>, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>, Gustavo Pimentel <gustavo.pimentel@synopsys.com>, Herve Codina <herve.codina@bootlin.com>, Kory Maincent <kory.maincent@bootlin.com> Subject: [PATCH v2 1/5] dmaengine: dw-edma: Fix the ch_count hdma callback Date: Mon, 2 Oct 2023 15:17:45 +0200 Message-Id: <20231002131749.2977952-2-kory.maincent@bootlin.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231002131749.2977952-1-kory.maincent@bootlin.com> References: <20231002131749.2977952-1-kory.maincent@bootlin.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-GND-Sasl: kory.maincent@bootlin.com X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Mon, 02 Oct 2023 06:18:26 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778669339846748407 X-GMAIL-MSGID: 1778669339846748407 |
Series |
Fix support of dw-edma HDMA NATIVE IP in remote setup
|
|
Commit Message
Köry Maincent
Oct. 2, 2023, 1:17 p.m. UTC
From: Kory Maincent <kory.maincent@bootlin.com> The current check of ch_en enabled to know the maximum number of available hardware channels is wrong as it check the number of ch_en register set but all of them are unset at probe. This register is set at the dw_hdma_v0_core_start function which is run lately before a DMA transfer. The HDMA IP have no way to know the number of hardware channels available like the eDMA IP, then let set it to maximum channels and let the platform set the right number of channels. Fixes: e74c39573d35 ("dmaengine: dw-edma: Add support for native HDMA") Signed-off-by: Kory Maincent <kory.maincent@bootlin.com> --- See the following thread mail that talk about this issue: https://lore.kernel.org/lkml/20230607095832.6d6b1a73@kmaincent-XPS-13-7390/ Changes in v2: - Add comment --- drivers/dma/dw-edma/dw-hdma-v0-core.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-)
Comments
Hi Cai, On Mon, Oct 02, 2023 at 03:17:45PM +0200, Köry Maincent wrote: > From: Kory Maincent <kory.maincent@bootlin.com> > > The current check of ch_en enabled to know the maximum number of available > hardware channels is wrong as it check the number of ch_en register set > but all of them are unset at probe. This register is set at the > dw_hdma_v0_core_start function which is run lately before a DMA transfer. > > The HDMA IP have no way to know the number of hardware channels available > like the eDMA IP, then let set it to maximum channels and let the platform > set the right number of channels. > > Fixes: e74c39573d35 ("dmaengine: dw-edma: Add support for native HDMA") > Signed-off-by: Kory Maincent <kory.maincent@bootlin.com> > --- > > See the following thread mail that talk about this issue: > https://lore.kernel.org/lkml/20230607095832.6d6b1a73@kmaincent-XPS-13-7390/ Cai, do you have anything to add in regards to this change and to the discussion available in the thread above? If no, I guess the solution provided in this patch is the best we can currently come up with. -Serge(y) > > Changes in v2: > - Add comment > --- > drivers/dma/dw-edma/dw-hdma-v0-core.c | 17 +++++------------ > 1 file changed, 5 insertions(+), 12 deletions(-) > > diff --git a/drivers/dma/dw-edma/dw-hdma-v0-core.c b/drivers/dma/dw-edma/dw-hdma-v0-core.c > index 00b735a0202a..3e78d4fd3955 100644 > --- a/drivers/dma/dw-edma/dw-hdma-v0-core.c > +++ b/drivers/dma/dw-edma/dw-hdma-v0-core.c > @@ -65,18 +65,11 @@ static void dw_hdma_v0_core_off(struct dw_edma *dw) > > static u16 dw_hdma_v0_core_ch_count(struct dw_edma *dw, enum dw_edma_dir dir) > { > - u32 num_ch = 0; > - int id; > - > - for (id = 0; id < HDMA_V0_MAX_NR_CH; id++) { > - if (GET_CH_32(dw, id, dir, ch_en) & BIT(0)) > - num_ch++; > - } > - > - if (num_ch > HDMA_V0_MAX_NR_CH) > - num_ch = HDMA_V0_MAX_NR_CH; > - > - return (u16)num_ch; > + /* The HDMA IP have no way to know the number of hardware channels > + * available, we set it to maximum channels and let the platform > + * set the right number of channels. > + */ > + return HDMA_V0_MAX_NR_CH; > } > > static enum dma_status dw_hdma_v0_core_ch_status(struct dw_edma_chan *chan) > -- > 2.25.1 >
On Mon, Oct 02, 2023 at 03:17:45PM +0200, Köry Maincent wrote: > From: Kory Maincent <kory.maincent@bootlin.com> > > The current check of ch_en enabled to know the maximum number of available > hardware channels is wrong as it check the number of ch_en register set > but all of them are unset at probe. This register is set at the > dw_hdma_v0_core_start function which is run lately before a DMA transfer. > > The HDMA IP have no way to know the number of hardware channels available > like the eDMA IP, then let set it to maximum channels and let the platform > set the right number of channels. > > Fixes: e74c39573d35 ("dmaengine: dw-edma: Add support for native HDMA") > Signed-off-by: Kory Maincent <kory.maincent@bootlin.com> One nitpick below. With that, Acked-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> > --- > > See the following thread mail that talk about this issue: > https://lore.kernel.org/lkml/20230607095832.6d6b1a73@kmaincent-XPS-13-7390/ > > Changes in v2: > - Add comment > --- > drivers/dma/dw-edma/dw-hdma-v0-core.c | 17 +++++------------ > 1 file changed, 5 insertions(+), 12 deletions(-) > > diff --git a/drivers/dma/dw-edma/dw-hdma-v0-core.c b/drivers/dma/dw-edma/dw-hdma-v0-core.c > index 00b735a0202a..3e78d4fd3955 100644 > --- a/drivers/dma/dw-edma/dw-hdma-v0-core.c > +++ b/drivers/dma/dw-edma/dw-hdma-v0-core.c > @@ -65,18 +65,11 @@ static void dw_hdma_v0_core_off(struct dw_edma *dw) > > static u16 dw_hdma_v0_core_ch_count(struct dw_edma *dw, enum dw_edma_dir dir) > { > - u32 num_ch = 0; > - int id; > - > - for (id = 0; id < HDMA_V0_MAX_NR_CH; id++) { > - if (GET_CH_32(dw, id, dir, ch_en) & BIT(0)) > - num_ch++; > - } > - > - if (num_ch > HDMA_V0_MAX_NR_CH) > - num_ch = HDMA_V0_MAX_NR_CH; > - > - return (u16)num_ch; > + /* The HDMA IP have no way to know the number of hardware channels Please use below style for multi line comment: /* * ... */ - Mani > + * available, we set it to maximum channels and let the platform > + * set the right number of channels. > + */ > + return HDMA_V0_MAX_NR_CH; > } > > static enum dma_status dw_hdma_v0_core_ch_status(struct dw_edma_chan *chan) > -- > 2.25.1 >
diff --git a/drivers/dma/dw-edma/dw-hdma-v0-core.c b/drivers/dma/dw-edma/dw-hdma-v0-core.c index 00b735a0202a..3e78d4fd3955 100644 --- a/drivers/dma/dw-edma/dw-hdma-v0-core.c +++ b/drivers/dma/dw-edma/dw-hdma-v0-core.c @@ -65,18 +65,11 @@ static void dw_hdma_v0_core_off(struct dw_edma *dw) static u16 dw_hdma_v0_core_ch_count(struct dw_edma *dw, enum dw_edma_dir dir) { - u32 num_ch = 0; - int id; - - for (id = 0; id < HDMA_V0_MAX_NR_CH; id++) { - if (GET_CH_32(dw, id, dir, ch_en) & BIT(0)) - num_ch++; - } - - if (num_ch > HDMA_V0_MAX_NR_CH) - num_ch = HDMA_V0_MAX_NR_CH; - - return (u16)num_ch; + /* The HDMA IP have no way to know the number of hardware channels + * available, we set it to maximum channels and let the platform + * set the right number of channels. + */ + return HDMA_V0_MAX_NR_CH; } static enum dma_status dw_hdma_v0_core_ch_status(struct dw_edma_chan *chan)