From: Robert Hancock <hancockr@shaw.ca>
To: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Greg KH <gregkh@suse.de>, Matthew Wilcox <matthew@wil.cx>,
Shaohua Li <shaohua.li@intel.com>,
lkml <linux-kernel@vger.kernel.org>,
linux-pci <linux-pci@atrey.karlin.mff.cuni.cz>,
Andrew Morton <akpm@linux-foundation.org>,
Jesse Barnes <jbarnes@virtuousgeek.org>
Subject: Re: [PATCH]PCI:disable resource decode in PCI BAR detection
Date: Fri, 14 Sep 2007 08:30:59 -0600 [thread overview]
Message-ID: <46EA9B23.7030709@shaw.ca> (raw)
In-Reply-To: <20070914151401.A5586@jurassic.park.msu.ru>
Ivan Kokshaysky wrote:
> On Thu, Sep 13, 2007 at 09:32:42PM -0600, Robert Hancock wrote:
>> Disabling the BAR decoding does not mean disabling the device (aside
>> from the one group of host bridge that apparently disables CPU to RAM
>> access, whose designers were apparently on crack when they read the PCI
>> spec and which is why we don't disable the decode on host bridges).
>> There really is no other sane way to do it.
>
> Disabling IO and MEM decode effectively disables device as a PCI target.
> Worse, it's often not just BARs that get disabled, but some non-standard
> or hidden address ranges as well. Host bridges are just one common
> example, there is a lot of other insane hardware, more than one could
> expect.
Do you have an example of specific hardware that exhibits this problem?
So far after a similar patch has been in -mm for months there have been
no reports of any such problems.
> BTW, the way how the internal address decode works on these latest Intel
> whippets doesn't look sane either. ;-)
>
>> If we do encounter other devices that choke on having the BAR disabled
>> during probing then we can add additional quirk logic, but we haven't
>> run into anything like that yet.
>
> As Greg said, the main point is "no regression".
>
> Folks, can you check if the patch below helps?
This isn't guaranteed to help. I don't think it is only integrated
graphics that could cause this problem, I think that an add-on PCI
Express card can do this as well. Depending on the chipset memory decode
rules, any PCI or PCI Express device with a BAR large enough could cause
issues.
>
> Ivan.
>
> --- 2.6.23-rc6-git4/include/linux/pci.h 2007-09-12 17:22:57.000000000 +0400
> +++ linux/include/linux/pci.h 2007-09-14 10:26:29.000000000 +0400
> @@ -183,6 +183,7 @@ struct pci_dev {
> unsigned int msi_enabled:1;
> unsigned int msix_enabled:1;
> unsigned int is_managed:1;
> + unsigned int disable_while_probe:1; /* Probe BARs with IO and MMIO turned off */
> atomic_t enable_cnt; /* pci_enable_device has been called */
>
> u32 saved_config_space[16]; /* config space saved at suspend time */
> --- 2.6.23-rc6-git4/arch/i386/pci/fixup.c 2007-09-12 17:22:55.000000000 +0400
> +++ linux/arch/i386/pci/fixup.c 2007-09-14 14:43:13.000000000 +0400
> @@ -444,3 +444,21 @@ static void __devinit pci_siemens_interr
> }
> DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SIEMENS, 0x0015,
> pci_siemens_interrupt_controller);
> +
> +/*
> + * Work around apparent quirk in internal address decoding on
> + * some Intel chipsets (G31, G33, Q965 etc.):
> + * when some MMIO address range of integrated peripheral overlaps
> + * mmconfig area, mmconfig accesses are blocked. This can happen
> + * when we size the BAR writing all ones to it.
> + * In practice, only integrated graphics controller has MMIO range
> + * large enough (BAR2, 256Mb) to cause a trouble, so we disable
> + * address decoders just on that function during PCI BAR probe.
> + */
> +static void __devinit pci_intel_mmconfig(struct pci_dev *dev)
> +{
> + if ((dev->class >> 8) == PCI_CLASS_DISPLAY_VGA &&
> + pci_domain_nr(dev->bus) == 0 && dev->bus->number == 0)
> + dev->disable_while_probe = 1;
> +}
> +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_ANY_ID, pci_intel_mmconfig);
> --- 2.6.23-rc6-git4/drivers/pci/probe.c 2007-09-14 00:35:47.000000000 +0400
> +++ linux/drivers/pci/probe.c 2007-09-14 10:27:45.000000000 +0400
> @@ -185,6 +185,13 @@ static void pci_read_bases(struct pci_de
> unsigned int pos, reg, next;
> u32 l, sz;
> struct resource *res;
> + u16 cmd, orig_cmd;
> +
> + if (dev->disable_while_probe) {
> + pci_read_config_word(dev, PCI_COMMAND, &orig_cmd);
> + cmd |= orig_cmd & ~(PCI_COMMAND_MEMORY | PCI_COMMAND_IO);
> + pci_write_config_word(dev, PCI_COMMAND, cmd);
> + }
>
> for(pos=0; pos<howmany; pos = next) {
> u64 l64;
> @@ -283,6 +290,8 @@ static void pci_read_bases(struct pci_de
> }
> }
> }
> + if (dev->disable_while_probe)
> + pci_write_config_word(dev, PCI_COMMAND, orig_cmd);
> }
>
> void pci_read_bridge_bases(struct pci_bus *child)
>
next prev parent reply other threads:[~2007-09-14 14:32 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <fa.ggBqx6W3i6hfs6jdfg64oXKSxW8@ifi.uio.no>
[not found] ` <fa.o5cJ0O7pLVWRzUiVPDEZL6nKqA8@ifi.uio.no>
[not found] ` <fa.tyYt4GOpTOmJTUbzsxpiCAObJPQ@ifi.uio.no>
[not found] ` <fa.13eJumylqINOxOaoEj9cthw0d0M@ifi.uio.no>
[not found] ` <fa.tAIuIM02CoL+ixB11n9Fmcqyz9M@ifi.uio.no>
[not found] ` <fa.pxFYhTaUz2NVN7Vux7b5xVRrKTw@ifi.uio.no>
2007-09-14 3:32 ` [PATCH]PCI:disable resource decode in PCI BAR detection Robert Hancock
2007-09-14 11:14 ` Ivan Kokshaysky
2007-09-14 11:33 ` Ivan Kokshaysky
2007-09-14 14:30 ` Robert Hancock [this message]
2007-09-14 15:29 ` Ivan Kokshaysky
2007-09-14 23:53 ` Robert Hancock
2007-09-15 5:55 ` Yinghai Lu
2007-09-16 11:13 ` Ivan Kokshaysky
2007-09-16 17:34 ` Robert Hancock
2007-09-17 9:20 ` Ivan Kokshaysky
2007-09-16 19:52 ` Matthew Wilcox
2007-09-17 9:31 ` Ivan Kokshaysky
2007-09-17 14:30 ` Robert Hancock
2007-09-17 1:21 ` Shaohua Li
2007-09-18 9:53 ` Ivan Kokshaysky
2007-09-19 21:34 ` Jesse Barnes
2007-09-16 20:06 ` Benjamin Herrenschmidt
2007-09-16 23:37 ` Robert Hancock
2007-09-17 0:21 ` Benjamin Herrenschmidt
[not found] ` <fa.0Edi0qLTdvqVnuoDAebaTVz1jEM@ifi.uio.no>
[not found] ` <fa.sq+NimBnzGB2syLmvcIGOvDkixI@ifi.uio.no>
[not found] ` <fa.G9DPndNUxuPi5LrUTOL4uPFshnc@ifi.uio.no>
2007-09-26 23:01 ` Robert Hancock
2007-09-27 0:40 ` Benjamin Herrenschmidt
2007-09-27 2:14 ` Matthew Wilcox
[not found] <fa.+WRenB38novq157RnGPLoU4q2XI@ifi.uio.no>
[not found] ` <fa.mM7Va6Nlsaduo/AF4MkeurSBTbs@ifi.uio.no>
[not found] ` <fa.Ff0IMhMYWp7NYEdjO0AftHzVOh4@ifi.uio.no>
[not found] ` <fa.d9zBdhHd9gKcJbtwrYguusbECo4@ifi.uio.no>
[not found] ` <fa.TLO57rS9iV7zhomQxJbV9gjbxx8@ifi.uio.no>
[not found] ` <fa.lPg6OSzX+f6jdXK1ZF0rlIhZok4@ifi.uio.no>
2007-09-15 20:24 ` Robert Hancock
2007-09-13 6:21 Shaohua Li
2007-09-13 7:31 ` Matthew Wilcox
2007-09-13 7:24 ` Shaohua Li
2007-09-13 7:55 ` Matthew Wilcox
2007-09-13 9:53 ` Greg KH
2007-09-13 11:16 ` Ivan Kokshaysky
2007-09-13 12:00 ` Greg KH
2007-09-16 20:01 ` Benjamin Herrenschmidt
2007-09-17 10:22 ` Ivan Kokshaysky
2007-09-17 20:30 ` Benjamin Herrenschmidt
2007-09-18 9:54 ` Ivan Kokshaysky
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=46EA9B23.7030709@shaw.ca \
--to=hancockr@shaw.ca \
--cc=akpm@linux-foundation.org \
--cc=gregkh@suse.de \
--cc=ink@jurassic.park.msu.ru \
--cc=jbarnes@virtuousgeek.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@atrey.karlin.mff.cuni.cz \
--cc=matthew@wil.cx \
--cc=shaohua.li@intel.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;
as well as URLs for NNTP newsgroup(s).