From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Yuanquan Chen <B41889@freescale.com>
Cc: linuxppc-dev@lists.ozlabs.org, galak@kernel.crashing.org,
r61911@freescale.com, linux-pci@vger.kernel.org,
Bjorn Helgaas <bhelgaas@google.com>
Subject: Re: [linuxppc-release][PATCH] powerpc/pci-hotplug: fix init issue of rescanned pci device
Date: Wed, 05 Dec 2012 18:17:58 +1100 [thread overview]
Message-ID: <1354691878.2351.2.camel@pasglop> (raw)
In-Reply-To: <1354674717-14426-1-git-send-email-B41889@freescale.com>
On Wed, 2012-12-05 at 10:31 +0800, Yuanquan Chen wrote:
> On powerpc arch, some fixup work of PCI/PCI-e device is just done during the
> first scan at booting time. For the PCI/PCI-e device rescanned after linux OS
> booting up, the fixup work won't be done, which leads to dma_set_mask error or
> irq related issue in rescanned PCI/PCI-e device's driver. So, it does the same
> fixup work for the rescanned device to avoid this issue.
Hrm, the patch is a bit gross. First the code shouldn't be copy/pasted
that way but factored out.
I'm surprised also that is_added is false when pcibios_enable_device()
gets called ... that looks strange to me. At what point is that enable
happening in the hotplug sequence ?
How do you trigger the rescan anyway ?
I think the problem needs to be solve at a higher level, I'm adding
linux-pci & Bjorn to the CC list.
Cheers,
Ben.
> Signed-off-by: Yuanquan Chen <B41889@freescale.com>
> ---
> arch/powerpc/kernel/pci-common.c | 20 ++++++++++++++++++++
> 1 file changed, 20 insertions(+)
>
> diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
> index 7f94f76..f0fb070 100644
> --- a/arch/powerpc/kernel/pci-common.c
> +++ b/arch/powerpc/kernel/pci-common.c
> @@ -1496,6 +1496,26 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
> if (ppc_md.pcibios_enable_device_hook(dev))
> return -EINVAL;
>
> + if (!dev->is_added) {
> + /*
> + * Fixup NUMA node as it may not be setup yet by the generic
> + * code and is needed by the DMA init
> + */
> + set_dev_node(&dev->dev, pcibus_to_node(dev->bus));
> +
> + /* Hook up default DMA ops */
> + set_dma_ops(&dev->dev, pci_dma_ops);
> + set_dma_offset(&dev->dev, PCI_DRAM_OFFSET);
> +
> + /* Additional platform DMA/iommu setup */
> + if (ppc_md.pci_dma_dev_setup)
> + ppc_md.pci_dma_dev_setup(dev);
> +
> + /* Read default IRQs and fixup if necessary */
> + pci_read_irq_line(dev);
> + if (ppc_md.pci_irq_fixup)
> + ppc_md.pci_irq_fixup(dev);
> + }
> return pci_enable_resources(dev, mask);
> }
>
next parent reply other threads:[~2012-12-05 7:18 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1354674717-14426-1-git-send-email-B41889@freescale.com>
2012-12-05 7:17 ` Benjamin Herrenschmidt [this message]
2012-12-05 8:20 ` [linuxppc-release][PATCH] powerpc/pci-hotplug: fix init issue of rescanned pci device Chen Yuanquan-B41889
2012-12-05 8:26 ` Benjamin Herrenschmidt
2012-12-05 9:29 ` Chen Yuanquan-B41889
2012-12-05 21:30 ` Bjorn Helgaas
2012-12-06 11:23 ` Chen Yuanquan-B41889
2012-12-07 21:15 ` Bjorn Helgaas
2013-04-01 10:29 ` Chen Yuanquan-B41889
2013-04-01 16:29 ` 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=1354691878.2351.2.camel@pasglop \
--to=benh@kernel.crashing.org \
--cc=B41889@freescale.com \
--cc=bhelgaas@google.com \
--cc=galak@kernel.crashing.org \
--cc=linux-pci@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=r61911@freescale.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;
as well as URLs for NNTP newsgroup(s).