Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp2417029rdd; Fri, 12 Jan 2024 08:47:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IE1k978cLSB75LCkwbOCUscmI79r64EAKBtX3/y4awpJp2fi5HpF34AxN/LoaGWzVUCyDMm X-Received: by 2002:a05:6a00:a8d:b0:6d9:b293:115c with SMTP id b13-20020a056a000a8d00b006d9b293115cmr1167149pfl.11.1705078050366; Fri, 12 Jan 2024 08:47:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705078050; cv=none; d=google.com; s=arc-20160816; b=CV8/QmbwwcwgeoVZ1f4U/86dcmhfRcVhCr4TRXZlsGXo76KEY2f7uiM46x1i3AnkJw rCBQao3ZVUBgCaA07PPWkdpL/rvCP4teCY7N3+tPySI4r/UynrVZnCukWYhcU9qk1SQp 5nEtdaMifYFbE2EYDk7uQ8kmSArw8WMIFQ6cTFzK259CUv1Dj6s+QvDNx6ja8PsrjiCW JIUiNtxGOcDWd5p3rQGwjrZPHAF3VDfl1FOvN0XNqppBOHNDP4TpQOjSlYd+ZKXZbyXo 5Tgi8ViAxH/eQ3iK/zy4w1rGP/zQ3cyQG8D9N4d1EkbE00dVxeo1fZyV3rIxZi2mB9f6 8Ucg== ARC-Message-Signature: i=1; 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:message-id:subject:cc:to:from :date:dkim-signature; bh=vuUii7WesTsWZTuwxiV4FrTqt044Iez+4d1asS8A6Kg=; fh=KB+bdWgROKrBp2tD/MsH1UL8puYvkIfNGUWzihWYzws=; b=jqCwdv92xiwg1+dtuXXKridXCHCQt36WDw6jNg2OTMHUjR1423emPH6gdARKAvJmC8 2Q3tBjyUrb/AmdjiqkYlXxNnQ62sRifHCnWiHLmVU38X/vn7LzXfdXozcqNY34wRzBae x7rb3OwvU2ABvXZne8ElRs9qmueKTO69V3XCn83VatWTD/cl7+M3ZkJuX3IBBwwY0S3O QM0v5Zavxpx3p7BpUK3O5eKLYfCO8vxUtqYJygpZC6j5YJiafvD7lyXo8ngLr9NHF3gQ pL3adfP+VMVwN+dLHx2V+JT9kAwqaROVOH2pdW6N8cdj3H10eTNZlRYzeWuoi70t0P/H oTrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KITWq1LX; spf=pass (google.com: domain of linux-kernel+bounces-24869-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-24869-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id t4-20020a056a00138400b006daa81ef27esi3689458pfg.240.2024.01.12.08.47.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jan 2024 08:47:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-24869-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KITWq1LX; spf=pass (google.com: domain of linux-kernel+bounces-24869-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-24869-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 81DBBB23427 for ; Fri, 12 Jan 2024 16:47:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BC95D77645; Fri, 12 Jan 2024 16:47:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="KITWq1LX" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D74AF6DD08; Fri, 12 Jan 2024 16:47:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5E740C433C7; Fri, 12 Jan 2024 16:47:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705078034; bh=XLbIi+FzvkY5/phGa7UWlshotiTTgXJvXXEBTRX287o=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=KITWq1LXFy2rWhdf5KnEM7ohv/qcZ55BbfDOZBpd8DML1T75Q9kxR6YdsoyoN7cKw n/A67rKfrGZmJXi7sdecwb9zAmbeTEckeP/sRFs9/nNL44Y5nBu6c7FHDz0xD/2K7J v7+jqnXqmL21ttSZcbwROoZ11hoK9+s1lcHXTIeAzzGWNLiXB2e0OPJtwMB7awUFdE 491D6uhQF7JgEDokUBbrPI9BhPl5v59BhzdXMt58jWccx2qdowY7NAlbCxxHeZjb43 CSaVCyHK0vDEzDaPlyojrZ3bjNWvU2bWcdtK4Q+5inRKXt4HnhWR+Am7bNCxYORePR Dl6g86OSZWdSg== Date: Fri, 12 Jan 2024 10:47:12 -0600 From: Bjorn Helgaas To: Krishna chaitanya chundru Cc: Bjorn Andersson , Konrad Dybcio , Bjorn Helgaas , Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Manivannan Sadhasivam , Rob Herring , Johan Hovold , Brian Masney , Georgi Djakov , linux-arm-msm@vger.kernel.org, vireshk@kernel.org, quic_vbadigan@quicinc.com, quic_skananth@quicinc.com, quic_nitegupt@quicinc.com, linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH v6 3/6] PCI: qcom: Add missing icc bandwidth vote for cpu to PCIe path Message-ID: <20240112164712.GA2271535@bhelgaas> 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: <20240112-opp_support-v6-3-77bbf7d0cc37@quicinc.com> Capitalize "ICC" and "CPU" to make the subject easier to read. "Missing" might be superfluous in the subject? It would be nice to have the ICC expansion once in the commit log as a hook for newbies like me :) On Fri, Jan 12, 2024 at 07:52:02PM +0530, Krishna chaitanya chundru wrote: > CPU-PCIe path consits for registers PCIe BAR space, config space. > As there is less access on this path compared to pcie to mem path > add minimum vote i.e GEN1x1 bandwidth always. "GEN1x1" is unnecessarily ambiguous, and the spec recommends avoiding it (PCIe r6.0, sec 1.2). Use the actual bandwidth numbers instead. "PCIe" to match above. Also below in comments and messages. > In suspend remove the cpu vote after register space access is done. "CPU" to match above. > Fixes: c4860af88d0c ("PCI: qcom: Add basic interconnect support") > cc: stable@vger.kernel.org > Signed-off-by: Krishna chaitanya chundru > --- > drivers/pci/controller/dwc/pcie-qcom.c | 31 +++++++++++++++++++++++++++++-- > 1 file changed, 29 insertions(+), 2 deletions(-) > > diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c > index 11c80555d975..035953f0b6d8 100644 > --- a/drivers/pci/controller/dwc/pcie-qcom.c > +++ b/drivers/pci/controller/dwc/pcie-qcom.c > @@ -240,6 +240,7 @@ struct qcom_pcie { > struct phy *phy; > struct gpio_desc *reset; > struct icc_path *icc_mem; > + struct icc_path *icc_cpu; > const struct qcom_pcie_cfg *cfg; > struct dentry *debugfs; > bool suspended; > @@ -1372,6 +1373,9 @@ static int qcom_pcie_icc_init(struct qcom_pcie *pcie) > if (IS_ERR(pcie->icc_mem)) > return PTR_ERR(pcie->icc_mem); > > + pcie->icc_cpu = devm_of_icc_get(pci->dev, "cpu-pcie"); > + if (IS_ERR(pcie->icc_cpu)) > + return PTR_ERR(pcie->icc_cpu); > /* > * Some Qualcomm platforms require interconnect bandwidth constraints > * to be set before enabling interconnect clocks. > @@ -1381,7 +1385,18 @@ static int qcom_pcie_icc_init(struct qcom_pcie *pcie) > */ > ret = icc_set_bw(pcie->icc_mem, 0, QCOM_PCIE_LINK_SPEED_TO_BW(1)); > if (ret) { > - dev_err(pci->dev, "failed to set interconnect bandwidth: %d\n", > + dev_err(pci->dev, "failed to set interconnect bandwidth for pcie-mem: %d\n", > + ret); > + return ret; > + } > + > + /* > + * The config space, BAR space and registers goes through cpu-pcie path. > + * Set peak bandwidth to single-lane Gen1 for this path all the time. Numbers instead of "Gen1". > + */ > + ret = icc_set_bw(pcie->icc_cpu, 0, QCOM_PCIE_LINK_SPEED_TO_BW(1)); > + if (ret) { > + dev_err(pci->dev, "failed to set interconnect bandwidth for cpu-pcie: %d\n", > ret); > return ret; > } > @@ -1573,7 +1588,7 @@ static int qcom_pcie_suspend_noirq(struct device *dev) > */ > ret = icc_set_bw(pcie->icc_mem, 0, kBps_to_icc(1)); > if (ret) { > - dev_err(dev, "Failed to set interconnect bandwidth: %d\n", ret); > + dev_err(dev, "Failed to set interconnect bandwidth for pcie-mem: %d\n", ret); > return ret; > } > > @@ -1597,6 +1612,12 @@ static int qcom_pcie_suspend_noirq(struct device *dev) > pcie->suspended = true; > } > > + /* Remove cpu path vote after all the register access is done */ > + ret = icc_set_bw(pcie->icc_cpu, 0, 0); > + if (ret) { > + dev_err(dev, "failed to set interconnect bandwidth for cpu-pcie: %d\n", ret); > + return ret; > + } > return 0; > } > > @@ -1605,6 +1626,12 @@ static int qcom_pcie_resume_noirq(struct device *dev) > struct qcom_pcie *pcie = dev_get_drvdata(dev); > int ret; > > + ret = icc_set_bw(pcie->icc_cpu, 0, QCOM_PCIE_LINK_SPEED_TO_BW(1)); > + if (ret) { > + dev_err(dev, "failed to set interconnect bandwidth for cpu-pcie: %d\n", ret); > + return ret; > + } > + > if (pcie->suspended) { > ret = qcom_pcie_host_init(&pcie->pci->pp); > if (ret) > > -- > 2.42.0 >