public inbox for linux-pci@vger.kernel.org
 help / color / mirror / Atom feed
From: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
To: Bjorn Helgaas <helgaas@kernel.org>
Cc: Dongdong Liu <liudongdong3@huawei.com>,
	linux-pci@vger.kernel.org, wangzhou1@hisilicon.com,
	gabriele.paoloni@huawei.com, charles.chenxin@huawei.com,
	linuxarm@huawei.com, Tomasz Nowicki <tn@semihalf.com>
Subject: Re: [PATCH 3/3] PCI: generic: Fix the bug of pci_fixup_irqs() for arm64 platform.
Date: Mon, 6 Feb 2017 14:08:27 +0000	[thread overview]
Message-ID: <20170206140827.GB14139@red-moon> (raw)
In-Reply-To: <20170203204530.GH10291@bhelgaas-glaptop.roam.corp.google.com>

On Fri, Feb 03, 2017 at 02:45:30PM -0600, Bjorn Helgaas wrote:
> [+cc Tomasz, Lorenzo]
> 
> On Thu, Jan 12, 2017 at 02:28:24PM +0800, Dongdong Liu wrote:
> > arch/arm64/pci.c pcibios_alloc_irq() has the same function as
> > pci_fixup_irqs(), so we add condition #ifndef CONFIG_ARM64 for
> > pci_fixup_irqs().
> > 
> > Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
> > Reviewed-by: Gabriele Paoloni <gabriele.paoloni@huawei.com>
> > Reviewed-by: Zhou Wang <wangzhou1@hisilicon.com>
> > ---
> >  drivers/pci/host/pci-host-common.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/drivers/pci/host/pci-host-common.c b/drivers/pci/host/pci-host-common.c
> > index e3c48b5..f160afc 100644
> > --- a/drivers/pci/host/pci-host-common.c
> > +++ b/drivers/pci/host/pci-host-common.c
> > @@ -145,7 +145,9 @@ int pci_host_common_probe(struct platform_device *pdev,
> >  		return -ENODEV;
> >  	}
> >  
> > +#ifndef CONFIG_ARM64
> >  	pci_fixup_irqs(pci_common_swizzle, of_irq_parse_and_map_pci);
> > +#endif
> 
> d8ed75d59332 ("ARM64: PCI: ACPI support for legacy IRQs parsing and
> consolidation with DT code") added pcibios_alloc_irq() for arm64.
> 
> arm64 is the only arch that implements pcibios_alloc_irq().  And now
> you want to add an ifdef here so arm64 is the only arch that doesn't
> call pci_fixup_irqs().
> 
> I don't remember the details of why arm64 is so special here.
> Obviously we'd prefer not to have the ifdef and not to have the
> arm64-specific pcibios_alloc_irq().

Well, I am not sure ARM64 is more special than other architectures
in this respect, actually I think that what ARM64 does is what we
will end up doing when Matthew Minter's patches are merged and
that's my aim for v4.12, pci_fixup_irqs() should not be used
any longer, at least on ARM/ARM64 and I know what to do to make
it disappear.

ARM64 relies on pcibios_alloc_irq() because of probe sequence. Before
d8ed75d59332 ("ARM64: PCI: ACPI support for legacy IRQs parsing and
consolidation with DT code") legacy IRQs were assigned at
pcibios_add_device() time. This does not work at all on ACPI (ie scan
handlers dependency), so to have a single callback DT/ACPI we
moved the allocation at pcibios_alloc_irq() time and I suspect
that's where (in pci_device_probe()) the host bridge hook to
init legacy IRQs will be called when we manage to merge Matt's
code. I will send you Matt's code rebased for v4.12, I take an
action on that (except for x86 code that IIRC is unfathomable
from this perspective and that's what blocked Matt's attempt).

Now this patch. Yes, using pci_fixup_irqs() is wrong on ARM64
(because we may reallocate an IRQ for a device that is already
bound to a driver - but that's a problem on ARM too - ie multiple
host controllers), the call has to be there for legacy IRQs to "work"
on ARM though so the ifdef.

How are we fixing this ? We merge this patch and I will remove
this stuff completely for v4.12 by using Matt's approach (ie moving
the legacy IRQ allocation to a per-host bridge callback ?)

Thanks,
Lorenzo

  reply	other threads:[~2017-02-06 14:08 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-12  6:28 [PATCH 0/3] PCI:hisi: Add DT almost ECAM support for HiSilicon Hip06/Hip07 host controllers Dongdong Liu
2017-01-12  6:28 ` [PATCH 1/3] " Dongdong Liu
2017-02-03 20:40   ` Bjorn Helgaas
2017-02-03 21:00     ` Bjorn Helgaas
2017-02-04  3:30       ` Dongdong Liu
2017-01-12  6:28 ` [PATCH 2/3] PCI: Set pdev->no_msi=1 " Dongdong Liu
2017-02-03 20:42   ` Bjorn Helgaas
2017-02-04  3:37     ` Dongdong Liu
2017-02-05  0:38       ` Bjorn Helgaas
2017-02-06  0:38         ` Dongdong Liu
2017-01-12  6:28 ` [PATCH 3/3] PCI: generic: Fix the bug of pci_fixup_irqs() for arm64 platform Dongdong Liu
2017-02-03 20:45   ` Bjorn Helgaas
2017-02-06 14:08     ` Lorenzo Pieralisi [this message]
2017-02-07 21:46       ` Bjorn Helgaas
2017-02-08  9:58         ` Lorenzo Pieralisi
2017-01-23 10:29 ` [PATCH 0/3] PCI:hisi: Add DT almost ECAM support for HiSilicon Hip06/Hip07 host controllers Dongdong Liu
2017-02-03 21:04 ` Bjorn Helgaas

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=20170206140827.GB14139@red-moon \
    --to=lorenzo.pieralisi@arm.com \
    --cc=charles.chenxin@huawei.com \
    --cc=gabriele.paoloni@huawei.com \
    --cc=helgaas@kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=liudongdong3@huawei.com \
    --cc=tn@semihalf.com \
    --cc=wangzhou1@hisilicon.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox