All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <bhelgaas@google.com>
To: Guenter Roeck <groeck@juniper.net>
Cc: "linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	Yinghai Lu <yinghai@kernel.org>
Subject: Re: BAR 7 io space assignment errors
Date: Sat, 16 May 2015 08:12:09 -0500	[thread overview]
Message-ID: <20150516131209.GD31666@google.com> (raw)
In-Reply-To: <20150516022713.GA4417@svl-evodev-groeck.juniper.net>

On Fri, May 15, 2015 at 07:27:13PM -0700, Guenter Roeck wrote:
> On Fri, May 15, 2015 at 05:11:49PM -0500, Bjorn Helgaas wrote:
> > This sounds like an interesting topology.  A device coming online later is
> > a hotplug event from the core's point of view.  Since the core can't tell
> > what a hot-added device is going to be, it allocates a default amount of
> > space (pci_hotplug_io_size) to accomodate it.  You can influence that with
> > the "pci=hpiosize=" boot parameter.  Maybe "pci=hpiosize=0" would help in
> > your case, but we'd still have the problem that the messages don't make
> > sense to the average user (including me).
> > 
> Also, I don't really want to specify lots of boot parameters if I can avoid it.

Yes, I agree completely.  I hate boot parameters.

> >   fsl-pci fff70a000.pcie: PCI host bridge to bus 0000:00
> >   pci_bus 0000:00: root bus resource [io  0x0000-0xffff]
> >   pci 0000:00:00.0: PCI bridge to [bus 01-ff]      # Root Port
> >   pci 0000:00:00.0:   bridge window [io  0x0000-0x0fff]
> > 
> > The host bridge does have an I/O aperture, and it looks like firmware set
> > up the 00:00.0 bridge with a small piece of that.  That's sort of a waste:
> > supposedly we have 64K of I/O space available on bus 00, and 4K of that is
> > routed to [bus 01-ff].  The other 60K could be used by other devices on bus
> > 00, but it doesn't look like there *are* any, so it is wasted.
> > 
> The problem is that I can not reprogram PCI_IO_BASE on 0000:00:00.0.
> Here is a debug log:
> 
> pci 0000:00:00.0: io base written 0xe0f0 reads back as 0x0
> pci 0000:00:00.0: io base written 0xf000 reads back as 0x0

That's odd; that's a non-conformant bridge.  Per spec (PCI-to-PCI Bridge
r1.2, sec 3.2.5.6), for a bridge that implements an I/O address range, the
upper four bits of I/O Base is writable.

But I suspect this bridge is discovered via OF and there's something broken
about how config access is done.  That's arch code and I don't know much
about it.

Or maybe the hardware itself is not quite spec-compliant, although it would
be strange to have I/O aperture addresses hard-wired into the hardware.  

> The io ranges of ports behind it (ie the ones below) are programmable.
> I can try to find out if there is a means to program the io range
> on 0000:00:00.0, but I would prefer to just disable the io range for
> everything downstream of it.

As far as I can tell, you don't need any I/O port space anywhere in this
hierarchy.  If you could disable this host bridge I/O aperture:

  PCI host bridge /pcie@a000 (primary) ranges:
    IO 0x0000000fffc00000..0x0000000fffc0ffff -> 0x0000000000000000

e.g., remove it from the OF description of the bridge, the core could know
that it needn't bother trying to assign I/O space.  It might not be smart
enough to notice that today, but it would at least be possible in
principle.

> "bridge window [io  0x1000-0x0fff]" for sure looks odd. Maybe it means
> something to you, but for me it is just confusing.

"The I/O Limit register can be programmed to a smaller value than the I/O
Base register, if there are no I/O addresses on the secondary side of the
bridge."  So this would ordinarily mean the I/O window is disabled.  But I
agree, this is a confusing way to say it.

Bjorn

  reply	other threads:[~2015-05-16 13:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-15 17:28 BAR 7 io space assignment errors Guenter Roeck
2015-05-15 19:25 ` Bjorn Helgaas
2015-05-15 20:04   ` Guenter Roeck
2015-05-15 22:11     ` Bjorn Helgaas
2015-05-16  2:27       ` Guenter Roeck
2015-05-16 13:12         ` Bjorn Helgaas [this message]
2015-05-16 16:41           ` Guenter Roeck
2015-05-18 15:55             ` Bjorn Helgaas
2015-05-19  0:18               ` Guenter Roeck

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=20150516131209.GD31666@google.com \
    --to=bhelgaas@google.com \
    --cc=groeck@juniper.net \
    --cc=linux-pci@vger.kernel.org \
    --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.