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