On powerpc arch, dma_ops of rescanned pci device after system's booting up won't be
initialized by system, so it will fail to execute the dma_set_mask in the device's
driver. Initialize it to solve this issue.
Signed-off-by: Yuanquan Chen <redacted>
---
arch/powerpc/include/asm/dma-mapping.h | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
On Nov 22, 2012, at 10:29 PM, Yuanquan Chen wrote:
quoted
On powerpc arch, dma_ops of rescanned pci device after system's booting up won't be
initialized by system, so it will fail to execute the dma_set_mask in the device's
driver. Initialize it to solve this issue.
Signed-off-by: Yuanquan Chen <redacted>
---
arch/powerpc/include/asm/dma-mapping.h | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
This is not the right way to get the dma_ops setup. You need to find some other point for the hotplug scenario to get the dma_ops setup.
- k
Hi Kumar,
I read the code about pci bus scan and rescan. Only the
pcibios_fixup_bus in pci_scan_child_bus and
pcibios_enable_device in pci_rescan_bus are arch related code. The
pcibios_fixup_bus won't be called
for the rescanned PCI devices due to the bus->is_added has been set for
the first scanning at boot time.
So I think it's more reasonable to do the same work as pcibios_fixup_bus
for rescanned PCI device in
pcibios_enable_device. The patch code is a copy of
pcibios_setup_bus_devices called by pcibios_fixup_bus,
It can solve the dma_set_mask and irq related issues of rescanned PCI
device on powerpc arch. What's
your opinion?
Thanks,
yuanquan
diff --git a/arch/powerpc/kernel/pci-common.c
b/arch/powerpc/kernel/pci-common.c
index 7f94f76..30f7d61 100644
On Nov 22, 2012, at 10:29 PM, Yuanquan Chen wrote:
quoted
On powerpc arch, dma_ops of rescanned pci device after system's booting up won't be
initialized by system, so it will fail to execute the dma_set_mask in the device's
driver. Initialize it to solve this issue.
Signed-off-by: Yuanquan Chen <redacted>
---
arch/powerpc/include/asm/dma-mapping.h | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
This is not the right way to get the dma_ops setup. You need to find some other point for the hotplug scenario to get the dma_ops setup.
- k
Hi Kumar,
I read the code about pci bus scan and rescan. Only the
pcibios_fixup_bus in pci_scan_child_bus and
pcibios_enable_device in pci_rescan_bus are arch related code. The
pcibios_fixup_bus won't be called
for the rescanned PCI devices due to the bus->is_added has been set for
the first scanning at boot time.
So I think it's more reasonable to do the same work as pcibios_fixup_bus
for rescanned PCI device in
pcibios_enable_device. The patch code is a copy of
pcibios_setup_bus_devices called by pcibios_fixup_bus,
It can solve the dma_set_mask and irq related issues of rescanned PCI
device on powerpc arch. What's
your opinion?
Thanks,
yuanquan
diff --git a/arch/powerpc/kernel/pci-common.c
b/arch/powerpc/kernel/pci-common.c
index 7f94f76..30f7d61 100644
@@ -1496,6 +1496,23 @@ int pcibios_enable_device(struct pci_dev *dev, =
int mask)
if (ppc_md.pcibios_enable_device_hook(dev))
return -EINVAL;
=20
+ if (!dev->is_added) {
+ 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);
}
=20
This looks better than the first patch.. I'm surprised that the IBM =
guys don't run into a similar issue with their hotplug support.
Maybe Ben or someone else will comment.
- k