1 # SPDX-License-Identifier: GPL-2.0-only
3 # For a description of the syntax of this configuration file,
4 # see Documentation/kbuild/kconfig-language.rst.
15 select ARCH_CLOCKSOURCE_INIT
16 select ARCH_ENABLE_HUGEPAGE_MIGRATION if HUGETLB_PAGE && MIGRATION
17 select ARCH_ENABLE_SPLIT_PMD_PTLOCK if PGTABLE_LEVELS > 2
18 select ARCH_HAS_BINFMT_FLAT
19 select ARCH_HAS_CURRENT_STACK_POINTER
20 select ARCH_HAS_DEBUG_VM_PGTABLE
21 select ARCH_HAS_DEBUG_VIRTUAL if MMU
22 select ARCH_HAS_DEBUG_WX
23 select ARCH_HAS_FORTIFY_SOURCE
24 select ARCH_HAS_GCOV_PROFILE_ALL
25 select ARCH_HAS_GIGANTIC_PAGE
27 select ARCH_HAS_MMIOWB
28 select ARCH_HAS_PTE_SPECIAL
29 select ARCH_HAS_SET_DIRECT_MAP if MMU
30 select ARCH_HAS_SET_MEMORY if MMU
31 select ARCH_HAS_STRICT_KERNEL_RWX if MMU && !XIP_KERNEL
32 select ARCH_HAS_STRICT_MODULE_RWX if MMU && !XIP_KERNEL
33 select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
34 select ARCH_HAS_UBSAN_SANITIZE_ALL
35 select ARCH_OPTIONAL_KERNEL_RWX if ARCH_HAS_STRICT_KERNEL_RWX
36 select ARCH_OPTIONAL_KERNEL_RWX_DEFAULT
38 select ARCH_SUPPORTS_ATOMIC_RMW
39 select ARCH_SUPPORTS_DEBUG_PAGEALLOC if MMU
40 select ARCH_SUPPORTS_HUGETLBFS if MMU
41 select ARCH_USE_MEMTEST
42 select ARCH_USE_QUEUED_RWLOCKS
43 select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU
44 select ARCH_WANT_FRAME_POINTERS
45 select ARCH_WANT_GENERAL_HUGETLB
46 select ARCH_WANT_HUGE_PMD_SHARE if 64BIT
47 select BINFMT_FLAT_NO_DATA_START_OFFSET if !MMU
48 select BUILDTIME_TABLE_SORT if MMU
49 select CLONE_BACKWARDS
50 select CLINT_TIMER if !MMU
52 select CPU_PM if CPU_IDLE
54 select GENERIC_ARCH_TOPOLOGY if SMP
55 select GENERIC_ATOMIC64 if !64BIT
56 select GENERIC_CLOCKEVENTS_BROADCAST if SMP
57 select GENERIC_EARLY_IOREMAP
58 select GENERIC_GETTIMEOFDAY if HAVE_GENERIC_VDSO
59 select GENERIC_IDLE_POLL_SETUP
60 select GENERIC_IOREMAP if MMU
61 select GENERIC_IRQ_MULTI_HANDLER
62 select GENERIC_IRQ_SHOW
63 select GENERIC_IRQ_SHOW_LEVEL
64 select GENERIC_LIB_DEVMEM_IS_ALLOWED
65 select GENERIC_PCI_IOMAP
66 select GENERIC_PTDUMP if MMU
67 select GENERIC_SCHED_CLOCK
68 select GENERIC_SMP_IDLE_THREAD
69 select GENERIC_TIME_VSYSCALL if MMU && 64BIT
70 select GENERIC_VDSO_TIME_NS if HAVE_GENERIC_VDSO
71 select HAVE_ARCH_AUDITSYSCALL
72 select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL
73 select HAVE_ARCH_JUMP_LABEL_RELATIVE if !XIP_KERNEL
74 select HAVE_ARCH_KASAN if MMU && 64BIT
75 select HAVE_ARCH_KASAN_VMALLOC if MMU && 64BIT
76 select HAVE_ARCH_KFENCE if MMU && 64BIT
77 select HAVE_ARCH_KGDB if !XIP_KERNEL
78 select HAVE_ARCH_KGDB_QXFER_PKT
79 select HAVE_ARCH_MMAP_RND_BITS if MMU
80 select HAVE_ARCH_SECCOMP_FILTER
81 select HAVE_ARCH_TRACEHOOK
82 select HAVE_ARCH_TRANSPARENT_HUGEPAGE if 64BIT && MMU
83 select ARCH_ENABLE_THP_MIGRATION if TRANSPARENT_HUGEPAGE
84 select HAVE_ARCH_THREAD_STRUCT_WHITELIST
85 select HAVE_ARCH_VMAP_STACK if MMU && 64BIT
86 select HAVE_ASM_MODVERSIONS
87 select HAVE_CONTEXT_TRACKING
88 select HAVE_DEBUG_KMEMLEAK
89 select HAVE_DMA_CONTIGUOUS if MMU
90 select HAVE_EBPF_JIT if MMU
91 select HAVE_FUNCTION_ERROR_INJECTION
92 select HAVE_GCC_PLUGINS
93 select HAVE_GENERIC_VDSO if MMU && 64BIT
94 select HAVE_IRQ_TIME_ACCOUNTING
95 select HAVE_KPROBES if !XIP_KERNEL
96 select HAVE_KPROBES_ON_FTRACE if !XIP_KERNEL
97 select HAVE_KRETPROBES if !XIP_KERNEL
101 select HAVE_PERF_EVENTS
102 select HAVE_PERF_REGS
103 select HAVE_PERF_USER_STACK_DUMP
104 select HAVE_REGS_AND_STACK_ACCESS_API
105 select HAVE_FUNCTION_ARG_ACCESS_API
106 select HAVE_STACKPROTECTOR
107 select HAVE_SYSCALL_TRACEPOINTS
110 select IRQ_FORCED_THREADING
111 select MODULES_USE_ELF_RELA if MODULES
112 select MODULE_SECTIONS if MODULES
114 select OF_EARLY_FLATTREE
116 select PCI_DOMAINS_GENERIC if PCI
117 select PCI_MSI if PCI
119 select RISCV_TIMER if RISCV_SBI
121 select SYSCTL_EXCEPTION_TRACE
122 select THREAD_INFO_IN_TASK
123 select TRACE_IRQFLAGS_SUPPORT
124 select UACCESS_MEMCPY if !MMU
125 select ZONE_DMA32 if 64BIT
127 config ARCH_MMAP_RND_BITS_MIN
131 # max bits determined by the following formula:
132 # VA_BITS - PAGE_SHIFT - 3
133 config ARCH_MMAP_RND_BITS_MAX
134 default 24 if 64BIT # SV39 based
137 # set if we run in machine mode, cleared if we run in supervisor mode
142 # set if we are running in S-mode and can use SBI calls
145 depends on !RISCV_M_MODE
149 bool "MMU-based Paged Memory Management Support"
152 Select if you want MMU-based virtualised addressing space
153 support by paged memory management. If unsure, say 'Y'.
157 default 0xC0000000 if 32BIT
158 default 0x80000000 if 64BIT && !MMU
159 default 0xff60000000000000 if 64BIT
161 config KASAN_SHADOW_OFFSET
163 depends on KASAN_GENERIC
164 default 0xdfffffff00000000 if 64BIT
165 default 0xffffffff if 32BIT
167 config ARCH_FLATMEM_ENABLE
170 config ARCH_SPARSEMEM_ENABLE
173 select SPARSEMEM_STATIC if 32BIT && SPARSEMEM
174 select SPARSEMEM_VMEMMAP_ENABLE if 64BIT
176 config ARCH_SELECT_MEMORY_MODEL
177 def_bool ARCH_SPARSEMEM_ENABLE
179 config ARCH_SUPPORTS_UPROBES
182 config STACKTRACE_SUPPORT
188 select GENERIC_BUG_RELATIVE_POINTERS if 64BIT
190 config GENERIC_BUG_RELATIVE_POINTERS
193 config GENERIC_CALIBRATE_DELAY
199 config GENERIC_HWEIGHT
202 config FIX_EARLYCON_MEM
205 config PGTABLE_LEVELS
210 config LOCKDEP_SUPPORT
213 source "arch/riscv/Kconfig.socs"
214 source "arch/riscv/Kconfig.erratas"
222 This selects the base ISA that this kernel will target and must match
228 select GENERIC_LIB_ASHLDI3
229 select GENERIC_LIB_ASHRDI3
230 select GENERIC_LIB_LSHRDI3
231 select GENERIC_LIB_UCMPDI2
237 select ARCH_SUPPORTS_INT128 if CC_HAS_INT128
238 select HAVE_DYNAMIC_FTRACE if !XIP_KERNEL && MMU && $(cc-option,-fpatchable-function-entry=8)
239 select HAVE_DYNAMIC_FTRACE_WITH_REGS if HAVE_DYNAMIC_FTRACE
240 select HAVE_FTRACE_MCOUNT_RECORD if !XIP_KERNEL
241 select HAVE_FUNCTION_GRAPH_TRACER
242 select HAVE_FUNCTION_TRACER if !XIP_KERNEL
243 select SWIOTLB if MMU
247 # We must be able to map all physical memory into the kernel, but the compiler
248 # is still a bit more efficient when generating code if it's setup in a manner
249 # such that it can only map 2GiB of memory.
251 prompt "Kernel Code Model"
252 default CMODEL_MEDLOW if 32BIT
253 default CMODEL_MEDANY if 64BIT
256 bool "medium low code model"
258 bool "medium any code model"
261 config MODULE_SECTIONS
263 select HAVE_MOD_ARCH_SPECIFIC
266 bool "Symmetric Multi-Processing"
268 This enables support for systems with more than one CPU. If
269 you say N here, the kernel will run on single and
270 multiprocessor machines, but will use only one CPU of a
271 multiprocessor machine. If you say Y here, the kernel will run
272 on many, but not all, single processor machines. On a single
273 processor machine, the kernel will run faster if you say N
276 If you don't know what to do here, say N.
279 int "Maximum number of CPUs (2-32)"
285 bool "Support for hot-pluggable CPUs"
287 select GENERIC_IRQ_MIGRATION
290 Say Y here to experiment with turning CPUs off and on. CPUs
291 can be controlled through /sys/devices/system/cpu.
293 Say N if you want to disable CPU hotplug.
304 # Common NUMA Features
306 bool "NUMA Memory Allocation and Scheduler Support"
307 depends on SMP && MMU
308 select GENERIC_ARCH_NUMA
310 select ARCH_SUPPORTS_NUMA_BALANCING
311 select USE_PERCPU_NUMA_NODE_ID
312 select NEED_PER_CPU_EMBED_FIRST_CHUNK
314 Enable NUMA (Non-Uniform Memory Access) support.
316 The kernel will try to allocate memory used by a CPU on the
317 local memory of the CPU and add some more NUMA awareness to the kernel.
320 int "Maximum NUMA Nodes (as a power of 2)"
325 Specify the maximum number of NUMA Nodes available on the target
326 system. Increases memory reserved to accommodate various tables.
329 bool "Emit compressed instructions when building Linux"
332 Adds "C" to the ISA subsets that the toolchain is allowed to emit
333 when building Linux, which results in compressed instructions in the
336 If you don't know what to do here, say Y.
342 Say N here if you want to disable all floating-point related procedure
345 If you don't know what to do here, say Y.
349 menu "Kernel features"
351 source "kernel/Kconfig.hz"
354 bool "SBI v0.1 support"
357 This config allows kernel to use SBI v0.1 APIs. This will be
358 deprecated in future once legacy M-mode software are no longer in use.
360 config RISCV_BOOT_SPINWAIT
361 bool "Spinwait booting method"
365 This enables support for booting Linux via spinwait method. In the
366 spinwait method, all cores randomly jump to Linux. One of the cores
367 gets chosen via lottery and all other keep spinning on a percpu
368 variable. This method cannot support CPU hotplug and sparse hartid
369 scheme. It should be only enabled for M-mode Linux or platforms relying
370 on older firmware without SBI HSM extension. All other platforms should
371 rely on ordered booting via SBI HSM extension which gets chosen
372 dynamically at runtime if the firmware supports it.
375 bool "Kexec system call"
377 select HOTPLUG_CPU if SMP
380 kexec is a system call that implements the ability to shutdown your
381 current kernel, and to start another kernel. It is like a reboot
382 but it is independent of the system firmware. And like a reboot
383 you can start any kernel with it, not just Linux.
385 The name comes from the similarity to the exec system call.
388 bool "Build kdump crash kernel"
390 Generate crash dump after being started by kexec. This should
391 be normally only set in special crash dump kernels which are
392 loaded in the main kernel with kexec-tools into a specially
393 reserved region and then later executed after a crash by
396 For more details see Documentation/admin-guide/kdump/kdump.rst
403 string "Built-in kernel command line"
405 For most platforms, the arguments for the kernel's command line
406 are provided at run-time, during boot. However, there are cases
407 where either no arguments are being provided or the provided
408 arguments are insufficient or even invalid.
410 When that occurs, it is possible to define a built-in command
411 line here and choose how the kernel should use it later on.
414 prompt "Built-in command line usage" if CMDLINE != ""
415 default CMDLINE_FALLBACK
417 Choose how the kernel will handle the provided built-in command
420 config CMDLINE_FALLBACK
421 bool "Use bootloader kernel arguments if available"
423 Use the built-in command line as fallback in case we get nothing
424 during boot. This is the default behaviour.
426 config CMDLINE_EXTEND
427 bool "Extend bootloader kernel arguments"
429 The command-line arguments provided during boot will be
430 appended to the built-in command line. This is useful in
431 cases where the provided arguments are insufficient and
432 you don't want to or cannot modify them.
436 bool "Always use the default kernel command string"
438 Always use the built-in command line, even if we get one during
439 boot. This is useful in case you need to override the provided
440 command line on systems where you don't have or want control
449 bool "UEFI runtime support"
450 depends on OF && !XIP_KERNEL
453 select EFI_PARAMS_FROM_FDT
455 select EFI_GENERIC_STUB
456 select EFI_RUNTIME_WRAPPERS
461 This option provides support for runtime services provided
462 by UEFI firmware (such as non-volatile variables, realtime
463 clock, and platform reset). A UEFI stub is also provided to
464 allow the kernel to be booted as an EFI application. This
465 is only useful on systems that have UEFI firmware.
467 config CC_HAVE_STACKPROTECTOR_TLS
468 def_bool $(cc-option,-mstack-protector-guard=tls -mstack-protector-guard-reg=tp -mstack-protector-guard-offset=0)
470 config STACKPROTECTOR_PER_TASK
472 depends on !RANDSTRUCT
473 depends on STACKPROTECTOR && CC_HAVE_STACKPROTECTOR_TLS
475 config PHYS_RAM_BASE_FIXED
476 bool "Explicitly specified physical RAM address"
480 hex "Platform Physical RAM address"
481 depends on PHYS_RAM_BASE_FIXED
484 This is the physical address of RAM in the system. It has to be
485 explicitly specified to run early relocations of read-write data
489 bool "Kernel Execute-In-Place from ROM"
490 depends on MMU && SPARSEMEM
491 # This prevents XIP from being enabled by all{yes,mod}config, which
492 # fail to build since XIP doesn't support large kernels.
493 depends on !COMPILE_TEST
494 select PHYS_RAM_BASE_FIXED
496 Execute-In-Place allows the kernel to run from non-volatile storage
497 directly addressable by the CPU, such as NOR flash. This saves RAM
498 space since the text section of the kernel is not loaded from flash
499 to RAM. Read-write sections, such as the data section and stack,
500 are still copied to RAM. The XIP kernel is not compressed since
501 it has to run directly from flash, so it will take more space to
502 store it. The flash address used to link the kernel object files,
503 and for storing it, is configuration dependent. Therefore, if you
504 say Y here, you must know the proper physical address where to
505 store the kernel image depending on your own flash memory usage.
507 Also note that the make target becomes "make xipImage" rather than
508 "make zImage" or "make Image". The final kernel binary to put in
509 ROM memory will be arch/riscv/boot/xipImage.
511 SPARSEMEM is required because the kernel text and rodata that are
512 flash resident are not backed by memmap, then any attempt to get
513 a struct page on those regions will trigger a fault.
518 hex "XIP Kernel Physical Location"
519 depends on XIP_KERNEL
522 This is the physical address in your flash memory the kernel will
523 be linked for and stored to. This address is dependent on your
531 default y if XIP_KERNEL
533 menu "Power management options"
535 source "kernel/power/Kconfig"
539 menu "CPU Power Management"
541 source "drivers/cpuidle/Kconfig"
545 source "arch/riscv/kvm/Kconfig"