]> git.baikalelectronics.ru Git - kernel.git/commit
PCI: Don't check resource_size() in pci_bus_alloc_resource()
authorBjorn Helgaas <bhelgaas@google.com>
Tue, 11 Mar 2014 20:23:12 +0000 (14:23 -0600)
committerBjorn Helgaas <bhelgaas@google.com>
Wed, 12 Mar 2014 17:19:20 +0000 (11:19 -0600)
commitc353d8d689e312cc75babb0d5afb8abf9e858fa8
treea75cae106cf2b399d18b72bc05856d0e3cc6aa48
parent539093663d4cf605c846c1921b6a1ee20b326724
PCI: Don't check resource_size() in pci_bus_alloc_resource()

Paul reported that after 2b686543c9ee ("PCI: Enforce bus address limits in
resource allocation") on a 32-bit kernel (CONFIG_PHYS_ADDR_T_64BIT not
set), intel-gtt complained "can't ioremap flush page - no chipset
flushing".  In addition, other PCI resource allocations, e.g., for bridge
windows, failed.

This happens because we incorrectly skip bus resources of
[mem 0x00000000-0xffffffff] because we think they are of size zero.
When resource_size_t is 32 bits wide, resource_size() on
[mem 0x00000000-0xffffffff] returns 0 because (r->end - r->start + 1)
overflows.

Therefore, we can't use "resource_size() == 0" to decide that allocation
from this resource will fail.  allocate_resource() should fail anyway if it
can't satisfy the address constraints, so we should just depend on that.

A [mem 0x00000000-0xffffffff] bus resource is obviously not really valid,
but we do fall back to it as a default when we don't have information about
host bridge apertures.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=71611
Fixes: 2b686543c9ee PCI: Enforce bus address limits in resource allocation
Reported-and-tested-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/pci/bus.c