Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932426AbcLHUrt (ORCPT ); Thu, 8 Dec 2016 15:47:49 -0500 Received: from mail.kernel.org ([198.145.29.136]:51756 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932200AbcLHUrr (ORCPT ); Thu, 8 Dec 2016 15:47:47 -0500 Date: Thu, 8 Dec 2016 14:47:43 -0600 From: Bjorn Helgaas To: David Daney Cc: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, Bjorn Helgaas , Andy Lutomirski , Shawn Lin , David Daney Subject: Re: [PATCH] PCI/ASPM: Don't retrain link if ASPM not possible. Message-ID: <20161208204743.GA6693@bhelgaas-glaptop.roam.corp.google.com> References: <1479421501-31029-1-git-send-email-ddaney.cavm@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1479421501-31029-1-git-send-email-ddaney.cavm@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1986 Lines: 59 On Thu, Nov 17, 2016 at 02:25:01PM -0800, David Daney wrote: > From: David Daney > > Some (defective) PCIe devices are not able to reliably do link > retraining. > > Check to see if ASPM is possible between link partners before > configuring common clocking, and doing the resulting link retraining. > If ASPM is not possible, there is no reason to risk losing access to a > device due to an unnecessary link retraining. > > Signed-off-by: David Daney Applied to pci/aspm for v4.10, thanks, David! > --- > drivers/pci/pcie/aspm.c | 18 ++++++++++++++++-- > 1 file changed, 16 insertions(+), 2 deletions(-) > > diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c > index 0ec649d..d6667db 100644 > --- a/drivers/pci/pcie/aspm.c > +++ b/drivers/pci/pcie/aspm.c > @@ -351,12 +351,26 @@ static void pcie_aspm_cap_init(struct pcie_link_state *link, int blacklist) > return; > } > > + /* Get upstream/downstream components' register state */ > + pcie_get_aspm_reg(parent, &upreg); > + child = list_entry(linkbus->devices.next, struct pci_dev, bus_list); > + pcie_get_aspm_reg(child, &dwreg); > + > + /* > + * If ASPM not supported, don't mess with the clocks and link, > + * bail out now. > + */ > + if (!(upreg.support & dwreg.support)) > + return; > + > /* Configure common clock before checking latencies */ > pcie_aspm_configure_common_clock(link); > > - /* Get upstream/downstream components' register state */ > + /* > + * Re-read upstream/downstream components' register state > + * after clock configuration > + */ > pcie_get_aspm_reg(parent, &upreg); > - child = list_entry(linkbus->devices.next, struct pci_dev, bus_list); > pcie_get_aspm_reg(child, &dwreg); > > /* > -- > 1.7.11.7 > > -- > 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