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_SUPPORTS_PAGE_TABLE_CHECK if MMU
42 select ARCH_USE_MEMTEST
43 select ARCH_USE_QUEUED_RWLOCKS
44 select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU
45 select ARCH_WANT_FRAME_POINTERS
46 select ARCH_WANT_GENERAL_HUGETLB
47 select ARCH_WANT_HUGE_PMD_SHARE if 64BIT
48 select ARCH_WANTS_THP_SWAP if HAVE_ARCH_TRANSPARENT_HUGEPAGE
49 select BINFMT_FLAT_NO_DATA_START_OFFSET if !MMU
50 select BUILDTIME_TABLE_SORT if MMU
51 select CLONE_BACKWARDS
52 select CLINT_TIMER if !MMU
54 select CPU_PM if CPU_IDLE
56 select GENERIC_ARCH_TOPOLOGY
57 select GENERIC_ATOMIC64 if !64BIT
58 select GENERIC_CLOCKEVENTS_BROADCAST if SMP
59 select GENERIC_EARLY_IOREMAP
60 select GENERIC_GETTIMEOFDAY if HAVE_GENERIC_VDSO
61 select GENERIC_IDLE_POLL_SETUP
62 select GENERIC_IOREMAP if MMU
63 select GENERIC_IRQ_MULTI_HANDLER
64 select GENERIC_IRQ_SHOW
65 select GENERIC_IRQ_SHOW_LEVEL
66 select GENERIC_LIB_DEVMEM_IS_ALLOWED
67 select GENERIC_PCI_IOMAP
68 select GENERIC_PTDUMP if MMU
69 select GENERIC_SCHED_CLOCK
70 select GENERIC_SMP_IDLE_THREAD
71 select GENERIC_TIME_VSYSCALL if MMU && 64BIT
72 select GENERIC_VDSO_TIME_NS if HAVE_GENERIC_VDSO
73 select HARDIRQS_SW_RESEND
74 select HAVE_ARCH_AUDITSYSCALL
75 select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL
76 select HAVE_ARCH_JUMP_LABEL_RELATIVE if !XIP_KERNEL
77 select HAVE_ARCH_KASAN if MMU && 64BIT
78 select HAVE_ARCH_KASAN_VMALLOC if MMU && 64BIT
79 select HAVE_ARCH_KFENCE if MMU && 64BIT
80 select HAVE_ARCH_KGDB if !XIP_KERNEL
81 select HAVE_ARCH_KGDB_QXFER_PKT
82 select HAVE_ARCH_MMAP_RND_BITS if MMU
83 select HAVE_ARCH_MMAP_RND_COMPAT_BITS if COMPAT
84 select HAVE_ARCH_SECCOMP_FILTER
85 select HAVE_ARCH_TRACEHOOK
86 select HAVE_ARCH_TRANSPARENT_HUGEPAGE if 64BIT && MMU
87 select ARCH_ENABLE_THP_MIGRATION if TRANSPARENT_HUGEPAGE
88 select HAVE_ARCH_THREAD_STRUCT_WHITELIST
89 select HAVE_ARCH_VMAP_STACK if MMU && 64BIT
90 select HAVE_ASM_MODVERSIONS
91 select HAVE_CONTEXT_TRACKING_USER
92 select HAVE_DEBUG_KMEMLEAK
93 select HAVE_DMA_CONTIGUOUS if MMU
94 select HAVE_EBPF_JIT if MMU
95 select HAVE_FUNCTION_ERROR_INJECTION
96 select HAVE_GCC_PLUGINS
97 select HAVE_GENERIC_VDSO if MMU && 64BIT
98 select HAVE_IRQ_TIME_ACCOUNTING
99 select HAVE_KPROBES if !XIP_KERNEL
100 select HAVE_KPROBES_ON_FTRACE if !XIP_KERNEL
101 select HAVE_KRETPROBES if !XIP_KERNEL
105 select HAVE_PERF_EVENTS
106 select HAVE_PERF_REGS
107 select HAVE_PERF_USER_STACK_DUMP
108 select HAVE_POSIX_CPU_TIMERS_TASK_WORK
109 select HAVE_REGS_AND_STACK_ACCESS_API
110 select HAVE_FUNCTION_ARG_ACCESS_API
111 select HAVE_STACKPROTECTOR
112 select HAVE_SYSCALL_TRACEPOINTS
115 select IRQ_FORCED_THREADING
116 select MODULES_USE_ELF_RELA if MODULES
117 select MODULE_SECTIONS if MODULES
119 select OF_DMA_DEFAULT_COHERENT
120 select OF_EARLY_FLATTREE
122 select PCI_DOMAINS_GENERIC if PCI
123 select PCI_MSI if PCI
125 select RISCV_TIMER if RISCV_SBI
127 select SYSCTL_EXCEPTION_TRACE
128 select THREAD_INFO_IN_TASK
129 select TRACE_IRQFLAGS_SUPPORT
130 select UACCESS_MEMCPY if !MMU
131 select ZONE_DMA32 if 64BIT
133 config ARCH_MMAP_RND_BITS_MIN
137 config ARCH_MMAP_RND_COMPAT_BITS_MIN
140 # max bits determined by the following formula:
141 # VA_BITS - PAGE_SHIFT - 3
142 config ARCH_MMAP_RND_BITS_MAX
143 default 24 if 64BIT # SV39 based
146 config ARCH_MMAP_RND_COMPAT_BITS_MAX
149 # set if we run in machine mode, cleared if we run in supervisor mode
154 # set if we are running in S-mode and can use SBI calls
157 depends on !RISCV_M_MODE
161 bool "MMU-based Paged Memory Management Support"
164 Select if you want MMU-based virtualised addressing space
165 support by paged memory management. If unsure, say 'Y'.
169 default 0xC0000000 if 32BIT
170 default 0x80000000 if 64BIT && !MMU
171 default 0xff60000000000000 if 64BIT
173 config KASAN_SHADOW_OFFSET
175 depends on KASAN_GENERIC
176 default 0xdfffffff00000000 if 64BIT
177 default 0xffffffff if 32BIT
179 config ARCH_FLATMEM_ENABLE
182 config ARCH_SPARSEMEM_ENABLE
185 select SPARSEMEM_STATIC if 32BIT && SPARSEMEM
186 select SPARSEMEM_VMEMMAP_ENABLE if 64BIT
188 config ARCH_SELECT_MEMORY_MODEL
189 def_bool ARCH_SPARSEMEM_ENABLE
191 config ARCH_SUPPORTS_UPROBES
194 config STACKTRACE_SUPPORT
200 select GENERIC_BUG_RELATIVE_POINTERS if 64BIT
202 config GENERIC_BUG_RELATIVE_POINTERS
205 config GENERIC_CALIBRATE_DELAY
211 config GENERIC_HWEIGHT
214 config FIX_EARLYCON_MEM
217 config PGTABLE_LEVELS
222 config LOCKDEP_SUPPORT
225 config RISCV_DMA_NONCOHERENT
227 select ARCH_HAS_DMA_PREP_COHERENT
228 select ARCH_HAS_SYNC_DMA_FOR_DEVICE
229 select ARCH_HAS_SYNC_DMA_FOR_CPU
230 select ARCH_HAS_SETUP_DMA_OPS
231 select DMA_DIRECT_REMAP
234 def_bool $(as-instr,.insn r 51$(comma) 0$(comma) 0$(comma) t0$(comma) t0$(comma) zero)
236 source "arch/riscv/Kconfig.socs"
237 source "arch/riscv/Kconfig.erratas"
242 bool "Allow configurations that result in non-portable kernels"
244 RISC-V kernel binaries are compatible between all known systems
245 whenever possible, but there are some use cases that can only be
246 satisfied by configurations that result in kernel binaries that are
247 not portable between systems.
249 Selecting N does not guarantee kernels will be portable to all known
250 systems. Selecting any of the options guarded by NONPORTABLE will
251 result in kernel binaries that are unlikely to be portable between
260 This selects the base ISA that this kernel will target and must match
265 depends on NONPORTABLE
267 select GENERIC_LIB_ASHLDI3
268 select GENERIC_LIB_ASHRDI3
269 select GENERIC_LIB_LSHRDI3
270 select GENERIC_LIB_UCMPDI2
276 select ARCH_SUPPORTS_INT128 if CC_HAS_INT128
277 select HAVE_DYNAMIC_FTRACE if !XIP_KERNEL && MMU && $(cc-option,-fpatchable-function-entry=8)
278 select HAVE_DYNAMIC_FTRACE_WITH_REGS if HAVE_DYNAMIC_FTRACE
279 select HAVE_FTRACE_MCOUNT_RECORD if !XIP_KERNEL
280 select HAVE_FUNCTION_GRAPH_TRACER
281 select HAVE_FUNCTION_TRACER if !XIP_KERNEL
282 select SWIOTLB if MMU
286 # We must be able to map all physical memory into the kernel, but the compiler
287 # is still a bit more efficient when generating code if it's setup in a manner
288 # such that it can only map 2GiB of memory.
290 prompt "Kernel Code Model"
291 default CMODEL_MEDLOW if 32BIT
292 default CMODEL_MEDANY if 64BIT
295 bool "medium low code model"
297 bool "medium any code model"
300 config MODULE_SECTIONS
302 select HAVE_MOD_ARCH_SPECIFIC
305 bool "Symmetric Multi-Processing"
307 This enables support for systems with more than one CPU. If
308 you say N here, the kernel will run on single and
309 multiprocessor machines, but will use only one CPU of a
310 multiprocessor machine. If you say Y here, the kernel will run
311 on many, but not all, single processor machines. On a single
312 processor machine, the kernel will run faster if you say N
315 If you don't know what to do here, say N.
318 int "Maximum number of CPUs (2-512)"
320 range 2 512 if !SBI_V01
321 range 2 32 if SBI_V01 && 32BIT
322 range 2 64 if SBI_V01 && 64BIT
323 default "32" if 32BIT
324 default "64" if 64BIT
327 bool "Support for hot-pluggable CPUs"
329 select GENERIC_IRQ_MIGRATION
332 Say Y here to experiment with turning CPUs off and on. CPUs
333 can be controlled through /sys/devices/system/cpu.
335 Say N if you want to disable CPU hotplug.
346 # Common NUMA Features
348 bool "NUMA Memory Allocation and Scheduler Support"
349 depends on SMP && MMU
350 select GENERIC_ARCH_NUMA
352 select ARCH_SUPPORTS_NUMA_BALANCING
353 select USE_PERCPU_NUMA_NODE_ID
354 select NEED_PER_CPU_EMBED_FIRST_CHUNK
356 Enable NUMA (Non-Uniform Memory Access) support.
358 The kernel will try to allocate memory used by a CPU on the
359 local memory of the CPU and add some more NUMA awareness to the kernel.
362 int "Maximum NUMA Nodes (as a power of 2)"
367 Specify the maximum number of NUMA Nodes available on the target
368 system. Increases memory reserved to accommodate various tables.
370 config RISCV_ALTERNATIVE
372 depends on !XIP_KERNEL
374 This Kconfig allows the kernel to automatically patch the
375 errata required by the execution platform at run time. The
376 code patching is performed once in the boot stages. It means
377 that the overhead from this mechanism is just taken once.
379 config RISCV_ALTERNATIVE_EARLY
381 depends on RISCV_ALTERNATIVE
383 Allows early patching of the kernel for special errata
386 bool "Emit compressed instructions when building Linux"
389 Adds "C" to the ISA subsets that the toolchain is allowed to emit
390 when building Linux, which results in compressed instructions in the
393 If you don't know what to do here, say Y.
395 config RISCV_ISA_SVPBMT
396 bool "SVPBMT extension support"
397 depends on 64BIT && MMU
398 depends on !XIP_KERNEL
399 select RISCV_ALTERNATIVE
402 Adds support to dynamically detect the presence of the SVPBMT
403 ISA-extension (Supervisor-mode: page-based memory types) and
406 The memory type for a page contains a combination of attributes
407 that indicate the cacheability, idempotency, and ordering
408 properties for access to that page.
410 The SVPBMT extension is only available on 64Bit cpus.
412 If you don't know what to do here, say Y.
416 default y if 64BIT && $(cc-option,-mabi=lp64 -march=rv64ima_zicbom)
417 default y if 32BIT && $(cc-option,-mabi=ilp32 -march=rv32ima_zicbom)
419 config RISCV_ISA_ZICBOM
420 bool "Zicbom extension support for non-coherent DMA operation"
421 depends on CC_HAS_ZICBOM
422 depends on !XIP_KERNEL && MMU
423 select RISCV_DMA_NONCOHERENT
424 select RISCV_ALTERNATIVE
427 Adds support to dynamically detect the presence of the ZICBOM
428 extension (Cache Block Management Operations) and enable its
431 The Zicbom extension can be used to handle for example
432 non-coherent DMA support on devices that need it.
434 If you don't know what to do here, say Y.
440 Say N here if you want to disable all floating-point related procedure
443 If you don't know what to do here, say Y.
445 endmenu # "Platform type"
447 menu "Kernel features"
449 source "kernel/Kconfig.hz"
452 bool "SBI v0.1 support"
455 This config allows kernel to use SBI v0.1 APIs. This will be
456 deprecated in future once legacy M-mode software are no longer in use.
458 config RISCV_BOOT_SPINWAIT
459 bool "Spinwait booting method"
461 default y if RISCV_SBI_V01 || RISCV_M_MODE
463 This enables support for booting Linux via spinwait method. In the
464 spinwait method, all cores randomly jump to Linux. One of the cores
465 gets chosen via lottery and all other keep spinning on a percpu
466 variable. This method cannot support CPU hotplug and sparse hartid
467 scheme. It should be only enabled for M-mode Linux or platforms relying
468 on older firmware without SBI HSM extension. All other platforms should
469 rely on ordered booting via SBI HSM extension which gets chosen
470 dynamically at runtime if the firmware supports it.
472 Since spinwait is incompatible with sparse hart IDs, it requires
473 NR_CPUS be large enough to contain the physical hart ID of the first
476 If unsure what to do here, say N.
479 bool "Kexec system call"
481 select HOTPLUG_CPU if SMP
484 kexec is a system call that implements the ability to shutdown your
485 current kernel, and to start another kernel. It is like a reboot
486 but it is independent of the system firmware. And like a reboot
487 you can start any kernel with it, not just Linux.
489 The name comes from the similarity to the exec system call.
492 bool "kexec file based systmem call"
495 select HAVE_IMA_KEXEC if IMA
498 This is new version of kexec system call. This system call is
499 file based and takes file descriptors as system call argument
500 for kernel and initramfs as opposed to list of segments as
501 accepted by previous system call.
503 If you don't know what to do here, say Y.
505 config ARCH_HAS_KEXEC_PURGATORY
508 depends on CRYPTO_SHA256=y
511 bool "Build kdump crash kernel"
513 Generate crash dump after being started by kexec. This should
514 be normally only set in special crash dump kernels which are
515 loaded in the main kernel with kexec-tools into a specially
516 reserved region and then later executed after a crash by
519 For more details see Documentation/admin-guide/kdump/kdump.rst
522 bool "Kernel support for 32-bit U-mode"
524 depends on 64BIT && MMU
526 This option enables support for a 32-bit U-mode running under a 64-bit
527 kernel at S-mode. riscv32-specific components such as system calls,
528 the user helper functions (vdso), signal rt_frame functions and the
529 ptrace interface are handled appropriately by the kernel.
531 If you want to execute 32-bit userspace applications, say Y.
533 endmenu # "Kernel features"
538 string "Built-in kernel command line"
540 For most platforms, the arguments for the kernel's command line
541 are provided at run-time, during boot. However, there are cases
542 where either no arguments are being provided or the provided
543 arguments are insufficient or even invalid.
545 When that occurs, it is possible to define a built-in command
546 line here and choose how the kernel should use it later on.
549 prompt "Built-in command line usage" if CMDLINE != ""
550 default CMDLINE_FALLBACK
552 Choose how the kernel will handle the provided built-in command
555 config CMDLINE_FALLBACK
556 bool "Use bootloader kernel arguments if available"
558 Use the built-in command line as fallback in case we get nothing
559 during boot. This is the default behaviour.
561 config CMDLINE_EXTEND
562 bool "Extend bootloader kernel arguments"
564 The command-line arguments provided during boot will be
565 appended to the built-in command line. This is useful in
566 cases where the provided arguments are insufficient and
567 you don't want to or cannot modify them.
570 bool "Always use the default kernel command string"
572 Always use the built-in command line, even if we get one during
573 boot. This is useful in case you need to override the provided
574 command line on systems where you don't have or want control
583 bool "UEFI runtime support"
584 depends on OF && !XIP_KERNEL
587 select EFI_PARAMS_FROM_FDT
589 select EFI_GENERIC_STUB
590 select EFI_RUNTIME_WRAPPERS
595 This option provides support for runtime services provided
596 by UEFI firmware (such as non-volatile variables, realtime
597 clock, and platform reset). A UEFI stub is also provided to
598 allow the kernel to be booted as an EFI application. This
599 is only useful on systems that have UEFI firmware.
601 config CC_HAVE_STACKPROTECTOR_TLS
602 def_bool $(cc-option,-mstack-protector-guard=tls -mstack-protector-guard-reg=tp -mstack-protector-guard-offset=0)
604 config STACKPROTECTOR_PER_TASK
606 depends on !RANDSTRUCT
607 depends on STACKPROTECTOR && CC_HAVE_STACKPROTECTOR_TLS
609 config PHYS_RAM_BASE_FIXED
610 bool "Explicitly specified physical RAM address"
611 depends on NONPORTABLE
615 hex "Platform Physical RAM address"
616 depends on PHYS_RAM_BASE_FIXED
619 This is the physical address of RAM in the system. It has to be
620 explicitly specified to run early relocations of read-write data
624 bool "Kernel Execute-In-Place from ROM"
625 depends on MMU && SPARSEMEM && NONPORTABLE
626 # This prevents XIP from being enabled by all{yes,mod}config, which
627 # fail to build since XIP doesn't support large kernels.
628 depends on !COMPILE_TEST
629 select PHYS_RAM_BASE_FIXED
631 Execute-In-Place allows the kernel to run from non-volatile storage
632 directly addressable by the CPU, such as NOR flash. This saves RAM
633 space since the text section of the kernel is not loaded from flash
634 to RAM. Read-write sections, such as the data section and stack,
635 are still copied to RAM. The XIP kernel is not compressed since
636 it has to run directly from flash, so it will take more space to
637 store it. The flash address used to link the kernel object files,
638 and for storing it, is configuration dependent. Therefore, if you
639 say Y here, you must know the proper physical address where to
640 store the kernel image depending on your own flash memory usage.
642 Also note that the make target becomes "make xipImage" rather than
643 "make zImage" or "make Image". The final kernel binary to put in
644 ROM memory will be arch/riscv/boot/xipImage.
646 SPARSEMEM is required because the kernel text and rodata that are
647 flash resident are not backed by memmap, then any attempt to get
648 a struct page on those regions will trigger a fault.
653 hex "XIP Kernel Physical Location"
654 depends on XIP_KERNEL
657 This is the physical address in your flash memory the kernel will
658 be linked for and stored to. This address is dependent on your
661 endmenu # "Boot options"
665 depends on OF && NONPORTABLE
666 default y if XIP_KERNEL
675 menu "Power management options"
677 source "kernel/power/Kconfig"
679 endmenu # "Power management options"
681 menu "CPU Power Management"
683 source "drivers/cpuidle/Kconfig"
685 endmenu # "CPU Power Management"
687 source "arch/riscv/kvm/Kconfig"