linux/drivers/pci
Myron Stowe 8a5db4152b PCI: Restore detection of read-only BARs
commit 36e8164882 upstream.

Commit 6ac665c63d ("PCI: rewrite PCI BAR reading code") masked off
low-order bits from 'l', but not from 'sz'.  Both are passed to pci_size(),
which compares 'base == maxbase' to check for read-only BARs.  The masking
of 'l' means that comparison will never be 'true', so the check for
read-only BARs no longer works.

Resolve this by also masking off the low-order bits of 'sz' before passing
it into pci_size() as 'maxbase'.  With this change, pci_size() will once
again catch the problems that have been encountered to date:

  - AGP aperture BAR of AMD-7xx host bridges: if the AGP window is
    disabled, this BAR is read-only and read as 0x00000008 [1]

  - BARs 0-4 of ALi IDE controllers can be non-zero and read-only [1]

  - Intel Sandy Bridge - Thermal Management Controller [8086:0103];
    BAR 0 returning 0xfed98004 [2]

  - Intel Xeon E5 v3/Core i7 Power Control Unit [8086:2fc0];
    Bar 0 returning 0x00001a [3]

Link: [1] https://git.kernel.org/cgit/linux/kernel/git/tglx/history.git/commit/drivers/pci/probe.c?id=1307ef6621991f1c4bc3cec1b5a4ebd6fd3d66b9 ("PCI: probing read-only BARs" (pre-git))
Link: [2] https://bugzilla.kernel.org/show_bug.cgi?id=43331
Link: [3] https://bugzilla.kernel.org/show_bug.cgi?id=85991
Reported-by: William Unruh <unruh@physics.ubc.ca>
Reported-by: Martin Lucina <martin@lucina.net>
Signed-off-by: Myron Stowe <myron.stowe@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
CC: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-01-16 06:59:30 -08:00
..
host PCI: mvebu: Fix uninitialized variable in mvebu_get_tgt_attr() 2014-10-30 09:38:23 -07:00
hotplug PCI: shpchp: Check bridge's secondary (not primary) bus speed 2014-06-07 10:28:24 -07:00
pcie Merge branch 'pci/dead-code' into next 2014-01-13 16:47:08 -07:00
Kconfig PCI: Convert ioapic to be builtin only, not modular 2014-01-03 14:31:38 -07:00
Makefile PCI: Add Virtual Channel to save/restore support 2013-12-17 17:39:08 -07:00
access.c PCI: Remove unused pci_vpd_truncate() 2014-01-13 11:14:43 -07:00
ats.c PCI: Removed unused parts of Page Request Interface support 2014-01-10 14:00:47 -07:00
bus.c PCI: Don't check resource_size() in pci_bus_alloc_resource() 2014-03-12 11:19:20 -06:00
host-bridge.c PCI: Convert pcibios_resource_to_bus() to take a pci_bus, not a pci_dev 2013-12-21 10:06:10 -07:00
hotplug-pci.c PCI: hotplug: remove pci_do_scan_bus() 2012-06-13 15:42:27 -06:00
htirq.c pci: Fix files needing export.h for EXPORT_SYMBOL/THIS_MODULE 2011-10-31 19:31:22 -04:00
ioapic.c ACPI and power management updates for 3.14-rc1 2014-01-24 15:51:02 -08:00
iov.c PCI: Never treat a VF as a multifunction device 2014-01-10 10:05:26 -07:00
irq.c PCI: Fix whitespace, capitalization, and spelling errors 2013-11-14 11:28:18 -07:00
msi.c PCI/MSI: Add device flag indicating that 64-bit MSIs don't work 2014-12-06 15:55:34 -08:00
of.c PCI: OF: Don't crash when bridge parent is NULL. 2011-08-19 08:51:37 -07:00
pci-acpi.c ACPI and power management updates for 3.14-rc1 2014-01-24 15:51:02 -08:00
pci-driver.c PCI: Disable Bus Master only on kexec reboot 2013-12-07 14:20:28 -07:00
pci-label.c ACPI / PCI: Fix sysfs acpi_index and label errors 2014-09-05 16:34:15 -07:00
pci-stub.c PCI: Fix whitespace, capitalization, and spelling errors 2013-11-14 11:28:18 -07:00
pci-sysfs.c PCI: Rename sysfs 'enabled' file back to 'enable' 2014-11-14 09:00:09 -08:00
pci.c PCI: Configure ASPM when enabling device 2014-09-05 16:34:15 -07:00
pci.h PCI: Make local functions static 2014-01-13 11:57:29 -07:00
probe.c PCI: Restore detection of read-only BARs 2015-01-16 06:59:30 -08:00
proc.c PCI: Fix whitespace, capitalization, and spelling errors 2013-11-14 11:28:18 -07:00
quirks.c PCI: Increase IBM ipr SAS Crocodile BARs to at least system page size 2014-10-30 09:38:23 -07: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: Convert pcibios_resource_to_bus() to take a pci_bus, not a pci_dev 2013-12-21 10:06:10 -07:00
search.c PCI: Fix whitespace, capitalization, and spelling errors 2013-11-14 11:28:18 -07:00
setup-bus.c Merge branch 'pci/resource' into next 2014-01-10 14:23:15 -07:00
setup-irq.c PCI: Provide a default pcibios_update_irq() 2012-09-18 17:28:21 -06:00
setup-res.c PCI: Convert pcibios_resource_to_bus() to take a pci_bus, not a pci_dev 2013-12-21 10:06:10 -07:00
slot.c PCI: Remove unused pci_renumber_slot() 2014-01-13 11:14:44 -07:00
syscall.c PCI: Fix whitespace, capitalization, and spelling errors 2013-11-14 11:28:18 -07: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 pci: Fix files needing export.h for EXPORT_SYMBOL/THIS_MODULE 2011-10-31 19:31:22 -04:00
xen-pcifront.c Features: 2014-01-22 22:00:18 -08:00