From mboxrd@z Thu Jan 1 00:00:00 1970 From: Phil Edworthy Date: Wed, 18 Nov 2015 18:01:39 +0000 Subject: RE: [PATCH] PCI: pcie-rcar: Fix OF node passed to MSI irq domain Message-Id: List-Id: References: <1446542899-25137-1-git-send-email-phil.edworthy@renesas.com> <20151109161115.GA13870@ulmo.nvidia.com> <20151110155232.GA25368@ulmo.nvidia.com> <20151111163802.3a96080c@arm.com> <20151112203100.2e91da2a@arm.com> <564A2101.90600@arm.com> In-Reply-To: <564A2101.90600@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: Marc Zyngier Cc: Thierry Reding , Bjorn Helgaas , Wolfram Sang , Geert Uytterhoeven , Simon Horman , "linux-pci@vger.kernel.org" , "linux-sh@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Ley Foon Tan , Jingoo Han Hi Marc, On 16 November 2015 18:31, Marc Zyngier wrote: > On 13/11/15 09:36, Phil Edworthy wrote: > > Since the stack trace doesn't help that much I added some tracing: > > pci_msi_setup_msi_irqs() > > calls pci_msi_get_domain() > > calls dev_get_msi_domain(), gets a non-NULL domain. > > pci_msi_setup_msi_irqs() > > calls pci_msi_domain_alloc_irqs() > > calls msi_domain_alloc_irqs() > > msi_domain_alloc_irqs:273: ops=FFffffc03193a810 > > msi_domain_alloc_irqs:274: ops->msi_check=FFffffc031161418 > > systemd-udevd[1311]: undefined instruction: pc=FFffffc03116141c > > That looks to me as though msi_check is off pointing to the weeds. >=20 > So the next step is to find out who initializes msi_check. Assuming > someone does... Nothing initializes msi_check...=20 =20 > > By passing a NULL domain into irq_domain_add_linear() you get: > > pci_msi_setup_msi_irqs() > > calls pci_msi_get_domain() > > calls dev_get_msi_domain(), gets a NULL domain. > > calls arch_setup_msi_irq() > > All ok then. >=20 > Yes, because you're sidestepping the issue. Any chance you could dig a > bit deeper? I'd really like to nail this one down (before we convert > your PCI driver to the right API... ;-). The problem appears to be that when the pci host driver enables msi it calls the following: msi->domain =3D irq_domain_add_linear(pcie->dev->of_node, INT_PCI_MSI_NR, &msi_domain_ops, &msi->chip); The last arg is documented as: * @host_data: Controller private data pointer=20 In _irq_domain_add() this ptr is stored in struct irq_domain's host_data. However, msi_domain_alloc_irqs() expects host_data to be a ptr to a struct msi_domain_info. It seems that a number of other pci host drivers do the same, so I am surprised that no one else has seen this. Thanks for your help, Phil From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756681AbbKRSBu (ORCPT ); Wed, 18 Nov 2015 13:01:50 -0500 Received: from relmlor3.renesas.com ([210.160.252.173]:58728 "EHLO relmlie2.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755664AbbKRSBp convert rfc822-to-8bit (ORCPT ); Wed, 18 Nov 2015 13:01:45 -0500 X-IronPort-AV: E=Sophos;i="5.20,313,1444662000"; d="scan'208";a="198861331" From: Phil Edworthy To: Marc Zyngier CC: Thierry Reding , Bjorn Helgaas , Wolfram Sang , Geert Uytterhoeven , Simon Horman , "linux-pci@vger.kernel.org" , "linux-sh@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Ley Foon Tan , Jingoo Han Subject: RE: [PATCH] PCI: pcie-rcar: Fix OF node passed to MSI irq domain Thread-Topic: [PATCH] PCI: pcie-rcar: Fix OF node passed to MSI irq domain Thread-Index: AQHRFhpazS7O4def1E+1x+YbvdM7WJ6T04kggAASxwCAABC7IIAADPxggAFvZICAAZ8KAIABBYmAgADN4gCAANc20IAFULmAgAMTyRA= Date: Wed, 18 Nov 2015 18:01:39 +0000 Message-ID: References: <1446542899-25137-1-git-send-email-phil.edworthy@renesas.com> <20151109161115.GA13870@ulmo.nvidia.com> <20151110155232.GA25368@ulmo.nvidia.com> <20151111163802.3a96080c@arm.com> <20151112203100.2e91da2a@arm.com> <564A2101.90600@arm.com> In-Reply-To: <564A2101.90600@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;PS1PR06MB1178;5:NmxIio+aJxfU/oSfe5vr54TnHtQBvo8fhtoyBt0Q7A3wrZrYf8eY4OcBe39cwa5QAQjdwWlidPbdUuRjveZXDU5QFI9rKFqaQf3lloT6JEfVhA2BCM5xpo2wPaGfzgLN6b/02Le978gyRtweFV/v4g==;24:WvhkiARrEcbJldeAw5YwWt2ixRSQWC5sbslDLtEyAUdBJlT/rMp4JDNfplGMlRDVKY4g8M+y1YlILoy0zsLxsFvv4OFytS23QIzOvoaNdMM=;20:3M+6J6G19QfdwG2kUY6eStUS0g9CYoTQbZc0Mb1YMqqOK8MTPO/U4qakczE+VQ503sigefHIQEpoRnrH8e6wUfAhD/Jn/zOxhWoL8qJ6wrSVqtQzLjfCSzMW0za/9VmOUzUCeGSHidl6ELvzx8ooj5Mfqup13RG+2H09+fi67e4= x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:PS1PR06MB1178; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(601004)(2401047)(8121501046)(5005006)(520078)(10201501046)(3002001);SRVR:PS1PR06MB1178;BCL:0;PCL:0;RULEID:;SRVR:PS1PR06MB1178; x-forefront-prvs: 0764C4A8CD x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(189002)(40764003)(479174004)(24454002)(199003)(110136002)(66066001)(5007970100001)(74316001)(5002640100001)(33656002)(5004730100002)(3846002)(6116002)(102836003)(101416001)(76576001)(5001960100002)(10400500002)(97736004)(189998001)(86362001)(77096005)(5008740100001)(11100500001)(106116001)(50986999)(92566002)(76176999)(54356999)(81156007)(586003)(106356001)(5003600100002)(87936001)(122556002)(2950100001)(93886004)(2900100001)(40100003)(105586002)(7059030);DIR:OUT;SFP:1102;SCL:1;SRVR:PS1PR06MB1178;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: 18 Nov 2015 18:01:39.2703 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-Transport-CrossTenantHeadersStamped: PS1PR06MB1178 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Marc, On 16 November 2015 18:31, Marc Zyngier wrote: > On 13/11/15 09:36, Phil Edworthy wrote: > > Since the stack trace doesn't help that much I added some tracing: > > pci_msi_setup_msi_irqs() > > calls pci_msi_get_domain() > > calls dev_get_msi_domain(), gets a non-NULL domain. > > pci_msi_setup_msi_irqs() > > calls pci_msi_domain_alloc_irqs() > > calls msi_domain_alloc_irqs() > > msi_domain_alloc_irqs:273: ops=ffffffc03193a810 > > msi_domain_alloc_irqs:274: ops->msi_check=ffffffc031161418 > > systemd-udevd[1311]: undefined instruction: pc=ffffffc03116141c > > That looks to me as though msi_check is off pointing to the weeds. > > So the next step is to find out who initializes msi_check. Assuming > someone does... Nothing initializes msi_check... > > By passing a NULL domain into irq_domain_add_linear() you get: > > pci_msi_setup_msi_irqs() > > calls pci_msi_get_domain() > > calls dev_get_msi_domain(), gets a NULL domain. > > calls arch_setup_msi_irq() > > All ok then. > > Yes, because you're sidestepping the issue. Any chance you could dig a > bit deeper? I'd really like to nail this one down (before we convert > your PCI driver to the right API... ;-). The problem appears to be that when the pci host driver enables msi it calls the following: msi->domain = irq_domain_add_linear(pcie->dev->of_node, INT_PCI_MSI_NR, &msi_domain_ops, &msi->chip); The last arg is documented as: * @host_data: Controller private data pointer In _irq_domain_add() this ptr is stored in struct irq_domain's host_data. However, msi_domain_alloc_irqs() expects host_data to be a ptr to a struct msi_domain_info. It seems that a number of other pci host drivers do the same, so I am surprised that no one else has seen this. Thanks for your help, Phil