All of lore.kernel.org
 help / color / mirror / Atom feed
From: Austin S Hemmelgarn <ahferroin7@gmail.com>
To: Linux-Kernel mailing list <linux-kernel@vger.kernel.org>,
	Linux Torvalds <torvalds@osdl.org>, Alan Cox <alan@redhat.com>
Subject: [PATCH 1/1] x86_64: add config options to optimize for newer AMD processors
Date: Sun, 29 Sep 2013 13:54:00 -0400	[thread overview]
Message-ID: <52486938.4090009@gmail.com> (raw)

From: Austin S. Hemmelgarn <ahferroin7@gmail.com>

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@gmail.com>
---
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)
 

             reply	other threads:[~2013-09-29 17:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-29 17:54 Austin S Hemmelgarn [this message]
2013-09-29 18:01 ` [PATCH 1/1] x86_64: add config options to optimize for newer AMD processors Borislav Petkov
2013-09-29 20:41   ` Austin S Hemmelgarn
2013-09-29 20:50     ` Borislav Petkov
2013-09-29 21:23       ` Austin S Hemmelgarn
2013-09-29 21:30         ` Borislav Petkov
2013-10-03 13:42           ` Austin S Hemmelgarn
     [not found]           ` <524D5DAC.3000004@gmail.com>
2013-10-03 16:27             ` Linus Torvalds
2013-10-03 16:57               ` Borislav Petkov
2013-10-03 18:12                 ` Austin S Hemmelgarn
2013-10-03 18:28                   ` Borislav Petkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52486938.4090009@gmail.com \
    --to=ahferroin7@gmail.com \
    --cc=alan@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.