All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Yinghai Lu <yinghai@kernel.org>, Bjorn Helgaas <bhelgaas@google.com>
Cc: "linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Subject: Re: [RFC PATCH v2] PCI: Only enable IO window if supported
Date: Wed, 29 Jul 2015 12:46:45 -0700	[thread overview]
Message-ID: <55B92DA5.4030409@roeck-us.net> (raw)
In-Reply-To: <CAE9FiQWr3-dw0FhgZjSq=pT-Cn3DaDV3E4QFjURJbQo_igQGNw@mail.gmail.com>

On 07/29/2015 12:30 PM, Yinghai Lu wrote:
> On Wed, Jul 29, 2015 at 9:09 AM, Bjorn Helgaas <bhelgaas@google.com> 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.
>

Hi Yinghai,

excellent catch. Unfortunately, I don't know how to make it
work with the reversed flag. The idea here was that the flag
propagates from parent to child. This makes sense for an
"it doesn't work" flag to be inherited from the child,
but not for an "it works" flag.

Guenter


  reply	other threads:[~2015-07-29 19:46 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-07 18:11 [RFC PATCH v2] PCI: Only enable IO window if supported Guenter Roeck
2015-07-24  3:09 ` Guenter Roeck
2015-07-29 16:09 ` Bjorn Helgaas
2015-07-29 19:30   ` Yinghai Lu
2015-07-29 19:46     ` Guenter Roeck [this message]
2015-07-29 19:53       ` Yinghai Lu
2015-07-29 20:02         ` Guenter Roeck
2015-07-29 20:24           ` Yinghai Lu
2015-07-29 20:26           ` Bjorn Helgaas
2015-07-30  3:59             ` Yinghai Lu
2015-07-30  4:17               ` Guenter Roeck
2015-07-30 16:18                 ` Bjorn Helgaas
2015-07-30 17:06                   ` Guenter Roeck
2015-07-29 20:18         ` Guenter Roeck
2015-07-29 20:21           ` Yinghai Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55B92DA5.4030409@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=bhelgaas@google.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=yinghai@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.