Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp17253158rwd; Mon, 26 Jun 2023 23:51:56 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7XzOOkDU/XM5AsxJm/8VO7sRb0rW4JF2q/jlt/tMXtw2NaNl+Z96uyHbZySnTVLup0eHNW X-Received: by 2002:a17:902:e883:b0:1b5:5fd2:4d6e with SMTP id w3-20020a170902e88300b001b55fd24d6emr11092776plg.58.1687848716587; Mon, 26 Jun 2023 23:51:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687848716; cv=none; d=google.com; s=arc-20160816; b=mrXs0Yr+HegXbM72R6mfZex58jqOJAmOXz1HDB+3bEpy3mOhSGB4WN9w2vs0qlhXkB D4KbgOVvOajL263U5N20wIjTQYbJXY8sSQG6iC+9vIPy9LCNlqR7oLOtuC3Brq5KRZ7V m9/tBfYVC8+wrfNlaq50FVQ8cm2Wy/MSTQVcoUZgprQXbq+BM5IXr876NApyPchlvX6h uspahLVxKOEZOd+sW6v79qnqNpnjnaNJ1q1TCb/uKVY5nEiMT3/gxFco1BKtlMLZl0b9 R2YJFzGdKLzK0AAzQ/n8UArh6BV5hNUQEpV8ac6Oy18AjBUNzVr1lQT68yx8aYeaEXSx 45Jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=a9/8jloY1SITJxs8vJeZOe0WCZbr/Y8PpK7/up/ZC74=; fh=Mp8bSTX5vKZtuwZYw6IrM/ypubEjsPuXglSIXQLDV8g=; b=p/NWecm+Hu1Fig+pCHfFe1UHTSVJm7quYzpDOnJ8ZNxGoWBMGv3UTBqe9Na5WS1wuH BTwy9hKGkfxCFMiewtYCpgcWy1vhPspYd62NUh11qVHIYNDe3YbLzppEhuDqhwn0wqzH CnDQoGuAH9o4U2TttDSUWYNyG+wy6QuPA9rTrz+nvbsy3W5hMz9Gm/IWOEoCu04o6YOT z90rrlY9u3YP88h7M24qJftIyqpC/48oz15u9safeXiPSnbF2b3R6gTvBbcic9P/buv6 BGBrPA6YUP3uvdkPLoBzJXiPYJDvULItCh9eyMHGOs6P1aXJcRlQN4I1ogykdCpfy9pw WWeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=c0npUSlv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j22-20020a170902759600b001b551fb08f2si6257774pll.168.2023.06.26.23.51.44; Mon, 26 Jun 2023 23:51:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=c0npUSlv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230353AbjF0Gf4 (ORCPT + 99 others); Tue, 27 Jun 2023 02:35:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230376AbjF0Gfs (ORCPT ); Tue, 27 Jun 2023 02:35:48 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 201282120; Mon, 26 Jun 2023 23:35:43 -0700 (PDT) Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35R5fb1k022888; Tue, 27 Jun 2023 06:35:37 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=qcppdkim1; bh=a9/8jloY1SITJxs8vJeZOe0WCZbr/Y8PpK7/up/ZC74=; b=c0npUSlv2xavLM0a4TZJL7gGWVohOPl/xBrr2nfgTtG30zplWub8EiTuJtMIGz5uKC4O EVfu2gwGIqYUluz+a5OuM1KopcXu9NzTos1oKPOs6cfXyzGtxGKNxF3AwQjz8fG/H0Cp 2tLHxsTOYtJ/gNLljzrEfYYZxHwYLTioKFnuVBENAvVMHUnbY5D/m3FU1A8C64nJIZXV Uk/ehdYkEAMmhuTZKRw8IMhz/JC926Q9wytG75TMb9ZHgMSuo3EPgmfr1Fg32HzET8KX v6yp3hvEpBxfIBZGjSX5UJyGyc2THqHJdmL/gm5ZNUSleionduNDrVW1qRX0pZJJt5eb ZA== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3rf8gtj85q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Jun 2023 06:35:37 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 35R6ZWRD019463 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Jun 2023 06:35:32 GMT Received: from hu-pkondeti-hyd.qualcomm.com (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.986.42; Mon, 26 Jun 2023 23:35:26 -0700 Date: Tue, 27 Jun 2023 12:05:23 +0530 From: Pavan Kondeti To: Krishna chaitanya chundru CC: , , , , , , , , , , "Manivannan Sadhasivam" , Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas Subject: Re: [PATCH v5 3/3] PCI: qcom-ep: Add ICC bandwidth voting support Message-ID: References: <1687827692-6181-1-git-send-email-quic_krichai@quicinc.com> <1687827692-6181-4-git-send-email-quic_krichai@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <1687827692-6181-4-git-send-email-quic_krichai@quicinc.com> X-Originating-IP: [10.80.80.8] 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: R_B6GZJGrAR1eXskLMG0eWxB7lgNjBAJ X-Proofpoint-ORIG-GUID: R_B6GZJGrAR1eXskLMG0eWxB7lgNjBAJ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-06-27_03,2023-06-26_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 lowpriorityscore=0 priorityscore=1501 impostorscore=0 adultscore=0 malwarescore=0 spamscore=0 phishscore=0 mlxscore=0 clxscore=1011 mlxlogscore=753 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306270061 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 27, 2023 at 06:31:31AM +0530, Krishna chaitanya chundru wrote: > +static void qcom_pcie_ep_icc_update(struct qcom_pcie_ep *pcie_ep) > +{ > + struct dw_pcie *pci = &pcie_ep->pci; > + u32 offset, status, bw; > + int speed, width; > + int ret; > + > + if (!pcie_ep->icc_mem) > + return; > + Is this check needed? interconnect is added as required property and probe is failed if interconnect get fails. qcom_pcie_enable_resources() which gets called before enabling this interrupt is assuming that interconnect available. > + offset = dw_pcie_find_capability(pci, PCI_CAP_ID_EXP); > + status = readw(pci->dbi_base + offset + PCI_EXP_LNKSTA); > + > + speed = FIELD_GET(PCI_EXP_LNKSTA_CLS, status); > + width = FIELD_GET(PCI_EXP_LNKSTA_NLW, status); > + > + switch (speed) { > + case 1: > + bw = MBps_to_icc(PCIE_GEN1_BW_MBPS); > + break; > + case 2: > + bw = MBps_to_icc(PCIE_GEN2_BW_MBPS); > + break; > + case 3: > + bw = MBps_to_icc(PCIE_GEN3_BW_MBPS); > + break; > + default: > + dev_warn(pci->dev, "using default GEN4 bandwidth\n"); > + fallthrough; > + case 4: > + bw = MBps_to_icc(PCIE_GEN4_BW_MBPS); > + break; > + } > + > + ret = icc_set_bw(pcie_ep->icc_mem, 0, width * bw); > + if (ret) { > + dev_err(pci->dev, "failed to set interconnect bandwidth: %d\n", > + ret); > + } Are you not seeing the below warning from checkpatch? WARNING: braces {} are not necessary for single statement blocks > +} > + > static int qcom_pcie_enable_resources(struct qcom_pcie_ep *pcie_ep) > { > int ret; > + struct dw_pcie *pci = &pcie_ep->pci; > > ret = clk_bulk_prepare_enable(pcie_ep->num_clks, pcie_ep->clks); > if (ret) > @@ -277,6 +331,20 @@ static int qcom_pcie_enable_resources(struct qcom_pcie_ep *pcie_ep) > if (ret) > goto err_phy_exit; > > + /* > + * Some Qualcomm platforms require interconnect bandwidth constraints > + * to be set before enabling interconnect clocks. > + * > + * Set an initial peak bandwidth corresponding to single-lane Gen 1 > + * for the pcie-mem path. > + */ > + ret = icc_set_bw(pcie_ep->icc_mem, 0, MBps_to_icc(PCIE_GEN1_BW_MBPS)); > + if (ret) { > + dev_err(pci->dev, "failed to set interconnect bandwidth: %d\n", > + ret); > + goto err_phy_exit; > + } > + > return 0; Thanks, Pavan