From patchwork Thu May 26 06:00:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Po Liu X-Patchwork-Id: 9136653 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 693546075C for ; Thu, 26 May 2016 06:26:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5C53427B33 for ; Thu, 26 May 2016 06:26:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 50D3827F2B; Thu, 26 May 2016 06:26: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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable 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 B7F3B27B33 for ; Thu, 26 May 2016 06:26:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752843AbcEZGZ7 (ORCPT ); Thu, 26 May 2016 02:25:59 -0400 Received: from mail-by2on0054.outbound.protection.outlook.com ([207.46.100.54]:30222 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752703AbcEZGZ5 (ORCPT ); Thu, 26 May 2016 02:25:57 -0400 Received: from BN3PR0301CA0012.namprd03.prod.outlook.com (10.160.180.150) by DM2PR03MB477.namprd03.prod.outlook.com (10.141.85.19) with Microsoft SMTP Server (TLS) id 15.1.497.12; Thu, 26 May 2016 06:10:13 +0000 Received: from BN1AFFO11FD032.protection.gbl (2a01:111:f400:7c10::182) by BN3PR0301CA0012.outlook.office365.com (2a01:111:e400:4000::22) with Microsoft SMTP Server (TLS) id 15.1.501.7 via Frontend Transport; Thu, 26 May 2016 06:10:11 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) 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.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1AFFO11FD032.mail.protection.outlook.com (10.58.52.186) with Microsoft SMTP Server (TLS) id 15.1.497.8 via Frontend Transport; Thu, 26 May 2016 06:10:11 +0000 Received: from titan.ap.freescale.net ([10.192.208.233]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id u4Q6A483009925; Wed, 25 May 2016 23:10:05 -0700 From: Po Liu To: , , , CC: Shawn Guo , Marc Zyngier , "Rob Herring" , Roy Zang , Mingkai Hu , Stuart Yoder , Yang-Leo Li , Arnd Bergmann , Bjorn Helgaas , Minghuan Lian , Po Liu Subject: [PATCH 2/2] aer: add support aer interrupt with none MSI/MSI-X/INTx mode Date: Thu, 26 May 2016 14:00:06 +0800 Message-ID: <1464242406-20203-1-git-send-email-po.liu@nxp.com> X-Mailer: git-send-email 2.1.0.27.g96db324 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131087166114169167; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(9170700003)(8936002)(11100500001)(81166006)(8676002)(5003940100001)(5001770100001)(50466002)(189998001)(104016004)(6806005)(50226002)(8666003)(33646002)(105606002)(47776003)(229853001)(106466001)(50986999)(575784001)(86362001)(48376002)(87936001)(77096005)(36756003)(2201001)(4326007)(92566002)(586003)(5008740100001)(1220700001)(2906002)(19580395003)(85426001)(19580405001)(7059030)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR03MB477; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; MLV:sfv; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD032; 1:37PaRyabGiPY/m0kWCjZPR97QIQM/Wr1ZgVlbE33qMZb//RpJRmVw6Kg8kkR0HqnHTaeqX5RxWuAP4D0p92Ba9gRCL1wQl6UbdjiI/oYcnP2uouPhEpxOkvqrgcKwyDjrRE4u66SgXwVtN+JjiUQl3I9f7ZVSuLZSu3JblVffZ9gnUWfUg9CgLeOQd2rWOiSKjec5Ol6l+4fOOFEsJ0Ad0U7s0EF5JdRjpmFAsYgsRs3Rq/Vmgn8EkpWg98Eqr9zfxKaKltYWh6QqzKbWGYAIquwy8hDgRLAswP7Ta6zMfK+UqVQG62+pUMeTJJtNgaJ5/EpJxNhG5l03+I2JUnIMxd98BQZUg4FcjPKF50g/5mOKLLliV3KZ2NrYm8YQgXhkCZ1Oef1mrp8Ii5G8qvx0HgjAPDlfs6K10llr7+N56J4h8Bf5WI4u5l4xIi34YetnMWnpV9mZasvXljvs8Tw7zNtb3igyblckHdpAwrOAKaEXH/setuW4sp4cxCp2DixnN2hwMsx17TBhyroAWEu/mCRfJOrvFvSxhbdMII2f9aR3TKc0JPIogWbcBFmHgnpDterVmq66tq1zDKOw0oOMOmSWLckGo0hjJWyUeA56R16HDl8ZJFet6M2Ul3IS5Kzf7cuZPqmP6gOv3j2piIwBKAVQbZfV86murBZS5gO5k4SXD51H7Th01kfZXH9psEK3TyVDFXhuPnrHOcVPKtdQA== MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 101363b3-aa78-4f96-014f-08d3852c6550 X-Microsoft-Exchange-Diagnostics: 1; DM2PR03MB477; 2:5coc2bdGuuUL1MYbTCtN24eAUanrdA5ZnBSynDsXQUxSL1lIi7hLsKjR7UYifXz9MFfth16Z/n/g2y6uZ3zQ/yNJT8bWt5OUg1G8ovmQRUJjlfxOokLeTJpoxShYhnNoL8oEOTLtcEZ3bH+NNT0uql7othIeCxLZM6v/OUabD2ZZbaHhN3HBNmjTVh43L017; 3:Aq1ftTg3L9qy8Yp4bxJRrra8+Kb8aoss4oAGf2G4w02DVGbtdaOPAwUr3GMtNQxGXGAJPTuqf71U0s9IU8FYcjF+zrS3xi6J7QBFA3hpyMRxyArtbpbMvg5S15HWa5JvxKn/GgTasjM1QVBlv97pM/3UrLB8meOxVIUbJ1kxMDWywR8w7qr/UpVxz3cKh1jQrJ4AouQFD5HJW0VLm+rVSQUCebBj4mmEo22krNwI2oQ=; 25:6fcW2CUVMJ65+vIOV1bqqCIy6fmAnNKKGHLSNzU8H4TNQcCRjJvBJxXacZD2TdzJRSnbd8ypuuiGp95wcugHF8Udv7yV/GHnO14e28PW9pIGZvho+ocv9iczCVmZIeJLdGcw1lXyS9ngSI6Nk3043rQTNDNBynigKC3pmQbn5z6idPyNKYsLVjeV6SKbF5Ev9giQDahyNxj1xY3OvWYBtfkjMjVz9uEEa23LlE77TLPhEs3dZKCyNEwM0qYndTwmTnQLSc83y5ZY9YKBQkO4/jdlJqUyHGQ0mT3gFwOqoHSLqJRDDpeVM2T2iWA1Ckiz/fJzmf6Lm7IrbXrrfVZb1Xy8huH8pfUR9yv1EBc/u5aWv9oW5YisB0J/XhDokaWRUhaGy/HwZnONqGyTAUnxZWSL/ya3ECl9HvOMIFeLhiw= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DM2PR03MB477; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13018025)(13017025)(13015025)(13023025)(13024025)(5005006)(8121501046)(10201501046)(3002001)(6055026); SRVR:DM2PR03MB477; BCL:0; PCL:0; RULEID:(400006); SRVR:DM2PR03MB477; X-Microsoft-Exchange-Diagnostics: 1; DM2PR03MB477; 4:xyzF8nLgABOnSzSa6P6Ih51rQE7pW8I+vLm2ulqGtp8d0t7bGlUx+ez0ZyRBVIxvKH53vgHut0SRavXYEfjwC1qmkLbqMm5raN0YZmEX51Khl0q0a3sBdvLrFl9SegoRQ1V8zJH4QiJ807xCuQ16cVF/rLNUydSeXzj8cUrNZ2EPFoqNdDoxTyskcqSdj5apzUeG9Y9i3Gmt+Ye8xtzg9l3JcOm1SCSUtXz51QN99TiN8q40Cr2/u2Qknue09I6ylyXPRR6DIwxDQo7oS9CI+3lwmPVYyrT0MKCAQ0s8q51RVeUOBF0BocJPDw6v4aFpO8VmL/1q3VsTPmosXa5hUxWCUU/xtPRANojsmfZi+OQaJshhLP728+fhicc9rJ9H8OyoJFxOnpMSo8AudB3yy7Q5C2kftpU+RqBp+Owy8OI+xhPPQy+TiC4ZCmQauIOQt4a9a/jBpPlXat+nWkFD2KFnOT3zGzq67hS+Gl73tFJ0rhRjXf7lBDG3xzGzvKdtgRFZkaJ6TKQdOt+Is5gKyw== X-Forefront-PRVS: 0954EE4910 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM2PR03MB477; 23:gwSppegwPeUsb+FBpl073rNbh5gXN7ggEEuUAdtZwy?= =?us-ascii?Q?s6iP6Xz4suGszVYgb4N5d7awLiK6MIGfABtRlW8XQMBkFf6VwhAqjzi1MnEj?= =?us-ascii?Q?NhFpyGCRzsjsCvHiUn/44kv2KBbOB2wWIVCNo5AEEPT1pI0YJOATiBf9RHqR?= =?us-ascii?Q?IDFTN2ymQfhR6Rce7OM+yR5xbzA6BXbkvefEU9LqF0tU7fqBTy9wzRmVVXmm?= =?us-ascii?Q?ufmXhqIOzZNocP7SrG7a3FqYPjYpbVzJbpqqrk9AKhWVr/jiMk3UtL/E15NL?= =?us-ascii?Q?yfg7Kz9k0yFA5TXoSidtf+GL9PoAPLd8RTrzKohnuQZPB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KyvjCJpeVUYC9XO++YifUYvmB6nLdSl4kOilVE7mItu7SwyHTqsgBZct6rlNf0FT5z4f/rYSW05N1LVS4A1ZZdY+nOYtoSw9gNkRX0doyLDbpcWCx3NQNz4WI0UsahB+WzqvdRjN4vWS653qG3MwC+BiCGXOmi0PVoibjA7k=; 24:Qk7hiP2d/ydtqIDW2dhKFrAFM27EHDaZTMi4oxyfvKfXpVLttbIVGq7u8k8+B58fi4NMSFBUpPJZohlnW6+XBdlgYD2JQiV4Z5vTKdnI3a8=; 7:zm3NJKDkKKsmH0UnKfTF8WnWYg8NN7uHx00jNg+b6BT2gqWgKOYrlbOoX6Y5hZazgeiHX+JXGIWVnwvNVoOTZsJ3HjAntVDrVsPKXV+PrlS/oBVuUMtobCB/9H9JgV8bF7iz5zTQT/wtWBcrlJSVqrOV+1QZwA2Tt3FUU5lWXJCNTcEJAO45VN6zlzsRI2XN SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 May 2016 06:10:11.2297 (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.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR03MB477 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 some platforms, root port doesn't support MSI/MSI-X/INTx in RC mode. When chip support the aer interrupt with none MSI/MSI-X/INTx mode, maybe there is interrupt line for aer pme etc. Search the interrupt number in the fdt file. Signed-off-by: Po Liu --- drivers/pci/pcie/portdrv_core.c | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c index 32d4d0a..64833e5 100644 --- a/drivers/pci/pcie/portdrv_core.c +++ b/drivers/pci/pcie/portdrv_core.c @@ -15,6 +15,7 @@ #include #include #include +#include #include "../pci.h" #include "portdrv.h" @@ -199,6 +200,28 @@ static int pcie_port_enable_msix(struct pci_dev *dev, int *vectors, int mask) static int init_service_irqs(struct pci_dev *dev, int *irqs, int mask) { int i, irq = -1; + int ret; + struct device_node *np = NULL; + + for (i = 0; i < PCIE_PORT_DEVICE_MAXSERVICES; i++) + irqs[i] = 0; + + if (dev->bus->dev.of_node) + np = dev->bus->dev.of_node; + + /* If root port doesn't support MSI/MSI-X/INTx in RC mode, + * request irq for aer + */ + if (IS_ENABLED(CONFIG_OF_IRQ) && np && + (mask & PCIE_PORT_SERVICE_PME)) { + ret = of_irq_get_byname(np, "aer"); + if (ret > 0) { + irqs[PCIE_PORT_SERVICE_AER_SHIFT] = ret; + if (dev->irq) + irq = dev->irq; + goto no_msi; + } + } /* * If MSI cannot be used for PCIe PME or hotplug, we have to use @@ -224,11 +247,13 @@ static int init_service_irqs(struct pci_dev *dev, int *irqs, int mask) irq = dev->irq; no_msi: - for (i = 0; i < PCIE_PORT_DEVICE_MAXSERVICES; i++) - irqs[i] = irq; + for (i = 0; i < PCIE_PORT_DEVICE_MAXSERVICES; i++) { + if (!irqs[i]) + irqs[i] = irq; + } irqs[PCIE_PORT_SERVICE_VC_SHIFT] = -1; - if (irq < 0) + if (irq < 0 && irqs[PCIE_PORT_SERVICE_AER_SHIFT] < 0) return -ENODEV; return 0; }