Received: by 2002:a05:7412:8d09:b0:fa:4c10:6cad with SMTP id bj9csp250252rdb; Mon, 15 Jan 2024 21:19:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IE7SV9jCRygG0gduAVdXL8HaUEC7sREoetI3yTImf1JOrUrznp1ubneJ3LElODDqQ1z9J/T X-Received: by 2002:a50:ec91:0:b0:558:320f:cfc with SMTP id e17-20020a50ec91000000b00558320f0cfcmr3279742edr.59.1705382371726; Mon, 15 Jan 2024 21:19:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705382371; cv=none; d=google.com; s=arc-20160816; b=O9V+s+AjwT6bVuqs7gfISHv20wH4qIwV7eDnwRDOy0AYS3uAN1JkSn2g14Sf2L7IgD 8liCHLbjWcOvNo57vXkREuFEGJO3OYGLanXHoOXbavIJqwnaBy+Z0LeT8OM60ju0SDXA DPUb1EpU84QqdKjRwj4qOgxfYvB1+hgD69aKG63UUEmxxU8YxrOi3Ku4UDCaXBQ2i035 exiBaEzuIYQX9mjhWe+6hc3dJYyhihAcNPtw23nBr8DOCus7lkLCudPTL/XM1b8wA5BD YcKjygtym46tJkZjOIyBZJLZQGtK/DJ1PcrKmQveW76DcJDC3pnZtcSeV5u/aPqeu5ML HcRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=wS3rfmNA7q40qbJVSsHrdKN8favboaYx+n1VS8UcygM=; fh=T5uhC9E4t1Iko2SU8sq1A1iUfDgCg5++7qLBZeieHIM=; b=gepM15wRKmOaokAH6sv+D27z8tLBBSEyGam3i60bYyjgHCW8epsTRc++9FCwq9rsvy uwPelcDZK/cMQn+FOAb/Uy626C5FkZBt3epJuxU1B9uZpKROytd0U5SRDlW2jYavaEFT q8CTvxhtH43jWi/oqPFw1wtTsqS8VSCggVOx5GWOXz36K1xxw2V4WjCS3NWv4LMYevRz vIXDGG5LoLPxn1aP+OkwFDful5nyFZ8k7DU3Ju3xStXqtAuqBZ+VBwaafDKQFOabtWAe 8ZynsBfbfF0G6DGArjTge7Mwp7UYIpGeBwCCKPgQWBcYyC3s8BaxM1+Ia1qTOD/4TORM mqwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=GVRJUJGf; spf=pass (google.com: domain of linux-kernel+bounces-27013-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-27013-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id d9-20020a05640208c900b00543670dada0si4587872edz.217.2024.01.15.21.19.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 21:19:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-27013-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=GVRJUJGf; spf=pass (google.com: domain of linux-kernel+bounces-27013-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-27013-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.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 7B82D1F23B3A for ; Tue, 16 Jan 2024 05:19:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4D2A2D537; Tue, 16 Jan 2024 05:19:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="GVRJUJGf" Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (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 31C3F79FD; Tue, 16 Jan 2024 05:19:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 40G5GNfO032765; Tue, 16 Jan 2024 05:19:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= message-id:date:mime-version:subject:to:cc:references:from :in-reply-to:content-type:content-transfer-encoding; s= qcppdkim1; bh=wS3rfmNA7q40qbJVSsHrdKN8favboaYx+n1VS8UcygM=; b=GV RJUJGfj2QCm/Wh3LUD3G23dRpQ5jofe0iM2Q+JmSjf+IOu2zapkSiWHDVlXdrhkD aMTquF2Eur2rLSD9f6yyNjn+hQMvy9cq9CfzDiPx1ZdWRD+70Y/IYj35wJtAnJss lmjAY+kKsCtObNJFmiLHVHlGH/khW5qLxECfA1h/k1QkrxF3PMCn985qNGf9g/b4 ZLlzjd5i5qqSMiGS1KrQgt4l/NvNm2H4S+TXcOPjjCSNTm/hETZVB3ujC3xCP0gA eej5vlAWOU+xS4hQ//hXBUGnRPc812kr84Tgil9c5trNLWle0lk0YZZ6H9MEAKyw iakdL0usBaYxZBlNutMQ== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3vn2bjhx18-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 16 Jan 2024 05:19:01 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 40G5J0WO011402 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 16 Jan 2024 05:19:00 GMT Received: from [10.216.3.129] (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Mon, 15 Jan 2024 21:18:54 -0800 Message-ID: <160e3c95-314a-712a-36c6-a7eddf175c5c@quicinc.com> Date: Tue, 16 Jan 2024 10:48:50 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.13.1 Subject: Re: [PATCH v6 6/6] PCI: qcom: Add OPP support to scale performance state of power domain Content-Language: en-US To: Konrad Dybcio , 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: , , , , , , , References: <20240112-opp_support-v6-0-77bbf7d0cc37@quicinc.com> <20240112-opp_support-v6-6-77bbf7d0cc37@quicinc.com> From: Krishna Chaitanya Chundru In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: Ha8uzJEyL26jlBuhrXPrnz32uMtv8sYI X-Proofpoint-ORIG-GUID: Ha8uzJEyL26jlBuhrXPrnz32uMtv8sYI X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-09_01,2023-12-07_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 priorityscore=1501 mlxscore=0 phishscore=0 spamscore=0 malwarescore=0 mlxlogscore=999 adultscore=0 lowpriorityscore=0 bulkscore=0 suspectscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2311290000 definitions=main-2401160038 On 1/13/2024 4:14 AM, Konrad Dybcio wrote: > 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 > If OPP path is not present we are still voting through ICC, so it is better to have name as it. >> { >> 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 ACK. - Krishna Chaitanya.