linux-sg2042/arch/xtensa/kernel
Bjorn Helgaas 237865f195 PCI: Revert "PCI: Call pci_read_bridge_bases() from core instead of arch code"
Revert dff22d2054 ("PCI: Call pci_read_bridge_bases() from core instead
of arch code").

Reading PCI bridge windows is not arch-specific in itself, but there is PCI
core code that doesn't work correctly if we read them too early.  For
example, Hannes found this case on an ARM Freescale i.mx6 board:

  pci_bus 0000:00: root bus resource [mem 0x01000000-0x01efffff]
  pci 0000:00:00.0: PCI bridge to [bus 01-ff]
  pci 0000:00:00.0: BAR 8: no space for [mem size 0x01000000] (mem window)
  pci 0000:01:00.0: BAR 2: failed to assign [mem size 0x00200000]
  pci 0000:01:00.0: BAR 1: failed to assign [mem size 0x00004000]
  pci 0000:01:00.0: BAR 0: failed to assign [mem size 0x00000100]

The 00:00.0 mem window needs to be at least 3MB: the 01:00.0 device needs
0x204100 of space, and mem windows are megabyte-aligned.

Bus sizing can increase a bridge window size, but never *decrease* it (see
d65245c329 ("PCI: don't shrink bridge resources")).  Prior to
dff22d2054, ARM didn't read bridge windows at all, so the "original size"
was zero, and we assigned a 3MB window.

After dff22d2054, we read the bridge windows before sizing the bus.  The
firmware programmed a 16MB window (size 0x01000000) in 00:00.0, and since
we never decrease the size, we kept 16MB even though we only needed 3MB.
But 16MB doesn't fit in the host bridge aperture, so we failed to assign
space for the window and the downstream devices.

I think this is a defect in the PCI core: we shouldn't rely on the firmware
to assign sensible windows.

Ray reported a similar problem, also on ARM, with Broadcom iProc.

Issues like this are too hard to fix right now, so revert dff22d2054.

Reported-by: Hannes <oe5hpm@gmail.com>
Reported-by: Ray Jui <rjui@broadcom.com>
Link: http://lkml.kernel.org/r/CAAa04yFQEUJm7Jj1qMT57-LG7ZGtnhNDBe=PpSRa70Mj+XhW-A@mail.gmail.com
Link: http://lkml.kernel.org/r/55F75BB8.4070405@broadcom.com
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Yinghai Lu <yinghai@kernel.org>
Acked-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
2015-09-15 13:18:04 -05:00
..
.gitignore xtensa: tell git to ignore generated files 2013-06-05 10:14:19 -07:00
Makefile xtensa: improve vmlinux.lds.S sed post-processing 2015-08-20 15:28:42 +00:00
align.S xtensa: allow single-stepping through unaligned load/store 2014-08-14 11:59:30 +04:00
asm-offsets.c xtensa: Autogenerate offsets in struct thread_info 2015-04-12 21:03:29 +02:00
coprocessor.S xtensa: keep a3 and excsave1 on entry to exception handlers 2013-09-06 09:47:41 -07:00
entry.S xtensa: implement fake NMI 2015-08-17 07:33:39 +03:00
head.S xtensa: move vecbase SR initialization to _startup 2014-10-21 13:28:55 +04:00
irq.c Merge branch 'irq-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2015-09-01 14:33:35 -07:00
mcount.S xtensa: add static function tracer support 2013-07-08 01:18:57 -07:00
module.c xtensa: clean up files to make them code-style compliant 2012-12-18 21:10:25 -08:00
mxhead.S xtensa: add SMP support 2014-01-14 10:19:58 -08:00
pci-dma.c xtensa: reimplement DMA API using common helpers 2015-08-17 07:31:00 +03:00
pci.c PCI: Revert "PCI: Call pci_read_bridge_bases() from core instead of arch code" 2015-09-15 13:18:04 -05:00
perf_event.c xtensa: implement fake NMI 2015-08-17 07:33:39 +03:00
platform.c xtensa: cleanup ccount frequency tracking 2013-07-08 01:11:37 -07:00
process.c xtensa: Use generic idle loop 2013-04-08 17:39:29 +02:00
ptrace.c ARCH: AUDIT: audit_syscall_entry() should not require the arch 2014-09-23 16:21:26 -04:00
setup.c xtensa: use %*pb[l] to print bitmaps including cpumasks and nodemasks 2015-02-13 21:21:37 -08:00
signal.c Merge branch 'exec_domain_rip_v2' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/misc 2015-04-15 13:53:55 -07:00
smp.c flush_icache_range: export symbol to fix build errors 2014-08-29 16:28:17 -07:00
stacktrace.c xtensa: move oprofile stack tracing to stacktrace.c 2015-08-17 07:32:49 +03:00
syscall.c xtensa: nommu: don't provide arch_get_unmapped_area 2014-10-21 13:28:48 +04:00
time.c xtensa/time: Migrate to new 'set-state' interface 2015-08-10 11:41:07 +02:00
traps.c xtensa: implement fake NMI 2015-08-17 07:33:39 +03:00
vectors.S xtensa: implement fake NMI 2015-08-17 07:33:39 +03:00
vmlinux.lds.S xtensa: don't allow overflow/underflow on unaligned stack 2014-08-14 11:59:32 +04:00
xtensa_ksyms.c xtensa: export __{invalidate,flush}_dcache_range 2014-04-02 01:35:50 +04:00