From patchwork Mon Nov 30 10:25:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Phil Edworthy X-Patchwork-Id: 7723101 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id EDFA7BEEE1 for ; Mon, 30 Nov 2015 10:26:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5355520558 for ; Mon, 30 Nov 2015 10:26:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 58A6320552 for ; Mon, 30 Nov 2015 10:26:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753236AbbK3KZv (ORCPT ); Mon, 30 Nov 2015 05:25:51 -0500 Received: from relmlor4.renesas.com ([210.160.252.174]:27600 "EHLO relmlie3.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751364AbbK3KZi convert rfc822-to-8bit (ORCPT ); Mon, 30 Nov 2015 05:25:38 -0500 Received: from unknown (HELO relmlir2.idc.renesas.com) ([10.200.68.152]) by relmlie3.idc.renesas.com with ESMTP; 30 Nov 2015 19:25:36 +0900 Received: from relmlac2.idc.renesas.com (relmlac2.idc.renesas.com [10.200.69.22]) by relmlir2.idc.renesas.com (Postfix) with ESMTP id 01719510F6; Mon, 30 Nov 2015 19:25:37 +0900 (JST) Received: by relmlac2.idc.renesas.com (Postfix, from userid 0) id DD09A2806D; Mon, 30 Nov 2015 19:25:36 +0900 (JST) Received: from relmlac2.idc.renesas.com (localhost [127.0.0.1]) by relmlac2.idc.renesas.com (Postfix) with ESMTP id 8FAE12806F; Mon, 30 Nov 2015 19:25:36 +0900 (JST) Received: from relmlii1.idc.renesas.com [10.200.68.65] by relmlac2.idc.renesas.com with ESMTP id VBC27338; Mon, 30 Nov 2015 19:25:36 +0900 X-IronPort-AV: E=Sophos;i="5.20,364,1444662000"; d="scan'208";a="199545815" Received: from mail-pu1apc01lp0018.outbound.protection.outlook.com (HELO APC01-PU1-obe.outbound.protection.outlook.com) ([65.55.88.18]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA; 30 Nov 2015 19:25:36 +0900 Received: from PS1PR06MB1180.apcprd06.prod.outlook.com (10.169.63.140) by PS1PR06MB1177.apcprd06.prod.outlook.com (10.169.63.29) with Microsoft SMTP Server (TLS) id 15.1.331.20; Mon, 30 Nov 2015 10:25:34 +0000 Received: from PS1PR06MB1180.apcprd06.prod.outlook.com ([10.169.63.140]) by PS1PR06MB1180.apcprd06.prod.outlook.com ([10.169.63.140]) with mapi id 15.01.0331.023; Mon, 30 Nov 2015 10:25:34 +0000 From: Phil Edworthy To: Thomas Gleixner , Jiang Liu , Bjorn Helgaas CC: "linux-kernel@vger.kernel.org" , "Wolfram Sang" , "linux-pci@vger.kernel.org" Subject: [PATCH] PCI: MSI: Only use the generic MSI layer when domain is hierarchical Thread-Topic: [PATCH] PCI: MSI: Only use the generic MSI layer when domain is hierarchical Thread-Index: AQHRJfsYtBebtwiEgEaHGoA+RtcFRJ60Zjqg Date: Mon, 30 Nov 2015 10:25:34 +0000 Message-ID: References: <1448288826-19058-1-git-send-email-marc.zyngier@arm.com> In-Reply-To: <1448288826-19058-1-git-send-email-marc.zyngier@arm.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=phil.edworthy@renesas.com; x-originating-ip: [193.141.220.21] x-microsoft-exchange-diagnostics: 1; PS1PR06MB1177; 5:W3fEZ7jKzEQe0qUD1hbqjr06LR2U17vbKCUNa0/gWlYSMnTpsdzJedf1FfPRaZFR/zsJB05MpJZDbYjopjgrsS+FtyGalY1oFi32F5zLbjTpul9CtWwuVpktP6cOoRVXGa2mQFMyOjpObtPiIqZRbg==; 24:8dsbuN8cAzXFOc8giarIxZzx6ml1ySyca2p0FcaF10CpYt45AjEhmC8Zp+4IePIF3ChrO/LXdnk03WBgRXXL/fRXtWcGPmuULSdgA6y4TXc=; 20:OHXWawPYqSOOiuloYCePA6uArQwjSeDPGa/In3wwwRW0/3oP5V8jZKsRQmwdhM1XyWzVotTeLSvCERMO3zlehNnH5aTU/sdc8IvxfXoKxlS7VCEV+c+FCvvmQEsgnHuaaabzPWAL31IoFUqNHCavV7qAb4JXHwszJT2ZLBjURt0= x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:PS1PR06MB1177; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(85106069007906)(180628864354917); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(520078)(8121501046)(3002001)(10201501046); SRVR:PS1PR06MB1177; BCL:0; PCL:0; RULEID:; SRVR:PS1PR06MB1177; x-forefront-prvs: 0776C39A48 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(6009001)(189002)(199003)(24454002)(10400500002)(11100500001)(106356001)(92566002)(74316001)(229853001)(106116001)(19580405001)(5002640100001)(105586002)(33656002)(5001770100001)(50986999)(19580395003)(97736004)(5003600100002)(86362001)(122556002)(81156007)(189998001)(87936001)(5001960100002)(66066001)(2900100001)(76176999)(101416001)(77096005)(5008740100001)(5004730100002)(40100003)(586003)(6116002)(76576001)(1220700001)(1096002)(102836003)(54356999)(2950100001)(3846002)(41533002); DIR:OUT; SFP:1102; SCL:1; SRVR:PS1PR06MB1177; H:PS1PR06MB1180.apcprd06.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; spamdiagnosticoutput: 1:23 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Nov 2015 10:25:34.4720 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-Transport-CrossTenantHeadersStamped: PS1PR06MB1177 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, 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 Cc'd linux-pci ml On 23 November 2015 14:27, Marc Zyngier wrote: Since d8a1cb757550 ("PCI/MSI: Let pci_msi_get_domain use struct device::msi_domain"), we use the MSI domain associated to the PCI device. But finding a MSI domain doesn't mean that the domain is implemented using the generic MSI domain API, and a number of MSI controllers are still using the arch_setup_msi_irq/arch_teardown_msi_irqs. In order to avoid a firework on these systems, check that the domain we just obtained is hierarchical. If not, don't use the generic MSI stuff and stick with the old one. Not pretty, but reliable. Another insentive to rework those drivers and phase out this API. Reported-by: Phil Edworthy Tested-by: Phil Edworthy Signed-off-by: Marc Zyngier --- drivers/pci/msi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index 53e4632..7eaa4c8 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c @@ -54,7 +54,7 @@ static int pci_msi_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) struct irq_domain *domain; domain = pci_msi_get_domain(dev); - if (domain) + if (domain && irq_domain_is_hierarchy(domain)) return pci_msi_domain_alloc_irqs(domain, dev, nvec, type); return arch_setup_msi_irqs(dev, nvec, type); @@ -65,7 +65,7 @@ static void pci_msi_teardown_msi_irqs(struct pci_dev *dev) struct irq_domain *domain; domain = pci_msi_get_domain(dev); - if (domain) + if (domain && irq_domain_is_hierarchy(domain)) pci_msi_domain_free_irqs(domain, dev); else arch_teardown_msi_irqs(dev);