]> git.ipfire.org Git - thirdparty/linux.git/blob - arch/riscv/Kconfig
Merge tag 'riscv-for-linus-6.5-mw1' of git://git.kernel.org/pub/scm/linux/kernel...
[thirdparty/linux.git] / arch / riscv / Kconfig
1 # SPDX-License-Identifier: GPL-2.0-only
2 #
3 # For a description of the syntax of this configuration file,
4 # see Documentation/kbuild/kconfig-language.rst.
5 #
6
7 config 64BIT
8 bool
9
10 config 32BIT
11 bool
12
13 config RISCV
14 def_bool y
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
29 select ARCH_HAS_KCOV
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_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
39 select ARCH_HAS_UBSAN_SANITIZE_ALL
40 select ARCH_HAS_VDSO_DATA
41 select ARCH_OPTIONAL_KERNEL_RWX if ARCH_HAS_STRICT_KERNEL_RWX
42 select ARCH_OPTIONAL_KERNEL_RWX_DEFAULT
43 select ARCH_STACKWALK
44 select ARCH_SUPPORTS_ATOMIC_RMW
45 select ARCH_SUPPORTS_DEBUG_PAGEALLOC if MMU
46 select ARCH_SUPPORTS_HUGETLBFS if MMU
47 select ARCH_SUPPORTS_PAGE_TABLE_CHECK if MMU
48 select ARCH_SUPPORTS_PER_VMA_LOCK if MMU
49 select ARCH_USE_MEMTEST
50 select ARCH_USE_QUEUED_RWLOCKS
51 select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU
52 select ARCH_WANT_FRAME_POINTERS
53 select ARCH_WANT_GENERAL_HUGETLB if !RISCV_ISA_SVNAPOT
54 select ARCH_WANT_HUGE_PMD_SHARE if 64BIT
55 select ARCH_WANT_LD_ORPHAN_WARN if !XIP_KERNEL
56 select ARCH_WANT_OPTIMIZE_VMEMMAP
57 select ARCH_WANTS_THP_SWAP if HAVE_ARCH_TRANSPARENT_HUGEPAGE
58 select BINFMT_FLAT_NO_DATA_START_OFFSET if !MMU
59 select BUILDTIME_TABLE_SORT if MMU
60 select CLINT_TIMER if !MMU
61 select CLONE_BACKWARDS
62 select COMMON_CLK
63 select CPU_PM if CPU_IDLE || HIBERNATION
64 select EDAC_SUPPORT
65 select GENERIC_ARCH_TOPOLOGY
66 select GENERIC_ATOMIC64 if !64BIT
67 select GENERIC_CLOCKEVENTS_BROADCAST if SMP
68 select GENERIC_EARLY_IOREMAP
69 select GENERIC_ENTRY
70 select GENERIC_GETTIMEOFDAY if HAVE_GENERIC_VDSO
71 select GENERIC_IDLE_POLL_SETUP
72 select GENERIC_IOREMAP if MMU
73 select GENERIC_IRQ_IPI if SMP
74 select GENERIC_IRQ_IPI_MUX if SMP
75 select GENERIC_IRQ_MULTI_HANDLER
76 select GENERIC_IRQ_SHOW
77 select GENERIC_IRQ_SHOW_LEVEL
78 select GENERIC_LIB_DEVMEM_IS_ALLOWED
79 select GENERIC_PCI_IOMAP
80 select GENERIC_PTDUMP if MMU
81 select GENERIC_SCHED_CLOCK
82 select GENERIC_SMP_IDLE_THREAD
83 select GENERIC_TIME_VSYSCALL if MMU && 64BIT
84 select GENERIC_VDSO_TIME_NS if HAVE_GENERIC_VDSO
85 select HARDIRQS_SW_RESEND
86 select HAS_IOPORT if MMU
87 select HAVE_ARCH_AUDITSYSCALL
88 select HAVE_ARCH_HUGE_VMALLOC if HAVE_ARCH_HUGE_VMAP
89 select HAVE_ARCH_HUGE_VMAP if MMU && 64BIT && !XIP_KERNEL
90 select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL
91 select HAVE_ARCH_JUMP_LABEL_RELATIVE if !XIP_KERNEL
92 select HAVE_ARCH_KASAN if MMU && 64BIT
93 select HAVE_ARCH_KASAN_VMALLOC if MMU && 64BIT
94 select HAVE_ARCH_KFENCE if MMU && 64BIT
95 select HAVE_ARCH_KGDB if !XIP_KERNEL
96 select HAVE_ARCH_KGDB_QXFER_PKT
97 select HAVE_ARCH_MMAP_RND_BITS if MMU
98 select HAVE_ARCH_MMAP_RND_COMPAT_BITS if COMPAT
99 select HAVE_ARCH_SECCOMP_FILTER
100 select HAVE_ARCH_THREAD_STRUCT_WHITELIST
101 select HAVE_ARCH_TRACEHOOK
102 select HAVE_ARCH_TRANSPARENT_HUGEPAGE if 64BIT && MMU
103 select HAVE_ARCH_VMAP_STACK if MMU && 64BIT
104 select HAVE_ASM_MODVERSIONS
105 select HAVE_CONTEXT_TRACKING_USER
106 select HAVE_DEBUG_KMEMLEAK
107 select HAVE_DMA_CONTIGUOUS if MMU
108 select HAVE_EBPF_JIT if MMU
109 select HAVE_FUNCTION_ARG_ACCESS_API
110 select HAVE_FUNCTION_ERROR_INJECTION
111 select HAVE_GCC_PLUGINS
112 select HAVE_GENERIC_VDSO if MMU && 64BIT
113 select HAVE_IRQ_TIME_ACCOUNTING
114 select HAVE_KPROBES if !XIP_KERNEL
115 select HAVE_KPROBES_ON_FTRACE if !XIP_KERNEL
116 select HAVE_KRETPROBES if !XIP_KERNEL
117 select HAVE_RETHOOK if !XIP_KERNEL
118 select HAVE_MOVE_PMD
119 select HAVE_MOVE_PUD
120 select HAVE_PCI
121 select HAVE_PERF_EVENTS
122 select HAVE_PERF_REGS
123 select HAVE_PERF_USER_STACK_DUMP
124 select HAVE_POSIX_CPU_TIMERS_TASK_WORK
125 select HAVE_REGS_AND_STACK_ACCESS_API
126 select HAVE_RSEQ
127 select HAVE_STACKPROTECTOR
128 select HAVE_SYSCALL_TRACEPOINTS
129 select HOTPLUG_CORE_SYNC_DEAD if HOTPLUG_CPU
130 select IRQ_DOMAIN
131 select IRQ_FORCED_THREADING
132 select KASAN_VMALLOC if KASAN
133 select LOCK_MM_AND_FIND_VMA
134 select MODULES_USE_ELF_RELA if MODULES
135 select MODULE_SECTIONS if MODULES
136 select OF
137 select OF_EARLY_FLATTREE
138 select OF_IRQ
139 select PCI_DOMAINS_GENERIC if PCI
140 select PCI_MSI if PCI
141 select RISCV_ALTERNATIVE if !XIP_KERNEL
142 select RISCV_INTC
143 select RISCV_TIMER if RISCV_SBI
144 select SIFIVE_PLIC
145 select SPARSE_IRQ
146 select SYSCTL_EXCEPTION_TRACE
147 select THREAD_INFO_IN_TASK
148 select TRACE_IRQFLAGS_SUPPORT
149 select UACCESS_MEMCPY if !MMU
150 select ZONE_DMA32 if 64BIT
151 select HAVE_DYNAMIC_FTRACE if !XIP_KERNEL && MMU && (CLANG_SUPPORTS_DYNAMIC_FTRACE || GCC_SUPPORTS_DYNAMIC_FTRACE)
152 select HAVE_DYNAMIC_FTRACE_WITH_REGS if HAVE_DYNAMIC_FTRACE
153 select HAVE_FTRACE_MCOUNT_RECORD if !XIP_KERNEL
154 select HAVE_FUNCTION_GRAPH_TRACER
155 select HAVE_FUNCTION_TRACER if !XIP_KERNEL && !PREEMPTION
156
157 config CLANG_SUPPORTS_DYNAMIC_FTRACE
158 def_bool CC_IS_CLANG
159 # https://github.com/llvm/llvm-project/commit/6ab8927931851bb42b2c93a00801dc499d7d9b1e
160 depends on CLANG_VERSION >= 130000
161 # https://github.com/ClangBuiltLinux/linux/issues/1817
162 depends on AS_IS_GNU || (AS_IS_LLVM && (LD_IS_LLD || LD_VERSION >= 23600))
163
164 config GCC_SUPPORTS_DYNAMIC_FTRACE
165 def_bool CC_IS_GCC
166 depends on $(cc-option,-fpatchable-function-entry=8)
167
168 config ARCH_MMAP_RND_BITS_MIN
169 default 18 if 64BIT
170 default 8
171
172 config ARCH_MMAP_RND_COMPAT_BITS_MIN
173 default 8
174
175 # max bits determined by the following formula:
176 # VA_BITS - PAGE_SHIFT - 3
177 config ARCH_MMAP_RND_BITS_MAX
178 default 24 if 64BIT # SV39 based
179 default 17
180
181 config ARCH_MMAP_RND_COMPAT_BITS_MAX
182 default 17
183
184 # set if we run in machine mode, cleared if we run in supervisor mode
185 config RISCV_M_MODE
186 bool
187 default !MMU
188
189 # set if we are running in S-mode and can use SBI calls
190 config RISCV_SBI
191 bool
192 depends on !RISCV_M_MODE
193 default y
194
195 config MMU
196 bool "MMU-based Paged Memory Management Support"
197 default y
198 help
199 Select if you want MMU-based virtualised addressing space
200 support by paged memory management. If unsure, say 'Y'.
201
202 config PAGE_OFFSET
203 hex
204 default 0xC0000000 if 32BIT && MMU
205 default 0x80000000 if !MMU
206 default 0xff60000000000000 if 64BIT
207
208 config KASAN_SHADOW_OFFSET
209 hex
210 depends on KASAN_GENERIC
211 default 0xdfffffff00000000 if 64BIT
212 default 0xffffffff if 32BIT
213
214 config ARCH_FLATMEM_ENABLE
215 def_bool !NUMA
216
217 config ARCH_SPARSEMEM_ENABLE
218 def_bool y
219 depends on MMU
220 select SPARSEMEM_STATIC if 32BIT && SPARSEMEM
221 select SPARSEMEM_VMEMMAP_ENABLE if 64BIT
222
223 config ARCH_SELECT_MEMORY_MODEL
224 def_bool ARCH_SPARSEMEM_ENABLE
225
226 config ARCH_SUPPORTS_UPROBES
227 def_bool y
228
229 config STACKTRACE_SUPPORT
230 def_bool y
231
232 config GENERIC_BUG
233 def_bool y
234 depends on BUG
235 select GENERIC_BUG_RELATIVE_POINTERS if 64BIT
236
237 config GENERIC_BUG_RELATIVE_POINTERS
238 bool
239
240 config GENERIC_CALIBRATE_DELAY
241 def_bool y
242
243 config GENERIC_CSUM
244 def_bool y
245
246 config GENERIC_HWEIGHT
247 def_bool y
248
249 config FIX_EARLYCON_MEM
250 def_bool MMU
251
252 config PGTABLE_LEVELS
253 int
254 default 5 if 64BIT
255 default 2
256
257 config LOCKDEP_SUPPORT
258 def_bool y
259
260 config RISCV_DMA_NONCOHERENT
261 bool
262 select ARCH_HAS_DMA_PREP_COHERENT
263 select ARCH_HAS_SETUP_DMA_OPS
264 select ARCH_HAS_SYNC_DMA_FOR_CPU
265 select ARCH_HAS_SYNC_DMA_FOR_DEVICE
266 select DMA_DIRECT_REMAP
267
268 config AS_HAS_INSN
269 def_bool $(as-instr,.insn r 51$(comma) 0$(comma) 0$(comma) t0$(comma) t0$(comma) zero)
270
271 config AS_HAS_OPTION_ARCH
272 # https://reviews.llvm.org/D123515
273 def_bool y
274 depends on $(as-instr, .option arch$(comma) +m)
275 depends on !$(as-instr, .option arch$(comma) -i)
276
277 source "arch/riscv/Kconfig.socs"
278 source "arch/riscv/Kconfig.errata"
279
280 menu "Platform type"
281
282 config NONPORTABLE
283 bool "Allow configurations that result in non-portable kernels"
284 help
285 RISC-V kernel binaries are compatible between all known systems
286 whenever possible, but there are some use cases that can only be
287 satisfied by configurations that result in kernel binaries that are
288 not portable between systems.
289
290 Selecting N does not guarantee kernels will be portable to all known
291 systems. Selecting any of the options guarded by NONPORTABLE will
292 result in kernel binaries that are unlikely to be portable between
293 systems.
294
295 If unsure, say N.
296
297 choice
298 prompt "Base ISA"
299 default ARCH_RV64I
300 help
301 This selects the base ISA that this kernel will target and must match
302 the target platform.
303
304 config ARCH_RV32I
305 bool "RV32I"
306 depends on NONPORTABLE
307 select 32BIT
308 select GENERIC_LIB_ASHLDI3
309 select GENERIC_LIB_ASHRDI3
310 select GENERIC_LIB_LSHRDI3
311 select GENERIC_LIB_UCMPDI2
312
313 config ARCH_RV64I
314 bool "RV64I"
315 select 64BIT
316 select ARCH_SUPPORTS_INT128 if CC_HAS_INT128
317 select SWIOTLB if MMU
318
319 endchoice
320
321 # We must be able to map all physical memory into the kernel, but the compiler
322 # is still a bit more efficient when generating code if it's setup in a manner
323 # such that it can only map 2GiB of memory.
324 choice
325 prompt "Kernel Code Model"
326 default CMODEL_MEDLOW if 32BIT
327 default CMODEL_MEDANY if 64BIT
328
329 config CMODEL_MEDLOW
330 bool "medium low code model"
331 config CMODEL_MEDANY
332 bool "medium any code model"
333 endchoice
334
335 config MODULE_SECTIONS
336 bool
337 select HAVE_MOD_ARCH_SPECIFIC
338
339 config SMP
340 bool "Symmetric Multi-Processing"
341 help
342 This enables support for systems with more than one CPU. If
343 you say N here, the kernel will run on single and
344 multiprocessor machines, but will use only one CPU of a
345 multiprocessor machine. If you say Y here, the kernel will run
346 on many, but not all, single processor machines. On a single
347 processor machine, the kernel will run faster if you say N
348 here.
349
350 If you don't know what to do here, say N.
351
352 config SCHED_MC
353 bool "Multi-core scheduler support"
354 depends on SMP
355 help
356 Multi-core scheduler support improves the CPU scheduler's decision
357 making when dealing with multi-core CPU chips at a cost of slightly
358 increased overhead in some places. If unsure say N here.
359
360 config NR_CPUS
361 int "Maximum number of CPUs (2-512)"
362 depends on SMP
363 range 2 512 if !RISCV_SBI_V01
364 range 2 32 if RISCV_SBI_V01 && 32BIT
365 range 2 64 if RISCV_SBI_V01 && 64BIT
366 default "32" if 32BIT
367 default "64" if 64BIT
368
369 config HOTPLUG_CPU
370 bool "Support for hot-pluggable CPUs"
371 depends on SMP
372 select GENERIC_IRQ_MIGRATION
373 help
374
375 Say Y here to experiment with turning CPUs off and on. CPUs
376 can be controlled through /sys/devices/system/cpu.
377
378 Say N if you want to disable CPU hotplug.
379
380 choice
381 prompt "CPU Tuning"
382 default TUNE_GENERIC
383
384 config TUNE_GENERIC
385 bool "generic"
386
387 endchoice
388
389 # Common NUMA Features
390 config NUMA
391 bool "NUMA Memory Allocation and Scheduler Support"
392 depends on SMP && MMU
393 select ARCH_SUPPORTS_NUMA_BALANCING
394 select GENERIC_ARCH_NUMA
395 select NEED_PER_CPU_EMBED_FIRST_CHUNK
396 select OF_NUMA
397 select USE_PERCPU_NUMA_NODE_ID
398 help
399 Enable NUMA (Non-Uniform Memory Access) support.
400
401 The kernel will try to allocate memory used by a CPU on the
402 local memory of the CPU and add some more NUMA awareness to the kernel.
403
404 config NODES_SHIFT
405 int "Maximum NUMA Nodes (as a power of 2)"
406 range 1 10
407 default "2"
408 depends on NUMA
409 help
410 Specify the maximum number of NUMA Nodes available on the target
411 system. Increases memory reserved to accommodate various tables.
412
413 config RISCV_ALTERNATIVE
414 bool
415 depends on !XIP_KERNEL
416 help
417 This Kconfig allows the kernel to automatically patch the
418 erratum or cpufeature required by the execution platform at run
419 time. The code patching overhead is minimal, as it's only done
420 once at boot and once on each module load.
421
422 config RISCV_ALTERNATIVE_EARLY
423 bool
424 depends on RISCV_ALTERNATIVE
425 help
426 Allows early patching of the kernel for special errata
427
428 config RISCV_ISA_C
429 bool "Emit compressed instructions when building Linux"
430 default y
431 help
432 Adds "C" to the ISA subsets that the toolchain is allowed to emit
433 when building Linux, which results in compressed instructions in the
434 Linux binary.
435
436 If you don't know what to do here, say Y.
437
438 config RISCV_ISA_SVNAPOT
439 bool "Svnapot extension support for supervisor mode NAPOT pages"
440 depends on 64BIT && MMU
441 depends on RISCV_ALTERNATIVE
442 default y
443 help
444 Allow kernel to detect the Svnapot ISA-extension dynamically at boot
445 time and enable its usage.
446
447 The Svnapot extension is used to mark contiguous PTEs as a range
448 of contiguous virtual-to-physical translations for a naturally
449 aligned power-of-2 (NAPOT) granularity larger than the base 4KB page
450 size. When HUGETLBFS is also selected this option unconditionally
451 allocates some memory for each NAPOT page size supported by the kernel.
452 When optimizing for low memory consumption and for platforms without
453 the Svnapot extension, it may be better to say N here.
454
455 If you don't know what to do here, say Y.
456
457 config RISCV_ISA_SVPBMT
458 bool "Svpbmt extension support for supervisor mode page-based memory types"
459 depends on 64BIT && MMU
460 depends on RISCV_ALTERNATIVE
461 default y
462 help
463 Adds support to dynamically detect the presence of the Svpbmt
464 ISA-extension (Supervisor-mode: page-based memory types) and
465 enable its usage.
466
467 The memory type for a page contains a combination of attributes
468 that indicate the cacheability, idempotency, and ordering
469 properties for access to that page.
470
471 The Svpbmt extension is only available on 64-bit cpus.
472
473 If you don't know what to do here, say Y.
474
475 config TOOLCHAIN_HAS_V
476 bool
477 default y
478 depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64iv)
479 depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32iv)
480 depends on LLD_VERSION >= 140000 || LD_VERSION >= 23800
481 depends on AS_HAS_OPTION_ARCH
482
483 config RISCV_ISA_V
484 bool "VECTOR extension support"
485 depends on TOOLCHAIN_HAS_V
486 depends on FPU
487 select DYNAMIC_SIGFRAME
488 default y
489 help
490 Say N here if you want to disable all vector related procedure
491 in the kernel.
492
493 If you don't know what to do here, say Y.
494
495 config RISCV_ISA_V_DEFAULT_ENABLE
496 bool "Enable userspace Vector by default"
497 depends on RISCV_ISA_V
498 default y
499 help
500 Say Y here if you want to enable Vector in userspace by default.
501 Otherwise, userspace has to make explicit prctl() call to enable
502 Vector, or enable it via the sysctl interface.
503
504 If you don't know what to do here, say Y.
505
506 config TOOLCHAIN_HAS_ZBB
507 bool
508 default y
509 depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64ima_zbb)
510 depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32ima_zbb)
511 depends on LLD_VERSION >= 150000 || LD_VERSION >= 23900
512 depends on AS_HAS_OPTION_ARCH
513
514 config RISCV_ISA_ZBB
515 bool "Zbb extension support for bit manipulation instructions"
516 depends on TOOLCHAIN_HAS_ZBB
517 depends on MMU
518 depends on RISCV_ALTERNATIVE
519 default y
520 help
521 Adds support to dynamically detect the presence of the ZBB
522 extension (basic bit manipulation) and enable its usage.
523
524 The Zbb extension provides instructions to accelerate a number
525 of bit-specific operations (count bit population, sign extending,
526 bitrotation, etc).
527
528 If you don't know what to do here, say Y.
529
530 config RISCV_ISA_ZICBOM
531 bool "Zicbom extension support for non-coherent DMA operation"
532 depends on MMU
533 depends on RISCV_ALTERNATIVE
534 default y
535 select RISCV_DMA_NONCOHERENT
536 help
537 Adds support to dynamically detect the presence of the ZICBOM
538 extension (Cache Block Management Operations) and enable its
539 usage.
540
541 The Zicbom extension can be used to handle for example
542 non-coherent DMA support on devices that need it.
543
544 If you don't know what to do here, say Y.
545
546 config RISCV_ISA_ZICBOZ
547 bool "Zicboz extension support for faster zeroing of memory"
548 depends on MMU
549 depends on RISCV_ALTERNATIVE
550 default y
551 help
552 Enable the use of the Zicboz extension (cbo.zero instruction)
553 when available.
554
555 The Zicboz extension is used for faster zeroing of memory.
556
557 If you don't know what to do here, say Y.
558
559 config TOOLCHAIN_HAS_ZIHINTPAUSE
560 bool
561 default y
562 depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64ima_zihintpause)
563 depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32ima_zihintpause)
564 depends on LLD_VERSION >= 150000 || LD_VERSION >= 23600
565
566 config TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI
567 def_bool y
568 # https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=aed44286efa8ae8717a77d94b51ac3614e2ca6dc
569 depends on AS_IS_GNU && AS_VERSION >= 23800
570 help
571 Newer binutils versions default to ISA spec version 20191213 which
572 moves some instructions from the I extension to the Zicsr and Zifencei
573 extensions.
574
575 config TOOLCHAIN_NEEDS_OLD_ISA_SPEC
576 def_bool y
577 depends on TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI
578 # https://github.com/llvm/llvm-project/commit/22e199e6afb1263c943c0c0d4498694e15bf8a16
579 depends on CC_IS_CLANG && CLANG_VERSION < 170000
580 help
581 Certain versions of clang do not support zicsr and zifencei via -march
582 but newer versions of binutils require it for the reasons noted in the
583 help text of CONFIG_TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI. This
584 option causes an older ISA spec compatible with these older versions
585 of clang to be passed to GAS, which has the same result as passing zicsr
586 and zifencei to -march.
587
588 config FPU
589 bool "FPU support"
590 default y
591 help
592 Say N here if you want to disable all floating-point related procedure
593 in the kernel.
594
595 If you don't know what to do here, say Y.
596
597 config IRQ_STACKS
598 bool "Independent irq & softirq stacks" if EXPERT
599 default y
600 select HAVE_IRQ_EXIT_ON_IRQ_STACK
601 select HAVE_SOFTIRQ_ON_OWN_STACK
602 help
603 Add independent irq & softirq stacks for percpu to prevent kernel stack
604 overflows. We may save some memory footprint by disabling IRQ_STACKS.
605
606 config THREAD_SIZE_ORDER
607 int "Kernel stack size (in power-of-two numbers of page size)" if VMAP_STACK && EXPERT
608 range 0 4
609 default 1 if 32BIT && !KASAN
610 default 3 if 64BIT && KASAN
611 default 2
612 help
613 Specify the Pages of thread stack size (from 4KB to 64KB), which also
614 affects irq stack size, which is equal to thread stack size.
615
616 endmenu # "Platform type"
617
618 menu "Kernel features"
619
620 source "kernel/Kconfig.hz"
621
622 config RISCV_SBI_V01
623 bool "SBI v0.1 support"
624 depends on RISCV_SBI
625 help
626 This config allows kernel to use SBI v0.1 APIs. This will be
627 deprecated in future once legacy M-mode software are no longer in use.
628
629 config RISCV_BOOT_SPINWAIT
630 bool "Spinwait booting method"
631 depends on SMP
632 default y if RISCV_SBI_V01 || RISCV_M_MODE
633 help
634 This enables support for booting Linux via spinwait method. In the
635 spinwait method, all cores randomly jump to Linux. One of the cores
636 gets chosen via lottery and all other keep spinning on a percpu
637 variable. This method cannot support CPU hotplug and sparse hartid
638 scheme. It should be only enabled for M-mode Linux or platforms relying
639 on older firmware without SBI HSM extension. All other platforms should
640 rely on ordered booting via SBI HSM extension which gets chosen
641 dynamically at runtime if the firmware supports it.
642
643 Since spinwait is incompatible with sparse hart IDs, it requires
644 NR_CPUS be large enough to contain the physical hart ID of the first
645 hart to enter Linux.
646
647 If unsure what to do here, say N.
648
649 config KEXEC
650 bool "Kexec system call"
651 depends on MMU
652 select HOTPLUG_CPU if SMP
653 select KEXEC_CORE
654 help
655 kexec is a system call that implements the ability to shutdown your
656 current kernel, and to start another kernel. It is like a reboot
657 but it is independent of the system firmware. And like a reboot
658 you can start any kernel with it, not just Linux.
659
660 The name comes from the similarity to the exec system call.
661
662 config KEXEC_FILE
663 bool "kexec file based systmem call"
664 depends on 64BIT && MMU
665 select HAVE_IMA_KEXEC if IMA
666 select KEXEC_CORE
667 select KEXEC_ELF
668 help
669 This is new version of kexec system call. This system call is
670 file based and takes file descriptors as system call argument
671 for kernel and initramfs as opposed to list of segments as
672 accepted by previous system call.
673
674 If you don't know what to do here, say Y.
675
676 config ARCH_HAS_KEXEC_PURGATORY
677 def_bool KEXEC_FILE
678 depends on CRYPTO=y
679 depends on CRYPTO_SHA256=y
680
681 config CRASH_DUMP
682 bool "Build kdump crash kernel"
683 help
684 Generate crash dump after being started by kexec. This should
685 be normally only set in special crash dump kernels which are
686 loaded in the main kernel with kexec-tools into a specially
687 reserved region and then later executed after a crash by
688 kdump/kexec.
689
690 For more details see Documentation/admin-guide/kdump/kdump.rst
691
692 config COMPAT
693 bool "Kernel support for 32-bit U-mode"
694 default 64BIT
695 depends on 64BIT && MMU
696 help
697 This option enables support for a 32-bit U-mode running under a 64-bit
698 kernel at S-mode. riscv32-specific components such as system calls,
699 the user helper functions (vdso), signal rt_frame functions and the
700 ptrace interface are handled appropriately by the kernel.
701
702 If you want to execute 32-bit userspace applications, say Y.
703
704 config RELOCATABLE
705 bool "Build a relocatable kernel"
706 depends on MMU && 64BIT && !XIP_KERNEL
707 help
708 This builds a kernel as a Position Independent Executable (PIE),
709 which retains all relocation metadata required to relocate the
710 kernel binary at runtime to a different virtual address than the
711 address it was linked at.
712 Since RISCV uses the RELA relocation format, this requires a
713 relocation pass at runtime even if the kernel is loaded at the
714 same address it was linked at.
715
716 If unsure, say N.
717
718 endmenu # "Kernel features"
719
720 menu "Boot options"
721
722 config CMDLINE
723 string "Built-in kernel command line"
724 help
725 For most platforms, the arguments for the kernel's command line
726 are provided at run-time, during boot. However, there are cases
727 where either no arguments are being provided or the provided
728 arguments are insufficient or even invalid.
729
730 When that occurs, it is possible to define a built-in command
731 line here and choose how the kernel should use it later on.
732
733 choice
734 prompt "Built-in command line usage" if CMDLINE != ""
735 default CMDLINE_FALLBACK
736 help
737 Choose how the kernel will handle the provided built-in command
738 line.
739
740 config CMDLINE_FALLBACK
741 bool "Use bootloader kernel arguments if available"
742 help
743 Use the built-in command line as fallback in case we get nothing
744 during boot. This is the default behaviour.
745
746 config CMDLINE_EXTEND
747 bool "Extend bootloader kernel arguments"
748 help
749 The command-line arguments provided during boot will be
750 appended to the built-in command line. This is useful in
751 cases where the provided arguments are insufficient and
752 you don't want to or cannot modify them.
753
754 config CMDLINE_FORCE
755 bool "Always use the default kernel command string"
756 help
757 Always use the built-in command line, even if we get one during
758 boot. This is useful in case you need to override the provided
759 command line on systems where you don't have or want control
760 over it.
761
762 endchoice
763
764 config EFI_STUB
765 bool
766
767 config EFI
768 bool "UEFI runtime support"
769 depends on OF && !XIP_KERNEL
770 depends on MMU
771 default y
772 select ARCH_SUPPORTS_ACPI if 64BIT
773 select EFI_GENERIC_STUB
774 select EFI_PARAMS_FROM_FDT
775 select EFI_RUNTIME_WRAPPERS
776 select EFI_STUB
777 select LIBFDT
778 select RISCV_ISA_C
779 select UCS2_STRING
780 help
781 This option provides support for runtime services provided
782 by UEFI firmware (such as non-volatile variables, realtime
783 clock, and platform reset). A UEFI stub is also provided to
784 allow the kernel to be booted as an EFI application. This
785 is only useful on systems that have UEFI firmware.
786
787 config CC_HAVE_STACKPROTECTOR_TLS
788 def_bool $(cc-option,-mstack-protector-guard=tls -mstack-protector-guard-reg=tp -mstack-protector-guard-offset=0)
789
790 config STACKPROTECTOR_PER_TASK
791 def_bool y
792 depends on !RANDSTRUCT
793 depends on STACKPROTECTOR && CC_HAVE_STACKPROTECTOR_TLS
794
795 config PHYS_RAM_BASE_FIXED
796 bool "Explicitly specified physical RAM address"
797 depends on NONPORTABLE
798 default n
799
800 config PHYS_RAM_BASE
801 hex "Platform Physical RAM address"
802 depends on PHYS_RAM_BASE_FIXED
803 default "0x80000000"
804 help
805 This is the physical address of RAM in the system. It has to be
806 explicitly specified to run early relocations of read-write data
807 from flash to RAM.
808
809 config XIP_KERNEL
810 bool "Kernel Execute-In-Place from ROM"
811 depends on MMU && SPARSEMEM && NONPORTABLE
812 # This prevents XIP from being enabled by all{yes,mod}config, which
813 # fail to build since XIP doesn't support large kernels.
814 depends on !COMPILE_TEST
815 select PHYS_RAM_BASE_FIXED
816 help
817 Execute-In-Place allows the kernel to run from non-volatile storage
818 directly addressable by the CPU, such as NOR flash. This saves RAM
819 space since the text section of the kernel is not loaded from flash
820 to RAM. Read-write sections, such as the data section and stack,
821 are still copied to RAM. The XIP kernel is not compressed since
822 it has to run directly from flash, so it will take more space to
823 store it. The flash address used to link the kernel object files,
824 and for storing it, is configuration dependent. Therefore, if you
825 say Y here, you must know the proper physical address where to
826 store the kernel image depending on your own flash memory usage.
827
828 Also note that the make target becomes "make xipImage" rather than
829 "make zImage" or "make Image". The final kernel binary to put in
830 ROM memory will be arch/riscv/boot/xipImage.
831
832 SPARSEMEM is required because the kernel text and rodata that are
833 flash resident are not backed by memmap, then any attempt to get
834 a struct page on those regions will trigger a fault.
835
836 If unsure, say N.
837
838 config XIP_PHYS_ADDR
839 hex "XIP Kernel Physical Location"
840 depends on XIP_KERNEL
841 default "0x21000000"
842 help
843 This is the physical address in your flash memory the kernel will
844 be linked for and stored to. This address is dependent on your
845 own flash usage.
846
847 endmenu # "Boot options"
848
849 config BUILTIN_DTB
850 bool
851 depends on OF && NONPORTABLE
852 default y if XIP_KERNEL
853
854 config PORTABLE
855 bool
856 default !NONPORTABLE
857 select EFI
858 select MMU
859 select OF
860
861 menu "Power management options"
862
863 source "kernel/power/Kconfig"
864
865 # Hibernation is only possible on systems where the SBI implementation has
866 # marked its reserved memory as not accessible from, or does not run
867 # from the same memory as, Linux
868 config ARCH_HIBERNATION_POSSIBLE
869 def_bool NONPORTABLE
870
871 config ARCH_HIBERNATION_HEADER
872 def_bool HIBERNATION
873
874 endmenu # "Power management options"
875
876 menu "CPU Power Management"
877
878 source "drivers/cpuidle/Kconfig"
879
880 source "drivers/cpufreq/Kconfig"
881
882 endmenu # "CPU Power Management"
883
884 source "arch/riscv/kvm/Kconfig"
885
886 source "drivers/acpi/Kconfig"