Skip to contentSkip to conversation

RFC: [2.6 patch] better i386 CPU selection

PATCH Adrian Bunk 7 participants 22 messages Sep 7, 2003 – Sep 11, 2003

lore
Share & tools
lore
#0 lore raw

The patch below tries to implement a better i386 CPU selection.

In 2.4 selecting e.g. M486 has the semantics to get a kernel that runs on a 486 and above.

In 2.6 selecting M486 means that only the 486 is supported.

The help text for the X86_GENERIC option says it generates a generic kernel but the implementation is that it supports CPUs of the selected M* option and above.

There are two different needs:
1. the installation kernel of a distribution should support all CPUs this distribution supports (perhaps starting with the 386)
2. a sysadmin might e.g. want a kernel that support both a Pentium-III and a Pentium 4, but doesn't need to support a 386

The implementation in 2.4 was near to satisfy need 2., if X86_GENERIC in 2.6 was implemented as the help text says it would satisfy the need of 1.

The patch below against 2.6.0-test4-mm5 does a different implementation that lets you select all CPUs you want to support and it should therefore suit both needs.

Changes:
- changed the i386 CPU selection from a choice to single options for every cpu
- renamed the M* variables to CPU_*, this is needed to ask the users upgrading from older kernels instead of silently changing the semantics
- AMD Elan is a different subarch, you can't configure a kernel that runs on both the AMD Elan and other i386 CPUs
- help text changes

Questions/TODO:
- @Rusty:
what's your opinion on making MODULE_PROC_FAMILY in include/asm-i386/module.h some kind of bitmask?
- @Robert:
there were no Elan CFLAGS in arch/i386/Makefile???
- which CPUs exactly need X86_ALIGNMENT_16?
- X86_GOOD_APIC: are there really that many processors with a bad APIC?
- could someone with a deeper knowledge of i386 CPUs comment on whether I got the CFLAGS in arch/i386/Makefile right for all possible CPU combinations?
- Kconfig handling of no CPU selected

diffstat output:

 arch/i386/Kconfig            |  237 ++++++++++++++---------------------
 arch/i386/Makefile           |   98 +++++++++++---
 arch/i386/boot/setup.S       |    2
 drivers/serial/8250.h        |    2
 include/asm-i386/processor.h |    4
 include/asm-i386/timex.h     |    2
 6 files changed, 184 insertions(+), 161 deletions(-)

A 2.6.0-test4-mm5 kernel with this patch applied compiled and bootet on my PC.

cu
Adrian

arch/i386/Kconfig renamed from arch/i386/Kconfig.old +100 -137
@@ -43,6 +43,15 @@
 	help
 	  Choose this option if your computer is a standard PC or compatible.
 
+config X86_ELAN
+	bool "Elan"
+	help
+	  Select this for an AMD Elan processor.
+	
+	  Do not use this option for K6/Athlon/Opteron processors!
+	
+	  If unsure choose "PC-compatible" instead.
+
 config X86_VOYAGER
 	bool "Voyager (NCR)"
 	help
@@ -125,48 +134,19 @@
 	default y
 	depends on SMP && X86_ES7000 && MPENTIUMIII
 
-choice
-	prompt "Processor family"
-	default M686
 
-config M386
-	bool "386"
-	---help---
-	  This is the processor type of your CPU. This information is used for
-	  optimizing purposes. In order to compile a kernel that can run on
-	  all x86 CPU types (albeit not optimally fast), you can specify
-	  "386" here.
-
-	  The kernel will not necessarily run on earlier architectures than
-	  the one you have chosen, e.g. a Pentium optimized kernel will run on
-	  a PPro, but not necessarily on a i486.
-
-	  Here are the settings recommended for greatest speed:
-	  - "386" for the AMD/Cyrix/Intel 386DX/DXL/SL/SLC/SX, Cyrix/TI
-	  486DLC/DLC2, UMC 486SX-S and NexGen Nx586.  Only "386" kernels
-	  will run on a 386 class machine.
-	  - "486" for the AMD/Cyrix/IBM/Intel 486DX/DX2/DX4 or
-	  SL/SLC/SLC2/SLC3/SX/SX2 and UMC U5D or U5S.
-	  - "586" for generic Pentium CPUs lacking the TSC
-	  (time stamp counter) register.
-	  - "Pentium-Classic" for the Intel Pentium.
-	  - "Pentium-MMX" for the Intel Pentium MMX.
-	  - "Pentium-Pro" for the Intel Pentium Pro.
-	  - "Pentium-II" for the Intel Pentium II or pre-Coppermine Celeron.
-	  - "Pentium-III" for the Intel Pentium III or Coppermine Celeron.
-	  - "Pentium-4" for the Intel Pentium 4 or P4-based Celeron.
-	  - "K6" for the AMD K6, K6-II and K6-III (aka K6-3D).
-	  - "Athlon" for the AMD K7 family (Athlon/Duron/Thunderbird).
-	  - "Crusoe" for the Transmeta Crusoe series.
-	  - "Winchip-C6" for original IDT Winchip.
-	  - "Winchip-2" for IDT Winchip 2.
-	  - "Winchip-2A" for IDT Winchips with 3dNow! capabilities.
-	  - "CyrixIII/VIA C3" for VIA Cyrix III or VIA C3.
-	  - "VIA C3-2 for VIA C3-2 "Nehemiah" (model 9 and above).
+if !X86_ELAN
 
