From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marc Zyngier Date: Mon, 23 Nov 2015 10:15:21 +0000 Subject: Re: [PATCH] PCI: pcie-rcar: Fix OF node passed to MSI irq domain Message-Id: <20151123101521.07e8dc9b@arm.com> 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> <564EECA9.9070400@arm.com> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: Phil Edworthy 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 On Mon, 23 Nov 2015 09:44:10 +0000 Phil Edworthy wrote: > Hi Marc, >=20 > 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 =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 > > > In _irq_domain_add() this ptr is stored in struct irq_domain's host_d= ata. > > > > > > 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. > >=20 > > Can you please give this hack a go and let me know if that helps? > Works for me! Cool. I'll post a patch with your Reported-by/Tested-by later today. Thanks a lot. M. --=20 Jazz is not dead. It just smells funny. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754545AbbKWKPc (ORCPT ); Mon, 23 Nov 2015 05:15:32 -0500 Received: from foss.arm.com ([217.140.101.70]:54623 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751924AbbKWKPa (ORCPT ); Mon, 23 Nov 2015 05:15:30 -0500 Date: Mon, 23 Nov 2015 10:15:21 +0000 From: Marc Zyngier To: Phil Edworthy 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 Message-ID: <20151123101521.07e8dc9b@arm.com> In-Reply-To: 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> Organization: ARM Ltd X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.25; arm-unknown-linux-gnueabihf) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 23 Nov 2015 09:44:10 +0000 Phil Edworthy wrote: > 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! Cool. I'll post a patch with your Reported-by/Tested-by later today. Thanks a lot. M. -- Jazz is not dead. It just smells funny.