linux/drivers/pci
Yinghai Lu 8505e729a2 PCI: Add pci_claim_bridge_resource() to clip window if necessary
Add pci_claim_bridge_resource() to claim a PCI-PCI bridge window.  This is
like regular pci_claim_resource(), except that if we fail to claim the
window, we check to see if we can reduce the size of the window and try
again.

This is for scenarios like this:

  pci_bus 0000:00: root bus resource [mem 0xc0000000-0xffffffff]
  pci 0000:00:01.0:   bridge window [mem 0xbdf00000-0xddefffff 64bit pref]
  pci 0000:01:00.0: reg 0x10: [mem 0xc0000000-0xcfffffff pref]

The 00:01.0 window is illegal: it starts before the host bridge window, so
we have to assume the [0xbdf00000-0xbfffffff] region is inaccessible.  We
can make it legal by clipping it to [mem 0xc0000000-0xddefffff 64bit pref].

Previously we discarded the 00:01.0 window and tried to reassign that part
of the hierarchy from scratch.  That is a problem because Linux doesn't
always assign things optimally.  For example, in this case, BIOS put the
01:00.0 device in a prefetchable window below 4GB, but after 5b28541552,
Linux puts the prefetchable window above 4GB where the 32-bit 01:00.0
device can't use it.

Clipping the 00:01.0 window is less intrusive than completely reassigning
things and is sufficient to let us use most of the BIOS configuration.  Of
course, it's possible that devices below 00:01.0 will no longer fit.  If
that's the case, we'll have to reassign things.  But that's a separate
problem.

[bhelgaas: changelog, split into separate patch]
Link: https://bugzilla.kernel.org/show_bug.cgi?id=85491
Reported-by: Marek Kordik <kordikmarek@gmail.com>
Fixes: 5b28541552 ("PCI: Restrict 64-bit prefetchable bridge windows to 64-bit resources")
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
CC: stable@vger.kernel.org	# v3.16+
2015-01-16 10:04:42 -06:00
..
host Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
hotplug Merge branch 'x86-apic-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2014-12-19 14:02:02 -08:00
pcie PCI / PM: Drop CONFIG_PM_RUNTIME from the PCI core 2014-12-04 00:50:33 +01:00
access.c PCI: Apply _HPX Link Control settings to all devices with a link 2014-11-13 15:43:42 -07:00
ats.c PCI: Removed unused parts of Page Request Interface support 2014-01-10 14:00:47 -07:00
bus.c PCI: Add pci_bus_clip_resource() to clip to fit upstream window 2015-01-16 10:04:42 -06:00
host-bridge.c PCI: Remove unnecessary includes of <linux/init.h> 2014-04-14 16:12:37 -06:00
hotplug-pci.c PCI: Remove unnecessary __ref annotations 2014-04-29 17:36:44 -06:00
htirq.c PCI changes for the v3.16 merge window (part 2): 2014-06-12 13:20:24 -07:00
iov.c PCI: Remove fixed parameter in pci_iov_resource_bar() 2014-11-19 15:07:43 -07:00
irq.c PCI: Fix whitespace, capitalization, and spelling errors 2013-11-14 11:28:18 -07:00
Kconfig x86, irq: Make MSI and HT_IRQ indepenent of X86_IO_APIC 2014-12-16 14:08:17 +01:00
Makefile PCI: Remove PCI ioapic driver 2014-12-16 14:08:14 +01:00
msi.c Merge branch 'irq-irqdomain-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2014-12-10 09:01:01 -08:00
of.c
pci-acpi.c PCI: Delete unnecessary NULL pointer checks 2014-11-10 21:02:17 -07:00
pci-driver.c PCI / PM: Drop CONFIG_PM_RUNTIME from the PCI core 2014-12-04 00:50:33 +01:00
pci-label.c ACPI / PCI: Fix sysfs acpi_index and label errors 2014-07-02 15:27:08 -06:00
pci-stub.c PCI: Whitespace cleanup 2014-06-10 20:20:19 -06:00
pci-sysfs.c Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
pci.c PCI: Add flag for devices where we can't use bus reset 2015-01-16 10:04:38 -06:00
pci.h PCI: Add pci_bus_clip_resource() to clip to fit upstream window 2015-01-16 10:04:42 -06:00
probe.c PCI changes for the v3.19 merge window: 2014-12-10 20:58:52 -08:00
proc.c PCI: Whitespace cleanup 2014-06-10 20:20:19 -06:00
quirks.c PCI: Mark Atheros AR93xx to avoid bus reset 2015-01-16 10:04:38 -06:00
remove.c Revert "PCI: Remove from bus_list and release resources in pci_release_dev()" 2014-02-01 10:24:31 -08:00
rom.c PCI: Whitespace cleanup 2014-06-10 20:20:19 -06:00
search.c PCI: Delete unnecessary NULL pointer checks 2014-11-10 21:02:17 -07:00
setup-bus.c PCI: Add pci_claim_bridge_resource() to clip window if necessary 2015-01-16 10:04:42 -06:00
setup-irq.c PCI: Whitespace cleanup 2014-06-10 20:20:19 -06:00
setup-res.c PCI: Tidy resource assignment messages 2014-07-08 16:29:08 -06:00
slot.c VERIFY_OCTAL_PERMISSIONS: stricter checking for sysfs perms. 2014-03-24 12:21:00 +10:30
syscall.c PCI: Whitespace cleanup 2014-06-10 20:20:19 -06:00
vc.c PCI: Rename PCI_VC_PORT_REG1/2 to PCI_VC_PORT_CAP1/2 2013-12-17 17:49:39 -07:00
vpd.c
xen-pcifront.c Merge branches 'pci/enumeration', 'pci/hotplug', 'pci/misc', 'pci/numa' and 'pci/virtualization' into next 2014-11-19 15:10:33 -07:00