-	  If you don't know what to do, choose "386".
+menu "Processor support"
 
-config M486
+comment "Select all processors your kernel should support"
+
+config CPU_386
+	bool "386"
+	help
+	  Select this for a 386 series processor.
+
+config CPU_486
 	bool "486"
 	help
 	  Select this for a 486 series processor, either Intel or one of the
@@ -174,227 +154,210 @@
 	  DX2, and DX4 variants; also SL/SLC/SLC2/SLC3/SX/SX2 and UMC U5D or
 	  U5S.
 
-config M586
+config CPU_586
 	bool "586/K5/5x86/6x86/6x86MX"
 	help
 	  Select this for an 586 or 686 series processor such as the AMD K5,
 	  the Intel 5x86 or 6x86, or the Intel 6x86MX.  This choice does not
 	  assume the RDTSC (Read Time Stamp Counter) instruction.
 
-config M586TSC
+config CPU_586TSC
 	bool "Pentium-Classic"
 	help
 	  Select this for a Pentium Classic processor with the RDTSC (Read
-	  Time Stamp Counter) instruction for benchmarking.
+	  Time Stamp Counter) instruction.
 
-config M586MMX
+config CPU_586MMX
 	bool "Pentium-MMX"
 	help
 	  Select this for a Pentium with the MMX graphics/multimedia
 	  extended instructions.
 
-config M686
+config CPU_686
 	bool "Pentium-Pro"
 	help
-	  Select this for Intel Pentium Pro chips.  This enables the use of
-	  Pentium Pro extended instructions, and disables the init-time guard
-	  against the f00f bug found in earlier Pentiums.
+	  Select this for Intel Pentium Pro chips.
 
-config MPENTIUMII
+config CPU_PENTIUMII
 	bool "Pentium-II/Celeron(pre-Coppermine)"
 	help
 	  Select this for Intel chips based on the Pentium-II and
-	  pre-Coppermine Celeron core.  This option enables an unaligned
-	  copy optimization, compiles the kernel with optimization flags
-	  tailored for the chip, and applies any applicable Pentium Pro
-	  optimizations.
+	  pre-Coppermine Celeron core.
 
-config MPENTIUMIII
+config CPU_PENTIUMIII
 	bool "Pentium-III/Celeron(Coppermine)/Pentium-III Xeon"
 	help
 	  Select this for Intel chips based on the Pentium-III and
-	  Celeron-Coppermine core.  This option enables use of some
-	  extended prefetch instructions in addition to the Pentium II
-	  extensions.
+	  Celeron-Coppermine core.
 
-config MPENTIUM4
+config CPU_PENTIUM4
 	bool "Pentium-4/Celeron(P4-based)/Xeon"
 	help
 	  Select this for Intel Pentium 4 chips.  This includes both
-	  the Pentium 4 and P4-based Celeron chips.  This option
-	  enables compile flags optimized for the chip, uses the
-	  correct cache shift, and applies any applicable Pentium III
-	  optimizations.
+	  the Pentium 4 and P4-based Celeron chips.
 
-config MK6
+config CPU_K6
 	bool "K6/K6-II/K6-III"
 	help
-	  Select this for an AMD K6-family processor.  Enables use of
-	  some extended instructions, and passes appropriate optimization
-	  flags to GCC.
+	  Select this for an AMD K6, K6-II or K6-III (aka K6-3D).
 
-config MK7
+config CPU_K7
 	bool "Athlon/Duron/K7"
 	help
-	  Select this for an AMD Athlon K7-family processor.  Enables use of
-	  some extended instructions, and passes appropriate optimization
-	  flags to GCC.
+	  Select this for an AMD Athlon K7-family processor.
 
-config MK8
+config CPU_K8
 	bool "Opteron/Athlon64/Hammer/K8"
 	help
-	  Select this for an AMD Opteron or Athlon64 Hammer-family processor.  Enables
-	  use of some extended instructions, and passes appropriate optimization
-	  flags to GCC.
+	  Select this for an AMD Opteron or Athlon64 Hammer-family processor.
 
-config MELAN
-	bool "Elan"
-
-config MCRUSOE
+config CPU_CRUSOE
 	bool "Crusoe"
 	help
-	  Select this for a Transmeta Crusoe processor.  Treats the processor
-	  like a 586 with TSC, and sets some GCC optimization flags (like a
-	  Pentium Pro with no alignment requirements).
+	  Select this for a Transmeta Crusoe processor.
 
-config MWINCHIPC6
+config CPU_WINCHIPC6
 	bool "Winchip-C6"
 	help
-	  Select this for an IDT Winchip C6 chip.  Linux and GCC
-	  treat this chip as a 586TSC with some extended instructions
-	  and alignment requirements.
+	  Select this for an IDT Winchip C6 chip.
 
