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 ACPI_GENERIC_GSI if ACPI
16 select ACPI_REDUCED_HARDWARE_ONLY if ACPI
17 select ARCH_DMA_DEFAULT_COHERENT
18 select ARCH_ENABLE_HUGEPAGE_MIGRATION if HUGETLB_PAGE && MIGRATION
19 select ARCH_ENABLE_SPLIT_PMD_PTLOCK if PGTABLE_LEVELS > 2
20 select ARCH_ENABLE_THP_MIGRATION if TRANSPARENT_HUGEPAGE
21 select ARCH_HAS_BINFMT_FLAT
22 select ARCH_HAS_CURRENT_STACK_POINTER
23 select ARCH_HAS_DEBUG_VIRTUAL if MMU
24 select ARCH_HAS_DEBUG_VM_PGTABLE
25 select ARCH_HAS_DEBUG_WX
26 select ARCH_HAS_FORTIFY_SOURCE
27 select ARCH_HAS_GCOV_PROFILE_ALL
28 select ARCH_HAS_GIGANTIC_PAGE
30 select ARCH_HAS_MMIOWB
31 select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
32 select ARCH_HAS_PMEM_API
33 select ARCH_HAS_PTE_SPECIAL
34 select ARCH_HAS_SET_DIRECT_MAP if MMU
35 select ARCH_HAS_SET_MEMORY if MMU
36 select ARCH_HAS_STRICT_KERNEL_RWX if MMU && !XIP_KERNEL
37 select ARCH_HAS_STRICT_MODULE_RWX if MMU && !XIP_KERNEL
38 select ARCH_HAS_SYSCALL_WRAPPER
39 select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
41 select ARCH_HAS_VDSO_DATA
42 select ARCH_KEEP_MEMBLOCK if ACPI
43 select ARCH_OPTIONAL_KERNEL_RWX if ARCH_HAS_STRICT_KERNEL_RWX
44 select ARCH_OPTIONAL_KERNEL_RWX_DEFAULT
46 select ARCH_SUPPORTS_ATOMIC_RMW
47 select ARCH_SUPPORTS_CFI_CLANG
48 select ARCH_SUPPORTS_DEBUG_PAGEALLOC if MMU
49 select ARCH_SUPPORTS_HUGETLBFS if MMU
50 select ARCH_SUPPORTS_PAGE_TABLE_CHECK if MMU
51 select ARCH_SUPPORTS_PER_VMA_LOCK if MMU
52 select ARCH_SUPPORTS_SHADOW_CALL_STACK if HAVE_SHADOW_CALL_STACK
53 select ARCH_USE_MEMTEST
54 select ARCH_USE_QUEUED_RWLOCKS
55 select ARCH_USES_CFI_TRAPS if CFI_CLANG
56 select ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH if SMP && MMU
57 select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU
58 select ARCH_WANT_FRAME_POINTERS
59 select ARCH_WANT_GENERAL_HUGETLB if !RISCV_ISA_SVNAPOT
60 select ARCH_WANT_HUGE_PMD_SHARE if 64BIT
61 select ARCH_WANT_LD_ORPHAN_WARN if !XIP_KERNEL
62 select ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP
63 select ARCH_WANTS_NO_INSTR
64 select ARCH_WANTS_THP_SWAP if HAVE_ARCH_TRANSPARENT_HUGEPAGE
65 select BINFMT_FLAT_NO_DATA_START_OFFSET if !MMU
66 select BUILDTIME_TABLE_SORT if MMU
67 select CLINT_TIMER if !MMU
68 select CLONE_BACKWARDS
70 select CPU_PM if CPU_IDLE || HIBERNATION || SUSPEND
72 select FRAME_POINTER if PERF_EVENTS || (FUNCTION_TRACER && !DYNAMIC_FTRACE)
73 select FTRACE_MCOUNT_USE_PATCHABLE_FUNCTION_ENTRY if DYNAMIC_FTRACE
74 select GENERIC_ARCH_TOPOLOGY
75 select GENERIC_ATOMIC64 if !64BIT
76 select GENERIC_CLOCKEVENTS_BROADCAST if SMP
77 select GENERIC_CPU_DEVICES
78 select GENERIC_EARLY_IOREMAP
80 select GENERIC_GETTIMEOFDAY if HAVE_GENERIC_VDSO
81 select GENERIC_IDLE_POLL_SETUP
82 select GENERIC_IOREMAP if MMU
83 select GENERIC_IRQ_IPI if SMP
84 select GENERIC_IRQ_IPI_MUX if SMP
85 select GENERIC_IRQ_MULTI_HANDLER
86 select GENERIC_IRQ_SHOW
87 select GENERIC_IRQ_SHOW_LEVEL
88 select GENERIC_LIB_DEVMEM_IS_ALLOWED
89 select GENERIC_PCI_IOMAP
90 select GENERIC_PTDUMP if MMU
91 select GENERIC_SCHED_CLOCK
92 select GENERIC_SMP_IDLE_THREAD
93 select GENERIC_TIME_VSYSCALL if MMU && 64BIT
94 select GENERIC_VDSO_TIME_NS if HAVE_GENERIC_VDSO
95 select HARDIRQS_SW_RESEND
96 select HAS_IOPORT if MMU
97 select HAVE_ARCH_AUDITSYSCALL
98 select HAVE_ARCH_HUGE_VMALLOC if HAVE_ARCH_HUGE_VMAP
99 select HAVE_ARCH_HUGE_VMAP if MMU && 64BIT && !XIP_KERNEL
100 select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL
101 select HAVE_ARCH_JUMP_LABEL_RELATIVE if !XIP_KERNEL
102 select HAVE_ARCH_KASAN if MMU && 64BIT
103 select HAVE_ARCH_KASAN_VMALLOC if MMU && 64BIT
104 select HAVE_ARCH_KFENCE if MMU && 64BIT
105 select HAVE_ARCH_KGDB if !XIP_KERNEL
106 select HAVE_ARCH_KGDB_QXFER_PKT
107 select HAVE_ARCH_MMAP_RND_BITS if MMU
108 select HAVE_ARCH_MMAP_RND_COMPAT_BITS if COMPAT
109 select HAVE_ARCH_SECCOMP_FILTER
110 select HAVE_ARCH_THREAD_STRUCT_WHITELIST
111 select HAVE_ARCH_TRACEHOOK
112 select HAVE_ARCH_TRANSPARENT_HUGEPAGE if 64BIT && MMU
113 select HAVE_ARCH_USERFAULTFD_MINOR if 64BIT && USERFAULTFD
114 select HAVE_ARCH_VMAP_STACK if MMU && 64BIT
115 select HAVE_ASM_MODVERSIONS
116 select HAVE_CONTEXT_TRACKING_USER
117 select HAVE_DEBUG_KMEMLEAK
118 select HAVE_DMA_CONTIGUOUS if MMU
119 select HAVE_DYNAMIC_FTRACE if !XIP_KERNEL && MMU && (CLANG_SUPPORTS_DYNAMIC_FTRACE || GCC_SUPPORTS_DYNAMIC_FTRACE)
120 select HAVE_DYNAMIC_FTRACE_WITH_DIRECT_CALLS
121 select HAVE_DYNAMIC_FTRACE_WITH_REGS if HAVE_DYNAMIC_FTRACE
122 select HAVE_FTRACE_MCOUNT_RECORD if !XIP_KERNEL
123 select HAVE_FUNCTION_GRAPH_TRACER
124 select HAVE_FUNCTION_GRAPH_RETVAL if HAVE_FUNCTION_GRAPH_TRACER
125 select HAVE_FUNCTION_TRACER if !XIP_KERNEL && !PREEMPTION
126 select HAVE_EBPF_JIT if MMU
127 select HAVE_FUNCTION_ARG_ACCESS_API
128 select HAVE_FUNCTION_ERROR_INJECTION
129 select HAVE_GCC_PLUGINS
130 select HAVE_GENERIC_VDSO if MMU && 64BIT
131 select HAVE_IRQ_TIME_ACCOUNTING
132 select HAVE_KPROBES if !XIP_KERNEL
133 select HAVE_KPROBES_ON_FTRACE if !XIP_KERNEL
134 select HAVE_KRETPROBES if !XIP_KERNEL
135 # https://github.com/ClangBuiltLinux/linux/issues/1881
136 select HAVE_LD_DEAD_CODE_DATA_ELIMINATION if !LD_IS_LLD
139 select HAVE_PAGE_SIZE_4KB
141 select HAVE_PERF_EVENTS
142 select HAVE_PERF_REGS
143 select HAVE_PERF_USER_STACK_DUMP
144 select HAVE_POSIX_CPU_TIMERS_TASK_WORK
145 select HAVE_PREEMPT_DYNAMIC_KEY if !XIP_KERNEL
146 select HAVE_REGS_AND_STACK_ACCESS_API
147 select HAVE_RETHOOK if !XIP_KERNEL
149 select HAVE_SAMPLE_FTRACE_DIRECT
150 select HAVE_SAMPLE_FTRACE_DIRECT_MULTI
151 select HAVE_STACKPROTECTOR
152 select HAVE_SYSCALL_TRACEPOINTS
153 select HOTPLUG_CORE_SYNC_DEAD if HOTPLUG_CPU
155 select IRQ_FORCED_THREADING
156 select KASAN_VMALLOC if KASAN
157 select LOCK_MM_AND_FIND_VMA
158 select MODULES_USE_ELF_RELA if MODULES
159 select MODULE_SECTIONS if MODULES
161 select OF_EARLY_FLATTREE
163 select PCI_DOMAINS_GENERIC if PCI
164 select PCI_MSI if PCI
165 select RISCV_ALTERNATIVE if !XIP_KERNEL
167 select RISCV_TIMER if RISCV_SBI
170 select SYSCTL_EXCEPTION_TRACE
171 select THREAD_INFO_IN_TASK
172 select TRACE_IRQFLAGS_SUPPORT
173 select UACCESS_MEMCPY if !MMU
174 select ZONE_DMA32 if 64BIT
176 config CLANG_SUPPORTS_DYNAMIC_FTRACE
178 # https://github.com/ClangBuiltLinux/linux/issues/1817
179 depends on AS_IS_GNU || (AS_IS_LLVM && (LD_IS_LLD || LD_VERSION >= 23600))
181 config GCC_SUPPORTS_DYNAMIC_FTRACE
183 depends on $(cc-option,-fpatchable-function-entry=8)
185 config HAVE_SHADOW_CALL_STACK
186 def_bool $(cc-option,-fsanitize=shadow-call-stack)
187 # https://github.com/riscv-non-isa/riscv-elf-psabi-doc/commit/a484e843e6eeb51f0cb7b8819e50da6d2444d769
188 depends on $(ld-option,--no-relax-gp)
190 config RISCV_USE_LINKER_RELAXATION
192 # https://github.com/llvm/llvm-project/commit/6611d58f5bbcbec77262d392e2923e1d680f6985
193 depends on !LD_IS_LLD || LLD_VERSION >= 150000
195 # https://github.com/llvm/llvm-project/commit/bbc0f99f3bc96f1db16f649fc21dd18e5b0918f6
196 config ARCH_HAS_BROKEN_DWARF5
198 depends on RISCV_USE_LINKER_RELAXATION
199 # https://github.com/llvm/llvm-project/commit/1df5ea29b43690b6622db2cad7b745607ca4de6a
200 depends on AS_IS_LLVM && AS_VERSION < 180000
201 # https://github.com/llvm/llvm-project/commit/7ffabb61a5569444b5ac9322e22e5471cc5e4a77
202 depends on LD_IS_LLD && LLD_VERSION < 180000
204 config ARCH_MMAP_RND_BITS_MIN
208 config ARCH_MMAP_RND_COMPAT_BITS_MIN
211 # max bits determined by the following formula:
212 # VA_BITS - PAGE_SHIFT - 3
213 config ARCH_MMAP_RND_BITS_MAX
214 default 24 if 64BIT # SV39 based
217 config ARCH_MMAP_RND_COMPAT_BITS_MAX
220 # set if we run in machine mode, cleared if we run in supervisor mode
225 # set if we are running in S-mode and can use SBI calls
228 depends on !RISCV_M_MODE
232 bool "MMU-based Paged Memory Management Support"
235 Select if you want MMU-based virtualised addressing space
236 support by paged memory management. If unsure, say 'Y'.
240 default 0xC0000000 if 32BIT && MMU
241 default 0x80000000 if !MMU
242 default 0xff60000000000000 if 64BIT
244 config KASAN_SHADOW_OFFSET
246 depends on KASAN_GENERIC
247 default 0xdfffffff00000000 if 64BIT
248 default 0xffffffff if 32BIT
250 config ARCH_FLATMEM_ENABLE
253 config ARCH_SPARSEMEM_ENABLE
256 select SPARSEMEM_STATIC if 32BIT && SPARSEMEM
257 select SPARSEMEM_VMEMMAP_ENABLE if 64BIT
259 config ARCH_SELECT_MEMORY_MODEL
260 def_bool ARCH_SPARSEMEM_ENABLE
262 config ARCH_SUPPORTS_UPROBES
265 config STACKTRACE_SUPPORT
271 select GENERIC_BUG_RELATIVE_POINTERS if 64BIT
273 config GENERIC_BUG_RELATIVE_POINTERS
276 config GENERIC_CALIBRATE_DELAY
282 config GENERIC_HWEIGHT
285 config FIX_EARLYCON_MEM
288 config PGTABLE_LEVELS
293 config LOCKDEP_SUPPORT
296 config RISCV_DMA_NONCOHERENT
298 select ARCH_HAS_DMA_PREP_COHERENT
299 select ARCH_HAS_SETUP_DMA_OPS
300 select ARCH_HAS_SYNC_DMA_FOR_CPU
301 select ARCH_HAS_SYNC_DMA_FOR_DEVICE
302 select DMA_BOUNCE_UNALIGNED_KMALLOC if SWIOTLB
304 config RISCV_NONSTANDARD_CACHE_OPS
307 This enables function pointer support for non-standard noncoherent
308 systems to handle cache management.
311 def_bool $(as-instr,.insn r 51$(comma) 0$(comma) 0$(comma) t0$(comma) t0$(comma) zero)
313 config AS_HAS_OPTION_ARCH
314 # https://github.com/llvm/llvm-project/commit/9e8ed3403c191ab9c4903e8eeb8f732ff8a43cb4
316 depends on $(as-instr, .option arch$(comma) +m)
318 source "arch/riscv/Kconfig.socs"
319 source "arch/riscv/Kconfig.errata"
324 bool "Allow configurations that result in non-portable kernels"
326 RISC-V kernel binaries are compatible between all known systems
327 whenever possible, but there are some use cases that can only be
328 satisfied by configurations that result in kernel binaries that are
329 not portable between systems.
331 Selecting N does not guarantee kernels will be portable to all known
332 systems. Selecting any of the options guarded by NONPORTABLE will
333 result in kernel binaries that are unlikely to be portable between
342 This selects the base ISA that this kernel will target and must match
347 depends on NONPORTABLE
349 select GENERIC_LIB_ASHLDI3
350 select GENERIC_LIB_ASHRDI3
351 select GENERIC_LIB_LSHRDI3
352 select GENERIC_LIB_UCMPDI2
357 select ARCH_SUPPORTS_INT128 if CC_HAS_INT128
358 select SWIOTLB if MMU
362 # We must be able to map all physical memory into the kernel, but the compiler
363 # is still a bit more efficient when generating code if it's setup in a manner
364 # such that it can only map 2GiB of memory.
366 prompt "Kernel Code Model"
367 default CMODEL_MEDLOW if 32BIT
368 default CMODEL_MEDANY if 64BIT
371 bool "medium low code model"
373 bool "medium any code model"
376 config MODULE_SECTIONS
378 select HAVE_MOD_ARCH_SPECIFIC
381 bool "Symmetric Multi-Processing"
383 This enables support for systems with more than one CPU. If
384 you say N here, the kernel will run on single and
385 multiprocessor machines, but will use only one CPU of a
386 multiprocessor machine. If you say Y here, the kernel will run
387 on many, but not all, single processor machines. On a single
388 processor machine, the kernel will run faster if you say N
391 If you don't know what to do here, say N.
394 bool "Multi-core scheduler support"
397 Multi-core scheduler support improves the CPU scheduler's decision
398 making when dealing with multi-core CPU chips at a cost of slightly
399 increased overhead in some places. If unsure say N here.
402 int "Maximum number of CPUs (2-512)"
404 range 2 512 if !RISCV_SBI_V01
405 range 2 32 if RISCV_SBI_V01 && 32BIT
406 range 2 64 if RISCV_SBI_V01 && 64BIT
407 default "32" if 32BIT
408 default "64" if 64BIT
411 bool "Support for hot-pluggable CPUs"
413 select GENERIC_IRQ_MIGRATION
416 Say Y here to experiment with turning CPUs off and on. CPUs
417 can be controlled through /sys/devices/system/cpu.
419 Say N if you want to disable CPU hotplug.
430 # Common NUMA Features
432 bool "NUMA Memory Allocation and Scheduler Support"
433 depends on SMP && MMU
434 select ARCH_SUPPORTS_NUMA_BALANCING
435 select GENERIC_ARCH_NUMA
436 select HAVE_SETUP_PER_CPU_AREA
437 select NEED_PER_CPU_EMBED_FIRST_CHUNK
438 select NEED_PER_CPU_PAGE_FIRST_CHUNK
440 select USE_PERCPU_NUMA_NODE_ID
442 Enable NUMA (Non-Uniform Memory Access) support.
444 The kernel will try to allocate memory used by a CPU on the
445 local memory of the CPU and add some more NUMA awareness to the kernel.
448 int "Maximum NUMA Nodes (as a power of 2)"
453 Specify the maximum number of NUMA Nodes available on the target
454 system. Increases memory reserved to accommodate various tables.
456 config RISCV_ALTERNATIVE
458 depends on !XIP_KERNEL
460 This Kconfig allows the kernel to automatically patch the
461 erratum or cpufeature required by the execution platform at run
462 time. The code patching overhead is minimal, as it's only done
463 once at boot and once on each module load.
465 config RISCV_ALTERNATIVE_EARLY
467 depends on RISCV_ALTERNATIVE
469 Allows early patching of the kernel for special errata
472 bool "Emit compressed instructions when building Linux"
475 Adds "C" to the ISA subsets that the toolchain is allowed to emit
476 when building Linux, which results in compressed instructions in the
479 If you don't know what to do here, say Y.
481 config RISCV_ISA_SVNAPOT
482 bool "Svnapot extension support for supervisor mode NAPOT pages"
483 depends on 64BIT && MMU
484 depends on RISCV_ALTERNATIVE
487 Allow kernel to detect the Svnapot ISA-extension dynamically at boot
488 time and enable its usage.
490 The Svnapot extension is used to mark contiguous PTEs as a range
491 of contiguous virtual-to-physical translations for a naturally
492 aligned power-of-2 (NAPOT) granularity larger than the base 4KB page
493 size. When HUGETLBFS is also selected this option unconditionally
494 allocates some memory for each NAPOT page size supported by the kernel.
495 When optimizing for low memory consumption and for platforms without
496 the Svnapot extension, it may be better to say N here.
498 If you don't know what to do here, say Y.
500 config RISCV_ISA_SVPBMT
501 bool "Svpbmt extension support for supervisor mode page-based memory types"
502 depends on 64BIT && MMU
503 depends on RISCV_ALTERNATIVE
506 Adds support to dynamically detect the presence of the Svpbmt
507 ISA-extension (Supervisor-mode: page-based memory types) and
510 The memory type for a page contains a combination of attributes
511 that indicate the cacheability, idempotency, and ordering
512 properties for access to that page.
514 The Svpbmt extension is only available on 64-bit cpus.
516 If you don't know what to do here, say Y.
518 config TOOLCHAIN_HAS_V
521 depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64iv)
522 depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32iv)
523 depends on LLD_VERSION >= 140000 || LD_VERSION >= 23800
524 depends on AS_HAS_OPTION_ARCH
527 bool "VECTOR extension support"
528 depends on TOOLCHAIN_HAS_V
530 select DYNAMIC_SIGFRAME
533 Say N here if you want to disable all vector related procedure
536 If you don't know what to do here, say Y.
538 config RISCV_ISA_V_DEFAULT_ENABLE
539 bool "Enable userspace Vector by default"
540 depends on RISCV_ISA_V
543 Say Y here if you want to enable Vector in userspace by default.
544 Otherwise, userspace has to make explicit prctl() call to enable
545 Vector, or enable it via the sysctl interface.
547 If you don't know what to do here, say Y.
549 config RISCV_ISA_V_UCOPY_THRESHOLD
550 int "Threshold size for vectorized user copies"
551 depends on RISCV_ISA_V
554 Prefer using vectorized copy_to_user()/copy_from_user() when the
555 workload size exceeds this value.
557 config RISCV_ISA_V_PREEMPTIVE
558 bool "Run kernel-mode Vector with kernel preemption"
559 depends on PREEMPTION
560 depends on RISCV_ISA_V
563 Usually, in-kernel SIMD routines are run with preemption disabled.
564 Functions which envoke long running SIMD thus must yield core's
565 vector unit to prevent blocking other tasks for too long.
567 This config allows kernel to run SIMD without explicitly disable
568 preemption. Enabling this config will result in higher memory
569 consumption due to the allocation of per-task's kernel Vector context.
571 config TOOLCHAIN_HAS_ZBB
574 depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64ima_zbb)
575 depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32ima_zbb)
576 depends on LLD_VERSION >= 150000 || LD_VERSION >= 23900
577 depends on AS_HAS_OPTION_ARCH
580 bool "Zbb extension support for bit manipulation instructions"
581 depends on TOOLCHAIN_HAS_ZBB
583 depends on RISCV_ALTERNATIVE
586 Adds support to dynamically detect the presence of the ZBB
587 extension (basic bit manipulation) and enable its usage.
589 The Zbb extension provides instructions to accelerate a number
590 of bit-specific operations (count bit population, sign extending,
593 If you don't know what to do here, say Y.
595 config RISCV_ISA_ZICBOM
596 bool "Zicbom extension support for non-coherent DMA operation"
598 depends on RISCV_ALTERNATIVE
600 select RISCV_DMA_NONCOHERENT
601 select DMA_DIRECT_REMAP
603 Adds support to dynamically detect the presence of the ZICBOM
604 extension (Cache Block Management Operations) and enable its
607 The Zicbom extension can be used to handle for example
608 non-coherent DMA support on devices that need it.
610 If you don't know what to do here, say Y.
612 config RISCV_ISA_ZICBOZ
613 bool "Zicboz extension support for faster zeroing of memory"
615 depends on RISCV_ALTERNATIVE
618 Enable the use of the Zicboz extension (cbo.zero instruction)
621 The Zicboz extension is used for faster zeroing of memory.
623 If you don't know what to do here, say Y.
625 config TOOLCHAIN_HAS_ZIHINTPAUSE
628 depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64ima_zihintpause)
629 depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32ima_zihintpause)
630 depends on LLD_VERSION >= 150000 || LD_VERSION >= 23600
632 config TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI
634 # https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=aed44286efa8ae8717a77d94b51ac3614e2ca6dc
635 # https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=98416dbb0a62579d4a7a4a76bab51b5b52fec2cd
636 depends on AS_IS_GNU && AS_VERSION >= 23600
638 Binutils-2.38 and GCC-12.1.0 bumped the default ISA spec to the newer
639 20191213 version, which moves some instructions from the I extension to
640 the Zicsr and Zifencei extensions. This requires explicitly specifying
641 Zicsr and Zifencei when binutils >= 2.38 or GCC >= 12.1.0. Zicsr
642 and Zifencei are supported in binutils from version 2.36 onwards.
643 To make life easier, and avoid forcing toolchains that default to a
644 newer ISA spec to version 2.2, relax the check to binutils >= 2.36.
645 For clang < 17 or GCC < 11.3.0, for which this is not possible or need
646 special treatment, this is dealt with in TOOLCHAIN_NEEDS_OLD_ISA_SPEC.
648 config TOOLCHAIN_NEEDS_OLD_ISA_SPEC
650 depends on TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI
651 # https://github.com/llvm/llvm-project/commit/22e199e6afb1263c943c0c0d4498694e15bf8a16
652 # https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=d29f5d6ab513c52fd872f532c492e35ae9fd6671
653 depends on (CC_IS_CLANG && CLANG_VERSION < 170000) || (CC_IS_GCC && GCC_VERSION < 110300)
655 Certain versions of clang and GCC do not support zicsr and zifencei via
656 -march. This option causes an older ISA spec compatible with these older
657 versions of clang and GCC to be passed to GAS, which has the same result
658 as passing zicsr and zifencei to -march.
664 Say N here if you want to disable all floating-point related procedure
667 If you don't know what to do here, say Y.
670 bool "Independent irq & softirq stacks" if EXPERT
672 select HAVE_IRQ_EXIT_ON_IRQ_STACK
673 select HAVE_SOFTIRQ_ON_OWN_STACK
675 Add independent irq & softirq stacks for percpu to prevent kernel stack
676 overflows. We may save some memory footprint by disabling IRQ_STACKS.
678 config THREAD_SIZE_ORDER
679 int "Kernel stack size (in power-of-two numbers of page size)" if VMAP_STACK && EXPERT
681 default 1 if 32BIT && !KASAN
682 default 3 if 64BIT && KASAN
685 Specify the Pages of thread stack size (from 4KB to 64KB), which also
686 affects irq stack size, which is equal to thread stack size.
688 config RISCV_MISALIGNED
689 bool "Support misaligned load/store traps for kernel and userspace"
690 select SYSCTL_ARCH_UNALIGN_ALLOW
693 Say Y here if you want the kernel to embed support for misaligned
694 load/store for both kernel and userspace. When disable, misaligned
695 accesses will generate SIGBUS in userspace and panic in kernel.
697 config RISCV_EFFICIENT_UNALIGNED_ACCESS
698 bool "Assume the CPU supports fast unaligned memory accesses"
699 depends on NONPORTABLE
700 select DCACHE_WORD_ACCESS if MMU
701 select HAVE_EFFICIENT_UNALIGNED_ACCESS
703 Say Y here if you want the kernel to assume that the CPU supports
704 efficient unaligned memory accesses. When enabled, this option
705 improves the performance of the kernel on such CPUs. However, the
706 kernel will run much more slowly, or will not be able to run at all,
707 on CPUs that do not support efficient unaligned memory accesses.
709 If unsure what to do here, say N.
711 endmenu # "Platform type"
713 menu "Kernel features"
715 source "kernel/Kconfig.hz"
718 bool "SBI v0.1 support"
721 This config allows kernel to use SBI v0.1 APIs. This will be
722 deprecated in future once legacy M-mode software are no longer in use.
724 config RISCV_BOOT_SPINWAIT
725 bool "Spinwait booting method"
727 default y if RISCV_SBI_V01 || RISCV_M_MODE
729 This enables support for booting Linux via spinwait method. In the
730 spinwait method, all cores randomly jump to Linux. One of the cores
731 gets chosen via lottery and all other keep spinning on a percpu
732 variable. This method cannot support CPU hotplug and sparse hartid
733 scheme. It should be only enabled for M-mode Linux or platforms relying
734 on older firmware without SBI HSM extension. All other platforms should
735 rely on ordered booting via SBI HSM extension which gets chosen
736 dynamically at runtime if the firmware supports it.
738 Since spinwait is incompatible with sparse hart IDs, it requires
739 NR_CPUS be large enough to contain the physical hart ID of the first
742 If unsure what to do here, say N.
744 config ARCH_SUPPORTS_KEXEC
747 config ARCH_SELECTS_KEXEC
750 select HOTPLUG_CPU if SMP
752 config ARCH_SUPPORTS_KEXEC_FILE
755 config ARCH_SELECTS_KEXEC_FILE
757 depends on KEXEC_FILE
758 select HAVE_IMA_KEXEC if IMA
761 config ARCH_SUPPORTS_KEXEC_PURGATORY
762 def_bool ARCH_SUPPORTS_KEXEC_FILE
764 config ARCH_SUPPORTS_CRASH_DUMP
767 config ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION
768 def_bool CRASH_RESERVE
771 bool "Kernel support for 32-bit U-mode"
773 depends on 64BIT && MMU
775 This option enables support for a 32-bit U-mode running under a 64-bit
776 kernel at S-mode. riscv32-specific components such as system calls,
777 the user helper functions (vdso), signal rt_frame functions and the
778 ptrace interface are handled appropriately by the kernel.
780 If you want to execute 32-bit userspace applications, say Y.
783 bool "Enable paravirtualization code"
786 This changes the kernel so it can modify itself when it is run
787 under a hypervisor, potentially improving performance significantly
788 over full virtualization.
790 config PARAVIRT_TIME_ACCOUNTING
791 bool "Paravirtual steal time accounting"
794 Select this option to enable fine granularity task steal time
795 accounting. Time spent executing other tasks in parallel with
796 the current vCPU is discounted from the vCPU power. To account for
797 that, there can be a small performance impact.
799 If in doubt, say N here.
802 bool "Build a relocatable kernel"
803 depends on MMU && 64BIT && !XIP_KERNEL
805 This builds a kernel as a Position Independent Executable (PIE),
806 which retains all relocation metadata required to relocate the
807 kernel binary at runtime to a different virtual address than the
808 address it was linked at.
809 Since RISCV uses the RELA relocation format, this requires a
810 relocation pass at runtime even if the kernel is loaded at the
811 same address it was linked at.
815 config RANDOMIZE_BASE
816 bool "Randomize the address of the kernel image"
818 depends on MMU && 64BIT && !XIP_KERNEL
820 Randomizes the virtual address at which the kernel image is
821 loaded, as a security feature that deters exploit attempts
822 relying on knowledge of the location of kernel internals.
824 It is the bootloader's job to provide entropy, by passing a
825 random u64 value in /chosen/kaslr-seed at kernel entry.
827 When booting via the UEFI stub, it will invoke the firmware's
828 EFI_RNG_PROTOCOL implementation (if available) to supply entropy
829 to the kernel proper. In addition, it will randomise the physical
830 location of the kernel Image as well.
834 endmenu # "Kernel features"
839 string "Built-in kernel command line"
841 For most platforms, the arguments for the kernel's command line
842 are provided at run-time, during boot. However, there are cases
843 where either no arguments are being provided or the provided
844 arguments are insufficient or even invalid.
846 When that occurs, it is possible to define a built-in command
847 line here and choose how the kernel should use it later on.
850 prompt "Built-in command line usage" if CMDLINE != ""
851 default CMDLINE_FALLBACK
853 Choose how the kernel will handle the provided built-in command
856 config CMDLINE_FALLBACK
857 bool "Use bootloader kernel arguments if available"
859 Use the built-in command line as fallback in case we get nothing
860 during boot. This is the default behaviour.
862 config CMDLINE_EXTEND
863 bool "Extend bootloader kernel arguments"
865 The command-line arguments provided during boot will be
866 appended to the built-in command line. This is useful in
867 cases where the provided arguments are insufficient and
868 you don't want to or cannot modify them.
871 bool "Always use the default kernel command string"
873 Always use the built-in command line, even if we get one during
874 boot. This is useful in case you need to override the provided
875 command line on systems where you don't have or want control
884 bool "UEFI runtime support"
885 depends on OF && !XIP_KERNEL
888 select ARCH_SUPPORTS_ACPI if 64BIT
889 select EFI_GENERIC_STUB
890 select EFI_PARAMS_FROM_FDT
891 select EFI_RUNTIME_WRAPPERS
897 This option provides support for runtime services provided
898 by UEFI firmware (such as non-volatile variables, realtime
899 clock, and platform reset). A UEFI stub is also provided to
900 allow the kernel to be booted as an EFI application. This
901 is only useful on systems that have UEFI firmware.
903 config CC_HAVE_STACKPROTECTOR_TLS
904 def_bool $(cc-option,-mstack-protector-guard=tls -mstack-protector-guard-reg=tp -mstack-protector-guard-offset=0)
906 config STACKPROTECTOR_PER_TASK
908 depends on !RANDSTRUCT
909 depends on STACKPROTECTOR && CC_HAVE_STACKPROTECTOR_TLS
911 config PHYS_RAM_BASE_FIXED
912 bool "Explicitly specified physical RAM address"
913 depends on NONPORTABLE
917 hex "Platform Physical RAM address"
918 depends on PHYS_RAM_BASE_FIXED
921 This is the physical address of RAM in the system. It has to be
922 explicitly specified to run early relocations of read-write data
926 bool "Kernel Execute-In-Place from ROM"
927 depends on MMU && SPARSEMEM && NONPORTABLE
928 # This prevents XIP from being enabled by all{yes,mod}config, which
929 # fail to build since XIP doesn't support large kernels.
930 depends on !COMPILE_TEST
931 select PHYS_RAM_BASE_FIXED
933 Execute-In-Place allows the kernel to run from non-volatile storage
934 directly addressable by the CPU, such as NOR flash. This saves RAM
935 space since the text section of the kernel is not loaded from flash
936 to RAM. Read-write sections, such as the data section and stack,
937 are still copied to RAM. The XIP kernel is not compressed since
938 it has to run directly from flash, so it will take more space to
939 store it. The flash address used to link the kernel object files,
940 and for storing it, is configuration dependent. Therefore, if you
941 say Y here, you must know the proper physical address where to
942 store the kernel image depending on your own flash memory usage.
944 Also note that the make target becomes "make xipImage" rather than
945 "make zImage" or "make Image". The final kernel binary to put in
946 ROM memory will be arch/riscv/boot/xipImage.
948 SPARSEMEM is required because the kernel text and rodata that are
949 flash resident are not backed by memmap, then any attempt to get
950 a struct page on those regions will trigger a fault.
955 hex "XIP Kernel Physical Location"
956 depends on XIP_KERNEL
959 This is the physical address in your flash memory the kernel will
960 be linked for and stored to. This address is dependent on your
963 config RISCV_ISA_FALLBACK
964 bool "Permit falling back to parsing riscv,isa for extension support by default"
967 Parsing the "riscv,isa" devicetree property has been deprecated and
968 replaced by a list of explicitly defined strings. For compatibility
969 with existing platforms, the kernel will fall back to parsing the
970 "riscv,isa" property if the replacements are not found.
972 Selecting N here will result in a kernel that does not use the
973 fallback, unless the commandline "riscv_isa_fallback" parameter is
976 Please see the dt-binding, located at
977 Documentation/devicetree/bindings/riscv/extensions.yaml for details
978 on the replacement properties, "riscv,isa-base" and
979 "riscv,isa-extensions".
982 bool "Built-in device tree"
983 depends on OF && NONPORTABLE
985 Build a device tree into the Linux image.
986 This option should be selected if no bootloader is being used.
990 config BUILTIN_DTB_SOURCE
991 string "Built-in device tree source"
992 depends on BUILTIN_DTB
994 DTS file path (without suffix, relative to arch/riscv/boot/dts)
995 for the DTS file that will be used to produce the DTB linked into the
998 endmenu # "Boot options"
1002 default !NONPORTABLE
1007 config ARCH_PROC_KCORE_TEXT
1010 menu "Power management options"
1012 source "kernel/power/Kconfig"
1014 # Hibernation is only possible on systems where the SBI implementation has
1015 # marked its reserved memory as not accessible from, or does not run
1016 # from the same memory as, Linux
1017 config ARCH_HIBERNATION_POSSIBLE
1018 def_bool NONPORTABLE
1020 config ARCH_HIBERNATION_HEADER
1021 def_bool HIBERNATION
1023 config ARCH_SUSPEND_POSSIBLE
1026 endmenu # "Power management options"
1028 menu "CPU Power Management"
1030 source "drivers/cpuidle/Kconfig"
1032 source "drivers/cpufreq/Kconfig"
1034 endmenu # "CPU Power Management"
1036 source "arch/riscv/kvm/Kconfig"
1038 source "drivers/acpi/Kconfig"