* [PATCH] PCI: fix for quirk_e100_interrupt()
@ 2007-12-17 21:39 Ivan Kokshaysky
2007-12-17 21:57 ` Kok, Auke
0 siblings, 1 reply; 4+ messages in thread
From: Ivan Kokshaysky @ 2007-12-17 21:39 UTC (permalink / raw)
To: Greg KH; +Cc: linux-kernel, linux-pci
Check that the e100 is in the D0 power state. If it's not, it won't
respond to MMIO accesses and we end up with master-abort machine
checks on some platforms.
Signed-off-by: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
---
drivers/pci/quirks.c | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 26cc4dc..c8b2b9d 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -1406,9 +1406,10 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NETMOS, PCI_ANY_ID, quirk_netmos);
static void __devinit quirk_e100_interrupt(struct pci_dev *dev)
{
- u16 command;
+ u16 command, pmcsr;
u8 __iomem *csr;
u8 cmd_hi;
+ int pm;
switch (dev->device) {
/* PCI IDs taken from drivers/net/e100.c */
@@ -1442,6 +1443,17 @@ static void __devinit quirk_e100_interrupt(struct pci_dev *dev)
if (!(command & PCI_COMMAND_MEMORY) || !pci_resource_start(dev, 0))
return;
+ /*
+ * Check that the device is in the D0 power state. If it's not,
+ * there is no point to look any further.
+ */
+ pm = pci_find_capability(dev, PCI_CAP_ID_PM);
+ if (pm) {
+ pci_read_config_word(dev, pm + PCI_PM_CTRL, &pmcsr);
+ if ((pmcsr & PCI_PM_CTRL_STATE_MASK) != PCI_D0)
+ return;
+ }
+
/* Convert from PCI bus to resource space. */
csr = ioremap(pci_resource_start(dev, 0), 8);
if (!csr) {
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] PCI: fix for quirk_e100_interrupt()
2007-12-17 21:39 [PATCH] PCI: fix for quirk_e100_interrupt() Ivan Kokshaysky
@ 2007-12-17 21:57 ` Kok, Auke
2007-12-17 22:48 ` Ivan Kokshaysky
0 siblings, 1 reply; 4+ messages in thread
From: Kok, Auke @ 2007-12-17 21:57 UTC (permalink / raw)
To: Ivan Kokshaysky; +Cc: Greg KH, linux-kernel, linux-pci
Ivan Kokshaysky wrote:
> Check that the e100 is in the D0 power state. If it's not, it won't
> respond to MMIO accesses and we end up with master-abort machine
> checks on some platforms.
>
> Signed-off-by: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
what kind of platform actually is doing this? It almost seems like something is
wrong with that platform's BIOS and I wonder if this workaround should not be more
general (IOW is it not just e100 that is affected but other components as well?)
Auke
> ---
> drivers/pci/quirks.c | 14 +++++++++++++-
> 1 files changed, 13 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
> index 26cc4dc..c8b2b9d 100644
> --- a/drivers/pci/quirks.c
> +++ b/drivers/pci/quirks.c
> @@ -1406,9 +1406,10 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NETMOS, PCI_ANY_ID, quirk_netmos);
>
> static void __devinit quirk_e100_interrupt(struct pci_dev *dev)
> {
> - u16 command;
> + u16 command, pmcsr;
> u8 __iomem *csr;
> u8 cmd_hi;
> + int pm;
>
> switch (dev->device) {
> /* PCI IDs taken from drivers/net/e100.c */
> @@ -1442,6 +1443,17 @@ static void __devinit quirk_e100_interrupt(struct pci_dev *dev)
> if (!(command & PCI_COMMAND_MEMORY) || !pci_resource_start(dev, 0))
> return;
>
> + /*
> + * Check that the device is in the D0 power state. If it's not,
> + * there is no point to look any further.
> + */
> + pm = pci_find_capability(dev, PCI_CAP_ID_PM);
> + if (pm) {
> + pci_read_config_word(dev, pm + PCI_PM_CTRL, &pmcsr);
> + if ((pmcsr & PCI_PM_CTRL_STATE_MASK) != PCI_D0)
> + return;
> + }
> +
> /* Convert from PCI bus to resource space. */
> csr = ioremap(pci_resource_start(dev, 0), 8);
> if (!csr) {
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] PCI: fix for quirk_e100_interrupt()
2007-12-17 21:57 ` Kok, Auke
@ 2007-12-17 22:48 ` Ivan Kokshaysky
0 siblings, 0 replies; 4+ messages in thread
From: Ivan Kokshaysky @ 2007-12-17 22:48 UTC (permalink / raw)
To: Kok, Auke; +Cc: Greg KH, linux-kernel, linux-pci
On Mon, Dec 17, 2007 at 01:57:33PM -0800, Kok, Auke wrote:
> what kind of platform actually is doing this? It almost seems like something is
> wrong with that platform's BIOS and I wonder if this workaround should not be more
> general (IOW is it not just e100 that is affected but other components as well?)
It's alpha sx164. But I don't think the firmware does anything wrong here,
it just put e100 in "sleep" or "soft off" state.
I think a general rule is that you cannot access device MEM or IO registers
without pci_enable_device first (or making sure that the device is actually
enabled in other ways).
Ivan.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [patch] PCI: fix for quirk_e100_interrupt()
@ 2008-04-04 6:23 Simon Horman
0 siblings, 0 replies; 4+ messages in thread
From: Simon Horman @ 2008-04-04 6:23 UTC (permalink / raw)
To: xen-devel, xen-ia64-devel; +Cc: Ivan Kokshaysky, Alex Williamson
From: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
PCI: fix for quirk_e100_interrupt()
Check that the e100 is in the D0 power state. If it's not, it won't
respond to MMIO accesses and we end up with master-abort machine
checks on some platforms.
Signed-off-by: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Auke Kok <auke-jan.h.kok@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Simon Horman <horms@verge.net.au>
---
This is a trivial backport of an upstream-linux patch to xen-linux.
It is needed in order for an kexec to work on an HP rx2620 ia64 machine
when the old Donald Becker driver is used for an eepro100 card. The
Intel e100 driver works both with and without this patch.
The original patch is here:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=e64aeccbeca1f7e22174ca3a12ec35a8f5566515
Without it kexec of linux on the machine in question doesn't work
with either the e100 or eepro100 driver.
I have not been able to test this change on x86 hardware.
Note that kexec isn't actually merged for ia64 xen yet. For the game,
please see http://lists.infradead.org/pipermail/kexec/2008-March/001497.html.
I am working on the HVM problem :-)
Index: linux-2.6.18-xen.hg/drivers/pci/quirks.c
===================================================================
--- linux-2.6.18-xen.hg.orig/drivers/pci/quirks.c 2008-04-01 18:28:15.000000000 +0900
+++ linux-2.6.18-xen.hg/drivers/pci/quirks.c 2008-04-04 15:13:19.000000000 +0900
@@ -1528,10 +1528,11 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_N
static void __devinit quirk_e100_interrupt(struct pci_dev *dev)
{
- u16 command;
+ u16 command, pmcsr;
u32 bar;
u8 __iomem *csr;
u8 cmd_hi;
+ int pm;
switch (dev->device) {
/* PCI IDs taken from drivers/net/e100.c */
@@ -1566,6 +1567,17 @@ static void __devinit quirk_e100_interru
if (!(command & PCI_COMMAND_MEMORY) || !bar)
return;
+ /*
+ * Check that the device is in the D0 power state. If it's not,
+ * there is no point to look any further.
+ */
+ pm = pci_find_capability(dev, PCI_CAP_ID_PM);
+ if (pm) {
+ pci_read_config_word(dev, pm + PCI_PM_CTRL, &pmcsr);
+ if ((pmcsr & PCI_PM_CTRL_STATE_MASK) != PCI_D0)
+ return;
+ }
+
csr = ioremap(bar, 8);
if (!csr) {
printk(KERN_WARNING "PCI: Can't map %s e100 registers\n",
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-04-04 6:23 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-17 21:39 [PATCH] PCI: fix for quirk_e100_interrupt() Ivan Kokshaysky
2007-12-17 21:57 ` Kok, Auke
2007-12-17 22:48 ` Ivan Kokshaysky
-- strict thread matches above, loose matches on Subject: below --
2008-04-04 6:23 [patch] " Simon Horman
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.