-config MWINCHIP2
+config CPU_WINCHIP2
 	bool "Winchip-2"
 	help
-	  Select this for an IDT Winchip-2.  Linux and GCC
-	  treat this chip as a 586TSC with some extended instructions
-	  and alignment requirements.
+	  Select this for an IDT Winchip-2.
 
-config MWINCHIP3D
+config CPU_WINCHIP3D
 	bool "Winchip-2A/Winchip-3"
 	help
-	  Select this for an IDT Winchip-2A or 3.  Linux and GCC
-	  treat this chip as a 586TSC with some extended instructions
-	  and alignment reqirements.  Also enable out of order memory
-	  stores for this CPU, which can increase performance of some
-	  operations.
-
-config MCYRIXIII
-	bool "CyrixIII/VIA-C3"
-	help
-	  Select this for a Cyrix III or C3 chip.  Presently Linux and GCC
-	  treat this chip as a generic 586. Whilst the CPU is 686 class,
-	  it lacks the cmov extension which gcc assumes is present when
-	  generating 686 code.
-	  Note that Nehemiah (Model 9) and above will not boot with this
-	  kernel due to them lacking the 3DNow! instructions used in earlier
-	  incarnations of the CPU.
+	  Select this for an IDT Winchip-2A or 3 with 3dNow!
+	  capabilities.
+
+config CPU_CYRIXIII
+	bool "Cyrix III/VIA C3"
+	help
+	  Select this for a Cyrix III or VIA C3 chip.
 
-config MVIAC3_2
+	  Note that Nehemiah (Model 9) and above need the next
+	  option instead.
+
+config CPU_VIAC3_2
 	bool "VIA C3-2 (Nehemiah)"
 	help
-	  Select this for a VIA C3 "Nehemiah". Selecting this enables usage
-	  of SSE and tells gcc to treat the CPU as a 686.
-	  Note, this kernel will not boot on older (pre model 9) C3s.
+	  Select this for a VIA C3 "Nehemiah" (model 9 and above).
 
-endchoice
+endmenu
 
-config X86_GENERIC
-       bool "Generic x86 support" 
-       help
-       	  Including some tuning for non selected x86 CPUs too.
-	  when it has moderate overhead. This is intended for generic 
-	  distributions kernels.
+endif
+
+#
+# helper options
+#
+config CPU_WINCHIP
+	bool
+	depends on CPU_WINCHIPC6 || CPU_WINCHIP2 || CPU_WINCHIP3D
+	default y
+
+config CPU_ONLY_K7
+	bool
+	depends on CPU_K7 && !CPU_386 && !CPU_486 && !CPU_586 && !CPU_586TSC && !CPU_586MMX && !CPU_686 && !CPU_PENTIUMII && !CPU_PENTIUMIII && !CPU_PENTIUM4 && !CPU_K6 && !CPU_K8 && !X86_ELAN && !CPU_CRUSOE && !CPU_WINCHIP && !CPU_CYRIXIII && !CPU_VIAC3_2
+
+config CPU_ONLY_K8
+	bool
+	depends on CPU_K8 && !CPU_386 && !CPU_486 && !CPU_586 && !CPU_586TSC && !CPU_586MMX && !CPU_686 && !CPU_PENTIUMII && !CPU_PENTIUMIII && !CPU_PENTIUM4 && !CPU_K6 && !CPU_K7 && !X86_ELAN && !CPU_CRUSOE && !CPU_WINCHIP && !CPU_CYRIXIII && !CPU_VIAC3_2
+
+config CPU_ONLY_WINCHIP
+	bool
+	depends on CPU_WINCHIP && !CPU_386 && !CPU_486 && !CPU_586 && !CPU_586TSC && !CPU_586MMX && !CPU_686 && !CPU_PENTIUMII && !CPU_PENTIUMIII && !CPU_PENTIUM4 && !CPU_K6 && !CPU_K7 && !CPU_K8 && !X86_ELAN && !CPU_CRUSOE && !CPU_CYRIXIII && !CPU_VIAC3_2
+	default y
 
 #
 # Define implied options from the CPU selection here
 #
 config X86_CMPXCHG
 	bool
-	depends on !M386
+	depends on !CPU_386
 	default y
 
 config X86_XADD
 	bool
-	depends on !M386
+	depends on !CPU_386
 	default y
 
 config X86_L1_CACHE_SHIFT
 	int
-	default "7" if MPENTIUM4 || X86_GENERIC
-	default "4" if MELAN || M486 || M386
-	default "5" if MWINCHIP3D || MWINCHIP2 || MWINCHIPC6 || MCRUSOE || MCYRIXIII || MK6 || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || M586 || MVIAC3_2
-	default "6" if MK7 || MK8
+	default "7" if CPU_PENTIUM4
+	default "6" if CPU_K7 || CPU_K8
+	default "5" if CPU_WINCHIP || CPU_CRUSOE || CPU_CYRIXIII || CPU_K6 || CPU_PENTIUMIII || CPU_PENTIUMII || CPU_686 || CPU_586MMX || CPU_586TSC || CPU_586 || CPU_VIAC3_2
+	default "4" if X86_ELAN || CPU_486 || CPU_386
 
 config RWSEM_GENERIC_SPINLOCK
 	bool
-	depends on M386
+	depends on CPU_386
 	default y
 
 config RWSEM_XCHGADD_ALGORITHM
 	bool
-	depends on !M386
+	depends on !CPU_386
 	default y
 
 config X86_PPRO_FENCE
 	bool
-	depends on M686 || M586MMX || M586TSC || M586 || M486 || M386
+	depends on CPU_686
 	default y
 
 config X86_F00F_BUG
 	bool
-	depends on M586MMX || M586TSC || M586 || M486 || M386
+	depends on CPU_586MMX || CPU_586TSC
 	default y
 
 config X86_WP_WORKS_OK
 	bool
-	depends on !M386
+	depends on !CPU_386
 	default y
 
 config X86_INVLPG
 	bool
-	depends on !M386
+	depends on !CPU_386
 	default y
 
 config X86_BSWAP
 	bool
-	depends on !M386
+	depends on !CPU_386
 	default y
 
 config X86_POPAD_OK
 	bool
-	depends on !M386
+	depends on !CPU_386
 	default y
 
 config X86_ALIGNMENT_16
 	bool
-	depends on MWINCHIP3D || MWINCHIP2 || MWINCHIPC6 || MCYRIXIII || MELAN || MK6 || M586MMX || M586TSC || M586 || M486 || MVIAC3_2
+	depends on CPU_WINCHIP || CPU_CYRIXIII || X86_ELAN || CPU_K6 || CPU_586MMX || CPU_586TSC || CPU_586 || CPU_486 || CPU_VIAC3_2
 	default y
 
 config X86_GOOD_APIC
 	bool
-	depends on MK7 || MPENTIUM4 || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || MK8
+	depends on !CPU_386 && !CPU_486 && !CPU_586 && !CPU_586TSC && !CPU_K6 && !X86_ELAN && !CPU_CRUSOE && !CPU_WINCHIP && !CPU_CYRIXIII && !CPU_VIAC3_2
 	default y
 
 config X86_INTEL_USERCOPY
 	bool
-	depends on MPENTIUM4 || MPENTIUMIII || MPENTIUMII || M586MMX || X86_GENERIC || MK8 || MK7
+	depends on !CPU_386 && !CPU_486 && !CPU_586 && !CPU_586TSC && !CPU_686 && !CPU_K6 && !X86_ELAN && !CPU_CRUSOE && !CPU_WINCHIP && !CPU_CYRIXIII && !CPU_VIAC3_2
 	default y
 
 config X86_USE_PPRO_CHECKSUM
 	bool
-	depends on MWINCHIP3D || MWINCHIP2 || MWINCHIPC6 || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMIII || MPENTIUMII || M686 || MK8 || MVIAC3_2
+	depends on !CPU_386 && !CPU_486 && !CPU_586 && !CPU_586TSC && !CPU_586MMX && !X86_ELAN && !CPU_CRUSOE
 	default y
 
 config X86_USE_3DNOW
 	bool
-	depends on MCYRIXIII || MK7
+	depends on !CPU_386 && !CPU_486 && !CPU_586 && !CPU_586TSC && !CPU_586MMX && !CPU_686 && !CPU_PENTIUMII && !CPU_PENTIUMIII && !CPU_PENTIUM4 && !CPU_K6 && !CPU_K8 && !X86_ELAN && !CPU_CRUSOE && !CPU_WINCHIP && !CPU_VIAC3_2
 	default y
 
 config X86_OOSTORE
 	bool
-	depends on MWINCHIP3D || MWINCHIP2 || MWINCHIPC6
+	depends on CPU_ONLY_WINCHIP
 	default y
 
 config X86_4G
@@ -565,7 +528,7 @@
 
 config X86_TSC
 	bool
-	depends on (MWINCHIP3D || MWINCHIP2 || MCRUSOE || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || MK8 || MVIAC3_2) && !X86_NUMAQ
+	depends on !X86_NUMAQ && !CPU_386 && !CPU_486 && !CPU_586 && !X86_ELAN && !CPU_WINCHIPC6
 	default y
 
 config X86_MCE
arch/i386/Makefile renamed from arch/i386/Makefile.old +79 -19

107 lines not on this page · raw message

include/asm-i386/processor.h renamed from include/asm-i386/processor.h.old +2 -2
@@ -544,7 +544,7 @@
 #define K7_NOP7        ".byte 0x8D,0x04,0x05,0,0,0,0\n"
 #define K7_NOP8        K7_NOP7 ASM_NOP1
 
-#ifdef CONFIG_MK8
+#ifdef CONFIG_CPU_ONLY_K8
 #define ASM_NOP1 K8_NOP1
 #define ASM_NOP2 K8_NOP2
 #define ASM_NOP3 K8_NOP3
@@ -553,7 +553,7 @@
 #define ASM_NOP6 K8_NOP6
 #define ASM_NOP7 K8_NOP7
 #define ASM_NOP8 K8_NOP8
