[PATCH 1/1] x86_64: add config options to optimize for newer AMDprocessors

From: Austin S Hemmelgarn
Date: Sun Sep 29 2013 - 13:54:08 EST


From: Austin S. Hemmelgarn <ahferroin7@xxxxxxxxx>

This patch adds Kconfig options to allow optimization for AMD family
10h, AMD Bulldozer, and AMD Piledriver derived CPU's in version
3.12-rc2. These provide noticeable improvements over the K8 config
option, and allow the kernel to take full advantage of AMD specific
instruction set extensions, such as ABM, LZCNT, and POPCNT.

Signed-Off-By: Austin S. Hemmelgarn <ahferroin7@xxxxxxxxx>
---
diff -uprN linux/arch/x86/Kconfig.cpu linux-new/arch/x86/Kconfig.cpu
--- linux/arch/x86/Kconfig.cpu 2013-09-23 18:41:09.000000000 -0400
+++ linux-new/arch/x86/Kconfig.cpu 2013-09-28 21:31:35.782173832 -0400
@@ -155,9 +155,9 @@ config MK7
flags to GCC.

config MK8
- bool "Opteron/Athlon64/Hammer/K8"
+ bool "Old Opteron/Athlon64/Hammer/K8"
---help---
- Select this for an AMD Opteron or Athlon64 Hammer-family processor.
+ Select this for an AMD old 64-bit Opteron or Athlon64 Hammer-family processor.
Enables use of some extended instructions, and passes appropriate
optimization flags to GCC.

@@ -269,6 +269,57 @@ config MATOM
accordingly optimized code. Use a recent GCC with specific Atom
support in order to fully benefit from selecting this option.

+config MAMDFAM10
+ bool "AMD Family 10h (Athlon II, Phenom II, and Opteron)"
+ depends on X86_64
+ ---help---
+
+ Select this for AMD Family 10h processors.
+ This includes Athlon II, Phenom II, early third-generation
+ Opterons, and a number of other Socket AM2, AM2+, AM3, and
+ Socket F processors. CPU's in this series show cpu family
+ 16 in /proc/cpuinfo. Note that a kernel compiled with this
+ option may not run correctly on non-AMD processors.
+
+config MBULLDOZER
+ bool "AMD Bulldozer (FX and Opteron)"
+ depends on X86_64
+ ---help---
+
+ Select this for AMD Buldozer microarchitecture processors.
+ This includes the following CPUs:
+ FX-41x0
+ FX-61x0
+ FX-6200
+ FX-81x0
+ Opteron 32xx
+ Opteron 42xx
+ Opteron 62xx
+
+ Note that a kernel compiled with this option may not run
+ correctly on non-Bulldozer derived processors, if it runs at all.
+
+config MPILEDRIVER
+ bool "AMD Piledriver (FX, APU, and Opteron)"
+ depends on X86_64
+ ---help---
+
+ Select this for AMD Piledriver microarchitecture processors.
+ This includes the Following CPUs:
+ 'Trinity' APUs
+ 'Richland' APUs
+ FX-43xx
+ FX-63xx
+ FX-83xx
+ FX-9370
+ FX-9590
+ Opteron 33xx
+ Opteron 43xx
+ Opteron 63xx
+
+ Note that a kernel compiled with this option may not run
+ correctly on non-Piledriver derived processors, if it runs at all.
+
config GENERIC_CPU
bool "Generic-x86-64"
depends on X86_64
@@ -300,7 +351,7 @@ config X86_INTERNODE_CACHE_SHIFT
config X86_L1_CACHE_SHIFT
int
default "7" if MPENTIUM4 || MPSC
- default "6" if MK7 || MK8 || MPENTIUMM || MCORE2 || MATOM || MVIAC7 || X86_GENERIC || GENERIC_CPU
+ default "6" if MK7 || MK8 || MPENTIUMM || MCORE2 || MATOM || MVIAC7 || MAMDFAM10 || MBULLDOZER || MPILEDRIVER || X86_GENERIC || GENERIC_CPU
default "4" if MELAN || M486 || MGEODEGX1
default "5" if MWINCHIP3D || MWINCHIPC6 || MCRUSOE || MEFFICEON || MCYRIXIII || MK6 || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || M586 || MVIAC3_2 || MGEODE_LX

diff -uprN linux/arch/x86/Makefile linux-new/arch/x86/Makefile
--- linux/arch/x86/Makefile 2013-09-23 18:41:09.000000000 -0400
+++ linux-new/arch/x86/Makefile 2013-09-28 21:20:41.869697978 -0400
@@ -68,6 +68,12 @@ else
$(call cc-option,-march=core2,$(call cc-option,-mtune=generic))
cflags-$(CONFIG_MATOM) += $(call cc-option,-march=atom) \
$(call cc-option,-mtune=atom,$(call cc-option,-mtune=generic))
+ cflags-$(CONFIG_AMDFAM10) += $(call cc-option,-march=amdfam10) \
+ $(call cc-option,-mtune=amdfam10,$(call cc-option,-mtune=generic))
+ cflags-$(CONFIG_MBULLCOZER) += $(call cc-option,-march=bdver1) \
+ $(call cc-option,-mtune=bdver1,$(call cc-option,-mtune=generic))
+ cflags-$(CONFIG_MPILEDRIVER) += $(call cc-option,-march=bdver2) \
+ $(call cc-option,-mtune=bdver2,$(call cc-option,-mtune=generic))
cflags-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=generic)
KBUILD_CFLAGS += $(cflags-y)

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