From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-yw1-f172.google.com (mail-yw1-f172.google.com [209.85.128.172]) (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 0483615D5A3 for ; Thu, 1 Feb 2024 11:59:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706788751; cv=none; b=g94gAR3EZ7LqNrdt3MtMW2CZcZQaQclWVPVycdinxrY8SKBrg8kIsdmgUXVk/hvYtxOg238H1qv6OdtQj9JW3Pt+rvwE8F10WclOnIw6Hq9hxrobixpp2Ntulb4lNingRAu8sndcVkJXCuzIhyZzAEa13sRNeCrGYLbhPupcszg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706788751; c=relaxed/simple; bh=OZsGrszBeKUHNZmz0F4X8KtWFi79ZQpewOFt5i7n+i0=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=PxY97tph8pbX60rXesucqf8Tgf5CCAKEirZjfYk0+nJTVyLseWXrjde6t9CeyMMXdSfCpnMc+OOCYGJQqAoShHykZo+skwQ1+6gCkFgrYAWphhYkNmT1CgJrEYcE8FWVRejdI3btYuz3mMe3KNsdgok9TaJxPVwiVkbFcQ6g9bc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=P+uMA5M4; arc=none smtp.client-ip=209.85.128.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="P+uMA5M4" Received: by mail-yw1-f172.google.com with SMTP id 00721157ae682-60406da718aso8842067b3.1 for ; Thu, 01 Feb 2024 03:59:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706788749; x=1707393549; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=uKEpVLIoUGjy+WrPCxIEJ9ucHcFp2SdWWm/C9ZhEGXw=; b=P+uMA5M4o3L2jNoiqwhsOFlWKv3GoAstWZOqlqCaQU9iheeRNY98iEF3Fg6IQfRnmb QFJgbRqLj8JKpIPUzmk3xEbJYAe9m9/38tX8ekNqtmP+j1/EdfkgckwCLhsAk7Bpwmn/ HpFOaTMSFprI3OdmbQHyiCTkGFvPi201Amhwbxa7ihMSTBLAq1toOofAm8jTuoM7Xjtf tWnrF8/S/wP8xrV/rNswadlcr39A01Z+P2pOXXf4LyeExix0FNfLLVhcRKhh2B5Acows 645pL29Cjib3AQsGEoh6eD99G2GyjgmBcDnXQsOpsVz6hkjcmQMZBThDm2K1xeQqxxbV 5HJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706788749; x=1707393549; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=uKEpVLIoUGjy+WrPCxIEJ9ucHcFp2SdWWm/C9ZhEGXw=; b=lRtaRu2lLjHwQuMlP148z3Yw9BaksGmHyKvqtTozpsf/SRIBH9k0MPcS9fMbBvnyuT 7tDptJt9pyXsk9OGz6VuEbQa6qgvm1cVccLewkeoJCxI/tWtBJycTtHXWS4xSwMsQXun o+f1UyeouInzd8pCIAByMsOfWLXHxsqZpf84TGXwhd8ufpTliCme0IsczKfoo9rlBmP1 LzMB5FQt988X4sdNv4Ab8BQGDTva/SVhEMcLvNAuw5z1er4JMe0f1SrPvzmrTH3xBwtq 9ENLI4SKPN8/s3Y4ZS5Dlc1foBRxDw/1skk1luO16f5qBdVKMAvt5jc+8cHgZdWoImd8 suQQ== X-Gm-Message-State: AOJu0YwbzqgTWkkptpxZ8dEooUptTNtYyyJVKoR3HeLc6pf/5tDSUYF5 ycwCtb8BdjrL7KcdsgGnQNQS7MA8CD2UaH2eDm0gR/sJWDyCqaQY7Rbr0p6leKjKPzx3peqPlLh I9E6df5XDL2S1bF0qZ8oPWF2Y3LHFjOdhLXcXlw== X-Google-Smtp-Source: AGHT+IG3BqsBlMIK+5jbWKOuxuJsDpvCPL0V2HadliqqQz05cdkoXtQw9qjR7RA5e7+YCNT2G6NA6p9yeYIqtzHeO/8= X-Received: by 2002:a0d:db8a:0:b0:602:ab27:3752 with SMTP id d132-20020a0ddb8a000000b00602ab273752mr4465559ywe.33.1706788748906; Thu, 01 Feb 2024 03:59:08 -0800 (PST) Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240112-opp_support-v6-0-77bbf7d0cc37@quicinc.com> <20240112-opp_support-v6-6-77bbf7d0cc37@quicinc.com> <20240201115415.GA2934@thinkpad> In-Reply-To: <20240201115415.GA2934@thinkpad> From: Dmitry Baryshkov Date: Thu, 1 Feb 2024 13:58:58 +0200 Message-ID: Subject: Re: [PATCH v6 6/6] PCI: qcom: Add OPP support to scale performance state of power domain To: Manivannan Sadhasivam Cc: Krishna Chaitanya Chundru , Bjorn Andersson , Konrad Dybcio , Bjorn Helgaas , Lorenzo Pieralisi , =?UTF-8?Q?Krzysztof_Wilczy=C5=84ski?= , Rob Herring , Krzysztof Kozlowski , Conor Dooley , 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 Content-Type: text/plain; charset="UTF-8" On Thu, 1 Feb 2024 at 13:54, Manivannan Sadhasivam wrote: > > On Tue, Jan 16, 2024 at 11:55:17AM +0200, Dmitry Baryshkov wrote: > > On Tue, 16 Jan 2024 at 07:17, Krishna Chaitanya Chundru > > wrote: > > > > > > > > > > > > On 1/12/2024 9:03 PM, Dmitry Baryshkov wrote: > > > > On Fri, 12 Jan 2024 at 16:25, Krishna chaitanya chundru > > > > wrote: > > > >> > > > >> QCOM Resource Power Manager-hardened (RPMh) is a hardware block which > > > >> maintains hardware state of a regulator by performing max aggregation of > > > >> the requests made by all of the processors. > > > >> > > > >> PCIe controller can operate on different RPMh performance state of power > > > >> domain based up on the speed of the link. And this performance state varies > > > >> from target to target. > > > >> > > > >> It is manadate to scale the performance state based up on the PCIe speed > > > >> link operates so that SoC can run under optimum power conditions. > > > >> > > > >> Add Operating Performance Points(OPP) support to vote for RPMh state based > > > >> upon GEN speed link is operating. > > > >> > > > >> OPP can handle ICC bw voting also, so move icc bw voting through opp > > > >> framework if opp entries are present. > > > >> > > > >> In PCIe certain gen speeds like GEN1x2 & GEN2X1 or GEN3x2 & GEN4x1 use > > > >> same icc bw and has frequency, so use frequency based search to reduce > > > >> number of entries in the opp table. > > > >> > > > >> Don't initialize icc if opp is supported. > > > >> > > > >> Signed-off-by: Krishna chaitanya chundru > > > >> --- > > > >> drivers/pci/controller/dwc/pcie-qcom.c | 83 ++++++++++++++++++++++++++++------ > > > >> 1 file changed, 70 insertions(+), 13 deletions(-) > > > >> > > > >> diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c > > > >> index 035953f0b6d8..31512dc9d6ff 100644 > > > >> --- a/drivers/pci/controller/dwc/pcie-qcom.c > > > >> +++ b/drivers/pci/controller/dwc/pcie-qcom.c > > [...] > > > > >> static int qcom_pcie_link_transition_count(struct seq_file *s, void *data) > > > >> @@ -1471,8 +1502,10 @@ static void qcom_pcie_init_debugfs(struct qcom_pcie *pcie) > > > >> static int qcom_pcie_probe(struct platform_device *pdev) > > > >> { > > > >> const struct qcom_pcie_cfg *pcie_cfg; > > > >> + unsigned long max_freq = INT_MAX; > > > >> struct device *dev = &pdev->dev; > > > >> struct qcom_pcie *pcie; > > > >> + struct dev_pm_opp *opp; > > > >> struct dw_pcie_rp *pp; > > > >> struct resource *res; > > > >> struct dw_pcie *pci; > > > >> @@ -1539,9 +1572,33 @@ static int qcom_pcie_probe(struct platform_device *pdev) > > > >> goto err_pm_runtime_put; > > > >> } > > > >> > > > >> - ret = qcom_pcie_icc_init(pcie); > > > >> - if (ret) > > > >> + /* OPP table is optional */ > > > >> + ret = devm_pm_opp_of_add_table(dev); > > > >> + if (ret && ret != -ENODEV) { > > > >> + dev_err_probe(dev, ret, "Failed to add OPP table\n"); > > > >> goto err_pm_runtime_put; > > > >> + } > > > > > > > > Can we initialise the table from the driver if it is not found? This > > > > will help us by having the common code later on. > > > > > > > we already icc voting if there is no opp table present in the dts. > > > > Yes. So later we have two different code paths: one for the OPP table > > being present and another one for the absent OPP table. My suggestion > > is to initialise minimal OPP table by hand and then have a common code > > path in qcom_pcie_icc_update(). > > > > Are you suggesting to duplicate DT in the driver? As a fallback for the cases when there is no OPP table in the driver it might make sense. See Otherwise the DT is still somewhat duplicated in the form of calling icc functions directly. -- With best wishes Dmitry