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_ENABLE_HUGEPAGE_MIGRATION if HUGETLB_PAGE && MIGRATION
16 select ARCH_ENABLE_SPLIT_PMD_PTLOCK if PGTABLE_LEVELS > 2
17 select ARCH_ENABLE_THP_MIGRATION if TRANSPARENT_HUGEPAGE
18 select ARCH_HAS_BINFMT_FLAT
19 select ARCH_HAS_CURRENT_STACK_POINTER
20 select ARCH_HAS_DEBUG_VIRTUAL if MMU
21 select ARCH_HAS_DEBUG_VM_PGTABLE
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_PMEM_API
29 select ARCH_HAS_PTE_SPECIAL
30 select ARCH_HAS_SET_DIRECT_MAP if MMU
31 select ARCH_HAS_SET_MEMORY if MMU
32 select ARCH_HAS_STRICT_KERNEL_RWX if MMU && !XIP_KERNEL
33 select ARCH_HAS_STRICT_MODULE_RWX if MMU && !XIP_KERNEL
34 select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
35 select ARCH_HAS_UBSAN_SANITIZE_ALL
36 select ARCH_OPTIONAL_KERNEL_RWX if ARCH_HAS_STRICT_KERNEL_RWX
37 select ARCH_OPTIONAL_KERNEL_RWX_DEFAULT
39 select ARCH_SUPPORTS_ATOMIC_RMW
40 select ARCH_SUPPORTS_DEBUG_PAGEALLOC if MMU
41 select ARCH_SUPPORTS_HUGETLBFS if MMU
42 select ARCH_SUPPORTS_PAGE_TABLE_CHECK if MMU
43 select ARCH_USE_MEMTEST
44 select ARCH_USE_QUEUED_RWLOCKS
45 select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU
46 select ARCH_WANT_FRAME_POINTERS
47 select ARCH_WANT_GENERAL_HUGETLB
48 select ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAP
49 select ARCH_WANT_HUGE_PMD_SHARE if 64BIT
50 select ARCH_WANT_LD_ORPHAN_WARN if !XIP_KERNEL
51 select ARCH_WANTS_THP_SWAP if HAVE_ARCH_TRANSPARENT_HUGEPAGE
52 select BINFMT_FLAT_NO_DATA_START_OFFSET if !MMU
53 select BUILDTIME_TABLE_SORT if MMU
54 select CLINT_TIMER if !MMU
55 select CLONE_BACKWARDS
57 select CPU_PM if CPU_IDLE
59 select GENERIC_ARCH_TOPOLOGY
60 select GENERIC_ATOMIC64 if !64BIT
61 select GENERIC_CLOCKEVENTS_BROADCAST if SMP
62 select GENERIC_EARLY_IOREMAP
63 select GENERIC_GETTIMEOFDAY if HAVE_GENERIC_VDSO
64 select GENERIC_IDLE_POLL_SETUP
65 select GENERIC_IOREMAP if MMU
66 select GENERIC_IRQ_IPI if SMP
67 select GENERIC_IRQ_IPI_MUX if SMP
68 select GENERIC_IRQ_MULTI_HANDLER
69 select GENERIC_IRQ_SHOW
70 select GENERIC_IRQ_SHOW_LEVEL
71 select GENERIC_LIB_DEVMEM_IS_ALLOWED
72 select GENERIC_PCI_IOMAP
73 select GENERIC_PTDUMP if MMU
74 select GENERIC_SCHED_CLOCK
75 select GENERIC_SMP_IDLE_THREAD
76 select GENERIC_TIME_VSYSCALL if MMU && 64BIT
77 select GENERIC_VDSO_TIME_NS if HAVE_GENERIC_VDSO
78 select HARDIRQS_SW_RESEND
79 select HAVE_ARCH_AUDITSYSCALL
80 select HAVE_ARCH_HUGE_VMALLOC if HAVE_ARCH_HUGE_VMAP
81 select HAVE_ARCH_HUGE_VMAP if MMU && 64BIT && !XIP_KERNEL
82 select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL
83 select HAVE_ARCH_JUMP_LABEL_RELATIVE if !XIP_KERNEL
84 select HAVE_ARCH_KASAN if MMU && 64BIT
85 select HAVE_ARCH_KASAN_VMALLOC if MMU && 64BIT
86 select HAVE_ARCH_KFENCE if MMU && 64BIT
87 select HAVE_ARCH_KGDB if !XIP_KERNEL
88 select HAVE_ARCH_KGDB_QXFER_PKT
89 select HAVE_ARCH_MMAP_RND_BITS if MMU
90 select HAVE_ARCH_MMAP_RND_COMPAT_BITS if COMPAT
91 select HAVE_ARCH_SECCOMP_FILTER
92 select HAVE_ARCH_THREAD_STRUCT_WHITELIST
93 select HAVE_ARCH_TRACEHOOK
94 select HAVE_ARCH_TRANSPARENT_HUGEPAGE if 64BIT && MMU
95 select HAVE_ARCH_VMAP_STACK if MMU && 64BIT
96 select HAVE_ASM_MODVERSIONS
97 select HAVE_CONTEXT_TRACKING_USER
98 select HAVE_DEBUG_KMEMLEAK
99 select HAVE_DMA_CONTIGUOUS if MMU
100 select HAVE_EBPF_JIT if MMU
101 select HAVE_FUNCTION_ARG_ACCESS_API
102 select HAVE_FUNCTION_ERROR_INJECTION
103 select HAVE_GCC_PLUGINS
104 select HAVE_GENERIC_VDSO if MMU && 64BIT
105 select HAVE_IRQ_TIME_ACCOUNTING
106 select HAVE_KPROBES if !XIP_KERNEL
107 select HAVE_KPROBES_ON_FTRACE if !XIP_KERNEL
108 select HAVE_KRETPROBES if !XIP_KERNEL
109 select HAVE_RETHOOK if !XIP_KERNEL
113 select HAVE_PERF_EVENTS
114 select HAVE_PERF_REGS
115 select HAVE_PERF_USER_STACK_DUMP
116 select HAVE_POSIX_CPU_TIMERS_TASK_WORK
117 select HAVE_REGS_AND_STACK_ACCESS_API
119 select HAVE_STACKPROTECTOR
120 select HAVE_SYSCALL_TRACEPOINTS
122 select IRQ_FORCED_THREADING
123 select MODULES_USE_ELF_RELA if MODULES
124 select MODULE_SECTIONS if MODULES
126 select OF_DMA_DEFAULT_COHERENT
127 select OF_EARLY_FLATTREE
129 select PCI_DOMAINS_GENERIC if PCI
130 select PCI_MSI if PCI
132 select RISCV_TIMER if RISCV_SBI
135 select SYSCTL_EXCEPTION_TRACE
136 select THREAD_INFO_IN_TASK
137 select TRACE_IRQFLAGS_SUPPORT
138 select UACCESS_MEMCPY if !MMU
139 select ZONE_DMA32 if 64BIT
140 select HAVE_DYNAMIC_FTRACE if !XIP_KERNEL && MMU && $(cc-option,-fpatchable-function-entry=8)
141 select HAVE_DYNAMIC_FTRACE_WITH_REGS if HAVE_DYNAMIC_FTRACE
142 select HAVE_FTRACE_MCOUNT_RECORD if !XIP_KERNEL
143 select HAVE_FUNCTION_GRAPH_TRACER
144 select HAVE_FUNCTION_TRACER if !XIP_KERNEL && !PREEMPTION
146 config ARCH_MMAP_RND_BITS_MIN
150 config ARCH_MMAP_RND_COMPAT_BITS_MIN
153 # max bits determined by the following formula:
154 # VA_BITS - PAGE_SHIFT - 3
155 config ARCH_MMAP_RND_BITS_MAX
156 default 24 if 64BIT # SV39 based
159 config ARCH_MMAP_RND_COMPAT_BITS_MAX
162 # set if we run in machine mode, cleared if we run in supervisor mode
167 # set if we are running in S-mode and can use SBI calls
170 depends on !RISCV_M_MODE
174 bool "MMU-based Paged Memory Management Support"
177 Select if you want MMU-based virtualised addressing space
178 support by paged memory management. If unsure, say 'Y'.
182 default 0xC0000000 if 32BIT
183 default 0x80000000 if 64BIT && !MMU
184 default 0xff60000000000000 if 64BIT
186 config KASAN_SHADOW_OFFSET
188 depends on KASAN_GENERIC
189 default 0xdfffffff00000000 if 64BIT
190 default 0xffffffff if 32BIT
192 config ARCH_FLATMEM_ENABLE
195 config ARCH_SPARSEMEM_ENABLE
198 select SPARSEMEM_STATIC if 32BIT && SPARSEMEM
199 select SPARSEMEM_VMEMMAP_ENABLE if 64BIT
201 config ARCH_SELECT_MEMORY_MODEL
202 def_bool ARCH_SPARSEMEM_ENABLE
204 config ARCH_SUPPORTS_UPROBES
207 config STACKTRACE_SUPPORT
213 select GENERIC_BUG_RELATIVE_POINTERS if 64BIT
215 config GENERIC_BUG_RELATIVE_POINTERS
218 config GENERIC_CALIBRATE_DELAY
224 config GENERIC_HWEIGHT
227 config FIX_EARLYCON_MEM
230 config PGTABLE_LEVELS
235 config LOCKDEP_SUPPORT
238 config RISCV_DMA_NONCOHERENT
240 select ARCH_HAS_DMA_PREP_COHERENT
241 select ARCH_HAS_SETUP_DMA_OPS
242 select ARCH_HAS_SYNC_DMA_FOR_CPU
243 select ARCH_HAS_SYNC_DMA_FOR_DEVICE
244 select DMA_DIRECT_REMAP
247 def_bool $(as-instr,.insn r 51$(comma) 0$(comma) 0$(comma) t0$(comma) t0$(comma) zero)
249 source "arch/riscv/Kconfig.socs"
250 source "arch/riscv/Kconfig.erratas"
255 bool "Allow configurations that result in non-portable kernels"
257 RISC-V kernel binaries are compatible between all known systems
258 whenever possible, but there are some use cases that can only be
259 satisfied by configurations that result in kernel binaries that are
260 not portable between systems.
262 Selecting N does not guarantee kernels will be portable to all known
263 systems. Selecting any of the options guarded by NONPORTABLE will
264 result in kernel binaries that are unlikely to be portable between
273 This selects the base ISA that this kernel will target and must match
278 depends on NONPORTABLE
280 select GENERIC_LIB_ASHLDI3
281 select GENERIC_LIB_ASHRDI3
282 select GENERIC_LIB_LSHRDI3
283 select GENERIC_LIB_UCMPDI2
289 select ARCH_SUPPORTS_INT128 if CC_HAS_INT128
290 select SWIOTLB if MMU
294 # We must be able to map all physical memory into the kernel, but the compiler
295 # is still a bit more efficient when generating code if it's setup in a manner
296 # such that it can only map 2GiB of memory.
298 prompt "Kernel Code Model"
299 default CMODEL_MEDLOW if 32BIT
300 default CMODEL_MEDANY if 64BIT
303 bool "medium low code model"
305 bool "medium any code model"
308 config MODULE_SECTIONS
310 select HAVE_MOD_ARCH_SPECIFIC
313 bool "Symmetric Multi-Processing"
315 This enables support for systems with more than one CPU. If
316 you say N here, the kernel will run on single and
317 multiprocessor machines, but will use only one CPU of a
318 multiprocessor machine. If you say Y here, the kernel will run
319 on many, but not all, single processor machines. On a single
320 processor machine, the kernel will run faster if you say N
323 If you don't know what to do here, say N.
326 int "Maximum number of CPUs (2-512)"
328 range 2 512 if !RISCV_SBI_V01
329 range 2 32 if RISCV_SBI_V01 && 32BIT
330 range 2 64 if RISCV_SBI_V01 && 64BIT
331 default "32" if 32BIT
332 default "64" if 64BIT
335 bool "Support for hot-pluggable CPUs"
337 select GENERIC_IRQ_MIGRATION
340 Say Y here to experiment with turning CPUs off and on. CPUs
341 can be controlled through /sys/devices/system/cpu.
343 Say N if you want to disable CPU hotplug.
354 # Common NUMA Features
356 bool "NUMA Memory Allocation and Scheduler Support"
357 depends on SMP && MMU
358 select ARCH_SUPPORTS_NUMA_BALANCING
359 select GENERIC_ARCH_NUMA
360 select NEED_PER_CPU_EMBED_FIRST_CHUNK
362 select USE_PERCPU_NUMA_NODE_ID
364 Enable NUMA (Non-Uniform Memory Access) support.
366 The kernel will try to allocate memory used by a CPU on the
367 local memory of the CPU and add some more NUMA awareness to the kernel.
370 int "Maximum NUMA Nodes (as a power of 2)"
375 Specify the maximum number of NUMA Nodes available on the target
376 system. Increases memory reserved to accommodate various tables.
378 config RISCV_ALTERNATIVE
380 depends on !XIP_KERNEL
382 This Kconfig allows the kernel to automatically patch the
383 errata required by the execution platform at run time. The
384 code patching is performed once in the boot stages. It means
385 that the overhead from this mechanism is just taken once.
387 config RISCV_ALTERNATIVE_EARLY
389 depends on RISCV_ALTERNATIVE
391 Allows early patching of the kernel for special errata
394 bool "Emit compressed instructions when building Linux"
397 Adds "C" to the ISA subsets that the toolchain is allowed to emit
398 when building Linux, which results in compressed instructions in the
401 If you don't know what to do here, say Y.
403 config RISCV_ISA_SVPBMT
404 bool "SVPBMT extension support"
405 depends on 64BIT && MMU
406 depends on !XIP_KERNEL
408 select RISCV_ALTERNATIVE
410 Adds support to dynamically detect the presence of the SVPBMT
411 ISA-extension (Supervisor-mode: page-based memory types) and
414 The memory type for a page contains a combination of attributes
415 that indicate the cacheability, idempotency, and ordering
416 properties for access to that page.
418 The SVPBMT extension is only available on 64Bit cpus.
420 If you don't know what to do here, say Y.
422 config TOOLCHAIN_HAS_ZBB
425 depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64ima_zbb)
426 depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32ima_zbb)
427 depends on LLD_VERSION >= 150000 || LD_VERSION >= 23900
431 bool "Zbb extension support for bit manipulation instructions"
432 depends on TOOLCHAIN_HAS_ZBB
433 depends on !XIP_KERNEL && MMU
434 select RISCV_ALTERNATIVE
437 Adds support to dynamically detect the presence of the ZBB
438 extension (basic bit manipulation) and enable its usage.
440 The Zbb extension provides instructions to accelerate a number
441 of bit-specific operations (count bit population, sign extending,
444 If you don't know what to do here, say Y.
446 config RISCV_ISA_ZICBOM
447 bool "Zicbom extension support for non-coherent DMA operation"
448 depends on !XIP_KERNEL && MMU
450 select RISCV_ALTERNATIVE
451 select RISCV_DMA_NONCOHERENT
453 Adds support to dynamically detect the presence of the ZICBOM
454 extension (Cache Block Management Operations) and enable its
457 The Zicbom extension can be used to handle for example
458 non-coherent DMA support on devices that need it.
460 If you don't know what to do here, say Y.
462 config TOOLCHAIN_HAS_ZIHINTPAUSE
465 depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64ima_zihintpause)
466 depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32ima_zihintpause)
467 depends on LLD_VERSION >= 150000 || LD_VERSION >= 23600
469 config TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI
471 # https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=aed44286efa8ae8717a77d94b51ac3614e2ca6dc
472 depends on AS_IS_GNU && AS_VERSION >= 23800
474 Newer binutils versions default to ISA spec version 20191213 which
475 moves some instructions from the I extension to the Zicsr and Zifencei
478 config TOOLCHAIN_NEEDS_OLD_ISA_SPEC
480 depends on TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI
481 # https://github.com/llvm/llvm-project/commit/22e199e6afb1263c943c0c0d4498694e15bf8a16
482 depends on CC_IS_CLANG && CLANG_VERSION < 170000
484 Certain versions of clang do not support zicsr and zifencei via -march
485 but newer versions of binutils require it for the reasons noted in the
486 help text of CONFIG_TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI. This
487 option causes an older ISA spec compatible with these older versions
488 of clang to be passed to GAS, which has the same result as passing zicsr
489 and zifencei to -march.
495 Say N here if you want to disable all floating-point related procedure
498 If you don't know what to do here, say Y.
500 endmenu # "Platform type"
502 menu "Kernel features"
504 source "kernel/Kconfig.hz"
507 bool "SBI v0.1 support"
510 This config allows kernel to use SBI v0.1 APIs. This will be
511 deprecated in future once legacy M-mode software are no longer in use.
513 config RISCV_BOOT_SPINWAIT
514 bool "Spinwait booting method"
516 default y if RISCV_SBI_V01 || RISCV_M_MODE
518 This enables support for booting Linux via spinwait method. In the
519 spinwait method, all cores randomly jump to Linux. One of the cores
520 gets chosen via lottery and all other keep spinning on a percpu
521 variable. This method cannot support CPU hotplug and sparse hartid
522 scheme. It should be only enabled for M-mode Linux or platforms relying
523 on older firmware without SBI HSM extension. All other platforms should
524 rely on ordered booting via SBI HSM extension which gets chosen
525 dynamically at runtime if the firmware supports it.
527 Since spinwait is incompatible with sparse hart IDs, it requires
528 NR_CPUS be large enough to contain the physical hart ID of the first
531 If unsure what to do here, say N.
534 bool "Kexec system call"
536 select HOTPLUG_CPU if SMP
539 kexec is a system call that implements the ability to shutdown your
540 current kernel, and to start another kernel. It is like a reboot
541 but it is independent of the system firmware. And like a reboot
542 you can start any kernel with it, not just Linux.
544 The name comes from the similarity to the exec system call.
547 bool "kexec file based systmem call"
548 depends on 64BIT && MMU
549 select HAVE_IMA_KEXEC if IMA
553 This is new version of kexec system call. This system call is
554 file based and takes file descriptors as system call argument
555 for kernel and initramfs as opposed to list of segments as
556 accepted by previous system call.
558 If you don't know what to do here, say Y.
560 config ARCH_HAS_KEXEC_PURGATORY
563 depends on CRYPTO_SHA256=y
566 bool "Build kdump crash kernel"
568 Generate crash dump after being started by kexec. This should
569 be normally only set in special crash dump kernels which are
570 loaded in the main kernel with kexec-tools into a specially
571 reserved region and then later executed after a crash by
574 For more details see Documentation/admin-guide/kdump/kdump.rst
577 bool "Kernel support for 32-bit U-mode"
579 depends on 64BIT && MMU
581 This option enables support for a 32-bit U-mode running under a 64-bit
582 kernel at S-mode. riscv32-specific components such as system calls,
583 the user helper functions (vdso), signal rt_frame functions and the
584 ptrace interface are handled appropriately by the kernel.
586 If you want to execute 32-bit userspace applications, say Y.
588 endmenu # "Kernel features"
593 string "Built-in kernel command line"
595 For most platforms, the arguments for the kernel's command line
596 are provided at run-time, during boot. However, there are cases
597 where either no arguments are being provided or the provided
598 arguments are insufficient or even invalid.
600 When that occurs, it is possible to define a built-in command
601 line here and choose how the kernel should use it later on.
604 prompt "Built-in command line usage" if CMDLINE != ""
605 default CMDLINE_FALLBACK
607 Choose how the kernel will handle the provided built-in command
610 config CMDLINE_FALLBACK
611 bool "Use bootloader kernel arguments if available"
613 Use the built-in command line as fallback in case we get nothing
614 during boot. This is the default behaviour.
616 config CMDLINE_EXTEND
617 bool "Extend bootloader kernel arguments"
619 The command-line arguments provided during boot will be
620 appended to the built-in command line. This is useful in
621 cases where the provided arguments are insufficient and
622 you don't want to or cannot modify them.
625 bool "Always use the default kernel command string"
627 Always use the built-in command line, even if we get one during
628 boot. This is useful in case you need to override the provided
629 command line on systems where you don't have or want control
638 bool "UEFI runtime support"
639 depends on OF && !XIP_KERNEL
642 select EFI_GENERIC_STUB
643 select EFI_PARAMS_FROM_FDT
644 select EFI_RUNTIME_WRAPPERS
650 This option provides support for runtime services provided
651 by UEFI firmware (such as non-volatile variables, realtime
652 clock, and platform reset). A UEFI stub is also provided to
653 allow the kernel to be booted as an EFI application. This
654 is only useful on systems that have UEFI firmware.
656 config CC_HAVE_STACKPROTECTOR_TLS
657 def_bool $(cc-option,-mstack-protector-guard=tls -mstack-protector-guard-reg=tp -mstack-protector-guard-offset=0)
659 config STACKPROTECTOR_PER_TASK
661 depends on !RANDSTRUCT
662 depends on STACKPROTECTOR && CC_HAVE_STACKPROTECTOR_TLS
664 config PHYS_RAM_BASE_FIXED
665 bool "Explicitly specified physical RAM address"
666 depends on NONPORTABLE
670 hex "Platform Physical RAM address"
671 depends on PHYS_RAM_BASE_FIXED
674 This is the physical address of RAM in the system. It has to be
675 explicitly specified to run early relocations of read-write data
679 bool "Kernel Execute-In-Place from ROM"
680 depends on MMU && SPARSEMEM && NONPORTABLE
681 # This prevents XIP from being enabled by all{yes,mod}config, which
682 # fail to build since XIP doesn't support large kernels.
683 depends on !COMPILE_TEST
684 select PHYS_RAM_BASE_FIXED
686 Execute-In-Place allows the kernel to run from non-volatile storage
687 directly addressable by the CPU, such as NOR flash. This saves RAM
688 space since the text section of the kernel is not loaded from flash
689 to RAM. Read-write sections, such as the data section and stack,
690 are still copied to RAM. The XIP kernel is not compressed since
691 it has to run directly from flash, so it will take more space to
692 store it. The flash address used to link the kernel object files,
693 and for storing it, is configuration dependent. Therefore, if you
694 say Y here, you must know the proper physical address where to
695 store the kernel image depending on your own flash memory usage.
697 Also note that the make target becomes "make xipImage" rather than
698 "make zImage" or "make Image". The final kernel binary to put in
699 ROM memory will be arch/riscv/boot/xipImage.
701 SPARSEMEM is required because the kernel text and rodata that are
702 flash resident are not backed by memmap, then any attempt to get
703 a struct page on those regions will trigger a fault.
708 hex "XIP Kernel Physical Location"
709 depends on XIP_KERNEL
712 This is the physical address in your flash memory the kernel will
713 be linked for and stored to. This address is dependent on your
716 endmenu # "Boot options"
720 depends on OF && NONPORTABLE
721 default y if XIP_KERNEL
730 menu "Power management options"
732 source "kernel/power/Kconfig"
734 endmenu # "Power management options"
736 menu "CPU Power Management"
738 source "drivers/cpuidle/Kconfig"
740 source "drivers/cpufreq/Kconfig"
742 endmenu # "CPU Power Management"
744 source "arch/riscv/kvm/Kconfig"