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