public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] moving F0 0F bug check to bugs.h
@ 2001-11-18 13:51 Zwane Mwaikambo
  2001-11-18 14:18 ` Dave Jones
  0 siblings, 1 reply; 9+ messages in thread
From: Zwane Mwaikambo @ 2001-11-18 13:51 UTC (permalink / raw)
  To: Linux Kernel

Is there any reason why the F0 0F bug check isn't in bugs.h? We only
check for the bug once so we might as well move it to check the boot cpu
only in bugs.h. Diffed against 2.4.14-pre6, please consider for
applying.

Regards,
	Zwane Mwaikambo


diff -urbB linux-2.4.14-pre6-orig/arch/i386/kernel/setup.c linux-2.4.14-pre6-zm/arch/i386/kernel/setup.c
--- linux-2.4.14-pre6-orig/arch/i386/kernel/setup.c	Sun Nov 18 15:18:05 2001
+++ linux-2.4.14-pre6-zm/arch/i386/kernel/setup.c	Sun Nov 18 15:28:54 2001
@@ -2025,29 +2025,10 @@

 static void __init init_intel(struct cpuinfo_x86 *c)
 {
-#ifndef CONFIG_M686
-	static int f00f_workaround_enabled = 0;
-#endif
 	char *p = NULL;
 	unsigned int l1i = 0, l1d = 0, l2 = 0, l3 = 0; /* Cache sizes */

-#ifndef CONFIG_M686
-	/*
-	 * All current models of Pentium and Pentium with MMX technology CPUs
-	 * have the F0 0F bug, which lets nonpriviledged users lock up the system.
-	 * Note that the workaround only should be initialized once...
-	 */
-	c->f00f_bug = 0;
-	if ( c->x86 == 5 ) {
-		c->f00f_bug = 1;
-		if ( !f00f_workaround_enabled ) {
-			trap_init_f00f_bug();
-			printk(KERN_NOTICE "Intel Pentium with F0 0F bug - workaround enabled.\n");
-			f00f_workaround_enabled = 1;
-		}
-	}
-#endif
-
+	c->f00f_bug = boot_cpu_data.f00f_bug;	/* to avoid confusion */

 	if (c->cpuid_level > 1) {
 		/* supports eax=2  call */
diff -urbB linux-2.4.14-pre6-orig/include/asm-i386/bugs.h linux-2.4.14-pre6-zm/include/asm-i386/bugs.h
--- linux-2.4.14-pre6-orig/include/asm-i386/bugs.h	Mon Nov  5 22:42:12 2001
+++ linux-2.4.14-pre6-zm/include/asm-i386/bugs.h	Sun Nov 18 15:27:54 2001
@@ -144,6 +144,23 @@
 }

 /*
+ * All current models of Pentium and Pentium with MMX technology CPUs
+ * have the F0 0F bug, which lets nonpriviledged users lock up the system.
+ * Note that the workaround only should be initialized once...
+ */
+static void __init check_f00f(void)
+{
+#ifndef CONFIG_M686
+	boot_cpu_data.f00f_bug = 0;
+	if ((boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) && (boot_cpu_data.x86 == 5)) {
+		boot_cpu_data.f00f_bug = 1;
+		trap_init_f00f_bug();
+		printk(KERN_NOTICE "Intel Pentium with F0 0F bug - workaround enabled.\n");
+	}
+#endif
+}
+
+/*
  * Check whether we are able to run this kernel safely on SMP.
  *
  * - In order to run on a i386, we need to be compiled for i386
@@ -213,5 +230,6 @@
 	check_fpu();
 	check_hlt();
 	check_popad();
+	check_f00f();
 	system_utsname.machine[1] = '0' + (boot_cpu_data.x86 > 6 ? 6 : boot_cpu_data.x86);
 }


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2001-11-19  1:46 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-11-18 13:51 [PATCH] moving F0 0F bug check to bugs.h Zwane Mwaikambo
2001-11-18 14:18 ` Dave Jones
2001-11-18 14:37   ` Zwane Mwaikambo
2001-11-18 14:50     ` Dave Jones
2001-11-18 15:22       ` Zwane Mwaikambo
2001-11-18 15:30         ` Dave Jones
2001-11-18 15:07   ` Alan Cox
2001-11-18 18:14   ` George Greer
2001-11-19  1:46   ` H. Peter Anvin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox