Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1282348rbb; Mon, 26 Feb 2024 04:53:38 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVwRg2tq1Sm+vYcGHUjeeRZygIv5/MmXv3DEESeTGte7OIlfmh7xFmGTwOoFOk57YEGo4w0v7DpDJiuEzx/fhC7ICq25b174y/vPoqJ7Q== X-Google-Smtp-Source: AGHT+IHG8VnLjmnBs4c3yDQIO3hBH7G9rieIWKC+ecihdBv+4llehNck2uq0QgIuS8d0gM+lMSb/ X-Received: by 2002:a17:906:5f97:b0:a3e:e678:556 with SMTP id a23-20020a1709065f9700b00a3ee6780556mr5005055eju.58.1708952018504; Mon, 26 Feb 2024 04:53:38 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708952018; cv=pass; d=google.com; s=arc-20160816; b=lyv4fw28AMfVuqSNw3FzdCtBX4y6J1hZ2O9XQM21Cc4YgNyaIUxINW7rRCjbR8CPaI e5lwxGiNH8Mhs0PxxKM2/uwfpJMzWE+9qGzf7TCa1htMQI1llLMo6Gk4Sm7AS4V4Wnu+ iWIWJdlrZrtYh3EEAFaj4zQ6dmEk8IhKdnWo6X5GFD/MlIF/qL9MITLMDeWzpXW8PgMn 6qfdGoI1jMRVIhBXhvwdkj3/nIuwR8yM7rXj9INPUE9OLlhdhRAJEcDSOONG8hEiR9m3 EIAtnUh6ljqRtZ/7zOvtPSWWPEBMm6CHW6Ss63+krLkNho1DhYguCJYCLKCxqKuWv2XG a/8w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=96ZM0BBE+jJXYNw871lXR/5rqt8HxgCfbVdQRkOIEUw=; fh=0HYGD6/1pCZMiBBWKZHIH0/cvcKXYbCAeoNG3kQnGuY=; b=xxvVyoBxxeE34dfcX0AhTfSxAG/+CmUjs2wSwhGvC1rxv0+Zmeqfcty00s42iDB+wZ zg4Ar/3O+0XNG+kY0byBY/9XpnPjOG98b04hcrfZyxQvB3KYoeoEZ9cHLIA8JutROuld /SENZl6NvLds1hkNeAnB0pkEpjlM9CCPZdtCXWdkCtsHiNW+YaxXixbd1GgtOklF/dKs 6Zu0PTjvaebSM9hSIh2198joBj/Xa9KSLwwkGMCyDaaIiKrfAVi5eGjH8QUgop0i7zoX kHwjXxrtFcvDweKEGCU1/mSs7JaIgIEUp9D/8Ni54LRnTUt+z8nNLI2FvUtkJiZA02em Rx9w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=BrkB64L+; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-81413-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81413-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id dn20-20020a17090794d400b00a42edc09d48si2054128ejc.1034.2024.02.26.04.53.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 04:53:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-81413-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=BrkB64L+; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-81413-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81413-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 11FED1F25BDC for ; Mon, 26 Feb 2024 12:53:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CFA7E80021; Mon, 26 Feb 2024 12:53:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="BrkB64L+" Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 505B3604CC; Mon, 26 Feb 2024 12:53:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708952007; cv=none; b=CsYBEFJk4xbzlzHpNqdqlOb2z2kiyNUra+H+t6Av/iWM81SbnViIkagxxxGgYfD2HJUPskLanX6UV/0kd8h/z/mHQJ8VCrx0L70iWEHCwy8G6OREQe4xSkEHBGJfbVRlocD98DgYcIaisjruuwIX3GfkzL2NmCBVWtBq6dxdfeI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708952007; c=relaxed/simple; bh=+9bFTdaZN0sNxaXlHrqrWk5lnAZUUQT7AZ/mmZL7Fvg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Rx7Ke1loZomMfAXInZ6rVxsBC3bxMe/afqPX7UOnBhoR/tru5bqr+iQW03Hu1YagMjYlrf25GoTBT0AZbOS0bXlKf0Uj5Elt0HP+4hDq/20vNrqZ5hZG8YdqoUPV9mFLwSNtL4HdBD2IjP2IPJolbaNS5DyNoqJW16wyr3IkdX4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=BrkB64L+; arc=none smtp.client-ip=209.85.167.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lf1-f49.google.com with SMTP id 2adb3069b0e04-512f54c81d2so1498205e87.2; Mon, 26 Feb 2024 04:53:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708952003; x=1709556803; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=96ZM0BBE+jJXYNw871lXR/5rqt8HxgCfbVdQRkOIEUw=; b=BrkB64L++in9BOacviKlLevM33vrMPefKfGX9ZLGTI7JpauIp9moikwcdpFXnfZ++G uYW+C7xPO5961LiQDGUZ9r8X5nRcqftuX/y/CGUr2aUEuNH44vI4aNxU7tChXINQ6DEs 1EdMyW3BsJE7sHs0oiGISORbl7OpMaeycWKyMxaImMG/Bm53BfVSWjr32V1fADGksasb xf4Il7ulFVKGaeGKBWft1uMxzblOq0z8NVhkzrn+ITkQI/DBSacY4AF1FX8ZCKm7U71X faJpJaCLPcTnMDOnfHxXYvo8KtCCst9GCQv7CrGScZWOity/3Kvc0s8vnpWTfBvysf57 D/pQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708952003; x=1709556803; h=in-reply-to: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=96ZM0BBE+jJXYNw871lXR/5rqt8HxgCfbVdQRkOIEUw=; b=GTqnuOi3QFD9JTF48Uv7VppLYog23BPnNADaoSaT/8lkx1R/o3KZftagiAAiMrbvA+ nZ31FiRiDJeO9m3xy0+RZMf8M8zvEH6FgVrgnQvv1+foVw2M+7r5quCVt9SuDF6fdVQa 9gqSP4VwG8pOY2NXc0Oc0px/aJLdUpEDd6INA1MMjWJaT3+iK8mGJTT2It5SIeHGT+1U bL/R9cBLbI4RJaqyQqvzutwnGhiVXFAOwln5bs1jX6GAwa5NtuWIaIh17FuTyDjt2jgl 0B7fBumCi3eW92T8ZeAfW0zoPNS5h77BfT2vIgh+JQY6nuCG5BfrXcegr7S6Q7fQ05iH yTyQ== X-Forwarded-Encrypted: i=1; AJvYcCUlslbRbvbc8Ad0dtVr0iLfFgQG50CFA3gQwgzeJweXyK/rgYhLiqhUyWMsgv2lkS2Xb0k5Yx32n9AItz/QuYLqQJCtJIgZyM+usyE10gZTzvxmDQAX774SCeupId2aKY8/bGCsoQUusgBGvWJH11NlnxnnoE/C9cWjOfj9+iKGfBhMJMioCU/XbQRku0sux77dquIOqUxjE8/7tKZKqE4+SwLi8XU9sAgy X-Gm-Message-State: AOJu0YyY5ih6JBmOEYWNBACASj0uLHwb+pCaNNkdHHmUoWKspoYyxhUz ccTqikZ6uTym/ADzaOcQTqMCmXjSKHJshrdMrmBNQEHA8YswbkfpGvoWZae2 X-Received: by 2002:a05:6512:224b:b0:512:f7e3:2ca0 with SMTP id i11-20020a056512224b00b00512f7e32ca0mr3369529lfu.61.1708952003264; Mon, 26 Feb 2024 04:53:23 -0800 (PST) Received: from mobilestation ([178.176.56.174]) by smtp.gmail.com with ESMTPSA id e21-20020a196915000000b00512ffb9bae9sm222505lfc.143.2024.02.26.04.53.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 04:53:22 -0800 (PST) Date: Mon, 26 Feb 2024 15:53:20 +0300 From: Serge Semin To: Manivannan Sadhasivam Cc: Jingoo Han , Gustavo Pimentel , Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Marek Vasut , Yoshihiro Shimoda , Kishon Vijay Abraham I , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-arm-msm@vger.kernel.org, mhi@lists.linux.dev, Siddharth Vadapalli Subject: Re: [PATCH v3 2/5] PCI: dwc: Skip finding eDMA channels count if glue drivers have passed them Message-ID: <5gzkxdpx6u3jhw5twbncjhtozgekmlzxrpj3m6is3ijadm2svb@f6ng4owyakup> References: <20240226-dw-hdma-v3-0-cfcb8171fc24@linaro.org> <20240226-dw-hdma-v3-2-cfcb8171fc24@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240226-dw-hdma-v3-2-cfcb8171fc24@linaro.org> On Mon, Feb 26, 2024 at 05:07:27PM +0530, Manivannan Sadhasivam wrote: > In the case of Hyper DMA (HDMA) present in DWC controllers, there is no way > the drivers can auto detect the number of read/write channels as like its > predecessor embedded DMA (eDMA). So the glue drivers making use of HDMA > have to pass the channels count during probe. > > To accommodate that, let's skip finding the channels if the channels count > were already passed by glue drivers. If the channels count passed were > wrong in any form, then the existing sanity check will catch it. > > Suggested-by: Serge Semin > Reviewed-by: Siddharth Vadapalli > Signed-off-by: Manivannan Sadhasivam > --- > drivers/pci/controller/dwc/pcie-designware.c | 16 +++++++++------- > 1 file changed, 9 insertions(+), 7 deletions(-) > > diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c > index 193fcd86cf93..ce273c3c5421 100644 > --- a/drivers/pci/controller/dwc/pcie-designware.c > +++ b/drivers/pci/controller/dwc/pcie-designware.c > @@ -927,13 +927,15 @@ static int dw_pcie_edma_find_channels(struct dw_pcie *pci) > { > u32 val; > > - if (pci->edma.mf == EDMA_MF_EDMA_LEGACY) > - val = dw_pcie_readl_dbi(pci, PCIE_DMA_VIEWPORT_BASE + PCIE_DMA_CTRL); > - else > - val = dw_pcie_readl_dma(pci, PCIE_DMA_CTRL); > - > - pci->edma.ll_wr_cnt = FIELD_GET(PCIE_DMA_NUM_WR_CHAN, val); > - pci->edma.ll_rd_cnt = FIELD_GET(PCIE_DMA_NUM_RD_CHAN, val); > + if (!pci->edma.ll_wr_cnt || !pci->edma.ll_rd_cnt) { Are you sure that the partly initialized case should be considered as a request for the auto-detection? IMO &&-ing here and letting the sanity check to fail further would be more correct since thus the developer would know about improper initialized data. -Serge(y) > + if (pci->edma.mf == EDMA_MF_EDMA_LEGACY) > + val = dw_pcie_readl_dbi(pci, PCIE_DMA_VIEWPORT_BASE + PCIE_DMA_CTRL); > + else > + val = dw_pcie_readl_dma(pci, PCIE_DMA_CTRL); > + > + pci->edma.ll_wr_cnt = FIELD_GET(PCIE_DMA_NUM_WR_CHAN, val); > + pci->edma.ll_rd_cnt = FIELD_GET(PCIE_DMA_NUM_RD_CHAN, val); > + } > > /* Sanity check the channels count if the mapping was incorrect */ > if (!pci->edma.ll_wr_cnt || pci->edma.ll_wr_cnt > EDMA_MAX_WR_CH || > > -- > 2.25.1 >