-#elif defined(CONFIG_MK7)
+#elif defined(CONFIG_CPU_ONLY_K7)
 #define ASM_NOP1 K7_NOP1
 #define ASM_NOP2 K7_NOP2
 #define ASM_NOP3 K7_NOP3
drivers/serial/8250.h renamed from drivers/serial/8250.h.old +1 -1
@@ -44,7 +44,7 @@
 
 #undef SERIAL_DEBUG_PCI
 
-#if defined(__i386__) && (defined(CONFIG_M386) || defined(CONFIG_M486))
+#if defined(__i386__) && (defined(CONFIG_CPU_386) || defined(CONFIG_CPU_486))
 #define SERIAL_INLINE
 #endif
   
arch/i386/boot/setup.S renamed from arch/i386/boot/setup.S.old +1 -1
@@ -744,7 +744,7 @@
 # AMD Elan bug fix by Robert Schwebel.
 #
 
-#if defined(CONFIG_MELAN)
+#if defined(CONFIG_X86_ELAN)
 	movb $0x02, %al			# alternate A20 gate
 	outb %al, $0x92			# this works on SC410/SC520
 a20_elan_wait:
include/asm-i386/timex.h renamed from include/asm-i386/timex.h.old +1 -1
@@ -12,7 +12,7 @@
 #ifdef CONFIG_X86_PC9800
    extern int CLOCK_TICK_RATE;
 #else
-#ifdef CONFIG_MELAN
+#ifdef CONFIG_X86_ELAN
 #  define CLOCK_TICK_RATE 1189200 /* AMD Elan has different frequency! */
 #else
 #  define CLOCK_TICK_RATE 1193182 /* Underlying HZ */
#1 lore raw

On Sun, 2003-09-07 13:28:13 +0200, Adrian Bunk <[email protected]> wrote in message <[email protected]>:

Quoted 3 lines

There are two different needs:
1. the installation kernel of a distribution should support all CPUs this distribution supports (perhaps starting with the 386)

So far, no major distribution does support an i386. Basically, this has leaked in by some broken patch to libstdc++ which was not observed for a long time. To support i386, an additional emulator for additional i486 needs to be compiled-in, too. I had a short try to port Debian's patch into 2.6.x, but it oopsed :-> If I get some time, I'll finish that. Before we have thie i486-emu-for-i386 in, i386 support in the kernel doesn't make *any* sense on it's own...

Quoted 8 lines

Changes:
- changed the i386 CPU selection from a choice to single options for every cpu
- renamed the M* variables to CPU_*, this is needed to ask the users upgrading from older kernels instead of silently changing the semantics
- AMD Elan is a different subarch, you can't configure a kernel that runs on both the AMD Elan and other i386 CPUs

Oh well, the Elan is a beasty thing:) However, I like your overall approach, though.

MfG, JBG

Signature · 4 lines
   Jan-Benedict Glaw       [email protected]    . +49-172-7608481
   "Eine Freie Meinung in  einem Freien Kopf    | Gegen Zensur | Gegen Krieg
    fuer einen Freien Staat voll Freier Bürger" | im Internet! |   im Irak!
      ret = do_actions((curr | FREE_SPEECH) & ~(IRAQ_WAR_2 | DRM | TCPA));
#2 lore raw
Quoted 6 lines · Jan-Benedict Glaw

On Sun, 2003-09-07 13:28:13 +0200, Adrian Bunk <[email protected]> wrote in message <[email protected]>:

Quoted 3 lines

There are two different needs:
1. the installation kernel of a distribution should support all CPUs this distribution supports (perhaps starting with the 386)

Quoted 8 lines

So far, no major distribution does support an i386. Basically, this has leaked in by some broken patch to libstdc++ which was not observed for a long time. To support i386, an additional emulator for additional i486 needs to be compiled-in, too. I had a short try to port Debian's patch into 2.6.x, but it oopsed :-> If I get some time, I'll finish that. Before we have thie i486-emu-for-i386 in, i386 support in the kernel doesn't make *any* sense on it's own...
...

This is not related to the issues my patch addresses.

If you want to read my mail with a s/386/486/g and the contents should still be valid.

Quoted 1 line

MfG, JBG

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
#3 lore raw

On Sun, 2003-09-07 15:17:32 +0200, Adrian Bunk <[email protected]> wrote in message <[email protected]>:

Quoted 16 lines · Jan-Benedict Glaw
Quoted 6 lines

On Sun, 2003-09-07 13:28:13 +0200, Adrian Bunk <[email protected]> wrote in message <[email protected]>:

Quoted 3 lines

There are two different needs:
1. the installation kernel of a distribution should support all CPUs this distribution supports (perhaps starting with the 386)

Quoted 8 lines

So far, no major distribution does support an i386. Basically, this has leaked in by some broken patch to libstdc++ which was not observed for a long time. To support i386, an additional emulator for additional i486 needs to be compiled-in, too. I had a short try to port Debian's patch into 2.6.x, but it oopsed :-> If I get some time, I'll finish that. Before we have thie i486-emu-for-i386 in, i386 support in the kernel doesn't make *any* sense on it's own...
...

Quoted 1 line

This is not related to the issues my patch addresses.

This is why I wrote that I basically like the overall concept of your patch.

MfG, JBG

Signature · 4 lines
   Jan-Benedict Glaw       [email protected]    . +49-172-7608481
   "Eine Freie Meinung in  einem Freien Kopf    | Gegen Zensur | Gegen Krieg
    fuer einen Freien Staat voll Freier Bürger" | im Internet! |   im Irak!
      ret = do_actions((curr | FREE_SPEECH) & ~(IRAQ_WAR_2 | DRM | TCPA));
#4 lore raw
In reply to Adrian Bunk

On Sun, Sep 07, 2003 at 01:28:13PM +0200, Adrian Bunk wrote:
Could you change this:

arch/i386/Makefile line 112

Quoted 7 lines
arch/i386/Makefile renamed from arch/i386/Makefile.old +5 -1
+ifdef CONFIG_CPU_386
+  CFLAGS_CPU	:= -march=i386
+endif
+
 
-CFLAGS += $(cflags-y)
+CFLAGS += $(CFLAGS_CPU)

to:
cpuflags-$(CONFIG_CPU_386) := -march=i386
CFLAGS += $(cflags-y) $(cpuflags-y)

I kept cflags-y, but you may have totally eliminated that?

Sam

#5 lore raw
Quoted 7 lines · Sam Ravnborg

On Sun, Sep 07, 2003 at 01:28:13PM +0200, Adrian Bunk wrote:
Could you change this:

Quoted 5 lines
arch/i386/Makefile renamed from arch/i386/Makefile.old +4 -0
+ifdef CONFIG_CPU_386
+  CFLAGS_CPU	:= -march=i386
+endif
+
Quoted 6 lines

arch/i386/Makefile line 112

Quoted 2 lines
arch/i386/Makefile renamed from arch/i386/Makefile.old +1 -1
-CFLAGS += $(cflags-y)
+CFLAGS += $(CFLAGS_CPU)

to:
cpuflags-$(CONFIG_CPU_386) := -march=i386
CFLAGS += $(cflags-y) $(cpuflags-y)

If I understand you correctly this doesn't change the functionality, it's a s/CFLAGS_CPU/cpuflags-y/g ?

Quoted 1 line

I kept cflags-y, but you may have totally eliminated that?

AFAIK the cflags-y did what your proposed cpuflags-y does.

Quoted 1 line

Sam

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
#6 lore raw
In reply to Adrian Bunk
Quoted 1 line · Adrian Bunk

The patch below tries to implement a better i386 CPU selection.

Did you look at how rmk does CPU selection in the ARM tree? He has developed a very sophisticated scheme as there are lots of completely different cpu implementations, using a few cores. It might be an idea to make the schemes more uniform than they are now.

Quoted 3 lines

There are two different needs:
1. the installation kernel of a distribution should support all CPUs this distribution supports (perhaps starting with the 386)

Ack.

Quoted 2 lines

2. a sysadmin might e.g. want a kernel that support both a Pentium-III and a Pentium 4, but doesn't need to support a 386

Ack.

3. Embedded forlks might want to make a kernel which has support for exactly the used processor and nothing more.

Quoted 1 line

Changes:

[...]

Quoted 2 lines

- AMD Elan is a different subarch, you can't configure a kernel that runs on both the AMD Elan and other i386 CPUs

Ack. Same with for example Geode. And the subarchs might have different implementations, like Elan SC400, Elan SC410, Elan SC520.

Quoted 2 lines

- @Robert:
there were no Elan CFLAGS in arch/i386/Makefile???

That seems to have evolved since I last touched the Elan stuff. The Elans are more or less 486 cores with some edges, so adding -march=i486 should be ok.

Quoted 1 line

- which CPUs exactly need X86_ALIGNMENT_16?

I've just copied that from 486.

Quoted 2 lines

A 2.6.0-test4-mm5 kernel with this patch applied compiled and bootet on my PC.

I could do some tests on an Elan board, but not earlier than end of next week as I'm out of office for some days...

Robert

Signature · 5 lines
 Dipl.-Ing. Robert Schwebel | http://www.pengutronix.de
 Pengutronix - Linux Solutions for Science and Industry
   Handelsregister:  Amtsgericht Hildesheim, HRA 2686
     Hornemannstraße 12,  31137 Hildesheim, Germany
    Phone: +49-5121-28619-0 |  Fax: +49-5121-28619-4
#7 lore raw
Quoted 7 lines · Robert Schwebel
Quoted 1 line · Adrian Bunk

The patch below tries to implement a better i386 CPU selection.

Did you look at how rmk does CPU selection in the ARM tree? He has developed a very sophisticated scheme as there are lots of completely different cpu implementations, using a few cores. It might be an idea to make the schemes more uniform than they are now.

I didn't look at the ARM Makefile. Thanks for the note, I'll have a look at it before I'll do the revision of this patch.

Quoted 7 lines

...

Quoted 1 line

Changes:

[...]

Quoted 2 lines

