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_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
28 select ARCH_HAS_MMIOWB
29 select ARCH_HAS_PMEM_API
30 select ARCH_HAS_PTE_SPECIAL
31 select ARCH_HAS_SET_DIRECT_MAP if MMU
32 select ARCH_HAS_SET_MEMORY if MMU
33 select ARCH_HAS_STRICT_KERNEL_RWX if MMU && !XIP_KERNEL
34 select ARCH_HAS_STRICT_MODULE_RWX if MMU && !XIP_KERNEL
35 select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
36 select ARCH_HAS_UBSAN_SANITIZE_ALL
37 select ARCH_OPTIONAL_KERNEL_RWX if ARCH_HAS_STRICT_KERNEL_RWX
38 select ARCH_OPTIONAL_KERNEL_RWX_DEFAULT
40 select ARCH_SUPPORTS_ATOMIC_RMW
41 select ARCH_SUPPORTS_DEBUG_PAGEALLOC if MMU
42 select ARCH_SUPPORTS_HUGETLBFS if MMU
43 select ARCH_SUPPORTS_PAGE_TABLE_CHECK if MMU
44 select ARCH_USE_MEMTEST
45 select ARCH_USE_QUEUED_RWLOCKS
46 select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU
47 select ARCH_WANT_FRAME_POINTERS
48 select ARCH_WANT_GENERAL_HUGETLB
49 select ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAP
50 select ARCH_WANT_HUGE_PMD_SHARE if 64BIT
51 select ARCH_WANT_LD_ORPHAN_WARN if !XIP_KERNEL
52 select ARCH_WANTS_THP_SWAP if HAVE_ARCH_TRANSPARENT_HUGEPAGE
53 select BINFMT_FLAT_NO_DATA_START_OFFSET if !MMU
54 select BUILDTIME_TABLE_SORT if MMU
55 select CLINT_TIMER if !MMU
56 select CLONE_BACKWARDS
58 select CPU_PM if CPU_IDLE
60 select GENERIC_ARCH_TOPOLOGY
61 select GENERIC_ATOMIC64 if !64BIT
62 select GENERIC_CLOCKEVENTS_BROADCAST if SMP
63 select GENERIC_EARLY_IOREMAP
64 select GENERIC_GETTIMEOFDAY if HAVE_GENERIC_VDSO
65 select GENERIC_IDLE_POLL_SETUP
66 select GENERIC_IOREMAP if MMU
67 select GENERIC_IRQ_MULTI_HANDLER
68 select GENERIC_IRQ_SHOW
69 select GENERIC_IRQ_SHOW_LEVEL
70 select GENERIC_LIB_DEVMEM_IS_ALLOWED
71 select GENERIC_PCI_IOMAP
72 select GENERIC_PTDUMP if MMU
73 select GENERIC_SCHED_CLOCK
74 select GENERIC_SMP_IDLE_THREAD
75 select GENERIC_TIME_VSYSCALL if MMU && 64BIT
76 select GENERIC_VDSO_TIME_NS if HAVE_GENERIC_VDSO
77 select HARDIRQS_SW_RESEND
78 select HAVE_ARCH_AUDITSYSCALL
79 select HAVE_ARCH_HUGE_VMALLOC if HAVE_ARCH_HUGE_VMAP
80 select HAVE_ARCH_HUGE_VMAP if MMU && 64BIT && !XIP_KERNEL
81 select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL
82 select HAVE_ARCH_JUMP_LABEL_RELATIVE if !XIP_KERNEL
83 select HAVE_ARCH_KASAN if MMU && 64BIT
84 select HAVE_ARCH_KASAN_VMALLOC if MMU && 64BIT
85 select HAVE_ARCH_KFENCE if MMU && 64BIT
86 select HAVE_ARCH_KGDB if !XIP_KERNEL
87 select HAVE_ARCH_KGDB_QXFER_PKT
88 select HAVE_ARCH_MMAP_RND_BITS if MMU
89 select HAVE_ARCH_MMAP_RND_COMPAT_BITS if COMPAT
90 select HAVE_ARCH_SECCOMP_FILTER
91 select HAVE_ARCH_THREAD_STRUCT_WHITELIST
92 select HAVE_ARCH_TRACEHOOK
93 select HAVE_ARCH_TRANSPARENT_HUGEPAGE if 64BIT && MMU
94 select HAVE_ARCH_VMAP_STACK if MMU && 64BIT
95 select HAVE_ASM_MODVERSIONS
96 select HAVE_CONTEXT_TRACKING_USER
97 select HAVE_DEBUG_KMEMLEAK
98 select HAVE_DMA_CONTIGUOUS if MMU
99 select HAVE_EBPF_JIT if MMU
100 select HAVE_FUNCTION_ARG_ACCESS_API
101 select HAVE_FUNCTION_ERROR_INJECTION
102 select HAVE_GCC_PLUGINS
103 select HAVE_GENERIC_VDSO if MMU && 64BIT
104 select HAVE_IRQ_TIME_ACCOUNTING
105 select HAVE_KPROBES if !XIP_KERNEL
106 select HAVE_KPROBES_ON_FTRACE if !XIP_KERNEL
107 select HAVE_KRETPROBES if !XIP_KERNEL
108 select HAVE_RETHOOK if !XIP_KERNEL
112 select HAVE_PERF_EVENTS
113 select HAVE_PERF_REGS
114 select HAVE_PERF_USER_STACK_DUMP
115 select HAVE_POSIX_CPU_TIMERS_TASK_WORK
116 select HAVE_REGS_AND_STACK_ACCESS_API
118 select HAVE_STACKPROTECTOR
119 select HAVE_SYSCALL_TRACEPOINTS
121 select IRQ_FORCED_THREADING
122 select MODULES_USE_ELF_RELA if MODULES
123 select MODULE_SECTIONS if MODULES
125 select OF_DMA_DEFAULT_COHERENT
126 select OF_EARLY_FLATTREE
128 select PCI_DOMAINS_GENERIC if PCI
129 select PCI_MSI if PCI
131 select RISCV_TIMER if RISCV_SBI
134 select SYSCTL_EXCEPTION_TRACE
135 select THREAD_INFO_IN_TASK
136 select TRACE_IRQFLAGS_SUPPORT
137 select UACCESS_MEMCPY if !MMU
138 select ZONE_DMA32 if 64BIT
139 select HAVE_DYNAMIC_FTRACE if !XIP_KERNEL && MMU && $(cc-option,-fpatchable-function-entry=8)
140 select HAVE_DYNAMIC_FTRACE_WITH_REGS if HAVE_DYNAMIC_FTRACE
141 select HAVE_FTRACE_MCOUNT_RECORD if !XIP_KERNEL
142 select HAVE_FUNCTION_GRAPH_TRACER
143 select HAVE_FUNCTION_TRACER if !XIP_KERNEL && !PREEMPTION
145 config ARCH_MMAP_RND_BITS_MIN
149 config ARCH_MMAP_RND_COMPAT_BITS_MIN
152 # max bits determined by the following formula:
153 # VA_BITS - PAGE_SHIFT - 3
154 config ARCH_MMAP_RND_BITS_MAX
155 default 24 if 64BIT # SV39 based
158 config ARCH_MMAP_RND_COMPAT_BITS_MAX
161 # set if we run in machine mode, cleared if we run in supervisor mode
166 # set if we are running in S-mode and can use SBI calls
169 depends on !RISCV_M_MODE
173 bool "MMU-based Paged Memory Management Support"
176 Select if you want MMU-based virtualised addressing space
177 support by paged memory management. If unsure, say 'Y'.
181 default 0xC0000000 if 32BIT
182 default 0x80000000 if 64BIT && !MMU
183 default 0xff60000000000000 if 64BIT
185 config KASAN_SHADOW_OFFSET
187 depends on KASAN_GENERIC
188 default 0xdfffffff00000000 if 64BIT
189 default 0xffffffff if 32BIT
191 config ARCH_FLATMEM_ENABLE
194 config ARCH_SPARSEMEM_ENABLE
197 select SPARSEMEM_STATIC if 32BIT && SPARSEMEM
198 select SPARSEMEM_VMEMMAP_ENABLE if 64BIT
200 config ARCH_SELECT_MEMORY_MODEL
201 def_bool ARCH_SPARSEMEM_ENABLE
203 config ARCH_SUPPORTS_UPROBES
206 config STACKTRACE_SUPPORT
212 select GENERIC_BUG_RELATIVE_POINTERS if 64BIT
214 config GENERIC_BUG_RELATIVE_POINTERS
217 config GENERIC_CALIBRATE_DELAY
223 config GENERIC_HWEIGHT
226 config FIX_EARLYCON_MEM
229 config PGTABLE_LEVELS
234 config LOCKDEP_SUPPORT
237 config RISCV_DMA_NONCOHERENT
239 select ARCH_HAS_DMA_PREP_COHERENT
240 select ARCH_HAS_SETUP_DMA_OPS
241 select ARCH_HAS_SYNC_DMA_FOR_CPU
242 select ARCH_HAS_SYNC_DMA_FOR_DEVICE
243 select DMA_DIRECT_REMAP
246 def_bool $(as-instr,.insn r 51$(comma) 0$(comma) 0$(comma) t0$(comma) t0$(comma) zero)
248 source "arch/riscv/Kconfig.socs"
249 source "arch/riscv/Kconfig.erratas"
254 bool "Allow configurations that result in non-portable kernels"
256 RISC-V kernel binaries are compatible between all known systems
257 whenever possible, but there are some use cases that can only be
258 satisfied by configurations that result in kernel binaries that are
259 not portable between systems.
261 Selecting N does not guarantee kernels will be portable to all known
262 systems. Selecting any of the options guarded by NONPORTABLE will
263 result in kernel binaries that are unlikely to be portable between
272 This selects the base ISA that this kernel will target and must match
277 depends on NONPORTABLE
279 select GENERIC_LIB_ASHLDI3
280 select GENERIC_LIB_ASHRDI3
281 select GENERIC_LIB_LSHRDI3
282 select GENERIC_LIB_UCMPDI2
288 select ARCH_SUPPORTS_INT128 if CC_HAS_INT128
289 select SWIOTLB if MMU
293 # We must be able to map all physical memory into the kernel, but the compiler
294 # is still a bit more efficient when generating code if it's setup in a manner
295 # such that it can only map 2GiB of memory.
297 prompt "Kernel Code Model"
298 default CMODEL_MEDLOW if 32BIT
299 default CMODEL_MEDANY if 64BIT
302 bool "medium low code model"
304 bool "medium any code model"
307 config MODULE_SECTIONS
309 select HAVE_MOD_ARCH_SPECIFIC
312 bool "Symmetric Multi-Processing"
314 This enables support for systems with more than one CPU. If
315 you say N here, the kernel will run on single and
316 multiprocessor machines, but will use only one CPU of a
317 multiprocessor machine. If you say Y here, the kernel will run
318 on many, but not all, single processor machines. On a single
319 processor machine, the kernel will run faster if you say N
322 If you don't know what to do here, say N.
325 int "Maximum number of CPUs (2-512)"
327 range 2 512 if !RISCV_SBI_V01
328 range 2 32 if RISCV_SBI_V01 && 32BIT
329 range 2 64 if RISCV_SBI_V01 && 64BIT
330 default "32" if 32BIT
331 default "64" if 64BIT
334 bool "Support for hot-pluggable CPUs"
336 select GENERIC_IRQ_MIGRATION
339 Say Y here to experiment with turning CPUs off and on. CPUs
340 can be controlled through /sys/devices/system/cpu.
342 Say N if you want to disable CPU hotplug.
353 # Common NUMA Features
355 bool "NUMA Memory Allocation and Scheduler Support"
356 depends on SMP && MMU
357 select ARCH_SUPPORTS_NUMA_BALANCING
358 select GENERIC_ARCH_NUMA
359 select NEED_PER_CPU_EMBED_FIRST_CHUNK
361 select USE_PERCPU_NUMA_NODE_ID
363 Enable NUMA (Non-Uniform Memory Access) support.
365 The kernel will try to allocate memory used by a CPU on the
366 local memory of the CPU and add some more NUMA awareness to the kernel.
369 int "Maximum NUMA Nodes (as a power of 2)"
374 Specify the maximum number of NUMA Nodes available on the target
375 system. Increases memory reserved to accommodate various tables.
377 config RISCV_ALTERNATIVE
379 depends on !XIP_KERNEL
381 This Kconfig allows the kernel to automatically patch the
382 errata required by the execution platform at run time. The
383 code patching is performed once in the boot stages. It means
384 that the overhead from this mechanism is just taken once.
386 config RISCV_ALTERNATIVE_EARLY
388 depends on RISCV_ALTERNATIVE
390 Allows early patching of the kernel for special errata
393 bool "Emit compressed instructions when building Linux"
396 Adds "C" to the ISA subsets that the toolchain is allowed to emit
397 when building Linux, which results in compressed instructions in the
400 If you don't know what to do here, say Y.
402 config RISCV_ISA_SVPBMT
403 bool "SVPBMT extension support"
404 depends on 64BIT && MMU
405 depends on !XIP_KERNEL
407 select RISCV_ALTERNATIVE
409 Adds support to dynamically detect the presence of the SVPBMT
410 ISA-extension (Supervisor-mode: page-based memory types) and
413 The memory type for a page contains a combination of attributes
414 that indicate the cacheability, idempotency, and ordering
415 properties for access to that page.
417 The SVPBMT extension is only available on 64Bit cpus.
419 If you don't know what to do here, say Y.
421 config TOOLCHAIN_HAS_ZBB
424 depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64ima_zbb)
425 depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32ima_zbb)
426 depends on LLD_VERSION >= 150000 || LD_VERSION >= 23900
430 bool "Zbb extension support for bit manipulation instructions"
431 depends on TOOLCHAIN_HAS_ZBB
432 depends on !XIP_KERNEL && MMU
433 select RISCV_ALTERNATIVE
436 Adds support to dynamically detect the presence of the ZBB
437 extension (basic bit manipulation) and enable its usage.
439 The Zbb extension provides instructions to accelerate a number
440 of bit-specific operations (count bit population, sign extending,
443 If you don't know what to do here, say Y.
445 config RISCV_ISA_ZICBOM
446 bool "Zicbom extension support for non-coherent DMA operation"
447 depends on !XIP_KERNEL && MMU
449 select RISCV_ALTERNATIVE
450 select RISCV_DMA_NONCOHERENT
452 Adds support to dynamically detect the presence of the ZICBOM
453 extension (Cache Block Management Operations) and enable its
456 The Zicbom extension can be used to handle for example
457 non-coherent DMA support on devices that need it.
459 If you don't know what to do here, say Y.
461 config TOOLCHAIN_HAS_ZIHINTPAUSE
464 depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64ima_zihintpause)
465 depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32ima_zihintpause)
466 depends on LLD_VERSION >= 150000 || LD_VERSION >= 23600
472 Say N here if you want to disable all floating-point related procedure
475 If you don't know what to do here, say Y.
477 endmenu # "Platform type"
479 menu "Kernel features"
481 source "kernel/Kconfig.hz"
484 bool "SBI v0.1 support"
487 This config allows kernel to use SBI v0.1 APIs. This will be
488 deprecated in future once legacy M-mode software are no longer in use.
490 config RISCV_BOOT_SPINWAIT
491 bool "Spinwait booting method"
493 default y if RISCV_SBI_V01 || RISCV_M_MODE
495 This enables support for booting Linux via spinwait method. In the
496 spinwait method, all cores randomly jump to Linux. One of the cores
497 gets chosen via lottery and all other keep spinning on a percpu
498 variable. This method cannot support CPU hotplug and sparse hartid
499 scheme. It should be only enabled for M-mode Linux or platforms relying
500 on older firmware without SBI HSM extension. All other platforms should
501 rely on ordered booting via SBI HSM extension which gets chosen
502 dynamically at runtime if the firmware supports it.
504 Since spinwait is incompatible with sparse hart IDs, it requires
505 NR_CPUS be large enough to contain the physical hart ID of the first
508 If unsure what to do here, say N.
511 bool "Kexec system call"
513 select HOTPLUG_CPU if SMP
516 kexec is a system call that implements the ability to shutdown your
517 current kernel, and to start another kernel. It is like a reboot
518 but it is independent of the system firmware. And like a reboot
519 you can start any kernel with it, not just Linux.
521 The name comes from the similarity to the exec system call.
524 bool "kexec file based systmem call"
525 depends on 64BIT && MMU
526 select HAVE_IMA_KEXEC if IMA
530 This is new version of kexec system call. This system call is
531 file based and takes file descriptors as system call argument
532 for kernel and initramfs as opposed to list of segments as
533 accepted by previous system call.
535 If you don't know what to do here, say Y.
537 config ARCH_HAS_KEXEC_PURGATORY
540 depends on CRYPTO_SHA256=y
543 bool "Build kdump crash kernel"
545 Generate crash dump after being started by kexec. This should
546 be normally only set in special crash dump kernels which are
547 loaded in the main kernel with kexec-tools into a specially
548 reserved region and then later executed after a crash by
551 For more details see Documentation/admin-guide/kdump/kdump.rst
554 bool "Kernel support for 32-bit U-mode"
556 depends on 64BIT && MMU
558 This option enables support for a 32-bit U-mode running under a 64-bit
559 kernel at S-mode. riscv32-specific components such as system calls,
560 the user helper functions (vdso), signal rt_frame functions and the
561 ptrace interface are handled appropriately by the kernel.
563 If you want to execute 32-bit userspace applications, say Y.
565 endmenu # "Kernel features"
570 string "Built-in kernel command line"
572 For most platforms, the arguments for the kernel's command line
573 are provided at run-time, during boot. However, there are cases
574 where either no arguments are being provided or the provided
575 arguments are insufficient or even invalid.
577 When that occurs, it is possible to define a built-in command
578 line here and choose how the kernel should use it later on.
581 prompt "Built-in command line usage" if CMDLINE != ""
582 default CMDLINE_FALLBACK
584 Choose how the kernel will handle the provided built-in command
587 config CMDLINE_FALLBACK
588 bool "Use bootloader kernel arguments if available"
590 Use the built-in command line as fallback in case we get nothing
591 during boot. This is the default behaviour.
593 config CMDLINE_EXTEND
594 bool "Extend bootloader kernel arguments"
596 The command-line arguments provided during boot will be
597 appended to the built-in command line. This is useful in
598 cases where the provided arguments are insufficient and
599 you don't want to or cannot modify them.
602 bool "Always use the default kernel command string"
604 Always use the built-in command line, even if we get one during
605 boot. This is useful in case you need to override the provided
606 command line on systems where you don't have or want control
615 bool "UEFI runtime support"
616 depends on OF && !XIP_KERNEL
619 select EFI_GENERIC_STUB
620 select EFI_PARAMS_FROM_FDT
621 select EFI_RUNTIME_WRAPPERS
627 This option provides support for runtime services provided
628 by UEFI firmware (such as non-volatile variables, realtime
629 clock, and platform reset). A UEFI stub is also provided to
630 allow the kernel to be booted as an EFI application. This
631 is only useful on systems that have UEFI firmware.
633 config CC_HAVE_STACKPROTECTOR_TLS
634 def_bool $(cc-option,-mstack-protector-guard=tls -mstack-protector-guard-reg=tp -mstack-protector-guard-offset=0)
636 config STACKPROTECTOR_PER_TASK
638 depends on !RANDSTRUCT
639 depends on STACKPROTECTOR && CC_HAVE_STACKPROTECTOR_TLS
641 config PHYS_RAM_BASE_FIXED
642 bool "Explicitly specified physical RAM address"
643 depends on NONPORTABLE
647 hex "Platform Physical RAM address"
648 depends on PHYS_RAM_BASE_FIXED
651 This is the physical address of RAM in the system. It has to be
652 explicitly specified to run early relocations of read-write data
656 bool "Kernel Execute-In-Place from ROM"
657 depends on MMU && SPARSEMEM && NONPORTABLE
658 # This prevents XIP from being enabled by all{yes,mod}config, which
659 # fail to build since XIP doesn't support large kernels.
660 depends on !COMPILE_TEST
661 select PHYS_RAM_BASE_FIXED
663 Execute-In-Place allows the kernel to run from non-volatile storage
664 directly addressable by the CPU, such as NOR flash. This saves RAM
665 space since the text section of the kernel is not loaded from flash
666 to RAM. Read-write sections, such as the data section and stack,
667 are still copied to RAM. The XIP kernel is not compressed since
668 it has to run directly from flash, so it will take more space to
669 store it. The flash address used to link the kernel object files,
670 and for storing it, is configuration dependent. Therefore, if you
671 say Y here, you must know the proper physical address where to
672 store the kernel image depending on your own flash memory usage.
674 Also note that the make target becomes "make xipImage" rather than
675 "make zImage" or "make Image". The final kernel binary to put in
676 ROM memory will be arch/riscv/boot/xipImage.
678 SPARSEMEM is required because the kernel text and rodata that are
679 flash resident are not backed by memmap, then any attempt to get
680 a struct page on those regions will trigger a fault.
685 hex "XIP Kernel Physical Location"
686 depends on XIP_KERNEL
689 This is the physical address in your flash memory the kernel will
690 be linked for and stored to. This address is dependent on your
693 endmenu # "Boot options"
697 depends on OF && NONPORTABLE
698 default y if XIP_KERNEL
707 menu "Power management options"
709 source "kernel/power/Kconfig"
711 endmenu # "Power management options"
713 menu "CPU Power Management"
715 source "drivers/cpuidle/Kconfig"
717 source "drivers/cpufreq/Kconfig"
719 endmenu # "CPU Power Management"
721 source "arch/riscv/kvm/Kconfig"