Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753570AbbK3KZw (ORCPT ); Mon, 30 Nov 2015 05:25:52 -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 X-IronPort-AV: E=Sophos;i="5.20,364,1444662000"; d="scan'208";a="199545815" 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT 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-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1918 Lines: 54 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); -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/