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 X-Spam-Level: X-Spam-Status: No, score=-8.6 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FAKE_REPLY_C,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 486D5C11D35 for ; Mon, 24 Feb 2020 14:15:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 202FB2082F for ; Mon, 24 Feb 2020 14:15:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582553757; bh=XCz98vLZW6w/xNhdXjYLn54ZixK2JilGaitOtPGmMvs=; h=Date:From:To:Cc:Subject:In-Reply-To:List-ID:From; b=dX1U6i4vcDQqaYXtTxx/lQ0GEY57nUajzxGBw6ziCoaPlaU+LmffXm2hkF9v5xiLz /ePcpPV0fkAb1X3w/yn9CzGcySLNw9SpZjlg0Jq1a8K1vNUbcHHys2llmgEnNlaz72 /ZqR4X68EUD/ZNug8feJMZUg55Itq1piAuUrgTD0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727763AbgBXOP4 (ORCPT ); Mon, 24 Feb 2020 09:15:56 -0500 Received: from mail.kernel.org ([198.145.29.99]:33716 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727581AbgBXOPz (ORCPT ); Mon, 24 Feb 2020 09:15:55 -0500 Received: from localhost (52.sub-174-234-140.myvzw.com [174.234.140.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B01D520880; Mon, 24 Feb 2020 14:15:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582553754; bh=XCz98vLZW6w/xNhdXjYLn54ZixK2JilGaitOtPGmMvs=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=CiqJ30OyI8S16FM0s04k11u8hdvW/ESmAR0LgjcOX3sDn0jmkQnhIKAK+66JUKaJl TcnQ17I7B1cjisYZGQP23ile5qHfOKb+aY2TPcwFmbrG7ppVrUmQOJ4ZHd3a3NdLGg Z+FB1pzImqT5cmXjYfSJSAMfBWz1JpYVsppB54z8= Date: Mon, 24 Feb 2020 08:15:51 -0600 From: Bjorn Helgaas To: Stanislav Spassov Cc: linux-pci@vger.kernel.org, Stanislav Spassov , Thomas Gleixner , Andrew Morton , Jan H =?iso-8859-1?Q?=2E_Sch=F6nherr?= , Wei Wang , Jonathan Corbet , linux-doc@vger.kernel.org, Ashok Raj , Alex Williamson , Sinan Kaya , Rajat Jain Subject: Re: [PATCH 1/3] PCI: Make PCIE_RESET_READY_POLL_MS configurable Message-ID: <20200224141551.GA217704@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200223122057.6504-2-stanspas@amazon.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org [+cc Ashok, Alex, Sinan, Rajat] On Sun, Feb 23, 2020 at 01:20:55PM +0100, Stanislav Spassov wrote: > From: Wei Wang > > The resonable value for the maximum time to wait for a PCI device to be > ready after reset varies depending on the platform and the reliability > of its set of devices. There are several mechanisms in the spec for reducing these times, e.g., Readiness Notifications (PCIe r5.0, sec 6.23), the Readiness Time Reporting capability (sec 7.9.17), and ACPI _DSM methods (PCI Firmware Spec r3.2, sec 4.6.8, 4.6.9). I would much rather use standard mechanisms like those instead of adding kernel parameters. A user would have to use trial and error to figure out the value to use with a parameter like this, and that doesn't feel like a robust approach. > Signed-off-by: Wei Wang > Signed-off-by: Stanislav Spassov > --- > .../admin-guide/kernel-parameters.txt | 5 +++++ > drivers/pci/pci.c | 22 ++++++++++++++----- > 2 files changed, 22 insertions(+), 5 deletions(-) > > diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt > index dbc22d684627..5e4dade9acc8 100644 > --- a/Documentation/admin-guide/kernel-parameters.txt > +++ b/Documentation/admin-guide/kernel-parameters.txt > @@ -3653,6 +3653,11 @@ > nomsi Do not use MSI for native PCIe PME signaling (this makes > all PCIe root ports use INTx for all services). > > + pcie_reset_ready_poll_ms= [PCI,PCIE] > + Specifies timeout for PCI(e) device readiness polling > + after device reset (in milliseconds). > + Default: 60000 = 60 seconds > + > pcmv= [HW,PCMCIA] BadgePAD 4 > > pd_ignore_unused > diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c > index d828ca835a98..db9b58ab6c68 100644 > --- a/drivers/pci/pci.c > +++ b/drivers/pci/pci.c > @@ -149,7 +149,19 @@ static int __init pcie_port_pm_setup(char *str) > __setup("pcie_port_pm=", pcie_port_pm_setup); > > /* Time to wait after a reset for device to become responsive */ > -#define PCIE_RESET_READY_POLL_MS 60000 > +#define PCIE_RESET_READY_POLL_MS_DEFAULT 60000 > + > +int __read_mostly pcie_reset_ready_poll_ms = PCIE_RESET_READY_POLL_MS_DEFAULT; > + > +static int __init pcie_reset_ready_poll_ms_setup(char *str) > +{ > + int timeout; > + > + if (!kstrtoint(str, 0, &timeout)) > + pcie_reset_ready_poll_ms = timeout; > + return 1; > +} > +__setup("pcie_reset_ready_poll_ms=", pcie_reset_ready_poll_ms_setup); > > /** > * pci_bus_max_busnr - returns maximum PCI bus number of given bus' children > @@ -4506,7 +4518,7 @@ int pcie_flr(struct pci_dev *dev) > */ > msleep(100); > > - return pci_dev_wait(dev, "FLR", PCIE_RESET_READY_POLL_MS); > + return pci_dev_wait(dev, "FLR", pcie_reset_ready_poll_ms); > } > EXPORT_SYMBOL_GPL(pcie_flr); > > @@ -4551,7 +4563,7 @@ static int pci_af_flr(struct pci_dev *dev, int probe) > */ > msleep(100); > > - return pci_dev_wait(dev, "AF_FLR", PCIE_RESET_READY_POLL_MS); > + return pci_dev_wait(dev, "AF_FLR", pcie_reset_ready_poll_ms); > } > > /** > @@ -4596,7 +4608,7 @@ static int pci_pm_reset(struct pci_dev *dev, int probe) > pci_write_config_word(dev, dev->pm_cap + PCI_PM_CTRL, csr); > pci_dev_d3_sleep(dev); > > - return pci_dev_wait(dev, "PM D3hot->D0", PCIE_RESET_READY_POLL_MS); > + return pci_dev_wait(dev, "PM D3hot->D0", pcie_reset_ready_poll_ms); > } > > /** > @@ -4826,7 +4838,7 @@ int pci_bridge_secondary_bus_reset(struct pci_dev *dev) > { > pcibios_reset_secondary_bus(dev); > > - return pci_dev_wait(dev, "bus reset", PCIE_RESET_READY_POLL_MS); > + return pci_dev_wait(dev, "bus reset", pcie_reset_ready_poll_ms); > } > EXPORT_SYMBOL_GPL(pci_bridge_secondary_bus_reset);