From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: linux-pci@atrey.karlin.mff.cuni.cz, Alan Cox <alan@redhat.com>,
Greg Kroah-Hartman <greg@kroah.com>,
jgarzik@pobox.com, wingel@nano-system.com,
Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>,
james.smart@emulex.com, linux-driver@qlogic.com,
linux-kernel@vger.kernel.org
Subject: Re: [RFC/PATCH 4/4] [POWERPC] pci: Disable IO/Mem on a device when resources can't be allocated
Date: Tue, 18 Dec 2007 22:36:09 +1100 [thread overview]
Message-ID: <1197977769.13400.42.camel@pasglop> (raw)
In-Reply-To: <20071218125643.B7874@jurassic.park.msu.ru>
On Tue, 2007-12-18 at 12:56 +0300, Ivan Kokshaysky wrote:
> On Tue, Dec 18, 2007 at 10:01:15AM +1100, Benjamin Herrenschmidt wrote:
> > @@ -1040,7 +1040,10 @@ static inline void __devinit alloc_resou
> > r->flags |= IORESOURCE_UNSET;
> > r->end -= r->start;
> > r->start = 0;
>
> Perhaps we should use IORESOURCE_UNSET universally... It's a lot better
> than clearing r->start which is in fact architecture dependent thing
> and in the end just destroys information for no purpose.
I'm not totally sure. I was actually tempted to switch powerpc to get
rid of it lately :-)
The problem is that a resource is never "unset" on PCI... the BAR always
contains something... the question is whether that something is going to
be problematic or not, or rather, whether that something can be
"allocated" (ie. fitted into the resource tree in a free spot or not).
And we have a way of knowing that already which is ... resource->parent
being NULL or not. That also happens to be what
pci_assign_unassigned_resources() uses and I think the various arch
pcibios_enable_device() should use (in fact I have a fix to make PowerPC
use that) instead of testing res->start or even IORESOURCE_UNSET.
Anything that isn't in the resource tree is potentially stale and thus
mustn't be enabled (ie. IO/MEM decoding must not be enabled on a device
that has a BAR whose res->parent is NULL).
The reason why we introduced use of IORESOURCE_UNSET on powerpc goes
back from when we had our own resource assignment code there that was
somewhat a half-assed version of what pci_assign_unassigned_resources().
We decided to introduce IORESOURCE_UNSET rather than testing res->start
because it could cope with a value of 0 being valid, and on machines
with no legacy ISA stuff at all, 0 is a valid BAR value for some things,
and we weren't smart enough to reassign those things in all
circumstances.
Nowadays, that doesn't seem necessary anymore, and in fact, I think we
can still support those valid 0 BARs -and- not have IORESOURCE_UNSET by
standardizing on the idea that res->parent is the only indicator of a
resource validity... unless I'm missing something which is quite
possible :-)
Cheers,
Ben.
next prev parent reply other threads:[~2007-12-18 19:47 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-17 23:01 [RFC/PATCH 1/4] pci: Add pci_enable_device_{io,mem} intefaces Benjamin Herrenschmidt
2007-12-17 23:01 ` [RFC/PATCH 3/4] pci: Remove pci_enable_device_bars() Benjamin Herrenschmidt
2007-12-24 7:08 ` Grant Grundler
2007-12-25 21:16 ` Benjamin Herrenschmidt
2007-12-17 23:01 ` [RFC/PATCH 2/4] pci: Remove users of pci_enable_device_bars() Benjamin Herrenschmidt
2007-12-18 0:07 ` Alan Cox
2007-12-18 0:26 ` Benjamin Herrenschmidt
2007-12-24 7:13 ` Grant Grundler
2007-12-17 23:01 ` [RFC/PATCH 4/4] [POWERPC] pci: Disable IO/Mem on a device when resources can't be allocated Benjamin Herrenschmidt
2007-12-18 9:56 ` Ivan Kokshaysky
2007-12-18 11:36 ` Benjamin Herrenschmidt [this message]
2007-12-24 7:23 ` Grant Grundler
2007-12-25 21:20 ` Benjamin Herrenschmidt
2007-12-25 21:26 ` Benjamin Herrenschmidt
2007-12-27 21:03 ` Grant Grundler
2007-12-17 23:49 ` [RFC/PATCH 1/4] pci: Add pci_enable_device_{io,mem} intefaces Johannes Weiner
2007-12-17 23:55 ` Benjamin Herrenschmidt
2007-12-18 0:02 ` Benjamin Herrenschmidt
2007-12-18 9:37 ` Ivan Kokshaysky
2007-12-18 9:43 ` Benjamin Herrenschmidt
2007-12-19 5:10 ` [RFC/PATCH]] x86: pci: Disable IO/Mem on a device when resources can't be allocated Benjamin Herrenschmidt
2007-12-19 13:43 ` Ivan Kokshaysky
2007-12-19 20:29 ` Benjamin Herrenschmidt
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=1197977769.13400.42.camel@pasglop \
--to=benh@kernel.crashing.org \
--cc=alan@redhat.com \
--cc=bzolnier@gmail.com \
--cc=greg@kroah.com \
--cc=ink@jurassic.park.msu.ru \
--cc=james.smart@emulex.com \
--cc=jgarzik@pobox.com \
--cc=linux-driver@qlogic.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@atrey.karlin.mff.cuni.cz \
--cc=wingel@nano-system.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox