From: Bjorn Helgaas <bjorn.helgaas@hp.com>
To: Frans Pop <elendil@planet.nl>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
Thomas Gleixner <tglx@linutronix.de>,
Jesse Barnes <jbarnes@virtuousgeek.org>,
Matthew Wilcox <matthew@wil.cx>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Rene Herman <rene.herman@keyaccess.nl>
Subject: Re: [Bug #11550] pnp: Huge number of "io resource overlap" messages
Date: Wed, 4 Mar 2009 14:53:51 -0700 [thread overview]
Message-ID: <200903041453.52771.bjorn.helgaas@hp.com> (raw)
In-Reply-To: <200903042117.18034.elendil@planet.nl>
On Wednesday 04 March 2009 01:17:15 pm Frans Pop wrote:
> On Friday 26 September 2008, Bjorn Helgaas wrote:
> > http://bugzilla.kernel.org/show_bug.cgi?id=11550
>
> Sorry for having to revive this old thread. In November 2008 I reported
> that this issue had been solved for me as a result of 1f98757776ea, but I
> now find that was due to faulty testing. (I suspect that changing the BIOS
> setting that affects this issue on my Toshiba laptop only takes effect
> after a cold boot, not a normal reboot.)
>
> The problem was that with the BIOS setting for "Device config" set to
> "Setup by OS", I get 78 messages like:
> pnp 00:08: io resource (0x2e-0x2f) overlaps 0000:00:1f.5 BAR 0 (0x0-0xff), disabling
> pnp 00:08: io resource (0x2e-0x2f) overlaps 0000:00:1f.6 BAR 0 (0x0-0xff), disabling
>
> If the BIOS setting is set to "All Devices", the problem does not occur.
>
> The origin of these messages was bisected to:
> commit aee3ad815dd291a7193ab01da0f1a30c84d00061
> Author: Bjorn Helgaas <bjorn.helgaas@hp.com>
> Date: Fri Jun 27 16:56:57 2008 -0600
> PNP: replace pnp_resource_table with dynamically allocated resources
>
> Last analysis from Bjorn was:
> > The problem seems to be that Frans has some PCI devices that are not
> > configured by the BIOS, and their BARs contain zero. A PNP quirk
> > checks for overlaps of PCI devices and PNP devices, and those zero-
> > valued BARs of course conflict with the PNP motherboard devices that
> > describe legacy hardware.
> >
> > Here's another approach based on section 3.5 of the PCI Firmware spec.
> > It says:
> >
> > Since not all devices may be configured prior to the operating
> > system handoff, the operating system needs to know whether a
> > specific BAR register has been configured by firmware. The operating
> > system makes the determination by checking the I/O Enable, and
> > Memory Enable bits in the device's command register, and Expansion
> > ROM BAR enable bits. If the enable bit is set, then the corresponding
> > resource register has been configured.
> >
> > So instead of checking whether the BAR contains zero, the patch below
> > checks the I/O, Mem, and ROM BAR enable bits to determine whether a
> > BAR is enabled.
>
> Below the then proposed patch from Bjorn, rediffed against 2.6.29-rc7.
> I've verified that the patch still solves the issue for me. Attached
> dmesg output for 2.6.29-rc7 without and with the patch.
>
> Bjorn, could you please consider this patch for inclusion again?
>
> Original thread: http://marc.info/?l=linux-kernel&m=122095745403793&w=4
Seems like we do need something, but this patch is kind of a klunky
approach, so I'd like to come up with a better proposal. I don't
have any better ideas yet, though.
Bjorn
> diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c
> index 32e8d88..e63f800 100644
> --- a/drivers/pci/setup-res.c
> +++ b/drivers/pci/setup-res.c
> @@ -26,6 +26,28 @@
> #include "pci.h"
>
>
> +int pci_resource_enabled(struct pci_dev *dev, int bar)
> +{
> + u16 command = 0;
> + u32 addr = 0;
> +
> + pci_read_config_word(dev, PCI_COMMAND, &command);
> +
> + if (pci_resource_flags(dev, bar) & IORESOURCE_IO)
> + return command & PCI_COMMAND_IO;
> +
> + if (command & PCI_COMMAND_MEMORY) {
> + if (bar == PCI_ROM_RESOURCE) {
> + pci_read_config_dword(dev, dev->rom_base_reg, &addr);
> + return addr & PCI_ROM_ADDRESS_ENABLE;
> + }
> +
> + return 1;
> + }
> +
> + return 0;
> +}
> +
> void pci_update_resource(struct pci_dev *dev, int resno)
> {
> struct pci_bus_region region;
> diff --git a/drivers/pnp/quirks.c b/drivers/pnp/quirks.c
> index 8473fe5..1f37988 100644
> --- a/drivers/pnp/quirks.c
> +++ b/drivers/pnp/quirks.c
> @@ -247,6 +247,9 @@ static void quirk_system_pci_resources(struct pnp_dev *dev)
> for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
> unsigned long type;
>
> + if (!pci_resource_enabled(pdev, i))
> + continue;
> +
> type = pci_resource_flags(pdev, i) &
> (IORESOURCE_IO | IORESOURCE_MEM);
> if (!type || pci_resource_len(pdev, i) == 0)
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index c927ae9..9848ac2 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -870,6 +870,8 @@ static inline int pci_proc_domain(struct pci_bus *bus)
> }
> #endif /* CONFIG_PCI_DOMAINS */
>
> +extern int pci_resource_enabled(struct pci_dev *dev, int bar);
> +
> #else /* CONFIG_PCI is not enabled */
>
> /*
> @@ -1050,6 +1052,9 @@ static inline struct pci_dev *pci_get_bus_and_slot(unsigned int bus,
> unsigned int devfn)
> { return NULL; }
>
> +static inline int pci_resource_enabled(struct pci_dev *dev, int bar)
> +{ return 0; }
> +
> #endif /* CONFIG_PCI */
>
> /* Include architecture-dependent settings and functions */
>
>
next prev parent reply other threads:[~2009-03-04 21:54 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-09 10:50 [bisected][resend] " Frans Pop
2008-09-09 11:22 ` Rene Herman
2008-09-09 15:30 ` Bjorn Helgaas
2008-09-09 16:26 ` Frans Pop
2008-09-09 17:40 ` Bjorn Helgaas
2008-09-09 18:31 ` Rene Herman
2008-09-18 5:10 ` Bjorn Helgaas
2008-09-20 23:49 ` Frans Pop
2008-09-20 23:56 ` Bjorn Helgaas
2008-09-26 21:40 ` [Bug #11550] " Bjorn Helgaas
2008-09-27 15:16 ` Frans Pop
2008-09-27 20:53 ` Ingo Molnar
2009-03-04 20:17 ` Frans Pop
2009-03-04 21:53 ` Bjorn Helgaas [this message]
2009-03-20 2:07 ` Jesse Barnes
2009-03-23 15:46 ` Bjorn Helgaas
2008-09-10 7:39 ` [bisected][resend] " Frans Pop
2008-09-10 21:34 ` Bjorn Helgaas
2008-09-11 16:58 ` Frans Pop
2008-11-07 9:51 ` Frans Pop
2008-11-07 10:00 ` Ingo Molnar
2008-09-12 18:59 2.6.27-rc6-git2: Reported regressions from 2.6.26 Rafael J. Wysocki
2008-09-12 19:06 ` [Bug #11550] pnp: Huge number of "io resource overlap" messages Rafael J. Wysocki
2008-09-12 22:52 ` Rene Herman
2008-09-21 18:52 2.6.27-rc6-git6: Reported regressions from 2.6.26 Rafael J. Wysocki
2008-09-21 18:54 ` [Bug #11550] pnp: Huge number of "io resource overlap" messages Rafael J. Wysocki
2008-09-27 15:54 2.6.27-rc7-git5: Reported regressions from 2.6.26 Rafael J. Wysocki
2008-09-27 15:56 ` [Bug #11550] pnp: Huge number of "io resource overlap" messages Rafael J. Wysocki
2008-10-04 17:28 2.6.27-rc8-git7: Reported regressions from 2.6.26 Rafael J. Wysocki
2008-10-04 17:32 ` [Bug #11550] pnp: Huge number of "io resource overlap" messages Rafael J. Wysocki
2008-10-07 22:34 ` Frans Pop
2008-10-25 21:04 2.6.28-rc1-git1: Reported regressions 2.6.26 -> 2.6.27 Rafael J. Wysocki
2008-10-25 21:07 ` [Bug #11550] pnp: Huge number of "io resource overlap" messages Rafael J. Wysocki
2008-10-26 16:43 ` Frans Pop
2008-11-02 16:47 2.6.28-rc2-git7: Reported regressions 2.6.26 -> 2.6.27 Rafael J. Wysocki
2008-11-02 16:49 ` [Bug #11550] pnp: Huge number of "io resource overlap" messages Rafael J. Wysocki
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=200903041453.52771.bjorn.helgaas@hp.com \
--to=bjorn.helgaas@hp.com \
--cc=benh@kernel.crashing.org \
--cc=elendil@planet.nl \
--cc=jbarnes@virtuousgeek.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matthew@wil.cx \
--cc=mingo@elte.hu \
--cc=rene.herman@keyaccess.nl \
--cc=tglx@linutronix.de \
/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®