Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1886704rdb; Tue, 3 Oct 2023 04:23:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF/QCdB2TiRd1Rmm16Sdwy0JSMYKGNzoCGHKtg4r0mhc8zVBa3A7dnBKJNvb79IFX8UdjlM X-Received: by 2002:a17:902:9b8e:b0:1c0:d7a8:a43e with SMTP id y14-20020a1709029b8e00b001c0d7a8a43emr11966839plp.53.1696332231914; Tue, 03 Oct 2023 04:23:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696332231; cv=none; d=google.com; s=arc-20160816; b=YwbW1dXlzPWdhf6LO2M8y6om6Pfqyvtzy28B0ayzDyg1CIenJsCZXrJO+hgC9MX8YO jv0a3gDvGbsqy1Bu9cOaLWbgewto7FcHhskkM0RNrFBSK8HfpOS+M4tfA2qLgOc3Ig4i k3jufjYh7evRJvwvrPJNdHJIHwp0vrO4gBQOgq5t+fRyEMEf2qPN+g66WR4ozNaZuNWd 2d1klnKKUzMvn6q+JtbjqdFriXZPSoXS6unmTGPuynTrRG7FTZMs21RbN/RE2QLQgzcM 1JLKGPrADYoU8Ingr3X3e/oRg3uneUWl+fM8MsEfpwanPC1BBNfc/alP1G4VEVv+uzsM 2KKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=d2TdzkuFEpDl4t3q/Kjs9DD3oRaFiqjM4irBtEHakYY=; fh=8qRNkMLrn1IkT3REdbjizdVcONNFCFrTqcAy+Upovl0=; b=0KwubLQWTmBk9colE3iSlYjLhDdzeYsMIjjUriI2H8NlSf0WOpsF8htSIPZThrPQwB HFBsz47SsiOt/4v93zvDN7XVgfqVlsijKar6IhxAKNabZxTJUkoAZb/VrnQK7amBIw2f c2FQeUiPBm12vSwDa4Wee8FSY5OG37Ly8WTuD7i1lLms5/YIw/P0JdEbPCarNyojWubl DWdf0rPyIRjzhbRocw8+rROCpin6HN0GqbBEU6KqzMCSR6x8pXw3Ad/X80QRrEqsKefm BBsSLSFnnFx1nil1imCWNiZ9rvPbK8C9+cbi+9hXx2R7IZLjGKBA+L7YSZ3PVc1jy3c3 RW/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Hc35AOeZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id p12-20020a170902c70c00b001c732b6869csi1156918plp.63.2023.10.03.04.23.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 04:23:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Hc35AOeZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id C303680886AE; Tue, 3 Oct 2023 04:23:50 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232051AbjJCLXl (ORCPT + 99 others); Tue, 3 Oct 2023 07:23:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231337AbjJCLXk (ORCPT ); Tue, 3 Oct 2023 07:23:40 -0400 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A89978E; Tue, 3 Oct 2023 04:23:37 -0700 (PDT) Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-504427aae4fso5116360e87.1; Tue, 03 Oct 2023 04:23:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696332216; x=1696937016; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=d2TdzkuFEpDl4t3q/Kjs9DD3oRaFiqjM4irBtEHakYY=; b=Hc35AOeZ5wbXbKIJgltVFIikwQHsmoCxnC2hPQLIcANveqNcEOqQRuxVkvB32Wh0XF wIiF+N8AfQBq1xL8u10c54ZukpwT8rI4gX96U/AFl0fb615WGyzGUNZXh6XARx8T5unb +ujPoIz/5y1HYhCqZbnojGRQ9qqvj/xBwi4ajqXAiiiY/COddKRhUUchRvWLzfSmDnp1 TG6/nChMK3zmL2+ev1KQdG1cAya57Sv4d50N1q9Td/f0xmXIZWhjeAZJ9rAH5Z09ZzoJ M8LofW4IdK0zd5mUJsdqMJfgQPGGadE4lGaHKJ1IBITEYPFv2YtaFOm/V+sKtrIiCZEa qB0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696332216; x=1696937016; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=d2TdzkuFEpDl4t3q/Kjs9DD3oRaFiqjM4irBtEHakYY=; b=mzV0b7Ode/o0neR1DwkQD2KN0/Oe67TI/xfdlM1Qq+3XBVfy9f96mQMemR7UjLJ8Az WWkmu2xFZe05FQ6NwDIdzXB5igZ9JUcoHuHs/t470cEhtyh8DRG6t99VQHkruuvn2iFz uiaucpC2BRs5izYVTWDPyNnfnvG2Iei0DCzV9QbyH04GhYNPjQksQ+qbR5MlPnv9R6pY ed6lKfq+XhxP82p871X8FQVw5CTdiVa235E8lEe/j0zZiqAmFkejfqMa5lDjp49aUsMx gfu5+ogCadFSzEIZhV0+X1CKZnUgJVsVuyxLHSROaxqZdwcQKyMi36n6HPjTUMqf5A/4 rk2Q== X-Gm-Message-State: AOJu0Yys9RX5qpp9DDpjtqITa6+/VW45ZMti+DgB4ZXRN4XVGMNGfhud aeaDTFJaKhHeZnrd4YKVecHZ4Pustbw= X-Received: by 2002:a05:6512:3d25:b0:502:d973:3206 with SMTP id d37-20020a0565123d2500b00502d9733206mr1730581lfv.6.1696332215541; Tue, 03 Oct 2023 04:23:35 -0700 (PDT) Received: from mobilestation ([178.176.56.174]) by smtp.gmail.com with ESMTPSA id b28-20020ac2563c000000b0050419b760d0sm158429lff.17.2023.10.03.04.23.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 04:23:34 -0700 (PDT) Date: Tue, 3 Oct 2023 14:23:31 +0300 From: Serge Semin To: Cai Huoqing Cc: =?utf-8?B?S8O2cnk=?= Maincent , Manivannan Sadhasivam , Vinod Koul , Gustavo Pimentel , dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, Thomas Petazzoni , Herve Codina Subject: Re: [PATCH v2 1/5] dmaengine: dw-edma: Fix the ch_count hdma callback Message-ID: References: <20231002131749.2977952-1-kory.maincent@bootlin.com> <20231002131749.2977952-2-kory.maincent@bootlin.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20231002131749.2977952-2-kory.maincent@bootlin.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 03 Oct 2023 04:23:51 -0700 (PDT) Hi Cai, On Mon, Oct 02, 2023 at 03:17:45PM +0200, K?ry Maincent wrote: > From: Kory Maincent > > 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 > --- > > 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 >