* [PATCH] fix pci_setup_phb_io_dynamic for pci_iomap
@ 2007-05-03 19:42 Arnd Bergmann
2007-05-03 21:31 ` Benjamin Herrenschmidt
0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2007-05-03 19:42 UTC (permalink / raw)
To: linuxppc-dev; +Cc: paulus
We had a problem on a system with only dynamically allocated
PCI buses (using of_pci_phb_driver) in combination with libata.
It turns out that pci_setup_phb_io_dynamic does a simple ioremap
instead of an __ioremap_explicit into the reserved I/O space
region, which causes pcim_iomap->pci_iomap->ioport_map to fail
a sanity check for the virtual address of the I/O port.
Also, our setup ended up having no "primary" phb, which means
that pci_io_base never got initialized. This caused the same
bug independently.
This patch fixes both problems.
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
arch/powerpc/kernel/of_platform.c | 4 ++--
arch/powerpc/kernel/pci_64.c | 6 ++++--
2 files changed, 6 insertions(+), 4 deletions(-)
Index: linux-2.6.21.ppc64/arch/powerpc/kernel/of_platform.c
===================================================================
--- linux-2.6.21.ppc64.orig/arch/powerpc/kernel/of_platform.c
+++ linux-2.6.21.ppc64/arch/powerpc/kernel/of_platform.c
@@ -426,13 +426,13 @@ static int __devinit of_pci_phb_probe(st
}
/* Process "ranges" property */
- pci_process_bridge_OF_ranges(phb, dev->node, 0);
+ pci_process_bridge_OF_ranges(phb, dev->node, pci_io_base == 0);
/* Setup IO space.
* This will not work properly for ISA IOs, something needs to be done
* about it if we ever generalize that way of probing PCI brigdes
*/
- pci_setup_phb_io_dynamic(phb, 0);
+ pci_setup_phb_io_dynamic(phb, pci_io_base == 0);
/* Init pci_dn data structures */
pci_devs_phb_init_dynamic(phb);
Index: linux-2.6.21.ppc64/arch/powerpc/kernel/pci_64.c
===================================================================
--- linux-2.6.21.ppc64.orig/arch/powerpc/kernel/pci_64.c
+++ linux-2.6.21.ppc64/arch/powerpc/kernel/pci_64.c
@@ -1077,8 +1077,7 @@ void __devinit pci_setup_phb_io_dynamic(
unsigned long io_virt_offset;
struct resource *res;
- hose->io_base_virt = __ioremap(hose->io_base_phys, size,
- _PAGE_NO_CACHE | _PAGE_GUARDED);
+ hose->io_base_virt = reserve_phb_iospace(size);
DBG("phb%d io_base_phys 0x%lx io_base_virt 0x%lx\n",
hose->global_number, hose->io_base_phys,
(unsigned long) hose->io_base_virt);
@@ -1090,6 +1089,9 @@ void __devinit pci_setup_phb_io_dynamic(
res = &hose->io_resource;
res->start += io_virt_offset;
res->end += io_virt_offset;
+
+ __ioremap_explicit(hose->io_base_phys, (unsigned long)hose->io_base_virt, size,
+ _PAGE_NO_CACHE | _PAGE_GUARDED);
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] fix pci_setup_phb_io_dynamic for pci_iomap
2007-05-03 19:42 [PATCH] fix pci_setup_phb_io_dynamic for pci_iomap Arnd Bergmann
@ 2007-05-03 21:31 ` Benjamin Herrenschmidt
0 siblings, 0 replies; 2+ messages in thread
From: Benjamin Herrenschmidt @ 2007-05-03 21:31 UTC (permalink / raw)
To: Arnd Bergmann; +Cc: linuxppc-dev, paulus
On Thu, 2007-05-03 at 21:42 +0200, Arnd Bergmann wrote:
> We had a problem on a system with only dynamically allocated
> PCI buses (using of_pci_phb_driver) in combination with libata.
>
> It turns out that pci_setup_phb_io_dynamic does a simple ioremap
> instead of an __ioremap_explicit into the reserved I/O space
> region, which causes pcim_iomap->pci_iomap->ioport_map to fail
> a sanity check for the virtual address of the I/O port.
>
> Also, our setup ended up having no "primary" phb, which means
> that pci_io_base never got initialized. This caused the same
> bug independently.
>
> This patch fixes both problems.
Hrm... dynamically added PHBs shouldn't use the reserved region.
We need to fix ioport_map instead I think. I'll have a look.
Ben.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-05-03 21:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-03 19:42 [PATCH] fix pci_setup_phb_io_dynamic for pci_iomap Arnd Bergmann
2007-05-03 21:31 ` Benjamin Herrenschmidt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox