1 |
commit: 2454e4a6ae16783c690c3ffb3ee8b688b4f8659d |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Jul 1 14:28:08 2021 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Jul 1 14:28:08 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=2454e4a6 |
7 |
|
8 |
Update CPU OPT Patch 06062021 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
5010_enable-cpu-optimizations-universal.patch | 74 +++++++++++++-------------- |
13 |
1 file changed, 36 insertions(+), 38 deletions(-) |
14 |
|
15 |
diff --git a/5010_enable-cpu-optimizations-universal.patch b/5010_enable-cpu-optimizations-universal.patch |
16 |
index 1868f23..c45d13b 100644 |
17 |
--- a/5010_enable-cpu-optimizations-universal.patch |
18 |
+++ b/5010_enable-cpu-optimizations-universal.patch |
19 |
@@ -1,23 +1,18 @@ |
20 |
-From 59db769ad69e080c512b3890e1d27d6120f4a1a4 Mon Sep 17 00:00:00 2001 |
21 |
+From 4af44fbc97bc51eb742f0d6555bde23cf580d4e3 Mon Sep 17 00:00:00 2001 |
22 |
From: graysky <graysky@×××××××××.us> |
23 |
-Date: Mon, 12 Apr 2021 07:09:27 -0400 |
24 |
+Date: Sun, 6 Jun 2021 09:41:36 -0400 |
25 |
Subject: [PATCH] more uarches for kernel 5.8+ |
26 |
MIME-Version: 1.0 |
27 |
Content-Type: text/plain; charset=UTF-8 |
28 |
Content-Transfer-Encoding: 8bit |
29 |
|
30 |
-WARNING |
31 |
-This patch works with all gcc versions 9.0+ and with kernel version 5.8+ and should |
32 |
-NOT be applied when compiling on older versions of gcc due to key name changes |
33 |
-of the march flags introduced with the version 4.9 release of gcc.[1] |
34 |
- |
35 |
FEATURES |
36 |
This patch adds additional CPU options to the Linux kernel accessible under: |
37 |
Processor type and features ---> |
38 |
Processor family ---> |
39 |
|
40 |
-With the release of gcc 11.0, several generic 64-bit levels are offered which |
41 |
-are good for supported Intel or AMD CPUs: |
42 |
+With the release of gcc 11.1 and clang 12.0, several generic 64-bit levels are |
43 |
+offered which are good for supported Intel or AMD CPUs: |
44 |
• x86-64-v2 |
45 |
• x86-64-v3 |
46 |
• x86-64-v4 |
47 |
@@ -26,7 +21,7 @@ Users of glibc 2.33 and above can see which level is supported by current |
48 |
hardware by running: |
49 |
/lib/ld-linux-x86-64.so.2 --help | grep supported |
50 |
|
51 |
-Alternatively, compare the flags from /proc/cpuinfo to this list.[2] |
52 |
+Alternatively, compare the flags from /proc/cpuinfo to this list.[1] |
53 |
|
54 |
CPU-specific microarchitectures include: |
55 |
• AMD Improved K8-family |
56 |
@@ -62,13 +57,15 @@ CPU-specific microarchitectures include: |
57 |
• Intel 12th Gen i3/i5/i7/i9-family (Alder Lake)‡ |
58 |
|
59 |
Notes: If not otherwise noted, gcc >=9.1 is required for support. |
60 |
- *Requires gcc >=10.1 †Required gcc >=10.3 ‡Required gcc >=11.0 |
61 |
+ *Requires gcc >=10.1 or clang >=10.0 |
62 |
+ †Required gcc >=10.3 or clang >=12.0 |
63 |
+ ‡Required gcc >=11.1 or clang >=12.0 |
64 |
|
65 |
It also offers to compile passing the 'native' option which, "selects the CPU |
66 |
to generate code for at compilation time by determining the processor type of |
67 |
the compiling machine. Using -march=native enables all instruction subsets |
68 |
supported by the local machine and will produce code optimized for the local |
69 |
-machine under the constraints of the selected instruction set."[3] |
70 |
+machine under the constraints of the selected instruction set."[2] |
71 |
|
72 |
Users of Intel CPUs should select the 'Intel-Native' option and users of AMD |
73 |
CPUs should select the 'AMD-Native' option. |
74 |
@@ -76,9 +73,9 @@ CPUs should select the 'AMD-Native' option. |
75 |
MINOR NOTES RELATING TO INTEL ATOM PROCESSORS |
76 |
This patch also changes -march=atom to -march=bonnell in accordance with the |
77 |
gcc v4.9 changes. Upstream is using the deprecated -match=atom flags when I |
78 |
-believe it should use the newer -march=bonnell flag for atom processors.[4] |
79 |
+believe it should use the newer -march=bonnell flag for atom processors.[3] |
80 |
|
81 |
-It is not recommended to compile on Atom-CPUs with the 'native' option.[5] The |
82 |
+It is not recommended to compile on Atom-CPUs with the 'native' option.[4] The |
83 |
recommendation is to use the 'atom' option instead. |
84 |
|
85 |
BENEFITS |
86 |
@@ -90,18 +87,19 @@ https://github.com/graysky2/kernel_gcc_patch |
87 |
|
88 |
REQUIREMENTS |
89 |
linux version >=5.8 |
90 |
-gcc version >=9.0 |
91 |
+gcc version >=9.0 or clang version >=9.0 |
92 |
|
93 |
ACKNOWLEDGMENTS |
94 |
-This patch builds on the seminal work by Jeroen.[6] |
95 |
+This patch builds on the seminal work by Jeroen.[5] |
96 |
|
97 |
REFERENCES |
98 |
-1. https://gcc.gnu.org/gcc-4.9/changes.html |
99 |
-2. https://gitlab.com/x86-psABIs/x86-64-ABI/-/commit/77566eb03bc6a326811cb7e9 |
100 |
-3. https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html#index-x86-Options |
101 |
-4. https://bugzilla.kernel.org/show_bug.cgi?id=77461 |
102 |
-5. https://github.com/graysky2/kernel_gcc_patch/issues/15 |
103 |
-6. http://www.linuxforge.net/docs/linux/linux-gcc.php |
104 |
+1. https://gitlab.com/x86-psABIs/x86-64-ABI/-/commit/77566eb03bc6a326811cb7e9 |
105 |
+2. https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html#index-x86-Options |
106 |
+3. https://bugzilla.kernel.org/show_bug.cgi?id=77461 |
107 |
+4. https://github.com/graysky2/kernel_gcc_patch/issues/15 |
108 |
+5. http://www.linuxforge.net/docs/linux/linux-gcc.php |
109 |
+ |
110 |
+Signed-off-by: graysky <graysky@×××××××××.us> |
111 |
--- |
112 |
arch/x86/Kconfig.cpu | 332 ++++++++++++++++++++++++++++++-- |
113 |
arch/x86/Makefile | 47 ++++- |
114 |
@@ -109,7 +107,7 @@ REFERENCES |
115 |
3 files changed, 428 insertions(+), 17 deletions(-) |
116 |
|
117 |
diff --git a/arch/x86/Kconfig.cpu b/arch/x86/Kconfig.cpu |
118 |
-index 814fe0d349b0..872b9cf598e3 100644 |
119 |
+index 814fe0d349b0..8acf6519d279 100644 |
120 |
--- a/arch/x86/Kconfig.cpu |
121 |
+++ b/arch/x86/Kconfig.cpu |
122 |
@@ -157,7 +157,7 @@ config MPENTIUM4 |
123 |
@@ -221,7 +219,7 @@ index 814fe0d349b0..872b9cf598e3 100644 |
124 |
+ |
125 |
+config MZEN3 |
126 |
+ bool "AMD Zen 3" |
127 |
-+ depends on GCC_VERSION > 100300 |
128 |
++ depends on ( CC_IS_GCC && GCC_VERSION >= 100300 ) || ( CC_IS_CLANG && CLANG_VERSION >= 120000 ) |
129 |
+ help |
130 |
+ Select this for AMD Family 19h Zen 3 processors. |
131 |
+ |
132 |
@@ -380,7 +378,7 @@ index 814fe0d349b0..872b9cf598e3 100644 |
133 |
+ |
134 |
+config MCOOPERLAKE |
135 |
+ bool "Intel Cooper Lake" |
136 |
-+ depends on GCC_VERSION > 100100 |
137 |
++ depends on ( CC_IS_GCC && GCC_VERSION > 100100 ) || ( CC_IS_CLANG && CLANG_VERSION >= 100000 ) |
138 |
+ select X86_P6_NOP |
139 |
+ help |
140 |
+ |
141 |
@@ -390,7 +388,7 @@ index 814fe0d349b0..872b9cf598e3 100644 |
142 |
+ |
143 |
+config MTIGERLAKE |
144 |
+ bool "Intel Tiger Lake" |
145 |
-+ depends on GCC_VERSION > 100100 |
146 |
++ depends on ( CC_IS_GCC && GCC_VERSION > 100100 ) || ( CC_IS_CLANG && CLANG_VERSION >= 100000 ) |
147 |
+ select X86_P6_NOP |
148 |
+ help |
149 |
+ |
150 |
@@ -400,7 +398,7 @@ index 814fe0d349b0..872b9cf598e3 100644 |
151 |
+ |
152 |
+config MSAPPHIRERAPIDS |
153 |
+ bool "Intel Sapphire Rapids" |
154 |
-+ depends on GCC_VERSION > 110000 |
155 |
++ depends on ( CC_IS_GCC && GCC_VERSION > 110000 ) || ( CC_IS_CLANG && CLANG_VERSION >= 120000 ) |
156 |
+ select X86_P6_NOP |
157 |
+ help |
158 |
+ |
159 |
@@ -410,7 +408,7 @@ index 814fe0d349b0..872b9cf598e3 100644 |
160 |
+ |
161 |
+config MROCKETLAKE |
162 |
+ bool "Intel Rocket Lake" |
163 |
-+ depends on GCC_VERSION > 110000 |
164 |
++ depends on ( CC_IS_GCC && GCC_VERSION > 110000 ) || ( CC_IS_CLANG && CLANG_VERSION >= 120000 ) |
165 |
+ select X86_P6_NOP |
166 |
+ help |
167 |
+ |
168 |
@@ -420,7 +418,7 @@ index 814fe0d349b0..872b9cf598e3 100644 |
169 |
+ |
170 |
+config MALDERLAKE |
171 |
+ bool "Intel Alder Lake" |
172 |
-+ depends on GCC_VERSION > 110000 |
173 |
++ depends on ( CC_IS_GCC && GCC_VERSION > 110000 ) || ( CC_IS_CLANG && CLANG_VERSION >= 120000 ) |
174 |
+ select X86_P6_NOP |
175 |
+ help |
176 |
+ |
177 |
@@ -437,7 +435,7 @@ index 814fe0d349b0..872b9cf598e3 100644 |
178 |
|
179 |
+config GENERIC_CPU2 |
180 |
+ bool "Generic-x86-64-v2" |
181 |
-+ depends on GCC_VERSION > 110000 |
182 |
++ depends on ( CC_IS_GCC && GCC_VERSION > 110000 ) || ( CC_IS_CLANG && LANG_VERSION >= 120000 ) |
183 |
+ depends on X86_64 |
184 |
+ help |
185 |
+ Generic x86-64 CPU. |
186 |
@@ -445,7 +443,7 @@ index 814fe0d349b0..872b9cf598e3 100644 |
187 |
+ |
188 |
+config GENERIC_CPU3 |
189 |
+ bool "Generic-x86-64-v3" |
190 |
-+ depends on GCC_VERSION > 110000 |
191 |
++ depends on ( CC_IS_GCC && GCC_VERSION > 110000 ) || ( CC_IS_CLANG && LANG_VERSION >= 120000 ) |
192 |
+ depends on X86_64 |
193 |
+ help |
194 |
+ Generic x86-64-v3 CPU with v3 instructions. |
195 |
@@ -453,27 +451,27 @@ index 814fe0d349b0..872b9cf598e3 100644 |
196 |
+ |
197 |
+config GENERIC_CPU4 |
198 |
+ bool "Generic-x86-64-v4" |
199 |
-+ depends on GCC_VERSION > 110000 |
200 |
++ depends on ( CC_IS_GCC && GCC_VERSION > 110000 ) || ( CC_IS_CLANG && LANG_VERSION >= 120000 ) |
201 |
+ depends on X86_64 |
202 |
+ help |
203 |
+ Generic x86-64 CPU with v4 instructions. |
204 |
+ Run equally well on all x86-64 CPUs with min support of x86-64-v4. |
205 |
+ |
206 |
+config MNATIVE_INTEL |
207 |
-+ bool "Intel-Native optimizations autodetected by GCC" |
208 |
++ bool "Intel-Native optimizations autodetected by the compiler" |
209 |
+ help |
210 |
+ |
211 |
-+ GCC 4.2 and above support -march=native, which automatically detects |
212 |
++ Clang 3.8, GCC 4.2 and above support -march=native, which automatically detects |
213 |
+ the optimum settings to use based on your processor. Do NOT use this |
214 |
+ for AMD CPUs. Intel Only! |
215 |
+ |
216 |
+ Enables -march=native |
217 |
+ |
218 |
+config MNATIVE_AMD |
219 |
-+ bool "AMD-Native optimizations autodetected by GCC" |
220 |
++ bool "AMD-Native optimizations autodetected by the compiler" |
221 |
+ help |
222 |
+ |
223 |
-+ GCC 4.2 and above support -march=native, which automatically detects |
224 |
++ Clang 3.8, GCC 4.2 and above support -march=native, which automatically detects |
225 |
+ the optimum settings to use based on your processor. Do NOT use this |
226 |
+ for Intel CPUs. AMD Only! |
227 |
+ |
228 |
@@ -538,10 +536,10 @@ index 814fe0d349b0..872b9cf598e3 100644 |
229 |
default "4" |
230 |
|
231 |
diff --git a/arch/x86/Makefile b/arch/x86/Makefile |
232 |
-index 9a85eae37b17..facf9a278fe3 100644 |
233 |
+index 78faf9c7e3ae..ee0cd507af8b 100644 |
234 |
--- a/arch/x86/Makefile |
235 |
+++ b/arch/x86/Makefile |
236 |
-@@ -113,11 +113,48 @@ else |
237 |
+@@ -114,11 +114,48 @@ else |
238 |
# FIXME - should be integrated in Makefile.cpu (Makefile_32.cpu) |
239 |
cflags-$(CONFIG_MK8) += $(call cc-option,-march=k8) |
240 |
cflags-$(CONFIG_MPSC) += $(call cc-option,-march=nocona) |