Subject: [PATCH] IBM T23; quirks force enable interrupts in APM set power state, causes crash on suspend

Steven et al,

Summary: dmi_scan.c forces interrupt enable on during PCI BIOS call for
all IBM machines, which breaks T23, which needs it off it seems.

(Steven: hope you don't mind lkml copy)

>>> My only worry is I have some people saying (admittedly on laptops
>>> pre the T23) that disabling this opption whilst udma is still enabled
>>> is a sure way to kill your entire filing system. Well, guess I've
>>> got most of it backed up ...
>>
>> You could try this in single user mode with all your file systems mounted
>> read only (or not mounted if possible).
>
> I will try it this evening - I think with UDMA off (somehow), single
> user mode, no other apps, immediate reboot afterwards,
> it should be worth the risk :-)
>
> I have 2 x T23 here which are not (yet) doing vital stuff, so if you
> want any information on them, I'm happy to do testing.

Well, lo and behold, if I /do/ disable interrupts (i.e. change
APM_DO_CLI to just cli() ), it seems to suspend and restore
correctly. So it looks like the BIOS in the T23 has the opposite
bug from other boxes - i.e. it doesn't work if you have interrupts
/enabled/ (grrrr...).

So now 'all' I have to worry is all the dire warnings about
enabling this.

>>> I shall try it - is this any different (I think no) from turning OFF
>>> the config option which says enable IRQs in interrupts?
>>
>> It is different, because we automatically detect all IBM thinkpads and
>> turn that option on at runtime. We currently do not distinguish between
>> different Thinkpad models because up until (at least) the T22, they all
>> had the problem and I do not have access to a T23.
>
> OK - obviously hadn't read the code sufficiently closely.

Found it :-)

Looks like the test for IBM laptops in dmiscan.c is too specific,
and needs to be made less so. I changed dmi_printk
to just do a printk() and have included what I think is all
the relevant information below, so you can exclude matching the T23.

I have attached a patch which fixes this (against 2.4.12-ac5),
and the dmi dump.

--
Alex Bligh

DMI dump on standard build:

All processors have done init_idle
DMI 0.0 present.
48 structures occupying 1720 bytes.
DMI table at 0x27F7C000.
BIOS Vendor: IBM
BIOS Version: 1AET38WW (1.01b)
BIOS Release: 07/27/2001
System Vendor: IBM.
Product Name: 26479LU.
Version Not Available.
Serial Number 787PR4K.
Board Vendor: IBM.
Board Name: 26479LU.
Board Version: Not Available.
Asset Tag: No Asset Information.
IBM machine detected. Enabling interrupts during APM calls.


--- kernel-source-2.4.12ac5clean/arch/i386/kernel/dmi_scan.c Tue Oct 23 10:00:14 2001
+++ kernel-source-2.4.12ac5dev/arch/i386/kernel/dmi_scan.c Wed Oct 31 22:09:14 2001
@@ -277,6 +277,23 @@
return 0;
}

+/*
+ * ... but some other (more specific) variants of the above laptops
+ * do not like interrupts being enabled during APM calls
+ * For instance though IBM laptops apparently crash if interrupts
+ * are not enabled during APM calls, the IBM T23 appears to crash
+ * if interrupts /are/ enabled during APM calls - sigh - [email protected]
+ */
+static __init int set_no_apm_ints(struct dmi_blacklist *d)
+{
+ if (apm_info.allow_ints)
+ {
+ apm_info.allow_ints = 0;
+ printk(KERN_INFO "%s machine detected. Re-disabling interrupts during APM calls.\n", d->ident);
+ }
+ return 0;
+}
+
/*
* Some APM bioses corrupt memory or just plain do not work
*/
@@ -458,6 +475,11 @@
MATCH(DMI_SYS_VENDOR, "IBM"),
NO_MATCH, NO_MATCH, NO_MATCH
} },
+ { set_no_apm_ints, "IBM T23", { /* Disable interrupts during suspend on IBM T23 laptops */
+ MATCH(DMI_SYS_VENDOR, "IBM"),
+ MATCH(DMI_PRODUCT_NAME, "26479"),
+ NO_MATCH, NO_MATCH
+ } },
{ set_apm_ints, "Dell Inspiron", { /* Allow interrupts during suspend on Dell Inspiron laptops*/
MATCH(DMI_SYS_VENDOR, "Dell Computer Corporation"),
MATCH(DMI_PRODUCT_NAME, "Inspiron 4000"),


2001-11-04 00:21:44

by Thomas Hood

[permalink] [raw]
Subject: Re: [PATCH] IBM T23; quirks force enable interrupts in APM set power state, causes crash on suspend

> Summary: dmi_scan.c forces interrupt enable on during PCI BIOS
> call for all IBM machines, which breaks T23, which needs it
> off it seems.
[...]
> BIOS Vendor: IBM
> BIOS Version: 1AET38WW (1.01b)
> BIOS Release: 07/27/2001

I would suggest that you try upgrading your firmware before
concluding that your patch is necessary. The latest firmware
listed on IBM's website is version 1.03 = 1AET43WW,
released 19 October 2001. There have been a LOT of changes since
version 1.01 of the firmware. Here is IBM's changelog:

> I. Summary of changes
> version 1.01 - 1AET38WW
>
> (New) Support for ThinkPad T23.
>
> version 1.02 - 1AET40WW
>
> (New) Support F11 key handling on logo screen for new
> recovery program.
> NOTE: xKx and xLx models are not supported.
> (Fix) IBM Token-Ring PC card does not work after Hibernation
> wakeup under Microsoft Windows 98.
> (Fix) FDD read/write access fail on Microsoft Windows XP.
> (Fix) POST 175 error appear.
> (Fix) USB device which is connected to USB port in docking
> station does not work on Microsoft Windows 95.
> (Fix) System can not boot from USB Portable Device Bay.
> (Fix) Japanese message of eFlash is corrupted.
> (Fix) Two different docking configuration is made.
> (Fix) Ctrl+Alt+Del cause system hang on DOS/V.
> (Fix) Blue screen appear after standby/resume on Microsoft
> Windows 2000 or Windows XP.
> (Fix) Noise appear when TV out is used.
>
> version 1.03 - 1AET43WW
>
> (Fix) Resume hang occur on Windows 2000 when USB CCD
> camera is attached.
> (Fix) RIPL from PCMCIA TokeRing adapter card in docking station
> does not work.
> (Fix) UltraDMA mode 5 (ATA/100) does not enabled on Windows 2000.





Subject: Re: [PATCH] IBM T23; quirks force enable interrupts in APM set power state, causes crash on suspend

Thomas,

--On Saturday, 03 November, 2001 7:20 PM -0500 Thomas Hood
<[email protected]> wrote:

>> Summary: dmi_scan.c forces interrupt enable on during PCI BIOS
>> call for all IBM machines, which breaks T23, which needs it
>> off it seems.
> [...]
>> BIOS Vendor: IBM
>> BIOS Version: 1AET38WW (1.01b)
>> BIOS Release: 07/27/2001
>
> I would suggest that you try upgrading your firmware before
> concluding that your patch is necessary. The latest firmware
> listed on IBM's website is version 1.03 = 1AET43WW,
> released 19 October 2001. There have been a LOT of changes since
> version 1.01 of the firmware. Here is IBM's changelog:

Here's the results

With my patch on 2.4.12-ac5, it was working.

First I took Arjan's pci-bridge patch alone (no BIOS
upgrade etc.). It crashes the machine on suspend.

Then I tried upgrading the BIOS firmware (to 1.03) and
the embedded controller firmware (to 1.02) - i.e. without
Arjan's patch, still running 2.4.12-ac5. It doesn't
resume properly and hung APM but didn't crash.
I believe this may be because I fixed the .config
to run the sound driver at the same time, and it oops'd,
and generally annoyed the suspend process - tsk tsk
changing too many variables at once.

Then I upgraded to 2.4.13-ac7 (which has Arjan's patch
in). All is now well. Any luck & I'll have sound working
too :-)

