From patchwork Sun Dec 11 01:19:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yinghai Lu X-Patchwork-Id: 9469561 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D153F607F0 for ; Sun, 11 Dec 2016 01:19:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BC90828409 for ; Sun, 11 Dec 2016 01:19:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AFDE52841D; Sun, 11 Dec 2016 01:19:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CD92128409 for ; Sun, 11 Dec 2016 01:19:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752038AbcLKBTN (ORCPT ); Sat, 10 Dec 2016 20:19:13 -0500 Received: from mail-pf0-f194.google.com ([209.85.192.194]:35055 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751639AbcLKBTM (ORCPT ); Sat, 10 Dec 2016 20:19:12 -0500 Received: by mail-pf0-f194.google.com with SMTP id i88so2784525pfk.2; Sat, 10 Dec 2016 17:19:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=LAi4Phx4zJIv5czTnjp7qfVqpLswgjFu+zJ/rvYB8Lk=; b=onb0XZ4FJTwY6pkGfpNR+vZPhW29mKHSikieJ3Ex65Rh2d8uOsOjhLPt9Da9eom4qT 3GWSwEGINYjjTvPqK9aFuBzKAtxYJLCS6HDc/zkdaUCNNzwPcVx3MzsymR1h+sDeUufQ Uy3VYud/5aejRaZTdD/32vo2NSlJWAW84IRH8PCnjFkkYizOrKrsWA227ehw9JePqHau D4JlYxKw7sDyg6MMdFZdvycq15Ta4BVMzEqyqd2l77y02GI2MFZM0G+A90eev6x+LXUY mqcBj6RA1Q9n+b6JW02D839qE6tMQLWH0CkC7qraOradDjgU4Xuf0UVAXjM99l7kozi2 cEqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=LAi4Phx4zJIv5czTnjp7qfVqpLswgjFu+zJ/rvYB8Lk=; b=Y9ntu7oacs5UJ7YNu8cpFSdLSg3qXz2RV8RZy7SkT6Mp5TdPIiSvxONBkCay0ch0v9 d0JE7vlYEHAOzxR4lIlD4EpMfvDOSFD8ox0uLl+T2C352eHdx6jzRX7PAl8g3TmOxQOv XQBxAWcUvQdLaNx3f0QmIaWQ+22CcF4WrNzISThdqR6mZJbef7kDzl2bfug/ZOwOFKuj cInXUJ7qqX4RRhOcM04qvGXTMnrUmnWnA6WGyT4ODtRTrnq2ANH4BD0z9yr6QDtzCNVN Qhn53ODwsPHgyuS+BdQYlcCf4DM7G1LOHqwCSJKs6iqXY5oAhRj6GS6FgGWXECQdVdlX RYJA== X-Gm-Message-State: AKaTC00vVPiKF5RU/HmonEX1Wy9eFozUACnEds+Y+Y8Ic2aZnJIcUk10KQ8/qVPh+JTJDg== X-Received: by 10.99.185.84 with SMTP id v20mr58497638pgo.98.1481419151855; Sat, 10 Dec 2016 17:19:11 -0800 (PST) Received: from linux-siqj.site (c-69-181-250-163.hsd1.ca.comcast.net. [69.181.250.163]) by smtp.gmail.com with ESMTPSA id 4sm67162220pgd.32.2016.12.10.17.19.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 10 Dec 2016 17:19:11 -0800 (PST) Date: Sat, 10 Dec 2016 17:19:09 -0800 From: Yinghai Lu To: Bjorn Helgaas Cc: Vaibhav Shankar , bhelgaas@google.com, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, venkateswarlu.v.vinjamuri@intel.com Subject: Re: [PATCH] PCI: pciehp: Optimize PCIe root resume time Message-ID: <20161211011908.GA10954@linux-siqj.site> References: <1481323406-12865-1-git-send-email-vaibhav.shankar@intel.com> <20161210002744.GB8381@bhelgaas-glaptop.roam.corp.google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20161210002744.GB8381@bhelgaas-glaptop.roam.corp.google.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Fri, Dec 09, 2016 at 06:27:44PM -0600, Bjorn Helgaas wrote: > [+cc Yinghai, author of 2f5d8e4ff947] > > On Fri, Dec 09, 2016 at 02:43:26PM -0800, Vaibhav Shankar wrote: > > On Apollolake platforms, PCIe rootport takes a long time to resume > > from S3. With 100ms delay before read pci conf, rootport takes > > ~200ms during resume. > > > > commit 2f5d8e4ff947 ("PCI: pciehp: replace unconditional sleep with > > config space access check") is the one that added the 100ms delay > > before reading pci conf. > > > > This patch removes the 100ms delay.By removing the delay, the > > PCIe root port takes ~16ms during resume. As per PCIe spec, we > > only require 1000ms delay. This delay is provide by > > pci_bus_check_dev() function. > > > > Signed-off-by: Vaibhav Shankar > > --- > > drivers/pci/hotplug/pciehp_hpc.c | 2 -- > > 1 file changed, 2 deletions(-) > > > > diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c > > index 5c24e93..08357e7 100644 > > --- a/drivers/pci/hotplug/pciehp_hpc.c > > +++ b/drivers/pci/hotplug/pciehp_hpc.c > > @@ -311,8 +311,6 @@ int pciehp_check_link_status(struct controller *ctrl) > > else > > msleep(1000); > > > > - /* wait 100ms before read pci conf, and try in 1s */ > > - msleep(100); > > found = pci_bus_check_dev(ctrl->pcie->port->subordinate, > > PCI_DEVFN(0, 0)); that msleep(100) is from that commit: - /* - * If the port supports Link speeds greater than 5.0 GT/s, we - * must wait for 100 ms after Link training completes before - * sending configuration request. - */ - if (ctrl->pcie->port->subordinate->max_bus_speed > PCIE_SPEED_5_0GT) - msleep(100); so we should put the checking back. Thanks Yinghai --- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c index 026830a..1b0fc0b 100644 --- a/drivers/pci/hotplug/pciehp_hpc.c +++ b/drivers/pci/hotplug/pciehp_hpc.c @@ -311,8 +311,15 @@ int pciehp_check_link_status(struct controller *ctrl) else msleep(1000); - /* wait 100ms before read pci conf, and try in 1s */ - msleep(100); + /* + * If the port supports Link speeds greater than 5.0 GT/s, we + * must wait for 100 ms after Link training completes before + * sending configuration request. + */ + if (ctrl->pcie->port->subordinate->max_bus_speed > PCIE_SPEED_5_0GT) + msleep(100); + + /* try in 1s */ found = pci_bus_check_dev(ctrl->pcie->port->subordinate, PCI_DEVFN(0, 0));