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