xref: /openbmc/linux/arch/riscv/Kconfig (revision e8069f5a)
1# SPDX-License-Identifier: GPL-2.0-only
2#
3# For a description of the syntax of this configuration file,
4# see Documentation/kbuild/kconfig-language.rst.
5#
6
7config 64BIT
8	bool
9
10config 32BIT
11	bool
12
13config RISCV
14	def_bool y
15	select ACPI_GENERIC_GSI if ACPI
16	select ACPI_REDUCED_HARDWARE_ONLY if ACPI
17	select ARCH_DMA_DEFAULT_COHERENT
18	select ARCH_ENABLE_HUGEPAGE_MIGRATION if HUGETLB_PAGE && MIGRATION
19	select ARCH_ENABLE_SPLIT_PMD_PTLOCK if PGTABLE_LEVELS > 2
20	select ARCH_ENABLE_THP_MIGRATION if TRANSPARENT_HUGEPAGE
21	select ARCH_HAS_BINFMT_FLAT
22	select ARCH_HAS_CURRENT_STACK_POINTER
23	select ARCH_HAS_DEBUG_VIRTUAL if MMU
24	select ARCH_HAS_DEBUG_VM_PGTABLE
25	select ARCH_HAS_DEBUG_WX
26	select ARCH_HAS_FORTIFY_SOURCE
27	select ARCH_HAS_GCOV_PROFILE_ALL
28	select ARCH_HAS_GIGANTIC_PAGE
29	select ARCH_HAS_KCOV
30	select ARCH_HAS_MMIOWB
31	select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
32	select ARCH_HAS_PMEM_API
33	select ARCH_HAS_PTE_SPECIAL
34	select ARCH_HAS_SET_DIRECT_MAP if MMU
35	select ARCH_HAS_SET_MEMORY if MMU
36	select ARCH_HAS_STRICT_KERNEL_RWX if MMU && !XIP_KERNEL
37	select ARCH_HAS_STRICT_MODULE_RWX if MMU && !XIP_KERNEL
38	select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
39	select ARCH_HAS_UBSAN_SANITIZE_ALL
40	select ARCH_HAS_VDSO_DATA
41	select ARCH_OPTIONAL_KERNEL_RWX if ARCH_HAS_STRICT_KERNEL_RWX
42	select ARCH_OPTIONAL_KERNEL_RWX_DEFAULT
43	select ARCH_STACKWALK
44	select ARCH_SUPPORTS_ATOMIC_RMW
45	select ARCH_SUPPORTS_DEBUG_PAGEALLOC if MMU
46	select ARCH_SUPPORTS_HUGETLBFS if MMU
47	select ARCH_SUPPORTS_PAGE_TABLE_CHECK if MMU
48	select ARCH_SUPPORTS_PER_VMA_LOCK if MMU
49	select ARCH_USE_MEMTEST
50	select ARCH_USE_QUEUED_RWLOCKS
51	select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU
52	select ARCH_WANT_FRAME_POINTERS
53	select ARCH_WANT_GENERAL_HUGETLB if !RISCV_ISA_SVNAPOT
54	select ARCH_WANT_HUGE_PMD_SHARE if 64BIT
55	select ARCH_WANT_LD_ORPHAN_WARN if !XIP_KERNEL
56	select ARCH_WANT_OPTIMIZE_VMEMMAP
57	select ARCH_WANTS_THP_SWAP if HAVE_ARCH_TRANSPARENT_HUGEPAGE
58	select BINFMT_FLAT_NO_DATA_START_OFFSET if !MMU
59	select BUILDTIME_TABLE_SORT if MMU
60	select CLINT_TIMER if !MMU
61	select CLONE_BACKWARDS
62	select COMMON_CLK
63	select CPU_PM if CPU_IDLE || HIBERNATION
64	select EDAC_SUPPORT
65	select GENERIC_ARCH_TOPOLOGY
66	select GENERIC_ATOMIC64 if !64BIT
67	select GENERIC_CLOCKEVENTS_BROADCAST if SMP
68	select GENERIC_EARLY_IOREMAP
69	select GENERIC_ENTRY
70	select GENERIC_GETTIMEOFDAY if HAVE_GENERIC_VDSO
71	select GENERIC_IDLE_POLL_SETUP
72	select GENERIC_IOREMAP if MMU
73	select GENERIC_IRQ_IPI if SMP
74	select GENERIC_IRQ_IPI_MUX if SMP
75	select GENERIC_IRQ_MULTI_HANDLER
76	select GENERIC_IRQ_SHOW
77	select GENERIC_IRQ_SHOW_LEVEL
78	select GENERIC_LIB_DEVMEM_IS_ALLOWED
79	select GENERIC_PCI_IOMAP
80	select GENERIC_PTDUMP if MMU
81	select GENERIC_SCHED_CLOCK
82	select GENERIC_SMP_IDLE_THREAD
83	select GENERIC_TIME_VSYSCALL if MMU && 64BIT
84	select GENERIC_VDSO_TIME_NS if HAVE_GENERIC_VDSO
85	select HARDIRQS_SW_RESEND
86	select HAS_IOPORT if MMU
87	select HAVE_ARCH_AUDITSYSCALL
88	select HAVE_ARCH_HUGE_VMALLOC if HAVE_ARCH_HUGE_VMAP
89	select HAVE_ARCH_HUGE_VMAP if MMU && 64BIT && !XIP_KERNEL
90	select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL
91	select HAVE_ARCH_JUMP_LABEL_RELATIVE if !XIP_KERNEL
92	select HAVE_ARCH_KASAN if MMU && 64BIT
93	select HAVE_ARCH_KASAN_VMALLOC if MMU && 64BIT
94	select HAVE_ARCH_KFENCE if MMU && 64BIT
95	select HAVE_ARCH_KGDB if !XIP_KERNEL
96	select HAVE_ARCH_KGDB_QXFER_PKT
97	select HAVE_ARCH_MMAP_RND_BITS if MMU
98	select HAVE_ARCH_MMAP_RND_COMPAT_BITS if COMPAT
99	select HAVE_ARCH_SECCOMP_FILTER
100	select HAVE_ARCH_THREAD_STRUCT_WHITELIST
101	select HAVE_ARCH_TRACEHOOK
102	select HAVE_ARCH_TRANSPARENT_HUGEPAGE if 64BIT && MMU
103	select HAVE_ARCH_VMAP_STACK if MMU && 64BIT
104	select HAVE_ASM_MODVERSIONS
105	select HAVE_CONTEXT_TRACKING_USER
106	select HAVE_DEBUG_KMEMLEAK
107	select HAVE_DMA_CONTIGUOUS if MMU
108	select HAVE_EBPF_JIT if MMU
109	select HAVE_FUNCTION_ARG_ACCESS_API
110	select HAVE_FUNCTION_ERROR_INJECTION
111	select HAVE_GCC_PLUGINS
112	select HAVE_GENERIC_VDSO if MMU && 64BIT
113	select HAVE_IRQ_TIME_ACCOUNTING
114	select HAVE_KPROBES if !XIP_KERNEL
115	select HAVE_KPROBES_ON_FTRACE if !XIP_KERNEL
116	select HAVE_KRETPROBES if !XIP_KERNEL
117	select HAVE_RETHOOK if !XIP_KERNEL
118	select HAVE_MOVE_PMD
119	select HAVE_MOVE_PUD
120	select HAVE_PCI
121	select HAVE_PERF_EVENTS
122	select HAVE_PERF_REGS
123	select HAVE_PERF_USER_STACK_DUMP
124	select HAVE_POSIX_CPU_TIMERS_TASK_WORK
125	select HAVE_REGS_AND_STACK_ACCESS_API
126	select HAVE_RSEQ
127	select HAVE_STACKPROTECTOR
128	select HAVE_SYSCALL_TRACEPOINTS
129	select HOTPLUG_CORE_SYNC_DEAD if HOTPLUG_CPU
130	select IRQ_DOMAIN
131	select IRQ_FORCED_THREADING
132	select KASAN_VMALLOC if KASAN
133	select LOCK_MM_AND_FIND_VMA
134	select MODULES_USE_ELF_RELA if MODULES
135	select MODULE_SECTIONS if MODULES
136	select OF
137	select OF_EARLY_FLATTREE
138	select OF_IRQ
139	select PCI_DOMAINS_GENERIC if PCI
140	select PCI_MSI if PCI
141	select RISCV_ALTERNATIVE if !XIP_KERNEL
142	select RISCV_INTC
143	select RISCV_TIMER if RISCV_SBI
144	select SIFIVE_PLIC
145	select SPARSE_IRQ
146	select SYSCTL_EXCEPTION_TRACE
147	select THREAD_INFO_IN_TASK
148	select TRACE_IRQFLAGS_SUPPORT
149	select UACCESS_MEMCPY if !MMU
150	select ZONE_DMA32 if 64BIT
151	select HAVE_DYNAMIC_FTRACE if !XIP_KERNEL && MMU && (CLANG_SUPPORTS_DYNAMIC_FTRACE || GCC_SUPPORTS_DYNAMIC_FTRACE)
152	select HAVE_DYNAMIC_FTRACE_WITH_REGS if HAVE_DYNAMIC_FTRACE
153	select HAVE_FTRACE_MCOUNT_RECORD if !XIP_KERNEL
154	select HAVE_FUNCTION_GRAPH_TRACER
155	select HAVE_FUNCTION_GRAPH_RETVAL if HAVE_FUNCTION_GRAPH_TRACER
156	select HAVE_FUNCTION_TRACER if !XIP_KERNEL && !PREEMPTION
157
158config CLANG_SUPPORTS_DYNAMIC_FTRACE
159	def_bool CC_IS_CLANG
160	# https://github.com/llvm/llvm-project/commit/6ab8927931851bb42b2c93a00801dc499d7d9b1e
161	depends on CLANG_VERSION >= 130000
162	# https://github.com/ClangBuiltLinux/linux/issues/1817
163	depends on AS_IS_GNU || (AS_IS_LLVM && (LD_IS_LLD || LD_VERSION >= 23600))
164
165config GCC_SUPPORTS_DYNAMIC_FTRACE
166	def_bool CC_IS_GCC
167	depends on $(cc-option,-fpatchable-function-entry=8)
168
169config ARCH_MMAP_RND_BITS_MIN
170	default 18 if 64BIT
171	default 8
172
173config ARCH_MMAP_RND_COMPAT_BITS_MIN
174	default 8
175
176# max bits determined by the following formula:
177#  VA_BITS - PAGE_SHIFT - 3
178config ARCH_MMAP_RND_BITS_MAX
179	default 24 if 64BIT # SV39 based
180	default 17
181
182config ARCH_MMAP_RND_COMPAT_BITS_MAX
183	default 17
184
185# set if we run in machine mode, cleared if we run in supervisor mode
186config RISCV_M_MODE
187	bool
188	default !MMU
189
190# set if we are running in S-mode and can use SBI calls
191config RISCV_SBI
192	bool
193	depends on !RISCV_M_MODE
194	default y
195
196config MMU
197	bool "MMU-based Paged Memory Management Support"
198	default y
199	help
200	  Select if you want MMU-based virtualised addressing space
201	  support by paged memory management. If unsure, say 'Y'.
202
203config PAGE_OFFSET
204	hex
205	default 0xC0000000 if 32BIT && MMU
206	default 0x80000000 if !MMU
207	default 0xff60000000000000 if 64BIT
208
209config KASAN_SHADOW_OFFSET
210	hex
211	depends on KASAN_GENERIC
212	default 0xdfffffff00000000 if 64BIT
213	default 0xffffffff if 32BIT
214
215config ARCH_FLATMEM_ENABLE
216	def_bool !NUMA
217
218config ARCH_SPARSEMEM_ENABLE
219	def_bool y
220	depends on MMU
221	select SPARSEMEM_STATIC if 32BIT && SPARSEMEM
222	select SPARSEMEM_VMEMMAP_ENABLE if 64BIT
223
224config ARCH_SELECT_MEMORY_MODEL
225	def_bool ARCH_SPARSEMEM_ENABLE
226
227config ARCH_SUPPORTS_UPROBES
228	def_bool y
229
230config STACKTRACE_SUPPORT
231	def_bool y
232
233config GENERIC_BUG
234	def_bool y
235	depends on BUG
236	select GENERIC_BUG_RELATIVE_POINTERS if 64BIT
237
238config GENERIC_BUG_RELATIVE_POINTERS
239	bool
240
241config GENERIC_CALIBRATE_DELAY
242	def_bool y
243
244config GENERIC_CSUM
245	def_bool y
246
247config GENERIC_HWEIGHT
248	def_bool y
249
250config FIX_EARLYCON_MEM
251	def_bool MMU
252
253config PGTABLE_LEVELS
254	int
255	default 5 if 64BIT
256	default 2
257
258config LOCKDEP_SUPPORT
259	def_bool y
260
261config RISCV_DMA_NONCOHERENT
262	bool
263	select ARCH_HAS_DMA_PREP_COHERENT
264	select ARCH_HAS_SETUP_DMA_OPS
265	select ARCH_HAS_SYNC_DMA_FOR_CPU
266	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
267	select DMA_DIRECT_REMAP
268
269config AS_HAS_INSN
270	def_bool $(as-instr,.insn r 51$(comma) 0$(comma) 0$(comma) t0$(comma) t0$(comma) zero)
271
272config AS_HAS_OPTION_ARCH
273	# https://reviews.llvm.org/D123515
274	def_bool y
275	depends on $(as-instr, .option arch$(comma) +m)
276	depends on !$(as-instr, .option arch$(comma) -i)
277
278source "arch/riscv/Kconfig.socs"
279source "arch/riscv/Kconfig.errata"
280
281menu "Platform type"
282
283config NONPORTABLE
284	bool "Allow configurations that result in non-portable kernels"
285	help
286	  RISC-V kernel binaries are compatible between all known systems
287	  whenever possible, but there are some use cases that can only be
288	  satisfied by configurations that result in kernel binaries that are
289	  not portable between systems.
290
291	  Selecting N does not guarantee kernels will be portable to all known
292	  systems.  Selecting any of the options guarded by NONPORTABLE will
293	  result in kernel binaries that are unlikely to be portable between
294	  systems.
295
296	  If unsure, say N.
297
298choice
299	prompt "Base ISA"
300	default ARCH_RV64I
301	help
302	  This selects the base ISA that this kernel will target and must match
303	  the target platform.
304
305config ARCH_RV32I
306	bool "RV32I"
307	depends on NONPORTABLE
308	select 32BIT
309	select GENERIC_LIB_ASHLDI3
310	select GENERIC_LIB_ASHRDI3
311	select GENERIC_LIB_LSHRDI3
312	select GENERIC_LIB_UCMPDI2
313
314config ARCH_RV64I
315	bool "RV64I"
316	select 64BIT
317	select ARCH_SUPPORTS_INT128 if CC_HAS_INT128
318	select SWIOTLB if MMU
319
320endchoice
321
322# We must be able to map all physical memory into the kernel, but the compiler
323# is still a bit more efficient when generating code if it's setup in a manner
324# such that it can only map 2GiB of memory.
325choice
326	prompt "Kernel Code Model"
327	default CMODEL_MEDLOW if 32BIT
328	default CMODEL_MEDANY if 64BIT
329
330	config CMODEL_MEDLOW
331		bool "medium low code model"
332	config CMODEL_MEDANY
333		bool "medium any code model"
334endchoice
335
336config MODULE_SECTIONS
337	bool
338	select HAVE_MOD_ARCH_SPECIFIC
339
340config SMP
341	bool "Symmetric Multi-Processing"
342	help
343	  This enables support for systems with more than one CPU.  If
344	  you say N here, the kernel will run on single and
345	  multiprocessor machines, but will use only one CPU of a
346	  multiprocessor machine. If you say Y here, the kernel will run
347	  on many, but not all, single processor machines. On a single
348	  processor machine, the kernel will run faster if you say N
349	  here.
350
351	  If you don't know what to do here, say N.
352
353config SCHED_MC
354	bool "Multi-core scheduler support"
355	depends on SMP
356	help
357	  Multi-core scheduler support improves the CPU scheduler's decision
358	  making when dealing with multi-core CPU chips at a cost of slightly
359	  increased overhead in some places. If unsure say N here.
360
361config NR_CPUS
362	int "Maximum number of CPUs (2-512)"
363	depends on SMP
364	range 2 512 if !RISCV_SBI_V01
365	range 2 32 if RISCV_SBI_V01 && 32BIT
366	range 2 64 if RISCV_SBI_V01 && 64BIT
367	default "32" if 32BIT
368	default "64" if 64BIT
369
370config HOTPLUG_CPU
371	bool "Support for hot-pluggable CPUs"
372	depends on SMP
373	select GENERIC_IRQ_MIGRATION
374	help
375
376	  Say Y here to experiment with turning CPUs off and on.  CPUs
377	  can be controlled through /sys/devices/system/cpu.
378
379	  Say N if you want to disable CPU hotplug.
380
381choice
382	prompt "CPU Tuning"
383	default TUNE_GENERIC
384
385config TUNE_GENERIC
386	bool "generic"
387
388endchoice
389
390# Common NUMA Features
391config NUMA
392	bool "NUMA Memory Allocation and Scheduler Support"
393	depends on SMP && MMU
394	select ARCH_SUPPORTS_NUMA_BALANCING
395	select GENERIC_ARCH_NUMA
396	select NEED_PER_CPU_EMBED_FIRST_CHUNK
397	select OF_NUMA
398	select USE_PERCPU_NUMA_NODE_ID
399	help
400	  Enable NUMA (Non-Uniform Memory Access) support.
401
402	  The kernel will try to allocate memory used by a CPU on the
403	  local memory of the CPU and add some more NUMA awareness to the kernel.
404
405config NODES_SHIFT
406	int "Maximum NUMA Nodes (as a power of 2)"
407	range 1 10
408	default "2"
409	depends on NUMA
410	help
411	  Specify the maximum number of NUMA Nodes available on the target
412	  system.  Increases memory reserved to accommodate various tables.
413
414config RISCV_ALTERNATIVE
415	bool
416	depends on !XIP_KERNEL
417	help
418	  This Kconfig allows the kernel to automatically patch the
419	  erratum or cpufeature required by the execution platform at run
420	  time. The code patching overhead is minimal, as it's only done
421	  once at boot and once on each module load.
422
423config RISCV_ALTERNATIVE_EARLY
424	bool
425	depends on RISCV_ALTERNATIVE
426	help
427	  Allows early patching of the kernel for special errata
428
429config RISCV_ISA_C
430	bool "Emit compressed instructions when building Linux"
431	default y
432	help
433	  Adds "C" to the ISA subsets that the toolchain is allowed to emit
434	  when building Linux, which results in compressed instructions in the
435	  Linux binary.
436
437	  If you don't know what to do here, say Y.
438
439config RISCV_ISA_SVNAPOT
440	bool "Svnapot extension support for supervisor mode NAPOT pages"
441	depends on 64BIT && MMU
442	depends on RISCV_ALTERNATIVE
443	default y
444	help
445	  Allow kernel to detect the Svnapot ISA-extension dynamically at boot
446	  time and enable its usage.
447
448	  The Svnapot extension is used to mark contiguous PTEs as a range
449	  of contiguous virtual-to-physical translations for a naturally
450	  aligned power-of-2 (NAPOT) granularity larger than the base 4KB page
451	  size. When HUGETLBFS is also selected this option unconditionally
452	  allocates some memory for each NAPOT page size supported by the kernel.
453	  When optimizing for low memory consumption and for platforms without
454	  the Svnapot extension, it may be better to say N here.
455
456	  If you don't know what to do here, say Y.
457
458config RISCV_ISA_SVPBMT
459	bool "Svpbmt extension support for supervisor mode page-based memory types"
460	depends on 64BIT && MMU
461	depends on RISCV_ALTERNATIVE
462	default y
463	help
464	   Adds support to dynamically detect the presence of the Svpbmt
465	   ISA-extension (Supervisor-mode: page-based memory types) and
466	   enable its usage.
467
468	   The memory type for a page contains a combination of attributes
469	   that indicate the cacheability, idempotency, and ordering
470	   properties for access to that page.
471
472	   The Svpbmt extension is only available on 64-bit cpus.
473
474	   If you don't know what to do here, say Y.
475
476config TOOLCHAIN_HAS_V
477	bool
478	default y
479	depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64iv)
480	depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32iv)
481	depends on LLD_VERSION >= 140000 || LD_VERSION >= 23800
482	depends on AS_HAS_OPTION_ARCH
483
484config RISCV_ISA_V
485	bool "VECTOR extension support"
486	depends on TOOLCHAIN_HAS_V
487	depends on FPU
488	select DYNAMIC_SIGFRAME
489	default y
490	help
491	  Say N here if you want to disable all vector related procedure
492	  in the kernel.
493
494	  If you don't know what to do here, say Y.
495
496config RISCV_ISA_V_DEFAULT_ENABLE
497	bool "Enable userspace Vector by default"
498	depends on RISCV_ISA_V
499	default y
500	help
501	  Say Y here if you want to enable Vector in userspace by default.
502	  Otherwise, userspace has to make explicit prctl() call to enable
503	  Vector, or enable it via the sysctl interface.
504
505	  If you don't know what to do here, say Y.
506
507config TOOLCHAIN_HAS_ZBB
508	bool
509	default y
510	depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64ima_zbb)
511	depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32ima_zbb)
512	depends on LLD_VERSION >= 150000 || LD_VERSION >= 23900
513	depends on AS_HAS_OPTION_ARCH
514
515config RISCV_ISA_ZBB
516	bool "Zbb extension support for bit manipulation instructions"
517	depends on TOOLCHAIN_HAS_ZBB
518	depends on MMU
519	depends on RISCV_ALTERNATIVE
520	default y
521	help
522	   Adds support to dynamically detect the presence of the ZBB
523	   extension (basic bit manipulation) and enable its usage.
524
525	   The Zbb extension provides instructions to accelerate a number
526	   of bit-specific operations (count bit population, sign extending,
527	   bitrotation, etc).
528
529	   If you don't know what to do here, say Y.
530
531config RISCV_ISA_ZICBOM
532	bool "Zicbom extension support for non-coherent DMA operation"
533	depends on MMU
534	depends on RISCV_ALTERNATIVE
535	default y
536	select RISCV_DMA_NONCOHERENT
537	help
538	   Adds support to dynamically detect the presence of the ZICBOM
539	   extension (Cache Block Management Operations) and enable its
540	   usage.
541
542	   The Zicbom extension can be used to handle for example
543	   non-coherent DMA support on devices that need it.
544
545	   If you don't know what to do here, say Y.
546
547config RISCV_ISA_ZICBOZ
548	bool "Zicboz extension support for faster zeroing of memory"
549	depends on MMU
550	depends on RISCV_ALTERNATIVE
551	default y
552	help
553	   Enable the use of the Zicboz extension (cbo.zero instruction)
554	   when available.
555
556	   The Zicboz extension is used for faster zeroing of memory.
557
558	   If you don't know what to do here, say Y.
559
560config TOOLCHAIN_HAS_ZIHINTPAUSE
561	bool
562	default y
563	depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64ima_zihintpause)
564	depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32ima_zihintpause)
565	depends on LLD_VERSION >= 150000 || LD_VERSION >= 23600
566
567config TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI
568	def_bool y
569	# https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=aed44286efa8ae8717a77d94b51ac3614e2ca6dc
570	depends on AS_IS_GNU && AS_VERSION >= 23800
571	help
572	  Newer binutils versions default to ISA spec version 20191213 which
573	  moves some instructions from the I extension to the Zicsr and Zifencei
574	  extensions.
575
576config TOOLCHAIN_NEEDS_OLD_ISA_SPEC
577	def_bool y
578	depends on TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI
579	# https://github.com/llvm/llvm-project/commit/22e199e6afb1263c943c0c0d4498694e15bf8a16
580	depends on CC_IS_CLANG && CLANG_VERSION < 170000
581	help
582	  Certain versions of clang do not support zicsr and zifencei via -march
583	  but newer versions of binutils require it for the reasons noted in the
584	  help text of CONFIG_TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI. This
585	  option causes an older ISA spec compatible with these older versions
586	  of clang to be passed to GAS, which has the same result as passing zicsr
587	  and zifencei to -march.
588
589config FPU
590	bool "FPU support"
591	default y
592	help
593	  Say N here if you want to disable all floating-point related procedure
594	  in the kernel.
595
596	  If you don't know what to do here, say Y.
597
598config IRQ_STACKS
599	bool "Independent irq & softirq stacks" if EXPERT
600	default y
601	select HAVE_IRQ_EXIT_ON_IRQ_STACK
602	select HAVE_SOFTIRQ_ON_OWN_STACK
603	help
604	  Add independent irq & softirq stacks for percpu to prevent kernel stack
605	  overflows. We may save some memory footprint by disabling IRQ_STACKS.
606
607config THREAD_SIZE_ORDER
608	int "Kernel stack size (in power-of-two numbers of page size)" if VMAP_STACK && EXPERT
609	range 0 4
610	default 1 if 32BIT && !KASAN
611	default 3 if 64BIT && KASAN
612	default 2
613	help
614	  Specify the Pages of thread stack size (from 4KB to 64KB), which also
615	  affects irq stack size, which is equal to thread stack size.
616
617endmenu # "Platform type"
618
619menu "Kernel features"
620
621source "kernel/Kconfig.hz"
622
623config RISCV_SBI_V01
624	bool "SBI v0.1 support"
625	depends on RISCV_SBI
626	help
627	  This config allows kernel to use SBI v0.1 APIs. This will be
628	  deprecated in future once legacy M-mode software are no longer in use.
629
630config RISCV_BOOT_SPINWAIT
631	bool "Spinwait booting method"
632	depends on SMP
633	default y if RISCV_SBI_V01 || RISCV_M_MODE
634	help
635	  This enables support for booting Linux via spinwait method. In the
636	  spinwait method, all cores randomly jump to Linux. One of the cores
637	  gets chosen via lottery and all other keep spinning on a percpu
638	  variable. This method cannot support CPU hotplug and sparse hartid
639	  scheme. It should be only enabled for M-mode Linux or platforms relying
640	  on older firmware without SBI HSM extension. All other platforms should
641	  rely on ordered booting via SBI HSM extension which gets chosen
642	  dynamically at runtime if the firmware supports it.
643
644	  Since spinwait is incompatible with sparse hart IDs, it requires
645	  NR_CPUS be large enough to contain the physical hart ID of the first
646	  hart to enter Linux.
647
648	  If unsure what to do here, say N.
649
650config KEXEC
651	bool "Kexec system call"
652	depends on MMU
653	select HOTPLUG_CPU if SMP
654	select KEXEC_CORE
655	help
656	  kexec is a system call that implements the ability to shutdown your
657	  current kernel, and to start another kernel. It is like a reboot
658	  but it is independent of the system firmware. And like a reboot
659	  you can start any kernel with it, not just Linux.
660
661	  The name comes from the similarity to the exec system call.
662
663config KEXEC_FILE
664	bool "kexec file based systmem call"
665	depends on 64BIT && MMU
666	select HAVE_IMA_KEXEC if IMA
667	select KEXEC_CORE
668	select KEXEC_ELF
669	help
670	  This is new version of kexec system call. This system call is
671	  file based and takes file descriptors as system call argument
672	  for kernel and initramfs as opposed to list of segments as
673	  accepted by previous system call.
674
675	  If you don't know what to do here, say Y.
676
677config ARCH_HAS_KEXEC_PURGATORY
678	def_bool KEXEC_FILE
679	depends on CRYPTO=y
680	depends on CRYPTO_SHA256=y
681
682config CRASH_DUMP
683	bool "Build kdump crash kernel"
684	help
685	  Generate crash dump after being started by kexec. This should
686	  be normally only set in special crash dump kernels which are
687	  loaded in the main kernel with kexec-tools into a specially
688	  reserved region and then later executed after a crash by
689	  kdump/kexec.
690
691	  For more details see Documentation/admin-guide/kdump/kdump.rst
692
693config COMPAT
694	bool "Kernel support for 32-bit U-mode"
695	default 64BIT
696	depends on 64BIT && MMU
697	help
698	  This option enables support for a 32-bit U-mode running under a 64-bit
699	  kernel at S-mode. riscv32-specific components such as system calls,
700	  the user helper functions (vdso), signal rt_frame functions and the
701	  ptrace interface are handled appropriately by the kernel.
702
703	  If you want to execute 32-bit userspace applications, say Y.
704
705config RELOCATABLE
706	bool "Build a relocatable kernel"
707	depends on MMU && 64BIT && !XIP_KERNEL
708	help
709          This builds a kernel as a Position Independent Executable (PIE),
710          which retains all relocation metadata required to relocate the
711          kernel binary at runtime to a different virtual address than the
712          address it was linked at.
713          Since RISCV uses the RELA relocation format, this requires a
714          relocation pass at runtime even if the kernel is loaded at the
715          same address it was linked at.
716
717          If unsure, say N.
718
719endmenu # "Kernel features"
720
721menu "Boot options"
722
723config CMDLINE
724	string "Built-in kernel command line"
725	help
726	  For most platforms, the arguments for the kernel's command line
727	  are provided at run-time, during boot. However, there are cases
728	  where either no arguments are being provided or the provided
729	  arguments are insufficient or even invalid.
730
731	  When that occurs, it is possible to define a built-in command
732	  line here and choose how the kernel should use it later on.
733
734choice
735	prompt "Built-in command line usage" if CMDLINE != ""
736	default CMDLINE_FALLBACK
737	help
738	  Choose how the kernel will handle the provided built-in command
739	  line.
740
741config CMDLINE_FALLBACK
742	bool "Use bootloader kernel arguments if available"
743	help
744	  Use the built-in command line as fallback in case we get nothing
745	  during boot. This is the default behaviour.
746
747config CMDLINE_EXTEND
748	bool "Extend bootloader kernel arguments"
749	help
750	  The command-line arguments provided during boot will be
751	  appended to the built-in command line. This is useful in
752	  cases where the provided arguments are insufficient and
753	  you don't want to or cannot modify them.
754
755config CMDLINE_FORCE
756	bool "Always use the default kernel command string"
757	help
758	  Always use the built-in command line, even if we get one during
759	  boot. This is useful in case you need to override the provided
760	  command line on systems where you don't have or want control
761	  over it.
762
763endchoice
764
765config EFI_STUB
766	bool
767
768config EFI
769	bool "UEFI runtime support"
770	depends on OF && !XIP_KERNEL
771	depends on MMU
772	default y
773	select ARCH_SUPPORTS_ACPI if 64BIT
774	select EFI_GENERIC_STUB
775	select EFI_PARAMS_FROM_FDT
776	select EFI_RUNTIME_WRAPPERS
777	select EFI_STUB
778	select LIBFDT
779	select RISCV_ISA_C
780	select UCS2_STRING
781	help
782	  This option provides support for runtime services provided
783	  by UEFI firmware (such as non-volatile variables, realtime
784	  clock, and platform reset). A UEFI stub is also provided to
785	  allow the kernel to be booted as an EFI application. This
786	  is only useful on systems that have UEFI firmware.
787
788config CC_HAVE_STACKPROTECTOR_TLS
789	def_bool $(cc-option,-mstack-protector-guard=tls -mstack-protector-guard-reg=tp -mstack-protector-guard-offset=0)
790
791config STACKPROTECTOR_PER_TASK
792	def_bool y
793	depends on !RANDSTRUCT
794	depends on STACKPROTECTOR && CC_HAVE_STACKPROTECTOR_TLS
795
796config PHYS_RAM_BASE_FIXED
797	bool "Explicitly specified physical RAM address"
798	depends on NONPORTABLE
799	default n
800
801config PHYS_RAM_BASE
802	hex "Platform Physical RAM address"
803	depends on PHYS_RAM_BASE_FIXED
804	default "0x80000000"
805	help
806	  This is the physical address of RAM in the system. It has to be
807	  explicitly specified to run early relocations of read-write data
808	  from flash to RAM.
809
810config XIP_KERNEL
811	bool "Kernel Execute-In-Place from ROM"
812	depends on MMU && SPARSEMEM && NONPORTABLE
813	# This prevents XIP from being enabled by all{yes,mod}config, which
814	# fail to build since XIP doesn't support large kernels.
815	depends on !COMPILE_TEST
816	select PHYS_RAM_BASE_FIXED
817	help
818	  Execute-In-Place allows the kernel to run from non-volatile storage
819	  directly addressable by the CPU, such as NOR flash. This saves RAM
820	  space since the text section of the kernel is not loaded from flash
821	  to RAM.  Read-write sections, such as the data section and stack,
822	  are still copied to RAM.  The XIP kernel is not compressed since
823	  it has to run directly from flash, so it will take more space to
824	  store it.  The flash address used to link the kernel object files,
825	  and for storing it, is configuration dependent. Therefore, if you
826	  say Y here, you must know the proper physical address where to
827	  store the kernel image depending on your own flash memory usage.
828
829	  Also note that the make target becomes "make xipImage" rather than
830	  "make zImage" or "make Image".  The final kernel binary to put in
831	  ROM memory will be arch/riscv/boot/xipImage.
832
833	  SPARSEMEM is required because the kernel text and rodata that are
834	  flash resident are not backed by memmap, then any attempt to get
835	  a struct page on those regions will trigger a fault.
836
837	  If unsure, say N.
838
839config XIP_PHYS_ADDR
840	hex "XIP Kernel Physical Location"
841	depends on XIP_KERNEL
842	default "0x21000000"
843	help
844	  This is the physical address in your flash memory the kernel will
845	  be linked for and stored to.  This address is dependent on your
846	  own flash usage.
847
848endmenu # "Boot options"
849
850config BUILTIN_DTB
851	bool
852	depends on OF && NONPORTABLE
853	default y if XIP_KERNEL
854
855config PORTABLE
856	bool
857	default !NONPORTABLE
858	select EFI
859	select MMU
860	select OF
861
862menu "Power management options"
863
864source "kernel/power/Kconfig"
865
866# Hibernation is only possible on systems where the SBI implementation has
867# marked its reserved memory as not accessible from, or does not run
868# from the same memory as, Linux
869config ARCH_HIBERNATION_POSSIBLE
870	def_bool NONPORTABLE
871
872config ARCH_HIBERNATION_HEADER
873	def_bool HIBERNATION
874
875endmenu # "Power management options"
876
877menu "CPU Power Management"
878
879source "drivers/cpuidle/Kconfig"
880
881source "drivers/cpufreq/Kconfig"
882
883endmenu # "CPU Power Management"
884
885source "arch/riscv/kvm/Kconfig"
886
887source "drivers/acpi/Kconfig"
888