Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754101AbbKWJoT (ORCPT ); Mon, 23 Nov 2015 04:44:19 -0500 Received: from relmlor4.renesas.com ([210.160.252.174]:36551 "EHLO relmlie3.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752508AbbKWJoR convert rfc822-to-8bit (ORCPT ); Mon, 23 Nov 2015 04:44:17 -0500 X-IronPort-AV: E=Sophos;i="5.20,336,1444662000"; d="scan'208";a="200339095" 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+YbvdM7WJ6T04kggAASxwCAABC7IIAADPxggAFvZICAAZ8KAIABBYmAgADN4gCAANc20IAFULmAgAMTyRCAAqOygIAEtSvQ Date: Mon, 23 Nov 2015 09:44:10 +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> <564EECA9.9070400@arm.com> In-Reply-To: <564EECA9.9070400@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:3Le+2VDYTOFB95M76XoXbqgTi/vzWCsec62TLM32UQSMPPianqV3leUtiEAz1f81pU81FSn05BYD+0zFKiL5xSO8fXAM+2VzSF39g1dzqr6A9nitwQCIynNzt98rkhwJQPYsmKZt0jT/XwFpb1ejOA==;24:QukODUNAS9QjQnMM3XlzYo+YFIpQlSVY+R29oUnzgFejHj3PAzboUfWY4NeLj7tL2Pi5rePU890+ErSnpDnh3bWsUZ1SL5rdiyGT/eO/kQQ=;20:y6zLVJjdgxVsfpankQRm1In6LjoX/q+sOWwEpDr94+i/m2ycIuB9ixHqJlIiCe2Qe+QBbuGLLBfiatLfZ0GRpKAvi2QZlIhc050FsgvDQhSBkzKXUYxesAg5ETw9M++Vo/b9m0QISDBc3UfA8HpPkuMtDjWe5XTft84Orzfl42g= 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)(5005006)(520078)(8121501046)(3002001)(10201501046);SRVR:PS1PR06MB1178;BCL:0;PCL:0;RULEID:;SRVR:PS1PR06MB1178; x-forefront-prvs: 07697999E6 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(479174004)(24454002)(199003)(189002)(66654002)(110136002)(77096005)(76176999)(586003)(81156007)(2950100001)(11100500001)(97736004)(189998001)(106116001)(92566002)(50986999)(87936001)(54356999)(105586002)(122556002)(93886004)(40100003)(5003600100002)(106356001)(2900100001)(66066001)(5004730100002)(74316001)(5001920100001)(5007970100001)(5008740100001)(86362001)(3846002)(33656002)(5001960100002)(102836003)(5002640100001)(10400500002)(101416001)(76576001)(6116002)(7059030);DIR:OUT;SFP:1102;SCL:1;SRVR:PS1PR06MB1178;H:PS1PR06MB1180.apcprd06.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX: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: 23 Nov 2015 09:44:10.9617 (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 Content-Length: 3201 Lines: 88 Hi Marc, On 20 November 2015 09:49, Marc Zyngier wrote: > On 18/11/15 18:01, Phil Edworthy wrote: > > 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. > > Can you please give this hack a go and let me know if that helps? Works for me! Many thanks Phil > 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); > > -- > Jazz is not dead. It just smells funny... -- 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/