Gentoo Archives: gentoo-commits

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