1# SPDX-License-Identifier: GPL-2.0-only
2config ARM64
3	def_bool y
4	select ACPI_CCA_REQUIRED if ACPI
5	select ACPI_GENERIC_GSI if ACPI
6	select ACPI_GTDT if ACPI
7	select ACPI_IORT if ACPI
8	select ACPI_REDUCED_HARDWARE_ONLY if ACPI
9	select ACPI_MCFG if (ACPI && PCI)
10	select ACPI_SPCR_TABLE if ACPI
11	select ACPI_PPTT if ACPI
12	select ARCH_HAS_DEBUG_WX
13	select ARCH_BINFMT_ELF_EXTRA_PHDRS
14	select ARCH_BINFMT_ELF_STATE
15	select ARCH_CORRECT_STACKTRACE_ON_KRETPROBE
16	select ARCH_ENABLE_HUGEPAGE_MIGRATION if HUGETLB_PAGE && MIGRATION
17	select ARCH_ENABLE_MEMORY_HOTPLUG
18	select ARCH_ENABLE_MEMORY_HOTREMOVE
19	select ARCH_ENABLE_SPLIT_PMD_PTLOCK if PGTABLE_LEVELS > 2
20	select ARCH_ENABLE_THP_MIGRATION if TRANSPARENT_HUGEPAGE
21	select ARCH_HAS_CACHE_LINE_SIZE
22	select ARCH_HAS_CURRENT_STACK_POINTER
23	select ARCH_HAS_DEBUG_VIRTUAL
24	select ARCH_HAS_DEBUG_VM_PGTABLE
25	select ARCH_HAS_DMA_PREP_COHERENT
26	select ARCH_HAS_ACPI_TABLE_UPGRADE if ACPI
27	select ARCH_HAS_FAST_MULTIPLIER
28	select ARCH_HAS_FORTIFY_SOURCE
29	select ARCH_HAS_GCOV_PROFILE_ALL
30	select ARCH_HAS_GIGANTIC_PAGE
31	select ARCH_HAS_KCOV
32	select ARCH_HAS_KEEPINITRD
33	select ARCH_HAS_MEMBARRIER_SYNC_CORE
34	select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
35	select ARCH_HAS_PTE_DEVMAP
36	select ARCH_HAS_PTE_SPECIAL
37	select ARCH_HAS_SETUP_DMA_OPS
38	select ARCH_HAS_SET_DIRECT_MAP
39	select ARCH_HAS_SET_MEMORY
40	select ARCH_STACKWALK
41	select ARCH_HAS_STRICT_KERNEL_RWX
42	select ARCH_HAS_STRICT_MODULE_RWX
43	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
44	select ARCH_HAS_SYNC_DMA_FOR_CPU
45	select ARCH_HAS_SYSCALL_WRAPPER
46	select ARCH_HAS_TEARDOWN_DMA_OPS if IOMMU_SUPPORT
47	select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
48	select ARCH_HAS_VM_GET_PAGE_PROT
49	select ARCH_HAS_ZONE_DMA_SET if EXPERT
50	select ARCH_HAVE_ELF_PROT
51	select ARCH_HAVE_NMI_SAFE_CMPXCHG
52	select ARCH_INLINE_READ_LOCK if !PREEMPTION
53	select ARCH_INLINE_READ_LOCK_BH if !PREEMPTION
54	select ARCH_INLINE_READ_LOCK_IRQ if !PREEMPTION
55	select ARCH_INLINE_READ_LOCK_IRQSAVE if !PREEMPTION
56	select ARCH_INLINE_READ_UNLOCK if !PREEMPTION
57	select ARCH_INLINE_READ_UNLOCK_BH if !PREEMPTION
58	select ARCH_INLINE_READ_UNLOCK_IRQ if !PREEMPTION
59	select ARCH_INLINE_READ_UNLOCK_IRQRESTORE if !PREEMPTION
60	select ARCH_INLINE_WRITE_LOCK if !PREEMPTION
61	select ARCH_INLINE_WRITE_LOCK_BH if !PREEMPTION
62	select ARCH_INLINE_WRITE_LOCK_IRQ if !PREEMPTION
63	select ARCH_INLINE_WRITE_LOCK_IRQSAVE if !PREEMPTION
64	select ARCH_INLINE_WRITE_UNLOCK if !PREEMPTION
65	select ARCH_INLINE_WRITE_UNLOCK_BH if !PREEMPTION
66	select ARCH_INLINE_WRITE_UNLOCK_IRQ if !PREEMPTION
67	select ARCH_INLINE_WRITE_UNLOCK_IRQRESTORE if !PREEMPTION
68	select ARCH_INLINE_SPIN_TRYLOCK if !PREEMPTION
69	select ARCH_INLINE_SPIN_TRYLOCK_BH if !PREEMPTION
70	select ARCH_INLINE_SPIN_LOCK if !PREEMPTION
71	select ARCH_INLINE_SPIN_LOCK_BH if !PREEMPTION
72	select ARCH_INLINE_SPIN_LOCK_IRQ if !PREEMPTION
73	select ARCH_INLINE_SPIN_LOCK_IRQSAVE if !PREEMPTION
74	select ARCH_INLINE_SPIN_UNLOCK if !PREEMPTION
75	select ARCH_INLINE_SPIN_UNLOCK_BH if !PREEMPTION
76	select ARCH_INLINE_SPIN_UNLOCK_IRQ if !PREEMPTION
77	select ARCH_INLINE_SPIN_UNLOCK_IRQRESTORE if !PREEMPTION
78	select ARCH_KEEP_MEMBLOCK
79	select ARCH_USE_CMPXCHG_LOCKREF
80	select ARCH_USE_GNU_PROPERTY
81	select ARCH_USE_MEMTEST
82	select ARCH_USE_QUEUED_RWLOCKS
83	select ARCH_USE_QUEUED_SPINLOCKS
84	select ARCH_USE_SYM_ANNOTATIONS
85	select ARCH_SUPPORTS_DEBUG_PAGEALLOC
86	select ARCH_SUPPORTS_HUGETLBFS
87	select ARCH_SUPPORTS_MEMORY_FAILURE
88	select ARCH_SUPPORTS_SHADOW_CALL_STACK if CC_HAVE_SHADOW_CALL_STACK
89	select ARCH_SUPPORTS_LTO_CLANG if CPU_LITTLE_ENDIAN
90	select ARCH_SUPPORTS_LTO_CLANG_THIN
91	select ARCH_SUPPORTS_CFI_CLANG
92	select ARCH_SUPPORTS_ATOMIC_RMW
93	select ARCH_SUPPORTS_INT128 if CC_HAS_INT128
94	select ARCH_SUPPORTS_NUMA_BALANCING
95	select ARCH_SUPPORTS_PAGE_TABLE_CHECK
96	select ARCH_WANT_COMPAT_IPC_PARSE_VERSION if COMPAT
97	select ARCH_WANT_DEFAULT_BPF_JIT
98	select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT
99	select ARCH_WANT_FRAME_POINTERS
100	select ARCH_WANT_HUGE_PMD_SHARE if ARM64_4K_PAGES || (ARM64_16K_PAGES && !ARM64_VA_BITS_36)
101	select ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAP
102	select ARCH_WANT_LD_ORPHAN_WARN
103	select ARCH_WANTS_NO_INSTR
104	select ARCH_HAS_UBSAN_SANITIZE_ALL
105	select ARM_AMBA
106	select ARM_ARCH_TIMER
107	select ARM_GIC
108	select AUDIT_ARCH_COMPAT_GENERIC
109	select ARM_GIC_V2M if PCI
110	select ARM_GIC_V3
111	select ARM_GIC_V3_ITS if PCI
112	select ARM_PSCI_FW
113	select BUILDTIME_TABLE_SORT
114	select CLONE_BACKWARDS
115	select COMMON_CLK
116	select CPU_PM if (SUSPEND || CPU_IDLE)
117	select CRC32
118	select DCACHE_WORD_ACCESS
119	select DMA_DIRECT_REMAP
120	select EDAC_SUPPORT
121	select FRAME_POINTER
122	select GENERIC_ALLOCATOR
123	select GENERIC_ARCH_TOPOLOGY
124	select GENERIC_CLOCKEVENTS_BROADCAST
125	select GENERIC_CPU_AUTOPROBE
126	select GENERIC_CPU_VULNERABILITIES
127	select GENERIC_EARLY_IOREMAP
128	select GENERIC_IDLE_POLL_SETUP
129	select GENERIC_IRQ_IPI
130	select GENERIC_IRQ_PROBE
131	select GENERIC_IRQ_SHOW
132	select GENERIC_IRQ_SHOW_LEVEL
133	select GENERIC_LIB_DEVMEM_IS_ALLOWED
134	select GENERIC_PCI_IOMAP
135	select GENERIC_PTDUMP
136	select GENERIC_SCHED_CLOCK
137	select GENERIC_SMP_IDLE_THREAD
138	select GENERIC_TIME_VSYSCALL
139	select GENERIC_GETTIMEOFDAY
140	select GENERIC_VDSO_TIME_NS
141	select HARDIRQS_SW_RESEND
142	select HAVE_MOVE_PMD
143	select HAVE_MOVE_PUD
144	select HAVE_PCI
145	select HAVE_ACPI_APEI if (ACPI && EFI)
146	select HAVE_ALIGNED_STRUCT_PAGE if SLUB
147	select HAVE_ARCH_AUDITSYSCALL
148	select HAVE_ARCH_BITREVERSE
149	select HAVE_ARCH_COMPILER_H
150	select HAVE_ARCH_HUGE_VMAP
151	select HAVE_ARCH_JUMP_LABEL
152	select HAVE_ARCH_JUMP_LABEL_RELATIVE
153	select HAVE_ARCH_KASAN if !(ARM64_16K_PAGES && ARM64_VA_BITS_48)
154	select HAVE_ARCH_KASAN_VMALLOC if HAVE_ARCH_KASAN
155	select HAVE_ARCH_KASAN_SW_TAGS if HAVE_ARCH_KASAN
156	select HAVE_ARCH_KASAN_HW_TAGS if (HAVE_ARCH_KASAN && ARM64_MTE)
157	# Some instrumentation may be unsound, hence EXPERT
158	select HAVE_ARCH_KCSAN if EXPERT
159	select HAVE_ARCH_KFENCE
160	select HAVE_ARCH_KGDB
161	select HAVE_ARCH_MMAP_RND_BITS
162	select HAVE_ARCH_MMAP_RND_COMPAT_BITS if COMPAT
163	select HAVE_ARCH_PREL32_RELOCATIONS
164	select HAVE_ARCH_RANDOMIZE_KSTACK_OFFSET
165	select HAVE_ARCH_SECCOMP_FILTER
166	select HAVE_ARCH_STACKLEAK
167	select HAVE_ARCH_THREAD_STRUCT_WHITELIST
168	select HAVE_ARCH_TRACEHOOK
169	select HAVE_ARCH_TRANSPARENT_HUGEPAGE
170	select HAVE_ARCH_VMAP_STACK
171	select HAVE_ARM_SMCCC
172	select HAVE_ASM_MODVERSIONS
173	select HAVE_EBPF_JIT
174	select HAVE_C_RECORDMCOUNT
175	select HAVE_CMPXCHG_DOUBLE
176	select HAVE_CMPXCHG_LOCAL
177	select HAVE_CONTEXT_TRACKING
178	select HAVE_DEBUG_KMEMLEAK
179	select HAVE_DMA_CONTIGUOUS
180	select HAVE_DYNAMIC_FTRACE
181	select FTRACE_MCOUNT_USE_PATCHABLE_FUNCTION_ENTRY \
182		if DYNAMIC_FTRACE_WITH_REGS
183	select HAVE_EFFICIENT_UNALIGNED_ACCESS
184	select HAVE_FAST_GUP
185	select HAVE_FTRACE_MCOUNT_RECORD
186	select HAVE_FUNCTION_TRACER
187	select HAVE_FUNCTION_ERROR_INJECTION
188	select HAVE_FUNCTION_GRAPH_TRACER
189	select HAVE_GCC_PLUGINS
190	select HAVE_HW_BREAKPOINT if PERF_EVENTS
191	select HAVE_IRQ_TIME_ACCOUNTING
192	select HAVE_KVM
193	select HAVE_NMI
194	select HAVE_PATA_PLATFORM
195	select HAVE_PERF_EVENTS
196	select HAVE_PERF_REGS
197	select HAVE_PERF_USER_STACK_DUMP
198	select HAVE_PREEMPT_DYNAMIC_KEY
199	select HAVE_REGS_AND_STACK_ACCESS_API
200	select HAVE_POSIX_CPU_TIMERS_TASK_WORK
201	select HAVE_FUNCTION_ARG_ACCESS_API
202	select MMU_GATHER_RCU_TABLE_FREE
203	select HAVE_RSEQ
204	select HAVE_STACKPROTECTOR
205	select HAVE_SYSCALL_TRACEPOINTS
206	select HAVE_KPROBES
207	select HAVE_KRETPROBES
208	select HAVE_GENERIC_VDSO
209	select IOMMU_DMA if IOMMU_SUPPORT
210	select IRQ_DOMAIN
211	select IRQ_FORCED_THREADING
212	select KASAN_VMALLOC if KASAN
213	select MODULES_USE_ELF_RELA
214	select NEED_DMA_MAP_STATE
215	select NEED_SG_DMA_LENGTH
216	select OF
217	select OF_EARLY_FLATTREE
218	select PCI_DOMAINS_GENERIC if PCI
219	select PCI_ECAM if (ACPI && PCI)
220	select PCI_SYSCALL if PCI
221	select POWER_RESET
222	select POWER_SUPPLY
223	select SPARSE_IRQ
224	select SWIOTLB
225	select SYSCTL_EXCEPTION_TRACE
226	select THREAD_INFO_IN_TASK
227	select HAVE_ARCH_USERFAULTFD_MINOR if USERFAULTFD
228	select TRACE_IRQFLAGS_SUPPORT
229	select TRACE_IRQFLAGS_NMI_SUPPORT
230	help
231	  ARM 64-bit (AArch64) Linux support.
232
233config CLANG_SUPPORTS_DYNAMIC_FTRACE_WITH_REGS
234	def_bool CC_IS_CLANG
235	# https://github.com/ClangBuiltLinux/linux/issues/1507
236	depends on AS_IS_GNU || (AS_IS_LLVM && (LD_IS_LLD || LD_VERSION >= 23600))
237	select HAVE_DYNAMIC_FTRACE_WITH_REGS
238
239config GCC_SUPPORTS_DYNAMIC_FTRACE_WITH_REGS
240	def_bool CC_IS_GCC
241	depends on $(cc-option,-fpatchable-function-entry=2)
242	select HAVE_DYNAMIC_FTRACE_WITH_REGS
243
244config 64BIT
245	def_bool y
246
247config MMU
248	def_bool y
249
250config ARM64_PAGE_SHIFT
251	int
252	default 16 if ARM64_64K_PAGES
253	default 14 if ARM64_16K_PAGES
254	default 12
255
256config ARM64_CONT_PTE_SHIFT
257	int
258	default 5 if ARM64_64K_PAGES
259	default 7 if ARM64_16K_PAGES
260	default 4
261
262config ARM64_CONT_PMD_SHIFT
263	int
264	default 5 if ARM64_64K_PAGES
265	default 5 if ARM64_16K_PAGES
266	default 4
267
268config ARCH_MMAP_RND_BITS_MIN
269	default 14 if ARM64_64K_PAGES
270	default 16 if ARM64_16K_PAGES
271	default 18
272
273# max bits determined by the following formula:
274#  VA_BITS - PAGE_SHIFT - 3
275config ARCH_MMAP_RND_BITS_MAX
276	default 19 if ARM64_VA_BITS=36
277	default 24 if ARM64_VA_BITS=39
278	default 27 if ARM64_VA_BITS=42
279	default 30 if ARM64_VA_BITS=47
280	default 29 if ARM64_VA_BITS=48 && ARM64_64K_PAGES
281	default 31 if ARM64_VA_BITS=48 && ARM64_16K_PAGES
282	default 33 if ARM64_VA_BITS=48
283	default 14 if ARM64_64K_PAGES
284	default 16 if ARM64_16K_PAGES
285	default 18
286
287config ARCH_MMAP_RND_COMPAT_BITS_MIN
288	default 7 if ARM64_64K_PAGES
289	default 9 if ARM64_16K_PAGES
290	default 11
291
292config ARCH_MMAP_RND_COMPAT_BITS_MAX
293	default 16
294
295config NO_IOPORT_MAP
296	def_bool y if !PCI
297
298config STACKTRACE_SUPPORT
299	def_bool y
300
301config ILLEGAL_POINTER_VALUE
302	hex
303	default 0xdead000000000000
304
305config LOCKDEP_SUPPORT
306	def_bool y
307
308config GENERIC_BUG
309	def_bool y
310	depends on BUG
311
312config GENERIC_BUG_RELATIVE_POINTERS
313	def_bool y
314	depends on GENERIC_BUG
315
316config GENERIC_HWEIGHT
317	def_bool y
318
319config GENERIC_CSUM
320	def_bool y
321
322config GENERIC_CALIBRATE_DELAY
323	def_bool y
324
325config ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE
326	def_bool y
327
328config SMP
329	def_bool y
330
331config KERNEL_MODE_NEON
332	def_bool y
333
334config FIX_EARLYCON_MEM
335	def_bool y
336
337config PGTABLE_LEVELS
338	int
339	default 2 if ARM64_16K_PAGES && ARM64_VA_BITS_36
340	default 2 if ARM64_64K_PAGES && ARM64_VA_BITS_42
341	default 3 if ARM64_64K_PAGES && (ARM64_VA_BITS_48 || ARM64_VA_BITS_52)
342	default 3 if ARM64_4K_PAGES && ARM64_VA_BITS_39
343	default 3 if ARM64_16K_PAGES && ARM64_VA_BITS_47
344	default 4 if !ARM64_64K_PAGES && ARM64_VA_BITS_48
345
346config ARCH_SUPPORTS_UPROBES
347	def_bool y
348
349config ARCH_PROC_KCORE_TEXT
350	def_bool y
351
352config BROKEN_GAS_INST
353	def_bool !$(as-instr,1:\n.inst 0\n.rept . - 1b\n\nnop\n.endr\n)
354
355config KASAN_SHADOW_OFFSET
356	hex
357	depends on KASAN_GENERIC || KASAN_SW_TAGS
358	default 0xdfff800000000000 if (ARM64_VA_BITS_48 || ARM64_VA_BITS_52) && !KASAN_SW_TAGS
359	default 0xdfffc00000000000 if ARM64_VA_BITS_47 && !KASAN_SW_TAGS
360	default 0xdffffe0000000000 if ARM64_VA_BITS_42 && !KASAN_SW_TAGS
361	default 0xdfffffc000000000 if ARM64_VA_BITS_39 && !KASAN_SW_TAGS
362	default 0xdffffff800000000 if ARM64_VA_BITS_36 && !KASAN_SW_TAGS
363	default 0xefff800000000000 if (ARM64_VA_BITS_48 || ARM64_VA_BITS_52) && KASAN_SW_TAGS
364	default 0xefffc00000000000 if ARM64_VA_BITS_47 && KASAN_SW_TAGS
365	default 0xeffffe0000000000 if ARM64_VA_BITS_42 && KASAN_SW_TAGS
366	default 0xefffffc000000000 if ARM64_VA_BITS_39 && KASAN_SW_TAGS
367	default 0xeffffff800000000 if ARM64_VA_BITS_36 && KASAN_SW_TAGS
368	default 0xffffffffffffffff
369
370source "arch/arm64/Kconfig.platforms"
371
372menu "Kernel Features"
373
374menu "ARM errata workarounds via the alternatives framework"
375
376config ARM64_WORKAROUND_CLEAN_CACHE
377	bool
378
379config ARM64_ERRATUM_826319
380	bool "Cortex-A53: 826319: System might deadlock if a write cannot complete until read data is accepted"
381	default y
382	select ARM64_WORKAROUND_CLEAN_CACHE
383	help
384	  This option adds an alternative code sequence to work around ARM
385	  erratum 826319 on Cortex-A53 parts up to r0p2 with an AMBA 4 ACE or
386	  AXI master interface and an L2 cache.
387
388	  If a Cortex-A53 uses an AMBA AXI4 ACE interface to other processors
389	  and is unable to accept a certain write via this interface, it will
390	  not progress on read data presented on the read data channel and the
391	  system can deadlock.
392
393	  The workaround promotes data cache clean instructions to
394	  data cache clean-and-invalidate.
395	  Please note that this does not necessarily enable the workaround,
396	  as it depends on the alternative framework, which will only patch
397	  the kernel if an affected CPU is detected.
398
399	  If unsure, say Y.
400
401config ARM64_ERRATUM_827319
402	bool "Cortex-A53: 827319: Data cache clean instructions might cause overlapping transactions to the interconnect"
403	default y
404	select ARM64_WORKAROUND_CLEAN_CACHE
405	help
406	  This option adds an alternative code sequence to work around ARM
407	  erratum 827319 on Cortex-A53 parts up to r0p2 with an AMBA 5 CHI
408	  master interface and an L2 cache.
409
410	  Under certain conditions this erratum can cause a clean line eviction
411	  to occur at the same time as another transaction to the same address
412	  on the AMBA 5 CHI interface, which can cause data corruption if the
413	  interconnect reorders the two transactions.
414
415	  The workaround promotes data cache clean instructions to
416	  data cache clean-and-invalidate.
417	  Please note that this does not necessarily enable the workaround,
418	  as it depends on the alternative framework, which will only patch
419	  the kernel if an affected CPU is detected.
420
421	  If unsure, say Y.
422
423config ARM64_ERRATUM_824069
424	bool "Cortex-A53: 824069: Cache line might not be marked as clean after a CleanShared snoop"
425	default y
426	select ARM64_WORKAROUND_CLEAN_CACHE
427	help
428	  This option adds an alternative code sequence to work around ARM
429	  erratum 824069 on Cortex-A53 parts up to r0p2 when it is connected
430	  to a coherent interconnect.
431
432	  If a Cortex-A53 processor is executing a store or prefetch for
433	  write instruction at the same time as a processor in another
434	  cluster is executing a cache maintenance operation to the same
435	  address, then this erratum might cause a clean cache line to be
436	  incorrectly marked as dirty.
437
438	  The workaround promotes data cache clean instructions to
439	  data cache clean-and-invalidate.
440	  Please note that this option does not necessarily enable the
441	  workaround, as it depends on the alternative framework, which will
442	  only patch the kernel if an affected CPU is detected.
443
444	  If unsure, say Y.
445
446config ARM64_ERRATUM_819472
447	bool "Cortex-A53: 819472: Store exclusive instructions might cause data corruption"
448	default y
449	select ARM64_WORKAROUND_CLEAN_CACHE
450	help
451	  This option adds an alternative code sequence to work around ARM
452	  erratum 819472 on Cortex-A53 parts up to r0p1 with an L2 cache
453	  present when it is connected to a coherent interconnect.
454
455	  If the processor is executing a load and store exclusive sequence at
456	  the same time as a processor in another cluster is executing a cache
457	  maintenance operation to the same address, then this erratum might
458	  cause data corruption.
459
460	  The workaround promotes data cache clean instructions to
461	  data cache clean-and-invalidate.
462	  Please note that this does not necessarily enable the workaround,
463	  as it depends on the alternative framework, which will only patch
464	  the kernel if an affected CPU is detected.
465
466	  If unsure, say Y.
467
468config ARM64_ERRATUM_832075
469	bool "Cortex-A57: 832075: possible deadlock on mixing exclusive memory accesses with device loads"
470	default y
471	help
472	  This option adds an alternative code sequence to work around ARM
473	  erratum 832075 on Cortex-A57 parts up to r1p2.
474
475	  Affected Cortex-A57 parts might deadlock when exclusive load/store
476	  instructions to Write-Back memory are mixed with Device loads.
477
478	  The workaround is to promote device loads to use Load-Acquire
479	  semantics.
480	  Please note that this does not necessarily enable the workaround,
481	  as it depends on the alternative framework, which will only patch
482	  the kernel if an affected CPU is detected.
483
484	  If unsure, say Y.
485
486config ARM64_ERRATUM_834220
487	bool "Cortex-A57: 834220: Stage 2 translation fault might be incorrectly reported in presence of a Stage 1 fault"
488	depends on KVM
489	default y
490	help
491	  This option adds an alternative code sequence to work around ARM
492	  erratum 834220 on Cortex-A57 parts up to r1p2.
493
494	  Affected Cortex-A57 parts might report a Stage 2 translation
495	  fault as the result of a Stage 1 fault for load crossing a
496	  page boundary when there is a permission or device memory
497	  alignment fault at Stage 1 and a translation fault at Stage 2.
498
499	  The workaround is to verify that the Stage 1 translation
500	  doesn't generate a fault before handling the Stage 2 fault.
501	  Please note that this does not necessarily enable the workaround,
502	  as it depends on the alternative framework, which will only patch
503	  the kernel if an affected CPU is detected.
504
505	  If unsure, say Y.
506
507config ARM64_ERRATUM_1742098
508	bool "Cortex-A57/A72: 1742098: ELR recorded incorrectly on interrupt taken between cryptographic instructions in a sequence"
509	depends on COMPAT
510	default y
511	help
512	  This option removes the AES hwcap for aarch32 user-space to
513	  workaround erratum 1742098 on Cortex-A57 and Cortex-A72.
514
515	  Affected parts may corrupt the AES state if an interrupt is
516	  taken between a pair of AES instructions. These instructions
517	  are only present if the cryptography extensions are present.
518	  All software should have a fallback implementation for CPUs
519	  that don't implement the cryptography extensions.
520
521	  If unsure, say Y.
522
523config ARM64_ERRATUM_845719
524	bool "Cortex-A53: 845719: a load might read incorrect data"
525	depends on COMPAT
526	default y
527	help
528	  This option adds an alternative code sequence to work around ARM
529	  erratum 845719 on Cortex-A53 parts up to r0p4.
530
531	  When running a compat (AArch32) userspace on an affected Cortex-A53
532	  part, a load at EL0 from a virtual address that matches the bottom 32
533	  bits of the virtual address used by a recent load at (AArch64) EL1
534	  might return incorrect data.
535
536	  The workaround is to write the contextidr_el1 register on exception
537	  return to a 32-bit task.
538	  Please note that this does not necessarily enable the workaround,
539	  as it depends on the alternative framework, which will only patch
540	  the kernel if an affected CPU is detected.
541
542	  If unsure, say Y.
543
544config ARM64_ERRATUM_843419
545	bool "Cortex-A53: 843419: A load or store might access an incorrect address"
546	default y
547	select ARM64_MODULE_PLTS if MODULES
548	help
549	  This option links the kernel with '--fix-cortex-a53-843419' and
550	  enables PLT support to replace certain ADRP instructions, which can
551	  cause subsequent memory accesses to use an incorrect address on
552	  Cortex-A53 parts up to r0p4.
553
554	  If unsure, say Y.
555
556config ARM64_LD_HAS_FIX_ERRATUM_843419
557	def_bool $(ld-option,--fix-cortex-a53-843419)
558
559config ARM64_ERRATUM_1024718
560	bool "Cortex-A55: 1024718: Update of DBM/AP bits without break before make might result in incorrect update"
561	default y
562	help
563	  This option adds a workaround for ARM Cortex-A55 Erratum 1024718.
564
565	  Affected Cortex-A55 cores (all revisions) could cause incorrect
566	  update of the hardware dirty bit when the DBM/AP bits are updated
567	  without a break-before-make. The workaround is to disable the usage
568	  of hardware DBM locally on the affected cores. CPUs not affected by
569	  this erratum will continue to use the feature.
570
571	  If unsure, say Y.
572
573config ARM64_ERRATUM_1418040
574	bool "Cortex-A76/Neoverse-N1: MRC read following MRRC read of specific Generic Timer in AArch32 might give incorrect result"
575	default y
576	depends on COMPAT
577	help
578	  This option adds a workaround for ARM Cortex-A76/Neoverse-N1
579	  errata 1188873 and 1418040.
580
581	  Affected Cortex-A76/Neoverse-N1 cores (r0p0 to r3p1) could
582	  cause register corruption when accessing the timer registers
583	  from AArch32 userspace.
584
585	  If unsure, say Y.
586
587config ARM64_WORKAROUND_SPECULATIVE_AT
588	bool
589
590config ARM64_ERRATUM_1165522
591	bool "Cortex-A76: 1165522: Speculative AT instruction using out-of-context translation regime could cause subsequent request to generate an incorrect translation"
592	default y
593	select ARM64_WORKAROUND_SPECULATIVE_AT
594	help
595	  This option adds a workaround for ARM Cortex-A76 erratum 1165522.
596
597	  Affected Cortex-A76 cores (r0p0, r1p0, r2p0) could end-up with
598	  corrupted TLBs by speculating an AT instruction during a guest
599	  context switch.
600
601	  If unsure, say Y.
602
603config ARM64_ERRATUM_1319367
604	bool "Cortex-A57/A72: 1319537: Speculative AT instruction using out-of-context translation regime could cause subsequent request to generate an incorrect translation"
605	default y
606	select ARM64_WORKAROUND_SPECULATIVE_AT
607	help
608	  This option adds work arounds for ARM Cortex-A57 erratum 1319537
609	  and A72 erratum 1319367
610
611	  Cortex-A57 and A72 cores could end-up with corrupted TLBs by
612	  speculating an AT instruction during a guest context switch.
613
614	  If unsure, say Y.
615
616config ARM64_ERRATUM_1530923
617	bool "Cortex-A55: 1530923: Speculative AT instruction using out-of-context translation regime could cause subsequent request to generate an incorrect translation"
618	default y
619	select ARM64_WORKAROUND_SPECULATIVE_AT
620	help
621	  This option adds a workaround for ARM Cortex-A55 erratum 1530923.
622
623	  Affected Cortex-A55 cores (r0p0, r0p1, r1p0, r2p0) could end-up with
624	  corrupted TLBs by speculating an AT instruction during a guest
625	  context switch.
626
627	  If unsure, say Y.
628
629config ARM64_WORKAROUND_REPEAT_TLBI
630	bool
631
632config ARM64_ERRATUM_1286807
633	bool "Cortex-A76: Modification of the translation table for a virtual address might lead to read-after-read ordering violation"
634	default y
635	select ARM64_WORKAROUND_REPEAT_TLBI
636	help
637	  This option adds a workaround for ARM Cortex-A76 erratum 1286807.
638
639	  On the affected Cortex-A76 cores (r0p0 to r3p0), if a virtual
640	  address for a cacheable mapping of a location is being
641	  accessed by a core while another core is remapping the virtual
642	  address to a new physical page using the recommended
643	  break-before-make sequence, then under very rare circumstances
644	  TLBI+DSB completes before a read using the translation being
645	  invalidated has been observed by other observers. The
646	  workaround repeats the TLBI+DSB operation.
647
648config ARM64_ERRATUM_1463225
649	bool "Cortex-A76: Software Step might prevent interrupt recognition"
650	default y
651	help
652	  This option adds a workaround for Arm Cortex-A76 erratum 1463225.
653
654	  On the affected Cortex-A76 cores (r0p0 to r3p1), software stepping
655	  of a system call instruction (SVC) can prevent recognition of
656	  subsequent interrupts when software stepping is disabled in the
657	  exception handler of the system call and either kernel debugging
658	  is enabled or VHE is in use.
659
660	  Work around the erratum by triggering a dummy step exception
661	  when handling a system call from a task that is being stepped
662	  in a VHE configuration of the kernel.
663
664	  If unsure, say Y.
665
666config ARM64_ERRATUM_1542419
667	bool "Neoverse-N1: workaround mis-ordering of instruction fetches"
668	default y
669	help
670	  This option adds a workaround for ARM Neoverse-N1 erratum
671	  1542419.
672
673	  Affected Neoverse-N1 cores could execute a stale instruction when
674	  modified by another CPU. The workaround depends on a firmware
675	  counterpart.
676
677	  Workaround the issue by hiding the DIC feature from EL0. This
678	  forces user-space to perform cache maintenance.
679
680	  If unsure, say Y.
681
682config ARM64_ERRATUM_1508412
683	bool "Cortex-A77: 1508412: workaround deadlock on sequence of NC/Device load and store exclusive or PAR read"
684	default y
685	help
686	  This option adds a workaround for Arm Cortex-A77 erratum 1508412.
687
688	  Affected Cortex-A77 cores (r0p0, r1p0) could deadlock on a sequence
689	  of a store-exclusive or read of PAR_EL1 and a load with device or
690	  non-cacheable memory attributes. The workaround depends on a firmware
691	  counterpart.
692
693	  KVM guests must also have the workaround implemented or they can
694	  deadlock the system.
695
696	  Work around the issue by inserting DMB SY barriers around PAR_EL1
697	  register reads and warning KVM users. The DMB barrier is sufficient
698	  to prevent a speculative PAR_EL1 read.
699
700	  If unsure, say Y.
701
702config ARM64_WORKAROUND_TRBE_OVERWRITE_FILL_MODE
703	bool
704
705config ARM64_ERRATUM_2051678
706	bool "Cortex-A510: 2051678: disable Hardware Update of the page table dirty bit"
707	default y
708	help
709	  This options adds the workaround for ARM Cortex-A510 erratum ARM64_ERRATUM_2051678.
710	  Affected Cortex-A510 might not respect the ordering rules for
711	  hardware update of the page table's dirty bit. The workaround
712	  is to not enable the feature on affected CPUs.
713
714	  If unsure, say Y.
715
716config ARM64_ERRATUM_2077057
717	bool "Cortex-A510: 2077057: workaround software-step corrupting SPSR_EL2"
718	default y
719	help
720	  This option adds the workaround for ARM Cortex-A510 erratum 2077057.
721	  Affected Cortex-A510 may corrupt SPSR_EL2 when the a step exception is
722	  expected, but a Pointer Authentication trap is taken instead. The
723	  erratum causes SPSR_EL1 to be copied to SPSR_EL2, which could allow
724	  EL1 to cause a return to EL2 with a guest controlled ELR_EL2.
725
726	  This can only happen when EL2 is stepping EL1.
727
728	  When these conditions occur, the SPSR_EL2 value is unchanged from the
729	  previous guest entry, and can be restored from the in-memory copy.
730
731	  If unsure, say Y.
732
733config ARM64_ERRATUM_2119858
734	bool "Cortex-A710/X2: 2119858: workaround TRBE overwriting trace data in FILL mode"
735	default y
736	depends on CORESIGHT_TRBE
737	select ARM64_WORKAROUND_TRBE_OVERWRITE_FILL_MODE
738	help
739	  This option adds the workaround for ARM Cortex-A710/X2 erratum 2119858.
740
741	  Affected Cortex-A710/X2 cores could overwrite up to 3 cache lines of trace
742	  data at the base of the buffer (pointed to by TRBASER_EL1) in FILL mode in
743	  the event of a WRAP event.
744
745	  Work around the issue by always making sure we move the TRBPTR_EL1 by
746	  256 bytes before enabling the buffer and filling the first 256 bytes of
747	  the buffer with ETM ignore packets upon disabling.
748
749	  If unsure, say Y.
750
751config ARM64_ERRATUM_2139208
752	bool "Neoverse-N2: 2139208: workaround TRBE overwriting trace data in FILL mode"
753	default y
754	depends on CORESIGHT_TRBE
755	select ARM64_WORKAROUND_TRBE_OVERWRITE_FILL_MODE
756	help
757	  This option adds the workaround for ARM Neoverse-N2 erratum 2139208.
758
759	  Affected Neoverse-N2 cores could overwrite up to 3 cache lines of trace
760	  data at the base of the buffer (pointed to by TRBASER_EL1) in FILL mode in
761	  the event of a WRAP event.
762
763	  Work around the issue by always making sure we move the TRBPTR_EL1 by
764	  256 bytes before enabling the buffer and filling the first 256 bytes of
765	  the buffer with ETM ignore packets upon disabling.
766
767	  If unsure, say Y.
768
769config ARM64_WORKAROUND_TSB_FLUSH_FAILURE
770	bool
771
772config ARM64_ERRATUM_2054223
773	bool "Cortex-A710: 2054223: workaround TSB instruction failing to flush trace"
774	default y
775	select ARM64_WORKAROUND_TSB_FLUSH_FAILURE
776	help
777	  Enable workaround for ARM Cortex-A710 erratum 2054223
778
779	  Affected cores may fail to flush the trace data on a TSB instruction, when
780	  the PE is in trace prohibited state. This will cause losing a few bytes
781	  of the trace cached.
782
783	  Workaround is to issue two TSB consecutively on affected cores.
784
785	  If unsure, say Y.
786
787config ARM64_ERRATUM_2067961
788	bool "Neoverse-N2: 2067961: workaround TSB instruction failing to flush trace"
789	default y
790	select ARM64_WORKAROUND_TSB_FLUSH_FAILURE
791	help
792	  Enable workaround for ARM Neoverse-N2 erratum 2067961
793
794	  Affected cores may fail to flush the trace data on a TSB instruction, when
795	  the PE is in trace prohibited state. This will cause losing a few bytes
796	  of the trace cached.
797
798	  Workaround is to issue two TSB consecutively on affected cores.
799
800	  If unsure, say Y.
801
802config ARM64_WORKAROUND_TRBE_WRITE_OUT_OF_RANGE
803	bool
804
805config ARM64_ERRATUM_2253138
806	bool "Neoverse-N2: 2253138: workaround TRBE writing to address out-of-range"
807	depends on CORESIGHT_TRBE
808	default y
809	select ARM64_WORKAROUND_TRBE_WRITE_OUT_OF_RANGE
810	help
811	  This option adds the workaround for ARM Neoverse-N2 erratum 2253138.
812
813	  Affected Neoverse-N2 cores might write to an out-of-range address, not reserved
814	  for TRBE. Under some conditions, the TRBE might generate a write to the next
815	  virtually addressed page following the last page of the TRBE address space
816	  (i.e., the TRBLIMITR_EL1.LIMIT), instead of wrapping around to the base.
817
818	  Work around this in the driver by always making sure that there is a
819	  page beyond the TRBLIMITR_EL1.LIMIT, within the space allowed for the TRBE.
820
821	  If unsure, say Y.
822
823config ARM64_ERRATUM_2224489
824	bool "Cortex-A710/X2: 2224489: workaround TRBE writing to address out-of-range"
825	depends on CORESIGHT_TRBE
826	default y
827	select ARM64_WORKAROUND_TRBE_WRITE_OUT_OF_RANGE
828	help
829	  This option adds the workaround for ARM Cortex-A710/X2 erratum 2224489.
830
831	  Affected Cortex-A710/X2 cores might write to an out-of-range address, not reserved
832	  for TRBE. Under some conditions, the TRBE might generate a write to the next
833	  virtually addressed page following the last page of the TRBE address space
834	  (i.e., the TRBLIMITR_EL1.LIMIT), instead of wrapping around to the base.
835
836	  Work around this in the driver by always making sure that there is a
837	  page beyond the TRBLIMITR_EL1.LIMIT, within the space allowed for the TRBE.
838
839	  If unsure, say Y.
840
841config ARM64_ERRATUM_2441009
842	bool "Cortex-A510: Completion of affected memory accesses might not be guaranteed by completion of a TLBI"
843	default y
844	select ARM64_WORKAROUND_REPEAT_TLBI
845	help
846	  This option adds a workaround for ARM Cortex-A510 erratum #2441009.
847
848	  Under very rare circumstances, affected Cortex-A510 CPUs
849	  may not handle a race between a break-before-make sequence on one
850	  CPU, and another CPU accessing the same page. This could allow a
851	  store to a page that has been unmapped.
852
853	  Work around this by adding the affected CPUs to the list that needs
854	  TLB sequences to be done twice.
855
856	  If unsure, say Y.
857
858config ARM64_ERRATUM_2064142
859	bool "Cortex-A510: 2064142: workaround TRBE register writes while disabled"
860	depends on CORESIGHT_TRBE
861	default y
862	help
863	  This option adds the workaround for ARM Cortex-A510 erratum 2064142.
864
865	  Affected Cortex-A510 core might fail to write into system registers after the
866	  TRBE has been disabled. Under some conditions after the TRBE has been disabled
867	  writes into TRBE registers TRBLIMITR_EL1, TRBPTR_EL1, TRBBASER_EL1, TRBSR_EL1,
868	  and TRBTRG_EL1 will be ignored and will not be effected.
869
870	  Work around this in the driver by executing TSB CSYNC and DSB after collection
871	  is stopped and before performing a system register write to one of the affected
872	  registers.
873
874	  If unsure, say Y.
875
876config ARM64_ERRATUM_2038923
877	bool "Cortex-A510: 2038923: workaround TRBE corruption with enable"
878	depends on CORESIGHT_TRBE
879	default y
880	help
881	  This option adds the workaround for ARM Cortex-A510 erratum 2038923.
882
883	  Affected Cortex-A510 core might cause an inconsistent view on whether trace is
884	  prohibited within the CPU. As a result, the trace buffer or trace buffer state
885	  might be corrupted. This happens after TRBE buffer has been enabled by setting
886	  TRBLIMITR_EL1.E, followed by just a single context synchronization event before
887	  execution changes from a context, in which trace is prohibited to one where it
888	  isn't, or vice versa. In these mentioned conditions, the view of whether trace
889	  is prohibited is inconsistent between parts of the CPU, and the trace buffer or
890	  the trace buffer state might be corrupted.
891
892	  Work around this in the driver by preventing an inconsistent view of whether the
893	  trace is prohibited or not based on TRBLIMITR_EL1.E by immediately following a
894	  change to TRBLIMITR_EL1.E with at least one ISB instruction before an ERET, or
895	  two ISB instructions if no ERET is to take place.
896
897	  If unsure, say Y.
898
899config ARM64_ERRATUM_1902691
900	bool "Cortex-A510: 1902691: workaround TRBE trace corruption"
901	depends on CORESIGHT_TRBE
902	default y
903	help
904	  This option adds the workaround for ARM Cortex-A510 erratum 1902691.
905
906	  Affected Cortex-A510 core might cause trace data corruption, when being written
907	  into the memory. Effectively TRBE is broken and hence cannot be used to capture
908	  trace data.
909
910	  Work around this problem in the driver by just preventing TRBE initialization on
911	  affected cpus. The firmware must have disabled the access to TRBE for the kernel
912	  on such implementations. This will cover the kernel for any firmware that doesn't
913	  do this already.
914
915	  If unsure, say Y.
916
917config ARM64_ERRATUM_2457168
918	bool "Cortex-A510: 2457168: workaround for AMEVCNTR01 incrementing incorrectly"
919	depends on ARM64_AMU_EXTN
920	default y
921	help
922	  This option adds the workaround for ARM Cortex-A510 erratum 2457168.
923
924	  The AMU counter AMEVCNTR01 (constant counter) should increment at the same rate
925	  as the system counter. On affected Cortex-A510 cores AMEVCNTR01 increments
926	  incorrectly giving a significantly higher output value.
927
928	  Work around this problem by returning 0 when reading the affected counter in
929	  key locations that results in disabling all users of this counter. This effect
930	  is the same to firmware disabling affected counters.
931
932	  If unsure, say Y.
933
934config CAVIUM_ERRATUM_22375
935	bool "Cavium erratum 22375, 24313"
936	default y
937	help
938	  Enable workaround for errata 22375 and 24313.
939
940	  This implements two gicv3-its errata workarounds for ThunderX. Both
941	  with a small impact affecting only ITS table allocation.
942
943	    erratum 22375: only alloc 8MB table size
944	    erratum 24313: ignore memory access type
945
946	  The fixes are in ITS initialization and basically ignore memory access
947	  type and table size provided by the TYPER and BASER registers.
948
949	  If unsure, say Y.
950
951config CAVIUM_ERRATUM_23144
952	bool "Cavium erratum 23144: ITS SYNC hang on dual socket system"
953	depends on NUMA
954	default y
955	help
956	  ITS SYNC command hang for cross node io and collections/cpu mapping.
957
958	  If unsure, say Y.
959
960config CAVIUM_ERRATUM_23154
961	bool "Cavium errata 23154 and 38545: GICv3 lacks HW synchronisation"
962	default y
963	help
964	  The ThunderX GICv3 implementation requires a modified version for
965	  reading the IAR status to ensure data synchronization
966	  (access to icc_iar1_el1 is not sync'ed before and after).
967
968	  It also suffers from erratum 38545 (also present on Marvell's
969	  OcteonTX and OcteonTX2), resulting in deactivated interrupts being
970	  spuriously presented to the CPU interface.
971
972	  If unsure, say Y.
973
974config CAVIUM_ERRATUM_27456
975	bool "Cavium erratum 27456: Broadcast TLBI instructions may cause icache corruption"
976	default y
977	help
978	  On ThunderX T88 pass 1.x through 2.1 parts, broadcast TLBI
979	  instructions may cause the icache to become corrupted if it
980	  contains data for a non-current ASID.  The fix is to
981	  invalidate the icache when changing the mm context.
982
983	  If unsure, say Y.
984
985config CAVIUM_ERRATUM_30115
986	bool "Cavium erratum 30115: Guest may disable interrupts in host"
987	default y
988	help
989	  On ThunderX T88 pass 1.x through 2.2, T81 pass 1.0 through
990	  1.2, and T83 Pass 1.0, KVM guest execution may disable
991	  interrupts in host. Trapping both GICv3 group-0 and group-1
992	  accesses sidesteps the issue.
993
994	  If unsure, say Y.
995
996config CAVIUM_TX2_ERRATUM_219
997	bool "Cavium ThunderX2 erratum 219: PRFM between TTBR change and ISB fails"
998	default y
999	help
1000	  On Cavium ThunderX2, a load, store or prefetch instruction between a
1001	  TTBR update and the corresponding context synchronizing operation can
1002	  cause a spurious Data Abort to be delivered to any hardware thread in
1003	  the CPU core.
1004
1005	  Work around the issue by avoiding the problematic code sequence and
1006	  trapping KVM guest TTBRx_EL1 writes to EL2 when SMT is enabled. The
1007	  trap handler performs the corresponding register access, skips the
1008	  instruction and ensures context synchronization by virtue of the
1009	  exception return.
1010
1011	  If unsure, say Y.
1012
1013config FUJITSU_ERRATUM_010001
1014	bool "Fujitsu-A64FX erratum E#010001: Undefined fault may occur wrongly"
1015	default y
1016	help
1017	  This option adds a workaround for Fujitsu-A64FX erratum E#010001.
1018	  On some variants of the Fujitsu-A64FX cores ver(1.0, 1.1), memory
1019	  accesses may cause undefined fault (Data abort, DFSC=0b111111).
1020	  This fault occurs under a specific hardware condition when a
1021	  load/store instruction performs an address translation using:
1022	  case-1  TTBR0_EL1 with TCR_EL1.NFD0 == 1.
1023	  case-2  TTBR0_EL2 with TCR_EL2.NFD0 == 1.
1024	  case-3  TTBR1_EL1 with TCR_EL1.NFD1 == 1.
1025	  case-4  TTBR1_EL2 with TCR_EL2.NFD1 == 1.
1026
1027	  The workaround is to ensure these bits are clear in TCR_ELx.
1028	  The workaround only affects the Fujitsu-A64FX.
1029
1030	  If unsure, say Y.
1031
1032config HISILICON_ERRATUM_161600802
1033	bool "Hip07 161600802: Erroneous redistributor VLPI base"
1034	default y
1035	help
1036	  The HiSilicon Hip07 SoC uses the wrong redistributor base
1037	  when issued ITS commands such as VMOVP and VMAPP, and requires
1038	  a 128kB offset to be applied to the target address in this commands.
1039
1040	  If unsure, say Y.
1041
1042config QCOM_FALKOR_ERRATUM_1003
1043	bool "Falkor E1003: Incorrect translation due to ASID change"
1044	default y
1045	help
1046	  On Falkor v1, an incorrect ASID may be cached in the TLB when ASID
1047	  and BADDR are changed together in TTBRx_EL1. Since we keep the ASID
1048	  in TTBR1_EL1, this situation only occurs in the entry trampoline and
1049	  then only for entries in the walk cache, since the leaf translation
1050	  is unchanged. Work around the erratum by invalidating the walk cache
1051	  entries for the trampoline before entering the kernel proper.
1052
1053config QCOM_FALKOR_ERRATUM_1009
1054	bool "Falkor E1009: Prematurely complete a DSB after a TLBI"
1055	default y
1056	select ARM64_WORKAROUND_REPEAT_TLBI
1057	help
1058	  On Falkor v1, the CPU may prematurely complete a DSB following a
1059	  TLBI xxIS invalidate maintenance operation. Repeat the TLBI operation
1060	  one more time to fix the issue.
1061
1062	  If unsure, say Y.
1063
1064config QCOM_QDF2400_ERRATUM_0065
1065	bool "QDF2400 E0065: Incorrect GITS_TYPER.ITT_Entry_size"
1066	default y
1067	help
1068	  On Qualcomm Datacenter Technologies QDF2400 SoC, ITS hardware reports
1069	  ITE size incorrectly. The GITS_TYPER.ITT_Entry_size field should have
1070	  been indicated as 16Bytes (0xf), not 8Bytes (0x7).
1071
1072	  If unsure, say Y.
1073
1074config QCOM_FALKOR_ERRATUM_E1041
1075	bool "Falkor E1041: Speculative instruction fetches might cause errant memory access"
1076	default y
1077	help
1078	  Falkor CPU may speculatively fetch instructions from an improper
1079	  memory location when MMU translation is changed from SCTLR_ELn[M]=1
1080	  to SCTLR_ELn[M]=0. Prefix an ISB instruction to fix the problem.
1081
1082	  If unsure, say Y.
1083
1084config NVIDIA_CARMEL_CNP_ERRATUM
1085	bool "NVIDIA Carmel CNP: CNP on Carmel semantically different than ARM cores"
1086	default y
1087	help
1088	  If CNP is enabled on Carmel cores, non-sharable TLBIs on a core will not
1089	  invalidate shared TLB entries installed by a different core, as it would
1090	  on standard ARM cores.
1091
1092	  If unsure, say Y.
1093
1094config SOCIONEXT_SYNQUACER_PREITS
1095	bool "Socionext Synquacer: Workaround for GICv3 pre-ITS"
1096	default y
1097	help
1098	  Socionext Synquacer SoCs implement a separate h/w block to generate
1099	  MSI doorbell writes with non-zero values for the device ID.
1100
1101	  If unsure, say Y.
1102
1103endmenu # "ARM errata workarounds via the alternatives framework"
1104
1105choice
1106	prompt "Page size"
1107	default ARM64_4K_PAGES
1108	help
1109	  Page size (translation granule) configuration.
1110
1111config ARM64_4K_PAGES
1112	bool "4KB"
1113	help
1114	  This feature enables 4KB pages support.
1115
1116config ARM64_16K_PAGES
1117	bool "16KB"
1118	help
1119	  The system will use 16KB pages support. AArch32 emulation
1120	  requires applications compiled with 16K (or a multiple of 16K)
1121	  aligned segments.
1122
1123config ARM64_64K_PAGES
1124	bool "64KB"
1125	help
1126	  This feature enables 64KB pages support (4KB by default)
1127	  allowing only two levels of page tables and faster TLB
1128	  look-up. AArch32 emulation requires applications compiled
1129	  with 64K aligned segments.
1130
1131endchoice
1132
1133choice
1134	prompt "Virtual address space size"
1135	default ARM64_VA_BITS_39 if ARM64_4K_PAGES
1136	default ARM64_VA_BITS_47 if ARM64_16K_PAGES
1137	default ARM64_VA_BITS_42 if ARM64_64K_PAGES
1138	help
1139	  Allows choosing one of multiple possible virtual address
1140	  space sizes. The level of translation table is determined by
1141	  a combination of page size and virtual address space size.
1142
1143config ARM64_VA_BITS_36
1144	bool "36-bit" if EXPERT
1145	depends on ARM64_16K_PAGES
1146
1147config ARM64_VA_BITS_39
1148	bool "39-bit"
1149	depends on ARM64_4K_PAGES
1150
1151config ARM64_VA_BITS_42
1152	bool "42-bit"
1153	depends on ARM64_64K_PAGES
1154
1155config ARM64_VA_BITS_47
1156	bool "47-bit"
1157	depends on ARM64_16K_PAGES
1158
1159config ARM64_VA_BITS_48
1160	bool "48-bit"
1161
1162config ARM64_VA_BITS_52
1163	bool "52-bit"
1164	depends on ARM64_64K_PAGES && (ARM64_PAN || !ARM64_SW_TTBR0_PAN)
1165	help
1166	  Enable 52-bit virtual addressing for userspace when explicitly
1167	  requested via a hint to mmap(). The kernel will also use 52-bit
1168	  virtual addresses for its own mappings (provided HW support for
1169	  this feature is available, otherwise it reverts to 48-bit).
1170
1171	  NOTE: Enabling 52-bit virtual addressing in conjunction with
1172	  ARMv8.3 Pointer Authentication will result in the PAC being
1173	  reduced from 7 bits to 3 bits, which may have a significant
1174	  impact on its susceptibility to brute-force attacks.
1175
1176	  If unsure, select 48-bit virtual addressing instead.
1177
1178endchoice
1179
1180config ARM64_FORCE_52BIT
1181	bool "Force 52-bit virtual addresses for userspace"
1182	depends on ARM64_VA_BITS_52 && EXPERT
1183	help
1184	  For systems with 52-bit userspace VAs enabled, the kernel will attempt
1185	  to maintain compatibility with older software by providing 48-bit VAs
1186	  unless a hint is supplied to mmap.
1187
1188	  This configuration option disables the 48-bit compatibility logic, and
1189	  forces all userspace addresses to be 52-bit on HW that supports it. One
1190	  should only enable this configuration option for stress testing userspace
1191	  memory management code. If unsure say N here.
1192
1193config ARM64_VA_BITS
1194	int
1195	default 36 if ARM64_VA_BITS_36
1196	default 39 if ARM64_VA_BITS_39
1197	default 42 if ARM64_VA_BITS_42
1198	default 47 if ARM64_VA_BITS_47
1199	default 48 if ARM64_VA_BITS_48
1200	default 52 if ARM64_VA_BITS_52
1201
1202choice
1203	prompt "Physical address space size"
1204	default ARM64_PA_BITS_48
1205	help
1206	  Choose the maximum physical address range that the kernel will
1207	  support.
1208
1209config ARM64_PA_BITS_48
1210	bool "48-bit"
1211
1212config ARM64_PA_BITS_52
1213	bool "52-bit (ARMv8.2)"
1214	depends on ARM64_64K_PAGES
1215	depends on ARM64_PAN || !ARM64_SW_TTBR0_PAN
1216	help
1217	  Enable support for a 52-bit physical address space, introduced as
1218	  part of the ARMv8.2-LPA extension.
1219
1220	  With this enabled, the kernel will also continue to work on CPUs that
1221	  do not support ARMv8.2-LPA, but with some added memory overhead (and
1222	  minor performance overhead).
1223
1224endchoice
1225
1226config ARM64_PA_BITS
1227	int
1228	default 48 if ARM64_PA_BITS_48
1229	default 52 if ARM64_PA_BITS_52
1230
1231choice
1232	prompt "Endianness"
1233	default CPU_LITTLE_ENDIAN
1234	help
1235	  Select the endianness of data accesses performed by the CPU. Userspace
1236	  applications will need to be compiled and linked for the endianness
1237	  that is selected here.
1238
1239config CPU_BIG_ENDIAN
1240	bool "Build big-endian kernel"
1241	depends on !LD_IS_LLD || LLD_VERSION >= 130000
1242	help
1243	  Say Y if you plan on running a kernel with a big-endian userspace.
1244
1245config CPU_LITTLE_ENDIAN
1246	bool "Build little-endian kernel"
1247	help
1248	  Say Y if you plan on running a kernel with a little-endian userspace.
1249	  This is usually the case for distributions targeting arm64.
1250
1251endchoice
1252
1253config SCHED_MC
1254	bool "Multi-core scheduler support"
1255	help
1256	  Multi-core scheduler support improves the CPU scheduler's decision
1257	  making when dealing with multi-core CPU chips at a cost of slightly
1258	  increased overhead in some places. If unsure say N here.
1259
1260config SCHED_CLUSTER
1261	bool "Cluster scheduler support"
1262	help
1263	  Cluster scheduler support improves the CPU scheduler's decision
1264	  making when dealing with machines that have clusters of CPUs.
1265	  Cluster usually means a couple of CPUs which are placed closely
1266	  by sharing mid-level caches, last-level cache tags or internal
1267	  busses.
1268
1269config SCHED_SMT
1270	bool "SMT scheduler support"
1271	help
1272	  Improves the CPU scheduler's decision making when dealing with
1273	  MultiThreading at a cost of slightly increased overhead in some
1274	  places. If unsure say N here.
1275
1276config NR_CPUS
1277	int "Maximum number of CPUs (2-4096)"
1278	range 2 4096
1279	default "256"
1280
1281config HOTPLUG_CPU
1282	bool "Support for hot-pluggable CPUs"
1283	select GENERIC_IRQ_MIGRATION
1284	help
1285	  Say Y here to experiment with turning CPUs off and on.  CPUs
1286	  can be controlled through /sys/devices/system/cpu.
1287
1288# Common NUMA Features
1289config NUMA
1290	bool "NUMA Memory Allocation and Scheduler Support"
1291	select GENERIC_ARCH_NUMA
1292	select ACPI_NUMA if ACPI
1293	select OF_NUMA
1294	select HAVE_SETUP_PER_CPU_AREA
1295	select NEED_PER_CPU_EMBED_FIRST_CHUNK
1296	select NEED_PER_CPU_PAGE_FIRST_CHUNK
1297	select USE_PERCPU_NUMA_NODE_ID
1298	help
1299	  Enable NUMA (Non-Uniform Memory Access) support.
1300
1301	  The kernel will try to allocate memory used by a CPU on the
1302	  local memory of the CPU and add some more
1303	  NUMA awareness to the kernel.
1304
1305config NODES_SHIFT
1306	int "Maximum NUMA Nodes (as a power of 2)"
1307	range 1 10
1308	default "4"
1309	depends on NUMA
1310	help
1311	  Specify the maximum number of NUMA Nodes available on the target
1312	  system.  Increases memory reserved to accommodate various tables.
1313
1314source "kernel/Kconfig.hz"
1315
1316config ARCH_SPARSEMEM_ENABLE
1317	def_bool y
1318	select SPARSEMEM_VMEMMAP_ENABLE
1319	select SPARSEMEM_VMEMMAP
1320
1321config HW_PERF_EVENTS
1322	def_bool y
1323	depends on ARM_PMU
1324
1325# Supported by clang >= 7.0 or GCC >= 12.0.0
1326config CC_HAVE_SHADOW_CALL_STACK
1327	def_bool $(cc-option, -fsanitize=shadow-call-stack -ffixed-x18)
1328
1329config PARAVIRT
1330	bool "Enable paravirtualization code"
1331	help
1332	  This changes the kernel so it can modify itself when it is run
1333	  under a hypervisor, potentially improving performance significantly
1334	  over full virtualization.
1335
1336config PARAVIRT_TIME_ACCOUNTING
1337	bool "Paravirtual steal time accounting"
1338	select PARAVIRT
1339	help
1340	  Select this option to enable fine granularity task steal time
1341	  accounting. Time spent executing other tasks in parallel with
1342	  the current vCPU is discounted from the vCPU power. To account for
1343	  that, there can be a small performance impact.
1344
1345	  If in doubt, say N here.
1346
1347config KEXEC
1348	depends on PM_SLEEP_SMP
1349	select KEXEC_CORE
1350	bool "kexec system call"
1351	help
1352	  kexec is a system call that implements the ability to shutdown your
1353	  current kernel, and to start another kernel.  It is like a reboot
1354	  but it is independent of the system firmware.   And like a reboot
1355	  you can start any kernel with it, not just Linux.
1356
1357config KEXEC_FILE
1358	bool "kexec file based system call"
1359	select KEXEC_CORE
1360	select HAVE_IMA_KEXEC if IMA
1361	help
1362	  This is new version of kexec system call. This system call is
1363	  file based and takes file descriptors as system call argument
1364	  for kernel and initramfs as opposed to list of segments as
1365	  accepted by previous system call.
1366
1367config KEXEC_SIG
1368	bool "Verify kernel signature during kexec_file_load() syscall"
1369	depends on KEXEC_FILE
1370	help
1371	  Select this option to verify a signature with loaded kernel
1372	  image. If configured, any attempt of loading a image without
1373	  valid signature will fail.
1374
1375	  In addition to that option, you need to enable signature
1376	  verification for the corresponding kernel image type being
1377	  loaded in order for this to work.
1378
1379config KEXEC_IMAGE_VERIFY_SIG
1380	bool "Enable Image signature verification support"
1381	default y
1382	depends on KEXEC_SIG
1383	depends on EFI && SIGNED_PE_FILE_VERIFICATION
1384	help
1385	  Enable Image signature verification support.
1386
1387comment "Support for PE file signature verification disabled"
1388	depends on KEXEC_SIG
1389	depends on !EFI || !SIGNED_PE_FILE_VERIFICATION
1390
1391config CRASH_DUMP
1392	bool "Build kdump crash kernel"
1393	help
1394	  Generate crash dump after being started by kexec. This should
1395	  be normally only set in special crash dump kernels which are
1396	  loaded in the main kernel with kexec-tools into a specially
1397	  reserved region and then later executed after a crash by
1398	  kdump/kexec.
1399
1400	  For more details see Documentation/admin-guide/kdump/kdump.rst
1401
1402config TRANS_TABLE
1403	def_bool y
1404	depends on HIBERNATION || KEXEC_CORE
1405
1406config XEN_DOM0
1407	def_bool y
1408	depends on XEN
1409
1410config XEN
1411	bool "Xen guest support on ARM64"
1412	depends on ARM64 && OF
1413	select SWIOTLB_XEN
1414	select PARAVIRT
1415	help
1416	  Say Y if you want to run Linux in a Virtual Machine on Xen on ARM64.
1417
1418config FORCE_MAX_ZONEORDER
1419	int
1420	default "14" if ARM64_64K_PAGES
1421	default "12" if ARM64_16K_PAGES
1422	default "11"
1423	help
1424	  The kernel memory allocator divides physically contiguous memory
1425	  blocks into "zones", where each zone is a power of two number of
1426	  pages.  This option selects the largest power of two that the kernel
1427	  keeps in the memory allocator.  If you need to allocate very large
1428	  blocks of physically contiguous memory, then you may need to
1429	  increase this value.
1430
1431	  This config option is actually maximum order plus one. For example,
1432	  a value of 11 means that the largest free memory block is 2^10 pages.
1433
1434	  We make sure that we can allocate upto a HugePage size for each configuration.
1435	  Hence we have :
1436		MAX_ORDER = (PMD_SHIFT - PAGE_SHIFT) + 1 => PAGE_SHIFT - 2
1437
1438	  However for 4K, we choose a higher default value, 11 as opposed to 10, giving us
1439	  4M allocations matching the default size used by generic code.
1440
1441config UNMAP_KERNEL_AT_EL0
1442	bool "Unmap kernel when running in userspace (aka \"KAISER\")" if EXPERT
1443	default y
1444	help
1445	  Speculation attacks against some high-performance processors can
1446	  be used to bypass MMU permission checks and leak kernel data to
1447	  userspace. This can be defended against by unmapping the kernel
1448	  when running in userspace, mapping it back in on exception entry
1449	  via a trampoline page in the vector table.
1450
1451	  If unsure, say Y.
1452
1453config MITIGATE_SPECTRE_BRANCH_HISTORY
1454	bool "Mitigate Spectre style attacks against branch history" if EXPERT
1455	default y
1456	help
1457	  Speculation attacks against some high-performance processors can
1458	  make use of branch history to influence future speculation.
1459	  When taking an exception from user-space, a sequence of branches
1460	  or a firmware call overwrites the branch history.
1461
1462config RODATA_FULL_DEFAULT_ENABLED
1463	bool "Apply r/o permissions of VM areas also to their linear aliases"
1464	default y
1465	help
1466	  Apply read-only attributes of VM areas to the linear alias of
1467	  the backing pages as well. This prevents code or read-only data
1468	  from being modified (inadvertently or intentionally) via another
1469	  mapping of the same memory page. This additional enhancement can
1470	  be turned off at runtime by passing rodata=[off|on] (and turned on
1471	  with rodata=full if this option is set to 'n')
1472
1473	  This requires the linear region to be mapped down to pages,
1474	  which may adversely affect performance in some cases.
1475
1476config ARM64_SW_TTBR0_PAN
1477	bool "Emulate Privileged Access Never using TTBR0_EL1 switching"
1478	help
1479	  Enabling this option prevents the kernel from accessing
1480	  user-space memory directly by pointing TTBR0_EL1 to a reserved
1481	  zeroed area and reserved ASID. The user access routines
1482	  restore the valid TTBR0_EL1 temporarily.
1483
1484config ARM64_TAGGED_ADDR_ABI
1485	bool "Enable the tagged user addresses syscall ABI"
1486	default y
1487	help
1488	  When this option is enabled, user applications can opt in to a
1489	  relaxed ABI via prctl() allowing tagged addresses to be passed
1490	  to system calls as pointer arguments. For details, see
1491	  Documentation/arm64/tagged-address-abi.rst.
1492
1493menuconfig COMPAT
1494	bool "Kernel support for 32-bit EL0"
1495	depends on ARM64_4K_PAGES || EXPERT
1496	select HAVE_UID16
1497	select OLD_SIGSUSPEND3
1498	select COMPAT_OLD_SIGACTION
1499	help
1500	  This option enables support for a 32-bit EL0 running under a 64-bit
1501	  kernel at EL1. AArch32-specific components such as system calls,
1502	  the user helper functions, VFP support and the ptrace interface are
1503	  handled appropriately by the kernel.
1504
1505	  If you use a page size other than 4KB (i.e, 16KB or 64KB), please be aware
1506	  that you will only be able to execute AArch32 binaries that were compiled
1507	  with page size aligned segments.
1508
1509	  If you want to execute 32-bit userspace applications, say Y.
1510
1511if COMPAT
1512
1513config KUSER_HELPERS
1514	bool "Enable kuser helpers page for 32-bit applications"
1515	default y
1516	help
1517	  Warning: disabling this option may break 32-bit user programs.
1518
1519	  Provide kuser helpers to compat tasks. The kernel provides
1520	  helper code to userspace in read only form at a fixed location
1521	  to allow userspace to be independent of the CPU type fitted to
1522	  the system. This permits binaries to be run on ARMv4 through
1523	  to ARMv8 without modification.
1524
1525	  See Documentation/arm/kernel_user_helpers.rst for details.
1526
1527	  However, the fixed address nature of these helpers can be used
1528	  by ROP (return orientated programming) authors when creating
1529	  exploits.
1530
1531	  If all of the binaries and libraries which run on your platform
1532	  are built specifically for your platform, and make no use of
1533	  these helpers, then you can turn this option off to hinder
1534	  such exploits. However, in that case, if a binary or library
1535	  relying on those helpers is run, it will not function correctly.
1536
1537	  Say N here only if you are absolutely certain that you do not
1538	  need these helpers; otherwise, the safe option is to say Y.
1539
1540config COMPAT_VDSO
1541	bool "Enable vDSO for 32-bit applications"
1542	depends on !CPU_BIG_ENDIAN
1543	depends on (CC_IS_CLANG && LD_IS_LLD) || "$(CROSS_COMPILE_COMPAT)" != ""
1544	select GENERIC_COMPAT_VDSO
1545	default y
1546	help
1547	  Place in the process address space of 32-bit applications an
1548	  ELF shared object providing fast implementations of gettimeofday
1549	  and clock_gettime.
1550
1551	  You must have a 32-bit build of glibc 2.22 or later for programs
1552	  to seamlessly take advantage of this.
1553
1554config THUMB2_COMPAT_VDSO
1555	bool "Compile the 32-bit vDSO for Thumb-2 mode" if EXPERT
1556	depends on COMPAT_VDSO
1557	default y
1558	help
1559	  Compile the compat vDSO with '-mthumb -fomit-frame-pointer' if y,
1560	  otherwise with '-marm'.
1561
1562menuconfig ARMV8_DEPRECATED
1563	bool "Emulate deprecated/obsolete ARMv8 instructions"
1564	depends on SYSCTL
1565	help
1566	  Legacy software support may require certain instructions
1567	  that have been deprecated or obsoleted in the architecture.
1568
1569	  Enable this config to enable selective emulation of these
1570	  features.
1571
1572	  If unsure, say Y
1573
1574if ARMV8_DEPRECATED
1575
1576config SWP_EMULATION
1577	bool "Emulate SWP/SWPB instructions"
1578	help
1579	  ARMv8 obsoletes the use of A32 SWP/SWPB instructions such that
1580	  they are always undefined. Say Y here to enable software
1581	  emulation of these instructions for userspace using LDXR/STXR.
1582	  This feature can be controlled at runtime with the abi.swp
1583	  sysctl which is disabled by default.
1584
1585	  In some older versions of glibc [<=2.8] SWP is used during futex
1586	  trylock() operations with the assumption that the code will not
1587	  be preempted. This invalid assumption may be more likely to fail
1588	  with SWP emulation enabled, leading to deadlock of the user
1589	  application.
1590
1591	  NOTE: when accessing uncached shared regions, LDXR/STXR rely
1592	  on an external transaction monitoring block called a global
1593	  monitor to maintain update atomicity. If your system does not
1594	  implement a global monitor, this option can cause programs that
1595	  perform SWP operations to uncached memory to deadlock.
1596
1597	  If unsure, say Y
1598
1599config CP15_BARRIER_EMULATION
1600	bool "Emulate CP15 Barrier instructions"
1601	help
1602	  The CP15 barrier instructions - CP15ISB, CP15DSB, and
1603	  CP15DMB - are deprecated in ARMv8 (and ARMv7). It is
1604	  strongly recommended to use the ISB, DSB, and DMB
1605	  instructions instead.
1606
1607	  Say Y here to enable software emulation of these
1608	  instructions for AArch32 userspace code. When this option is
1609	  enabled, CP15 barrier usage is traced which can help
1610	  identify software that needs updating. This feature can be
1611	  controlled at runtime with the abi.cp15_barrier sysctl.
1612
1613	  If unsure, say Y
1614
1615config SETEND_EMULATION
1616	bool "Emulate SETEND instruction"
1617	help
1618	  The SETEND instruction alters the data-endianness of the
1619	  AArch32 EL0, and is deprecated in ARMv8.
1620
1621	  Say Y here to enable software emulation of the instruction
1622	  for AArch32 userspace code. This feature can be controlled
1623	  at runtime with the abi.setend sysctl.
1624
1625	  Note: All the cpus on the system must have mixed endian support at EL0
1626	  for this feature to be enabled. If a new CPU - which doesn't support mixed
1627	  endian - is hotplugged in after this feature has been enabled, there could
1628	  be unexpected results in the applications.
1629
1630	  If unsure, say Y
1631endif # ARMV8_DEPRECATED
1632
1633endif # COMPAT
1634
1635menu "ARMv8.1 architectural features"
1636
1637config ARM64_HW_AFDBM
1638	bool "Support for hardware updates of the Access and Dirty page flags"
1639	default y
1640	help
1641	  The ARMv8.1 architecture extensions introduce support for
1642	  hardware updates of the access and dirty information in page
1643	  table entries. When enabled in TCR_EL1 (HA and HD bits) on
1644	  capable processors, accesses to pages with PTE_AF cleared will
1645	  set this bit instead of raising an access flag fault.
1646	  Similarly, writes to read-only pages with the DBM bit set will
1647	  clear the read-only bit (AP[2]) instead of raising a
1648	  permission fault.
1649
1650	  Kernels built with this configuration option enabled continue
1651	  to work on pre-ARMv8.1 hardware and the performance impact is
1652	  minimal. If unsure, say Y.
1653
1654config ARM64_PAN
1655	bool "Enable support for Privileged Access Never (PAN)"
1656	default y
1657	help
1658	  Privileged Access Never (PAN; part of the ARMv8.1 Extensions)
1659	  prevents the kernel or hypervisor from accessing user-space (EL0)
1660	  memory directly.
1661
1662	  Choosing this option will cause any unprotected (not using
1663	  copy_to_user et al) memory access to fail with a permission fault.
1664
1665	  The feature is detected at runtime, and will remain as a 'nop'
1666	  instruction if the cpu does not implement the feature.
1667
1668config AS_HAS_LDAPR
1669	def_bool $(as-instr,.arch_extension rcpc)
1670
1671config AS_HAS_LSE_ATOMICS
1672	def_bool $(as-instr,.arch_extension lse)
1673
1674config ARM64_LSE_ATOMICS
1675	bool
1676	default ARM64_USE_LSE_ATOMICS
1677	depends on AS_HAS_LSE_ATOMICS
1678
1679config ARM64_USE_LSE_ATOMICS
1680	bool "Atomic instructions"
1681	depends on JUMP_LABEL
1682	default y
1683	help
1684	  As part of the Large System Extensions, ARMv8.1 introduces new
1685	  atomic instructions that are designed specifically to scale in
1686	  very large systems.
1687
1688	  Say Y here to make use of these instructions for the in-kernel
1689	  atomic routines. This incurs a small overhead on CPUs that do
1690	  not support these instructions and requires the kernel to be
1691	  built with binutils >= 2.25 in order for the new instructions
1692	  to be used.
1693
1694endmenu # "ARMv8.1 architectural features"
1695
1696menu "ARMv8.2 architectural features"
1697
1698config AS_HAS_ARMV8_2
1699	def_bool $(cc-option,-Wa$(comma)-march=armv8.2-a)
1700
1701config AS_HAS_SHA3
1702	def_bool $(as-instr,.arch armv8.2-a+sha3)
1703
1704config ARM64_PMEM
1705	bool "Enable support for persistent memory"
1706	select ARCH_HAS_PMEM_API
1707	select ARCH_HAS_UACCESS_FLUSHCACHE
1708	help
1709	  Say Y to enable support for the persistent memory API based on the
1710	  ARMv8.2 DCPoP feature.
1711
1712	  The feature is detected at runtime, and the kernel will use DC CVAC
1713	  operations if DC CVAP is not supported (following the behaviour of
1714	  DC CVAP itself if the system does not define a point of persistence).
1715
1716config ARM64_RAS_EXTN
1717	bool "Enable support for RAS CPU Extensions"
1718	default y
1719	help
1720	  CPUs that support the Reliability, Availability and Serviceability
1721	  (RAS) Extensions, part of ARMv8.2 are able to track faults and
1722	  errors, classify them and report them to software.
1723
1724	  On CPUs with these extensions system software can use additional
1725	  barriers to determine if faults are pending and read the
1726	  classification from a new set of registers.
1727
1728	  Selecting this feature will allow the kernel to use these barriers
1729	  and access the new registers if the system supports the extension.
1730	  Platform RAS features may additionally depend on firmware support.
1731
1732config ARM64_CNP
1733	bool "Enable support for Common Not Private (CNP) translations"
1734	default y
1735	depends on ARM64_PAN || !ARM64_SW_TTBR0_PAN
1736	help
1737	  Common Not Private (CNP) allows translation table entries to
1738	  be shared between different PEs in the same inner shareable
1739	  domain, so the hardware can use this fact to optimise the
1740	  caching of such entries in the TLB.
1741
1742	  Selecting this option allows the CNP feature to be detected
1743	  at runtime, and does not affect PEs that do not implement
1744	  this feature.
1745
1746endmenu # "ARMv8.2 architectural features"
1747
1748menu "ARMv8.3 architectural features"
1749
1750config ARM64_PTR_AUTH
1751	bool "Enable support for pointer authentication"
1752	default y
1753	help
1754	  Pointer authentication (part of the ARMv8.3 Extensions) provides
1755	  instructions for signing and authenticating pointers against secret
1756	  keys, which can be used to mitigate Return Oriented Programming (ROP)
1757	  and other attacks.
1758
1759	  This option enables these instructions at EL0 (i.e. for userspace).
1760	  Choosing this option will cause the kernel to initialise secret keys
1761	  for each process at exec() time, with these keys being
1762	  context-switched along with the process.
1763
1764	  The feature is detected at runtime. If the feature is not present in
1765	  hardware it will not be advertised to userspace/KVM guest nor will it
1766	  be enabled.
1767
1768	  If the feature is present on the boot CPU but not on a late CPU, then
1769	  the late CPU will be parked. Also, if the boot CPU does not have
1770	  address auth and the late CPU has then the late CPU will still boot
1771	  but with the feature disabled. On such a system, this option should
1772	  not be selected.
1773
1774config ARM64_PTR_AUTH_KERNEL
1775	bool "Use pointer authentication for kernel"
1776	default y
1777	depends on ARM64_PTR_AUTH
1778	depends on (CC_HAS_SIGN_RETURN_ADDRESS || CC_HAS_BRANCH_PROT_PAC_RET) && AS_HAS_PAC
1779	# Modern compilers insert a .note.gnu.property section note for PAC
1780	# which is only understood by binutils starting with version 2.33.1.
1781	depends on LD_IS_LLD || LD_VERSION >= 23301 || (CC_IS_GCC && GCC_VERSION < 90100)
1782	depends on !CC_IS_CLANG || AS_HAS_CFI_NEGATE_RA_STATE
1783	depends on (!FUNCTION_GRAPH_TRACER || DYNAMIC_FTRACE_WITH_REGS)
1784	help
1785	  If the compiler supports the -mbranch-protection or
1786	  -msign-return-address flag (e.g. GCC 7 or later), then this option
1787	  will cause the kernel itself to be compiled with return address
1788	  protection. In this case, and if the target hardware is known to
1789	  support pointer authentication, then CONFIG_STACKPROTECTOR can be
1790	  disabled with minimal loss of protection.
1791
1792	  This feature works with FUNCTION_GRAPH_TRACER option only if
1793	  DYNAMIC_FTRACE_WITH_REGS is enabled.
1794
1795config CC_HAS_BRANCH_PROT_PAC_RET
1796	# GCC 9 or later, clang 8 or later
1797	def_bool $(cc-option,-mbranch-protection=pac-ret+leaf)
1798
1799config CC_HAS_SIGN_RETURN_ADDRESS
1800	# GCC 7, 8
1801	def_bool $(cc-option,-msign-return-address=all)
1802
1803config AS_HAS_PAC
1804	def_bool $(cc-option,-Wa$(comma)-march=armv8.3-a)
1805
1806config AS_HAS_CFI_NEGATE_RA_STATE
1807	def_bool $(as-instr,.cfi_startproc\n.cfi_negate_ra_state\n.cfi_endproc\n)
1808
1809endmenu # "ARMv8.3 architectural features"
1810
1811menu "ARMv8.4 architectural features"
1812
1813config ARM64_AMU_EXTN
1814	bool "Enable support for the Activity Monitors Unit CPU extension"
1815	default y
1816	help
1817	  The activity monitors extension is an optional extension introduced
1818	  by the ARMv8.4 CPU architecture. This enables support for version 1
1819	  of the activity monitors architecture, AMUv1.
1820
1821	  To enable the use of this extension on CPUs that implement it, say Y.
1822
1823	  Note that for architectural reasons, firmware _must_ implement AMU
1824	  support when running on CPUs that present the activity monitors
1825	  extension. The required support is present in:
1826	    * Version 1.5 and later of the ARM Trusted Firmware
1827
1828	  For kernels that have this configuration enabled but boot with broken
1829	  firmware, you may need to say N here until the firmware is fixed.
1830	  Otherwise you may experience firmware panics or lockups when
1831	  accessing the counter registers. Even if you are not observing these
1832	  symptoms, the values returned by the register reads might not
1833	  correctly reflect reality. Most commonly, the value read will be 0,
1834	  indicating that the counter is not enabled.
1835
1836config AS_HAS_ARMV8_4
1837	def_bool $(cc-option,-Wa$(comma)-march=armv8.4-a)
1838
1839config ARM64_TLB_RANGE
1840	bool "Enable support for tlbi range feature"
1841	default y
1842	depends on AS_HAS_ARMV8_4
1843	help
1844	  ARMv8.4-TLBI provides TLBI invalidation instruction that apply to a
1845	  range of input addresses.
1846
1847	  The feature introduces new assembly instructions, and they were
1848	  support when binutils >= 2.30.
1849
1850endmenu # "ARMv8.4 architectural features"
1851
1852menu "ARMv8.5 architectural features"
1853
1854config AS_HAS_ARMV8_5
1855	def_bool $(cc-option,-Wa$(comma)-march=armv8.5-a)
1856
1857config ARM64_BTI
1858	bool "Branch Target Identification support"
1859	default y
1860	help
1861	  Branch Target Identification (part of the ARMv8.5 Extensions)
1862	  provides a mechanism to limit the set of locations to which computed
1863	  branch instructions such as BR or BLR can jump.
1864
1865	  To make use of BTI on CPUs that support it, say Y.
1866
1867	  BTI is intended to provide complementary protection to other control
1868	  flow integrity protection mechanisms, such as the Pointer
1869	  authentication mechanism provided as part of the ARMv8.3 Extensions.
1870	  For this reason, it does not make sense to enable this option without
1871	  also enabling support for pointer authentication.  Thus, when
1872	  enabling this option you should also select ARM64_PTR_AUTH=y.
1873
1874	  Userspace binaries must also be specifically compiled to make use of
1875	  this mechanism.  If you say N here or the hardware does not support
1876	  BTI, such binaries can still run, but you get no additional
1877	  enforcement of branch destinations.
1878
1879config ARM64_BTI_KERNEL
1880	bool "Use Branch Target Identification for kernel"
1881	default y
1882	depends on ARM64_BTI
1883	depends on ARM64_PTR_AUTH_KERNEL
1884	depends on CC_HAS_BRANCH_PROT_PAC_RET_BTI
1885	# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94697
1886	depends on !CC_IS_GCC || GCC_VERSION >= 100100
1887	# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106671
1888	depends on !CC_IS_GCC
1889	# https://github.com/llvm/llvm-project/commit/a88c722e687e6780dcd6a58718350dc76fcc4cc9
1890	depends on !CC_IS_CLANG || CLANG_VERSION >= 120000
1891	depends on (!FUNCTION_GRAPH_TRACER || DYNAMIC_FTRACE_WITH_REGS)
1892	help
1893	  Build the kernel with Branch Target Identification annotations
1894	  and enable enforcement of this for kernel code. When this option
1895	  is enabled and the system supports BTI all kernel code including
1896	  modular code must have BTI enabled.
1897
1898config CC_HAS_BRANCH_PROT_PAC_RET_BTI
1899	# GCC 9 or later, clang 8 or later
1900	def_bool $(cc-option,-mbranch-protection=pac-ret+leaf+bti)
1901
1902config ARM64_E0PD
1903	bool "Enable support for E0PD"
1904	default y
1905	help
1906	  E0PD (part of the ARMv8.5 extensions) allows us to ensure
1907	  that EL0 accesses made via TTBR1 always fault in constant time,
1908	  providing similar benefits to KASLR as those provided by KPTI, but
1909	  with lower overhead and without disrupting legitimate access to
1910	  kernel memory such as SPE.
1911
1912	  This option enables E0PD for TTBR1 where available.
1913
1914config ARCH_RANDOM
1915	bool "Enable support for random number generation"
1916	default y
1917	help
1918	  Random number generation (part of the ARMv8.5 Extensions)
1919	  provides a high bandwidth, cryptographically secure
1920	  hardware random number generator.
1921
1922config ARM64_AS_HAS_MTE
1923	# Initial support for MTE went in binutils 2.32.0, checked with
1924	# ".arch armv8.5-a+memtag" below. However, this was incomplete
1925	# as a late addition to the final architecture spec (LDGM/STGM)
1926	# is only supported in the newer 2.32.x and 2.33 binutils
1927	# versions, hence the extra "stgm" instruction check below.
1928	def_bool $(as-instr,.arch armv8.5-a+memtag\nstgm xzr$(comma)[x0])
1929
1930config ARM64_MTE
1931	bool "Memory Tagging Extension support"
1932	default y
1933	depends on ARM64_AS_HAS_MTE && ARM64_TAGGED_ADDR_ABI
1934	depends on AS_HAS_ARMV8_5
1935	depends on AS_HAS_LSE_ATOMICS
1936	# Required for tag checking in the uaccess routines
1937	depends on ARM64_PAN
1938	select ARCH_HAS_SUBPAGE_FAULTS
1939	select ARCH_USES_HIGH_VMA_FLAGS
1940	help
1941	  Memory Tagging (part of the ARMv8.5 Extensions) provides
1942	  architectural support for run-time, always-on detection of
1943	  various classes of memory error to aid with software debugging
1944	  to eliminate vulnerabilities arising from memory-unsafe
1945	  languages.
1946
1947	  This option enables the support for the Memory Tagging
1948	  Extension at EL0 (i.e. for userspace).
1949
1950	  Selecting this option allows the feature to be detected at
1951	  runtime. Any secondary CPU not implementing this feature will
1952	  not be allowed a late bring-up.
1953
1954	  Userspace binaries that want to use this feature must
1955	  explicitly opt in. The mechanism for the userspace is
1956	  described in:
1957
1958	  Documentation/arm64/memory-tagging-extension.rst.
1959
1960endmenu # "ARMv8.5 architectural features"
1961
1962menu "ARMv8.7 architectural features"
1963
1964config ARM64_EPAN
1965	bool "Enable support for Enhanced Privileged Access Never (EPAN)"
1966	default y
1967	depends on ARM64_PAN
1968	help
1969	  Enhanced Privileged Access Never (EPAN) allows Privileged
1970	  Access Never to be used with Execute-only mappings.
1971
1972	  The feature is detected at runtime, and will remain disabled
1973	  if the cpu does not implement the feature.
1974endmenu # "ARMv8.7 architectural features"
1975
1976config ARM64_SVE
1977	bool "ARM Scalable Vector Extension support"
1978	default y
1979	help
1980	  The Scalable Vector Extension (SVE) is an extension to the AArch64
1981	  execution state which complements and extends the SIMD functionality
1982	  of the base architecture to support much larger vectors and to enable
1983	  additional vectorisation opportunities.
1984
1985	  To enable use of this extension on CPUs that implement it, say Y.
1986
1987	  On CPUs that support the SVE2 extensions, this option will enable
1988	  those too.
1989
1990	  Note that for architectural reasons, firmware _must_ implement SVE
1991	  support when running on SVE capable hardware.  The required support
1992	  is present in:
1993
1994	    * version 1.5 and later of the ARM Trusted Firmware
1995	    * the AArch64 boot wrapper since commit 5e1261e08abf
1996	      ("bootwrapper: SVE: Enable SVE for EL2 and below").
1997
1998	  For other firmware implementations, consult the firmware documentation
1999	  or vendor.
2000
2001	  If you need the kernel to boot on SVE-capable hardware with broken
2002	  firmware, you may need to say N here until you get your firmware
2003	  fixed.  Otherwise, you may experience firmware panics or lockups when
2004	  booting the kernel.  If unsure and you are not observing these
2005	  symptoms, you should assume that it is safe to say Y.
2006
2007config ARM64_SME
2008	bool "ARM Scalable Matrix Extension support"
2009	default y
2010	depends on ARM64_SVE
2011	help
2012	  The Scalable Matrix Extension (SME) is an extension to the AArch64
2013	  execution state which utilises a substantial subset of the SVE
2014	  instruction set, together with the addition of new architectural
2015	  register state capable of holding two dimensional matrix tiles to
2016	  enable various matrix operations.
2017
2018config ARM64_MODULE_PLTS
2019	bool "Use PLTs to allow module memory to spill over into vmalloc area"
2020	depends on MODULES
2021	select HAVE_MOD_ARCH_SPECIFIC
2022	help
2023	  Allocate PLTs when loading modules so that jumps and calls whose
2024	  targets are too far away for their relative offsets to be encoded
2025	  in the instructions themselves can be bounced via veneers in the
2026	  module's PLT. This allows modules to be allocated in the generic
2027	  vmalloc area after the dedicated module memory area has been
2028	  exhausted.
2029
2030	  When running with address space randomization (KASLR), the module
2031	  region itself may be too far away for ordinary relative jumps and
2032	  calls, and so in that case, module PLTs are required and cannot be
2033	  disabled.
2034
2035	  Specific errata workaround(s) might also force module PLTs to be
2036	  enabled (ARM64_ERRATUM_843419).
2037
2038config ARM64_PSEUDO_NMI
2039	bool "Support for NMI-like interrupts"
2040	select ARM_GIC_V3
2041	help
2042	  Adds support for mimicking Non-Maskable Interrupts through the use of
2043	  GIC interrupt priority. This support requires version 3 or later of
2044	  ARM GIC.
2045
2046	  This high priority configuration for interrupts needs to be
2047	  explicitly enabled by setting the kernel parameter
2048	  "irqchip.gicv3_pseudo_nmi" to 1.
2049
2050	  If unsure, say N
2051
2052if ARM64_PSEUDO_NMI
2053config ARM64_DEBUG_PRIORITY_MASKING
2054	bool "Debug interrupt priority masking"
2055	help
2056	  This adds runtime checks to functions enabling/disabling
2057	  interrupts when using priority masking. The additional checks verify
2058	  the validity of ICC_PMR_EL1 when calling concerned functions.
2059
2060	  If unsure, say N
2061endif # ARM64_PSEUDO_NMI
2062
2063config RELOCATABLE
2064	bool "Build a relocatable kernel image" if EXPERT
2065	select ARCH_HAS_RELR
2066	default y
2067	help
2068	  This builds the kernel as a Position Independent Executable (PIE),
2069	  which retains all relocation metadata required to relocate the
2070	  kernel binary at runtime to a different virtual address than the
2071	  address it was linked at.
2072	  Since AArch64 uses the RELA relocation format, this requires a
2073	  relocation pass at runtime even if the kernel is loaded at the
2074	  same address it was linked at.
2075
2076config RANDOMIZE_BASE
2077	bool "Randomize the address of the kernel image"
2078	select ARM64_MODULE_PLTS if MODULES
2079	select RELOCATABLE
2080	help
2081	  Randomizes the virtual address at which the kernel image is
2082	  loaded, as a security feature that deters exploit attempts
2083	  relying on knowledge of the location of kernel internals.
2084
2085	  It is the bootloader's job to provide entropy, by passing a
2086	  random u64 value in /chosen/kaslr-seed at kernel entry.
2087
2088	  When booting via the UEFI stub, it will invoke the firmware's
2089	  EFI_RNG_PROTOCOL implementation (if available) to supply entropy
2090	  to the kernel proper. In addition, it will randomise the physical
2091	  location of the kernel Image as well.
2092
2093	  If unsure, say N.
2094
2095config RANDOMIZE_MODULE_REGION_FULL
2096	bool "Randomize the module region over a 2 GB range"
2097	depends on RANDOMIZE_BASE
2098	default y
2099	help
2100	  Randomizes the location of the module region inside a 2 GB window
2101	  covering the core kernel. This way, it is less likely for modules
2102	  to leak information about the location of core kernel data structures
2103	  but it does imply that function calls between modules and the core
2104	  kernel will need to be resolved via veneers in the module PLT.
2105
2106	  When this option is not set, the module region will be randomized over
2107	  a limited range that contains the [_stext, _etext] interval of the
2108	  core kernel, so branch relocations are almost always in range unless
2109	  ARM64_MODULE_PLTS is enabled and the region is exhausted. In this
2110	  particular case of region exhaustion, modules might be able to fall
2111	  back to a larger 2GB area.
2112
2113config CC_HAVE_STACKPROTECTOR_SYSREG
2114	def_bool $(cc-option,-mstack-protector-guard=sysreg -mstack-protector-guard-reg=sp_el0 -mstack-protector-guard-offset=0)
2115
2116config STACKPROTECTOR_PER_TASK
2117	def_bool y
2118	depends on STACKPROTECTOR && CC_HAVE_STACKPROTECTOR_SYSREG
2119
2120# The GPIO number here must be sorted by descending number. In case of
2121# a multiplatform kernel, we just want the highest value required by the
2122# selected platforms.
2123config ARCH_NR_GPIO
2124        int
2125        default 2048 if ARCH_APPLE
2126        default 0
2127        help
2128          Maximum number of GPIOs in the system.
2129
2130          If unsure, leave the default value.
2131
2132endmenu # "Kernel Features"
2133
2134menu "Boot options"
2135
2136config ARM64_ACPI_PARKING_PROTOCOL
2137	bool "Enable support for the ARM64 ACPI parking protocol"
2138	depends on ACPI
2139	help
2140	  Enable support for the ARM64 ACPI parking protocol. If disabled
2141	  the kernel will not allow booting through the ARM64 ACPI parking
2142	  protocol even if the corresponding data is present in the ACPI
2143	  MADT table.
2144
2145config CMDLINE
2146	string "Default kernel command string"
2147	default ""
2148	help
2149	  Provide a set of default command-line options at build time by
2150	  entering them here. As a minimum, you should specify the the
2151	  root device (e.g. root=/dev/nfs).
2152
2153choice
2154	prompt "Kernel command line type" if CMDLINE != ""
2155	default CMDLINE_FROM_BOOTLOADER
2156	help
2157	  Choose how the kernel will handle the provided default kernel
2158	  command line string.
2159
2160config CMDLINE_FROM_BOOTLOADER
2161	bool "Use bootloader kernel arguments if available"
2162	help
2163	  Uses the command-line options passed by the boot loader. If
2164	  the boot loader doesn't provide any, the default kernel command
2165	  string provided in CMDLINE will be used.
2166
2167config CMDLINE_FORCE
2168	bool "Always use the default kernel command string"
2169	help
2170	  Always use the default kernel command string, even if the boot
2171	  loader passes other arguments to the kernel.
2172	  This is useful if you cannot or don't want to change the
2173	  command-line options your boot loader passes to the kernel.
2174
2175endchoice
2176
2177config EFI_STUB
2178	bool
2179
2180config EFI
2181	bool "UEFI runtime support"
2182	depends on OF && !CPU_BIG_ENDIAN
2183	depends on KERNEL_MODE_NEON
2184	select ARCH_SUPPORTS_ACPI
2185	select LIBFDT
2186	select UCS2_STRING
2187	select EFI_PARAMS_FROM_FDT
2188	select EFI_RUNTIME_WRAPPERS
2189	select EFI_STUB
2190	select EFI_GENERIC_STUB
2191	imply IMA_SECURE_AND_OR_TRUSTED_BOOT
2192	default y
2193	help
2194	  This option provides support for runtime services provided
2195	  by UEFI firmware (such as non-volatile variables, realtime
2196	  clock, and platform reset). A UEFI stub is also provided to
2197	  allow the kernel to be booted as an EFI application. This
2198	  is only useful on systems that have UEFI firmware.
2199
2200config DMI
2201	bool "Enable support for SMBIOS (DMI) tables"
2202	depends on EFI
2203	default y
2204	help
2205	  This enables SMBIOS/DMI feature for systems.
2206
2207	  This option is only useful on systems that have UEFI firmware.
2208	  However, even with this option, the resultant kernel should
2209	  continue to boot on existing non-UEFI platforms.
2210
2211endmenu # "Boot options"
2212
2213menu "Power management options"
2214
2215source "kernel/power/Kconfig"
2216
2217config ARCH_HIBERNATION_POSSIBLE
2218	def_bool y
2219	depends on CPU_PM
2220
2221config ARCH_HIBERNATION_HEADER
2222	def_bool y
2223	depends on HIBERNATION
2224
2225config ARCH_SUSPEND_POSSIBLE
2226	def_bool y
2227
2228endmenu # "Power management options"
2229
2230menu "CPU Power Management"
2231
2232source "drivers/cpuidle/Kconfig"
2233
2234source "drivers/cpufreq/Kconfig"
2235
2236endmenu # "CPU Power Management"
2237
2238source "drivers/acpi/Kconfig"
2239
2240source "arch/arm64/kvm/Kconfig"
2241
2242if CRYPTO
2243source "arch/arm64/crypto/Kconfig"
2244endif # CRYPTO
2245