lkml.org 
[lkml]   [2015]   [Nov]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH] PCI: pcie-rcar: Fix OF node passed to MSI irq domain
Date
Hi Thierry,

On 09 November 2015 17:24, Phil wrote:
> On 09 November 2015 16:11, Thierry wrote:
> > On Mon, Nov 09, 2015 at 03:20:24PM +0000, Phil Edworthy wrote:
> > > cc'ing others (Tegra, Altera, Designware) who may have the same bug
> > >
> > > On 03 November 2015 09:28, Phil Edworthy wrote:
> > > > The OF node passed to irq_domain_add_linear() should be a
> > > > pointer to interrupt controller's device tree node, or NULL,
> > > > but not the PCI controller's node.
> > > >
> > > > This fixes an oops in msi_domain_alloc_irqs() when it tries
> > > > to call msi_check().
> > > >
> > > > Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
> > > > ---
> > > > drivers/pci/host/pcie-rcar.c | 2 +-
> > > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > > >
> > > > diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c
> > > > index 2377bf0..c6fa562 100644
> > > > --- a/drivers/pci/host/pcie-rcar.c
> > > > +++ b/drivers/pci/host/pcie-rcar.c
> > > > @@ -709,7 +709,7 @@ static int rcar_pcie_enable_msi(struct rcar_pcie
> *pcie)
> > > > msi->chip.setup_irq = rcar_msi_setup_irq;
> > > > msi->chip.teardown_irq = rcar_msi_teardown_irq;
> > > >
> > > > - msi->domain = irq_domain_add_linear(pcie->dev->of_node,
> > > > INT_PCI_MSI_NR,
> > > > + msi->domain = irq_domain_add_linear(NULL, INT_PCI_MSI_NR,
> > > > &msi_domain_ops, &msi->chip);
> > > > if (!msi->domain) {
> > > > dev_err(&pdev->dev, "failed to create IRQ domain\n");
> >
> > On Tegra the PCI controller is in fact the interrupt controller for
> > MSIs. And looking at the code here it seems like the same would apply to
> > RCAR.
> Yes you are correct here.
>
> > I'm also slightly confused as to why this would cause ->msi_check() to
> > fail. The default implementation (msi_domain_ops_check()) doesn't do
> > anything.
> >
> > Also, how is passing in NULL instead of a valid struct device_node *
> > going to prevent an oops? Perhaps this is one of those reference count
> > imbalance bugs that have recently been showing up?
> On arm64 (previously I didn't realise this just affects arm64, not arm),
> the changes in commit f075915ac0b11 ("PCI/MSI: Drop domain field from
> msi_controller") and d8a1cb757550 ("PCI/MSI: Let pci_msi_get_domain use
> struct device::msi_domain") return an uninitialized msi domain that leads
> to the oops. It appears that these changes assume that msi interrupt
> controller is separate from the PCI controller.
More accurately, when CONFIG_GENERIC_MSI_IRQ_DOMAIN is enabled,
pci_msi_get_domain() calls dev_get_msi_domain() and at this point
dev->msi_domain is uninitialized.

Phil


\
 
 \ /
  Last update: 2015-11-09 19:21    [W:0.085 / U:0.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site