Take 2: Generic x86 config option.

From: George (greerga@nidhogg.ham.muohio.edu)
Date: Tue Mar 07 2000 - 23:55:44 EST


Since I haven't heard "this sucks, no" yet, I'll retry. Here's my previous
message:

--- 8< ---
After the discussion on the P6 microcode and how it shouldn't be dependant
on CONFIG_M686 due to generic kernels using M386, I made these incremental
patches for a generic x86 build. They are incremental in case there are
issues with parts.

Basically, CONFIG_M386 becomes truly a 386 and MCONFIG_MX86_GENERIC becomes
the generic option. It's long I know, but CONFIG_MX86 is too close to
CONFIG_X86.

With this, the kernel configuration options could be changed from 'this and
higher' to be 'only this' to exclude such things as the F00F bug from
386/486 builds. I haven't done that in this patch though.

Some of the options I would prefer to negate their meaning to prevent
double negatives (e.g. CONFIG_X86_POPAD_OK and CONFIG_X86_GOOD_APIC) but I
have not done that here to reduce the impact.

I tested this by running through config, oldconfig, and menuconfig. The
help options I tested in config.
--- 8< ---

And now the patch: (now no longer incremental)

diff -uprN linux/Documentation/Configure.help linux.x86gen/Documentation/Configure.help
--- linux/Documentation/Configure.help Tue Mar 7 18:57:13 2000
+++ linux.x86gen/Documentation/Configure.help Wed Mar 8 01:41:51 2000
@@ -125,6 +125,112 @@ CONFIG_X86_UP_IOAPIC
   on IO-APIC-less systems with no slowdown at all. SMP kernels include
   IO-APIC support unconditionally.
 
+Require working memory write protect
+CONFIG_X86_WP_WORKS_OK
+ If you enable this option, the kernel assumes your processor handles
+ writing to pages while in supervisor mode properly.
+
+ If you enable this option and boot on a machine which does not do
+ the above, the kernel will panic before starting.
+
+ If you don't know what to do here, say N if you want to use a 386.
+ Otherwise it is safe to say Y.
+
+Require INVLPG instruction
+CONFIG_X86_INVLPG
+ This option enables the use of a CPU instruction introduced in later
+ x86 models. While not required, it can increase the speed of the
+ kernel.
+
+ If you enable this option and boot on a machine which does not do
+ the above, the kernel will panic before starting.
+
+ If you don't know what to do here, say N if you want to use a 386.
+ Otherwise it is safe to say Y.
+
+Require BSWAP instruction
+CONFIG_X86_BSWAP
+ This option enables the use of a CPU instruction introduced in later
+ x86 models. While not required, it can increase the speed of the
+ kernel.
+
+ If you enable this option and boot on a machine which does not do
+ the above, the kernel will panic before starting.
+
+ If you don't know what to do here, say N if you want to use a 386.
+ Otherwise it is safe to say Y.
+
+Assume no POPAD bug
+CONFIG_X86_POPAD_OK
+ Intel 386 processors may be hung from userspace by executing certain
+ instructions. If you're more familiar with Pentiums, think F00F bug.
+ Unlike the F00F bug, however, there is no workaround so this can
+ only print a warning message.
+
+ If you don't know what to do here, say N if you want to use a 386.
+ Otherwise it is safe to say Y.
+
+Require Time Stamp Counter (TSC)
+CONFIG_X86_TSC
+ This option enables the use of a CPU instruction introduced in later
+ x86 models. While not required, it can increase the speed of the
+ kernel.
+
+ If you enable this option and boot on a machine which does not do
+ the above, the kernel will panic before starting.
+
+ If you don't know what to do here, say N if you want to use a 386,
+ 486, or non-Intel 586 class machine. Otherwise it is safe to say Y.
+
+Require Pentium Pro or better APIC
+CONFIG_X86_GOOD_APIC
+ The multi-processor local interrupt controller on Pentium and
+ earlier motherboards contains a bug in its write handling. Enable
+ this option to work around the problem.
+
+ If you enable this option and boot on a Pentium or earlier machine,
+ the kernel will panic before starting.
+
+ If you don't know what to do here, say Y if you have a Pentium Pro
+ or later machine. Otherwise say N.
+
+Require Page Global Enable (PGE)
+CONFIG_X86_PGE
+ Page Global Enable allows the kernel to keep certain maps of
+ memory always available. While not required, it can increase
+ the speed of the kernel.
+
+ If you enable this option and boot on a machine which does not do
+ the above, the kernel will panic before starting.
+
+ If you don't know what to do here, say Y if you have a Pentium Pro
+ or later machine. Otherwise say N.
+
+Use AMD 3D Now! extensions
+CONFIG_X86_USE_3DNOW
+ This option enables the use of a CPU instruction introduced first
+ in late AMD K6 models. While not required, it can increase the
+ speed of the kernel.
+
+ If you enable this option and boot on a machine which does not do
+ the above, the kernel will panic before starting.
+
+ If you don't know what to do here, say N. Say Y if you own an AMD
+ CPU such as the K6-III, Athlon, or later.
+
+Fast unlocking for spinlocks
+CONFIG_X86_MOVB_SPIN_UNLOCK
+ Due to the memory ordering in x86 processors, the CPU bus on a
+ multi-processor system need not be locked in order to release
+ the software lock called a "spinlock." While not required, it
+ can increase the speed of the kernel.
+
+ This would be default, except that early Pentium Pro processors
+ contain a bug breaking that assumption.
+
+ If you don't know what to do here, say N if you want to run this
+ kernel on a Pentium Pro machine. Otherwise, say Y.
+
 Kernel math emulation
 CONFIG_MATH_EMULATION
   Linux can emulate a math coprocessor (used for floating point
diff -uprN linux/arch/i386/Makefile linux.x86gen/arch/i386/Makefile
--- linux/arch/i386/Makefile Tue Mar 7 18:57:14 2000
+++ linux.x86gen/arch/i386/Makefile Wed Mar 8 01:39:36 2000
@@ -29,6 +29,11 @@ CFLAGS += $(shell if ! $(CC) -march=i486
 # prevent gcc from keeping the stack 16 byte aligned
 CFLAGS += $(shell if $(CC) -mpreferred-stack-boundary=2 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mpreferred-stack-boundary=2"; fi)
 
+ifdef CONFIG_MX86_GENERIC
+CFLAGS := $(CFLAGS) -m386 -DCPU=386
+AFLAGS := $(AFLAGS) -DCPU=386
+endif
+
 ifdef CONFIG_M386
 CFLAGS := $(CFLAGS) -m386 -DCPU=386
 AFLAGS := $(AFLAGS) -DCPU=386
diff -uprN linux/arch/i386/config.in linux.x86gen/arch/i386/config.in
--- linux/arch/i386/config.in Tue Mar 7 18:57:14 2000
+++ linux.x86gen/arch/i386/config.in Wed Mar 8 01:41:51 2000
@@ -14,24 +14,52 @@ comment 'Code maturity level options'
 bool 'Prompt for development and/or incomplete code/drivers' CONFIG_EXPERIMENTAL
 endmenu
 
+#
+# CONFIG_MX86 would be better, but see a few lines above
+# for the problem with that. (CONFIG_X86)
+#
 mainmenu_option next_comment
 comment 'Processor type and features'
 choice 'Processor family' \
- "386 CONFIG_M386 \
+ "Generic CONFIG_MX86_GENERIC \
+ 386 CONFIG_M386 \
          486/Cx486 CONFIG_M486 \
          586/K5/5x86/6x86 CONFIG_M586 \
          Pentium/TSC CONFIG_M586TSC \
          PPro/6x86MX CONFIG_M686 \
          K6/II/III CONFIG_MK6 \
          Athlon CONFIG_MK7" PPro
+
+#
+# Let the user customize their options here.
+#
+if [ "$CONFIG_MX86_GENERIC" = "y" ]; then
+ bool ' Require working memory write protect' CONFIG_X86_WP_WORKS_OK
+ bool ' Require INVLPG instruction' CONFIG_X86_INVLPG
+ bool ' Require BSWAP instruction' CONFIG_X86_BSWAP
+ bool ' Assume no POPAD bug' CONFIG_X86_POPAD_OK
+ bool ' Require Time Stamp Counter (TSC)' CONFIG_X86_TSC
+ if [ "$CONFIG_SMP" = "y" -o "$CONFIG_X86_LOCAL_APIC" = "y" ]; then
+ bool ' Require Pentium Pro or better APIC' CONFIG_X86_GOOD_APIC
+ fi
+ bool ' Require Page Global Enable (PGE)' CONFIG_X86_PGE
+ bool ' Use AMD 3D Now! extensions' CONFIG_X86_USE_3DNOW
+ if [ "$CONFIG_SMP" = "y" ]; then
+ bool ' Fast unlocking for spinlocks' CONFIG_X86_MOVB_SPIN_UNLOCK
+ fi
+fi
+
 #
 # Define implied options from the CPU selection here
 #
-if [ "$CONFIG_M386" != "y" ]; then
+if [ "$CONFIG_M386" != "y" -a "$CONFIG_MX86_GENERIC" != "y" ]; then
    define_bool CONFIG_X86_WP_WORKS_OK y
    define_bool CONFIG_X86_INVLPG y
    define_bool CONFIG_X86_BSWAP y
    define_bool CONFIG_X86_POPAD_OK y
+fi
+if [ "$CONFIG_M686" != "y" -a "$CONFIG_MX86_GENERIC" != "y" ]; then
+ define_bool CONFIG_X86_MOVB_SPIN_UNLOCK y
 fi
 if [ "$CONFIG_M686" = "y" -o "$CONFIG_M586TSC" = "y" ]; then
    define_bool CONFIG_X86_TSC y
diff -uprN linux/include/asm-i386/spinlock.h linux.x86gen/include/asm-i386/spinlock.h
--- linux/include/asm-i386/spinlock.h Tue Mar 7 18:56:29 2000
+++ linux.x86gen/include/asm-i386/spinlock.h Wed Mar 8 01:39:42 2000
@@ -67,8 +67,14 @@ typedef struct {
  *
  * Which is noticeably faster.
  */
+#ifdef CONFIG_X86_MOVB_SPIN_UNLOCK
+#define spin_unlock_string \
+ "movb $0,%0"
+#else
 #define spin_unlock_string \
         "lock ; btrl $0,%0"
+#endif
+
 
 extern inline void spin_lock(spinlock_t *lock)
 {

-George Greer

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



This archive was generated by hypermail 2b29 : Wed Mar 15 2000 - 21:00:13 EST