Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:5.8 commit in: /
Date: Mon, 29 Jun 2020 17:33:56
Message-Id: 1593452021.cc4e39b1cd2307d4bd50e1b6147cf22b351f5db3.mpagano@gentoo
1 commit: cc4e39b1cd2307d4bd50e1b6147cf22b351f5db3
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Mon Jun 29 17:33:41 2020 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Mon Jun 29 17:33:41 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=cc4e39b1
7
8 Kernel patch enables gcc = v9.1+ optimizations for additional CPUs.
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 0000_README | 6 +-
13 5012_enable-cpu-optimizations-for-gcc91.patch | 641 ++++++++++++++++++++++++++
14 2 files changed, 646 insertions(+), 1 deletion(-)
15
16 diff --git a/0000_README b/0000_README
17 index f93b340..b9ce21a 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -103,6 +103,10 @@ Patch: 5007_ZSTD-v5-8-8-gitignore-add-ZSTD-compressed-files.patch
21 From: https://lkml.org/lkml/2020/4/1/29
22 Desc: .gitignore: add ZSTD-compressed files
23
24 +Patch: 5012_enable-cpu-optimizations-for-gcc91.patch
25 +From: https://github.com/graysky2/kernel_gcc_patch/
26 +Desc: Kernel patch enables gcc = v9.1+ optimizations for additional CPUs.
27 +
28 Patch: 5013_enable-cpu-optimizations-for-gcc10.patch
29 From: https://github.com/graysky2/kernel_gcc_patch/
30 -Desc: Kernel patch enables gcc >= v10.1 optimizations for additional CPUs.
31 +Desc: Kernel patch enables gcc = v10.1+ optimizations for additional CPUs.
32
33 diff --git a/5012_enable-cpu-optimizations-for-gcc91.patch b/5012_enable-cpu-optimizations-for-gcc91.patch
34 new file mode 100644
35 index 0000000..2f16153
36 --- /dev/null
37 +++ b/5012_enable-cpu-optimizations-for-gcc91.patch
38 @@ -0,0 +1,641 @@
39 +WARNING
40 +This patch works with gcc versions 9.1+ and with kernel version 5.7+ and should
41 +NOT be applied when compiling on older versions of gcc due to key name changes
42 +of the march flags introduced with the version 4.9 release of gcc.[1]
43 +
44 +Use the older version of this patch hosted on the same github for older
45 +versions of gcc.
46 +
47 +FEATURES
48 +This patch adds additional CPU options to the Linux kernel accessible under:
49 + Processor type and features --->
50 + Processor family --->
51 +
52 +The expanded microarchitectures include:
53 +* AMD Improved K8-family
54 +* AMD K10-family
55 +* AMD Family 10h (Barcelona)
56 +* AMD Family 14h (Bobcat)
57 +* AMD Family 16h (Jaguar)
58 +* AMD Family 15h (Bulldozer)
59 +* AMD Family 15h (Piledriver)
60 +* AMD Family 15h (Steamroller)
61 +* AMD Family 15h (Excavator)
62 +* AMD Family 17h (Zen)
63 +* AMD Family 17h (Zen 2)
64 +* Intel Silvermont low-power processors
65 +* Intel Goldmont low-power processors (Apollo Lake and Denverton)
66 +* Intel Goldmont Plus low-power processors (Gemini Lake)
67 +* Intel 1st Gen Core i3/i5/i7 (Nehalem)
68 +* Intel 1.5 Gen Core i3/i5/i7 (Westmere)
69 +* Intel 2nd Gen Core i3/i5/i7 (Sandybridge)
70 +* Intel 3rd Gen Core i3/i5/i7 (Ivybridge)
71 +* Intel 4th Gen Core i3/i5/i7 (Haswell)
72 +* Intel 5th Gen Core i3/i5/i7 (Broadwell)
73 +* Intel 6th Gen Core i3/i5/i7 (Skylake)
74 +* Intel 6th Gen Core i7/i9 (Skylake X)
75 +* Intel 8th Gen Core i3/i5/i7 (Cannon Lake)
76 +* Intel 10th Gen Core i7/i9 (Ice Lake)
77 +* Intel Xeon (Cascade Lake)
78 +
79 +It also offers to compile passing the 'native' option which, "selects the CPU
80 +to generate code for at compilation time by determining the processor type of
81 +the compiling machine. Using -march=native enables all instruction subsets
82 +supported by the local machine and will produce code optimized for the local
83 +machine under the constraints of the selected instruction set."[2]
84 +
85 +Do NOT try using the 'native' option on AMD Piledriver, Steamroller, or
86 +Excavator CPUs (-march=bdver{2,3,4} flag). The build will error out due the
87 +kernel's objtool issue with these.[3a,b]
88 +
89 +MINOR NOTES
90 +This patch also changes 'atom' to 'bonnell' in accordance with the gcc v4.9
91 +changes. Note that upstream is using the deprecated 'match=atom' flags when I
92 +believe it should use the newer 'march=bonnell' flag for atom processors.[4]
93 +
94 +It is not recommended to compile on Atom-CPUs with the 'native' option.[5] The
95 +recommendation is to use the 'atom' option instead.
96 +
97 +BENEFITS
98 +Small but real speed increases are measurable using a make endpoint comparing
99 +a generic kernel to one built with one of the respective microarchs.
100 +
101 +See the following experimental evidence supporting this statement:
102 +https://github.com/graysky2/kernel_gcc_patch
103 +
104 +REQUIREMENTS
105 +linux version >=5.7
106 +gcc version >=9.1 and <10
107 +
108 +ACKNOWLEDGMENTS
109 +This patch builds on the seminal work by Jeroen.[6]
110 +
111 +REFERENCES
112 +1. https://gcc.gnu.org/gcc-4.9/changes.html
113 +2. https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html
114 +3a. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95671#c11
115 +3b. https://github.com/graysky2/kernel_gcc_patch/issues/55
116 +4. https://bugzilla.kernel.org/show_bug.cgi?id=77461
117 +5. https://github.com/graysky2/kernel_gcc_patch/issues/15
118 +6. http://www.linuxforge.net/docs/linux/linux-gcc.php
119 +
120 +--- a/arch/x86/include/asm/vermagic.h 2020-06-10 14:21:45.000000000 -0400
121 ++++ b/arch/x86/include/asm/vermagic.h 2020-06-15 10:44:10.437477053 -0400
122 +@@ -17,6 +17,36 @@
123 + #define MODULE_PROC_FAMILY "586MMX "
124 + #elif defined CONFIG_MCORE2
125 + #define MODULE_PROC_FAMILY "CORE2 "
126 ++#elif defined CONFIG_MNATIVE
127 ++#define MODULE_PROC_FAMILY "NATIVE "
128 ++#elif defined CONFIG_MNEHALEM
129 ++#define MODULE_PROC_FAMILY "NEHALEM "
130 ++#elif defined CONFIG_MWESTMERE
131 ++#define MODULE_PROC_FAMILY "WESTMERE "
132 ++#elif defined CONFIG_MSILVERMONT
133 ++#define MODULE_PROC_FAMILY "SILVERMONT "
134 ++#elif defined CONFIG_MGOLDMONT
135 ++#define MODULE_PROC_FAMILY "GOLDMONT "
136 ++#elif defined CONFIG_MGOLDMONTPLUS
137 ++#define MODULE_PROC_FAMILY "GOLDMONTPLUS "
138 ++#elif defined CONFIG_MSANDYBRIDGE
139 ++#define MODULE_PROC_FAMILY "SANDYBRIDGE "
140 ++#elif defined CONFIG_MIVYBRIDGE
141 ++#define MODULE_PROC_FAMILY "IVYBRIDGE "
142 ++#elif defined CONFIG_MHASWELL
143 ++#define MODULE_PROC_FAMILY "HASWELL "
144 ++#elif defined CONFIG_MBROADWELL
145 ++#define MODULE_PROC_FAMILY "BROADWELL "
146 ++#elif defined CONFIG_MSKYLAKE
147 ++#define MODULE_PROC_FAMILY "SKYLAKE "
148 ++#elif defined CONFIG_MSKYLAKEX
149 ++#define MODULE_PROC_FAMILY "SKYLAKEX "
150 ++#elif defined CONFIG_MCANNONLAKE
151 ++#define MODULE_PROC_FAMILY "CANNONLAKE "
152 ++#elif defined CONFIG_MICELAKE
153 ++#define MODULE_PROC_FAMILY "ICELAKE "
154 ++#elif defined CONFIG_MCASCADELAKE
155 ++#define MODULE_PROC_FAMILY "CASCADELAKE "
156 + #elif defined CONFIG_MATOM
157 + #define MODULE_PROC_FAMILY "ATOM "
158 + #elif defined CONFIG_M686
159 +@@ -35,6 +65,28 @@
160 + #define MODULE_PROC_FAMILY "K7 "
161 + #elif defined CONFIG_MK8
162 + #define MODULE_PROC_FAMILY "K8 "
163 ++#elif defined CONFIG_MK8SSE3
164 ++#define MODULE_PROC_FAMILY "K8SSE3 "
165 ++#elif defined CONFIG_MK10
166 ++#define MODULE_PROC_FAMILY "K10 "
167 ++#elif defined CONFIG_MBARCELONA
168 ++#define MODULE_PROC_FAMILY "BARCELONA "
169 ++#elif defined CONFIG_MBOBCAT
170 ++#define MODULE_PROC_FAMILY "BOBCAT "
171 ++#elif defined CONFIG_MBULLDOZER
172 ++#define MODULE_PROC_FAMILY "BULLDOZER "
173 ++#elif defined CONFIG_MPILEDRIVER
174 ++#define MODULE_PROC_FAMILY "PILEDRIVER "
175 ++#elif defined CONFIG_MSTEAMROLLER
176 ++#define MODULE_PROC_FAMILY "STEAMROLLER "
177 ++#elif defined CONFIG_MJAGUAR
178 ++#define MODULE_PROC_FAMILY "JAGUAR "
179 ++#elif defined CONFIG_MEXCAVATOR
180 ++#define MODULE_PROC_FAMILY "EXCAVATOR "
181 ++#elif defined CONFIG_MZEN
182 ++#define MODULE_PROC_FAMILY "ZEN "
183 ++#elif defined CONFIG_MZEN2
184 ++#define MODULE_PROC_FAMILY "ZEN2 "
185 + #elif defined CONFIG_MELAN
186 + #define MODULE_PROC_FAMILY "ELAN "
187 + #elif defined CONFIG_MCRUSOE
188 +--- a/arch/x86/Kconfig.cpu 2020-06-10 14:21:45.000000000 -0400
189 ++++ b/arch/x86/Kconfig.cpu 2020-06-15 10:44:10.437477053 -0400
190 +@@ -123,6 +123,7 @@ config MPENTIUMM
191 + config MPENTIUM4
192 + bool "Pentium-4/Celeron(P4-based)/Pentium-4 M/older Xeon"
193 + depends on X86_32
194 ++ select X86_P6_NOP
195 + ---help---
196 + Select this for Intel Pentium 4 chips. This includes the
197 + Pentium 4, Pentium D, P4-based Celeron and Xeon, and
198 +@@ -155,9 +156,8 @@ config MPENTIUM4
199 + -Paxville
200 + -Dempsey
201 +
202 +-
203 + config MK6
204 +- bool "K6/K6-II/K6-III"
205 ++ bool "AMD K6/K6-II/K6-III"
206 + depends on X86_32
207 + ---help---
208 + Select this for an AMD K6-family processor. Enables use of
209 +@@ -165,7 +165,7 @@ config MK6
210 + flags to GCC.
211 +
212 + config MK7
213 +- bool "Athlon/Duron/K7"
214 ++ bool "AMD Athlon/Duron/K7"
215 + depends on X86_32
216 + ---help---
217 + Select this for an AMD Athlon K7-family processor. Enables use of
218 +@@ -173,12 +173,90 @@ config MK7
219 + flags to GCC.
220 +
221 + config MK8
222 +- bool "Opteron/Athlon64/Hammer/K8"
223 ++ bool "AMD Opteron/Athlon64/Hammer/K8"
224 + ---help---
225 + Select this for an AMD Opteron or Athlon64 Hammer-family processor.
226 + Enables use of some extended instructions, and passes appropriate
227 + optimization flags to GCC.
228 +
229 ++config MK8SSE3
230 ++ bool "AMD Opteron/Athlon64/Hammer/K8 with SSE3"
231 ++ ---help---
232 ++ Select this for improved AMD Opteron or Athlon64 Hammer-family processors.
233 ++ Enables use of some extended instructions, and passes appropriate
234 ++ optimization flags to GCC.
235 ++
236 ++config MK10
237 ++ bool "AMD 61xx/7x50/PhenomX3/X4/II/K10"
238 ++ ---help---
239 ++ Select this for an AMD 61xx Eight-Core Magny-Cours, Athlon X2 7x50,
240 ++ Phenom X3/X4/II, Athlon II X2/X3/X4, or Turion II-family processor.
241 ++ Enables use of some extended instructions, and passes appropriate
242 ++ optimization flags to GCC.
243 ++
244 ++config MBARCELONA
245 ++ bool "AMD Barcelona"
246 ++ ---help---
247 ++ Select this for AMD Family 10h Barcelona processors.
248 ++
249 ++ Enables -march=barcelona
250 ++
251 ++config MBOBCAT
252 ++ bool "AMD Bobcat"
253 ++ ---help---
254 ++ Select this for AMD Family 14h Bobcat processors.
255 ++
256 ++ Enables -march=btver1
257 ++
258 ++config MJAGUAR
259 ++ bool "AMD Jaguar"
260 ++ ---help---
261 ++ Select this for AMD Family 16h Jaguar processors.
262 ++
263 ++ Enables -march=btver2
264 ++
265 ++config MBULLDOZER
266 ++ bool "AMD Bulldozer"
267 ++ ---help---
268 ++ Select this for AMD Family 15h Bulldozer processors.
269 ++
270 ++ Enables -march=bdver1
271 ++
272 ++config MPILEDRIVER
273 ++ bool "AMD Piledriver"
274 ++ ---help---
275 ++ Select this for AMD Family 15h Piledriver processors.
276 ++
277 ++ Enables -march=bdver2
278 ++
279 ++config MSTEAMROLLER
280 ++ bool "AMD Steamroller"
281 ++ ---help---
282 ++ Select this for AMD Family 15h Steamroller processors.
283 ++
284 ++ Enables -march=bdver3
285 ++
286 ++config MEXCAVATOR
287 ++ bool "AMD Excavator"
288 ++ ---help---
289 ++ Select this for AMD Family 15h Excavator processors.
290 ++
291 ++ Enables -march=bdver4
292 ++
293 ++config MZEN
294 ++ bool "AMD Zen"
295 ++ ---help---
296 ++ Select this for AMD Family 17h Zen processors.
297 ++
298 ++ Enables -march=znver1
299 ++
300 ++config MZEN2
301 ++ bool "AMD Zen 2"
302 ++ ---help---
303 ++ Select this for AMD Family 17h Zen 2 processors.
304 ++
305 ++ Enables -march=znver2
306 ++
307 + config MCRUSOE
308 + bool "Crusoe"
309 + depends on X86_32
310 +@@ -260,6 +338,7 @@ config MVIAC7
311 +
312 + config MPSC
313 + bool "Intel P4 / older Netburst based Xeon"
314 ++ select X86_P6_NOP
315 + depends on X86_64
316 + ---help---
317 + Optimize for Intel Pentium 4, Pentium D and older Nocona/Dempsey
318 +@@ -269,8 +348,19 @@ config MPSC
319 + using the cpu family field
320 + in /proc/cpuinfo. Family 15 is an older Xeon, Family 6 a newer one.
321 +
322 ++config MATOM
323 ++ bool "Intel Atom"
324 ++ select X86_P6_NOP
325 ++ ---help---
326 ++
327 ++ Select this for the Intel Atom platform. Intel Atom CPUs have an
328 ++ in-order pipelining architecture and thus can benefit from
329 ++ accordingly optimized code. Use a recent GCC with specific Atom
330 ++ support in order to fully benefit from selecting this option.
331 ++
332 + config MCORE2
333 +- bool "Core 2/newer Xeon"
334 ++ bool "Intel Core 2"
335 ++ select X86_P6_NOP
336 + ---help---
337 +
338 + Select this for Intel Core 2 and newer Core 2 Xeons (Xeon 51xx and
339 +@@ -278,14 +368,133 @@ config MCORE2
340 + family in /proc/cpuinfo. Newer ones have 6 and older ones 15
341 + (not a typo)
342 +
343 +-config MATOM
344 +- bool "Intel Atom"
345 ++ Enables -march=core2
346 ++
347 ++config MNEHALEM
348 ++ bool "Intel Nehalem"
349 ++ select X86_P6_NOP
350 + ---help---
351 +
352 +- Select this for the Intel Atom platform. Intel Atom CPUs have an
353 +- in-order pipelining architecture and thus can benefit from
354 +- accordingly optimized code. Use a recent GCC with specific Atom
355 +- support in order to fully benefit from selecting this option.
356 ++ Select this for 1st Gen Core processors in the Nehalem family.
357 ++
358 ++ Enables -march=nehalem
359 ++
360 ++config MWESTMERE
361 ++ bool "Intel Westmere"
362 ++ select X86_P6_NOP
363 ++ ---help---
364 ++
365 ++ Select this for the Intel Westmere formerly Nehalem-C family.
366 ++
367 ++ Enables -march=westmere
368 ++
369 ++config MSILVERMONT
370 ++ bool "Intel Silvermont"
371 ++ select X86_P6_NOP
372 ++ ---help---
373 ++
374 ++ Select this for the Intel Silvermont platform.
375 ++
376 ++ Enables -march=silvermont
377 ++
378 ++config MGOLDMONT
379 ++ bool "Intel Goldmont"
380 ++ select X86_P6_NOP
381 ++ ---help---
382 ++
383 ++ Select this for the Intel Goldmont platform including Apollo Lake and Denverton.
384 ++
385 ++ Enables -march=goldmont
386 ++
387 ++config MGOLDMONTPLUS
388 ++ bool "Intel Goldmont Plus"
389 ++ select X86_P6_NOP
390 ++ ---help---
391 ++
392 ++ Select this for the Intel Goldmont Plus platform including Gemini Lake.
393 ++
394 ++ Enables -march=goldmont-plus
395 ++
396 ++config MSANDYBRIDGE
397 ++ bool "Intel Sandy Bridge"
398 ++ select X86_P6_NOP
399 ++ ---help---
400 ++
401 ++ Select this for 2nd Gen Core processors in the Sandy Bridge family.
402 ++
403 ++ Enables -march=sandybridge
404 ++
405 ++config MIVYBRIDGE
406 ++ bool "Intel Ivy Bridge"
407 ++ select X86_P6_NOP
408 ++ ---help---
409 ++
410 ++ Select this for 3rd Gen Core processors in the Ivy Bridge family.
411 ++
412 ++ Enables -march=ivybridge
413 ++
414 ++config MHASWELL
415 ++ bool "Intel Haswell"
416 ++ select X86_P6_NOP
417 ++ ---help---
418 ++
419 ++ Select this for 4th Gen Core processors in the Haswell family.
420 ++
421 ++ Enables -march=haswell
422 ++
423 ++config MBROADWELL
424 ++ bool "Intel Broadwell"
425 ++ select X86_P6_NOP
426 ++ ---help---
427 ++
428 ++ Select this for 5th Gen Core processors in the Broadwell family.
429 ++
430 ++ Enables -march=broadwell
431 ++
432 ++config MSKYLAKE
433 ++ bool "Intel Skylake"
434 ++ select X86_P6_NOP
435 ++ ---help---
436 ++
437 ++ Select this for 6th Gen Core processors in the Skylake family.
438 ++
439 ++ Enables -march=skylake
440 ++
441 ++config MSKYLAKEX
442 ++ bool "Intel Skylake X"
443 ++ select X86_P6_NOP
444 ++ ---help---
445 ++
446 ++ Select this for 6th Gen Core processors in the Skylake X family.
447 ++
448 ++ Enables -march=skylake-avx512
449 ++
450 ++config MCANNONLAKE
451 ++ bool "Intel Cannon Lake"
452 ++ select X86_P6_NOP
453 ++ ---help---
454 ++
455 ++ Select this for 8th Gen Core processors
456 ++
457 ++ Enables -march=cannonlake
458 ++
459 ++config MICELAKE
460 ++ bool "Intel Ice Lake"
461 ++ select X86_P6_NOP
462 ++ ---help---
463 ++
464 ++ Select this for 10th Gen Core processors in the Ice Lake family.
465 ++
466 ++ Enables -march=icelake-client
467 ++
468 ++config MCASCADELAKE
469 ++ bool "Intel Cascade Lake"
470 ++ select X86_P6_NOP
471 ++ ---help---
472 ++
473 ++ Select this for Xeon processors in the Cascade Lake family.
474 ++
475 ++ Enables -march=cascadelake
476 +
477 + config GENERIC_CPU
478 + bool "Generic-x86-64"
479 +@@ -294,6 +503,19 @@ config GENERIC_CPU
480 + Generic x86-64 CPU.
481 + Run equally well on all x86-64 CPUs.
482 +
483 ++config MNATIVE
484 ++ bool "Native optimizations autodetected by GCC"
485 ++ ---help---
486 ++
487 ++ GCC 4.2 and above support -march=native, which automatically detects
488 ++ the optimum settings to use based on your processor. -march=native
489 ++ also detects and applies additional settings beyond -march specific
490 ++ to your CPU, (eg. -msse4). Unless you have a specific reason not to
491 ++ (e.g. distcc cross-compiling), you should probably be using
492 ++ -march=native rather than anything listed below.
493 ++
494 ++ Enables -march=native
495 ++
496 + endchoice
497 +
498 + config X86_GENERIC
499 +@@ -318,7 +540,7 @@ config X86_INTERNODE_CACHE_SHIFT
500 + config X86_L1_CACHE_SHIFT
501 + int
502 + default "7" if MPENTIUM4 || MPSC
503 +- default "6" if MK7 || MK8 || MPENTIUMM || MCORE2 || MATOM || MVIAC7 || X86_GENERIC || GENERIC_CPU
504 ++ default "6" if MK7 || MK8 || MK8SSE3 || MK10 || MBARCELONA || MBOBCAT || MBULLDOZER || MPILEDRIVER || MSTEAMROLLER || MEXCAVATOR || MZEN || MZEN2 || MJAGUAR || MPENTIUMM || MCORE2 || MNEHALEM || MWESTMERE || MSILVERMONT || MGOLDMONT || MGOLDMONTPLUS || MSANDYBRIDGE || MIVYBRIDGE || MHASWELL || MBROADWELL || MSKYLAKE || MSKYLAKEX || MCANNONLAKE || MICELAKE || MCASCADELAKE || MNATIVE || MATOM || MVIAC7 || X86_GENERIC || GENERIC_CPU
505 + default "4" if MELAN || M486SX || M486 || MGEODEGX1
506 + default "5" if MWINCHIP3D || MWINCHIPC6 || MCRUSOE || MEFFICEON || MCYRIXIII || MK6 || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || M586 || MVIAC3_2 || MGEODE_LX
507 +
508 +@@ -336,35 +558,36 @@ config X86_ALIGNMENT_16
509 +
510 + config X86_INTEL_USERCOPY
511 + def_bool y
512 +- depends on MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M586MMX || X86_GENERIC || MK8 || MK7 || MEFFICEON || MCORE2
513 ++ depends on MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M586MMX || X86_GENERIC || MK8 || MK8SSE3 || MK7 || MEFFICEON || MCORE2 || MK10 || MBARCELONA || MNEHALEM || MWESTMERE || MSILVERMONT || MGOLDMONT || MGOLDMONTPLUS || MSANDYBRIDGE || MIVYBRIDGE || MHASWELL || MBROADWELL || MSKYLAKE || MSKYLAKEX || MCANNONLAKE || MICELAKE || MCASCADELAKE || MNATIVE
514 +
515 + config X86_USE_PPRO_CHECKSUM
516 + def_bool y
517 +- depends on MWINCHIP3D || MWINCHIPC6 || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MK8 || MVIAC3_2 || MVIAC7 || MEFFICEON || MGEODE_LX || MCORE2 || MATOM
518 ++ depends on MWINCHIP3D || MWINCHIPC6 || MCYRIXIII || MK7 || MK6 || MK10 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MK8 || MK8SSE3 || MVIAC3_2 || MVIAC7 || MEFFICEON || MGEODE_LX || MCORE2 || MNEHALEM || MWESTMERE || MSILVERMONT || MGOLDMONT || MGOLDMONTPLUS || MSANDYBRIDGE || MIVYBRIDGE || MHASWELL || MBROADWELL || MSKYLAKE || MSKYLAKEX || MCANNONLAKE || MICELAKE || MCASCADELAKE || MATOM || MNATIVE
519 +
520 + config X86_USE_3DNOW
521 + def_bool y
522 + depends on (MCYRIXIII || MK7 || MGEODE_LX) && !UML
523 +
524 +-#
525 +-# P6_NOPs are a relatively minor optimization that require a family >=
526 +-# 6 processor, except that it is broken on certain VIA chips.
527 +-# Furthermore, AMD chips prefer a totally different sequence of NOPs
528 +-# (which work on all CPUs). In addition, it looks like Virtual PC
529 +-# does not understand them.
530 +-#
531 +-# As a result, disallow these if we're not compiling for X86_64 (these
532 +-# NOPs do work on all x86-64 capable chips); the list of processors in
533 +-# the right-hand clause are the cores that benefit from this optimization.
534 +-#
535 + config X86_P6_NOP
536 +- def_bool y
537 +- depends on X86_64
538 +- depends on (MCORE2 || MPENTIUM4 || MPSC)
539 ++ default n
540 ++ bool "Support for P6_NOPs on Intel chips"
541 ++ depends on (MCORE2 || MPENTIUM4 || MPSC || MATOM || MNEHALEM || MWESTMERE || MSILVERMONT || MGOLDMONT || MGOLDMONTPLUS || MSANDYBRIDGE || MIVYBRIDGE || MHASWELL || MBROADWELL || MSKYLAKE || MSKYLAKEX || MCANNONLAKE || MICELAKE || MCASCADELAKE || MNATIVE)
542 ++ ---help---
543 ++ P6_NOPs are a relatively minor optimization that require a family >=
544 ++ 6 processor, except that it is broken on certain VIA chips.
545 ++ Furthermore, AMD chips prefer a totally different sequence of NOPs
546 ++ (which work on all CPUs). In addition, it looks like Virtual PC
547 ++ does not understand them.
548 ++
549 ++ As a result, disallow these if we're not compiling for X86_64 (these
550 ++ NOPs do work on all x86-64 capable chips); the list of processors in
551 ++ the right-hand clause are the cores that benefit from this optimization.
552 ++
553 ++ Say Y if you have Intel CPU newer than Pentium Pro, N otherwise.
554 +
555 + config X86_TSC
556 + def_bool y
557 +- 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
558 ++ depends on (MWINCHIP3D || MCRUSOE || MEFFICEON || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || MK8 || MK8SSE3 || MVIAC3_2 || MVIAC7 || MGEODEGX1 || MGEODE_LX || MCORE2 || MNEHALEM || MWESTMERE || MSILVERMONT || MGOLDMONT || MGOLDMONTPLUS || MSANDYBRIDGE || MIVYBRIDGE || MHASWELL || MBROADWELL || MSKYLAKE || MSKYLAKEX || MCANNONLAKE || MICELAKE || MCASCADELAKE || MNATIVE || MATOM) || X86_64
559 +
560 + config X86_CMPXCHG64
561 + def_bool y
562 +@@ -374,7 +597,7 @@ config X86_CMPXCHG64
563 + # generates cmov.
564 + config X86_CMOV
565 + def_bool y
566 +- depends on (MK8 || MK7 || MCORE2 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MVIAC3_2 || MVIAC7 || MCRUSOE || MEFFICEON || X86_64 || MATOM || MGEODE_LX)
567 ++ depends on (MK8 || MK8SSE3 || MK10 || MBARCELONA || MBOBCAT || MBULLDOZER || MPILEDRIVER || MSTEAMROLLER || MEXCAVATOR || MZEN || MZEN2 || MJAGUAR || MK7 || MCORE2 || MNEHALEM || MWESTMERE || MSILVERMONT || MGOLDMONT || MGOLDMONTPLUS || MSANDYBRIDGE || MIVYBRIDGE || MHASWELL || MBROADWELL || MSKYLAKE || MSKYLAKEX || MCANNONLAKE || MICELAKE || MCASCADELAKE || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MVIAC3_2 || MVIAC7 || MCRUSOE || MEFFICEON || X86_64 || MNATIVE || MATOM || MGEODE_LX)
568 +
569 + config X86_MINIMUM_CPU_FAMILY
570 + int
571 +--- a/arch/x86/Makefile 2020-06-10 14:21:45.000000000 -0400
572 ++++ b/arch/x86/Makefile 2020-06-15 10:44:35.608035680 -0400
573 +@@ -119,13 +119,56 @@ else
574 + KBUILD_CFLAGS += $(call cc-option,-mskip-rax-setup)
575 +
576 + # FIXME - should be integrated in Makefile.cpu (Makefile_32.cpu)
577 ++ cflags-$(CONFIG_MNATIVE) += $(call cc-option,-march=native)
578 + cflags-$(CONFIG_MK8) += $(call cc-option,-march=k8)
579 ++ cflags-$(CONFIG_MK8SSE3) += $(call cc-option,-march=k8-sse3,-mtune=k8)
580 ++ cflags-$(CONFIG_MK10) += $(call cc-option,-march=amdfam10)
581 ++ cflags-$(CONFIG_MBARCELONA) += $(call cc-option,-march=barcelona)
582 ++ cflags-$(CONFIG_MBOBCAT) += $(call cc-option,-march=btver1)
583 ++ cflags-$(CONFIG_MJAGUAR) += $(call cc-option,-march=btver2)
584 ++ cflags-$(CONFIG_MBULLDOZER) += $(call cc-option,-march=bdver1)
585 ++ cflags-$(CONFIG_MPILEDRIVER) += $(call cc-option,-march=bdver2)
586 ++ cflags-$(CONFIG_MPILEDRIVER) += $(call cc-option,-mno-tbm)
587 ++ cflags-$(CONFIG_MSTEAMROLLER) += $(call cc-option,-march=bdver3)
588 ++ cflags-$(CONFIG_MSTEAMROLLER) += $(call cc-option,-mno-tbm)
589 ++ cflags-$(CONFIG_MEXCAVATOR) += $(call cc-option,-march=bdver4)
590 ++ cflags-$(CONFIG_MEXCAVATOR) += $(call cc-option,-mno-tbm)
591 ++ cflags-$(CONFIG_MZEN) += $(call cc-option,-march=znver1)
592 ++ cflags-$(CONFIG_MZEN2) += $(call cc-option,-march=znver2)
593 + cflags-$(CONFIG_MPSC) += $(call cc-option,-march=nocona)
594 +
595 + cflags-$(CONFIG_MCORE2) += \
596 +- $(call cc-option,-march=core2,$(call cc-option,-mtune=generic))
597 +- cflags-$(CONFIG_MATOM) += $(call cc-option,-march=atom) \
598 +- $(call cc-option,-mtune=atom,$(call cc-option,-mtune=generic))
599 ++ $(call cc-option,-march=core2,$(call cc-option,-mtune=core2))
600 ++ cflags-$(CONFIG_MNEHALEM) += \
601 ++ $(call cc-option,-march=nehalem,$(call cc-option,-mtune=nehalem))
602 ++ cflags-$(CONFIG_MWESTMERE) += \
603 ++ $(call cc-option,-march=westmere,$(call cc-option,-mtune=westmere))
604 ++ cflags-$(CONFIG_MSILVERMONT) += \
605 ++ $(call cc-option,-march=silvermont,$(call cc-option,-mtune=silvermont))
606 ++ cflags-$(CONFIG_MGOLDMONT) += \
607 ++ $(call cc-option,-march=goldmont,$(call cc-option,-mtune=goldmont))
608 ++ cflags-$(CONFIG_MGOLDMONTPLUS) += \
609 ++ $(call cc-option,-march=goldmont-plus,$(call cc-option,-mtune=goldmont-plus))
610 ++ cflags-$(CONFIG_MSANDYBRIDGE) += \
611 ++ $(call cc-option,-march=sandybridge,$(call cc-option,-mtune=sandybridge))
612 ++ cflags-$(CONFIG_MIVYBRIDGE) += \
613 ++ $(call cc-option,-march=ivybridge,$(call cc-option,-mtune=ivybridge))
614 ++ cflags-$(CONFIG_MHASWELL) += \
615 ++ $(call cc-option,-march=haswell,$(call cc-option,-mtune=haswell))
616 ++ cflags-$(CONFIG_MBROADWELL) += \
617 ++ $(call cc-option,-march=broadwell,$(call cc-option,-mtune=broadwell))
618 ++ cflags-$(CONFIG_MSKYLAKE) += \
619 ++ $(call cc-option,-march=skylake,$(call cc-option,-mtune=skylake))
620 ++ cflags-$(CONFIG_MSKYLAKEX) += \
621 ++ $(call cc-option,-march=skylake-avx512,$(call cc-option,-mtune=skylake-avx512))
622 ++ cflags-$(CONFIG_MCANNONLAKE) += \
623 ++ $(call cc-option,-march=cannonlake,$(call cc-option,-mtune=cannonlake))
624 ++ cflags-$(CONFIG_MICELAKE) += \
625 ++ $(call cc-option,-march=icelake-client,$(call cc-option,-mtune=icelake-client))
626 ++ cflags-$(CONFIG_MCASCADELAKE) += \
627 ++ $(call cc-option,-march=cascadelake,$(call cc-option,-mtune=cascadelake))
628 ++ cflags-$(CONFIG_MATOM) += $(call cc-option,-march=bonnell) \
629 ++ $(call cc-option,-mtune=bonnell,$(call cc-option,-mtune=generic))
630 + cflags-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=generic)
631 + KBUILD_CFLAGS += $(cflags-y)
632 +
633 +--- a/arch/x86/Makefile_32.cpu 2020-06-10 14:21:45.000000000 -0400
634 ++++ b/arch/x86/Makefile_32.cpu 2020-06-15 10:44:10.437477053 -0400
635 +@@ -24,7 +24,19 @@ cflags-$(CONFIG_MK6) += -march=k6
636 + # Please note, that patches that add -march=athlon-xp and friends are pointless.
637 + # They make zero difference whatsosever to performance at this time.
638 + cflags-$(CONFIG_MK7) += -march=athlon
639 ++cflags-$(CONFIG_MNATIVE) += $(call cc-option,-march=native)
640 + cflags-$(CONFIG_MK8) += $(call cc-option,-march=k8,-march=athlon)
641 ++cflags-$(CONFIG_MK8SSE3) += $(call cc-option,-march=k8-sse3,-march=athlon)
642 ++cflags-$(CONFIG_MK10) += $(call cc-option,-march=amdfam10,-march=athlon)
643 ++cflags-$(CONFIG_MBARCELONA) += $(call cc-option,-march=barcelona,-march=athlon)
644 ++cflags-$(CONFIG_MBOBCAT) += $(call cc-option,-march=btver1,-march=athlon)
645 ++cflags-$(CONFIG_MJAGUAR) += $(call cc-option,-march=btver2,-march=athlon)
646 ++cflags-$(CONFIG_MBULLDOZER) += $(call cc-option,-march=bdver1,-march=athlon)
647 ++cflags-$(CONFIG_MPILEDRIVER) += $(call cc-option,-march=bdver2,-march=athlon)
648 ++cflags-$(CONFIG_MSTEAMROLLER) += $(call cc-option,-march=bdver3,-march=athlon)
649 ++cflags-$(CONFIG_MEXCAVATOR) += $(call cc-option,-march=bdver4,-march=athlon)
650 ++cflags-$(CONFIG_MZEN) += $(call cc-option,-march=znver1,-march=athlon)
651 ++cflags-$(CONFIG_MZEN2) += $(call cc-option,-march=znver2,-march=athlon)
652 + cflags-$(CONFIG_MCRUSOE) += -march=i686 -falign-functions=0 -falign-jumps=0 -falign-loops=0
653 + cflags-$(CONFIG_MEFFICEON) += -march=i686 $(call tune,pentium3) -falign-functions=0 -falign-jumps=0 -falign-loops=0
654 + cflags-$(CONFIG_MWINCHIPC6) += $(call cc-option,-march=winchip-c6,-march=i586)
655 +@@ -33,8 +45,22 @@ cflags-$(CONFIG_MCYRIXIII) += $(call cc-
656 + cflags-$(CONFIG_MVIAC3_2) += $(call cc-option,-march=c3-2,-march=i686)
657 + cflags-$(CONFIG_MVIAC7) += -march=i686
658 + cflags-$(CONFIG_MCORE2) += -march=i686 $(call tune,core2)
659 +-cflags-$(CONFIG_MATOM) += $(call cc-option,-march=atom,$(call cc-option,-march=core2,-march=i686)) \
660 +- $(call cc-option,-mtune=atom,$(call cc-option,-mtune=generic))
661 ++cflags-$(CONFIG_MNEHALEM) += -march=i686 $(call tune,nehalem)
662 ++cflags-$(CONFIG_MWESTMERE) += -march=i686 $(call tune,westmere)
663 ++cflags-$(CONFIG_MSILVERMONT) += -march=i686 $(call tune,silvermont)
664 ++cflags-$(CONFIG_MGOLDMONT) += -march=i686 $(call tune,goldmont)
665 ++cflags-$(CONFIG_MGOLDMONTPLUS) += -march=i686 $(call tune,goldmont-plus)
666 ++cflags-$(CONFIG_MSANDYBRIDGE) += -march=i686 $(call tune,sandybridge)
667 ++cflags-$(CONFIG_MIVYBRIDGE) += -march=i686 $(call tune,ivybridge)
668 ++cflags-$(CONFIG_MHASWELL) += -march=i686 $(call tune,haswell)
669 ++cflags-$(CONFIG_MBROADWELL) += -march=i686 $(call tune,broadwell)
670 ++cflags-$(CONFIG_MSKYLAKE) += -march=i686 $(call tune,skylake)
671 ++cflags-$(CONFIG_MSKYLAKEX) += -march=i686 $(call tune,skylake-avx512)
672 ++cflags-$(CONFIG_MCANNONLAKE) += -march=i686 $(call tune,cannonlake)
673 ++cflags-$(CONFIG_MICELAKE) += -march=i686 $(call tune,icelake-client)
674 ++cflags-$(CONFIG_MCASCADELAKE) += -march=i686 $(call tune,cascadelake)
675 ++cflags-$(CONFIG_MATOM) += $(call cc-option,-march=bonnell,$(call cc-option,-march=core2,-march=i686)) \
676 ++ $(call cc-option,-mtune=bonnell,$(call cc-option,-mtune=generic))
677 +
678 + # AMD Elan support
679 + cflags-$(CONFIG_MELAN) += -march=i486