- AMD Elan is a different subarch, you can't configure a kernel that runs on both the AMD Elan and other i386 CPUs

Ack. Same with for example Geode. And the subarchs might have different

It seems the Geode support isn't fully merged in 2.6?

Quoted 1 line

implementations, like Elan SC400, Elan SC410, Elan SC520.

It should be no problem to add a "Processor support" menu for the Elan that allows you to specify which Elan CPUs you plan to support.

Quoted 7 lines
Quoted 2 lines

- @Robert:
there were no Elan CFLAGS in arch/i386/Makefile???

That seems to have evolved since I last touched the Elan stuff. The Elans are more or less 486 cores with some edges, so adding -march=i486 should be ok.
...

Thanks, I'll do this.

Quoted 1 line

Robert

Thanks for your comments
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
#8 lore raw
Quoted 2 lines · Adrian Bunk

I didn't look at the ARM Makefile. Thanks for the note, I'll have a look at it before I'll do the revision of this patch.

You should definitely discuss this with rmk. How do the PPC folks handle CPU selection?

Quoted 3 lines
Quoted 1 line

Ack. Same with for example Geode. And the subarchs might have different

It seems the Geode support isn't fully merged in 2.6?

That's also my impression, although I didn't have much time to look at the state. As far as I remember Christer Weinigel has recently done some work in this direction.

Quoted 2 lines

It should be no problem to add a "Processor support" menu for the Elan that allows you to specify which Elan CPUs you plan to support.

Great.

Robert

Signature · 5 lines
 Dipl.-Ing. Robert Schwebel | http://www.pengutronix.de
 Pengutronix - Linux Solutions for Science and Industry
   Handelsregister:  Amtsgericht Hildesheim, HRA 2686
     Hornemannstraße 12,  31137 Hildesheim, Germany
    Phone: +49-5121-28619-0 |  Fax: +49-5121-28619-4
#9 lore raw
Quoted 6 lines · Robert Schwebel
Quoted 2 lines · Adrian Bunk

I didn't look at the ARM Makefile. Thanks for the note, I'll have a look at it before I'll do the revision of this patch.

You should definitely discuss this with rmk. How do the PPC folks handle CPU selection?

We don't allow for one kernel to work on something outside of a 'family', nor do we (aside from MULTIPLATFORM) allow a kernel to work on

Quoted 1 line

1 board type (maybe we'll fix that in 2.7). You can pick 8xx

(MPC8xx line), 8260 (MPC826x/MPC827x, and should be fixed up to into classic), 6xx/7xx/74xx (aka 'classic' PPC, 40x and 44x.

Signature · 2 lines
Tom Rini
http://gate.crashing.org/~trini/
#10 lore raw
In reply to Adrian Bunk
Quoted 3 lines · Adrian Bunk
Quoted 1 line

Ack. Same with for example Geode. And the subarchs might have different

It seems the Geode support isn't fully merged in 2.6?

Geode is just another PC, well at least in software. In hardware its rather different and uses a lot of clever magic.

#11 lore raw
Quoted 2 lines · Alan Cox

Geode is just another PC, well at least in software. In hardware its rather different and uses a lot of clever magic.

It seems to be similar to the Elan: the core is "just another PC", but in several places you need to know that you have a Geode so that you can provide the right tweaks and fixes.

Robert

Signature · 5 lines
 Dipl.-Ing. Robert Schwebel | http://www.pengutronix.de
 Pengutronix - Linux Solutions for Science and Industry
   Handelsregister:  Amtsgericht Hildesheim, HRA 2686
     Hornemannstraße 12,  31137 Hildesheim, Germany
    Phone: +49-5121-28619-0 |  Fax: +49-5121-28619-4
#12 lore raw
Quoted 3 lines · Robert Schwebel

It seems to be similar to the Elan: the core is "just another PC", but in several places you need to know that you have a Geode so that you can provide the right tweaks and fixes.

ELAN is "like a PC", Geode is a PC, to software. You can run a generic 386/486/586/586+MMX kernel on a Geode CPU. The Geode support just picks the right compile options and our setup code turns on some handy CPU features we can use

#13 lore raw
Quoted 4 lines · Alan Cox

ELAN is "like a PC", Geode is a PC, to software. You can run a generic 386/486/586/586+MMX kernel on a Geode CPU. The Geode support just picks the right compile options and our setup code turns on some handy CPU features we can use

Hmm, I'm not so sure. I've not much experience with Geode yet, but from my first RTAI tests it surely has several problems which might require an #ifdef CONFIG_MGEODE or something similar. As long as this is possible everything's ok with me ;)

Robert

Signature · 5 lines
 Dipl.-Ing. Robert Schwebel | http://www.pengutronix.de
 Pengutronix - Linux Solutions for Science and Industry
   Handelsregister:  Amtsgericht Hildesheim, HRA 2686
     Hornemannstraße 12,  31137 Hildesheim, Germany
    Phone: +49-5121-28619-0 |  Fax: +49-5121-28619-4
#14 lore raw
Quoted 3 lines · Robert Schwebel

my first RTAI tests it surely has several problems which might require an #ifdef CONFIG_MGEODE or something similar. As long as this is possible everything's ok with me ;)

Lots of the geode hardware is emulated by SMM code, it makes hard real time on the Geode an 'interesting' world and does limit the latency you can achieve. Its actually a lot better than say the Dell BIOS battery SMM seems to be but its not insubstantial at times.

rdtsc before and after an inb/outb is most fascinating 8)

#15 lore raw
In reply to Robert Schwebel
Quoted 3 lines · Robert Schwebel

my first RTAI tests it surely has several problems which might require an #ifdef CONFIG_MGEODE or something similar. As long as this is possible everything's ok with me ;)

Lots of the geode hardware is emulated by SMM code, it makes hard real time on the Geode an 'interesting' world and does limit the latency you can achieve. Its actually a lot better than say the Dell BIOS battery SMM seems to be but its not insubstantial at times.

rdtsc before and after an inb/outb is most fascinating 8)

