* Patch to enable K6-2 and K6-3 processor optimizations
@ 2002-08-09 8:52 David Bronaugh
0 siblings, 0 replies; 5+ messages in thread
From: David Bronaugh @ 2002-08-09 8:52 UTC (permalink / raw)
To: linux-kernel
Hi,
Well, I said I was new to this; forgot to include the patch, and what kernel version it was against.
It's against 2.4.19, but doesn't really change much, so should apply to most kernel revisions.
Patch follows:
diff -Naur -X dontdiff linux/arch/i386/Makefile linux-2.4/arch/i386/Makefile
--- linux/arch/i386/Makefile 2001-04-12 12:20:31.000000000 -0700
+++ linux-2.4/arch/i386/Makefile 2002-08-09 01:16:40.000000000 -0700
@@ -62,6 +62,16 @@
CFLAGS += $(shell if $(CC) -march=k6 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=k6"; else echo "-march=i586"; fi)
endif
+ifdef CONFIG_MK6_2
+CFLAGS += $(shell if $(CC) -march=k6-2 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=k6-2"; else if $(CC) -march=k6 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=k6"; else echo "-march=i586"; fi; fi)
+endif
+
+ifdef CONFIG_MK6_3
+CFLAGS += $(shell if $(CC) -march=k6-3 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=k6-3"; else if $(CC) -march=k6 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=k6"; else echo "-march=i586"; fi; fi)
+endif
+
+
+
ifdef CONFIG_MK7
CFLAGS += $(shell if $(CC) -march=athlon -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=athlon"; else echo "-march=i686 -malign-functions=4"; fi)
endif
diff -Naur -X dontdiff linux/arch/i386/config.in linux-2.4/arch/i386/config.in
--- linux/arch/i386/config.in 2002-08-09 01:21:03.000000000 -0700
+++ linux-2.4/arch/i386/config.in 2002-08-09 01:11:39.000000000 -0700
@@ -35,7 +35,9 @@
Pentium-Pro/Celeron/Pentium-II CONFIG_M686 \
Pentium-III/Celeron(Coppermine) CONFIG_MPENTIUMIII \
Pentium-4 CONFIG_MPENTIUM4 \
- K6/K6-II/K6-III CONFIG_MK6 \
+ K6 CONFIG_MK6 \
+ K6-II CONFIG_MK6_2 \
+ K6-III CONFIG_MK6_3 \
Athlon/Duron/K7 CONFIG_MK7 \
Elan CONFIG_MELAN \
Crusoe CONFIG_MCRUSOE \
@@ -119,6 +121,20 @@
define_bool CONFIG_X86_TSC y
define_bool CONFIG_X86_USE_PPRO_CHECKSUM y
fi
+# Since I don't know whether CONFIG_X86_USE_3DNOW means 3dnowext or not, I'm playing it safe
+if [ "$CONFIG_MK6_2" = "y" ]; then
+ define_int CONFIG_X86_L1_CACHE_SHIFT 5
+ define_bool CONFIG_X86_ALIGNMENT_16 y
+ define_bool CONFIG_X86_TSC y
+ define_bool CONFIG_X86_USE_PPRO_CHECKSUM y
+fi
+if [ "$CONFIG_MK6_3" = "y" ]; then
+ define_int CONFIG_X86_L1_CACHE_SHIFT 5
+ define_bool CONFIG_X86_ALIGNMENT_16 y
+ define_bool CONFIG_X86_TSC y
+ define_bool CONFIG_X86_USE_PPRO_CHECKSUM y
+ define_bool CONFIG_X86_USE_3DNOW y
+fi
if [ "$CONFIG_MK7" = "y" ]; then
define_int CONFIG_X86_L1_CACHE_SHIFT 6
define_bool CONFIG_X86_TSC y
^ permalink raw reply [flat|nested] 5+ messages in thread* Patch to enable K6-2 and K6-3 processor optimizations
@ 2002-08-09 8:48 David Bronaugh
2002-08-09 10:31 ` Alan Cox
2002-08-09 16:45 ` Josh McKinney
0 siblings, 2 replies; 5+ messages in thread
From: David Bronaugh @ 2002-08-09 8:48 UTC (permalink / raw)
To: linux-kernel
Hi,
This is my first kernel patch, so please go easy on me :)
What it does is conditionally enable -march=k6-2 and -march=k6-3, and provide options for each in the Processor Type and Features menu.
This is conditional on the compiler supporting it; as of this writing only GCC 3.1 does. I compiled this kernel successfully with this patch on my K6-III and am presently running this kernel.
It also enables 3DNow in the case of the K6-III; I wasn't sure if 3DNow might imply the extended Athlon 3DNow instructions, so I only enabled it for the K6-III, which I know supports it.
Anyhow, that's all.
David Bronaugh
ps: This is pretty trivial to apply for other CPUs too; as I understand it several different CPU types gained their own architecture strings with GCC 3.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Patch to enable K6-2 and K6-3 processor optimizations
2002-08-09 8:48 David Bronaugh
@ 2002-08-09 10:31 ` Alan Cox
2002-08-09 17:28 ` David Bronaugh
2002-08-09 16:45 ` Josh McKinney
1 sibling, 1 reply; 5+ messages in thread
From: Alan Cox @ 2002-08-09 10:31 UTC (permalink / raw)
To: David Bronaugh; +Cc: linux-kernel
We can't actually use MMX/FPU instructions in the kernel in the general
case. That would require saving and restoring the user process floating
point state - which is extremely expensive
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Patch to enable K6-2 and K6-3 processor optimizations
2002-08-09 10:31 ` Alan Cox
@ 2002-08-09 17:28 ` David Bronaugh
0 siblings, 0 replies; 5+ messages in thread
From: David Bronaugh @ 2002-08-09 17:28 UTC (permalink / raw)
To: Alan Cox; +Cc: linux-kernel
On 09 Aug 2002 11:31:19 +0100
Alan Cox <alan@lxorguk.ukuu.org.uk> wrote:
> We can't actually use MMX/FPU instructions in the kernel in the general
> case. That would require saving and restoring the user process floating
> point state - which is extremely expensive
Yes, but that's not all that was implemented here.
>From the GCC 3.1 changelog:
# Prefetch support has been added to the Pentium III, Pentium 4, K6-2, K6-3, and Athlon series.
That's (as I understand it) independent from the floating point instructions.
Also, as a general point (IMO), targeting as specifically as possible (ie, K6-2 or K6-III rather than just K6) will most probably produce the best code for the processor. This also allows for later generations of compilers to make other optimizations and the kernel to take advantage of them.
David Bronaugh
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Patch to enable K6-2 and K6-3 processor optimizations
2002-08-09 8:48 David Bronaugh
2002-08-09 10:31 ` Alan Cox
@ 2002-08-09 16:45 ` Josh McKinney
1 sibling, 0 replies; 5+ messages in thread
From: Josh McKinney @ 2002-08-09 16:45 UTC (permalink / raw)
To: linux-kernel
On approximately Fri, Aug 09, 2002 at 01:48:40AM -0700, David Bronaugh wrote:
> Hi,
>
> This is my first kernel patch, so please go easy on me :)
>
> What it does is conditionally enable -march=k6-2 and -march=k6-3, and provide options for each in the Processor Type and Features menu.
>
Alan and/or Luca Barbiera,
Could we get this stuff into 2.4-ac at least? Luca, if you could backport your 2.5 patch that
would be great. I have attempted to but there is just to many things changed between 2.4 and
2.5 for me to feel comfortable with.
Thanks,
Josh McKinney
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2002-08-09 17:25 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-08-09 8:52 Patch to enable K6-2 and K6-3 processor optimizations David Bronaugh
-- strict thread matches above, loose matches on Subject: below --
2002-08-09 8:48 David Bronaugh
2002-08-09 10:31 ` Alan Cox
2002-08-09 17:28 ` David Bronaugh
2002-08-09 16:45 ` Josh McKinney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox