From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: linux-pci@atrey.karlin.mff.cuni.cz,
Linux Kernel list <linux-kernel@vger.kernel.org>,
Matthew Wilcox <matthew@wil.cx>
Subject: Re: Weirdness in pci_read_bases()
Date: Tue, 04 Mar 2008 07:42:34 +1100 [thread overview]
Message-ID: <1204576954.21545.10.camel@pasglop> (raw)
In-Reply-To: <200803031112.27658.jbarnes@virtuousgeek.org>
On Mon, 2008-03-03 at 11:12 -0800, Jesse Barnes wrote:
> On Thursday, February 28, 2008 6:37 pm Benjamin Herrenschmidt wrote:
> > Hi !
> >
> > There is something dodgy going on in pci_read_bases().
> >
> > In addition to the fact (or related to it) that we tend to treat
> > res->start == 0 as meaning "unassigned" (which at this stage is mostly
> > incorrect, but let's say I can cope),
>
> Yeah, that sounds like trouble. I expect this may become a problem even for
> PC architectures in the future (IOMMUs on multiple busses for example), so
> maybe it makes sense to change the core to not assume 0 == unassigned?
Not only iommu's. On lots of platforms, we have the PCI MMIO space
mapped 1:N, that is, an access at MMIO location N turns into a PCI cycle
with address 0. So outbound PCI is effectively remapped, thus allowing
access to things like 0 etc... without punching holes in RAM and without
other dirty x86-like tricks.
The main question regarding 0 in a BAR is do we know of devices that
consider it as "disabled" and don't operate/decode 0 ? (That would be
gross and out of spec but who knows...)
If not, then there is no notion of "unassigned" at all... Anything is
"assigned", it's just a matter of whether the value we get at boot time
overlaps with something else or not, or is within the range of the host
bridge or not.
Unfortunately, while pretty much all architectures have a clear idea of
what is decoded by a given bridge, and what overlap with others and what
not, x86 doesn't :-)
But that can be solved, using something akin to IORESOURCE_UNSET, like
we do on powerpc, generalizing it, and having an x86-specific quirk set
it on anything that comes up with resource->start == 0.
> But we should never hit the l == 0xffffffff case if it's a memory BAR, since
> the low bit will be 0, right?
And for an IO BAR, there's another bit that should be 0, so that's
simply an impossible value for a BAR.
> I think Grant is probably right that the only time we'd hit this is if the bus
> is down and we're getting back all 1s for every read (though that's a PC
> specific assumption).
But the next two write/reads for sizing would have worked ? Unlikely...
I wonder if we can just remove that test completely :-)
> Yeah, it seems like it could be safely removed, but this is an area where we
> should probably move slowly (i.e. one, very small change to the probing code
> at a time) or it may be difficult to isolate any bugs in the wild.
True.
Cheers,
Ben.
next prev parent reply other threads:[~2008-03-03 20:43 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-29 2:37 Weirdness in pci_read_bases() Benjamin Herrenschmidt
2008-02-29 7:15 ` Grant Grundler
2008-03-03 19:12 ` Jesse Barnes
2008-03-03 20:42 ` Benjamin Herrenschmidt [this message]
2008-03-03 20:57 ` Jesse Barnes
2008-03-03 21:02 ` Jesse Barnes
2008-03-03 21:29 ` Alan Cox
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=1204576954.21545.10.camel@pasglop \
--to=benh@kernel.crashing.org \
--cc=jbarnes@virtuousgeek.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@atrey.karlin.mff.cuni.cz \
--cc=matthew@wil.cx \
/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.