#16 lore raw
In reply to Adrian Bunk

This would be a good point to fix the winchip compile options properly in 2.6 while you are at it. You should select -m486 (preferably -m486 and then turn off the padding options)

#17 lore raw
Quoted 3 lines · Alan Cox

This would be a good point to fix the winchip compile options properly in 2.6 while you are at it. You should select -m486 (preferably -m486 and then turn off the padding options)

You are talking about the default for gcc versions that don't support -march=winchip{2,-c6} ?

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
#18 lore raw
In reply to Adrian Bunk

In message <[email protected]> you write:

Quoted 3 lines

- @Rusty:
what's your opinion on making MODULE_PROC_FAMILY in include/asm-i386/module.h some kind of bitmask?

The current one is readable, which is good, and Linus asked for it, which makes it kinda moot. And really, if you compile a module with M686 and insert it in a kernel with M586, *WHATEVER* scheme you we use for CPU seleciton, I want the poor user to have to use "modprobe -f".

Hope that clarifies,
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

#19 lore raw
Quoted 9 lines · Rusty Russell

In message <[email protected]> you write:

Quoted 3 lines

- @Rusty:
what's your opinion on making MODULE_PROC_FAMILY in include/asm-i386/module.h some kind of bitmask?

The current one is readable, which is good, and Linus asked for it, which makes it kinda moot. And really, if you compile a module with M686 and insert it in a kernel with M586, *WHATEVER* scheme you we use for CPU seleciton, I want the poor user to have to use "modprobe -f".

I agree, my thoughts go in the direction

bit 0 CPU_386
bit 1 CPU_486
bit 2 CPU_586
...

And you should need a "modprobe -f" if the bitmask in the module differs from the bitmask in the kernel.

Quoted 2 lines

Hope that clarifies,
Rusty.

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
#20 lore raw

In message <[email protected]> you write:

Quoted 11 lines · Rusty Russell
Quoted 9 lines

In message <[email protected]> you write:

Quoted 3 lines

- @Rusty:
what's your opinion on making MODULE_PROC_FAMILY in include/asm-i386/module.h some kind of bitmask?

The current one is readable, which is good, and Linus asked for it, which makes it kinda moot. And really, if you compile a module with M686 and insert it in a kernel with M586, *WHATEVER* scheme you we use for CPU seleciton, I want the poor user to have to use "modprobe -f".

Quoted 5 lines

I agree, my thoughts go in the direction

bit 0 CPU_386
bit 1 CPU_486
bit 2 CPU_586

We had a bitmask, which Linus said to replace with a string. We have 21 architectures, and a string works well in practice. We could have a bitmask *and* a string, but why the complexity?

Quoted 2 lines

And you should need a "modprobe -f" if the bitmask in the module differs from the bitmask in the kernel.

All modprobe -f knows is that it should remove/rename various sections from the elf object before handing it to the kernel. The checking is done in the kernel, as it should be (so we could change this whenever we want, for example).

Hope that clarifies,
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

#21 lore raw
Quoted 14 lines · Rusty Russell

In message <[email protected]> you write:

Quoted 13 lines · Rusty Russell
Quoted 9 lines

In message <[email protected]> you write:

Quoted 3 lines

- @Rusty:
what's your opinion on making MODULE_PROC_FAMILY in include/asm-i386/module.h some kind of bitmask?

The current one is readable, which is good, and Linus asked for it, which makes it kinda moot. And really, if you compile a module with M686 and insert it in a kernel with M586, *WHATEVER* scheme you we use for CPU seleciton, I want the poor user to have to use "modprobe -f".

I agree, my thoughts go in the direction

Quoted 8 lines
Quoted 3 lines

bit 0 CPU_386
bit 1 CPU_486
bit 2 CPU_586

We had a bitmask, which Linus said to replace with a string. We have 21 architectures, and a string works well in practice. We could have a bitmask *and* a string, but why the complexity?
...

My intention is that the user (= person compiling the kernel) selects all CPUs he wants to support and to move the answer to questions like "Which CPU type should I choose to support both an AMD Athlon and a Pentium 4?" into the Kconfig/Makefile where it's automatically selected.

Quoted 2 lines

Hope that clarifies,
Rusty.

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed