Message ID | 20230924160713.217086-1-manivannan.sadhasivam@linaro.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp899799vqu; Sun, 24 Sep 2023 17:20:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFnTr3QfuJzBkVrTKR8pqaoPp8URtZSxuTW+JX54rjPlL7vBecrhsKaSrVJJzXU780XOIOX X-Received: by 2002:a05:6a20:8f1c:b0:15d:5e1e:181f with SMTP id b28-20020a056a208f1c00b0015d5e1e181fmr4019983pzk.43.1695601228035; Sun, 24 Sep 2023 17:20:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695601228; cv=none; d=google.com; s=arc-20160816; b=WqDlSMh7D3BFNMVOIdcnDgoG1F80n0ZA4oq+YKfh7h2Cc2SfVwO32uDdE+OootX7L0 JuBfxGgpCxVLHWyRoed80DQUFRvCmKHOUso1e9WJWXn/mMAJApJ2GhVu18Wcb4x03isd sgiaaA3iftr6XJEObPqWPGQIZwCMsbyqxKljNTA3nrpc6HFYeZkU2o+63W0k17CUqkIQ lwW7lqUfaNRNMrY8noKa6Xc7lW5shI9aZuCax03J6F/kIFyR7gF0EPQhWe8TEvxt0mzc Kga+qNEZGmxoXSFeCb1kiEidsa7xgBooRM6wFqNLZ2BuVsa6tM4orqfwuZ0l3tfrDm6j HHEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=aeckoQ9VJ6OdE5PMGKcILi8nW1PsNTWbedGCSVfgmYk=; fh=AGN/tYtQjW7mdZ75nxqNDap8wtPE9BlC41CQHrUz6ag=; b=PGn4ckwTOUOEgZMCFul/XKa7bFPi4DS8w4yfH50npO0APww7IFqVq3DyemF3P8935l QLiZL7zSX0Tw8T9n1nsoV/hOFOgs1EitFVPxt5DN5OzaW9T8/XSPQi4vt5h60sjdNW+p nQIvliSblwYj89Mnin3xNU+9WOQTc4sZVWH60STlEivzxgH8L5lEpXvnkiu37COyVsfX X6mZP47LTeB1V3mH7sxFMzEgyEtG3NmrESJ1JsHO/wM6VoqT3vmesy/ywisw2jAfUuOW EDMTT3z9n+Cu2UkINpFrm/MGw+kT/t4uujnU3jzW0Q+OsjY7d1kvLdjDrNpLGvPNrFm5 irgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pM6RtUZ4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id s3-20020a17090330c300b001bc2c086880si8353358plc.306.2023.09.24.17.20.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Sep 2023 17:20:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pM6RtUZ4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 82A5C80E6FF8; Sun, 24 Sep 2023 09:07:48 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229850AbjIXQHf (ORCPT <rfc822;pusanteemu@gmail.com> + 30 others); Sun, 24 Sep 2023 12:07:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229437AbjIXQHd (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sun, 24 Sep 2023 12:07:33 -0400 Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA258F1 for <linux-kernel@vger.kernel.org>; Sun, 24 Sep 2023 09:07:25 -0700 (PDT) Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-99bf3f59905so601273466b.3 for <linux-kernel@vger.kernel.org>; Sun, 24 Sep 2023 09:07:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1695571643; x=1696176443; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=aeckoQ9VJ6OdE5PMGKcILi8nW1PsNTWbedGCSVfgmYk=; b=pM6RtUZ4Xtu65BKrhuaRLnqteAc8odjhJPgScTI6jG3b5rHRIMk1x/ldvs/TAL+q9K XtYxIyFwMhVLLwIMB7bVti5sEacz2JtKOSgIlMzgkU7OWcuJOtiQbpMyGNRpIoENv5rW ScE8zK/sgAmo1/ijQtC4qUvrOHdZExq+JwrX/xIVBE0bV22hALrP7zc+VvTwFgANDaBA S+MTaWHUBZ2Mo6bwEqdVytt6PRfnhOsPmOH0jnTH7/LooVuCKr/9FIYYVQpoh6sdAdLJ 5ZHN2jZCVwI6c0Ec2pD1ykA18jxxe7RfUXXK/8tr4+W5mwT6P7/q2Q1dujZhr1itfY8g vMFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695571643; x=1696176443; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=aeckoQ9VJ6OdE5PMGKcILi8nW1PsNTWbedGCSVfgmYk=; b=oVVqt6R3K6lZGIFhqE6vQZQjvEGT1QTrABb1y/Y1lU03l7jta46a1xze0uCZIBSeKS TunRdtk/gsC4q3fnASCrlRygwmAzWUM9gKwPqw9W0gHxnGdk/1bRzizxYDdZ1yfQuJrA 9cJiirmMxvoSHSKJdmxAJXdnSK4Pm3relwUyECmwy4MlEyzGTHA8gXJihLLGIPT9o4KA LJAsjlFM9iGJkf6vBWv5uhSLQJIxac86a48cxALfK9/UcXtS/+DSJZjUg1x2Tk4tafLE ewuJstG0l+lH6Y7kVI5qR+imFDMTVa8xvQjd7iueEHVxlDelc2OpJi5biaQ+QJy+mSN8 ueHg== X-Gm-Message-State: AOJu0YwGP43UkTh+Wh3Q+8D6MOOc5CXjLZCcBX6FYT0NMUSWSdn6ehnP kvHR0geMBhHmSVRqZBRl/8M8 X-Received: by 2002:a17:907:6d29:b0:9a5:b1cd:bdf2 with SMTP id sa41-20020a1709076d2900b009a5b1cdbdf2mr4006180ejc.51.1695571643552; Sun, 24 Sep 2023 09:07:23 -0700 (PDT) Received: from localhost.localdomain ([2a02:8108:8240:1578:d967:4cf:6d0e:a066]) by smtp.gmail.com with ESMTPSA id r11-20020a170906704b00b00999bb1e01dfsm5155345ejj.52.2023.09.24.09.07.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Sep 2023 09:07:23 -0700 (PDT) From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> To: lpieralisi@kernel.org, kw@linux.com Cc: andersson@kernel.org, konrad.dybcio@linaro.org, bhelgaas@google.com, linux-arm-msm@vger.kernel.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, abel.vesa@linaro.org, Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Subject: [PATCH] PCI: qcom: Add interconnect bandwidth for PCIe Gen4 Date: Sun, 24 Sep 2023 18:07:13 +0200 Message-Id: <20230924160713.217086-1-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Sun, 24 Sep 2023 09:07:48 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777966753334144807 X-GMAIL-MSGID: 1777966753334144807 |
Series |
PCI: qcom: Add interconnect bandwidth for PCIe Gen4
|
|
Commit Message
Manivannan Sadhasivam
Sept. 24, 2023, 4:07 p.m. UTC
PCIe Gen4 supports the interconnect bandwidth of 1969 MBps. So let's add
the bandwidth support in the driver. Otherwise, the default bandwidth of
985 MBps will be used.
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
drivers/pci/controller/dwc/pcie-qcom.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
Comments
On 24.09.2023 18:07, Manivannan Sadhasivam wrote: > PCIe Gen4 supports the interconnect bandwidth of 1969 MBps. So let's add > the bandwidth support in the driver. Otherwise, the default bandwidth of > 985 MBps will be used. > > Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> > --- > drivers/pci/controller/dwc/pcie-qcom.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c > index 297442c969b6..6853123f92c1 100644 > --- a/drivers/pci/controller/dwc/pcie-qcom.c > +++ b/drivers/pci/controller/dwc/pcie-qcom.c > @@ -1384,11 +1384,14 @@ static void qcom_pcie_icc_update(struct qcom_pcie *pcie) > case 2: > bw = MBps_to_icc(500); > break; > + case 3: > + bw = MBps_to_icc(985); > + break; > default: > WARN_ON_ONCE(1); > fallthrough; > - case 3: > - bw = MBps_to_icc(985); > + case 4: > + bw = MBps_to_icc(1969); > break; Are you adding case 4 under `default`? That looks.. bizzare.. Konrad
On 23-09-25 10:57:47, Konrad Dybcio wrote: > On 24.09.2023 18:07, Manivannan Sadhasivam wrote: > > PCIe Gen4 supports the interconnect bandwidth of 1969 MBps. So let's add > > the bandwidth support in the driver. Otherwise, the default bandwidth of > > 985 MBps will be used. > > > > Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> > > --- > > drivers/pci/controller/dwc/pcie-qcom.c | 7 +++++-- > > 1 file changed, 5 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c > > index 297442c969b6..6853123f92c1 100644 > > --- a/drivers/pci/controller/dwc/pcie-qcom.c > > +++ b/drivers/pci/controller/dwc/pcie-qcom.c > > @@ -1384,11 +1384,14 @@ static void qcom_pcie_icc_update(struct qcom_pcie *pcie) > > case 2: > > bw = MBps_to_icc(500); > > break; > > + case 3: > > + bw = MBps_to_icc(985); > > + break; > > default: > > WARN_ON_ONCE(1); > > fallthrough; > > - case 3: > > - bw = MBps_to_icc(985); > > + case 4: > > + bw = MBps_to_icc(1969); > > break; > Are you adding case 4 under `default`? That looks.. bizzare.. That's intentional. You want it to use 1969MBps if there is a different gen value. AFAIU. > > Konrad
On 25.09.2023 12:33, Abel Vesa wrote: > On 23-09-25 10:57:47, Konrad Dybcio wrote: >> On 24.09.2023 18:07, Manivannan Sadhasivam wrote: >>> PCIe Gen4 supports the interconnect bandwidth of 1969 MBps. So let's add >>> the bandwidth support in the driver. Otherwise, the default bandwidth of >>> 985 MBps will be used. >>> >>> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> >>> --- >>> drivers/pci/controller/dwc/pcie-qcom.c | 7 +++++-- >>> 1 file changed, 5 insertions(+), 2 deletions(-) >>> >>> diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c >>> index 297442c969b6..6853123f92c1 100644 >>> --- a/drivers/pci/controller/dwc/pcie-qcom.c >>> +++ b/drivers/pci/controller/dwc/pcie-qcom.c >>> @@ -1384,11 +1384,14 @@ static void qcom_pcie_icc_update(struct qcom_pcie *pcie) >>> case 2: >>> bw = MBps_to_icc(500); >>> break; >>> + case 3: >>> + bw = MBps_to_icc(985); >>> + break; >>> default: >>> WARN_ON_ONCE(1); >>> fallthrough; >>> - case 3: >>> - bw = MBps_to_icc(985); >>> + case 4: >>> + bw = MBps_to_icc(1969); >>> break; >> Are you adding case 4 under `default`? That looks.. bizzare.. > > That's intentional. You want it to use 1969MBps if there is a different > gen value. AFAIU. Gah right, then the commit message is wrong. Konrad
On 23-09-24 18:07:13, Manivannan Sadhasivam wrote: > PCIe Gen4 supports the interconnect bandwidth of 1969 MBps. So let's add > the bandwidth support in the driver. Otherwise, the default bandwidth of > 985 MBps will be used. > > Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Tested-by: Abel Vesa <abel.vesa@linaro.org> > --- > drivers/pci/controller/dwc/pcie-qcom.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c > index 297442c969b6..6853123f92c1 100644 > --- a/drivers/pci/controller/dwc/pcie-qcom.c > +++ b/drivers/pci/controller/dwc/pcie-qcom.c > @@ -1384,11 +1384,14 @@ static void qcom_pcie_icc_update(struct qcom_pcie *pcie) > case 2: > bw = MBps_to_icc(500); > break; > + case 3: > + bw = MBps_to_icc(985); > + break; > default: > WARN_ON_ONCE(1); > fallthrough; > - case 3: > - bw = MBps_to_icc(985); > + case 4: > + bw = MBps_to_icc(1969); > break; > } > > -- > 2.25.1 >
On 23-09-25 12:34:53, Konrad Dybcio wrote: > On 25.09.2023 12:33, Abel Vesa wrote: > > On 23-09-25 10:57:47, Konrad Dybcio wrote: > >> On 24.09.2023 18:07, Manivannan Sadhasivam wrote: > >>> PCIe Gen4 supports the interconnect bandwidth of 1969 MBps. So let's add > >>> the bandwidth support in the driver. Otherwise, the default bandwidth of > >>> 985 MBps will be used. > >>> > >>> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> > >>> --- > >>> drivers/pci/controller/dwc/pcie-qcom.c | 7 +++++-- > >>> 1 file changed, 5 insertions(+), 2 deletions(-) > >>> > >>> diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c > >>> index 297442c969b6..6853123f92c1 100644 > >>> --- a/drivers/pci/controller/dwc/pcie-qcom.c > >>> +++ b/drivers/pci/controller/dwc/pcie-qcom.c > >>> @@ -1384,11 +1384,14 @@ static void qcom_pcie_icc_update(struct qcom_pcie *pcie) > >>> case 2: > >>> bw = MBps_to_icc(500); > >>> break; > >>> + case 3: > >>> + bw = MBps_to_icc(985); > >>> + break; > >>> default: > >>> WARN_ON_ONCE(1); > >>> fallthrough; > >>> - case 3: > >>> - bw = MBps_to_icc(985); > >>> + case 4: > >>> + bw = MBps_to_icc(1969); > >>> break; > >> Are you adding case 4 under `default`? That looks.. bizzare.. > > > > That's intentional. You want it to use 1969MBps if there is a different > > gen value. AFAIU. > Gah right, then the commit message is wrong. Yep, should be: "Otherwise, the default bandwidth of 1969 MBps will be used." But maybe we should not default to that. Maybe we should still default to 985 MBps. > > Konrad
On 25.09.2023 12:37, Abel Vesa wrote: > On 23-09-25 12:34:53, Konrad Dybcio wrote: >> On 25.09.2023 12:33, Abel Vesa wrote: >>> On 23-09-25 10:57:47, Konrad Dybcio wrote: >>>> On 24.09.2023 18:07, Manivannan Sadhasivam wrote: >>>>> PCIe Gen4 supports the interconnect bandwidth of 1969 MBps. So let's add >>>>> the bandwidth support in the driver. Otherwise, the default bandwidth of >>>>> 985 MBps will be used. >>>>> >>>>> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> >>>>> --- >>>>> drivers/pci/controller/dwc/pcie-qcom.c | 7 +++++-- >>>>> 1 file changed, 5 insertions(+), 2 deletions(-) >>>>> >>>>> diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c >>>>> index 297442c969b6..6853123f92c1 100644 >>>>> --- a/drivers/pci/controller/dwc/pcie-qcom.c >>>>> +++ b/drivers/pci/controller/dwc/pcie-qcom.c >>>>> @@ -1384,11 +1384,14 @@ static void qcom_pcie_icc_update(struct qcom_pcie *pcie) >>>>> case 2: >>>>> bw = MBps_to_icc(500); >>>>> break; >>>>> + case 3: >>>>> + bw = MBps_to_icc(985); >>>>> + break; >>>>> default: >>>>> WARN_ON_ONCE(1); >>>>> fallthrough; >>>>> - case 3: >>>>> - bw = MBps_to_icc(985); >>>>> + case 4: >>>>> + bw = MBps_to_icc(1969); >>>>> break; >>>> Are you adding case 4 under `default`? That looks.. bizzare.. >>> >>> That's intentional. You want it to use 1969MBps if there is a different >>> gen value. AFAIU. >> Gah right, then the commit message is wrong. > > Yep, should be: "Otherwise, the default bandwidth of 1969 MBps will be > used." > > But maybe we should not default to that. Maybe we should still default > to 985 MBps. Perhaps we shouldn't have a default at all.. E.g. if the gen5 bus may get clogged if we exceed gen4 limits Konrad
On Sun, Sep 24, 2023 at 06:07:13PM +0200, Manivannan Sadhasivam wrote: > PCIe Gen4 supports the interconnect bandwidth of 1969 MBps. So let's add > the bandwidth support in the driver. Otherwise, the default bandwidth of > 985 MBps will be used. > > Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> > --- > drivers/pci/controller/dwc/pcie-qcom.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c > index 297442c969b6..6853123f92c1 100644 > --- a/drivers/pci/controller/dwc/pcie-qcom.c > +++ b/drivers/pci/controller/dwc/pcie-qcom.c > @@ -1384,11 +1384,14 @@ static void qcom_pcie_icc_update(struct qcom_pcie *pcie) > case 2: > bw = MBps_to_icc(500); > break; > + case 3: > + bw = MBps_to_icc(985); > + break; > default: > WARN_ON_ONCE(1); > fallthrough; > - case 3: > - bw = MBps_to_icc(985); > + case 4: > + bw = MBps_to_icc(1969); The bare numbers here are sort of weird. I assume they correspond to the Supported Link Speeds Vector in Link Cap 2, and I expected them to correspond somehow to PCIE_SPEED2MBS_ENC(), which computes the usable PCIe bandwidth per lane. I see the ratios between 250, 500, 986, 1969 *do* match up with the ratios of PCIE_SPEED2MBS_ENC() values, but I don't know the PCIE_SPEED2MBS_ENC() values aren't used: SLS Vector PCIE_SPEED2MBS_ENC() CLS 1: bit 0 2.5 GT/s MBps_to_icc(250) 2000 Mbps CLS 2: bit 1 5.0 GT/s MBps_to_icc(500) 4000 Mbps CLS 3: bit 2 8.0 GT/s MBps_to_icc(985) 7879 Mbps CLS 4: bit 3 16.0 GT/s MBps_to_icc(1969) 15753 Mbps This is just my curiosity, probably no change is needed, or at most a short comment. I do notice that pcie-qcom-ep.c uses #defines like PCIE_GEN1_BW_MBPS, and it seems like both could use the same style. Also agree with Konrad that the ordering ends up looking unusual; maybe would be more readable if the default case repeated the speed you want instead of using the fallthrough. > break; > }
On Mon, Sep 25, 2023 at 12:40:34PM +0200, Konrad Dybcio wrote: > On 25.09.2023 12:37, Abel Vesa wrote: > > On 23-09-25 12:34:53, Konrad Dybcio wrote: > >> On 25.09.2023 12:33, Abel Vesa wrote: > >>> On 23-09-25 10:57:47, Konrad Dybcio wrote: > >>>> On 24.09.2023 18:07, Manivannan Sadhasivam wrote: > >>>>> PCIe Gen4 supports the interconnect bandwidth of 1969 MBps. So let's add > >>>>> the bandwidth support in the driver. Otherwise, the default bandwidth of > >>>>> 985 MBps will be used. > >>>>> > >>>>> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> > >>>>> --- > >>>>> drivers/pci/controller/dwc/pcie-qcom.c | 7 +++++-- > >>>>> 1 file changed, 5 insertions(+), 2 deletions(-) > >>>>> > >>>>> diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c > >>>>> index 297442c969b6..6853123f92c1 100644 > >>>>> --- a/drivers/pci/controller/dwc/pcie-qcom.c > >>>>> +++ b/drivers/pci/controller/dwc/pcie-qcom.c > >>>>> @@ -1384,11 +1384,14 @@ static void qcom_pcie_icc_update(struct qcom_pcie *pcie) > >>>>> case 2: > >>>>> bw = MBps_to_icc(500); > >>>>> break; > >>>>> + case 3: > >>>>> + bw = MBps_to_icc(985); > >>>>> + break; > >>>>> default: > >>>>> WARN_ON_ONCE(1); > >>>>> fallthrough; > >>>>> - case 3: > >>>>> - bw = MBps_to_icc(985); > >>>>> + case 4: > >>>>> + bw = MBps_to_icc(1969); > >>>>> break; > >>>> Are you adding case 4 under `default`? That looks.. bizzare.. > >>> > >>> That's intentional. You want it to use 1969MBps if there is a different > >>> gen value. AFAIU. > >> Gah right, then the commit message is wrong. > > > > Yep, should be: "Otherwise, the default bandwidth of 1969 MBps will be > > used." > > > > But maybe we should not default to that. Maybe we should still default > > to 985 MBps. > Perhaps we shouldn't have a default at all.. > > E.g. if the gen5 bus may get clogged if we exceed gen4 > limits > So the idea here is that if we happen to run this driver on a new Gen supported SoC, we have to let the user know that the interconnects are running at a lower gen speed and it needs attention. But I think we can simplify it by fixing a default bandwidth, say Gen3 and get rid of the fallthrough. And yeah, the same needs to be done for the pcie-qcom-ep driver as well. - Mani > Konrad
On Tue, Sep 26, 2023 at 04:08:23PM -0500, Bjorn Helgaas wrote: > On Sun, Sep 24, 2023 at 06:07:13PM +0200, Manivannan Sadhasivam wrote: > > PCIe Gen4 supports the interconnect bandwidth of 1969 MBps. So let's add > > the bandwidth support in the driver. Otherwise, the default bandwidth of > > 985 MBps will be used. > > > > Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> > > --- > > drivers/pci/controller/dwc/pcie-qcom.c | 7 +++++-- > > 1 file changed, 5 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c > > index 297442c969b6..6853123f92c1 100644 > > --- a/drivers/pci/controller/dwc/pcie-qcom.c > > +++ b/drivers/pci/controller/dwc/pcie-qcom.c > > @@ -1384,11 +1384,14 @@ static void qcom_pcie_icc_update(struct qcom_pcie *pcie) > > case 2: > > bw = MBps_to_icc(500); > > break; > > + case 3: > > + bw = MBps_to_icc(985); > > + break; > > default: > > WARN_ON_ONCE(1); > > fallthrough; > > - case 3: > > - bw = MBps_to_icc(985); > > + case 4: > > + bw = MBps_to_icc(1969); > > The bare numbers here are sort of weird. I assume they correspond to > the Supported Link Speeds Vector in Link Cap 2, and I expected them to > correspond somehow to PCIE_SPEED2MBS_ENC(), which computes the usable > PCIe bandwidth per lane. I see the ratios between 250, 500, 986, 1969 > *do* match up with the ratios of PCIE_SPEED2MBS_ENC() values, but I > don't know the PCIE_SPEED2MBS_ENC() values aren't used: > > SLS Vector PCIE_SPEED2MBS_ENC() > CLS 1: bit 0 2.5 GT/s MBps_to_icc(250) 2000 Mbps > CLS 2: bit 1 5.0 GT/s MBps_to_icc(500) 4000 Mbps > CLS 3: bit 2 8.0 GT/s MBps_to_icc(985) 7879 Mbps > CLS 4: bit 3 16.0 GT/s MBps_to_icc(1969) 15753 Mbps > > This is just my curiosity, probably no change is needed, or at most a > short comment. > You are right. I'm not aware of this macro before and yes, I can make use of it. > I do notice that pcie-qcom-ep.c uses #defines like PCIE_GEN1_BW_MBPS, > and it seems like both could use the same style. > > Also agree with Konrad that the ordering ends up looking unusual; > maybe would be more readable if the default case repeated the speed > you want instead of using the fallthrough. > Yes, that would be more readable. - Mani > > break; > > }
diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c index 297442c969b6..6853123f92c1 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -1384,11 +1384,14 @@ static void qcom_pcie_icc_update(struct qcom_pcie *pcie) case 2: bw = MBps_to_icc(500); break; + case 3: + bw = MBps_to_icc(985); + break; default: WARN_ON_ONCE(1); fallthrough; - case 3: - bw = MBps_to_icc(985); + case 4: + bw = MBps_to_icc(1969); break; }