[PATCH] moving F0 0F bug check to bugs.h

Zwane Mwaikambo (zwane@linux.realnet.co.sz)
Sun, 18 Nov 2001 15:51:37 +0200 (SAST)


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);
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/