Bug 7264

Summary: Yenta TI - irq 11 nobody cared - ThinkPad A21m with docking station
Product: Drivers Reporter: Pavel Kysilka (goldenfish)
Component: PCMCIAAssignee: linux-pcmcia
Status: CLOSED PATCH_ALREADY_AVAILABLE    
Severity: normal CC: akkzilla, akpm, andrewb, daniel.ritz, kristen.c.accardi, pm, protasnb
Priority: P2    
Hardware: i386   
OS: Linux   
Kernel Version: 2.6.18-gcc94dcf5 Subsystem:
Regression: --- Bisected commit-id:
Bug Depends on:    
Bug Blocks: 56331    
Attachments: kernel.log with detailed ooops
cat /proc/interrupts
cat /proc/ioports
lspci -vvv
dmesg_2.6.16 and dmesg_2.6.17-rc1 -- tar archive
complete dmesg after patch, actual git
lspci -v -xxx
data from thinkpad dsdt tables parsed with grep -a C077
test patch for docking bridge
dmesg with patch at comment #25 - slot-enable [TI docking bridge]
Docking working only partially
docking working - dmesg

Description Pavel Kysilka 2006-10-04 15:31:46 UTC
Most recent kernel where this bug did not occur:
Distribution: Debian testing
Hardware Environment: ThinkPad A21m with docking station
Software Environment:
Problem Description:
I found in kernel log this Ooops. I don't use at this time any pcmicia card.
Ooops may be usuable for some error finding.

Oct  5 01:42:24 goldenfish kernel: Yenta: CardBus bridge found at 0000:08:02.0
[1014:0148]
Oct  5 01:42:24 goldenfish kernel: Yenta: Using INTVAL to route CSC interrupts
to PCI
Oct  5 01:42:24 goldenfish kernel: Yenta: Routing CardBus interrupts to PCI
Oct  5 01:42:24 goldenfish kernel: Yenta TI: socket 0000:08:02.0, mfunc
0x00001002, devctl 0x66
Oct  5 01:42:24 goldenfish kernel: irq 11: nobody cared (try booting with the
"irqpoll" option)
Oct  5 01:42:24 goldenfish kernel:  [__report_bad_irq+36/144]
__report_bad_irq+0x24/0x90
Oct  5 01:42:24 goldenfish kernel:  [note_interrupt+536/592]
note_interrupt+0x218/0x250
Oct  5 01:42:24 goldenfish kernel:  [handle_IRQ_event+61/112]
handle_IRQ_event+0x3d/0x70
Oct  5 01:42:24 goldenfish kernel:  [handle_level_irq+197/256]
handle_level_irq+0xc5/0x100
Oct  5 01:42:24 goldenfish kernel:  [do_IRQ+71/144] do_IRQ+0x47/0x90


Better information in attachments.
I am ready for testing. I am using latest git.

Steps to reproduce:
Boot linux. Load module yenta.
Comment 1 Pavel Kysilka 2006-10-04 15:32:50 UTC
Created attachment 9156 [details]
kernel.log with detailed ooops
Comment 2 Pavel Kysilka 2006-10-04 15:33:34 UTC
Created attachment 9157 [details]
cat /proc/interrupts
Comment 3 Pavel Kysilka 2006-10-04 15:33:55 UTC
Created attachment 9158 [details]
cat /proc/ioports
Comment 4 Pavel Kysilka 2006-10-04 15:34:17 UTC
Created attachment 9159 [details]
lspci -vvv
Comment 5 Andrew Morton 2006-10-04 17:30:08 UTC
On Wed, 4 Oct 2006 15:42:49 -0700
bugme-daemon@bugzilla.kernel.org wrote:

> Most recent kernel where this bug did not occur:

Are you able to identify a kernel which didn't have this bug?  it
really helps...

Thanks.

Comment 6 Pavel Kysilka 2006-10-04 19:46:43 UTC
Yes, i retest any kernel for better identify of bug.

from my log:

2.6.16 works
2.6.17-rc1 and latest git ==> Ooops.
Comment 7 Andrew Morton 2006-10-04 20:25:59 UTC
Thanks.  Could you please do the following:

- Boot 2.6.16
- run `dmesg -s 1000000 > dmesg.good'
- Boot 2.6.17-rc1
- run `dmesg -s 1000000 > dmesg.bad'

then attach dmesg.good and dmesg.bad.

That way we can look for changes between the two.

