Re: [RFC PATCH v2] PCI: Only enable IO window if supported

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 29, 2015 at 9:09 AM, Bjorn Helgaas <bhelgaas@xxxxxxxxxx> wrote:
> On Tue, Jul 07, 2015 at 11:11:20AM -0700, Guenter Roeck wrote:
>> The PCI subsystem always assumes that I/O is supported on PCIe bridges
>> and tries to assign an I/O window to each child bus even if that is not
>> the case.
>>
>> This may result in messages such as
>>
>> pcieport 0000:02:00.0: res[7]=[io  0x1000-0x0fff]
>>                                       get_res_add_size add_size 1000
>> pcieport 0000:02:00.0: BAR 7: no space for [io  size 0x1000]
>> pcieport 0000:02:00.0: BAR 7: failed to assign [io  size 0x1000]
>>
>
> Applied to pci/resource for v4.3, thanks!
>> @@ -340,6 +369,23 @@ static void pci_read_bridge_io(struct pci_bus *child)
>>       struct pci_bus_region region;
>>       struct resource *res;
>>
>> +     if (child->bus_flags & PCI_BUS_FLAGS_NO_IO)
>> +             return;
>> +
>> +     if (!pci_bus_supports_io(child)) {
>> +             dev_printk(KERN_DEBUG, &dev->dev,
>> +                        "  bus does not support IO\n");
>> +             child->bus_flags |= PCI_BUS_FLAGS_NO_IO;
>> +             return;
>> +     }
>> +
>> +     if (!pci_root_has_io_resource(child)) {
>> +             dev_printk(KERN_DEBUG, &dev->dev,
>> +                        "  no IO window on root bus\n");
>> +             child->bus_flags |= PCI_BUS_FLAGS_NO_IO;
>> +             return;
>> +     }
>> +
>>       io_mask = PCI_IO_RANGE_MASK;
>>       io_granularity = 0x1000;
>>       if (dev->io_window_1k) {

Hi Bjorn,

Looks like you flip the PCI_BUS_FLAGS_NO_IO to
PCI_BUS_FLAGS_SUPPORT_IO, and now have

@@ -340,6 +373,21 @@ static void pci_read_bridge_io(struct pci_bus *child)
        struct pci_bus_region region;
        struct resource *res;

+       if (!(child->bus_flags & PCI_BUS_FLAGS_SUPPORTS_IO))
+               return;
+
+       if (!pci_bridge_supports_io(dev)) {
+               dev_printk(KERN_DEBUG, &dev->dev, "  no I/O window\n");
+               return;
+       }
+
+       if (!pci_root_has_io_resource(child)) {
+               dev_printk(KERN_DEBUG, &dev->dev, "  no I/O resource
on root bus\n");
+               return;
+       }
+
+       child->bus_flags |= PCI_BUS_FLAGS_SUPPORTS_IO;
+

so PCI_BUS_FLAGS_SUPPORTS_IO will never get set.

Yinghai
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux