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