Comment 9 Pavel Kysilka 2006-10-05 13:26:37 UTC
Created attachment 9165 [details]
dmesg_2.6.16 and dmesg_2.6.17-rc1 -- tar archive
Comment 10 Pavel Kysilka 2006-10-05 14:24:18 UTC
Created attachment 9166 [details]
complete dmesg after patch, actual git
Comment 11 Andrew Morton 2006-10-05 14:36:26 UTC
(added bugzilla to cc)
On Thu, 5 Oct 2006 23:34:25 +0200
Pavel Kysilka <goldenfish@bsys.cz> wrote:

> On Thu Oct 05, 2006 at 01:32:47PM -0700, akpm@osdl.org wrote:
> > 
> > The patch titled
> > 
> >      revert "PCI: quirk for IBM Dock II cardbus controllers"
> > 
> > has been added to the -mm tree.  Its filename is
> > 
> >      revert-pci-quirk-for-ibm-dock-ii-cardbus-controllers.patch
> > 
> > See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
> > out what to do about this
> > 
> > ------------------------------------------------------
> > Subject: revert "PCI: quirk for IBM Dock II cardbus controllers"
> > From: Andrew Morton <akpm@osdl.org>
> > 
> > Daniel thinks this might fix http://bugzilla.kernel.org/show_bug.cgi?id=7264
> > 
> > Pavel, can you let us know if this patch fixes it please?
> 
>  Hi,
> 
>      patch fixes problem. Complete dmesg will be saved in bugzilla.
> 

hm, OK, thanks for testing.

Now what?

Comment 12 Kristen 2006-10-05 14:53:54 UTC
On Thu, 5 Oct 2006 14:47:29 -0700
Andrew Morton <akpm@osdl.org> wrote:

> (added bugzilla to cc)
> On Thu, 5 Oct 2006 23:34:25 +0200
> Pavel Kysilka <goldenfish@bsys.cz> wrote:
> 
> > On Thu Oct 05, 2006 at 01:32:47PM -0700, akpm@osdl.org wrote:
> > > 
> > > The patch titled
> > > 
> > >      revert "PCI: quirk for IBM Dock II cardbus controllers"
> > > 
> > > has been added to the -mm tree.  Its filename is
> > > 
> > >      revert-pci-quirk-for-ibm-dock-ii-cardbus-controllers.patch
> > > 
> > > See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
> > > out what to do about this
> > > 
> > > ------------------------------------------------------
> > > Subject: revert "PCI: quirk for IBM Dock II cardbus controllers"
> > > From: Andrew Morton <akpm@osdl.org>
> > > 
> > > Daniel thinks this might fix http://bugzilla.kernel.org/show_bug.cgi?id=7264
> > > 
> > > Pavel, can you let us know if this patch fixes it please?
> > 
> >  Hi,
> > 
> >      patch fixes problem. Complete dmesg will be saved in bugzilla.
> > 
> 
> hm, OK, thanks for testing.
> 
> Now what?

So, the original patch was for enabling docking for the T20.  Basically,
without the patch, the interrupts are all routed incorrectly on the
cardbus controllers on the dock station when you hotdock.  If we
revert this patch, we are going to break docking on the T20.  I'm ok
with that - I think it is far better to not oops.  And the patch isn't 
needed on newer systems (like T40) which have less brain death.  I
think we could decide to just let docking break on these older systems.

Kristen

Comment 13 Andrew Morton 2006-10-05 15:06:02 UTC
On Thu, 5 Oct 2006 15:04:47 -0700
Kristen Carlson Accardi <kristen.c.accardi@intel.com> wrote:

> On Thu, 5 Oct 2006 14:47:29 -0700
> Andrew Morton <akpm@osdl.org> wrote:
> 
> > (added bugzilla to cc)
> > On Thu, 5 Oct 2006 23:34:25 +0200
> > Pavel Kysilka <goldenfish@bsys.cz> wrote:
> > 
> > > On Thu Oct 05, 2006 at 01:32:47PM -0700, akpm@osdl.org wrote:
> > > > 
> > > > The patch titled
> > > > 
> > > >      revert "PCI: quirk for IBM Dock II cardbus controllers"
> > > > 
> > > > has been added to the -mm tree.  Its filename is
> > > > 
> > > >      revert-pci-quirk-for-ibm-dock-ii-cardbus-controllers.patch
> > > > 
> > > > See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
> > > > out what to do about this
> > > > 
> > > > ------------------------------------------------------
> > > > Subject: revert "PCI: quirk for IBM Dock II cardbus controllers"
> > > > From: Andrew Morton <akpm@osdl.org>
> > > > 
> > > > Daniel thinks this might fix http://bugzilla.kernel.org/show_bug.cgi?id=7264
> > > > 
> > > > Pavel, can you let us know if this patch fixes it please?
> > > 
> > >  Hi,
> > > 
> > >      patch fixes problem. Complete dmesg will be saved in bugzilla.
> > > 
> > 
> > hm, OK, thanks for testing.
> > 
> > Now what?
> 
> So, the original patch was for enabling docking for the T20.  Basically,
> without the patch, the interrupts are all routed incorrectly on the
> cardbus controllers on the dock station when you hotdock.  If we
> revert this patch, we are going to break docking on the T20.  I'm ok
> with that - I think it is far better to not oops.  And the patch isn't 
> needed on newer systems (like T40) which have less brain death.  I
> think we could decide to just let docking break on these older systems.
> 

Could we use DMI info to work out whether the quirk is needed?

Comment 14 Kristen 2006-10-05 17:29:03 UTC
On Thu, 5 Oct 2006 15:17:02 -0700
Andrew Morton <akpm@osdl.org> wrote:

> On Thu, 5 Oct 2006 15:04:47 -0700
> Kristen Carlson Accardi <kristen.c.accardi@intel.com> wrote:
> 
> > On Thu, 5 Oct 2006 14:47:29 -0700
> > Andrew Morton <akpm@osdl.org> wrote:
> > 
> > > (added bugzilla to cc)
> > > On Thu, 5 Oct 2006 23:34:25 +0200
> > > Pavel Kysilka <goldenfish@bsys.cz> wrote:
> > > 
> > > > On Thu Oct 05, 2006 at 01:32:47PM -0700, akpm@osdl.org wrote:
> > > > > 
> > > > > The patch titled
> > > > > 
> > > > >      revert "PCI: quirk for IBM Dock II cardbus controllers"
> > > > > 
> > > > > has been added to the -mm tree.  Its filename is
> > > > > 
> > > > >      revert-pci-quirk-for-ibm-dock-ii-cardbus-controllers.patch
> > > > > 
> > > > > See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
> > > > > out what to do about this
> > > > > 
> > > > > ------------------------------------------------------
> > > > > Subject: revert "PCI: quirk for IBM Dock II cardbus controllers"
> > > > > From: Andrew Morton <akpm@osdl.org>
> > > > > 
> > > > > Daniel thinks this might fix http://bugzilla.kernel.org/show_bug.cgi?id=7264
> > > > > 
> > > > > Pavel, can you let us know if this patch fixes it please?
> > > > 
> > > >  Hi,
> > > > 
> > > >      patch fixes problem. Complete dmesg will be saved in bugzilla.
> > > > 
> > > 
> > > hm, OK, thanks for testing.
> > > 
> > > Now what?
> > 
> > So, the original patch was for enabling docking for the T20.  Basically,
> > without the patch, the interrupts are all routed incorrectly on the
> > cardbus controllers on the dock station when you hotdock.  If we
> > revert this patch, we are going to break docking on the T20.  I'm ok
> > with that - I think it is far better to not oops.  And the patch isn't 
> > needed on newer systems (like T40) which have less brain death.  I
> > think we could decide to just let docking break on these older systems.
> > 
> 
> Could we use DMI info to work out whether the quirk is needed?

Would it be possible to get the result of lspci -v -xxx without the quirk,
with the system booted in the dock station.

thanks,
Kristen

Comment 15 Pavel Kysilka 2006-10-06 09:17:38 UTC
One idea: how about bios version ? I have in my thinkpad latest bios.

Script on this page on the bottom may be helpfull.

http://www.thinkwiki.org/wiki/List_of_DMI_IDs
Comment 16 Pavel Kysilka 2006-10-08 13:12:30 UTC
Andrew,
if you agree, i am able organize testing in comp.linux.thinkpad group and send
summary report about this funkcionality.
Comment 17 Pavel Kysilka 2006-10-10 11:50:19 UTC
Created attachment 9202 [details]
lspci -v -xxx

Hi Kirsten,

result of lspci -v -xxx attached.
Comment 18 Kristen 2006-10-24 16:12:16 UTC
This patch could replace the old quirk - using DMI as you suggested to
detect the T20, we can just apply the fix to the cardbus bridge when the
T20 is docked.

On the ThinkPad T20 laptop, when hotdocking into the IBM Dock II
station, the _DCK AML (i.e. ACPI based docking function) does not
correctly configure the cardbus controllers on the dock station.
This used to be a pci quirk, but since it is really driver specific,
am moving into the driver.  Also, we are now using DMI to detect
whether the laptop that has docked is a T20, because the fixup isn't
neccessary on other laptops with correctly written AML.