My conclusion is that the BIOS upgrade fixed the
necessity to call APM BIOS with interrupts off,
so the dmi_scan.c stuff which forces interrupts on
is now harmless.

So if you want to put a patch in, I guess it could
at least not break things on early T-23 BIOS's
(as that's what the dmi_scan does - as the config
option no longer has any effect), or at the /very/
least, document the fact that a BIOS & embedded
controller upgrade is extremely advisable.

[ I am recording T23 experiences at
http://www.alex.org.uk/T23
for anyone interested - especially in contributing]

--
Alex Bligh

2001-11-04 01:03:25

by Alan

[permalink] [raw]
Subject: Re: [PATCH] IBM T23; quirks force enable interrupts in APM set

> So if you want to put a patch in, I guess it could
> at least not break things on early T-23 BIOS's
> (as that's what the dmi_scan does - as the config

Send me the dmi strings (dmidecode output) for the old and new BIOS, the
URL for the firmware and not only can I make the kernel ensure they are
called IRQ off, I can make it tell you where ot get new firmware

Subject: Re: [PATCH] IBM T23; quirks force enable interrupts in APM set

Alan,

> Send me the dmi strings (dmidecode output) for the old and new BIOS, the
> URL for the firmware and not only can I make the kernel ensure they are
> called IRQ off, I can make it tell you where ot get new firmware

Short of dmidecode, assuming you're going to do what I think
you're going to do, I think the following should be sufficient
(change dmi_printk to use printk). If you really need dmidecode,
give me a pointer to it, not that I'm sure how to revert the
BIOS image...

This is assuming it's the BIOS which causes the problem, as opposed
to the embedded controller which I upgraded from 1.00 to 1.02
contemperaneously.

And the answer to 'where is the new firmware' is, for BIOS & embedded
controller:
http://www.pc.ibm.com/qtechinfo/MIGR-39366.html
http://www.pc.ibm.com/qtechinfo/MIGR-40022.html

Sadly they aren't indexed properly from the main IBM site (i.e.
find 'T23 BIOS' finds 1.02).


Old (BIOS 1.01b)

All processors have done init_idle
DMI 0.0 present.
48 structures occupying 1720 bytes.
DMI table at 0x27F7C000.
BIOS Vendor: IBM
BIOS Version: 1AET38WW (1.01b)
BIOS Release: 07/27/2001
System Vendor: IBM.
Product Name: 26479LU.
Version Not Available.
Serial Number 787PR4K.
Board Vendor: IBM.
Board Name: 26479LU.
Board Version: Not Available.
Asset Tag: No Asset Information.
IBM machine detected. Enabling interrupts during APM calls.

New Bios (1.03b)

DMI 0.0 present.
48 structures occupying 1720 bytes.
DMI table at 0x27F7C000.
BIOS Vendor: IBM
BIOS Version: 1AET43WW (1.03b)
BIOS Release: 09/25/2001
System Vendor: IBM.
Product Name: 26479LU.
Version Not Available.
Serial Number 787PR4K.
Board Vendor: IBM.
Board Name: 26479LU.
Board Version: Not Available.
Asset Tag: No Asset Information.
IBM machine detected. Enabling interrupts during APM calls.


--
Alex Bligh