All of lore.kernel.org
 help / color / mirror / Atom feed
From: Phil Edworthy <phil.edworthy@renesas.com>
To: Marc Zyngier <marc.zyngier@arm.com>
Cc: Thierry Reding <treding@nvidia.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Wolfram Sang <wsa@the-dreams.de>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	Simon Horman <horms@verge.net.au>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	"linux-sh@vger.kernel.org" <linux-sh@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Ley Foon Tan <lftan@altera.com>, Jingoo Han <jg1.han@samsung.com>
Subject: RE: [PATCH] PCI: pcie-rcar: Fix OF node passed to MSI irq domain
Date: Mon, 23 Nov 2015 09:44:10 +0000	[thread overview]
Message-ID: <PS1PR06MB1180D8114604DE8AC1125E96F5070@PS1PR06MB1180.apcprd06.prod.outlook.com> (raw)
In-Reply-To: <564EECA9.9070400@arm.com>

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:
> > <snip>
> >>> 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ÿffffc03193a810
> >>> msi_domain_alloc_irqs:274: ops->msi_checkÿffffc031161418
> >>> systemd-udevd[1311]: undefined instruction: pcÿffffc03116141c
> >>> 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...

WARNING: multiple messages have this Message-ID (diff)
From: Phil Edworthy <phil.edworthy@renesas.com>
To: Marc Zyngier <marc.zyngier@arm.com>
Cc: Thierry Reding <treding@nvidia.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Wolfram Sang <wsa@the-dreams.de>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	Simon Horman <horms@verge.net.au>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	"linux-sh@vger.kernel.org" <linux-sh@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Ley Foon Tan <lftan@altera.com>, Jingoo Han <jg1.han@samsung.com>
Subject: RE: [PATCH] PCI: pcie-rcar: Fix OF node passed to MSI irq domain
Date: Mon, 23 Nov 2015 09:44:10 +0000	[thread overview]
Message-ID: <PS1PR06MB1180D8114604DE8AC1125E96F5070@PS1PR06MB1180.apcprd06.prod.outlook.com> (raw)
In-Reply-To: <564EECA9.9070400@arm.com>

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:
> > <snip>
> >>> 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...

  reply	other threads:[~2015-11-23  9:44 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-03  9:28 [PATCH] PCI: pcie-rcar: Fix OF node passed to MSI irq domain Phil Edworthy
2015-11-03  9:28 ` Phil Edworthy
2015-11-07 13:59 ` Wolfram Sang
2015-11-07 13:59   ` Wolfram Sang
2015-11-09  9:00   ` Phil Edworthy
2015-11-09  9:00     ` Phil Edworthy
2015-11-10  1:21   ` Simon Horman
2015-11-10  1:21     ` Simon Horman
2015-11-09 15:20 ` Phil Edworthy
2015-11-09 15:20   ` Phil Edworthy
2015-11-09 16:11   ` Thierry Reding
2015-11-09 16:11     ` Thierry Reding
2015-11-09 17:24     ` Phil Edworthy
2015-11-09 17:24       ` Phil Edworthy
2015-11-09 18:01     ` Phil Edworthy
2015-11-09 18:01       ` Phil Edworthy
2015-11-10 15:52       ` Thierry Reding
2015-11-10 15:52         ` Thierry Reding
2015-11-11 16:38         ` Marc Zyngier
2015-11-12  8:57           ` Phil Edworthy
2015-11-12  8:57             ` Phil Edworthy
2015-11-12 20:31             ` Marc Zyngier
2015-11-12 20:31               ` Marc Zyngier
2015-11-13  9:36               ` Phil Edworthy
2015-11-13  9:36                 ` Phil Edworthy
2015-11-16 18:31                 ` Marc Zyngier
2015-11-16 18:31                   ` Marc Zyngier
2015-11-18 18:01                   ` Phil Edworthy
2015-11-18 18:01                     ` Phil Edworthy
2015-11-20  9:38                     ` Marc Zyngier
2015-11-20  9:38                       ` Marc Zyngier
2015-11-20  9:49                     ` Marc Zyngier
2015-11-20  9:49                       ` Marc Zyngier
2015-11-23  9:44                       ` Phil Edworthy [this message]
2015-11-23  9:44                         ` Phil Edworthy
2015-11-23 10:15                         ` Marc Zyngier
2015-11-23 10:15                           ` Marc Zyngier
2015-11-23 10:29                           ` Wolfram Sang
2015-11-23 10:29                             ` Wolfram Sang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=PS1PR06MB1180D8114604DE8AC1125E96F5070@PS1PR06MB1180.apcprd06.prod.outlook.com \
    --to=phil.edworthy@renesas.com \
    --cc=bhelgaas@google.com \
    --cc=geert@linux-m68k.org \
    --cc=horms@verge.net.au \
    --cc=jg1.han@samsung.com \
    --cc=lftan@altera.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --cc=treding@nvidia.com \
    --cc=wsa@the-dreams.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.