hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/arch/powerpc/kernel/cputable.c
....@@ -1,13 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Copyright (C) 2001 Ben. Herrenschmidt (benh@kernel.crashing.org)
34 *
45 * Modifications for ppc64:
56 * Copyright (C) 2003 Dave Engebretsen <engebret@us.ibm.com>
6
- *
7
- * This program is free software; you can redistribute it and/or
8
- * modify it under the terms of the GNU General Public License
9
- * as published by the Free Software Foundation; either version
10
- * 2 of the License, or (at your option) any later version.
117 */
128
139 #include <linux/string.h>
....@@ -20,6 +16,7 @@
2016 #include <asm/oprofile_impl.h>
2117 #include <asm/cputable.h>
2218 #include <asm/prom.h> /* for PTRRELOC on ARCH=ppc */
19
+#include <asm/mce.h>
2320 #include <asm/mmu.h>
2421 #include <asm/setup.h>
2522
....@@ -63,17 +60,12 @@
6360 extern void __setup_cpu_745x(unsigned long offset, struct cpu_spec* spec);
6461 #endif /* CONFIG_PPC32 */
6562 #ifdef CONFIG_PPC64
63
+#include <asm/cpu_setup_power.h>
6664 extern void __setup_cpu_ppc970(unsigned long offset, struct cpu_spec* spec);
6765 extern void __setup_cpu_ppc970MP(unsigned long offset, struct cpu_spec* spec);
6866 extern void __setup_cpu_pa6t(unsigned long offset, struct cpu_spec* spec);
6967 extern void __restore_cpu_pa6t(void);
7068 extern void __restore_cpu_ppc970(void);
71
-extern void __setup_cpu_power7(unsigned long offset, struct cpu_spec* spec);
72
-extern void __restore_cpu_power7(void);
73
-extern void __setup_cpu_power8(unsigned long offset, struct cpu_spec* spec);
74
-extern void __restore_cpu_power8(void);
75
-extern void __setup_cpu_power9(unsigned long offset, struct cpu_spec* spec);
76
-extern void __restore_cpu_power9(void);
7769 extern long __machine_check_early_realmode_p7(struct pt_regs *regs);
7870 extern long __machine_check_early_realmode_p8(struct pt_regs *regs);
7971 extern long __machine_check_early_realmode_p9(struct pt_regs *regs);
....@@ -122,7 +114,19 @@
122114 #define COMMON_USER2_POWER9 (COMMON_USER2_POWER8 | \
123115 PPC_FEATURE2_ARCH_3_00 | \
124116 PPC_FEATURE2_HAS_IEEE128 | \
125
- PPC_FEATURE2_DARN )
117
+ PPC_FEATURE2_DARN | \
118
+ PPC_FEATURE2_SCV)
119
+#define COMMON_USER_POWER10 COMMON_USER_POWER9
120
+#define COMMON_USER2_POWER10 (PPC_FEATURE2_ARCH_3_1 | \
121
+ PPC_FEATURE2_MMA | \
122
+ PPC_FEATURE2_ARCH_3_00 | \
123
+ PPC_FEATURE2_HAS_IEEE128 | \
124
+ PPC_FEATURE2_DARN | \
125
+ PPC_FEATURE2_SCV | \
126
+ PPC_FEATURE2_ARCH_2_07 | \
127
+ PPC_FEATURE2_DSCR | \
128
+ PPC_FEATURE2_ISEL | PPC_FEATURE2_TAR | \
129
+ PPC_FEATURE2_VEC_CRYPTO)
126130
127131 #ifdef CONFIG_PPC_BOOK3E_64
128132 #define COMMON_USER_BOOKE (COMMON_USER_PPC64 | PPC_FEATURE_BOOKE)
....@@ -371,6 +375,22 @@
371375 .cpu_restore = __restore_cpu_power9,
372376 .platform = "power9",
373377 },
378
+ { /* 3.1-compliant processor, i.e. Power10 "architected" mode */
379
+ .pvr_mask = 0xffffffff,
380
+ .pvr_value = 0x0f000006,
381
+ .cpu_name = "POWER10 (architected)",
382
+ .cpu_features = CPU_FTRS_POWER10,
383
+ .cpu_user_features = COMMON_USER_POWER10,
384
+ .cpu_user_features2 = COMMON_USER2_POWER10,
385
+ .mmu_features = MMU_FTRS_POWER10,
386
+ .icache_bsize = 128,
387
+ .dcache_bsize = 128,
388
+ .oprofile_type = PPC_OPROFILE_INVALID,
389
+ .oprofile_cpu_type = "ppc64/ibm-compat-v1",
390
+ .cpu_setup = __setup_cpu_power10,
391
+ .cpu_restore = __restore_cpu_power10,
392
+ .platform = "power10",
393
+ },
374394 { /* Power7 */
375395 .pvr_mask = 0xffff0000,
376396 .pvr_value = 0x003f0000,
....@@ -523,6 +543,25 @@
523543 .machine_check_early = __machine_check_early_realmode_p9,
524544 .platform = "power9",
525545 },
546
+ { /* Power10 */
547
+ .pvr_mask = 0xffff0000,
548
+ .pvr_value = 0x00800000,
549
+ .cpu_name = "POWER10 (raw)",
550
+ .cpu_features = CPU_FTRS_POWER10,
551
+ .cpu_user_features = COMMON_USER_POWER10,
552
+ .cpu_user_features2 = COMMON_USER2_POWER10,
553
+ .mmu_features = MMU_FTRS_POWER10,
554
+ .icache_bsize = 128,
555
+ .dcache_bsize = 128,
556
+ .num_pmcs = 6,
557
+ .pmc_type = PPC_PMC_IBM,
558
+ .oprofile_cpu_type = "ppc64/power10",
559
+ .oprofile_type = PPC_OPROFILE_INVALID,
560
+ .cpu_setup = __setup_cpu_power10,
561
+ .cpu_restore = __restore_cpu_power10,
562
+ .machine_check_early = __machine_check_early_realmode_p10,
563
+ .platform = "power10",
564
+ },
526565 { /* Cell Broadband Engine */
527566 .pvr_mask = 0xffff0000,
528567 .pvr_value = 0x00700000,
....@@ -573,20 +612,7 @@
573612 #endif /* CONFIG_PPC_BOOK3S_64 */
574613
575614 #ifdef CONFIG_PPC32
576
-#ifdef CONFIG_PPC_BOOK3S_32
577
- { /* 601 */
578
- .pvr_mask = 0xffff0000,
579
- .pvr_value = 0x00010000,
580
- .cpu_name = "601",
581
- .cpu_features = CPU_FTRS_PPC601,
582
- .cpu_user_features = COMMON_USER | PPC_FEATURE_601_INSTR |
583
- PPC_FEATURE_UNIFIED_CACHE | PPC_FEATURE_NO_TB,
584
- .mmu_features = MMU_FTR_HPTE_TABLE,
585
- .icache_bsize = 32,
586
- .dcache_bsize = 32,
587
- .machine_check = machine_check_generic,
588
- .platform = "ppc601",
589
- },
615
+#ifdef CONFIG_PPC_BOOK3S_6xx
590616 { /* 603 */
591617 .pvr_mask = 0xffff0000,
592618 .pvr_value = 0x00030000,
....@@ -1216,7 +1242,7 @@
12161242 .machine_check = machine_check_generic,
12171243 .platform = "ppc603",
12181244 },
1219
-#endif /* CONFIG_PPC_BOOK3S_32 */
1245
+#endif /* CONFIG_PPC_BOOK3S_6xx */
12201246 #ifdef CONFIG_PPC_8xx
12211247 { /* 8xx */
12221248 .pvr_mask = 0xffff0000,
....@@ -1234,69 +1260,6 @@
12341260 },
12351261 #endif /* CONFIG_PPC_8xx */
12361262 #ifdef CONFIG_40x
1237
- { /* 403GC */
1238
- .pvr_mask = 0xffffff00,
1239
- .pvr_value = 0x00200200,
1240
- .cpu_name = "403GC",
1241
- .cpu_features = CPU_FTRS_40X,
1242
- .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU,
1243
- .mmu_features = MMU_FTR_TYPE_40x,
1244
- .icache_bsize = 16,
1245
- .dcache_bsize = 16,
1246
- .machine_check = machine_check_4xx,
1247
- .platform = "ppc403",
1248
- },
1249
- { /* 403GCX */
1250
- .pvr_mask = 0xffffff00,
1251
- .pvr_value = 0x00201400,
1252
- .cpu_name = "403GCX",
1253
- .cpu_features = CPU_FTRS_40X,
1254
- .cpu_user_features = PPC_FEATURE_32 |
1255
- PPC_FEATURE_HAS_MMU | PPC_FEATURE_NO_TB,
1256
- .mmu_features = MMU_FTR_TYPE_40x,
1257
- .icache_bsize = 16,
1258
- .dcache_bsize = 16,
1259
- .machine_check = machine_check_4xx,
1260
- .platform = "ppc403",
1261
- },
1262
- { /* 403G ?? */
1263
- .pvr_mask = 0xffff0000,
1264
- .pvr_value = 0x00200000,
1265
- .cpu_name = "403G ??",
1266
- .cpu_features = CPU_FTRS_40X,
1267
- .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU,
1268
- .mmu_features = MMU_FTR_TYPE_40x,
1269
- .icache_bsize = 16,
1270
- .dcache_bsize = 16,
1271
- .machine_check = machine_check_4xx,
1272
- .platform = "ppc403",
1273
- },
1274
- { /* 405GP */
1275
- .pvr_mask = 0xffff0000,
1276
- .pvr_value = 0x40110000,
1277
- .cpu_name = "405GP",
1278
- .cpu_features = CPU_FTRS_40X,
1279
- .cpu_user_features = PPC_FEATURE_32 |
1280
- PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
1281
- .mmu_features = MMU_FTR_TYPE_40x,
1282
- .icache_bsize = 32,
1283
- .dcache_bsize = 32,
1284
- .machine_check = machine_check_4xx,
1285
- .platform = "ppc405",
1286
- },
1287
- { /* STB 03xxx */
1288
- .pvr_mask = 0xffff0000,
1289
- .pvr_value = 0x40130000,
1290
- .cpu_name = "STB03xxx",
1291
- .cpu_features = CPU_FTRS_40X,
1292
- .cpu_user_features = PPC_FEATURE_32 |
1293
- PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
1294
- .mmu_features = MMU_FTR_TYPE_40x,
1295
- .icache_bsize = 32,
1296
- .dcache_bsize = 32,
1297
- .machine_check = machine_check_4xx,
1298
- .platform = "ppc405",
1299
- },
13001263 { /* STB 04xxx */
13011264 .pvr_mask = 0xffff0000,
13021265 .pvr_value = 0x41810000,
....@@ -1381,32 +1344,6 @@
13811344 .cpu_name = "405LP",
13821345 .cpu_features = CPU_FTRS_40X,
13831346 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU,
1384
- .mmu_features = MMU_FTR_TYPE_40x,
1385
- .icache_bsize = 32,
1386
- .dcache_bsize = 32,
1387
- .machine_check = machine_check_4xx,
1388
- .platform = "ppc405",
1389
- },
1390
- { /* Xilinx Virtex-II Pro */
1391
- .pvr_mask = 0xfffff000,
1392
- .pvr_value = 0x20010000,
1393
- .cpu_name = "Virtex-II Pro",
1394
- .cpu_features = CPU_FTRS_40X,
1395
- .cpu_user_features = PPC_FEATURE_32 |
1396
- PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
1397
- .mmu_features = MMU_FTR_TYPE_40x,
1398
- .icache_bsize = 32,
1399
- .dcache_bsize = 32,
1400
- .machine_check = machine_check_4xx,
1401
- .platform = "ppc405",
1402
- },
1403
- { /* Xilinx Virtex-4 FX */
1404
- .pvr_mask = 0xfffff000,
1405
- .pvr_value = 0x20011000,
1406
- .cpu_name = "Virtex-4 FX",
1407
- .cpu_features = CPU_FTRS_40X,
1408
- .cpu_user_features = PPC_FEATURE_32 |
1409
- PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
14101347 .mmu_features = MMU_FTR_TYPE_40x,
14111348 .icache_bsize = 32,
14121349 .dcache_bsize = 32,
....@@ -1802,19 +1739,6 @@
18021739 .machine_check = machine_check_440A,
18031740 .platform = "ppc440",
18041741 },
1805
- { /* 440 in Xilinx Virtex-5 FXT */
1806
- .pvr_mask = 0xfffffff0,
1807
- .pvr_value = 0x7ff21910,
1808
- .cpu_name = "440 in Virtex-5 FXT",
1809
- .cpu_features = CPU_FTRS_44X,
1810
- .cpu_user_features = COMMON_USER_BOOKE,
1811
- .mmu_features = MMU_FTR_TYPE_44x,
1812
- .icache_bsize = 32,
1813
- .dcache_bsize = 32,
1814
- .cpu_setup = __setup_cpu_440x5,
1815
- .machine_check = machine_check_440A,
1816
- .platform = "ppc440",
1817
- },
18181742 { /* 460EX */
18191743 .pvr_mask = 0xffff0006,
18201744 .pvr_value = 0x13020002,
....@@ -2147,7 +2071,11 @@
21472071 struct cpu_spec *t = &the_cpu_spec;
21482072
21492073 t = PTRRELOC(t);
2150
- *t = *s;
2074
+ /*
2075
+ * use memcpy() instead of *t = *s so that GCC replaces it
2076
+ * by __memcpy() when KASAN is active
2077
+ */
2078
+ memcpy(t, s, sizeof(*t));
21512079
21522080 *PTRRELOC(&cur_cpu_spec) = &the_cpu_spec;
21532081 }
....@@ -2161,8 +2089,11 @@
21612089 t = PTRRELOC(t);
21622090 old = *t;
21632091
2164
- /* Copy everything, then do fixups */
2165
- *t = *s;
2092
+ /*
2093
+ * Copy everything, then do fixups. Use memcpy() instead of *t = *s
2094
+ * so that GCC replaces it by __memcpy() when KASAN is active
2095
+ */
2096
+ memcpy(t, s, sizeof(*t));
21662097
21672098 /*
21682099 * If we are overriding a previous value derived from the real
....@@ -2193,7 +2124,6 @@
21932124 */
21942125 if (old.oprofile_cpu_type != NULL) {
21952126 t->oprofile_cpu_type = old.oprofile_cpu_type;
2196
- t->oprofile_type = old.oprofile_type;
21972127 t->cpu_features |= old.cpu_features & CPU_FTR_PMAO_BUG;
21982128 }
21992129 }