summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2021-11-24 08:41:13 -0700
committerJens Axboe <axboe@kernel.dk>2022-03-27 15:20:13 -0600
commita2c35cfa21d60051881820fbcf4f5c9089eefe48 (patch)
tree7c4af1c7736596f91f7ec353ea869405c1cc8cf6
parentab3d4371227a34a5561e4d594a17baaad03bf1b7 (diff)
x86: add modern Intel and AMD CPUsperf-wip
Add options for both CPUs and have -march set correctly for them, and enable -O3 for x86_64 in general. Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--arch/x86/Kconfig.cpu41
-rw-r--r--arch/x86/Makefile4
-rw-r--r--init/Kconfig2
3 files changed, 41 insertions, 6 deletions
diff --git a/arch/x86/Kconfig.cpu b/arch/x86/Kconfig.cpu
index 542377cd419d..82206acbdadd 100644
--- a/arch/x86/Kconfig.cpu
+++ b/arch/x86/Kconfig.cpu
@@ -1,5 +1,8 @@
# SPDX-License-Identifier: GPL-2.0
# Put here option for CPU selection and depending optimization
+config CPU_DEFAULTS
+ bool
+
choice
prompt "Processor family"
default M686 if X86_32
@@ -294,6 +297,34 @@ config GENERIC_CPU
Generic x86-64 CPU.
Run equally well on all x86-64 CPUs.
+config AMD_RYZEN2
+ bool "AMD Ryzen zen2"
+ depends on X86_64
+ select CPU_DEFAULTS
+ help
+ For Ryzen zen2 / threadripper
+
+config AMD_RYZEN3
+ bool "AMD Ryzen zen3"
+ depends on X86_64
+ select CPU_DEFAULTS
+ help
+ For Ryzen zen3
+
+config TIGERLAKE
+ bool "Intel Tigerlake"
+ depends on X86_64
+ select CPU_DEFAULTS
+ help
+ For Intel Tigerlake, 11th gen Core-i9
+
+config ALDERLAKE
+ bool "Intel Alderlake"
+ depends on X86_64
+ select CPU_DEFAULTS
+ help
+ For Intel Alderlake, 12th gen Core-i9
+
endchoice
config X86_GENERIC
@@ -318,7 +349,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 || X86_GENERIC || GENERIC_CPU || CPU_DEFAULTS
default "4" if MELAN || M486SX || M486 || MGEODEGX1
default "5" if MWINCHIP3D || MWINCHIPC6 || MCRUSOE || MEFFICEON || MCYRIXIII || MK6 || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || M586 || MVIAC3_2 || MGEODE_LX
@@ -336,11 +367,11 @@ config X86_ALIGNMENT_16
config X86_INTEL_USERCOPY
def_bool y
- depends on MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M586MMX || X86_GENERIC || MK8 || MK7 || MEFFICEON || MCORE2
+ depends on MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M586MMX || X86_GENERIC || MK8 || MK7 || MEFFICEON || MCORE2 || CPU_DEFAULTS
config X86_USE_PPRO_CHECKSUM
def_bool y
- depends on MWINCHIP3D || MWINCHIPC6 || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MK8 || MVIAC3_2 || MVIAC7 || MEFFICEON || MGEODE_LX || MCORE2 || MATOM
+ depends on MWINCHIP3D || MWINCHIPC6 || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MK8 || MVIAC3_2 || MVIAC7 || MEFFICEON || MGEODE_LX || MCORE2 || MATOM || CPU_DEFAULTS
#
# P6_NOPs are a relatively minor optimization that require a family >=
@@ -360,11 +391,11 @@ config X86_P6_NOP
config X86_TSC
def_bool y
- depends on (MWINCHIP3D || MCRUSOE || MEFFICEON || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || MK8 || MVIAC3_2 || MVIAC7 || MGEODEGX1 || MGEODE_LX || MCORE2 || MATOM) || X86_64
+ depends on (MWINCHIP3D || MCRUSOE || MEFFICEON || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || MK8 || MVIAC3_2 || MVIAC7 || MGEODEGX1 || MGEODE_LX || MCORE2 || MATOM) || X86_64 || CPU_DEFAULTS
config X86_CMPXCHG64
def_bool y
- depends on X86_PAE || X86_64 || MCORE2 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || M586TSC || M586MMX || MATOM || MGEODE_LX || MGEODEGX1 || MK6 || MK7 || MK8
+ depends on X86_PAE || X86_64 || MCORE2 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || M586TSC || M586MMX || MATOM || MGEODE_LX || MGEODEGX1 || MK6 || MK7 || MK8 || CPU_DEFAULTS
# this should be set for all -march=.. options where the compiler
# generates cmov.
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 63d50f65b828..63ea49df6c2b 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -146,6 +146,10 @@ else
cflags-$(CONFIG_MCORE2) += -march=core2
cflags-$(CONFIG_MATOM) += -march=atom
cflags-$(CONFIG_GENERIC_CPU) += -mtune=generic
+ cflags-$(CONFIG_AMD_RYZEN2) += -march=znver2
+ cflags-$(CONFIG_AMD_RYZEN3) += -march=znver3
+ cflags-$(CONFIG_TIGERLAKE) += -march=tigerlake
+ cflags-$(CONFIG_ALDERLAKE) += -march=alderlake
KBUILD_CFLAGS += $(cflags-y)
KBUILD_CFLAGS += -mno-red-zone
diff --git a/init/Kconfig b/init/Kconfig
index 97463a33baa7..91e00178ebef 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -1374,7 +1374,7 @@ config CC_OPTIMIZE_FOR_PERFORMANCE
config CC_OPTIMIZE_FOR_PERFORMANCE_O3
bool "Optimize more for performance (-O3)"
- depends on ARC
+ depends on ARC || X86_64
help
Choosing this option will pass "-O3" to your compiler to optimize
the kernel yet more for performance.