Commit 66b53f4d authored by Joerg Roedel's avatar Joerg Roedel Committed by Greg Kroah-Hartman

x86: fix setup code crashes on my old 486 box

commit 7b27718b 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:

> Right in concept, but I dislike the implementation (duplication of the
> CPU detect code we already have).  Could you try this patch and see if
> it works for you?

which, with a small modification to fix a build error with it the
resulting kernel boots on my machine.
Signed-off-by: default avatarJoerg Roedel <joro@8bytes.org>
Signed-off-by: default avatar"H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent a6582aa4
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
#include <asm/boot.h> #include <asm/boot.h>
#include <asm/setup.h> #include <asm/setup.h>
#define NCAPINTS 8
/* Useful macros */ /* Useful macros */
#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
...@@ -242,6 +244,12 @@ int cmdline_find_option(const char *option, char *buffer, int bufsize); ...@@ -242,6 +244,12 @@ int cmdline_find_option(const char *option, char *buffer, int bufsize);
int cmdline_find_option_bool(const char *option); int cmdline_find_option_bool(const char *option);
/* cpu.c, cpucheck.c */ /* 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 check_cpu(int *cpu_level_ptr, int *req_level_ptr, u32 **err_flags_ptr);
int validate_cpu(void); int validate_cpu(void);
......
...@@ -30,13 +30,7 @@ ...@@ -30,13 +30,7 @@
#include <asm/required-features.h> #include <asm/required-features.h>
#include <asm/msr-index.h> #include <asm/msr-index.h>
struct cpu_features { struct cpu_features cpu;
int level; /* Family, or 64 for x86-64 */
int model;
u32 flags[NCAPINTS];
};
static struct cpu_features cpu;
static u32 cpu_vendor[3]; static u32 cpu_vendor[3];
static u32 err_flags[NCAPINTS]; static u32 err_flags[NCAPINTS];
......
...@@ -73,6 +73,10 @@ static void keyboard_set_repeat(void) ...@@ -73,6 +73,10 @@ static void keyboard_set_repeat(void)
*/ */
static void query_ist(void) static void query_ist(void)
{ {
/* Some 486 BIOSes apparently crash on this call */
if (cpu.level < 6)
return;
asm("int $0x15" asm("int $0x15"
: "=a" (boot_params.ist_info.signature), : "=a" (boot_params.ist_info.signature),
"=b" (boot_params.ist_info.command), "=b" (boot_params.ist_info.command),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment