Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp114740rdb; Thu, 1 Feb 2024 03:59:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IFKJgyFlsbBBxzBEFoRWaFuY25X8EdkypO6VWy3jGgGtWcG3zfLyRP/ffVg9xD4FZSjj4La X-Received: by 2002:a17:902:e789:b0:1d9:4105:a9cb with SMTP id cp9-20020a170902e78900b001d94105a9cbmr3346087plb.9.1706788780140; Thu, 01 Feb 2024 03:59:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706788780; cv=pass; d=google.com; s=arc-20160816; b=ul5ioZUQzZsJrvbiXqU5sUgbHU92cvrXyswCAZjVcTBPXNqns+5b+8oxIKJAmo9clf OMKfMDHnkDZKuiSVVWnSZHmEeWiHEHTBj9cEp/d9dDvWlC6wd0ClWN10hMabnQqc9LQL NJ3jNX6pBcVV7FiDSp4QSW+Jn5aPngpxHc21+pfjxlT0n2fh5tFEcrA6rPx7Tp6r8xWg GQCdZUAk5tKQcg8MpuSM86b8RBfQ6ijon0WmEAxYwe2C6+yiwJa3O3xop88qXYflVNg8 wkiyMtSacgy7fHYVamm/ui1jGObq2BmG6YGxvtu9IT1qHUhb7j0A9d0GJfK+8P3ha1GC 04uA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=uKEpVLIoUGjy+WrPCxIEJ9ucHcFp2SdWWm/C9ZhEGXw=; fh=9/gNKs9ISFSNBs9t42CvIMSN2PVap1hEzLUyO6SsmgU=; b=jFXX2dtzfcq/IZkuOvSjWXpRfT1lKSjZaNKi49XmoNOZf4O43xcIZIYgQfTnXnwJuv mhHY39kkog66qc+U72bwgU8mLMHQRkWgDu4hjRNCJn13lv5xWX+V9l7bfsM9u5N3TEYe h050YtsQGM4lu3RWGgpfVOCcUr9kDq7/lD9aYkDfmI4aAlvkgyxXIUsQ+q15cIErN6nB MayUt6YhV88EtqRX9ZkRyIS1Hnj3V/qYMaGjvOs7uqfyp0HHNIlgqFsdVBrhtq2zu3Os 3gQVH09Z5dbRtC13E0xPaWh709oqGJvP65icaL1+/fE1i7pWjniGh+gPlO482bLZZNzZ VIIw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=P+uMA5M4; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-48054-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48054-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=1; AJvYcCXqhDNH4ai0VghVtP67tdLPlAU7vJiwOGMjdOfVHDbX1IFSNn1T81dz9jqSYH9rDK25f4o3q+pCq06JRcYmWBJ28wbF6KRj+MNmhno/jg== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id l3-20020a170902f68300b001d5f009098bsi12399413plg.408.2024.02.01.03.59.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 03:59:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-48054-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=P+uMA5M4; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-48054-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48054-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id E6CB3280E65 for ; Thu, 1 Feb 2024 11:59:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D054115D5B2; Thu, 1 Feb 2024 11:59:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="P+uMA5M4" Received: from mail-yw1-f182.google.com (mail-yw1-f182.google.com [209.85.128.182]) (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 EC1B615B961 for ; Thu, 1 Feb 2024 11:59:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706788752; cv=none; b=pUpR2Mgzq4iOl1VCa5K9YoAJXMY3uaqdsZ7FwJ+AR1znPk9QKn7U0DQN+5wMVeWu473w1/pLAEBtS8gJpd2m3bsPzx7B7F0ozvNsl8E2oEj/3QLiyGln0rCQdX3BP8VlpaNWeOAiI/NdzrIrZu8mhG2uQ1HGwpw2EL4r3XDXkv0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706788752; c=relaxed/simple; bh=OZsGrszBeKUHNZmz0F4X8KtWFi79ZQpewOFt5i7n+i0=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=slygWc7Sn3R+kEK340bVojPz+MDsrWY+AKHQ7DoiEfTdGmiqUTFBVDseqg55zPSL6EO/98DtdAwGSRSSfndU8xqSOzcNtpH/laHz+iCOil66BjIs+XXYYy/VpyG5zSz3X8hf0m1a9ihjDDee26BSGfprbVVeMA752RQu5FNCSRk= 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.182 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 Received: by mail-yw1-f182.google.com with SMTP id 00721157ae682-60412866c36so8580367b3.2 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=DYqkynFWCw2r5atu+d8zsbt+waHUbfniT0PSOeaNQbLT40MaLDykvRrUuerfW4yHaQ W8L6w8+mlbS+VM+isu+0/Qc00v0FVqcqJOjIVsixFKyMkktsBxWz/0RStOyhll950k0P tZE9yY4o1+iel2cQVDgxVikWYqfhjNSnR4BbqGHL6tU335TNYq2MYMOQPqLEwaS98qWj MNA+nxcUjOFDfshca/IDK7uhSx12Ato3wXx3M/fzui0bxPVjjobWZEpGx109FRewnDYk GBy6GTZj39RQOl0VoVGeEIURJqChWJQ6/KYrL96YwWlXrSkJ7moVMU+TdKki8tCmpGP0 Qdxw== X-Gm-Message-State: AOJu0Yw8pqvRnZf/lerM8nWX+4E+0s3FHykZfXFPo/tvDih5RTu/dcsI s2UDIrTCo0SQRpyvPkyhi2DWB/Nxv0uXsAjmeRDWpBcuQncEPzf3KNQOSuT1YpA81YMMcqEdhUA 7Pz728gDq8hwLfTqbzkZCkggzC1/5epCPL8t2Ng== 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-kernel@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