Skip to content

Commit ac93ac7

Browse files
committed
PCI: Don't check resource_size() in pci_bus_alloc_resource()
Paul reported that after f75b99d ("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: f75b99d 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>
1 parent 3cdeb71 commit ac93ac7

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

drivers/pci/bus.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,6 @@ static int pci_bus_alloc_from_region(struct pci_bus *bus, struct resource *res,
162162

163163
avail = *r;
164164
pci_clip_resource_to_region(bus, &avail, region);
165-
if (!resource_size(&avail))
166-
continue;
167165

168166
/*
169167
* "min" is typically PCIBIOS_MIN_IO or PCIBIOS_MIN_MEM to

0 commit comments

Comments
 (0)