mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bjorn Helgaas <bjorn.helgaas@hp.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Rene Herman <rene.herman@keyaccess.nl>,
	Jesse Barnes <jbarnes@virtuousgeek.org>,
	Len Brown <lenb@kernel.org>, Frans Pop <elendil@planet.nl>,
	"Rafael J. Wysocki" <rjw@sisk.pl>,
	linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
	linux-acpi@vger.kernel.org, Adam Belay <abelay@mit.edu>,
	Avuton Olrich <avuton@gmail.com>,
	Karl Bellve <karl.bellve@umassmed.edu>,
	Willem Riede <wriede@riede.org>,
	Matthew Hall <mhall@mhcomputing.net>
Subject: Re: [patch 2/2] PNP: don't check disabled PCI BARs for conflicts in quirk_system_pci_resources()
Date: Tue, 30 Sep 2008 13:12:48 -0600	[thread overview]
Message-ID: <200809301312.50712.bjorn.helgaas@hp.com> (raw)
In-Reply-To: <alpine.LFD.2.00.0809300904530.3389@nehalem.linux-foundation.org>

On Tuesday 30 September 2008 10:29:44 am Linus Torvalds wrote:
> 
> On Tue, 30 Sep 2008, Rene Herman wrote:
> > 
> > > Of course, it may be that the PnP code runs too early, and we have only
> > > parsed the PCI resources, not inserted them into the resource tree yet. If
> > > so, none of this will work, of course.
> > 
> > It doesn't. With the test negated it triggers for all PCI resources (and
> > ofcourse my soundcard driver fails again).
> 
> Oh, ok. Looking at it, it does seem that we actually _insert_ the PCI 
> resources too late. We do it in pcibios_allocate_resources(), and there we 
> even take care to look at whether it was enabled or disabled (we 
> prioritize enabled resources, so that a disabled one will never be 
> requested before an enabled one and if they clash, it's always the 
> disabled one that loses the resource).
> 
> But pcibios_allocate_resources() is called from pcibios_resource_survey(), 
> which is called from pcibios_init(), which in turn is caled from 
> pci_subsys_init() that is a "subsys_initcall()".
> 
> In contrast, the PnP fixup thing is called from pnp_fixup_device, called 
> from __pnp_add_device(), called from pnp_add_device() (and 
> pnp_add_card(), but that should be later), and those in turn from
> pnpacpi_add_device and pnpacpi_init(). 
> 
> And pnpacpi_init is _also_ a subsys_initcall, but arch/x86/pci/built-in.o 
> gets linked in _after_ drivers/built-in.o. That, in turn, is because it's 
> marked as a "driver" in the x86 Makefile, and the main Makefile actually 
> ends up forcing "drivers-y" to have drivers/ first.
> 
> Just for fun, does this patch make a difference and allow you to just 
> take the "is it registered" thing into account?
> 
> It's a scary change right now, and I wouldn't commit it as is (I think 
> that for 2.6.27 the thing to do is to just do the minimal "zero means 
> disabled" thing), but having some random driver level initialize before 
> the core architecture-specific PCI code does smell. So something like this 
> sounds conceptually right anyway.

Sorry for the delay in responding -- I'm officially on vacation
yesterday and today.

I agree that for 2.6.27 the "res->start == 0 means disabled" check
in the PNP quirk seems safest.

I don't like it long-term, because (a) I'd like that knowledge to at
least be in PCI, not PNP, and (b) res->start is the CPU address, not
necessarily the PCI bus address, and the BAR value (== PCI bus address)
is what we're trying to check.  Even if we looked at the BAR value
instead of res->start, I think zero is a valid PCI bus address on
machines where the root bridge applies an address offset.

So something like the patch below (same as what Rene originally
proposed, I think)?

diff --git a/drivers/pnp/quirks.c b/drivers/pnp/quirks.c
index 0bdf9b8..b3319e4 100644
--- a/drivers/pnp/quirks.c
+++ b/drivers/pnp/quirks.c
@@ -254,6 +254,10 @@ static void quirk_system_pci_resources(struct pnp_dev *dev)
 
 			pci_start = pci_resource_start(pdev, i);
 			pci_end = pci_resource_end(pdev, i);
+
+			if (!pci_start)
+				continue;
+
 			for (j = 0;
 			     (res = pnp_get_resource(dev, type, j)); j++) {
 				if (res->start == 0 && res->end == 0)


  parent reply	other threads:[~2008-09-30 19:13 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-29 15:53 [patch 0/2] don't check disabled PCI BARs for conflicts with PNP devices Bjorn Helgaas
2008-09-29 15:56 ` [patch 1/2] PCI: add pci_resource_enabled() Bjorn Helgaas
2008-09-29 15:57 ` [patch 2/2] PNP: don't check disabled PCI BARs for conflicts in quirk_system_pci_resources() Bjorn Helgaas
2008-09-29 16:34   ` Linus Torvalds
2008-09-29 18:31     ` Rene Herman
2008-09-29 19:13       ` Linus Torvalds
2008-09-30  9:19         ` Rene Herman
2008-09-30 14:48           ` Linus Torvalds
2008-09-30 15:57             ` Rene Herman
2008-09-30 16:29               ` Linus Torvalds
2008-09-30 17:10                 ` Linus Torvalds
2008-09-30 17:21                   ` Linus Torvalds
2008-09-30 19:29                     ` Rene Herman
2008-09-30 19:37                       ` Rene Herman
2008-09-30 19:44                       ` Linus Torvalds
2008-09-30 20:48                         ` Rene Herman
2008-09-30 19:38                     ` Ingo Molnar
2008-09-30 19:51                       ` Linus Torvalds
2008-09-30 19:54                         ` Arjan van de Ven
2008-09-30 20:01                         ` Ingo Molnar
2008-10-01  6:13                         ` Grant Grundler
2008-10-01  8:26                           ` Ingo Molnar
2008-10-06  5:34                             ` Grant Grundler
2008-10-01 15:14                           ` Linus Torvalds
2008-10-01 16:21                             ` Yinghai Lu
2008-09-30 20:05                       ` Rolf Eike Beer
2008-10-01  8:52                         ` Ingo Molnar
2008-09-30 18:01                 ` Linus Torvalds
2008-09-30 18:13                   ` Linus Torvalds
2008-09-30 19:51                     ` Rene Herman
2008-09-30 19:16                   ` Bjorn Helgaas
2008-09-30 19:12                 ` Bjorn Helgaas [this message]
2008-10-01 20:18                   ` Bjorn Helgaas

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=200809301312.50712.bjorn.helgaas@hp.com \
    --to=bjorn.helgaas@hp.com \
    --cc=abelay@mit.edu \
    --cc=avuton@gmail.com \
    --cc=elendil@planet.nl \
    --cc=jbarnes@virtuousgeek.org \
    --cc=karl.bellve@umassmed.edu \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mhall@mhcomputing.net \
    --cc=rene.herman@keyaccess.nl \
    --cc=rjw@sisk.pl \
    --cc=torvalds@linux-foundation.org \
    --cc=wriede@riede.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®