Gentoo Archives: gentoo-commits

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