From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5DD72CD4F59 for ; Thu, 5 Sep 2024 06:48:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=dfA/5dqb3cupPBb2f1UlVZBWCvBRXsOA6HJbbpUkTgM=; b=ESrKpFxqZIF4M+UHGIatnM0Ln5 1WAfWMqPImONPgqlQfA0pZfuHvF1fRDNXeHNScKXU6GvXBEv8V467ey9gTWMyZXq+qaT98HEOYaRQ rksz2esH4Fs6t9D/2E0GlDH1UlmutTzgKY4EjMffomiCI9IAx2aYE0/3XuAy2MewERXLjVlgrbjma fON8RXoZPoKt+HB4sW3K8S72iWRaznYCZ6PWkfW86WPdzR4OtRNOH1jVUmsD1/xQk+E12QtPe9vJa +f4UtjBT7kZcRv58M8nnKOwuWbaqPOAzqGHpg442INe/S9ZJVv0hHn+bMMoLWzMEXTgZUKH60xQUk zEDkgptQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sm6HZ-00000007FD0-3dWp; Thu, 05 Sep 2024 06:47:53 +0000 Received: from nyc.source.kernel.org ([2604:1380:45d1:ec00::3]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sm6F9-00000007El4-1I0A for linux-arm-kernel@lists.infradead.org; Thu, 05 Sep 2024 06:45:25 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id B4BD6A440CA; Thu, 5 Sep 2024 06:45:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97B1EC4CEC4; Thu, 5 Sep 2024 06:45:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725518721; bh=pwkWnjC+Q1NqaXK6JlAyfabTkTo0JS4rxXogOThDdac=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=QLAgHg4raavHGx9ezW/P9yna3hyJgw6SY+qG+4eCnu+2qT3zUt0b0fPsaJX0WAkRr b9cDKSCmOjvrTllVynwEXb3enBl+fSuzgT8hcBIruZ1ep0mGnWnVs4eifKMzJLsXgD 35jjwGbavg8yMkh4NuEm3LKrA4x/PiKW9Ths/TrPgN0knM+hXgOmtuzIsjGCLGx80j z/MZF/3Spt7uR/u6V7jXGZQ69+qZxu9fqwCjKpnn8ybA6s1e5TAsV2Q3+PArjZM+Vb AOHDiGufvBkKqM3fG7dHqhwMeJTdNSxlKnbaolpRKwMhvrtoM2mQb+ukgwSk+Zdewl ds5+/dbcHItmw== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1sm6FO-000000001Hc-2EOT; Thu, 05 Sep 2024 08:45:38 +0200 Date: Thu, 5 Sep 2024 08:45:38 +0200 From: Johan Hovold To: Manivannan Sadhasivam Cc: Richard Zhu , Lucas Stach , Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Jingoo Han , Chuanhua Lei , Marek Vasut , Yoshihiro Shimoda , linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-arm-msm@vger.kernel.org, abel.vesa@linaro.org, johan+linaro@kernel.org, Shashank Babu Chinta Venkata Subject: Re: [PATCH v6 2/4] PCI: dwc: Always cache the maximum link speed value in dw_pcie::max_link_speed Message-ID: References: <20240904-pci-qcom-gen4-stability-v6-0-ec39f7ae3f62@linaro.org> <20240904-pci-qcom-gen4-stability-v6-2-ec39f7ae3f62@linaro.org> <20240904154944.w4bujfmhy5uhzkld@thinkpad> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240904154944.w4bujfmhy5uhzkld@thinkpad> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240904_234523_470319_3D0C1E3E X-CRM114-Status: GOOD ( 22.58 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Sep 04, 2024 at 09:19:44PM +0530, Manivannan Sadhasivam wrote: > On Wed, Sep 04, 2024 at 11:30:08AM +0200, Johan Hovold wrote: > > On Wed, Sep 04, 2024 at 12:41:58PM +0530, Manivannan Sadhasivam via B4 Relay wrote: > > > From: Manivannan Sadhasivam > > > + /* > > > + * Even if the platform doesn't want to limit the maximum link speed, > > > + * just cache the hardware default value so that the vendor drivers can > > > + * use it to do any link specific configuration. > > > + */ > > > + if (pci->max_link_speed < 0) { > > > > This should be > > > > if (pci->max_link_speed < 1) { > > > > Well I was trying to catch the error value here because if neither driver nor > platform limits the max link speed, this would have -EINVAL (returned by > of_pci_get_max_link_speed()). Indeed, I thought I'd traced it do be zero here, but I must have made a mistake. The old code did check for 0 before calling this function, though (e.g. in case max_link_speed was never initialised as intended). > But logically it makes sense to use 'pci->max_link_speed < 1' since anything > below value 1 is an invalid value. > > Will change it. Sounds good. > > > @@ -1058,8 +1069,7 @@ void dw_pcie_setup(struct dw_pcie *pci) > > > { > > > u32 val; > > > > > > - if (pci->max_link_speed > 0) > > > - dw_pcie_link_set_max_speed(pci, pci->max_link_speed); > > > + dw_pcie_link_set_max_speed(pci); Johan