All of lore.kernel.org
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Joerg Roedel <joro@8bytes.org>
Cc: mingo@redhat.com, tglx@linutronix.de, linux-kernel@vger.kernel.org
Subject: Re: Setup code crashes my old 486 box
Date: Tue, 12 Aug 2008 15:57:31 -0700	[thread overview]
Message-ID: <48A2155B.1020904@zytor.com> (raw)
In-Reply-To: <20080812224703.GV31439@8bytes.org>

[-- Attachment #1: Type: text/plain, Size: 978 bytes --]

Joerg Roedel wrote:
> Hello,
> 
> 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.
> Is this an acceptable workaround or is there a better one for this?
> 
> Regards,
> 
> Joerg

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?

	-hpa

[-- Attachment #2: diff --]
[-- Type: text/plain, Size: 1463 bytes --]

diff --git a/arch/x86/boot/boot.h b/arch/x86/boot/boot.h
index a34b998..9ce8d29 100644
--- a/arch/x86/boot/boot.h
+++ b/arch/x86/boot/boot.h
@@ -242,6 +242,12 @@ int cmdline_find_option(const char *option, char *buffer, int bufsize);
 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);
 
diff --git a/arch/x86/boot/cpucheck.c b/arch/x86/boot/cpucheck.c
index 7804389..c1ce030 100644
--- a/arch/x86/boot/cpucheck.c
+++ b/arch/x86/boot/cpucheck.c
@@ -30,13 +30,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];
 
diff --git a/arch/x86/boot/main.c b/arch/x86/boot/main.c
index 2296164..9b04773 100644
--- a/arch/x86/boot/main.c
+++ b/arch/x86/boot/main.c
@@ -73,6 +73,10 @@ static void keyboard_set_repeat(void)
  */
 static void query_ist(void)
 {
+	/* Some 486 BIOSes apparently crash on this call */
+	if (cpu.level < 5)
+		return;
+
 	asm("int $0x15"
 	    : "=a" (boot_params.ist_info.signature),
 	      "=b" (boot_params.ist_info.command),

  reply	other threads:[~2008-08-12 22:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-12 22:47 Setup code crashes my old 486 box Joerg Roedel
2008-08-12 22:57 ` H. Peter Anvin [this message]
2008-08-12 22:55   ` Alan Cox
2008-08-13  0:21     ` H. Peter Anvin
2008-08-13  8:07   ` Joerg Roedel
2008-08-13 10:00     ` Ingo Molnar
2008-08-13 10:40       ` Joerg Roedel
2008-08-13 15:33     ` H. Peter Anvin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48A2155B.1020904@zytor.com \
    --to=hpa@zytor.com \
    --cc=joro@8bytes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.