1# SPDX-License-Identifier: GPL-2.0
2config PPC32
3	bool
4	default y if !PPC64
5
6config PPC64
7	bool "64-bit kernel"
8	select ZLIB_DEFLATE
9	help
10	  This option selects whether a 32-bit or a 64-bit kernel
11	  will be built.
12
13menu "Processor support"
14choice
15	prompt "Processor Type"
16	depends on PPC32
17	help
18	  There are five families of 32 bit PowerPC chips supported.
19	  The most common ones are the desktop and server CPUs (603,
20	  604, 740, 750, 74xx) CPUs from Freescale and IBM, with their
21	  embedded 512x/52xx/82xx/83xx/86xx counterparts.
22	  The other embedded parts, namely 4xx, 8xx and e500
23	  (85xx) each form a family of their own that is not compatible
24	  with the others.
25
26	  If unsure, select 52xx/6xx/7xx/74xx/82xx/83xx/86xx.
27
28config PPC_BOOK3S_32
29	bool "512x/52xx/6xx/7xx/74xx/82xx/83xx/86xx"
30	imply PPC_FPU
31	select PPC_HAVE_PMU_SUPPORT
32	select HAVE_ARCH_VMAP_STACK
33
34config PPC_85xx
35	bool "Freescale 85xx"
36	select PPC_E500
37
38config PPC_8xx
39	bool "Freescale 8xx"
40	select ARCH_SUPPORTS_HUGETLBFS
41	select FSL_SOC
42	select PPC_KUEP
43	select HAVE_ARCH_VMAP_STACK
44	select HUGETLBFS
45
46config 40x
47	bool "AMCC 40x"
48	select PPC_DCR_NATIVE
49	select PPC_UDBG_16550
50	select 4xx_SOC
51	select HAVE_PCI
52	select PPC_KUEP if PPC_KUAP
53
54config 44x
55	bool "AMCC 44x, 46x or 47x"
56	select PPC_DCR_NATIVE
57	select PPC_UDBG_16550
58	select 4xx_SOC
59	select HAVE_PCI
60	select PHYS_64BIT
61	select PPC_KUEP
62
63endchoice
64
65config PPC_BOOK3S_603
66	bool "Support for 603 SW loaded TLB"
67	depends on PPC_BOOK3S_32
68	default y
69	help
70	  Provide support for processors based on the 603 cores. Those
71	  processors don't have a HASH MMU and provide SW TLB loading.
72
73config PPC_BOOK3S_604
74	bool "Support for 604+ HASH MMU" if PPC_BOOK3S_603
75	depends on PPC_BOOK3S_32
76	default y
77	help
78	  Provide support for processors not based on the 603 cores.
79	  Those processors have a HASH MMU.
80
81choice
82	prompt "Processor Type"
83	depends on PPC64
84	help
85	  There are two families of 64 bit PowerPC chips supported.
86	  The most common ones are the desktop and server CPUs
87	  (POWER5, 970, POWER5+, POWER6, POWER7, POWER8, POWER9 ...)
88
89	  The other are the "embedded" processors compliant with the
90	  "Book 3E" variant of the architecture
91
92config PPC_BOOK3S_64
93	bool "Server processors"
94	select PPC_FPU
95	select PPC_HAVE_PMU_SUPPORT
96	select HAVE_ARCH_TRANSPARENT_HUGEPAGE
97	select ARCH_ENABLE_HUGEPAGE_MIGRATION if HUGETLB_PAGE && MIGRATION
98	select ARCH_ENABLE_SPLIT_PMD_PTLOCK
99	select ARCH_ENABLE_THP_MIGRATION if TRANSPARENT_HUGEPAGE
100	select ARCH_SUPPORTS_HUGETLBFS
101	select ARCH_SUPPORTS_NUMA_BALANCING
102	select HAVE_MOVE_PMD
103	select HAVE_MOVE_PUD
104	select IRQ_WORK
105	select PPC_64S_HASH_MMU if !PPC_RADIX_MMU
106	select KASAN_VMALLOC if KASAN
107
108config PPC_BOOK3E_64
109	bool "Embedded processors"
110	select PPC_E500
111	select PPC_E500MC
112	select PPC_FPU # Make it a choice ?
113	select PPC_SMP_MUXED_IPI
114	select PPC_DOORBELL
115	select ZONE_DMA
116
117endchoice
118
119choice
120	prompt "CPU selection"
121	help
122	  This will create a kernel which is optimised for a particular CPU.
123	  The resulting kernel may not run on other CPUs, so use this with care.
124
125	  If unsure, select Generic.
126
127config POWERPC64_CPU
128	bool "Generic (POWER5 and PowerPC 970 and above)"
129	depends on PPC_BOOK3S_64 && !CPU_LITTLE_ENDIAN
130	select PPC_64S_HASH_MMU
131
132config POWERPC64_CPU
133	bool "Generic (POWER8 and above)"
134	depends on PPC_BOOK3S_64 && CPU_LITTLE_ENDIAN
135	select ARCH_HAS_FAST_MULTIPLIER
136	select PPC_64S_HASH_MMU
137	select PPC_HAS_LBARX_LHARX
138
139config POWERPC_CPU
140	bool "Generic 32 bits powerpc"
141	depends on PPC_BOOK3S_32
142
143config CELL_CPU
144	bool "Cell Broadband Engine"
145	depends on PPC_BOOK3S_64 && !CPU_LITTLE_ENDIAN
146	depends on !CC_IS_CLANG
147	select PPC_64S_HASH_MMU
148
149config PPC_970_CPU
150	bool "PowerPC 970 (including PowerPC G5)"
151	depends on PPC_BOOK3S_64 && !CPU_LITTLE_ENDIAN
152	select PPC_64S_HASH_MMU
153
154config POWER6_CPU
155	bool "POWER6"
156	depends on PPC_BOOK3S_64 && !CPU_LITTLE_ENDIAN
157	select PPC_64S_HASH_MMU
158
159config POWER7_CPU
160	bool "POWER7"
161	depends on PPC_BOOK3S_64
162	select ARCH_HAS_FAST_MULTIPLIER
163	select PPC_64S_HASH_MMU
164	select PPC_HAS_LBARX_LHARX
165
166config POWER8_CPU
167	bool "POWER8"
168	depends on PPC_BOOK3S_64
169	select ARCH_HAS_FAST_MULTIPLIER
170	select PPC_64S_HASH_MMU
171	select PPC_HAS_LBARX_LHARX
172
173config POWER9_CPU
174	bool "POWER9"
175	depends on PPC_BOOK3S_64
176	select ARCH_HAS_FAST_MULTIPLIER
177	select PPC_HAS_LBARX_LHARX
178
179config POWER10_CPU
180	bool "POWER10"
181	depends on PPC_BOOK3S_64
182	select ARCH_HAS_FAST_MULTIPLIER
183
184config E5500_CPU
185	bool "Freescale e5500"
186	depends on PPC64 && PPC_E500
187
188config E6500_CPU
189	bool "Freescale e6500"
190	depends on PPC64 && PPC_E500
191	depends on !CC_IS_CLANG
192	select PPC_HAS_LBARX_LHARX
193
194config 405_CPU
195	bool "40x family"
196	depends on 40x
197	depends on !CC_IS_CLANG
198
199config 440_CPU
200	bool "440 (44x family)"
201	depends on 44x
202
203config 464_CPU
204	bool "464 (44x family)"
205	depends on 44x
206	depends on !CC_IS_CLANG
207
208config 476_CPU
209	bool "476 (47x family)"
210	depends on PPC_47x
211	depends on !CC_IS_CLANG
212
213config 860_CPU
214	bool "8xx family"
215	depends on PPC_8xx
216	depends on !CC_IS_CLANG
217
218config E300C2_CPU
219	bool "e300c2 (832x)"
220	depends on PPC_BOOK3S_32
221	depends on !CC_IS_CLANG
222
223config E300C3_CPU
224	bool "e300c3 (831x)"
225	depends on PPC_BOOK3S_32
226	depends on !CC_IS_CLANG
227
228config G4_CPU
229	bool "G4 (74xx)"
230	depends on PPC_BOOK3S_32
231	select ALTIVEC
232
233config E500_CPU
234	bool "e500 (8540)"
235	depends on PPC_85xx && !PPC_E500MC
236
237config E500MC_CPU
238	bool "e500mc"
239	depends on PPC_85xx && PPC_E500MC
240
241config TOOLCHAIN_DEFAULT_CPU
242	bool "Rely on the toolchain's implicit default CPU"
243
244endchoice
245
246config TARGET_CPU_BOOL
247	bool
248	default !TOOLCHAIN_DEFAULT_CPU
249
250config TARGET_CPU
251	string
252	depends on TARGET_CPU_BOOL
253	default "cell" if CELL_CPU
254	default "970" if PPC_970_CPU
255	default "power6" if POWER6_CPU
256	default "power7" if POWER7_CPU
257	default "power8" if POWER8_CPU
258	default "power9" if POWER9_CPU
259	default "power10" if POWER10_CPU
260	default "e5500" if E5500_CPU
261	default "e6500" if E6500_CPU
262	default "power4" if POWERPC64_CPU && !CPU_LITTLE_ENDIAN
263	default "power8" if POWERPC64_CPU && CPU_LITTLE_ENDIAN
264	default "405" if 405_CPU
265	default "440" if 440_CPU
266	default "464" if 464_CPU
267	default "476" if 476_CPU
268	default "860" if 860_CPU
269	default "e300c2" if E300C2_CPU
270	default "e300c3" if E300C3_CPU
271	default "G4" if G4_CPU
272	default "8540" if E500_CPU
273	default "e500mc" if E500MC_CPU
274	default "powerpc" if POWERPC_CPU
275
276config PPC_BOOK3S
277	def_bool y
278	depends on PPC_BOOK3S_32 || PPC_BOOK3S_64
279
280config PPC_E500
281	select FSL_EMB_PERFMON
282	bool
283	select ARCH_SUPPORTS_HUGETLBFS if PHYS_64BIT || PPC64
284	select PPC_SMP_MUXED_IPI
285	select PPC_DOORBELL
286	select PPC_KUEP
287
288config PPC_E500MC
289	bool "e500mc Support"
290	select PPC_FPU
291	select COMMON_CLK
292	depends on PPC_E500
293	help
294	  This must be enabled for running on e500mc (and derivatives
295	  such as e5500/e6500), and must be disabled for running on
296	  e500v1 or e500v2.
297
298config PPC_FPU_REGS
299	bool
300
301config PPC_FPU
302	bool "Support for Floating Point Unit (FPU)" if PPC_MPC832x
303	default y if PPC64
304	select PPC_FPU_REGS
305	help
306	  This must be enabled to support the Floating Point Unit
307	  Most 6xx have an FPU but e300c2 core (mpc832x) don't have
308	  an FPU, so when building an embedded kernel for that target
309	  you can disable FPU support.
310
311	  If unsure say Y.
312
313config FSL_EMB_PERFMON
314	bool "Freescale Embedded Perfmon"
315	depends on PPC_E500 || PPC_83xx
316	help
317	  This is the Performance Monitor support found on the e500 core
318	  and some e300 cores (c3 and c4).  Select this only if your
319	  core supports the Embedded Performance Monitor APU
320
321config FSL_EMB_PERF_EVENT
322	bool
323	depends on FSL_EMB_PERFMON && PERF_EVENTS && !PPC_PERF_CTRS
324	default y
325
326config FSL_EMB_PERF_EVENT_E500
327	bool
328	depends on FSL_EMB_PERF_EVENT && PPC_E500
329	default y
330
331config 4xx
332	bool
333	depends on 40x || 44x
334	default y
335
336config BOOKE
337	bool
338	depends on PPC_E500 || 44x
339	default y
340
341config BOOKE_OR_40x
342	bool
343	depends on BOOKE || 40x
344	default y
345
346config PTE_64BIT
347	bool
348	depends on 44x || PPC_E500 || PPC_86xx
349	default y if PHYS_64BIT
350
351config PHYS_64BIT
352	bool 'Large physical address support' if PPC_E500 || PPC_86xx
353	depends on (44x || PPC_E500 || PPC_86xx) && !PPC_83xx && !PPC_82xx
354	select PHYS_ADDR_T_64BIT
355	help
356	  This option enables kernel support for larger than 32-bit physical
357	  addresses.  This feature may not be available on all cores.
358
359	  If you have more than 3.5GB of RAM or so, you also need to enable
360	  SWIOTLB under Kernel Options for this to work.  The actual number
361	  is platform-dependent.
362
363	  If in doubt, say N here.
364
365config ALTIVEC
366	bool "AltiVec Support"
367	depends on PPC_BOOK3S || (PPC_E500MC && PPC64 && !E5500_CPU)
368	select PPC_FPU
369	help
370	  This option enables kernel support for the Altivec extensions to the
371	  PowerPC processor. The kernel currently supports saving and restoring
372	  altivec registers, and turning on the 'altivec enable' bit so user
373	  processes can execute altivec instructions.
374
375	  This option is only usefully if you have a processor that supports
376	  altivec (G4, otherwise known as 74xx series), but does not have
377	  any affect on a non-altivec cpu (it does, however add code to the
378	  kernel).
379
380	  If in doubt, say Y here.
381
382config VSX
383	bool "VSX Support"
384	depends on PPC_BOOK3S_64 && ALTIVEC && PPC_FPU
385	help
386
387	  This option enables kernel support for the Vector Scaler extensions
388	  to the PowerPC processor. The kernel currently supports saving and
389	  restoring VSX registers, and turning on the 'VSX enable' bit so user
390	  processes can execute VSX instructions.
391
392	  This option is only useful if you have a processor that supports
393	  VSX (P7 and above), but does not have any affect on a non-VSX
394	  CPUs (it does, however add code to the kernel).
395
396	  If in doubt, say Y here.
397
398config SPE_POSSIBLE
399	def_bool y
400	depends on PPC_E500 && !PPC_E500MC
401
402config SPE
403	bool "SPE Support"
404	depends on SPE_POSSIBLE
405	default y
406	help
407	  This option enables kernel support for the Signal Processing
408	  Extensions (SPE) to the PowerPC processor. The kernel currently
409	  supports saving and restoring SPE registers, and turning on the
410	  'spe enable' bit so user processes can execute SPE instructions.
411
412	  This option is only useful if you have a processor that supports
413	  SPE (e500, otherwise known as 85xx series), but does not have any
414	  effect on a non-spe cpu (it does, however add code to the kernel).
415
416	  If in doubt, say Y here.
417
418config PPC_64S_HASH_MMU
419	bool "Hash MMU Support"
420	depends on PPC_BOOK3S_64
421	default y
422	help
423	  Enable support for the Power ISA Hash style MMU. This is implemented
424	  by all IBM Power and other 64-bit Book3S CPUs before ISA v3.0. The
425	  OpenPOWER ISA does not mandate the hash MMU and some CPUs do not
426	  implement it (e.g., Microwatt).
427
428	  Note that POWER9 PowerVM platforms only support the hash
429	  MMU. From POWER10 radix is also supported by PowerVM.
430
431	  If you're unsure, say Y.
432
433config PPC_RADIX_MMU
434	bool "Radix MMU Support"
435	depends on PPC_BOOK3S_64
436	select ARCH_HAS_GIGANTIC_PAGE
437	default y
438	help
439	  Enable support for the Power ISA 3.0 Radix style MMU. Currently this
440	  is only implemented by IBM Power9 CPUs, if you don't have one of them
441	  you can probably disable this.
442
443config PPC_RADIX_MMU_DEFAULT
444	bool "Default to using the Radix MMU when possible" if PPC_64S_HASH_MMU
445	depends on PPC_BOOK3S_64
446	depends on PPC_RADIX_MMU
447	default y
448	help
449	  When the hardware supports the Radix MMU, default to using it unless
450	  "disable_radix[=yes]" is specified on the kernel command line.
451
452	  If this option is disabled, the Hash MMU will be used by default,
453	  unless "disable_radix=no" is specified on the kernel command line.
454
455	  If you're unsure, say Y.
456
457config PPC_KUEP
458	bool "Kernel Userspace Execution Prevention" if !40x
459	default y if !40x
460	help
461	  Enable support for Kernel Userspace Execution Prevention (KUEP)
462
463	  If you're unsure, say Y.
464
465config PPC_KUAP
466	bool "Kernel Userspace Access Protection"
467	default y
468	help
469	  Enable support for Kernel Userspace Access Protection (KUAP)
470
471	  If you're unsure, say Y.
472
473config PPC_KUAP_DEBUG
474	bool "Extra debugging for Kernel Userspace Access Protection"
475	depends on PPC_KUAP
476	help
477	  Add extra debugging for Kernel Userspace Access Protection (KUAP)
478	  If you're unsure, say N.
479
480config PPC_PKEY
481	def_bool y
482	depends on PPC_BOOK3S_64
483	depends on PPC_MEM_KEYS || PPC_KUAP || PPC_KUEP
484
485
486config PPC_MMU_NOHASH
487	def_bool y
488	depends on !PPC_BOOK3S
489
490config PPC_HAVE_PMU_SUPPORT
491	bool
492
493config PMU_SYSFS
494	bool "Create PMU SPRs sysfs file"
495	default n
496	help
497	  This option enables sysfs file creation for PMU SPRs like MMCR* and PMC*.
498
499config PPC_PERF_CTRS
500	def_bool y
501	depends on PERF_EVENTS && PPC_HAVE_PMU_SUPPORT
502	help
503	 This enables the powerpc-specific perf_event back-end.
504
505config FORCE_SMP
506	# Allow platforms to force SMP=y by selecting this
507	bool
508	select SMP
509
510config SMP
511	depends on PPC_BOOK3S || PPC_E500 || PPC_47x
512	select GENERIC_IRQ_MIGRATION
513	bool "Symmetric multi-processing support" if !FORCE_SMP
514	help
515	  This enables support for systems with more than one CPU. If you have
516	  a system with only one CPU, say N. If you have a system with more
517	  than one CPU, say Y.  Note that the kernel does not currently
518	  support SMP machines with 603/603e/603ev or PPC750 ("G3") processors
519	  since they have inadequate hardware support for multiprocessor
520	  operation.
521
522	  If you say N here, the kernel will run on single and multiprocessor
523	  machines, but will use only one CPU of a multiprocessor machine. If
524	  you say Y here, the kernel will run on single-processor machines.
525	  On a single-processor machine, the kernel will run faster if you say
526	  N here.
527
528	  If you don't know what to do here, say N.
529
530config NR_CPUS
531	int "Maximum number of CPUs (2-8192)" if SMP
532	range 2 8192 if SMP
533	default "1" if !SMP
534	default "32" if PPC64
535	default "4"
536
537config NOT_COHERENT_CACHE
538	bool
539	depends on 4xx || PPC_8xx || PPC_MPC512x || \
540		GAMECUBE_COMMON || AMIGAONE
541	select ARCH_HAS_DMA_PREP_COHERENT
542	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
543	select ARCH_HAS_SYNC_DMA_FOR_CPU
544	select DMA_DIRECT_REMAP
545	default n if PPC_47x
546	default y
547
548config CHECK_CACHE_COHERENCY
549	bool
550
551config PPC_DOORBELL
552	bool
553
554endmenu
555
556config VDSO32
557	def_bool y
558	depends on PPC32 || COMPAT
559	help
560	  This symbol controls whether we build the 32-bit VDSO. We obviously
561	  want to do that if we're building a 32-bit kernel. If we're building
562	  a 64-bit kernel then we only want a 32-bit VDSO if we're also enabling
563	  COMPAT.
564
565choice
566	prompt "Endianness selection"
567	default CPU_BIG_ENDIAN
568	help
569	  This option selects whether a big endian or little endian kernel will
570	  be built.
571
572config CPU_BIG_ENDIAN
573	bool "Build big endian kernel"
574	help
575	  Build a big endian kernel.
576
577	  If unsure, select this option.
578
579config CPU_LITTLE_ENDIAN
580	bool "Build little endian kernel"
581	depends on PPC_BOOK3S_64
582	select PPC64_BOOT_WRAPPER
583	help
584	  Build a little endian kernel.
585
586	  Note that if cross compiling a little endian kernel,
587	  CROSS_COMPILE must point to a toolchain capable of targeting
588	  little endian powerpc.
589
590endchoice
591
592config PPC64_ELF_ABI_V1
593	def_bool PPC64 && (CPU_BIG_ENDIAN && !PPC64_BIG_ENDIAN_ELF_ABI_V2)
594
595config PPC64_ELF_ABI_V2
596	def_bool PPC64 && !PPC64_ELF_ABI_V1
597
598config PPC64_BOOT_WRAPPER
599	def_bool n
600	depends on CPU_LITTLE_ENDIAN
601