From patchwork Fri Aug 19 08:24:38 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: 9289867 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 C89F2600CB for ; Fri, 19 Aug 2016 08:40:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B8DAF28E63 for ; Fri, 19 Aug 2016 08:40:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AA0FD291F1; Fri, 19 Aug 2016 08:40:01 +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 13DB728E63 for ; Fri, 19 Aug 2016 08:40:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754187AbcHSIjH (ORCPT ); Fri, 19 Aug 2016 04:39:07 -0400 Received: from mail-bn3nam01on0064.outbound.protection.outlook.com ([104.47.33.64]:61811 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753911AbcHSIjF (ORCPT ); Fri, 19 Aug 2016 04:39:05 -0400 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=U+OnU0QNidFZR519uxCjU10J1XaRZ0v3fQEMlXYpD00=; b=LR+zSckD8Yim/55X3mUNwphbQiINDryl+7xlnf5QEOvxiCAWn+Ccw15L1Qx76UAVSIHsbsli8T46Jrgclb/6PK1g/qHPDj5FR2LyW97SRrRuoU2eHPzdmnUMqENoZZjyioqYJJ/0XR2C1sNlCXz/DFrns7mH9DwYyPpvlNIVzdo= Received: from BY2PR03CA057.namprd03.prod.outlook.com (10.141.249.30) by BY1PR0301MB0902.namprd03.prod.outlook.com (10.160.195.141) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.549.15; Fri, 19 Aug 2016 08:24:50 +0000 Received: from BL2FFO11FD013.protection.gbl (2a01:111:f400:7c09::124) by BY2PR03CA057.outlook.office365.com (2a01:111:e400:2c5d::30) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.557.21 via Frontend Transport; Fri, 19 Aug 2016 08:24:49 +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 BL2FFO11FD013.mail.protection.outlook.com (10.173.160.221) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.577.8 via Frontend Transport; Fri, 19 Aug 2016 08:24:49 +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; Fri, 19 Aug 2016 01:24:45 -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 u7J8OfdZ019495; Fri, 19 Aug 2016 01:24:42 -0700 (PDT) Received: by ubuntu (sSMTP sendmail emulation); Fri, 19 Aug 2016 16:24:40 +0800 From: Ley Foon Tan To: Bjorn Helgaas CC: , , Ley Foon Tan , Ley Foon Tan Subject: [PATCH v2] PCI: altera: Retrain link in rootport mode only Date: Fri, 19 Aug 2016 16:24:38 +0800 Message-ID: <1471595078-26297-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)(8936002)(626004)(97736004)(586003)(106466001)(356003)(7846002)(68736007)(42186005)(19580395003)(33646002)(19580405001)(50466002)(36756003)(50226002)(86362001)(81166006)(81156014)(305945005)(2906002)(8676002)(11100500001)(110136002)(92566002)(87936001)(5003940100001)(105596002)(48376002)(107886002)(50986999)(4326007)(189998001)(4001430100002)(47776003)(229853001)(7099028); DIR:OUT; SFP:1101; SCL:1; SRVR:BY1PR0301MB0902; H:sj-itexedge03.altera.priv.altera.com; FPR:; SPF:SoftFail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD013; 1:K2ROYZKLuNI3aB0x8osVLt3sSU7iLZGfW1S+J35Bzzqf85ijioZIrqmh6zM7WYuOtHkfGZYHsGDHFA5IRBoXQSPL9HTuvbs/ibIQCG/giPGi07+GxCwN9OpBPhAIk8+YBWIJHf/gimSp2Jg8cQ4rDCBtgMIRw8FvyR4r9mTIFlLt5t3ZUzhEv1yCjK7uQKSB3VT64urMMLPvoSJvT07LZQNVde3wqAEZEDir7BvK+vA/K+5kuMqxAGE6PeXB0D3tPED3N/1pdh1vUN9arcvz+Yl097UhlRHYamE4aQn8rKfReUejDqx7STfeQwWOVFp4yIPBlHp3sZk5tnv5ZjUUVfTFer4u3vJ/kiuzjage+1Nk5T3KxgXg3rELleFpnRKNeaF2gBBYf5TD7WrVl1BMX5wIlvqbkgEEZOWOZBvi6SO4V8E/8z7Lb2hLoGhDYY/37v+OUg+D1oIb88v6wxQ0pW2dXv+3sCHPGvin6EDbE5DD5QnPPu3Su1AnQer2ta6wwTuj5z1Xl+XBhN+eW5fp75otTBPdocOg59jlf4erScQwX6iF0TuJ7MwVgqnDIBKZ X-MS-Office365-Filtering-Correlation-Id: dbedab2e-5da3-4828-985d-08d3c80a497f X-Microsoft-Exchange-Diagnostics: 1; BY1PR0301MB0902; 2:ffY7F7+pR2pLe0i0uvd52I3SJ0MNVpwkVpdwf1JYIc+UiCff7sQtx4LOne/fu3xEj1gjhd39VWeI0gcsK1wVV2ibMA90QwRyWoZ6K8x9NkR6K8g80yqpx5vNggjJ69aGr3RQ+3cMu18uP8+PRIqWNdC0KzGWP9/6o2WCRrpIXakTt4xOaIcL9NtOJYP/4Rd6; 3:pI+ZsI8gUoOdr65GNJLP3a9WerkAF7VF1cDhER3d9nRurPFCdJ5ld6+tCiO2kN58VahmHj+1Aup+Fho1EHPyoWn0sWwhOac8XYz7cPv31Bs1Npfb7/MRddGuH9Bg9YlcAk7TtTgjkN62zCYc2DhSnpywq9QKDQxF05uR1ZI8nPRyffZM/TzmTeHniRqhWoHtGJ5xKaX8qbWvU4geHXRtP6zUOUdpYIOghOxvowKoUXo= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY1PR0301MB0902; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0301MB0902; 25:y2aAEOHRm3Y/vnGOu01FzTeJIPBDDS9Tkm14LV7ZuVTIvBLmin3KXP+MY12o0LxkONxzVbJ15v3asO5YJwT1CdpLV68OzSAUObmd4pySAX6FaTLq3LlexGCSrwaCWuZaUJY0eWE6Q6SsjizKOQy/Bne+kYHRzQm5rTyUNPI6Em3dMC73N67j0DJySQAH9MnsQs3Ux1QVHtj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iNg49UDDDjPHg/oxROeSK2C6DUsON8B3miK6t4y7ky9bSCibjXsAw/0Cs5pGID+VxkgQd/ZJTrQRHOpwqMIDWQgIWP/I/jJxtdrdLrb/G/Wtm2/ucToQ4I3tPTdDSmA2eg9q/TNY5I7/5Zvd9ldqQQuz3CalydSPADXuqvFVHsjtjtm0eXY+ijKvpCOPSgQEbCkrvP4IWbKyKGeKL2mYJofORQnPjRiM7YBUZQnTLvyFgEUYIX2YrEXyxkPiDMDFQ8T2nTzmN4ric64tRV5FK3wQ0J3ggobuhoETZe0EjHhcuuJ9Iu6E35pz0R1a33u9OOmh+NvVGLxF+Vk+y8XcrHS31LjOvDgCaE19pBsN7JoKdgVyi6dB8jbJI+9suOmmDYCmzxirEcS26Fpkku2A7CFLvMqF+GCtcinMWwkFY1GJhkAG+JQBBsDkEj6mkdNfdPmD5j1Jx1859cdiqa4VolGI74dI0dOSQcorIC lyR+z7NONJtNBYGVRdyZSINyLMIlia7oQo4= 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)(13018025)(13024025)(13017025)(13023025)(13015025)(8121501046)(5005006)(10201501046)(3002001)(6055026); SRVR:BY1PR0301MB0902; BCL:0; PCL:0; RULEID:; SRVR:BY1PR0301MB0902; X-Forefront-PRVS: 0039C6E5C5 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY1PR0301MB0902; 23:ZoqdR6zzCiGZKA1I0Zg53ViEAo/7KhoAPcCM96k?= =?us-ascii?Q?KmZb7yTeP6O35CvexCYCoi6VvKRmzdg0gyRhMGOGdLu7KhgQru3hSnVBTHyQ?= =?us-ascii?Q?q4sYpNhLWs/gK8bQTGh0b60uxoDaDaJCLsHqYD9r7bd1eCKb28YyyEcyUOZs?= =?us-ascii?Q?DgTng3s1CMnl3LcapiwaoqmfrWywUfbi04quJ19j0vFMUE3GgYw1PWuZCTII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i38o28vyKylvVayjlOZDG/5wkOwQNxy7Fz7WC7CsdA+2cI9lTpLcKLEkBCBL8b7lhnXP9OLbSb5+smM7phzRRhqUFhheyyrGXMGx/FKvWvQskqVqnqVkPHcgUbjgMgTw+DQTqjbCuvPS88hYIgty47SDH7SXl0O8fVtv69+O5PzP6AXjywiN+xSLhGTLqa0CkXcUkpCd7tXLr7RflBl0lSjRCY7Ne9sOPdgsm1jBeMoShFWpZqPLzESKf8Mauu5hynjd2tPby3KvraXVKfED+0DyPjkJ5EajgBQm6lXdWjJd6HISSHE5/vUA==; 5:SiuNFxpXMRGer/JAamqqnAbEK2cMf8TO64+amj+s3M2Td08ULINk6nhkPngMb21AjNtN8KofbZBT96MC+Y6erTUP7yfq2Zr8I3coMEbth/RVDZkgAQyhuiyBKLkC9HxHsMH4CvEaMq2kr5sOotZxPA==; 24:TsAe+A0cGRc1jcNAc75J+ps0LM/3KngTzCP3HbelsLt2X3IgnvBcKsh05HyYO+Pca+3URHbKCEW0wsSRswJQYkclQez7xoC2kYi6viPCXmQ=; 7:A7lZjVXfiC8Bk0byncZwyxn18AwJtONlRpPvMDUE7+7uo/8b/olN/CBqHA7wNkYEwiCVryeSZf1ccWS8VPWioGOF3C70n8/7X90iW7v8ZsWfBCRTEFqE6j/Xw+gylAw8HmBn29uE5XUzgZ9rQQq+/ZTU+t4ZETMvsskqWVzYxV3D7wkDtzfqSBt3pdyT4/F/BnuUs1d9kx2p+DWlGpY/GsPAefYF8EnYc78HFflVbRWm4KAviuF3PokUl5jefM2L SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: altera.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Aug 2016 08:24:49.4110 (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: BY1PR0301MB0902 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 --- v2: change to check PCIe type is PCI_EXP_TYPE_ROOT_PORT --- 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..33b6968 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_pcie_type(dev) != PCI_EXP_TYPE_ROOT_PORT) + return; + if (!altera_pcie_link_is_up(pcie)) return;