* [PATCH] PCI: disable decoding while sizing BARs
@ 2002-12-17 0:41 Bjorn Helgaas
2002-12-17 14:29 ` Ivan Kokshaysky
0 siblings, 1 reply; 3+ messages in thread
From: Bjorn Helgaas @ 2002-12-17 0:41 UTC (permalink / raw)
To: Marcelo Tosatti; +Cc: mj, linux-kernel
While sizing BARs, devices are temporarily assigned ranges
that may conflict with other things in the system, like IOSAPICs.
Here's a detailed description of a hang that results from leaving
device decoding enabled while sizing the BARs:
https://lists.linuxia64.org/archives//linux-ia64/2002-April/003302.html
This patch applies to current 2.4 BitKeeper.
--- linux-2.4/drivers/pci/pci.c 2002-12-16 10:44:21.000000000 -0700
+++ testing/drivers/pci/pci.c 2002-12-16 17:22:26.000000000 -0700
@@ -1058,8 +1058,14 @@
{
unsigned int pos, reg, next;
u32 l, sz;
+ u16 cmd;
struct resource *res;
+ /* Disable I/O & memory decoding while we size the BARs. */
+ pci_read_config_word(dev, PCI_COMMAND, &cmd);
+ pci_write_config_word(dev, PCI_COMMAND,
+ cmd & ~(PCI_COMMAND_IO | PCI_COMMAND_MEMORY));
+
for(pos=0; pos<howmany; pos = next) {
next = pos+1;
res = &dev->resource[pos];
@@ -1131,6 +1137,8 @@
res->end = res->start + (unsigned long) sz;
}
}
+
+ pci_write_config_word(dev, PCI_COMMAND, cmd);
}
void __devinit pci_read_bridge_bases(struct pci_bus *child)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] PCI: disable decoding while sizing BARs
2002-12-17 0:41 [PATCH] PCI: disable decoding while sizing BARs Bjorn Helgaas
@ 2002-12-17 14:29 ` Ivan Kokshaysky
2002-12-18 12:30 ` Marcelo Tosatti
0 siblings, 1 reply; 3+ messages in thread
From: Ivan Kokshaysky @ 2002-12-17 14:29 UTC (permalink / raw)
To: Bjorn Helgaas; +Cc: Marcelo Tosatti, mj, linux-kernel
On Mon, Dec 16, 2002 at 05:41:53PM -0700, Bjorn Helgaas wrote:
> + /* Disable I/O & memory decoding while we size the BARs. */
> + pci_read_config_word(dev, PCI_COMMAND, &cmd);
> + pci_write_config_word(dev, PCI_COMMAND,
> + cmd & ~(PCI_COMMAND_IO | PCI_COMMAND_MEMORY));
It's fatal for certain x86 northbridges, that's why the code was
removed 2 years ago.
Maybe it would be ok with this modification:
pci_read_config_word(dev, PCI_COMMAND, &cmd);
/* Don't touch northbridges or devices with devfn 0:0 */
if ((dev->class >> 8) != PCI_CLASS_BRIDGE_HOST && dev->devfn)
pci_write_config_word(dev, PCI_COMMAND,
cmd & ~(PCI_COMMAND_IO | PCI_COMMAND_MEMORY));
Ivan.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] PCI: disable decoding while sizing BARs
2002-12-17 14:29 ` Ivan Kokshaysky
@ 2002-12-18 12:30 ` Marcelo Tosatti
0 siblings, 0 replies; 3+ messages in thread
From: Marcelo Tosatti @ 2002-12-18 12:30 UTC (permalink / raw)
To: Ivan Kokshaysky; +Cc: Bjorn Helgaas, mj, linux-kernel
On Tue, 17 Dec 2002, Ivan Kokshaysky wrote:
> On Mon, Dec 16, 2002 at 05:41:53PM -0700, Bjorn Helgaas wrote:
> > + /* Disable I/O & memory decoding while we size the BARs. */
> > + pci_read_config_word(dev, PCI_COMMAND, &cmd);
> > + pci_write_config_word(dev, PCI_COMMAND,
> > + cmd & ~(PCI_COMMAND_IO | PCI_COMMAND_MEMORY));
>
> It's fatal for certain x86 northbridges, that's why the code was
> removed 2 years ago.
>
> Maybe it would be ok with this modification:
>
> pci_read_config_word(dev, PCI_COMMAND, &cmd);
> /* Don't touch northbridges or devices with devfn 0:0 */
> if ((dev->class >> 8) != PCI_CLASS_BRIDGE_HOST && dev->devfn)
> pci_write_config_word(dev, PCI_COMMAND,
> cmd & ~(PCI_COMMAND_IO | PCI_COMMAND_MEMORY));
Ok, I've reverted this one.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-12-18 15:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-17 0:41 [PATCH] PCI: disable decoding while sizing BARs Bjorn Helgaas
2002-12-17 14:29 ` Ivan Kokshaysky
2002-12-18 12:30 ` Marcelo Tosatti
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®