From patchwork Thu Feb 25 07:04:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "M.h. Lian" X-Patchwork-Id: 8419811 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 2D0489F314 for ; Thu, 25 Feb 2016 07:18:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 60A29202E9 for ; Thu, 25 Feb 2016 07:18:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 26CA3202E6 for ; Thu, 25 Feb 2016 07:18:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756834AbcBYHSx (ORCPT ); Thu, 25 Feb 2016 02:18:53 -0500 Received: from mail-by2on0097.outbound.protection.outlook.com ([207.46.100.97]:2752 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754819AbcBYHSw (ORCPT ); Thu, 25 Feb 2016 02:18:52 -0500 Received: from BY2PR03CA003.namprd03.prod.outlook.com (10.255.93.20) by BY1PR03MB1499.namprd03.prod.outlook.com (10.162.210.145) with Microsoft SMTP Server (TLS) id 15.1.409.15; Thu, 25 Feb 2016 07:03:06 +0000 Received: from BY2FFO11FD006.protection.gbl (10.255.93.4) by BY2PR03CA003.outlook.office365.com (10.255.93.20) with Microsoft SMTP Server (TLS) id 15.1.409.15 via Frontend Transport; Thu, 25 Feb 2016 07:03:06 +0000 Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=none action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Received: from az84smr01.freescale.net (192.88.158.2) by BY2FFO11FD006.mail.protection.outlook.com (10.1.14.127) with Microsoft SMTP Server (TLS) id 15.1.422.5 via Frontend Transport; Thu, 25 Feb 2016 07:03:05 +0000 Received: from lmh.ap.freescale.net (lmh.ap.freescale.net [10.193.20.68]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id u1P7322o027048; Thu, 25 Feb 2016 00:03:02 -0700 From: Minghuan Lian To: CC: , Roy Zang , Mingkai Hu , Stuart Yoder , Yang-Leo Li , Arnd Bergmann , "Bjorn Helgaas" , Minghuan Lian Subject: [PATCH] pci/layerscape: fix MSG TLP drop setting Date: Thu, 25 Feb 2016 15:04:30 +0800 Message-ID: <1456383870-23302-1-git-send-email-Minghuan.Lian@nxp.com> X-Mailer: git-send-email 1.9.1 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131008573858757116; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD006; 1:mHCfaHEJmk2UCCv6DtJ23YBtbo/f94hxIn8W9A7ZfPI6aJ4s2fKw/G6sYz5IVHZSoqdKUJjekL3S/CdZdgWZZdMaKnXyEDLo7SiH0GeMvafmSWg85aROQPSSbgIJdR4soax9w/RQipZ0h/quwrTwfbuXXh0pLrisCt+GyRPQEUYDqErFLFye3BQvx2o1k5MBi7SGYnJ27AFUghTwWUGMNZHNaOeShR9udlURnrcaMREfa+uw0qtG+sFxsBsw1Qh3H5qNZe0V6NeG2D9uGgHfGbIk94fCeUMHwO22bZrdfRVvapxYIlYK2+OrOOWZ+nvbNMC9zQH1L/coGXJcPL0AVvYoOIoHCh3xG6sDZq2tcYF3wPrwttjtGJqKj91kScwPp8SVgvDhYLkFV+/wF9pTkzajZhZ+Ox8sh/Vt3RYVzsF+6Qz9Tdrgj+sWqdD9REdzcHgpHOzA0Ik5ch+Y7PeVb1VIGncGp9IsMR7qL5z5IfVqLgp/JJFXq6xQSbxb1n+ZeGVxHAQFNa+a285q2asOP7Rl92L25Oca3IfEx3x9m99xOUf3vnhc1ZkxdO9on8/EWBMPIO2TNs2nlJPxfpHztw== X-Forefront-Antispam-Report: CIP:192.88.158.2; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(105606002)(85426001)(77096005)(5003940100001)(36756003)(104016004)(47776003)(87936001)(106466001)(86362001)(50226001)(5008740100001)(1096002)(1220700001)(586003)(6806005)(189998001)(5001960100002)(19580405001)(110136002)(48376002)(11100500001)(92566002)(2351001)(4326007)(229853001)(2906002)(50986999)(50466002)(19580395003)(7059030)(217873001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY1PR03MB1499; H:az84smr01.freescale.net; FPR:; SPF:Fail; MLV:sfv; MX:1; A:1; LANG:en; MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 8fb89cc7-83bc-4817-b9fc-08d33db1b5d8 X-Microsoft-Exchange-Diagnostics: 1; BY1PR03MB1499; 2:2krhEr3a4R1Co10aFJCbwHDysTohb/mkPXu60lQgEmqgj5fQrrSM3SA5liDTVbyCG4RHVmFjva87EWa233ckYBQA7T01XkCUUOek0K9acg+UZ8xTBLkH0dWGtZX2LRnvtrx4UjHFTeieEhmgvhLkhvJAzMUqLP7UMnXWw2MEbo7GyMsrLfR9hEF+neXC24gL; 3:iSknBLITjYYgmIRol7UXYdRoOSPPp+FnkjQRC/EPsoFOEbQMN13GJAiSu6gBHj5NjZIa4O1OkCpNfm1zsHQgJPQHSFtwB0PpY/bDIyRDVR75XEnz36lZSeQIukIZ98aw2SN+M4t1FT4+tRKF08bNThwQNDvYM5QYyCmQLRBYo/dBTBSOInU56Chwp+GBm9LZh/cPuSJgGUj0vppjb+41SyD74E26WnwssGA3/3HFjgQ=; 25:uwTASOjTVX2idOcEdP7CZXqg+xbSDAJHA+tJtL/4NZ5F80AKlu2n1Tv3kK9VmErQMoDhsEgNVUbckcF10klm8u1J8oplc0AOUuhc7dlvNOOWXQz80iPA7daztC5SRm6eVNes7gG3Te8b9yAzfvx1rvb5Qt6gV6r/nhmTAPsOiJUrZp/Q4Gs8HjafdjKZZ4TJTPougonPFX6dvQvn9igHCBYZce3dciyrv0rHDYB0IB9FRvif5SXIWnmfSItckRnaPgBFPy1qhoIuQYcT9vy8zfGERGbWcZzpLQqygDqDfvSCszGbdFePiuzYTwDxhZallFDzSfsGbpb4l1QOSPL6dQ== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY1PR03MB1499; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(8121501046)(13023025)(13017025)(13018025)(13024025)(13015025)(3002001)(10201501046); SRVR:BY1PR03MB1499; BCL:0; PCL:0; RULEID:(400006); SRVR:BY1PR03MB1499; X-Microsoft-Exchange-Diagnostics: 1; BY1PR03MB1499; 4:F8ubYLp56EOwTb3GOeLLV5kAXJ24s9Yq3xbLcR1emzKYsUQ37R/DgbnP75hZQJYei+g77afBWk8ow/OVHmDzK5KxnGX+Tic9T1w7Ff3wIaEL5k4gD0thg2eelDF4guvOAJev2TEID5VRi6+UQnHPByu8/dM3x5kGotHRNNwEE4UGND7W4EJLMJ0Ildf2wPDgB1V6sJ60Quxg15L5CgHoXVAD90EkLzNIv8y3Af2YKcyQCknx9nJwZ/et8bvu/a4eD1NSHanU66Qo9mqU2NSGrtZqL4K+z2TK7J0aAFA6XkSw4kIHGCT1+moKMi1THV4QDKLokmh17dxRsqqwMHpwbyo95urEfej3nETP6f0GSdQnsywgRe+tgHfmF4ywt2z+3TYPTS/Fx79jtMrLp+NLoNgN7oFMNFdmlkEfSnN1HGXwb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T8lzBwzrEO2K6Y?= =?us-ascii?Q?/Rdeq1R63J4ZZsy0DfOqynVSnTrFuPV4Wk+lx/p7sJ2qzjbrhmwGz7cyzGnw?= =?us-ascii?Q?xdAfeVZOGwFmoL6OBDxPa6QwKBEwiECYdCsWJk59ua97wVuj1dCT8NMieKxP?= =?us-ascii?Q?YTFpFoVOzOXcTQKgmDQxylrFsm6iaRwIawW+Gaujt00saXnB+S8Sxa0QYUyl?= =?us-ascii?Q?IVTy36oS6671JDPA5GqIotu2tAtTCTOm1BPS/GqNu2qqJp75FdAgKSQEUQw1?= =?us-ascii?Q?wy+gSS0sfdUNftZxdoCSsGm1KJv411PB2Bz/bpw7PYEFA=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; BY1PR03MB1499; 5:rXAaGZswLaAI3F/SK6Dr9itSK+cxaOeQJHbf5vaIPfimPhU/pv7wWZdXtN9ELLqqphGGb7FnGuLZWJZJ+Bp+EZejDuYBOC29KfzmVAqhsaIVqinGNd83LWEaMsLHqmE6nxpDL70QTvvM8nTCtOZbqhs2UOkqEvSB7TJM+TCoMRk=; 24:wMjkgVMYlXToifqCXOtbks8I51eTL5uDJ3yYgSA2Rm4bBE4uRfexCE7InBz2QWM7rVlmCmY39B62zlRR3CfbBdpxtg1lUiDIomINLTZNu/w= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Feb 2016 07:03:05.7665 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.158.2]; Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR03MB1499 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Some kinds of Layerscape PCIe controllers will forward the received message TLPs to system application address space, which could corrupt system memory or lead to a system hang. The patch enables the MSG_DROP to fix this issue. Signed-off-by: Minghuan Lian --- drivers/pci/host/pci-layerscape.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/pci/host/pci-layerscape.c b/drivers/pci/host/pci-layerscape.c index 3923bed..f39961b 100644 --- a/drivers/pci/host/pci-layerscape.c +++ b/drivers/pci/host/pci-layerscape.c @@ -77,6 +77,16 @@ static void ls_pcie_fix_class(struct ls_pcie *pcie) iowrite16(PCI_CLASS_BRIDGE_PCI, pcie->dbi + PCI_CLASS_DEVICE); } +/* Drop MSG TLP except for Vendor MSG */ +static void ls_pcie_drop_msg_tlp(struct ls_pcie *pcie) +{ + u32 val; + + val = ioread32(pcie->dbi + PCIE_STRFMR1); + val &= 0xDFFFFFFF; + iowrite32(val, pcie->dbi + PCIE_STRFMR1); +} + static int ls1021_pcie_link_up(struct pcie_port *pp) { u32 state; @@ -97,7 +107,7 @@ static int ls1021_pcie_link_up(struct pcie_port *pp) static void ls1021_pcie_host_init(struct pcie_port *pp) { struct ls_pcie *pcie = to_ls_pcie(pp); - u32 val, index[2]; + u32 index[2]; pcie->scfg = syscon_regmap_lookup_by_phandle(pp->dev->of_node, "fsl,pcie-scfg"); @@ -116,13 +126,7 @@ static void ls1021_pcie_host_init(struct pcie_port *pp) dw_pcie_setup_rc(pp); - /* - * LS1021A Workaround for internal TKT228622 - * to fix the INTx hang issue - */ - val = ioread32(pcie->dbi + PCIE_STRFMR1); - val &= 0xffff; - iowrite32(val, pcie->dbi + PCIE_STRFMR1); + ls_pcie_drop_msg_tlp(pcie); } static int ls_pcie_link_up(struct pcie_port *pp) @@ -147,6 +151,7 @@ static void ls_pcie_host_init(struct pcie_port *pp) iowrite32(1, pcie->dbi + PCIE_DBI_RO_WR_EN); ls_pcie_fix_class(pcie); ls_pcie_clear_multifunction(pcie); + ls_pcie_drop_msg_tlp(pcie); iowrite32(0, pcie->dbi + PCIE_DBI_RO_WR_EN); }