[patch 47/49] x86: fix setup code crashes on my old 486 box

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <linux-kernel@...>, <stable@...>, <jejb@...>
Cc: Justin Forbes <jmforbes@...>, Zwane Mwaikambo <zwane@...>, Theodore Ts'o <tytso@...>, Randy Dunlap <rdunlap@...>, Dave Jones <davej@...>, Chuck Wolber <chuckw@...>, Chris Wedgwood <reviews@...>, Michael Krufky <mkrufky@...>, Chuck Ebbert <cebbert@...>, Domenico Andreoli <cavokz@...>, Willy Tarreau <w@...>, Rodrigo Rubira Branco <rbranco@...>, Jake Edge <jake@...>, Eugene Teo <eteo@...>, <torvalds@...>, <akpm@...>, <alan@...>, Joerg Roedel <joro@...>, H. Peter Anvin <hpa@...>, Ingo Molnar <mingo@...>
Date: Monday, August 18, 2008 - 3:21 pm

2.6.25-stable review patch.  If anyone has any objections, please let us know.

------------------

From: Joerg Roedel <joro@8bytes.org>

commit 7b27718bdb1b70166383dec91391df5534d449ee upstream

yesterday I tried to reactivate my old 486 box and wanted to install a
current Linux with latest kernel on it. But it turned out that the
latest kernel does not boot because the machine crashes early in the
setup code.

After some debugging it turned out that the problem is the query_ist()
function. If this interrupt with that function is called the machine
simply locks up. It looks like a BIOS bug. Looking for a workaround for
this problem I wrote the attached patch. It checks for the CPUID
instruction and if it is not implemented it does not call the speedstep
BIOS function. As far as I know speedstep should be available since some
Pentium earliest.

Alan Cox observed that it's available since the Pentium II, so cpuid
levels 4 and 5 can be excluded altogether.

H. Peter Anvin cleaned up the code some more:


which, with a small modification to fix a build error with it the
resulting kernel boots on my machine.

Signed-off-by: Joerg Roedel <joro@8bytes.org>
Signed-off-by: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 arch/x86/boot/boot.h     |    8 ++++++++
 arch/x86/boot/cpucheck.c |    8 +-------
 arch/x86/boot/main.c     |    4 ++++
 3 files changed, 13 insertions(+), 7 deletions(-)

--- a/arch/x86/boot/boot.h
+++ b/arch/x86/boot/boot.h
@@ -27,6 +27,8 @@
 #include <asm/boot.h>
 #include <asm/setup.h>
 
+#define NCAPINTS   8
+
 /* Useful macros */
 #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
 
@@ -244,6 +246,12 @@ int cmdline_find_option(const char *opti
 int cmdline_find_option_bool(const char *option);
 
 /* cpu.c, cpucheck.c */
+struct cpu_features {
+	int level;		/* Family, or 64 for x86-64 */
+	int model;
+	u32 flags[NCAPINTS];
+};
+extern struct cpu_features cpu;
 int check_cpu(int *cpu_level_ptr, int *req_level_ptr, u32 **err_flags_ptr);
 int validate_cpu(void);
 
--- a/arch/x86/boot/cpucheck.c
+++ b/arch/x86/boot/cpucheck.c
@@ -32,13 +32,7 @@
 #include <asm/required-features.h>
 #include <asm/msr-index.h>
 
-struct cpu_features {
-	int level;		/* Family, or 64 for x86-64 */
-	int model;
-	u32 flags[NCAPINTS];
-};
-
-static struct cpu_features cpu;
+struct cpu_features cpu;
 static u32 cpu_vendor[3];
 static u32 err_flags[NCAPINTS];
 
--- a/arch/x86/boot/main.c
+++ b/arch/x86/boot/main.c
@@ -75,6 +75,10 @@ static void keyboard_set_repeat(void)
  */
 static void query_ist(void)
 {
+	/* Some 486 BIOSes apparently crash on this call */
+	if (cpu.level < 6)
+		return;
+
 	asm("int $0x15"
 	    : "=a" (boot_params.ist_info.signature),
 	      "=b" (boot_params.ist_info.command),

-- 
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[patch 00/49] 2.6.25-stable review, Greg KH, (Mon Aug 18, 3:18 pm)
[patch 47/49] x86: fix setup code crashes on my old 486 box, Greg KH, (Mon Aug 18, 3:21 pm)
[patch 46/49] x86: fix spin_is_contended(), Greg KH, (Mon Aug 18, 3:21 pm)
[patch 41/49] radeon: misc corrections, Greg KH, (Mon Aug 18, 3:20 pm)
[patch 40/49] uml: PATH_MAX needs limits.h, Greg KH, (Mon Aug 18, 3:20 pm)
[patch 39/49] uml: Fix boot crash, Greg KH, (Mon Aug 18, 3:20 pm)
[patch 30/49] uml: track and make up lost ticks, Greg KH, (Mon Aug 18, 3:20 pm)
[patch 25/49] sparc64: FUTEX_OP_ANDN fix, Greg KH, (Mon Aug 18, 3:20 pm)
[patch 23/49] random32: seeding improvement, Greg KH, (Mon Aug 18, 3:20 pm)
[patch 15/49] mlock() fix return values, Greg KH, (Mon Aug 18, 3:19 pm)
[patch 12/49] radeonfb: fix accel engine hangs, Greg KH, (Mon Aug 18, 3:19 pm)
[patch 07/49] SCSI: ses: fix VPD inquiry overrun, Greg KH, (Mon Aug 18, 3:19 pm)