From patchwork Mon Aug 15 08:36:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ley Foon Tan X-Patchwork-Id: 9280447 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 822B860780 for ; Mon, 15 Aug 2016 08:52:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 71AA628BD3 for ; Mon, 15 Aug 2016 08:52:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6642A28BDA; Mon, 15 Aug 2016 08:52:07 +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 02F0F28BD3 for ; Mon, 15 Aug 2016 08:52:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752787AbcHOIvw (ORCPT ); Mon, 15 Aug 2016 04:51:52 -0400 Received: from mail-bn3nam01on0055.outbound.protection.outlook.com ([104.47.33.55]:22064 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752073AbcHOIvt (ORCPT ); Mon, 15 Aug 2016 04:51:49 -0400 X-Greylist: delayed 7978 seconds by postgrey-1.27 at vger.kernel.org; Mon, 15 Aug 2016 04:51:49 EDT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=altera.onmicrosoft.com; s=selector1-altera-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=CRpDwXs7IlSXbbV9KckRlU4DVl0ougv0gaitrL78b4E=; b=WMv4Sfi4eKUynD5D+CnxFs5b8sVYY1dstdw7hFoZ/kPqT6/uLCmEASGEqxhbwUPJw3goeQJ/DyWbf2/j5SZhJuKLsuetSG1AMfvMjc6133CjE6vcr0NA2KiJsANqlbNQpyrdJTXx01CkHm8SV5BFCH9jdcRsFdc9FUiQWKJh6Ng= Received: from BY2PR03CA072.namprd03.prod.outlook.com (10.141.249.45) by BLUPR03MB168.namprd03.prod.outlook.com (10.255.212.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.549.15; Mon, 15 Aug 2016 08:36:33 +0000 Received: from BL2FFO11FD020.protection.gbl (2a01:111:f400:7c09::162) by BY2PR03CA072.outlook.office365.com (2a01:111:e400:2c5d::45) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.549.15 via Frontend Transport; Mon, 15 Aug 2016 08:36:31 +0000 Authentication-Results: spf=softfail (sender IP is 66.35.236.227) smtp.mailfrom=altera.com; vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=none action=none header.from=altera.com; Received-SPF: SoftFail (protection.outlook.com: domain of transitioning altera.com discourages use of 66.35.236.227 as permitted sender) Received: from sj-itexedge03.altera.priv.altera.com (66.35.236.227) by BL2FFO11FD020.mail.protection.outlook.com (10.173.161.38) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.567.7 via Frontend Transport; Mon, 15 Aug 2016 08:36:32 +0000 Received: from sj-mail01.altera.com (137.57.1.6) by webmail.altera.com (66.35.236.227) with Microsoft SMTP Server (TLS) id 14.3.174.1; Mon, 15 Aug 2016 01:35:33 -0700 Received: from ubuntu (pg-lftan-440b.altera.priv.altera.com [137.57.162.74]) by sj-mail01.altera.com (8.13.7+Sun/8.13.7) with SMTP id u7F8aMKE027311; Mon, 15 Aug 2016 01:36:23 -0700 (PDT) Received: by ubuntu (sSMTP sendmail emulation); Mon, 15 Aug 2016 16:36:21 +0800 From: Ley Foon Tan To: Bjorn Helgaas CC: , , Ley Foon Tan , Ley Foon Tan Subject: [PATCH] PCI: altera: Retrain link in rootport mode only Date: Mon, 15 Aug 2016 16:36:19 +0800 Message-ID: <1471250179-24198-1-git-send-email-lftan@altera.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:66.35.236.227; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(2980300002)(199003)(189002)(68736007)(8676002)(229853001)(105596002)(4001430100002)(87936001)(356003)(626004)(8936002)(92566002)(106466001)(86362001)(586003)(50466002)(19580405001)(48376002)(5003940100001)(189998001)(42186005)(47776003)(33646002)(110136002)(7846002)(50226002)(107886002)(50986999)(19580395003)(4326007)(97736004)(36756003)(81156014)(81166006)(305945005)(2906002)(7099028); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR03MB168; H:sj-itexedge03.altera.priv.altera.com; FPR:; SPF:SoftFail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD020; 1:v4svHmp8OlbUSixy8KLOKN5+Dy7BEPLiPc/M27xQ/l5Sv4eFRBJHzz7vVNWtFDJL22InCUl5PUWkEHvXcyAkY6hsf7o+xaHS71Cs8LPotrcp+wxNe8ysBw19f9Eiup8dHs30xdlF/mA5AFo6PHQ6IGeDwoM9iitdQ280OuW9NrJIXrXbGAjxllcRB+qNMea6A2pkhvZDzVFbvagFIiYqpR9JS73QG+MbvypSsx220ncd1O0v66cFR+4oXSHbM+vewwwaL/etVB6gf8wKjZy/vBSyoDTVvyIettic02LGWHZUgbANzabr3Rn/hDIwQIjdEfKvd5ZlcHBbNFPqx5Zu1YxqAElNHHYBS+2Vqf8bQVPCdz8wncBnOvqCYuP/T9dJ5ukjDDv1ScJ4xRQHiUkdAH0uulnoxahfh6RwERQ/3Z7pGv5N/HpgmBv0rBH7YT+5S25gyEvERXXHEBytPXMccYJLNtWsHhxwYK05g3iSLcjrv8dwlsVJnNRe9cfYhStWWuYovSz2gvJSjk/uuq/5ji+1k0c4VDpQPzWHQwf4YswSPpD1YznDjZRzgv/Jt9Jn X-MS-Office365-Filtering-Correlation-Id: 23087918-cf2d-4c20-d45f-08d3c4e742ca X-Microsoft-Exchange-Diagnostics: 1; BLUPR03MB168; 2:fsOzgwVFcoZIHYb8HpQ7KnXjnFVLFkENWYT3tR6P7jqHqyakP67I+ve/x3XQQBvxIi1PD17w+CZ8KXuiiNHqLYuZuFJDrHIDMDdcXXIO1es1+QHVPJx7nP7o6tCYWbn7L6y0ZrSA3xeT3AIb6Yl3X0a+pR5CrTeePiOsKI01d2/SmhU2aojfXRfNBo6cuXpv; 3:iplIEAT7MIdbR4/r1/yuAPloM3aruBgFuXo7zyO5UM8SJuhJkI3dMiN107yRP6/puHpPLZSLvprUbqDPYx5+GiRZd6EioJOCleLiSLb9QCGtX/JrWiyLWJr1QI3sS90JXRiuitrXQNA9ptcnoD77+gxihCAqhIkf2qI+WWXU/pjPjKwV7laGlboyHN9m5hoE9u2kCc+MJ3JZruw+g4Rh+6DIQ4nqQ3Cn4EfCZ1XC4dU= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR03MB168; X-Microsoft-Exchange-Diagnostics: 1; BLUPR03MB168; 25:cxRm80oLnfFUfD/JfQ3b+fs5PKhlb+OjacZXSnpIKSWlECHwUsWQe3/y+pbMvnJUGCXe1oR6ebL8g0tv4SabWYTjQh/Dm9o8nyjM15sfT1JxM1mKLKpmCxAQ902BVpER5FehE0WBXPMkbZTn4TptG/JNr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WQA/nWgSacqy0=; 4:feQ0bMV50dJygew2QphrXBLAT9pFHifcJ8i13AcEeiGysTN+IAxsuhObu6sj9uN+8j70DT2+1SNnpr5scc5TMs60HLpLkxFUiwxWy3iksqD1l72Y+CmszY3CxhFouGQHSXxZfwUZF2Xrq3vAd+3uij0CCIWL71ZjvYMxcMbrAKWRpIItlkZZivxuBgY/kuTELX31EIY6tXHZgdsQtSz0/YDEp8xKhciqJk5u2BfOkGRA//OHn6TnEpLY7Q1QdcRqPlSsrqiIRq7wlC5zpEPfpm6Ojn4daj9+mYfi19cUYAg1ceJKW3RxxiXDsHrnMQRQb03mEJio8PNdJsxLjfKETmZTI/3RZTTI7snDL5LxStHU7D/gwBZilLOHqHvoWkroHlyxgvRfNdw2ZGpd3Tq98MAz2z63gynuX71lCv63wYpu68Sz6giomD5EG4TEndoHr1W2JZVC5M7XrcvD07AFuUN6CkRj5gougPWrknH1FFZfaCxwDaJC4umFKQbNjkjZC5bO7dm2Fwl Eny+sQxwnorzlU04QotpbSkdAmkbntKk= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(80048183373757); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(8121501046)(13024025)(13017025)(13018025)(5005006)(13015025)(13023025)(10201501046)(3002001)(6055026); SRVR:BLUPR03MB168; BCL:0; PCL:0; RULEID:; SRVR:BLUPR03MB168; X-Forefront-PRVS: 0035B15214 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR03MB168; 23:ebbYK+sDwKsiFwA0dRR97siPr+wxx7GzOop86PQDLO?= =?us-ascii?Q?09ZrfVEXZgT8psaxy5OAO+3OKAt/mlIM7zFqoDczEilrBdtG3yNg6EIXtRuF?= =?us-ascii?Q?yb5iha15HWXTYLaTqgFBPtGmhVkqm4NCowpnWWvCwO4UzVcsUJKONFBZ7Trk?= =?us-ascii?Q?j2Xp+GKasCgPs2TazAh+n7oFc3S7vW4t4518m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DTjmpAGW800hPAsNsjPdySi0mJZpBIgqe2MTELMOa4aFj0Gjxt7f5Ez14+NgeHBlIPPA8+X/rQep5qsOUCC1KKHqXIu+TnfuU7VAAk/0cLvr75r/W7TcbXcZkAsezH3AteWaOUxT56udp30W+ipf7Je903PoNT7+NIwxOksIs5L+hWGqRTsOpwdcnWQ1ZA309sKpHdFIhyypmydF1j/x5NG1leyAYWFS518yyKrxRe8X49svqL9YY6zeIz4BTj5WDxcoe9QLsP38Dnf2MATQJjdvnQXOZ/qVgXFnJt/nJrNJlcWLFlfv8Ag==; 5:WaDknShf0T4Qy3Ilu0o6/LJpZOxkAxVmAnSwWtu8CGoyhk+w8BnIN4yQbxB2lZRIrAb33Az5XDtbjZMmNSy7xBV4kYIx0dOk6myfc+O7UkJuXoRp9CvmVxjtYK2ZaCJNlBXggC13xWMny4Vx7S/sNA==; 24:Da/YvPbRs/7WBE0JkH3hAWkHUw+wviAxrd5S9rdbfC6EGr9G2c9JonC2V+91bTl/pKm3NcNbTZhFusnADOJAiiz2LK/hGI8iXSWVFYxX9Xw=; 7:drPuTf5vM1PAlFBVsudi82agZ1YYEw2J7u3NKBwoHNoyfDC3M0AH2vt6R4cOS0AdoBo977+bMLN6ZdEffcnqbWtZrRZ5+Z6fxBlDdviLbxtzqYDaOHdqIQkA0mZE48vf4K9UrP7t6c2s3MzwvkCajst8ZWXVHEVjYNoojtg8OAUQVN09kEhyTikCeCtyWADcLt1Z8KLELcVQPePeWxWe0ipwaOFuFAu154J5rA5C/M+987YBwBjAXJoCS9KmSMCV SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: altera.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Aug 2016 08:36:32.3018 (UTC) X-MS-Exchange-CrossTenant-Id: fbd72e03-d4a5-4110-adce-614d51f2077a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=fbd72e03-d4a5-4110-adce-614d51f2077a; Ip=[66.35.236.227]; Helo=[sj-itexedge03.altera.priv.altera.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR03MB168 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 Altera PCIe IP can be configured as rootport or device and they might have same vendor ID. It will cause the system hang issue if Altera PCIe is in endpoint mode and work with other PCIe rootport that from other vendors. So, add the rootport mode checking in link retrain fixup function. Signed-off-by: Ley Foon Tan --- drivers/pci/host/pcie-altera.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/pci/host/pcie-altera.c b/drivers/pci/host/pcie-altera.c index 58eef99..6477738 100644 --- a/drivers/pci/host/pcie-altera.c +++ b/drivers/pci/host/pcie-altera.c @@ -139,6 +139,9 @@ static void altera_pcie_retrain(struct pci_dev *dev) u16 linkcap, linkstat; struct altera_pcie *pcie = dev->bus->sysdata; + if (!pci_is_root_bus(dev->bus)) + return; + if (!altera_pcie_link_is_up(pcie)) return;