Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1091648rwl; Wed, 5 Apr 2023 11:38:39 -0700 (PDT) X-Google-Smtp-Source: AKy350ZRXgdA3VrIih8//BDiKCdLKGVRr+sDWdYDbafYkZMit/gH0Bo4oi34xvWbk5x4srcKHHoz X-Received: by 2002:aa7:d511:0:b0:502:1c7d:deb6 with SMTP id y17-20020aa7d511000000b005021c7ddeb6mr2726657edq.29.1680719919033; Wed, 05 Apr 2023 11:38:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680719919; cv=none; d=google.com; s=arc-20160816; b=tNqKTL5mVuVsoEAczP0+sslk4Tf6/2VHWAOT+mM/OOepyv7uIDeqRfU7hXFHU9uXZ7 55CNL0WfdTx6TS3X3UKD531yXljC74b4b1euWC3NBR46CqcVJsRWnYen/qlHjeMw4PpD qziu6G/lX2Wq1xyjV1NkTMewPjCDoHZAS5QIl4iGiGmkFwOj7XpgqmZ3ZXQDOxBGmcVM ahkFI7+eLeVjJsiu59Jvy+K02QoIo95umC9kQ6TpZuZSUWekYri83YudmmCGZ3Psi4B0 5w4MZ5D1dxi8ROfChRYbGoVDHnakpiOcJQuoLJcIhOWLEZGs6UmGQzlF+zSG3OjDEH+a MttQ== 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-transfer-encoding :content-disposition:mime-version:message-id:subject:cc:to:from:date :dkim-signature; bh=iofNLxZppq2lnrnvin3b29ae52gu5HXKfmMVEZMFRUA=; b=wyy1MqKVuwHiyzjBqmYucNQGczthF07HmOKfR1ku/S+70U39PVi/dPZd1RBBYuad9c R2uX7Lilng6B1lf6THDTFPkvpgOgj6TB/Q3MCUH0gJDEsY6UHaKJHQqbR6nYZqDZERD4 OPldUlD6uY4abypHoiDG9NeEMbkKa7henMQZZPQBZEG1sWkhXUn3UMEzYJZhwkfAlusd pLU26IjM+W914KpmFgl2crKTPFQVcnWkasYlZrmJZ+58ZVoLxIojTUKlvLCeyCLmVnle xZ5iGsoUETJa/9MMdJdPr9CqhL/W1EpbthwUDtxYBBlr/J9WGdpAxEVqkS1MG1zWnhCG inPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pSYqHsSr; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v10-20020aa7d64a000000b00502a619f069si1906569edr.36.2023.04.05.11.38.13; Wed, 05 Apr 2023 11:38:39 -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=@kernel.org header.s=k20201202 header.b=pSYqHsSr; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229731AbjDES17 (ORCPT + 99 others); Wed, 5 Apr 2023 14:27:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234154AbjDES16 (ORCPT ); Wed, 5 Apr 2023 14:27:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A12361A2; Wed, 5 Apr 2023 11:27:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3569C64083; Wed, 5 Apr 2023 18:27:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60FDBC433D2; Wed, 5 Apr 2023 18:27:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1680719275; bh=S45JL7p28MzbNIkK/R/Rxee7+W/06GYb1Miri9LtNes=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=pSYqHsSrKTYeLipOE4a9ZP6avOxOgVZqmcWjoiGzeqAOx/sI/cjao7rIPo/01zM/D lhu2OAZPIb8qrmmUx16Aj2cPQYjBJ2Gj2o2eFulUB64Ys346lQ62uhO6r0ytNsPEhp x8UTVuwkjdoA8GmgWn/3IFcJg9jOie3vlbUyCcVnjyr//fgh9TVFmwKw9B8E/Xd9zd GldJk1xpXv80Y/1Y1k0959vxdsqhru9u2kcgGCD5yCEqZV3+jZ+Me5DW6VtfawPzhg bVTkQLmHILjnQHygnRNqzF7Tlw/ZRsBjDoKnHnxaLIP5vEtAhuJxHVNGZeW+OeFBgO jcOxVYBzBSDoA== Date: Wed, 5 Apr 2023 13:27:53 -0500 From: Bjorn Helgaas To: Lorenzo Pieralisi Cc: Sajid Dalvi , Han Jingoo , Bjorn Helgaas , Gustavo Pimentel , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Rob Herring , kernel-team@android.com, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Krzysztof Kozlowski Subject: Re: [PATCH v2] PCI: dwc: Wait for link up only if link is started Message-ID: <20230405182753.GA3626483@bhelgaas> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,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 lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 05, 2023 at 03:24:36PM +0200, Lorenzo Pieralisi wrote: > On Thu, Mar 16, 2023 at 06:05:02PM -0500, Sajid Dalvi wrote: > > On Tue, Feb 28, 2023 at 10:36 PM Sajid Dalvi wrote: > > > > > > Thanks for your review Jingoo. > > > Sajid > > > > > > On Tue, Feb 28, 2023 at 4:04 PM Han Jingoo wrote: > > > > > > > > On Mon, Feb 27, 2023, Sajid Dalvi wrote: > > > > > > > > > > In dw_pcie_host_init() regardless of whether the link has been started > > > > > or not, the code waits for the link to come up. Even in cases where > > > > > start_link() is not defined the code ends up spinning in a loop for 1 > > > > > second. Since in some systems dw_pcie_host_init() gets called during > > > > > probe, this one second loop for each pcie interface instance ends up > > > > > extending the boot time. > > > > > > > > > > Call trace when start_link() is not defined: > > > > > dw_pcie_wait_for_link << spins in a loop for 1 second > > > > > dw_pcie_host_init > > > > > > > > > > Signed-off-by: Sajid Dalvi > > > > > > > > (CC'ed Krzysztof Kozlowski) > > > > > > > > Acked-by: Jingoo Han > > > > > > > > It looks good to me. I also checked the previous thread. > > > > I agree with Krzysztof's opinion that we should include > > > > only hardware-related features into DT. > > > > Thank you. > > > > > > > > Best regards, > > > > Jingoo Han > > > > > > > > > --- > > > > > drivers/pci/controller/dwc/pcie-designware-host.c | 6 +++--- > > > > > 1 file changed, 3 insertions(+), 3 deletions(-) > > > > > > > > > > diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c > > > > > index 9952057c8819..9709f69f173e 100644 > > > > > --- a/drivers/pci/controller/dwc/pcie-designware-host.c > > > > > +++ b/drivers/pci/controller/dwc/pcie-designware-host.c > > > > > @@ -489,10 +489,10 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp) > > > > > ret = dw_pcie_start_link(pci); > > > > > if (ret) > > > > > goto err_remove_edma; > > > > > - } > > > > > > > > > > - /* Ignore errors, the link may come up later */ > > > > > - dw_pcie_wait_for_link(pci); > > > > > + /* Ignore errors, the link may come up later */ > > > > > + dw_pcie_wait_for_link(pci); > > > > > + } > > > > > > > > > > bridge->sysdata = pp; > > > > > > > > > > -- > > > > > 2.39.2.722.g9855ee24e9-goog > > > > > > > > > @bhelgaas Can this be picked up in your tree: > > https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git/ > > This patch seems fine to me. The question I have though is why the > *current* code is written the way it is. Perhaps it is just the way > it is, I wonder whether this change can trigger a regression though. The new code will look basically like this: if (!dw_pcie_link_up(pci)) { dw_pcie_start_link(pci); dw_pcie_wait_for_link(pci); } If the link is already up by the time we get here, this change means we won't get this message emitted by dw_pcie_wait_for_link(): dev_info(pci->dev, "PCIe Gen.%u x%u link up\n", ...) I don't know how important that is, but I bet somebody cares about it. From the commit log, I expected the patch to do something based on whether ->start_link() was defined, but there really isn't a direct connection, so maybe the log could be refined. Bjorn