Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp2587891rdd; Fri, 12 Jan 2024 14:45:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IHIDlaUnVz5qkqsN5u0bQmDHe3lmLNiwK4jjsNo+gayvsZz6kmwEPxafkqcK800kr8qqI+Y X-Received: by 2002:a17:907:c789:b0:a2c:d76d:5cb0 with SMTP id tz9-20020a170907c78900b00a2cd76d5cb0mr815533ejc.94.1705099517761; Fri, 12 Jan 2024 14:45:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705099517; cv=none; d=google.com; s=arc-20160816; b=KyC7qdUVKB0D6P9cmlIoF4GNrYM7HAcq1GbO5gKXuSUT4EWO7Dy/ToNND0QHgEa8VY lXTdM4+J48OFwYEnMrEC6RrH0VyUNXIaZV8vN0AYHdHpVKZrA1xhkLTMa0bScDhQhfbs wobtlK0yMQADYZ+Yg4gIGPbdPGR8RSCL6S+ZnW/PCsQhiW4W3iTg5eeCKkDTpQk/ufpN fLnlTUvr4Vdqcu9MQyxzJITl9ByjMIffmvzsWwfJ5J0vrM+PEeXfgo9kaWQQe4NXzVWe jI/Xrm4h5bNkTluAXwP77kGs3bL4NNLx06EkbKNaMf151nDUeUdGZ+5X3KgvchQbJL7V MIpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=5+Yt8N0vLR3BWDealxvKrDyIpQpUSEu3d8Yxm5uh+ww=; fh=fFQnWqi3ZTwjeq9YGM+83a5F9Xz9lOdik4depRuZ4Ro=; b=zUaB5Jz1EYvteD/7euJrBl1v/Zp3KDkPiPWXu3dYQXuTRW7RTX5yJjIkiE32ganihB oQ3DyZXvG9CqmKIhwFlgxwV1Mv878vVHQnDhVwY/MRU1bD8XKaaTRRQbscJS9W/uG24m jEeczUozbGVogBgoSLpuQthmMoFpKRfctK6v4dItB/q+Uw5cBwoXfnVgyFiw977vr964 NzGzExgY/I7IjWRl/sz5CmBDMIPYQCJgb9Nh9/rZCJNO+2ucRg+NIu3RI+Ql94mcJsM0 tQbbdbzoQjKpNgQw93ZxtA7CR+/aJl6uENycEnlzraXj9+M9Es2c5QzRFVISQmvRMicK qiNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xNh8lrph; spf=pass (google.com: domain of linux-kernel+bounces-25082-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-25082-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id ec8-20020a170906b6c800b00a2ccdd900edsi722633ejb.179.2024.01.12.14.45.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jan 2024 14:45:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-25082-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=@linaro.org header.s=google header.b=xNh8lrph; spf=pass (google.com: domain of linux-kernel+bounces-25082-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-25082-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 50FF71F238F6 for ; Fri, 12 Jan 2024 22:45:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6B209182BF; Fri, 12 Jan 2024 22:45:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="xNh8lrph" Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com [209.85.218.44]) (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 B7FC4182A1 for ; Fri, 12 Jan 2024 22:45:02 +0000 (UTC) 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-ej1-f44.google.com with SMTP id a640c23a62f3a-a2cea0563cbso124507666b.3 for ; Fri, 12 Jan 2024 14:45:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1705099501; x=1705704301; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=5+Yt8N0vLR3BWDealxvKrDyIpQpUSEu3d8Yxm5uh+ww=; b=xNh8lrphPW0XrDkvXtAPJERPaVFQYLkERJf6FZMkQD3LZ6XrF5+mXQOCKSpbZzkGVg +sl3/i8kSqOz15Qfk3TStsvYzaxEuwufcwxPcoJ+cnmilb7dNkrq/SEaWe0KEjvRgD5q OGKouoDt2IV2MFaZnAHeEmdLJyt9mRW06n8fTj/Hg1HsMUfKFyuy4EL+O0s9F24SbRYy g6TCfzeC5k+fJyGkgKQbsUb3ba2D7r75NQXQmvJMtZ6KOQeuoJfY9NjgwMuzePBsAm/j IHOcYYdLhovU7TN3YWdkEVm1kk7PlqmCiWWyROqdE0r0wh6M8OvGYC37xnLpV3xPiDb8 76Ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705099501; x=1705704301; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=5+Yt8N0vLR3BWDealxvKrDyIpQpUSEu3d8Yxm5uh+ww=; b=uYZZ+GPgEdWRLo8ZNWgrNLULvSAEftqTFGSFSjebh55iu7QXGcoIRke86L4Yqi8IJS 7ArtCI4KQSjTYrvl52jDUoe/baMnofUzj3QxxWcYQfmymxD8MBriJju1PMt6ZMnPt317 uda0+5Wq58RVQQ+24WV5yKTEDICiotRTZLP4je7A2syWflnVrtRpwTL110rL/uHAk+Cv 0eOfTOqaQ4qYm4H814Nuux/WvfldOvGUgjx5uClNa06n2nP23Y1iD0psRUlTJ1HYdVBG GdKdZkzStmbsP32PxMe9ruF7fwlRCtyJZVfBoRE3BAyvAAHuK+Y+dZnpAUeY+7Y3gERs 7rNg== X-Gm-Message-State: AOJu0YzZCLAWAz5fbyIt+2VUC1VkYYJSCndvP1ANlDhWaHoTAAukmCLq huQ0JKIj1n3oyz5Zv0HepPb6FQ+LOssKtg== X-Received: by 2002:a17:907:c70c:b0:a28:a8cb:3185 with SMTP id ty12-20020a170907c70c00b00a28a8cb3185mr1180597ejc.69.1705099500991; Fri, 12 Jan 2024 14:45:00 -0800 (PST) Received: from [192.168.174.25] (178235179017.dynamic-4-waw-k-1-3-0.vectranet.pl. [178.235.179.17]) by smtp.gmail.com with ESMTPSA id u3-20020a1709064ac300b00a269b4692a9sm2223723ejt.84.2024.01.12.14.44.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 12 Jan 2024 14:45:00 -0800 (PST) Message-ID: Date: Fri, 12 Jan 2024 23:44:57 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v6 6/6] PCI: qcom: Add OPP support to scale performance state of power domain Content-Language: en-US To: Krishna chaitanya chundru , Bjorn Andersson , Bjorn Helgaas , Lorenzo Pieralisi , =?UTF-8?Q?Krzysztof_Wilczy=C5=84ski?= , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Manivannan Sadhasivam , Rob Herring , Johan Hovold , Brian Masney , Georgi Djakov Cc: 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 References: <20240112-opp_support-v6-0-77bbf7d0cc37@quicinc.com> <20240112-opp_support-v6-6-77bbf7d0cc37@quicinc.com> From: Konrad Dybcio Autocrypt: addr=konrad.dybcio@linaro.org; keydata= xsFNBF9ALYUBEADWAhxdTBWrwAgDQQzc1O/bJ5O7b6cXYxwbBd9xKP7MICh5YA0DcCjJSOum BB/OmIWU6X+LZW6P88ZmHe+KeyABLMP5s1tJNK1j4ntT7mECcWZDzafPWF4F6m4WJOG27kTJ HGWdmtO+RvadOVi6CoUDqALsmfS3MUG5Pj2Ne9+0jRg4hEnB92AyF9rW2G3qisFcwPgvatt7 TXD5E38mLyOPOUyXNj9XpDbt1hNwKQfiidmPh5e7VNAWRnW1iCMMoKqzM1Anzq7e5Afyeifz zRcQPLaqrPjnKqZGL2BKQSZDh6NkI5ZLRhhHQf61fkWcUpTp1oDC6jWVfT7hwRVIQLrrNj9G MpPzrlN4YuAqKeIer1FMt8cq64ifgTzxHzXsMcUdclzq2LTk2RXaPl6Jg/IXWqUClJHbamSk t1bfif3SnmhA6TiNvEpDKPiT3IDs42THU6ygslrBxyROQPWLI9IL1y8S6RtEh8H+NZQWZNzm UQ3imZirlPjxZtvz1BtnnBWS06e7x/UEAguj7VHCuymVgpl2Za17d1jj81YN5Rp5L9GXxkV1 aUEwON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cg5dfFgFAmQ5bvICGwwACgkQR4cBcg5dfFju1Q//Xta1ShwL0MLSC1KL1lXGXeRM 8arzfyiB5wJ9tb9U/nZvhhdfilEDLe0jKJY0RJErbdRHsalwQCrtq/1ewQpMpsRxXzAjgfRN jc4tgxRWmI+aVTzSRpywNahzZBT695hMz81cVZJoZzaV0KaMTlSnBkrviPz1nIGHYCHJxF9r cIu0GSIyUjZ/7xslxdvjpLth16H27JCWDzDqIQMtg61063gNyEyWgt1qRSaK14JIH/DoYRfn jfFQSC8bffFjat7BQGFz4ZpRavkMUFuDirn5Tf28oc5ebe2cIHp4/kajTx/7JOxWZ80U70mA cBgEeYSrYYnX+UJsSxpzLc/0sT1eRJDEhI4XIQM4ClIzpsCIN5HnVF76UQXh3a9zpwh3dk8i bhN/URmCOTH+LHNJYN/MxY8wuukq877DWB7k86pBs5IDLAXmW8v3gIDWyIcgYqb2v8QO2Mqx YMqL7UZxVLul4/JbllsQB8F/fNI8AfttmAQL9cwo6C8yDTXKdho920W4WUR9k8NT/OBqWSyk bGqMHex48FVZhexNPYOd58EY9/7mL5u0sJmo+jTeb4JBgIbFPJCFyng4HwbniWgQJZ1WqaUC nas9J77uICis2WH7N8Bs9jy0wQYezNzqS+FxoNXmDQg2jetX8en4bO2Di7Pmx0jXA4TOb9TM izWDgYvmBE8= In-Reply-To: <20240112-opp_support-v6-6-77bbf7d0cc37@quicinc.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 12.01.2024 15:22, 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 > --- [...] > > -static void qcom_pcie_icc_update(struct qcom_pcie *pcie) > +static void qcom_pcie_icc_opp_update(struct qcom_pcie *pcie) Or simply.. qcom_pcie_opp_update :) Especially with Dmitry's suggestions > { > struct dw_pcie *pci = pcie->pci; > - u32 offset, status; > + u32 offset, status, freq; > + struct dev_pm_opp *opp; > int speed, width; > int ret; > > - if (!pcie->icc_mem) > - return; > - > offset = dw_pcie_find_capability(pci, PCI_CAP_ID_EXP); > status = readw(pci->dbi_base + offset + PCI_EXP_LNKSTA); > > @@ -1424,11 +1424,42 @@ static void qcom_pcie_icc_update(struct qcom_pcie *pcie) > speed = FIELD_GET(PCI_EXP_LNKSTA_CLS, status); > width = FIELD_GET(PCI_EXP_LNKSTA_NLW, status); > > - ret = icc_set_bw(pcie->icc_mem, 0, width * QCOM_PCIE_LINK_SPEED_TO_BW(speed)); > - if (ret) { > - dev_err(pci->dev, "failed to set interconnect bandwidth: %d\n", > - ret); > + if (pcie->opp_supported) { > + switch (speed) { > + case 1: > + freq = 2500000; > + break; > + case 2: > + freq = 5000000; > + break; > + case 3: > + freq = 8000000; > + break; > + default: > + WARN_ON_ONCE(1); > + fallthrough; > + case 4: > + freq = 16000000; > + break; > + } Might as well add gen5 and 6 rates of 3200.. and 6400.. since they're hard-in-stone in the spec by now, AFAIK Konrad