Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:5.16 commit in: /
Date: Sun, 05 Dec 2021 23:46:09
Message-Id: 1638747952.a8f0e431469a1ed2817fac5ebea32d67aa50c9ac.mpagano@gentoo
1 commit: a8f0e431469a1ed2817fac5ebea32d67aa50c9ac
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Sun Dec 5 23:45:52 2021 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Sun Dec 5 23:45:52 2021 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=a8f0e431
7
8 Add genpatches to 5.16
9
10 Patches:
11 Patch to support for namespace user.pax.* on tmpfs.
12 Patch to enable link security restrictions by default.
13 Bluetooth: Check key sizes only when Secure Simple Pairing is enabled. See bug #686758
14 Revert: drm/i915: Implement Wa_1508744258
15 tmp513 requies REGMAP_I2C to build. Select it by default in Kconfig. See bug #710790. Thanks to Phil Stracchino
16 sign-file: full functionality with modern LibreSSL
17
18 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
19
20 0000_README | 32 +
21 1500_XATTR_USER_PREFIX.patch | 67 ++
22 ...ble-link-security-restrictions-by-default.patch | 20 +
23 ...zes-only-if-Secure-Simple-Pairing-enabled.patch | 37 ++
24 2700_drm-i915-revert-Implement-Wa-1508744258.patch | 51 ++
25 ...3-Fix-build-issue-by-selecting-CONFIG_REG.patch | 30 +
26 2920_sign-file-patch-for-libressl.patch | 16 +
27 3000_Support-printing-firmware-info.patch | 14 +
28 4567_distro-Gentoo-Kconfig.patch | 2 +-
29 5010_enable-cpu-optimizations-universal.patch | 680 +++++++++++++++++++++
30 10 files changed, 948 insertions(+), 1 deletion(-)
31
32 diff --git a/0000_README b/0000_README
33 index 90189932..419ae990 100644
34 --- a/0000_README
35 +++ b/0000_README
36 @@ -43,6 +43,38 @@ EXPERIMENTAL
37 Individual Patch Descriptions:
38 --------------------------------------------------------------------------
39
40 +Patch: 1500_XATTR_USER_PREFIX.patch
41 +From: https://bugs.gentoo.org/show_bug.cgi?id=470644
42 +Desc: Support for namespace user.pax.* on tmpfs.
43 +
44 +Patch: 1510_fs-enable-link-security-restrictions-by-default.patch
45 +From: http://sources.debian.net/src/linux/3.16.7-ckt4-3/debian/patches/debian/fs-enable-link-security-restrictions-by-default.patch/
46 +Desc: Enable link security restrictions by default.
47 +
48 +Patch: 2000_BT-Check-key-sizes-only-if-Secure-Simple-Pairing-enabled.patch
49 +From: https://lore.kernel.org/linux-bluetooth/20190522070540.48895-1-marcel@××××××××.org/raw
50 +Desc: Bluetooth: Check key sizes only when Secure Simple Pairing is enabled. See bug #686758
51 +
52 +Patch: 2700_drm-i915-revert-Implement-Wa-1508744258.patch
53 +From: https://bugs.gentoo.org/828080
54 +Desc: Revert: drm/i915: Implement Wa_1508744258
55 +
56 +Patch: 2900_tmp513-Fix-build-issue-by-selecting-CONFIG_REG.patch
57 +From: https://bugs.gentoo.org/710790
58 +Desc: tmp513 requies REGMAP_I2C to build. Select it by default in Kconfig. See bug #710790. Thanks to Phil Stracchino
59 +
60 +Patch: 2920_sign-file-patch-for-libressl.patch
61 +From: https://bugs.gentoo.org/717166
62 +Desc: sign-file: full functionality with modern LibreSSL
63 +
64 +Patch: 3000_Support-printing-firmware-info.patch
65 +From: https://bugs.gentoo.org/732852
66 +Desc: Print firmware info (Reqs CONFIG_GENTOO_PRINT_FIRMWARE_INFO). Thanks to Georgy Yakovlev
67 +
68 Patch: 4567_distro-Gentoo-Kconfig.patch
69 From: Tom Wijsman <TomWij@g.o>
70 Desc: Add Gentoo Linux support config settings and defaults.
71 +
72 +Patch: 5010_enable-cpu-optimizations-universal.patch
73 +From: https://github.com/graysky2/kernel_compiler_patch
74 +Desc: Kernel >= 5.15 patch enables gcc = v11.1+ optimizations for additional CPUs.
75
76 diff --git a/1500_XATTR_USER_PREFIX.patch b/1500_XATTR_USER_PREFIX.patch
77 new file mode 100644
78 index 00000000..245dcc29
79 --- /dev/null
80 +++ b/1500_XATTR_USER_PREFIX.patch
81 @@ -0,0 +1,67 @@
82 +From: Anthony G. Basile <blueness@g.o>
83 +
84 +This patch adds support for a restricted user-controlled namespace on
85 +tmpfs filesystem used to house PaX flags. The namespace must be of the
86 +form user.pax.* and its value cannot exceed a size of 8 bytes.
87 +
88 +This is needed even on all Gentoo systems so that XATTR_PAX flags
89 +are preserved for users who might build packages using portage on
90 +a tmpfs system with a non-hardened kernel and then switch to a
91 +hardened kernel with XATTR_PAX enabled.
92 +
93 +The namespace is added to any user with Extended Attribute support
94 +enabled for tmpfs. Users who do not enable xattrs will not have
95 +the XATTR_PAX flags preserved.
96 +
97 +diff --git a/include/uapi/linux/xattr.h b/include/uapi/linux/xattr.h
98 +index 1590c49..5eab462 100644
99 +--- a/include/uapi/linux/xattr.h
100 ++++ b/include/uapi/linux/xattr.h
101 +@@ -73,5 +73,9 @@
102 + #define XATTR_POSIX_ACL_DEFAULT "posix_acl_default"
103 + #define XATTR_NAME_POSIX_ACL_DEFAULT XATTR_SYSTEM_PREFIX XATTR_POSIX_ACL_DEFAULT
104 +
105 ++/* User namespace */
106 ++#define XATTR_PAX_PREFIX XATTR_USER_PREFIX "pax."
107 ++#define XATTR_PAX_FLAGS_SUFFIX "flags"
108 ++#define XATTR_NAME_PAX_FLAGS XATTR_PAX_PREFIX XATTR_PAX_FLAGS_SUFFIX
109 +
110 + #endif /* _UAPI_LINUX_XATTR_H */
111 +--- a/mm/shmem.c 2020-05-04 15:30:27.042035334 -0400
112 ++++ b/mm/shmem.c 2020-05-04 15:34:57.013881725 -0400
113 +@@ -3238,6 +3238,14 @@ static int shmem_xattr_handler_set(const
114 + struct shmem_inode_info *info = SHMEM_I(inode);
115 +
116 + name = xattr_full_name(handler, name);
117 ++
118 ++ if (!strncmp(name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN)) {
119 ++ if (strcmp(name, XATTR_NAME_PAX_FLAGS))
120 ++ return -EOPNOTSUPP;
121 ++ if (size > 8)
122 ++ return -EINVAL;
123 ++ }
124 ++
125 + return simple_xattr_set(&info->xattrs, name, value, size, flags, NULL);
126 + }
127 +
128 +@@ -3253,6 +3261,12 @@ static const struct xattr_handler shmem_
129 + .set = shmem_xattr_handler_set,
130 + };
131 +
132 ++static const struct xattr_handler shmem_user_xattr_handler = {
133 ++ .prefix = XATTR_USER_PREFIX,
134 ++ .get = shmem_xattr_handler_get,
135 ++ .set = shmem_xattr_handler_set,
136 ++};
137 ++
138 + static const struct xattr_handler *shmem_xattr_handlers[] = {
139 + #ifdef CONFIG_TMPFS_POSIX_ACL
140 + &posix_acl_access_xattr_handler,
141 +@@ -3260,6 +3274,7 @@ static const struct xattr_handler *shmem
142 + #endif
143 + &shmem_security_xattr_handler,
144 + &shmem_trusted_xattr_handler,
145 ++ &shmem_user_xattr_handler,
146 + NULL
147 + };
148 +
149
150 diff --git a/1510_fs-enable-link-security-restrictions-by-default.patch b/1510_fs-enable-link-security-restrictions-by-default.patch
151 new file mode 100644
152 index 00000000..f0ed144f
153 --- /dev/null
154 +++ b/1510_fs-enable-link-security-restrictions-by-default.patch
155 @@ -0,0 +1,20 @@
156 +From: Ben Hutchings <ben@××××××××××××.uk>
157 +Subject: fs: Enable link security restrictions by default
158 +Date: Fri, 02 Nov 2012 05:32:06 +0000
159 +Bug-Debian: https://bugs.debian.org/609455
160 +Forwarded: not-needed
161 +This reverts commit 561ec64ae67ef25cac8d72bb9c4bfc955edfd415
162 +('VFS: don't do protected {sym,hard}links by default').
163 +--- a/fs/namei.c 2018-09-28 07:56:07.770005006 -0400
164 ++++ b/fs/namei.c 2018-09-28 07:56:43.370349204 -0400
165 +@@ -885,8 +885,8 @@ static inline void put_link(struct namei
166 + path_put(&last->link);
167 + }
168 +
169 +-int sysctl_protected_symlinks __read_mostly = 0;
170 +-int sysctl_protected_hardlinks __read_mostly = 0;
171 ++int sysctl_protected_symlinks __read_mostly = 1;
172 ++int sysctl_protected_hardlinks __read_mostly = 1;
173 + int sysctl_protected_fifos __read_mostly;
174 + int sysctl_protected_regular __read_mostly;
175 +
176
177 diff --git a/2000_BT-Check-key-sizes-only-if-Secure-Simple-Pairing-enabled.patch b/2000_BT-Check-key-sizes-only-if-Secure-Simple-Pairing-enabled.patch
178 new file mode 100644
179 index 00000000..394ad48f
180 --- /dev/null
181 +++ b/2000_BT-Check-key-sizes-only-if-Secure-Simple-Pairing-enabled.patch
182 @@ -0,0 +1,37 @@
183 +The encryption is only mandatory to be enforced when both sides are using
184 +Secure Simple Pairing and this means the key size check makes only sense
185 +in that case.
186 +
187 +On legacy Bluetooth 2.0 and earlier devices like mice the encryption was
188 +optional and thus causing an issue if the key size check is not bound to
189 +using Secure Simple Pairing.
190 +
191 +Fixes: d5bb334a8e17 ("Bluetooth: Align minimum encryption key size for LE and BR/EDR connections")
192 +Signed-off-by: Marcel Holtmann <marcel@××××××××.org>
193 +Cc: stable@×××××××××××.org
194 +---
195 + net/bluetooth/hci_conn.c | 9 +++++++--
196 + 1 file changed, 7 insertions(+), 2 deletions(-)
197 +
198 +diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
199 +index 3cf0764d5793..7516cdde3373 100644
200 +--- a/net/bluetooth/hci_conn.c
201 ++++ b/net/bluetooth/hci_conn.c
202 +@@ -1272,8 +1272,13 @@ int hci_conn_check_link_mode(struct hci_conn *conn)
203 + return 0;
204 + }
205 +
206 +- if (hci_conn_ssp_enabled(conn) &&
207 +- !test_bit(HCI_CONN_ENCRYPT, &conn->flags))
208 ++ /* If Secure Simple Pairing is not enabled, then legacy connection
209 ++ * setup is used and no encryption or key sizes can be enforced.
210 ++ */
211 ++ if (!hci_conn_ssp_enabled(conn))
212 ++ return 1;
213 ++
214 ++ if (!test_bit(HCI_CONN_ENCRYPT, &conn->flags))
215 + return 0;
216 +
217 + /* The minimum encryption key size needs to be enforced by the
218 +--
219 +2.20.1
220
221 diff --git a/2700_drm-i915-revert-Implement-Wa-1508744258.patch b/2700_drm-i915-revert-Implement-Wa-1508744258.patch
222 new file mode 100644
223 index 00000000..37e60701
224 --- /dev/null
225 +++ b/2700_drm-i915-revert-Implement-Wa-1508744258.patch
226 @@ -0,0 +1,51 @@
227 +From 72641d8d60401a5f1e1a0431ceaf928680d34418 Mon Sep 17 00:00:00 2001
228 +From: =?UTF-8?q?Jos=C3=A9=20Roberto=20de=20Souza?= <jose.souza@×××××.com>
229 +Date: Fri, 19 Nov 2021 06:09:30 -0800
230 +Subject: Revert "drm/i915: Implement Wa_1508744258"
231 +MIME-Version: 1.0
232 +Content-Type: text/plain; charset=UTF-8
233 +Content-Transfer-Encoding: 8bit
234 +
235 +This workarounds are causing hangs, because I missed the fact that it
236 +needs to be enabled for all cases and disabled when doing a resolve
237 +pass.
238 +
239 +So KMD only needs to whitelist it and UMD will be the one setting it
240 +on per case.
241 +
242 +This reverts commit 28ec02c9cbebf3feeaf21a59df9dfbc02bda3362.
243 +
244 +Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/4145
245 +Signed-off-by: José Roberto de Souza <jose.souza@×××××.com>
246 +Fixes: 28ec02c9cbeb ("drm/i915: Implement Wa_1508744258")
247 +Reviewed-by: Matt Atwood <matthew.s.atwood@×××××.com>
248 +Link: https://patchwork.freedesktop.org/patch/msgid/20211119140931.32791-1-jose.souza@×××××.com
249 +(cherry picked from commit f3799ff16fcfacd44aee55db162830df461b631f)
250 +Signed-off-by: Rodrigo Vivi <rodrigo.vivi@×××××.com>
251 +---
252 + drivers/gpu/drm/i915/gt/intel_workarounds.c | 7 -------
253 + 1 file changed, 7 deletions(-)
254 +
255 +(limited to 'drivers/gpu/drm/i915/gt/intel_workarounds.c')
256 +
257 +diff --git a/drivers/gpu/drm/i915/gt/intel_workarounds.c b/drivers/gpu/drm/i915/gt/intel_workarounds.c
258 +index e1f3625308891..ed73d9bc9d40b 100644
259 +--- a/drivers/gpu/drm/i915/gt/intel_workarounds.c
260 ++++ b/drivers/gpu/drm/i915/gt/intel_workarounds.c
261 +@@ -621,13 +621,6 @@ static void gen12_ctx_workarounds_init(struct intel_engine_cs *engine,
262 + FF_MODE2_GS_TIMER_MASK,
263 + FF_MODE2_GS_TIMER_224,
264 + 0, false);
265 +-
266 +- /*
267 +- * Wa_14012131227:dg1
268 +- * Wa_1508744258:tgl,rkl,dg1,adl-s,adl-p
269 +- */
270 +- wa_masked_en(wal, GEN7_COMMON_SLICE_CHICKEN1,
271 +- GEN9_RHWO_OPTIMIZATION_DISABLE);
272 + }
273 +
274 + static void dg1_ctx_workarounds_init(struct intel_engine_cs *engine,
275 +--
276 +cgit 1.2.3-1.el7
277 +
278
279 diff --git a/2900_tmp513-Fix-build-issue-by-selecting-CONFIG_REG.patch b/2900_tmp513-Fix-build-issue-by-selecting-CONFIG_REG.patch
280 new file mode 100644
281 index 00000000..43356857
282 --- /dev/null
283 +++ b/2900_tmp513-Fix-build-issue-by-selecting-CONFIG_REG.patch
284 @@ -0,0 +1,30 @@
285 +From dc328d75a6f37f4ff11a81ae16b1ec88c3197640 Mon Sep 17 00:00:00 2001
286 +From: Mike Pagano <mpagano@g.o>
287 +Date: Mon, 23 Mar 2020 08:20:06 -0400
288 +Subject: [PATCH 1/1] This driver requires REGMAP_I2C to build. Select it by
289 + default in Kconfig. Reported at gentoo bugzilla:
290 + https://bugs.gentoo.org/710790
291 +Cc: mpagano@g.o
292 +
293 +Reported-by: Phil Stracchino <phils@××××××××××.net>
294 +
295 +Signed-off-by: Mike Pagano <mpagano@g.o>
296 +---
297 + drivers/hwmon/Kconfig | 1 +
298 + 1 file changed, 1 insertion(+)
299 +
300 +diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
301 +index 47ac20aee06f..530b4f29ba85 100644
302 +--- a/drivers/hwmon/Kconfig
303 ++++ b/drivers/hwmon/Kconfig
304 +@@ -1769,6 +1769,7 @@ config SENSORS_TMP421
305 + config SENSORS_TMP513
306 + tristate "Texas Instruments TMP513 and compatibles"
307 + depends on I2C
308 ++ select REGMAP_I2C
309 + help
310 + If you say yes here you get support for Texas Instruments TMP512,
311 + and TMP513 temperature and power supply sensor chips.
312 +--
313 +2.24.1
314 +
315
316 diff --git a/2920_sign-file-patch-for-libressl.patch b/2920_sign-file-patch-for-libressl.patch
317 new file mode 100644
318 index 00000000..e6ec017d
319 --- /dev/null
320 +++ b/2920_sign-file-patch-for-libressl.patch
321 @@ -0,0 +1,16 @@
322 +--- a/scripts/sign-file.c 2020-05-20 18:47:21.282820662 -0400
323 ++++ b/scripts/sign-file.c 2020-05-20 18:48:37.991081899 -0400
324 +@@ -41,9 +41,10 @@
325 + * signing with anything other than SHA1 - so we're stuck with that if such is
326 + * the case.
327 + */
328 +-#if defined(LIBRESSL_VERSION_NUMBER) || \
329 +- OPENSSL_VERSION_NUMBER < 0x10000000L || \
330 +- defined(OPENSSL_NO_CMS)
331 ++#if defined(OPENSSL_NO_CMS) || \
332 ++ ( defined(LIBRESSL_VERSION_NUMBER) \
333 ++ && (LIBRESSL_VERSION_NUMBER < 0x3010000fL) ) || \
334 ++ OPENSSL_VERSION_NUMBER < 0x10000000L
335 + #define USE_PKCS7
336 + #endif
337 + #ifndef USE_PKCS7
338
339 diff --git a/3000_Support-printing-firmware-info.patch b/3000_Support-printing-firmware-info.patch
340 new file mode 100644
341 index 00000000..a630cfbe
342 --- /dev/null
343 +++ b/3000_Support-printing-firmware-info.patch
344 @@ -0,0 +1,14 @@
345 +--- a/drivers/base/firmware_loader/main.c 2021-08-24 15:42:07.025482085 -0400
346 ++++ b/drivers/base/firmware_loader/main.c 2021-08-24 15:44:40.782975313 -0400
347 +@@ -809,6 +809,11 @@ _request_firmware(const struct firmware
348 +
349 + ret = _request_firmware_prepare(&fw, name, device, buf, size,
350 + offset, opt_flags);
351 ++
352 ++#ifdef CONFIG_GENTOO_PRINT_FIRMWARE_INFO
353 ++ printk(KERN_NOTICE "Loading firmware: %s\n", name);
354 ++#endif
355 ++
356 + if (ret <= 0) /* error or already assigned */
357 + goto out;
358 +
359
360 diff --git a/4567_distro-Gentoo-Kconfig.patch b/4567_distro-Gentoo-Kconfig.patch
361 index b51dd21b..05570254 100644
362 --- a/4567_distro-Gentoo-Kconfig.patch
363 +++ b/4567_distro-Gentoo-Kconfig.patch
364 @@ -124,7 +124,6 @@
365 + select BPF_SYSCALL
366 + select CGROUP_BPF
367 + select CGROUPS
368 -+ select CHECKPOINT_RESTORE
369 + select CRYPTO_HMAC
370 + select CRYPTO_SHA256
371 + select CRYPTO_USER_API_HASH
372 @@ -136,6 +135,7 @@
373 + select FILE_LOCKING
374 + select INOTIFY_USER
375 + select IPV6
376 ++ select KCMP
377 + select NET
378 + select NET_NS
379 + select PROC_FS
380
381 diff --git a/5010_enable-cpu-optimizations-universal.patch b/5010_enable-cpu-optimizations-universal.patch
382 new file mode 100644
383 index 00000000..becfda36
384 --- /dev/null
385 +++ b/5010_enable-cpu-optimizations-universal.patch
386 @@ -0,0 +1,680 @@
387 +From d31d2b0747ab55e65c2366d51149a0ec9896155e Mon Sep 17 00:00:00 2001
388 +From: graysky <graysky@×××××××××.us>
389 +Date: Tue, 14 Sep 2021 15:35:34 -0400
390 +Subject: [PATCH] more uarches for kernel 5.15+
391 +MIME-Version: 1.0
392 +Content-Type: text/plain; charset=UTF-8
393 +Content-Transfer-Encoding: 8bit
394 +
395 +FEATURES
396 +This patch adds additional CPU options to the Linux kernel accessible under:
397 + Processor type and features --->
398 + Processor family --->
399 +
400 +With the release of gcc 11.1 and clang 12.0, several generic 64-bit levels are
401 +offered which are good for supported Intel or AMD CPUs:
402 +• x86-64-v2
403 +• x86-64-v3
404 +• x86-64-v4
405 +
406 +Users of glibc 2.33 and above can see which level is supported by current
407 +hardware by running:
408 + /lib/ld-linux-x86-64.so.2 --help | grep supported
409 +
410 +Alternatively, compare the flags from /proc/cpuinfo to this list.[1]
411 +
412 +CPU-specific microarchitectures include:
413 +• AMD Improved K8-family
414 +• AMD K10-family
415 +• AMD Family 10h (Barcelona)
416 +• AMD Family 14h (Bobcat)
417 +• AMD Family 16h (Jaguar)
418 +• AMD Family 15h (Bulldozer)
419 +• AMD Family 15h (Piledriver)
420 +• AMD Family 15h (Steamroller)
421 +• AMD Family 15h (Excavator)
422 +• AMD Family 17h (Zen)
423 +• AMD Family 17h (Zen 2)
424 +• AMD Family 19h (Zen 3)†
425 +• Intel Silvermont low-power processors
426 +• Intel Goldmont low-power processors (Apollo Lake and Denverton)
427 +• Intel Goldmont Plus low-power processors (Gemini Lake)
428 +• Intel 1st Gen Core i3/i5/i7 (Nehalem)
429 +• Intel 1.5 Gen Core i3/i5/i7 (Westmere)
430 +• Intel 2nd Gen Core i3/i5/i7 (Sandybridge)
431 +• Intel 3rd Gen Core i3/i5/i7 (Ivybridge)
432 +• Intel 4th Gen Core i3/i5/i7 (Haswell)
433 +• Intel 5th Gen Core i3/i5/i7 (Broadwell)
434 +• Intel 6th Gen Core i3/i5/i7 (Skylake)
435 +• Intel 6th Gen Core i7/i9 (Skylake X)
436 +• Intel 8th Gen Core i3/i5/i7 (Cannon Lake)
437 +• Intel 10th Gen Core i7/i9 (Ice Lake)
438 +• Intel Xeon (Cascade Lake)
439 +• Intel Xeon (Cooper Lake)*
440 +• Intel 3rd Gen 10nm++ i3/i5/i7/i9-family (Tiger Lake)*
441 +• Intel 3rd Gen 10nm++ Xeon (Sapphire Rapids)‡
442 +• Intel 11th Gen i3/i5/i7/i9-family (Rocket Lake)‡
443 +• Intel 12th Gen i3/i5/i7/i9-family (Alder Lake)‡
444 +
445 +Notes: If not otherwise noted, gcc >=9.1 is required for support.
446 + *Requires gcc >=10.1 or clang >=10.0
447 + †Required gcc >=10.3 or clang >=12.0
448 + ‡Required gcc >=11.1 or clang >=12.0
449 +
450 +It also offers to compile passing the 'native' option which, "selects the CPU
451 +to generate code for at compilation time by determining the processor type of
452 +the compiling machine. Using -march=native enables all instruction subsets
453 +supported by the local machine and will produce code optimized for the local
454 +machine under the constraints of the selected instruction set."[2]
455 +
456 +Users of Intel CPUs should select the 'Intel-Native' option and users of AMD
457 +CPUs should select the 'AMD-Native' option.
458 +
459 +MINOR NOTES RELATING TO INTEL ATOM PROCESSORS
460 +This patch also changes -march=atom to -march=bonnell in accordance with the
461 +gcc v4.9 changes. Upstream is using the deprecated -match=atom flags when I
462 +believe it should use the newer -march=bonnell flag for atom processors.[3]
463 +
464 +It is not recommended to compile on Atom-CPUs with the 'native' option.[4] The
465 +recommendation is to use the 'atom' option instead.
466 +
467 +BENEFITS
468 +Small but real speed increases are measurable using a make endpoint comparing
469 +a generic kernel to one built with one of the respective microarchs.
470 +
471 +See the following experimental evidence supporting this statement:
472 +https://github.com/graysky2/kernel_gcc_patch
473 +
474 +REQUIREMENTS
475 +linux version >=5.15
476 +gcc version >=9.0 or clang version >=9.0
477 +
478 +ACKNOWLEDGMENTS
479 +This patch builds on the seminal work by Jeroen.[5]
480 +
481 +REFERENCES
482 +1. https://gitlab.com/x86-psABIs/x86-64-ABI/-/commit/77566eb03bc6a326811cb7e9
483 +2. https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html#index-x86-Options
484 +3. https://bugzilla.kernel.org/show_bug.cgi?id=77461
485 +4. https://github.com/graysky2/kernel_gcc_patch/issues/15
486 +5. http://www.linuxforge.net/docs/linux/linux-gcc.php
487 +
488 +Signed-off-by: graysky <graysky@×××××××××.us>
489 +---
490 +From 1bfa1ef4e3a93e540a64cd1020863019dff3046e Mon Sep 17 00:00:00 2001
491 +From: graysky <graysky@×××××××××.us>
492 +Date: Sun, 14 Nov 2021 16:08:29 -0500
493 +Subject: [PATCH] iiii
494 +
495 +---
496 + arch/x86/Kconfig.cpu | 332 ++++++++++++++++++++++++++++++--
497 + arch/x86/Makefile | 40 +++-
498 + arch/x86/include/asm/vermagic.h | 66 +++++++
499 + 3 files changed, 424 insertions(+), 14 deletions(-)
500 +
501 +diff --git a/arch/x86/Kconfig.cpu b/arch/x86/Kconfig.cpu
502 +index eefc434351db..331f7631339a 100644
503 +--- a/arch/x86/Kconfig.cpu
504 ++++ b/arch/x86/Kconfig.cpu
505 +@@ -157,7 +157,7 @@ config MPENTIUM4
506 +
507 +
508 + config MK6
509 +- bool "K6/K6-II/K6-III"
510 ++ bool "AMD K6/K6-II/K6-III"
511 + depends on X86_32
512 + help
513 + Select this for an AMD K6-family processor. Enables use of
514 +@@ -165,7 +165,7 @@ config MK6
515 + flags to GCC.
516 +
517 + config MK7
518 +- bool "Athlon/Duron/K7"
519 ++ bool "AMD Athlon/Duron/K7"
520 + depends on X86_32
521 + help
522 + Select this for an AMD Athlon K7-family processor. Enables use of
523 +@@ -173,12 +173,98 @@ config MK7
524 + flags to GCC.
525 +
526 + config MK8
527 +- bool "Opteron/Athlon64/Hammer/K8"
528 ++ bool "AMD Opteron/Athlon64/Hammer/K8"
529 + help
530 + Select this for an AMD Opteron or Athlon64 Hammer-family processor.
531 + Enables use of some extended instructions, and passes appropriate
532 + optimization flags to GCC.
533 +
534 ++config MK8SSE3
535 ++ bool "AMD Opteron/Athlon64/Hammer/K8 with SSE3"
536 ++ help
537 ++ Select this for improved AMD Opteron or Athlon64 Hammer-family processors.
538 ++ Enables use of some extended instructions, and passes appropriate
539 ++ optimization flags to GCC.
540 ++
541 ++config MK10
542 ++ bool "AMD 61xx/7x50/PhenomX3/X4/II/K10"
543 ++ help
544 ++ Select this for an AMD 61xx Eight-Core Magny-Cours, Athlon X2 7x50,
545 ++ Phenom X3/X4/II, Athlon II X2/X3/X4, or Turion II-family processor.
546 ++ Enables use of some extended instructions, and passes appropriate
547 ++ optimization flags to GCC.
548 ++
549 ++config MBARCELONA
550 ++ bool "AMD Barcelona"
551 ++ help
552 ++ Select this for AMD Family 10h Barcelona processors.
553 ++
554 ++ Enables -march=barcelona
555 ++
556 ++config MBOBCAT
557 ++ bool "AMD Bobcat"
558 ++ help
559 ++ Select this for AMD Family 14h Bobcat processors.
560 ++
561 ++ Enables -march=btver1
562 ++
563 ++config MJAGUAR
564 ++ bool "AMD Jaguar"
565 ++ help
566 ++ Select this for AMD Family 16h Jaguar processors.
567 ++
568 ++ Enables -march=btver2
569 ++
570 ++config MBULLDOZER
571 ++ bool "AMD Bulldozer"
572 ++ help
573 ++ Select this for AMD Family 15h Bulldozer processors.
574 ++
575 ++ Enables -march=bdver1
576 ++
577 ++config MPILEDRIVER
578 ++ bool "AMD Piledriver"
579 ++ help
580 ++ Select this for AMD Family 15h Piledriver processors.
581 ++
582 ++ Enables -march=bdver2
583 ++
584 ++config MSTEAMROLLER
585 ++ bool "AMD Steamroller"
586 ++ help
587 ++ Select this for AMD Family 15h Steamroller processors.
588 ++
589 ++ Enables -march=bdver3
590 ++
591 ++config MEXCAVATOR
592 ++ bool "AMD Excavator"
593 ++ help
594 ++ Select this for AMD Family 15h Excavator processors.
595 ++
596 ++ Enables -march=bdver4
597 ++
598 ++config MZEN
599 ++ bool "AMD Zen"
600 ++ help
601 ++ Select this for AMD Family 17h Zen processors.
602 ++
603 ++ Enables -march=znver1
604 ++
605 ++config MZEN2
606 ++ bool "AMD Zen 2"
607 ++ help
608 ++ Select this for AMD Family 17h Zen 2 processors.
609 ++
610 ++ Enables -march=znver2
611 ++
612 ++config MZEN3
613 ++ bool "AMD Zen 3"
614 ++ depends on (CC_IS_GCC && GCC_VERSION >= 100300) || (CC_IS_CLANG && CLANG_VERSION >= 120000)
615 ++ help
616 ++ Select this for AMD Family 19h Zen 3 processors.
617 ++
618 ++ Enables -march=znver3
619 ++
620 + config MCRUSOE
621 + bool "Crusoe"
622 + depends on X86_32
623 +@@ -270,7 +356,7 @@ config MPSC
624 + in /proc/cpuinfo. Family 15 is an older Xeon, Family 6 a newer one.
625 +
626 + config MCORE2
627 +- bool "Core 2/newer Xeon"
628 ++ bool "Intel Core 2"
629 + help
630 +
631 + Select this for Intel Core 2 and newer Core 2 Xeons (Xeon 51xx and
632 +@@ -278,6 +364,8 @@ config MCORE2
633 + family in /proc/cpuinfo. Newer ones have 6 and older ones 15
634 + (not a typo)
635 +
636 ++ Enables -march=core2
637 ++
638 + config MATOM
639 + bool "Intel Atom"
640 + help
641 +@@ -287,6 +375,182 @@ config MATOM
642 + accordingly optimized code. Use a recent GCC with specific Atom
643 + support in order to fully benefit from selecting this option.
644 +
645 ++config MNEHALEM
646 ++ bool "Intel Nehalem"
647 ++ select X86_P6_NOP
648 ++ help
649 ++
650 ++ Select this for 1st Gen Core processors in the Nehalem family.
651 ++
652 ++ Enables -march=nehalem
653 ++
654 ++config MWESTMERE
655 ++ bool "Intel Westmere"
656 ++ select X86_P6_NOP
657 ++ help
658 ++
659 ++ Select this for the Intel Westmere formerly Nehalem-C family.
660 ++
661 ++ Enables -march=westmere
662 ++
663 ++config MSILVERMONT
664 ++ bool "Intel Silvermont"
665 ++ select X86_P6_NOP
666 ++ help
667 ++
668 ++ Select this for the Intel Silvermont platform.
669 ++
670 ++ Enables -march=silvermont
671 ++
672 ++config MGOLDMONT
673 ++ bool "Intel Goldmont"
674 ++ select X86_P6_NOP
675 ++ help
676 ++
677 ++ Select this for the Intel Goldmont platform including Apollo Lake and Denverton.
678 ++
679 ++ Enables -march=goldmont
680 ++
681 ++config MGOLDMONTPLUS
682 ++ bool "Intel Goldmont Plus"
683 ++ select X86_P6_NOP
684 ++ help
685 ++
686 ++ Select this for the Intel Goldmont Plus platform including Gemini Lake.
687 ++
688 ++ Enables -march=goldmont-plus
689 ++
690 ++config MSANDYBRIDGE
691 ++ bool "Intel Sandy Bridge"
692 ++ select X86_P6_NOP
693 ++ help
694 ++
695 ++ Select this for 2nd Gen Core processors in the Sandy Bridge family.
696 ++
697 ++ Enables -march=sandybridge
698 ++
699 ++config MIVYBRIDGE
700 ++ bool "Intel Ivy Bridge"
701 ++ select X86_P6_NOP
702 ++ help
703 ++
704 ++ Select this for 3rd Gen Core processors in the Ivy Bridge family.
705 ++
706 ++ Enables -march=ivybridge
707 ++
708 ++config MHASWELL
709 ++ bool "Intel Haswell"
710 ++ select X86_P6_NOP
711 ++ help
712 ++
713 ++ Select this for 4th Gen Core processors in the Haswell family.
714 ++
715 ++ Enables -march=haswell
716 ++
717 ++config MBROADWELL
718 ++ bool "Intel Broadwell"
719 ++ select X86_P6_NOP
720 ++ help
721 ++
722 ++ Select this for 5th Gen Core processors in the Broadwell family.
723 ++
724 ++ Enables -march=broadwell
725 ++
726 ++config MSKYLAKE
727 ++ bool "Intel Skylake"
728 ++ select X86_P6_NOP
729 ++ help
730 ++
731 ++ Select this for 6th Gen Core processors in the Skylake family.
732 ++
733 ++ Enables -march=skylake
734 ++
735 ++config MSKYLAKEX
736 ++ bool "Intel Skylake X"
737 ++ select X86_P6_NOP
738 ++ help
739 ++
740 ++ Select this for 6th Gen Core processors in the Skylake X family.
741 ++
742 ++ Enables -march=skylake-avx512
743 ++
744 ++config MCANNONLAKE
745 ++ bool "Intel Cannon Lake"
746 ++ select X86_P6_NOP
747 ++ help
748 ++
749 ++ Select this for 8th Gen Core processors
750 ++
751 ++ Enables -march=cannonlake
752 ++
753 ++config MICELAKE
754 ++ bool "Intel Ice Lake"
755 ++ select X86_P6_NOP
756 ++ help
757 ++
758 ++ Select this for 10th Gen Core processors in the Ice Lake family.
759 ++
760 ++ Enables -march=icelake-client
761 ++
762 ++config MCASCADELAKE
763 ++ bool "Intel Cascade Lake"
764 ++ select X86_P6_NOP
765 ++ help
766 ++
767 ++ Select this for Xeon processors in the Cascade Lake family.
768 ++
769 ++ Enables -march=cascadelake
770 ++
771 ++config MCOOPERLAKE
772 ++ bool "Intel Cooper Lake"
773 ++ depends on (CC_IS_GCC && GCC_VERSION > 100100) || (CC_IS_CLANG && CLANG_VERSION >= 100000)
774 ++ select X86_P6_NOP
775 ++ help
776 ++
777 ++ Select this for Xeon processors in the Cooper Lake family.
778 ++
779 ++ Enables -march=cooperlake
780 ++
781 ++config MTIGERLAKE
782 ++ bool "Intel Tiger Lake"
783 ++ depends on (CC_IS_GCC && GCC_VERSION > 100100) || (CC_IS_CLANG && CLANG_VERSION >= 100000)
784 ++ select X86_P6_NOP
785 ++ help
786 ++
787 ++ Select this for third-generation 10 nm process processors in the Tiger Lake family.
788 ++
789 ++ Enables -march=tigerlake
790 ++
791 ++config MSAPPHIRERAPIDS
792 ++ bool "Intel Sapphire Rapids"
793 ++ depends on (CC_IS_GCC && GCC_VERSION > 110000) || (CC_IS_CLANG && CLANG_VERSION >= 120000)
794 ++ select X86_P6_NOP
795 ++ help
796 ++
797 ++ Select this for third-generation 10 nm process processors in the Sapphire Rapids family.
798 ++
799 ++ Enables -march=sapphirerapids
800 ++
801 ++config MROCKETLAKE
802 ++ bool "Intel Rocket Lake"
803 ++ depends on (CC_IS_GCC && GCC_VERSION > 110000) || (CC_IS_CLANG && CLANG_VERSION >= 120000)
804 ++ select X86_P6_NOP
805 ++ help
806 ++
807 ++ Select this for eleventh-generation processors in the Rocket Lake family.
808 ++
809 ++ Enables -march=rocketlake
810 ++
811 ++config MALDERLAKE
812 ++ bool "Intel Alder Lake"
813 ++ depends on (CC_IS_GCC && GCC_VERSION > 110000) || (CC_IS_CLANG && CLANG_VERSION >= 120000)
814 ++ select X86_P6_NOP
815 ++ help
816 ++
817 ++ Select this for twelfth-generation processors in the Alder Lake family.
818 ++
819 ++ Enables -march=alderlake
820 ++
821 + config GENERIC_CPU
822 + bool "Generic-x86-64"
823 + depends on X86_64
824 +@@ -294,6 +558,50 @@ config GENERIC_CPU
825 + Generic x86-64 CPU.
826 + Run equally well on all x86-64 CPUs.
827 +
828 ++config GENERIC_CPU2
829 ++ bool "Generic-x86-64-v2"
830 ++ depends on (CC_IS_GCC && GCC_VERSION > 110000) || (CC_IS_CLANG && CLANG_VERSION >= 120000)
831 ++ depends on X86_64
832 ++ help
833 ++ Generic x86-64 CPU.
834 ++ Run equally well on all x86-64 CPUs with min support of x86-64-v2.
835 ++
836 ++config GENERIC_CPU3
837 ++ bool "Generic-x86-64-v3"
838 ++ depends on (CC_IS_GCC && GCC_VERSION > 110000) || (CC_IS_CLANG && CLANG_VERSION >= 120000)
839 ++ depends on X86_64
840 ++ help
841 ++ Generic x86-64-v3 CPU with v3 instructions.
842 ++ Run equally well on all x86-64 CPUs with min support of x86-64-v3.
843 ++
844 ++config GENERIC_CPU4
845 ++ bool "Generic-x86-64-v4"
846 ++ depends on (CC_IS_GCC && GCC_VERSION > 110000) || (CC_IS_CLANG && CLANG_VERSION >= 120000)
847 ++ depends on X86_64
848 ++ help
849 ++ Generic x86-64 CPU with v4 instructions.
850 ++ Run equally well on all x86-64 CPUs with min support of x86-64-v4.
851 ++
852 ++config MNATIVE_INTEL
853 ++ bool "Intel-Native optimizations autodetected by the compiler"
854 ++ help
855 ++
856 ++ Clang 3.8, GCC 4.2 and above support -march=native, which automatically detects
857 ++ the optimum settings to use based on your processor. Do NOT use this
858 ++ for AMD CPUs. Intel Only!
859 ++
860 ++ Enables -march=native
861 ++
862 ++config MNATIVE_AMD
863 ++ bool "AMD-Native optimizations autodetected by the compiler"
864 ++ help
865 ++
866 ++ Clang 3.8, GCC 4.2 and above support -march=native, which automatically detects
867 ++ the optimum settings to use based on your processor. Do NOT use this
868 ++ for Intel CPUs. AMD Only!
869 ++
870 ++ Enables -march=native
871 ++
872 + endchoice
873 +
874 + config X86_GENERIC
875 +@@ -318,7 +626,7 @@ config X86_INTERNODE_CACHE_SHIFT
876 + config X86_L1_CACHE_SHIFT
877 + int
878 + default "7" if MPENTIUM4 || MPSC
879 +- default "6" if MK7 || MK8 || MPENTIUMM || MCORE2 || MATOM || MVIAC7 || X86_GENERIC || GENERIC_CPU
880 ++ default "6" if MK7 || MK8 || MPENTIUMM || MCORE2 || MATOM || MVIAC7 || MK8SSE3 || MK10 || MBARCELONA || MBOBCAT || MJAGUAR || MBULLDOZER || MPILEDRIVER || MSTEAMROLLER || MEXCAVATOR || MZEN || MZEN2 || MZEN3 || MNEHALEM || MWESTMERE || MSILVERMONT || MGOLDMONT || MGOLDMONTPLUS || MSANDYBRIDGE || MIVYBRIDGE || MHASWELL || MBROADWELL || MSKYLAKE || MSKYLAKEX || MCANNONLAKE || MICELAKE || MCASCADELAKE || MCOOPERLAKE || MTIGERLAKE || MSAPPHIRERAPIDS || MROCKETLAKE || MALDERLAKE || MNATIVE_INTEL || MNATIVE_AMD || X86_GENERIC || GENERIC_CPU || GENERIC_CPU2 || GENERIC_CPU3 || GENERIC_CPU4
881 + default "4" if MELAN || M486SX || M486 || MGEODEGX1
882 + default "5" if MWINCHIP3D || MWINCHIPC6 || MCRUSOE || MEFFICEON || MCYRIXIII || MK6 || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || M586 || MVIAC3_2 || MGEODE_LX
883 +
884 +@@ -336,11 +644,11 @@ config X86_ALIGNMENT_16
885 +
886 + config X86_INTEL_USERCOPY
887 + def_bool y
888 +- depends on MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M586MMX || X86_GENERIC || MK8 || MK7 || MEFFICEON || MCORE2
889 ++ depends on MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M586MMX || X86_GENERIC || MK8 || MK7 || MEFFICEON || MCORE2 || MNEHALEM || MWESTMERE || MSILVERMONT || MGOLDMONT || MGOLDMONTPLUS || MSANDYBRIDGE || MIVYBRIDGE || MHASWELL || MBROADWELL || MSKYLAKE || MSKYLAKEX || MCANNONLAKE || MICELAKE || MCASCADELAKE || MCOOPERLAKE || MTIGERLAKE || MSAPPHIRERAPIDS || MROCKETLAKE || MALDERLAKE || MNATIVE_INTEL
890 +
891 + config X86_USE_PPRO_CHECKSUM
892 + def_bool y
893 +- depends on MWINCHIP3D || MWINCHIPC6 || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MK8 || MVIAC3_2 || MVIAC7 || MEFFICEON || MGEODE_LX || MCORE2 || MATOM
894 ++ depends on MWINCHIP3D || MWINCHIPC6 || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MK8 || MVIAC3_2 || MVIAC7 || MEFFICEON || MGEODE_LX || MCORE2 || MATOM || MK8SSE3 || MK10 || MBARCELONA || MBOBCAT || MJAGUAR || MBULLDOZER || MPILEDRIVER || MSTEAMROLLER || MEXCAVATOR || MZEN || MZEN2 || MZEN3 || MNEHALEM || MWESTMERE || MSILVERMONT || MGOLDMONT || MGOLDMONTPLUS || MSANDYBRIDGE || MIVYBRIDGE || MHASWELL || MBROADWELL || MSKYLAKE || MSKYLAKEX || MCANNONLAKE || MICELAKE || MCASCADELAKE || MCOOPERLAKE || MTIGERLAKE || MSAPPHIRERAPIDS || MROCKETLAKE || MALDERLAKE || MNATIVE_INTEL || MNATIVE_AMD
895 +
896 + config X86_USE_3DNOW
897 + def_bool y
898 +@@ -360,26 +668,26 @@ config X86_USE_3DNOW
899 + config X86_P6_NOP
900 + def_bool y
901 + depends on X86_64
902 +- depends on (MCORE2 || MPENTIUM4 || MPSC)
903 ++ depends on (MCORE2 || MPENTIUM4 || MPSC || MNEHALEM || MWESTMERE || MSILVERMONT || MGOLDMONT || MGOLDMONTPLUS || MSANDYBRIDGE || MIVYBRIDGE || MHASWELL || MBROADWELL || MSKYLAKE || MSKYLAKEX || MCANNONLAKE || MICELAKE || MCASCADELAKE || MCOOPERLAKE || MTIGERLAKE || MSAPPHIRERAPIDS || MROCKETLAKE || MALDERLAKE || MNATIVE_INTEL)
904 +
905 + config X86_TSC
906 + def_bool y
907 +- 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
908 ++ depends on (MWINCHIP3D || MCRUSOE || MEFFICEON || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || MK8 || MVIAC3_2 || MVIAC7 || MGEODEGX1 || MGEODE_LX || MCORE2 || MATOM || MK8SSE3 || MK10 || MBARCELONA || MBOBCAT || MJAGUAR || MBULLDOZER || MPILEDRIVER || MSTEAMROLLER || MEXCAVATOR || MZEN || MZEN2 || MZEN3 || MNEHALEM || MWESTMERE || MSILVERMONT || MGOLDMONT || MGOLDMONTPLUS || MSANDYBRIDGE || MIVYBRIDGE || MHASWELL || MBROADWELL || MSKYLAKE || MSKYLAKEX || MCANNONLAKE || MICELAKE || MCASCADELAKE || MCOOPERLAKE || MTIGERLAKE || MSAPPHIRERAPIDS || MROCKETLAKE || MALDERLAKE || MNATIVE_INTEL || MNATIVE_AMD) || X86_64
909 +
910 + config X86_CMPXCHG64
911 + def_bool y
912 +- depends on X86_PAE || X86_64 || MCORE2 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || M586TSC || M586MMX || MATOM || MGEODE_LX || MGEODEGX1 || MK6 || MK7 || MK8
913 ++ depends on X86_PAE || X86_64 || MCORE2 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || M586TSC || M586MMX || MATOM || MGEODE_LX || MGEODEGX1 || MK6 || MK7 || MK8 || MK8SSE3 || MK10 || MBARCELONA || MBOBCAT || MJAGUAR || MBULLDOZER || MPILEDRIVER || MSTEAMROLLER || MEXCAVATOR || MZEN || MZEN2 || MZEN3 || MNEHALEM || MWESTMERE || MSILVERMONT || MGOLDMONT || MGOLDMONTPLUS || MSANDYBRIDGE || MIVYBRIDGE || MHASWELL || MBROADWELL || MSKYLAKE || MSKYLAKEX || MCANNONLAKE || MICELAKE || MCASCADELAKE || MCOOPERLAKE || MTIGERLAKE || MSAPPHIRERAPIDS || MROCKETLAKE || MALDERLAKE || MNATIVE_INTEL || MNATIVE_AMD
914 +
915 + # this should be set for all -march=.. options where the compiler
916 + # generates cmov.
917 + config X86_CMOV
918 + def_bool y
919 +- depends on (MK8 || MK7 || MCORE2 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MVIAC3_2 || MVIAC7 || MCRUSOE || MEFFICEON || X86_64 || MATOM || MGEODE_LX)
920 ++ depends on (MK8 || MK7 || MCORE2 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MVIAC3_2 || MVIAC7 || MCRUSOE || MEFFICEON || X86_64 || MATOM || MGEODE_LX || MK8SSE3 || MK10 || MBARCELONA || MBOBCAT || MJAGUAR || MBULLDOZER || MPILEDRIVER || MSTEAMROLLER || MEXCAVATOR || MZEN || MZEN2 || MZEN3 || MNEHALEM || MWESTMERE || MSILVERMONT || MGOLDMONT || MGOLDMONTPLUS || MSANDYBRIDGE || MIVYBRIDGE || MHASWELL || MBROADWELL || MSKYLAKE || MSKYLAKEX || MCANNONLAKE || MICELAKE || MCASCADELAKE || MCOOPERLAKE || MTIGERLAKE || MSAPPHIRERAPIDS || MROCKETLAKE || MALDERLAKE || MNATIVE_INTEL || MNATIVE_AMD)
921 +
922 + config X86_MINIMUM_CPU_FAMILY
923 + int
924 + default "64" if X86_64
925 +- default "6" if X86_32 && (MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MVIAC3_2 || MVIAC7 || MEFFICEON || MATOM || MCRUSOE || MCORE2 || MK7 || MK8)
926 ++ default "6" if X86_32 && (MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MVIAC3_2 || MVIAC7 || MEFFICEON || MATOM || MCRUSOE || MCORE2 || MK7 || MK8 || MK8SSE3 || MK10 || MBARCELONA || MBOBCAT || MJAGUAR || MBULLDOZER || MPILEDRIVER || MSTEAMROLLER || MEXCAVATOR || MZEN || MZEN2 || MZEN3 || MNEHALEM || MWESTMERE || MSILVERMONT || MGOLDMONT || MGOLDMONTPLUS || MSANDYBRIDGE || MIVYBRIDGE || MHASWELL || MBROADWELL || MSKYLAKE || MSKYLAKEX || MCANNONLAKE || MICELAKE || MCASCADELAKE || MCOOPERLAKE || MTIGERLAKE || MSAPPHIRERAPIDS || MROCKETLAKE || MALDERLAKE || MNATIVE_INTEL || MNATIVE_AMD)
927 + default "5" if X86_32 && X86_CMPXCHG64
928 + default "4"
929 +
930 +diff --git a/arch/x86/Makefile b/arch/x86/Makefile
931 +index 42243869216d..ab1ad6959b96 100644
932 +--- a/arch/x86/Makefile
933 ++++ b/arch/x86/Makefile
934 +@@ -119,8 +119,44 @@ else
935 + # FIXME - should be integrated in Makefile.cpu (Makefile_32.cpu)
936 + cflags-$(CONFIG_MK8) += -march=k8
937 + cflags-$(CONFIG_MPSC) += -march=nocona
938 +- cflags-$(CONFIG_MCORE2) += -march=core2
939 +- cflags-$(CONFIG_MATOM) += -march=atom
940 ++ cflags-$(CONFIG_MK8SSE3) += -march=k8-sse3
941 ++ cflags-$(CONFIG_MK10) += -march=amdfam10
942 ++ cflags-$(CONFIG_MBARCELONA) += -march=barcelona
943 ++ cflags-$(CONFIG_MBOBCAT) += -march=btver1
944 ++ cflags-$(CONFIG_MJAGUAR) += -march=btver2
945 ++ cflags-$(CONFIG_MBULLDOZER) += -march=bdver1
946 ++ cflags-$(CONFIG_MPILEDRIVER) += -march=bdver2 -mno-tbm
947 ++ cflags-$(CONFIG_MSTEAMROLLER) += -march=bdver3 -mno-tbm
948 ++ cflags-$(CONFIG_MEXCAVATOR) += -march=bdver4 -mno-tbm
949 ++ cflags-$(CONFIG_MZEN) += -march=znver1
950 ++ cflags-$(CONFIG_MZEN2) += -march=znver2
951 ++ cflags-$(CONFIG_MZEN3) += -march=znver3
952 ++ cflags-$(CONFIG_MNATIVE_INTEL) += -march=native
953 ++ cflags-$(CONFIG_MNATIVE_AMD) += -march=native
954 ++ cflags-$(CONFIG_MATOM) += -march=bonnell
955 ++ cflags-$(CONFIG_MCORE2) += -march=core2
956 ++ cflags-$(CONFIG_MNEHALEM) += -march=nehalem
957 ++ cflags-$(CONFIG_MWESTMERE) += -march=westmere
958 ++ cflags-$(CONFIG_MSILVERMONT) += -march=silvermont
959 ++ cflags-$(CONFIG_MGOLDMONT) += -march=goldmont
960 ++ cflags-$(CONFIG_MGOLDMONTPLUS) += -march=goldmont-plus
961 ++ cflags-$(CONFIG_MSANDYBRIDGE) += -march=sandybridge
962 ++ cflags-$(CONFIG_MIVYBRIDGE) += -march=ivybridge
963 ++ cflags-$(CONFIG_MHASWELL) += -march=haswell
964 ++ cflags-$(CONFIG_MBROADWELL) += -march=broadwell
965 ++ cflags-$(CONFIG_MSKYLAKE) += -march=skylake
966 ++ cflags-$(CONFIG_MSKYLAKEX) += -march=skylake-avx512
967 ++ cflags-$(CONFIG_MCANNONLAKE) += -march=cannonlake
968 ++ cflags-$(CONFIG_MICELAKE) += -march=icelake-client
969 ++ cflags-$(CONFIG_MCASCADELAKE) += -march=cascadelake
970 ++ cflags-$(CONFIG_MCOOPERLAKE) += -march=cooperlake
971 ++ cflags-$(CONFIG_MTIGERLAKE) += -march=tigerlake
972 ++ cflags-$(CONFIG_MSAPPHIRERAPIDS) += -march=sapphirerapids
973 ++ cflags-$(CONFIG_MROCKETLAKE) += -march=rocketlake
974 ++ cflags-$(CONFIG_MALDERLAKE) += -march=alderlake
975 ++ cflags-$(CONFIG_GENERIC_CPU2) += -march=x86-64-v2
976 ++ cflags-$(CONFIG_GENERIC_CPU3) += -march=x86-64-v3
977 ++ cflags-$(CONFIG_GENERIC_CPU4) += -march=x86-64-v4
978 + cflags-$(CONFIG_GENERIC_CPU) += -mtune=generic
979 + KBUILD_CFLAGS += $(cflags-y)
980 +
981 +diff --git a/arch/x86/include/asm/vermagic.h b/arch/x86/include/asm/vermagic.h
982 +index 75884d2cdec3..4e6a08d4c7e5 100644
983 +--- a/arch/x86/include/asm/vermagic.h
984 ++++ b/arch/x86/include/asm/vermagic.h
985 +@@ -17,6 +17,48 @@
986 + #define MODULE_PROC_FAMILY "586MMX "
987 + #elif defined CONFIG_MCORE2
988 + #define MODULE_PROC_FAMILY "CORE2 "
989 ++#elif defined CONFIG_MNATIVE_INTEL
990 ++#define MODULE_PROC_FAMILY "NATIVE_INTEL "
991 ++#elif defined CONFIG_MNATIVE_AMD
992 ++#define MODULE_PROC_FAMILY "NATIVE_AMD "
993 ++#elif defined CONFIG_MNEHALEM
994 ++#define MODULE_PROC_FAMILY "NEHALEM "
995 ++#elif defined CONFIG_MWESTMERE
996 ++#define MODULE_PROC_FAMILY "WESTMERE "
997 ++#elif defined CONFIG_MSILVERMONT
998 ++#define MODULE_PROC_FAMILY "SILVERMONT "
999 ++#elif defined CONFIG_MGOLDMONT
1000 ++#define MODULE_PROC_FAMILY "GOLDMONT "
1001 ++#elif defined CONFIG_MGOLDMONTPLUS
1002 ++#define MODULE_PROC_FAMILY "GOLDMONTPLUS "
1003 ++#elif defined CONFIG_MSANDYBRIDGE
1004 ++#define MODULE_PROC_FAMILY "SANDYBRIDGE "
1005 ++#elif defined CONFIG_MIVYBRIDGE
1006 ++#define MODULE_PROC_FAMILY "IVYBRIDGE "
1007 ++#elif defined CONFIG_MHASWELL
1008 ++#define MODULE_PROC_FAMILY "HASWELL "
1009 ++#elif defined CONFIG_MBROADWELL
1010 ++#define MODULE_PROC_FAMILY "BROADWELL "
1011 ++#elif defined CONFIG_MSKYLAKE
1012 ++#define MODULE_PROC_FAMILY "SKYLAKE "
1013 ++#elif defined CONFIG_MSKYLAKEX
1014 ++#define MODULE_PROC_FAMILY "SKYLAKEX "
1015 ++#elif defined CONFIG_MCANNONLAKE
1016 ++#define MODULE_PROC_FAMILY "CANNONLAKE "
1017 ++#elif defined CONFIG_MICELAKE
1018 ++#define MODULE_PROC_FAMILY "ICELAKE "
1019 ++#elif defined CONFIG_MCASCADELAKE
1020 ++#define MODULE_PROC_FAMILY "CASCADELAKE "
1021 ++#elif defined CONFIG_MCOOPERLAKE
1022 ++#define MODULE_PROC_FAMILY "COOPERLAKE "
1023 ++#elif defined CONFIG_MTIGERLAKE
1024 ++#define MODULE_PROC_FAMILY "TIGERLAKE "
1025 ++#elif defined CONFIG_MSAPPHIRERAPIDS
1026 ++#define MODULE_PROC_FAMILY "SAPPHIRERAPIDS "
1027 ++#elif defined CONFIG_ROCKETLAKE
1028 ++#define MODULE_PROC_FAMILY "ROCKETLAKE "
1029 ++#elif defined CONFIG_MALDERLAKE
1030 ++#define MODULE_PROC_FAMILY "ALDERLAKE "
1031 + #elif defined CONFIG_MATOM
1032 + #define MODULE_PROC_FAMILY "ATOM "
1033 + #elif defined CONFIG_M686
1034 +@@ -35,6 +77,30 @@
1035 + #define MODULE_PROC_FAMILY "K7 "
1036 + #elif defined CONFIG_MK8
1037 + #define MODULE_PROC_FAMILY "K8 "
1038 ++#elif defined CONFIG_MK8SSE3
1039 ++#define MODULE_PROC_FAMILY "K8SSE3 "
1040 ++#elif defined CONFIG_MK10
1041 ++#define MODULE_PROC_FAMILY "K10 "
1042 ++#elif defined CONFIG_MBARCELONA
1043 ++#define MODULE_PROC_FAMILY "BARCELONA "
1044 ++#elif defined CONFIG_MBOBCAT
1045 ++#define MODULE_PROC_FAMILY "BOBCAT "
1046 ++#elif defined CONFIG_MBULLDOZER
1047 ++#define MODULE_PROC_FAMILY "BULLDOZER "
1048 ++#elif defined CONFIG_MPILEDRIVER
1049 ++#define MODULE_PROC_FAMILY "PILEDRIVER "
1050 ++#elif defined CONFIG_MSTEAMROLLER
1051 ++#define MODULE_PROC_FAMILY "STEAMROLLER "
1052 ++#elif defined CONFIG_MJAGUAR
1053 ++#define MODULE_PROC_FAMILY "JAGUAR "
1054 ++#elif defined CONFIG_MEXCAVATOR
1055 ++#define MODULE_PROC_FAMILY "EXCAVATOR "
1056 ++#elif defined CONFIG_MZEN
1057 ++#define MODULE_PROC_FAMILY "ZEN "
1058 ++#elif defined CONFIG_MZEN2
1059 ++#define MODULE_PROC_FAMILY "ZEN2 "
1060 ++#elif defined CONFIG_MZEN3
1061 ++#define MODULE_PROC_FAMILY "ZEN3 "
1062 + #elif defined CONFIG_MELAN
1063 + #define MODULE_PROC_FAMILY "ELAN "
1064 + #elif defined CONFIG_MCRUSOE
1065 +--
1066 +2.33.1