Signed-off-by:  Kristen Carlson Accardi <kristen.c.accardi@intel.com>

---
 drivers/pcmcia/yenta_socket.c |   36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

--- 2.6-mm.orig/drivers/pcmcia/yenta_socket.c
+++ 2.6-mm/drivers/pcmcia/yenta_socket.c
@@ -17,6 +17,7 @@
 #include <linux/interrupt.h>
 #include <linux/delay.h>
 #include <linux/module.h>
+#include <linux/dmi.h>
 
 #include <pcmcia/cs_types.h>
 #include <pcmcia/ss.h>
@@ -1076,6 +1077,15 @@ static void yenta_fixup_parent_bridge(st
 	}
 }
 
+static struct dmi_system_id __devinitdata t20_dmi_table[] = {
+	{
+		.ident = "IBM ThinkPad T20",
+		.matches = { DMI_MATCH(DMI_BOARD_VENDOR, "IBM"),
+		     	     DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T20"), },
+	},
+	{},
+};
+
 /*
  * Initialize a cardbus controller. Make sure we have a usable
  * interrupt, and that we can map the cardbus area. Fill in the
@@ -1150,6 +1160,32 @@ static int __devinit yenta_probe (struct
 	printk(KERN_INFO "Yenta: CardBus bridge found at %s [%04x:%04x]\n",
 		pci_name(dev), dev->subsystem_vendor, dev->subsystem_device);
 
+	/*
+	 * see if we are the cardbus controller on the
+	 * IBM Dock II
+	 */
+	if (dmi_check_system(t20_dmi_table) &&
+		dev->subsystem_device == 0x0148) {
+		u32 val;
+
+		/*
+		 * After hot docking, the AML on the
+		 * IBM T20 will not correctly configure
+		 * the cardbus bridge.  We will need to
+		 * fix this up ourselves.  Tie the 2 interrupt
+		 * pins to INTA, and configure the multifunction
+		 * routing register to handle this.
+		 */
+		printk(KERN_INFO "Found IBM Dock II Cardbus Bridge "
+			"fixing up config");
+		pci_read_config_dword(dev, 0x8c, &val);
+		val = ((val & 0xffffff00) | 0x1002);
+		pci_write_config_dword(dev, 0x8c, val);
+		pci_read_config_dword(dev, 0x80, &val);
+		val = ((val & 0x00ffff00) | 0x2864c077);
+		pci_write_config_dword(dev, 0x80, val);
+
+	}
 	yenta_config_init(socket);
 
 	/* Disable all events */

Comment 19 Andrew Baumann 2006-10-25 04:54:31 UTC
I have the same problem with a ThinkPad X31 in an IBM Dock II running
2.6.18.1. At boot Yenta triggers the same IRQ 11: nobody cared oops, the
interrupt is disabled, and as a result the e100 doesn't work any more.

I can happily report that applying the patch in the previous comment, and 
removing the "Dock II" quirk, fixes this problem. A cardbus USB2 controller in 
the docking station still works as well, even with the quirk removed.
Comment 20 Andrew Morton 2006-10-26 18:25:50 UTC
On Tue, 24 Oct 2006 16:24:58 -0700
Kristen Carlson Accardi <kristen.c.accardi@intel.com> wrote:

> This patch could replace the old quirk - using DMI as you suggested to
> detect the T20, we can just apply the fix to the cardbus bridge when the
> T20 is docked.

OK, so do you think these two patches are good to apply?  (IOW, what's
the testing status?)

Thanks.

Comment 21 Daniel Ritz 2006-10-27 05:00:32 UTC
this only affects TI bridges and only on X86. so i would suggest to move the quirk
to ti113x.h instead and protect it there with CONFIG_X86.
also when it's in ti113x.h you might want to consider using the named constants.

btw. what do the changed registers look like before the quirk is exec'd?
Comment 22 Kristen 2006-10-27 11:15:10 UTC
ok - drop this patch, I'll resubmit with suggested changes.  And on top of 
that I forgot to do a quilt refresh and have the wrong Product name (doh).
Comment 23 Pavel Kysilka 2006-11-08 15:08:39 UTC
Hi,

problem is possibly more complex. I am now playing with docking/undocking, pci
hotplug . After undocking is IBM pci bridge hidden. No lspci output about ibm
pci bridge.

I will be send more info in next 2 week.
Comment 24 Pavel Kysilka 2007-04-11 09:28:58 UTC
Created attachment 11126 [details]
data from thinkpad dsdt tables parsed with grep -a C077 

Look for url at comment #8 and this text attachment.
Comment 25 Pavel Kysilka 2007-05-07 16:44:30 UTC
Created attachment 11427 [details]
test patch for docking bridge

In the comment #24 i wrote, that there are 2 type of thinkpads. I create
testing patch for my idea.

With patch in comment #8 one type of thinkpads get oops and cannot get irq for
TI PCMICIA bridges. Second type of thinkpads docking.

With this patch my thinkpad docking and i get irq for TI PCMICIA slot.

And there is needed create patch for both type of thinkpad (integrate patch at
comment #8 and this comment together. But i don't have kernel programming
experience and skils for this.
Comment 26 Pavel Kysilka 2007-05-07 16:50:41 UTC
Created attachment 11428 [details]
dmesg with patch at comment #25 - slot-enable [TI docking bridge]
Comment 27 Pavel Kysilka 2007-06-10 16:56:29 UTC
Created attachment 11725 [details]
Docking working only partially

Hi,
docking now (2.6.22-rc4) working only partially.
Look for this attachment.

Changes: 
- USB now working after docking - USB port on dock working
- not needed call echo 1 > /sys/bus/pci/slots/1/power - working automaticcaly,
   but with error.
- devices list not changed in lspci output automatically
- devices list not changed in lspci output after enable/disable slot - it has
been working
Comment 28 Pavel Kysilka 2007-06-18 16:46:43 UTC
Created attachment 11787 [details]
docking working - dmesg

Docking and undocking now working completely for me.
PCI tree displayed correctly.

Needed:

-kernel booting with parameter pci=assign-busses
- this patch
http://bugme.osdl.org/attachment.cgi?id=11427&action=edit

goldenfish:~# uname -a
Linux goldenfish 2.6.22-rc5-gfa490cfd-dirty #102 Tue Jun 19 01:16:37 CEST 2007 i686 GNU/Linux

More in dmesg in attachment - Notebook booted and docked.
Comment 29 Natalie Protasevich 2007-07-06 09:43:25 UTC
Pavel,
It looks like your testing confirms that the problem has been resolved?
Thanks.
Comment 30 Pavel Kysilka 2007-07-06 13:20:29 UTC
Natalie,

problem resolved for me, but no working patch for both type of thinkpad there.
Comment 31 Akkana Peck 2007-07-21 20:22:39 UTC
I'm seing a related problem, but I'm not sure if it belongs here or as a separate bug report. The hardware is different, a Vaio SR17, and the IRQ where "nobody cared" is 9, not 11. The hardware that's known to be on IRQ 9 is the yenta pcmcia/cardbus controller (with a 3com 3c59x cardbus ethernet card inserted), USB (with the built-in memory stick reader plus an external hub plugged in, and a mouse plugged into the hub), sound (Yamaha ymfpci) and firewire (nothing plugged in). The symptom, besides the "nobody cared" message in dmesg, is that the USB mouse stops working (and sometimes the network does as well).

I can delay the symptoms by removing the hub (plugging the USB mouse in directly) and by building a kernel with no firewire, but in either case the problem still eventually shows up, usually after a suspend/resume cycle or two.

Booting with irqpoll fixes the problem (but doesn't sound like a good solution). ACPI isn't related (it's configured off in the kernel because of bug 75174).

2.6.19 is where the problem appeared for me: 2.6.18.8 did NOT show the problem, but 2.6.19 with the same .config (plus make oldconfig) did.

Please advise if this isn't related to this bug and should be filed separately, or if you want more details about this machine's setup.
Comment 32 Natalie Protasevich 2008-03-30 17:28:37 UTC
Can we refresh data on this problem please. Have you tested with recent kernel, is the problem still there? If so please provide dmesg again.
Thanks.
Comment 33 Zhang Rui 2008-11-18 17:51:51 UTC
*** Bug 10805 has been marked as a duplicate of this bug. ***
Comment 34 ykzhao 2009-02-01 21:10:01 UTC
*** Bug 10805 has been marked as a duplicate of this bug. ***
Comment 35 ykzhao 2009-02-01 21:12:37 UTC
Hi, Pavel
    Will you please have an opportunity to push the patch in comment #25 into upstream kernel?
    Thanks.
Comment 36 Len Brown 2009-02-21 08:42:59 UTC
shipped in 2.6.19-rc5:

(I guess this means that we decided to break the old T20
 in favor of newer machines?)

commit d8f7975159f35846754d3845c9701b612c5c0624
Author: Andrew Morton <akpm@osdl.org>
Date:   Tue Nov 14 02:03:26 2006 -0800

    [PATCH] revert "PCI: quirk for IBM Dock II cardbus controllers"