]> Git Repo - linux.git/blame - arch/riscv/Kconfig
Merge tag 'vfs-6.8.cachefiles' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs
[linux.git] / arch / riscv / Kconfig
CommitLineData
ec8f24b7 1# SPDX-License-Identifier: GPL-2.0-only
fbe934d6
PD
2#
3# For a description of the syntax of this configuration file,
cd238eff 4# see Documentation/kbuild/kconfig-language.rst.
fbe934d6
PD
5#
6
c3e4ed01
CH
7config 64BIT
8 bool
9
10config 32BIT
11 bool
12
fbe934d6
PD
13config RISCV
14 def_bool y
a91a9ffb
S
15 select ACPI_GENERIC_GSI if ACPI
16 select ACPI_REDUCED_HARDWARE_ONLY if ACPI
c00a60d6 17 select ARCH_DMA_DEFAULT_COHERENT
c24a1967 18 select ARCH_ENABLE_HUGEPAGE_MIGRATION if HUGETLB_PAGE && MIGRATION
5a7ac592 19 select ARCH_ENABLE_SPLIT_PMD_PTLOCK if PGTABLE_LEVELS > 2
5f365c13 20 select ARCH_ENABLE_THP_MIGRATION if TRANSPARENT_HUGEPAGE
ad97f9df 21 select ARCH_HAS_BINFMT_FLAT
fdecfea0 22 select ARCH_HAS_CURRENT_STACK_POINTER
e8c7ef7d 23 select ARCH_HAS_DEBUG_VIRTUAL if MMU
5f365c13 24 select ARCH_HAS_DEBUG_VM_PGTABLE
b422d28b 25 select ARCH_HAS_DEBUG_WX
95301414 26 select ARCH_HAS_FORTIFY_SOURCE
e8c7ef7d
PD
27 select ARCH_HAS_GCOV_PROFILE_ALL
28 select ARCH_HAS_GIGANTIC_PAGE
20d38f7c 29 select ARCH_HAS_KCOV
e8c7ef7d 30 select ARCH_HAS_MMIOWB
99a670b2 31 select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
a49ab905 32 select ARCH_HAS_PMEM_API
e8c7ef7d 33 select ARCH_HAS_PTE_SPECIAL
10cc3278
MR
34 select ARCH_HAS_SET_DIRECT_MAP if MMU
35 select ARCH_HAS_SET_MEMORY if MMU
44c92257
VW
36 select ARCH_HAS_STRICT_KERNEL_RWX if MMU && !XIP_KERNEL
37 select ARCH_HAS_STRICT_MODULE_RWX if MMU && !XIP_KERNEL
08d0ce30 38 select ARCH_HAS_SYSCALL_WRAPPER
2f100585 39 select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
8341dcfb 40 select ARCH_HAS_UBSAN_SANITIZE_ALL
aa5af0aa 41 select ARCH_HAS_VDSO_DATA
e8065df5 42 select ARCH_KEEP_MEMBLOCK if ACPI
fc0c769f
VC
43 select ARCH_OPTIONAL_KERNEL_RWX if ARCH_HAS_STRICT_KERNEL_RWX
44 select ARCH_OPTIONAL_KERNEL_RWX_DEFAULT
7f85b04b
JZ
45 select ARCH_STACKWALK
46 select ARCH_SUPPORTS_ATOMIC_RMW
74f8fc31 47 select ARCH_SUPPORTS_CFI_CLANG
7f85b04b 48 select ARCH_SUPPORTS_DEBUG_PAGEALLOC if MMU
855f9a8e 49 select ARCH_SUPPORTS_HUGETLBFS if MMU
34c0a5b0 50 select ARCH_SUPPORTS_PAGE_TABLE_CHECK if MMU
648321fa 51 select ARCH_SUPPORTS_PER_VMA_LOCK if MMU
d1584d79 52 select ARCH_SUPPORTS_SHADOW_CALL_STACK if HAVE_SHADOW_CALL_STACK
97a03108 53 select ARCH_USE_MEMTEST
c9c0b0ba 54 select ARCH_USE_QUEUED_RWLOCKS
af0ead42 55 select ARCH_USES_CFI_TRAPS if CFI_CLANG
e8c7ef7d 56 select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU
fbe934d6 57 select ARCH_WANT_FRAME_POINTERS
82a1a1f3 58 select ARCH_WANT_GENERAL_HUGETLB if !RISCV_ISA_SVNAPOT
e8c7ef7d 59 select ARCH_WANT_HUGE_PMD_SHARE if 64BIT
f4b71bff 60 select ARCH_WANT_LD_ORPHAN_WARN if !XIP_KERNEL
0b6f1582 61 select ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP
87f81e66 62 select ARCH_WANTS_THP_SWAP if HAVE_ARCH_TRANSPARENT_HUGEPAGE
09accc3a 63 select BINFMT_FLAT_NO_DATA_START_OFFSET if !MMU
54fed35f 64 select BUILDTIME_TABLE_SORT if MMU
d5be89a8 65 select CLINT_TIMER if !MMU
5f365c13 66 select CLONE_BACKWARDS
fbe934d6 67 select COMMON_CLK
c0317210 68 select CPU_PM if CPU_IDLE || HIBERNATION
e8c7ef7d 69 select EDAC_SUPPORT
9f944d2e 70 select FRAME_POINTER if PERF_EVENTS || (FUNCTION_TRACER && !DYNAMIC_FTRACE)
fbd92809 71 select GENERIC_ARCH_TOPOLOGY
e8c7ef7d 72 select GENERIC_ATOMIC64 if !64BIT
2f100585 73 select GENERIC_CLOCKEVENTS_BROADCAST if SMP
6262f661 74 select GENERIC_EARLY_IOREMAP
f0bddf50 75 select GENERIC_ENTRY
ad5d1122 76 select GENERIC_GETTIMEOFDAY if HAVE_GENERIC_VDSO
bcf11b5e 77 select GENERIC_IDLE_POLL_SETUP
8350229f 78 select GENERIC_IOREMAP if MMU
832f15f4
AP
79 select GENERIC_IRQ_IPI if SMP
80 select GENERIC_IRQ_IPI_MUX if SMP
e8c7ef7d 81 select GENERIC_IRQ_MULTI_HANDLER
fbe934d6 82 select GENERIC_IRQ_SHOW
ecd4916c 83 select GENERIC_IRQ_SHOW_LEVEL
78ed473c 84 select GENERIC_LIB_DEVMEM_IS_ALLOWED
fbe934d6 85 select GENERIC_PCI_IOMAP
e8c7ef7d 86 select GENERIC_PTDUMP if MMU
9b9afe4a 87 select GENERIC_SCHED_CLOCK
e8c7ef7d 88 select GENERIC_SMP_IDLE_THREAD
ad5d1122 89 select GENERIC_TIME_VSYSCALL if MMU && 64BIT
dffe11e2 90 select GENERIC_VDSO_TIME_NS if HAVE_GENERIC_VDSO
c45fc916 91 select HARDIRQS_SW_RESEND
fcbfe812 92 select HAS_IOPORT if MMU
efe75c49 93 select HAVE_ARCH_AUDITSYSCALL
be79afc7 94 select HAVE_ARCH_HUGE_VMALLOC if HAVE_ARCH_HUGE_VMAP
310f541a 95 select HAVE_ARCH_HUGE_VMAP if MMU && 64BIT && !XIP_KERNEL
42e0e0b4
JZ
96 select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL
97 select HAVE_ARCH_JUMP_LABEL_RELATIVE if !XIP_KERNEL
e8c7ef7d 98 select HAVE_ARCH_KASAN if MMU && 64BIT
e178d670 99 select HAVE_ARCH_KASAN_VMALLOC if MMU && 64BIT
47513f24 100 select HAVE_ARCH_KFENCE if MMU && 64BIT
42e0e0b4 101 select HAVE_ARCH_KGDB if !XIP_KERNEL
e8c7ef7d
PD
102 select HAVE_ARCH_KGDB_QXFER_PKT
103 select HAVE_ARCH_MMAP_RND_BITS if MMU
9be84592 104 select HAVE_ARCH_MMAP_RND_COMPAT_BITS if COMPAT
5340627e 105 select HAVE_ARCH_SECCOMP_FILTER
5f365c13 106 select HAVE_ARCH_THREAD_STRUCT_WHITELIST
e8c7ef7d 107 select HAVE_ARCH_TRACEHOOK
9b76d71f 108 select HAVE_ARCH_TRANSPARENT_HUGEPAGE if 64BIT && MMU
a2492ca8 109 select HAVE_ARCH_USERFAULTFD_MINOR if 64BIT && USERFAULTFD
31da94c2 110 select HAVE_ARCH_VMAP_STACK if MMU && 64BIT
2ff2b7ec 111 select HAVE_ASM_MODVERSIONS
24a9c541 112 select HAVE_CONTEXT_TRACKING_USER
cbb3d91d 113 select HAVE_DEBUG_KMEMLEAK
6bd33e1e 114 select HAVE_DMA_CONTIGUOUS if MMU
ab7fa6b0
JZ
115 select HAVE_DYNAMIC_FTRACE if !XIP_KERNEL && MMU && (CLANG_SUPPORTS_DYNAMIC_FTRACE || GCC_SUPPORTS_DYNAMIC_FTRACE)
116 select HAVE_DYNAMIC_FTRACE_WITH_REGS if HAVE_DYNAMIC_FTRACE
117 select HAVE_FTRACE_MCOUNT_RECORD if !XIP_KERNEL
118 select HAVE_FUNCTION_GRAPH_TRACER
4f6b6c2b 119 select HAVE_FUNCTION_GRAPH_RETVAL if HAVE_FUNCTION_GRAPH_TRACER
ab7fa6b0 120 select HAVE_FUNCTION_TRACER if !XIP_KERNEL && !PREEMPTION
e8c7ef7d 121 select HAVE_EBPF_JIT if MMU
5f365c13 122 select HAVE_FUNCTION_ARG_ACCESS_API
ee55ff80 123 select HAVE_FUNCTION_ERROR_INJECTION
20d38f7c 124 select HAVE_GCC_PLUGINS
ad5d1122 125 select HAVE_GENERIC_VDSO if MMU && 64BIT
31564b8b 126 select HAVE_IRQ_TIME_ACCOUNTING
42e0e0b4
JZ
127 select HAVE_KPROBES if !XIP_KERNEL
128 select HAVE_KPROBES_ON_FTRACE if !XIP_KERNEL
129 select HAVE_KRETPROBES if !XIP_KERNEL
f7584322
ND
130 # https://github.com/ClangBuiltLinux/linux/issues/1881
131 select HAVE_LD_DEAD_CODE_DATA_ELIMINATION if !LD_IS_LLD
3332f419
JZ
132 select HAVE_MOVE_PMD
133 select HAVE_MOVE_PUD
e8c7ef7d 134 select HAVE_PCI
178e9fc4 135 select HAVE_PERF_EVENTS
98a93b0b
MH
136 select HAVE_PERF_REGS
137 select HAVE_PERF_USER_STACK_DUMP
b60ca697 138 select HAVE_POSIX_CPU_TIMERS_TASK_WORK
4e90d052 139 select HAVE_PREEMPT_DYNAMIC_KEY if !XIP_KERNEL
dcdc7a53 140 select HAVE_REGS_AND_STACK_ACCESS_API
ab7fa6b0 141 select HAVE_RETHOOK if !XIP_KERNEL
5f365c13 142 select HAVE_RSEQ
f2c9699f 143 select HAVE_STACKPROTECTOR
5aeb1b36 144 select HAVE_SYSCALL_TRACEPOINTS
72b11aa7 145 select HOTPLUG_CORE_SYNC_DEAD if HOTPLUG_CPU
fbe934d6 146 select IRQ_DOMAIN
8165c6ae 147 select IRQ_FORCED_THREADING
864046c5 148 select KASAN_VMALLOC if KASAN
7267ef7b 149 select LOCK_MM_AND_FIND_VMA
fbe934d6 150 select MODULES_USE_ELF_RELA if MODULES
2cffc956 151 select MODULE_SECTIONS if MODULES
e8c7ef7d
PD
152 select OF
153 select OF_EARLY_FLATTREE
154 select OF_IRQ
2eac9c2d 155 select PCI_DOMAINS_GENERIC if PCI
eb01d42a 156 select PCI_MSI if PCI
1ee7fc3f 157 select RISCV_ALTERNATIVE if !XIP_KERNEL
e71ee06e 158 select RISCV_INTC
2bc3fc87 159 select RISCV_TIMER if RISCV_SBI
bf3d7b1d 160 select SIFIVE_PLIC
e8c7ef7d
PD
161 select SPARSE_IRQ
162 select SYSCTL_EXCEPTION_TRACE
163 select THREAD_INFO_IN_TASK
4aae683f 164 select TRACE_IRQFLAGS_SUPPORT
11129e8e 165 select UACCESS_MEMCPY if !MMU
63703f37 166 select ZONE_DMA32 if 64BIT
54c95a11 167
b3d6bdfe
NC
168config CLANG_SUPPORTS_DYNAMIC_FTRACE
169 def_bool CC_IS_CLANG
170 # https://github.com/llvm/llvm-project/commit/6ab8927931851bb42b2c93a00801dc499d7d9b1e
171 depends on CLANG_VERSION >= 130000
172 # https://github.com/ClangBuiltLinux/linux/issues/1817
173 depends on AS_IS_GNU || (AS_IS_LLVM && (LD_IS_LLD || LD_VERSION >= 23600))
174
175config GCC_SUPPORTS_DYNAMIC_FTRACE
176 def_bool CC_IS_GCC
177 depends on $(cc-option,-fpatchable-function-entry=8)
178
d1584d79
ST
179config HAVE_SHADOW_CALL_STACK
180 def_bool $(cc-option,-fsanitize=shadow-call-stack)
181 # https://github.com/riscv-non-isa/riscv-elf-psabi-doc/commit/a484e843e6eeb51f0cb7b8819e50da6d2444d769
182 depends on $(ld-option,--no-relax-gp)
183
54c95a11
AG
184config ARCH_MMAP_RND_BITS_MIN
185 default 18 if 64BIT
186 default 8
187
9be84592
GR
188config ARCH_MMAP_RND_COMPAT_BITS_MIN
189 default 8
190
54c95a11
AG
191# max bits determined by the following formula:
192# VA_BITS - PAGE_SHIFT - 3
193config ARCH_MMAP_RND_BITS_MAX
194 default 24 if 64BIT # SV39 based
195 default 17
fbe934d6 196
9be84592
GR
197config ARCH_MMAP_RND_COMPAT_BITS_MAX
198 default 17
199
a4c3733d
CH
200# set if we run in machine mode, cleared if we run in supervisor mode
201config RISCV_M_MODE
202 bool
6bd33e1e 203 default !MMU
a4c3733d 204
eded8bc6
DLM
205# set if we are running in S-mode and can use SBI calls
206config RISCV_SBI
207 bool
208 depends on !RISCV_M_MODE
209 default y
210
fbe934d6 211config MMU
6bd33e1e
CH
212 bool "MMU-based Paged Memory Management Support"
213 default y
214 help
215 Select if you want MMU-based virtualised addressing space
216 support by paged memory management. If unsure, say 'Y'.
fbe934d6 217
fbe934d6
PD
218config PAGE_OFFSET
219 hex
b5e2c507
YG
220 default 0xC0000000 if 32BIT && MMU
221 default 0x80000000 if !MMU
011f09d1 222 default 0xff60000000000000 if 64BIT
fbe934d6 223
54c5639d
AG
224config KASAN_SHADOW_OFFSET
225 hex
226 depends on KASAN_GENERIC
f7ae0233 227 default 0xdfffffff00000000 if 64BIT
54c5639d
AG
228 default 0xffffffff if 32BIT
229
d95f1a54 230config ARCH_FLATMEM_ENABLE
4f0e8eef 231 def_bool !NUMA
d95f1a54
LG
232
233config ARCH_SPARSEMEM_ENABLE
234 def_bool y
aa273420 235 depends on MMU
199fc6b8 236 select SPARSEMEM_STATIC if 32BIT && SPARSEMEM
a5406a7f 237 select SPARSEMEM_VMEMMAP_ENABLE if 64BIT
d95f1a54
LG
238
239config ARCH_SELECT_MEMORY_MODEL
240 def_bool ARCH_SPARSEMEM_ENABLE
241
74784081
GR
242config ARCH_SUPPORTS_UPROBES
243 def_bool y
244
fbe934d6
PD
245config STACKTRACE_SUPPORT
246 def_bool y
247
fbe934d6
PD
248config GENERIC_BUG
249 def_bool y
250 depends on BUG
251 select GENERIC_BUG_RELATIVE_POINTERS if 64BIT
252
253config GENERIC_BUG_RELATIVE_POINTERS
254 bool
255
256config GENERIC_CALIBRATE_DELAY
257 def_bool y
258
259config GENERIC_CSUM
260 def_bool y
261
262config GENERIC_HWEIGHT
263 def_bool y
264
f2c17aab 265config FIX_EARLYCON_MEM
0312a3d4 266 def_bool MMU
f2c17aab 267
fbe934d6
PD
268config PGTABLE_LEVELS
269 int
011f09d1 270 default 5 if 64BIT
fbe934d6
PD
271 default 2
272
3c469798
GR
273config LOCKDEP_SUPPORT
274 def_bool y
275
1631ba12
HS
276config RISCV_DMA_NONCOHERENT
277 bool
278 select ARCH_HAS_DMA_PREP_COHERENT
1631ba12 279 select ARCH_HAS_SETUP_DMA_OPS
5f365c13
CD
280 select ARCH_HAS_SYNC_DMA_FOR_CPU
281 select ARCH_HAS_SYNC_DMA_FOR_DEVICE
f51f7a0f 282 select DMA_BOUNCE_UNALIGNED_KMALLOC if SWIOTLB
1631ba12 283
b79f300c
LP
284config RISCV_NONSTANDARD_CACHE_OPS
285 bool
b79f300c
LP
286 help
287 This enables function pointer support for non-standard noncoherent
288 systems to handle cache management.
289
5ac43ab2
AJ
290config AS_HAS_INSN
291 def_bool $(as-instr,.insn r 51$(comma) 0$(comma) 0$(comma) t0$(comma) t0$(comma) zero)
292
e4bb020f
AC
293config AS_HAS_OPTION_ARCH
294 # https://reviews.llvm.org/D123515
295 def_bool y
296 depends on $(as-instr, .option arch$(comma) +m)
297 depends on !$(as-instr, .option arch$(comma) -i)
298
0cbb8a32 299source "arch/riscv/Kconfig.socs"
a3d095ac 300source "arch/riscv/Kconfig.errata"
0cbb8a32 301
fbe934d6
PD
302menu "Platform type"
303
44c1e84a
PD
304config NONPORTABLE
305 bool "Allow configurations that result in non-portable kernels"
306 help
307 RISC-V kernel binaries are compatible between all known systems
308 whenever possible, but there are some use cases that can only be
309 satisfied by configurations that result in kernel binaries that are
310 not portable between systems.
311
312 Selecting N does not guarantee kernels will be portable to all known
313 systems. Selecting any of the options guarded by NONPORTABLE will
314 result in kernel binaries that are unlikely to be portable between
315 systems.
316
317 If unsure, say N.
318
fbe934d6
PD
319choice
320 prompt "Base ISA"
321 default ARCH_RV64I
322 help
86cca81a 323 This selects the base ISA that this kernel will target and must match
fbe934d6
PD
324 the target platform.
325
326config ARCH_RV32I
327 bool "RV32I"
44c1e84a 328 depends on NONPORTABLE
fbe934d6 329 select 32BIT
e3d59805
MR
330 select GENERIC_LIB_ASHLDI3
331 select GENERIC_LIB_ASHRDI3
332 select GENERIC_LIB_LSHRDI3
8f79125d 333 select GENERIC_LIB_UCMPDI2
fbe934d6
PD
334
335config ARCH_RV64I
336 bool "RV64I"
fbe934d6 337 select 64BIT
d2075895 338 select ARCH_SUPPORTS_INT128 if CC_HAS_INT128
6bd33e1e 339 select SWIOTLB if MMU
fbe934d6
PD
340
341endchoice
342
343# We must be able to map all physical memory into the kernel, but the compiler
344# is still a bit more efficient when generating code if it's setup in a manner
345# such that it can only map 2GiB of memory.
346choice
347 prompt "Kernel Code Model"
348 default CMODEL_MEDLOW if 32BIT
349 default CMODEL_MEDANY if 64BIT
350
351 config CMODEL_MEDLOW
352 bool "medium low code model"
353 config CMODEL_MEDANY
354 bool "medium any code model"
355endchoice
356
ab1ef68e
ZL
357config MODULE_SECTIONS
358 bool
359 select HAVE_MOD_ARCH_SPECIFIC
360
fbe934d6
PD
361config SMP
362 bool "Symmetric Multi-Processing"
363 help
364 This enables support for systems with more than one CPU. If
365 you say N here, the kernel will run on single and
366 multiprocessor machines, but will use only one CPU of a
367 multiprocessor machine. If you say Y here, the kernel will run
368 on many, but not all, single processor machines. On a single
369 processor machine, the kernel will run faster if you say N
370 here.
371
372 If you don't know what to do here, say N.
373
8bf7b3b6
SS
374config SCHED_MC
375 bool "Multi-core scheduler support"
376 depends on SMP
377 help
378 Multi-core scheduler support improves the CPU scheduler's decision
379 making when dealing with multi-core CPU chips at a cost of slightly
380 increased overhead in some places. If unsure say N here.
381
fbe934d6 382config NR_CPUS
e623715f 383 int "Maximum number of CPUs (2-512)"
fbe934d6 384 depends on SMP
1d6b5ed4
SH
385 range 2 512 if !RISCV_SBI_V01
386 range 2 32 if RISCV_SBI_V01 && 32BIT
387 range 2 64 if RISCV_SBI_V01 && 64BIT
e623715f
AP
388 default "32" if 32BIT
389 default "64" if 64BIT
fbe934d6 390
f1e58583
AP
391config HOTPLUG_CPU
392 bool "Support for hot-pluggable CPUs"
393 depends on SMP
394 select GENERIC_IRQ_MIGRATION
395 help
396
397 Say Y here to experiment with turning CPUs off and on. CPUs
398 can be controlled through /sys/devices/system/cpu.
399
400 Say N if you want to disable CPU hotplug.
401
fbe934d6
PD
402choice
403 prompt "CPU Tuning"
404 default TUNE_GENERIC
405
406config TUNE_GENERIC
407 bool "generic"
408
409endchoice
410
4f0e8eef
AP
411# Common NUMA Features
412config NUMA
413 bool "NUMA Memory Allocation and Scheduler Support"
1adbc294 414 depends on SMP && MMU
5f365c13 415 select ARCH_SUPPORTS_NUMA_BALANCING
4f0e8eef 416 select GENERIC_ARCH_NUMA
5f365c13 417 select NEED_PER_CPU_EMBED_FIRST_CHUNK
4f0e8eef 418 select OF_NUMA
7ecd19cf 419 select USE_PERCPU_NUMA_NODE_ID
4f0e8eef
AP
420 help
421 Enable NUMA (Non-Uniform Memory Access) support.
422
423 The kernel will try to allocate memory used by a CPU on the
424 local memory of the CPU and add some more NUMA awareness to the kernel.
425
426config NODES_SHIFT
427 int "Maximum NUMA Nodes (as a power of 2)"
428 range 1 10
429 default "2"
a9ee6cf5 430 depends on NUMA
4f0e8eef
AP
431 help
432 Specify the maximum number of NUMA Nodes available on the target
433 system. Increases memory reserved to accommodate various tables.
434
e64f737a
HS
435config RISCV_ALTERNATIVE
436 bool
437 depends on !XIP_KERNEL
438 help
439 This Kconfig allows the kernel to automatically patch the
ff19a8de
AJ
440 erratum or cpufeature required by the execution platform at run
441 time. The code patching overhead is minimal, as it's only done
442 once at boot and once on each module load.
e64f737a 443
a35707c3
HS
444config RISCV_ALTERNATIVE_EARLY
445 bool
446 depends on RISCV_ALTERNATIVE
447 help
448 Allows early patching of the kernel for special errata
449
fbe934d6
PD
450config RISCV_ISA_C
451 bool "Emit compressed instructions when building Linux"
452 default y
453 help
2f66a3d0
JH
454 Adds "C" to the ISA subsets that the toolchain is allowed to emit
455 when building Linux, which results in compressed instructions in the
456 Linux binary.
fbe934d6 457
2f66a3d0 458 If you don't know what to do here, say Y.
fbe934d6 459
23ad288a 460config RISCV_ISA_SVNAPOT
5464912c 461 bool "Svnapot extension support for supervisor mode NAPOT pages"
23ad288a 462 depends on 64BIT && MMU
d34a6b71 463 depends on RISCV_ALTERNATIVE
23ad288a 464 default y
23ad288a 465 help
5464912c 466 Allow kernel to detect the Svnapot ISA-extension dynamically at boot
23ad288a
QP
467 time and enable its usage.
468
5464912c 469 The Svnapot extension is used to mark contiguous PTEs as a range
23ad288a
QP
470 of contiguous virtual-to-physical translations for a naturally
471 aligned power-of-2 (NAPOT) granularity larger than the base 4KB page
472 size. When HUGETLBFS is also selected this option unconditionally
473 allocates some memory for each NAPOT page size supported by the kernel.
474 When optimizing for low memory consumption and for platforms without
5464912c 475 the Svnapot extension, it may be better to say N here.
23ad288a
QP
476
477 If you don't know what to do here, say Y.
478
ff689fd2 479config RISCV_ISA_SVPBMT
5464912c 480 bool "Svpbmt extension support for supervisor mode page-based memory types"
ff689fd2 481 depends on 64BIT && MMU
1ee7fc3f 482 depends on RISCV_ALTERNATIVE
ff689fd2
HS
483 default y
484 help
5464912c 485 Adds support to dynamically detect the presence of the Svpbmt
924cbb8c
HS
486 ISA-extension (Supervisor-mode: page-based memory types) and
487 enable its usage.
488
489 The memory type for a page contains a combination of attributes
490 that indicate the cacheability, idempotency, and ordering
491 properties for access to that page.
ff689fd2 492
5464912c 493 The Svpbmt extension is only available on 64-bit cpus.
ff689fd2
HS
494
495 If you don't know what to do here, say Y.
496
fa8e7cce
GR
497config TOOLCHAIN_HAS_V
498 bool
499 default y
500 depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64iv)
501 depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32iv)
502 depends on LLD_VERSION >= 140000 || LD_VERSION >= 23800
503 depends on AS_HAS_OPTION_ARCH
504
505config RISCV_ISA_V
506 bool "VECTOR extension support"
507 depends on TOOLCHAIN_HAS_V
508 depends on FPU
509 select DYNAMIC_SIGFRAME
510 default y
511 help
512 Say N here if you want to disable all vector related procedure
513 in the kernel.
514
515 If you don't know what to do here, say Y.
516
517config RISCV_ISA_V_DEFAULT_ENABLE
518 bool "Enable userspace Vector by default"
519 depends on RISCV_ISA_V
520 default y
521 help
522 Say Y here if you want to enable Vector in userspace by default.
523 Otherwise, userspace has to make explicit prctl() call to enable
524 Vector, or enable it via the sysctl interface.
525
526 If you don't know what to do here, say Y.
527
b6fcdb19 528config TOOLCHAIN_HAS_ZBB
1631ba12 529 bool
b8c86872 530 default y
b6fcdb19
HS
531 depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64ima_zbb)
532 depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32ima_zbb)
533 depends on LLD_VERSION >= 150000 || LD_VERSION >= 23900
e4bb020f 534 depends on AS_HAS_OPTION_ARCH
b6fcdb19
HS
535
536config RISCV_ISA_ZBB
537 bool "Zbb extension support for bit manipulation instructions"
538 depends on TOOLCHAIN_HAS_ZBB
1ee7fc3f
CD
539 depends on MMU
540 depends on RISCV_ALTERNATIVE
b6fcdb19
HS
541 default y
542 help
543 Adds support to dynamically detect the presence of the ZBB
544 extension (basic bit manipulation) and enable its usage.
545
546 The Zbb extension provides instructions to accelerate a number
547 of bit-specific operations (count bit population, sign extending,
548 bitrotation, etc).
549
550 If you don't know what to do here, say Y.
1631ba12
HS
551
552config RISCV_ISA_ZICBOM
553 bool "Zicbom extension support for non-coherent DMA operation"
1ee7fc3f
CD
554 depends on MMU
555 depends on RISCV_ALTERNATIVE
1631ba12 556 default y
5f365c13 557 select RISCV_DMA_NONCOHERENT
381cae16 558 select DMA_DIRECT_REMAP
1631ba12
HS
559 help
560 Adds support to dynamically detect the presence of the ZICBOM
561 extension (Cache Block Management Operations) and enable its
562 usage.
563
564 The Zicbom extension can be used to handle for example
565 non-coherent DMA support on devices that need it.
566
567 If you don't know what to do here, say Y.
568
ab0f7746
AJ
569config RISCV_ISA_ZICBOZ
570 bool "Zicboz extension support for faster zeroing of memory"
d34a6b71
CD
571 depends on MMU
572 depends on RISCV_ALTERNATIVE
ab0f7746
AJ
573 default y
574 help
5464912c 575 Enable the use of the Zicboz extension (cbo.zero instruction)
ab0f7746
AJ
576 when available.
577
578 The Zicboz extension is used for faster zeroing of memory.
579
580 If you don't know what to do here, say Y.
581
aae538cd
CD
582config TOOLCHAIN_HAS_ZIHINTPAUSE
583 bool
584 default y
585 depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64ima_zihintpause)
586 depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32ima_zihintpause)
587 depends on LLD_VERSION >= 150000 || LD_VERSION >= 23600
588
e89c2e81
NC
589config TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI
590 def_bool y
591 # https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=aed44286efa8ae8717a77d94b51ac3614e2ca6dc
ca09f772
MX
592 # https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=98416dbb0a62579d4a7a4a76bab51b5b52fec2cd
593 depends on AS_IS_GNU && AS_VERSION >= 23600
e89c2e81 594 help
ca09f772
MX
595 Binutils-2.38 and GCC-12.1.0 bumped the default ISA spec to the newer
596 20191213 version, which moves some instructions from the I extension to
597 the Zicsr and Zifencei extensions. This requires explicitly specifying
598 Zicsr and Zifencei when binutils >= 2.38 or GCC >= 12.1.0. Zicsr
599 and Zifencei are supported in binutils from version 2.36 onwards.
600 To make life easier, and avoid forcing toolchains that default to a
601 newer ISA spec to version 2.2, relax the check to binutils >= 2.36.
ef21fa7c
MX
602 For clang < 17 or GCC < 11.3.0, for which this is not possible or need
603 special treatment, this is dealt with in TOOLCHAIN_NEEDS_OLD_ISA_SPEC.
e89c2e81
NC
604
605config TOOLCHAIN_NEEDS_OLD_ISA_SPEC
606 def_bool y
607 depends on TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI
608 # https://github.com/llvm/llvm-project/commit/22e199e6afb1263c943c0c0d4498694e15bf8a16
ef21fa7c
MX
609 # https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=d29f5d6ab513c52fd872f532c492e35ae9fd6671
610 depends on (CC_IS_CLANG && CLANG_VERSION < 170000) || (CC_IS_GCC && GCC_VERSION < 110300)
e89c2e81 611 help
ca09f772
MX
612 Certain versions of clang and GCC do not support zicsr and zifencei via
613 -march. This option causes an older ISA spec compatible with these older
614 versions of clang and GCC to be passed to GAS, which has the same result
615 as passing zicsr and zifencei to -march.
e89c2e81 616
9671f706
AK
617config FPU
618 bool "FPU support"
619 default y
620 help
621 Say N here if you want to disable all floating-point related procedure
622 in the kernel.
623
624 If you don't know what to do here, say Y.
625
163e76cc 626config IRQ_STACKS
dd69d07a 627 bool "Independent irq & softirq stacks" if EXPERT
163e76cc
GR
628 default y
629 select HAVE_IRQ_EXIT_ON_IRQ_STACK
dd69d07a 630 select HAVE_SOFTIRQ_ON_OWN_STACK
163e76cc 631 help
dd69d07a
GR
632 Add independent irq & softirq stacks for percpu to prevent kernel stack
633 overflows. We may save some memory footprint by disabling IRQ_STACKS.
163e76cc 634
a7555f6b
GR
635config THREAD_SIZE_ORDER
636 int "Kernel stack size (in power-of-two numbers of page size)" if VMAP_STACK && EXPERT
637 range 0 4
638 default 1 if 32BIT && !KASAN
639 default 3 if 64BIT && KASAN
640 default 2
641 help
642 Specify the Pages of thread stack size (from 4KB to 64KB), which also
643 affects irq stack size, which is equal to thread stack size.
644
7c832321
CL
645config RISCV_MISALIGNED
646 bool "Support misaligned load/store traps for kernel and userspace"
bc38f613 647 select SYSCTL_ARCH_UNALIGN_ALLOW
7c832321
CL
648 default y
649 help
650 Say Y here if you want the kernel to embed support for misaligned
651 load/store for both kernel and userspace. When disable, misaligned
652 accesses will generate SIGBUS in userspace and panic in kernel.
653
2f66a3d0 654endmenu # "Platform type"
fbe934d6 655
aef53f97 656menu "Kernel features"
fbe934d6 657
fbe934d6
PD
658source "kernel/Kconfig.hz"
659
efca1398
AP
660config RISCV_SBI_V01
661 bool "SBI v0.1 support"
efca1398
AP
662 depends on RISCV_SBI
663 help
664 This config allows kernel to use SBI v0.1 APIs. This will be
665 deprecated in future once legacy M-mode software are no longer in use.
fba8a867 666
2ffc48fc
AP
667config RISCV_BOOT_SPINWAIT
668 bool "Spinwait booting method"
669 depends on SMP
77d707a3 670 default y if RISCV_SBI_V01 || RISCV_M_MODE
2ffc48fc
AP
671 help
672 This enables support for booting Linux via spinwait method. In the
673 spinwait method, all cores randomly jump to Linux. One of the cores
674 gets chosen via lottery and all other keep spinning on a percpu
675 variable. This method cannot support CPU hotplug and sparse hartid
676 scheme. It should be only enabled for M-mode Linux or platforms relying
677 on older firmware without SBI HSM extension. All other platforms should
678 rely on ordered booting via SBI HSM extension which gets chosen
679 dynamically at runtime if the firmware supports it.
680
77d707a3
PD
681 Since spinwait is incompatible with sparse hart IDs, it requires
682 NR_CPUS be large enough to contain the physical hart ID of the first
683 hart to enter Linux.
684
685 If unsure what to do here, say N.
686
1f0d6efe 687config ARCH_SUPPORTS_KEXEC
c41bd251 688 def_bool y
1f0d6efe
ED
689
690config ARCH_SELECTS_KEXEC
691 def_bool y
692 depends on KEXEC
5f365c13 693 select HOTPLUG_CPU if SMP
fba8a867 694
1f0d6efe 695config ARCH_SUPPORTS_KEXEC_FILE
c41bd251 696 def_bool 64BIT
fba8a867 697
1f0d6efe
ED
698config ARCH_SELECTS_KEXEC_FILE
699 def_bool y
700 depends on KEXEC_FILE
5f365c13 701 select HAVE_IMA_KEXEC if IMA
6261586e 702 select KEXEC_ELF
6261586e 703
e6265fe7 704config ARCH_SUPPORTS_KEXEC_PURGATORY
c1ad12ee 705 def_bool ARCH_SUPPORTS_KEXEC_FILE
736e30af 706
1f0d6efe
ED
707config ARCH_SUPPORTS_CRASH_DUMP
708 def_bool y
fba8a867 709
39365395
BH
710config ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION
711 def_bool CRASH_CORE
712
9be84592
GR
713config COMPAT
714 bool "Kernel support for 32-bit U-mode"
715 default 64BIT
716 depends on 64BIT && MMU
717 help
718 This option enables support for a 32-bit U-mode running under a 64-bit
719 kernel at S-mode. riscv32-specific components such as system calls,
720 the user helper functions (vdso), signal rt_frame functions and the
721 ptrace interface are handled appropriately by the kernel.
722
723 If you want to execute 32-bit userspace applications, say Y.
724
39b33072
AG
725config RELOCATABLE
726 bool "Build a relocatable kernel"
727 depends on MMU && 64BIT && !XIP_KERNEL
728 help
729 This builds a kernel as a Position Independent Executable (PIE),
730 which retains all relocation metadata required to relocate the
731 kernel binary at runtime to a different virtual address than the
732 address it was linked at.
733 Since RISCV uses the RELA relocation format, this requires a
734 relocation pass at runtime even if the kernel is loaded at the
735 same address it was linked at.
736
737 If unsure, say N.
738
84fe419d
AG
739config RANDOMIZE_BASE
740 bool "Randomize the address of the kernel image"
741 select RELOCATABLE
742 depends on MMU && 64BIT && !XIP_KERNEL
743 help
744 Randomizes the virtual address at which the kernel image is
745 loaded, as a security feature that deters exploit attempts
746 relying on knowledge of the location of kernel internals.
747
748 It is the bootloader's job to provide entropy, by passing a
749 random u64 value in /chosen/kaslr-seed at kernel entry.
750
751 When booting via the UEFI stub, it will invoke the firmware's
752 EFI_RNG_PROTOCOL implementation (if available) to supply entropy
753 to the kernel proper. In addition, it will randomise the physical
754 location of the kernel Image as well.
755
756 If unsure, say N.
757
2f66a3d0 758endmenu # "Kernel features"
fbe934d6 759
aef53f97
NK
760menu "Boot options"
761
3aed8c43
NK
762config CMDLINE
763 string "Built-in kernel command line"
aef53f97 764 help
3aed8c43
NK
765 For most platforms, the arguments for the kernel's command line
766 are provided at run-time, during boot. However, there are cases
767 where either no arguments are being provided or the provided
768 arguments are insufficient or even invalid.
aef53f97 769
3aed8c43
NK
770 When that occurs, it is possible to define a built-in command
771 line here and choose how the kernel should use it later on.
aef53f97 772
3aed8c43
NK
773choice
774 prompt "Built-in command line usage" if CMDLINE != ""
775 default CMDLINE_FALLBACK
776 help
777 Choose how the kernel will handle the provided built-in command
778 line.
aef53f97 779
3aed8c43
NK
780config CMDLINE_FALLBACK
781 bool "Use bootloader kernel arguments if available"
aef53f97 782 help
3aed8c43
NK
783 Use the built-in command line as fallback in case we get nothing
784 during boot. This is the default behaviour.
785
786config CMDLINE_EXTEND
787 bool "Extend bootloader kernel arguments"
788 help
789 The command-line arguments provided during boot will be
790 appended to the built-in command line. This is useful in
791 cases where the provided arguments are insufficient and
792 you don't want to or cannot modify them.
793
aef53f97 794config CMDLINE_FORCE
3aed8c43 795 bool "Always use the default kernel command string"
aef53f97 796 help
3aed8c43
NK
797 Always use the built-in command line, even if we get one during
798 boot. This is useful in case you need to override the provided
799 command line on systems where you don't have or want control
800 over it.
aef53f97 801
3aed8c43 802endchoice
aef53f97 803
d7071743
AP
804config EFI_STUB
805 bool
806
807config EFI
808 bool "UEFI runtime support"
44c92257 809 depends on OF && !XIP_KERNEL
5f365c13
CD
810 depends on MMU
811 default y
a91a9ffb 812 select ARCH_SUPPORTS_ACPI if 64BIT
d7071743 813 select EFI_GENERIC_STUB
5f365c13 814 select EFI_PARAMS_FROM_FDT
b91540d5 815 select EFI_RUNTIME_WRAPPERS
5f365c13
CD
816 select EFI_STUB
817 select LIBFDT
d7071743 818 select RISCV_ISA_C
5f365c13 819 select UCS2_STRING
d7071743
AP
820 help
821 This option provides support for runtime services provided
822 by UEFI firmware (such as non-volatile variables, realtime
823 clock, and platform reset). A UEFI stub is also provided to
824 allow the kernel to be booted as an EFI application. This
825 is only useful on systems that have UEFI firmware.
826
fea2fed2
GR
827config CC_HAVE_STACKPROTECTOR_TLS
828 def_bool $(cc-option,-mstack-protector-guard=tls -mstack-protector-guard-reg=tp -mstack-protector-guard-offset=0)
829
830config STACKPROTECTOR_PER_TASK
831 def_bool y
595b893e 832 depends on !RANDSTRUCT
fea2fed2
GR
833 depends on STACKPROTECTOR && CC_HAVE_STACKPROTECTOR_TLS
834
867432be
AG
835config PHYS_RAM_BASE_FIXED
836 bool "Explicitly specified physical RAM address"
44c1e84a 837 depends on NONPORTABLE
867432be
AG
838 default n
839
44c92257
VW
840config PHYS_RAM_BASE
841 hex "Platform Physical RAM address"
867432be 842 depends on PHYS_RAM_BASE_FIXED
44c92257
VW
843 default "0x80000000"
844 help
845 This is the physical address of RAM in the system. It has to be
846 explicitly specified to run early relocations of read-write data
847 from flash to RAM.
848
849config XIP_KERNEL
850 bool "Kernel Execute-In-Place from ROM"
44c1e84a 851 depends on MMU && SPARSEMEM && NONPORTABLE
44c92257
VW
852 # This prevents XIP from being enabled by all{yes,mod}config, which
853 # fail to build since XIP doesn't support large kernels.
854 depends on !COMPILE_TEST
867432be 855 select PHYS_RAM_BASE_FIXED
44c92257
VW
856 help
857 Execute-In-Place allows the kernel to run from non-volatile storage
858 directly addressable by the CPU, such as NOR flash. This saves RAM
859 space since the text section of the kernel is not loaded from flash
860 to RAM. Read-write sections, such as the data section and stack,
861 are still copied to RAM. The XIP kernel is not compressed since
862 it has to run directly from flash, so it will take more space to
863 store it. The flash address used to link the kernel object files,
864 and for storing it, is configuration dependent. Therefore, if you
865 say Y here, you must know the proper physical address where to
866 store the kernel image depending on your own flash memory usage.
867
868 Also note that the make target becomes "make xipImage" rather than
869 "make zImage" or "make Image". The final kernel binary to put in
870 ROM memory will be arch/riscv/boot/xipImage.
871
872 SPARSEMEM is required because the kernel text and rodata that are
873 flash resident are not backed by memmap, then any attempt to get
874 a struct page on those regions will trigger a fault.
875
876 If unsure, say N.
877
878config XIP_PHYS_ADDR
879 hex "XIP Kernel Physical Location"
880 depends on XIP_KERNEL
881 default "0x21000000"
882 help
883 This is the physical address in your flash memory the kernel will
884 be linked for and stored to. This address is dependent on your
885 own flash usage.
886
496ea826
CD
887config RISCV_ISA_FALLBACK
888 bool "Permit falling back to parsing riscv,isa for extension support by default"
889 default y
890 help
891 Parsing the "riscv,isa" devicetree property has been deprecated and
892 replaced by a list of explicitly defined strings. For compatibility
893 with existing platforms, the kernel will fall back to parsing the
894 "riscv,isa" property if the replacements are not found.
895
896 Selecting N here will result in a kernel that does not use the
897 fallback, unless the commandline "riscv_isa_fallback" parameter is
898 present.
899
900 Please see the dt-binding, located at
901 Documentation/devicetree/bindings/riscv/extensions.yaml for details
902 on the replacement properties, "riscv,isa-base" and
903 "riscv,isa-extensions".
904
2f66a3d0 905endmenu # "Boot options"
aef53f97 906
2d268251 907config BUILTIN_DTB
44c92257 908 bool
44c1e84a 909 depends on OF && NONPORTABLE
44c92257 910 default y if XIP_KERNEL
2d268251 911
44c1e84a
PD
912config PORTABLE
913 bool
914 default !NONPORTABLE
915 select EFI
44c1e84a 916 select MMU
5f365c13 917 select OF
44c1e84a 918
e0c0a7c3
AS
919config ARCH_PROC_KCORE_TEXT
920 def_bool y
921
fbe934d6
PD
922menu "Power management options"
923
8636a1f9 924source "kernel/power/Kconfig"
fbe934d6 925
ed309ce5
CD
926# Hibernation is only possible on systems where the SBI implementation has
927# marked its reserved memory as not accessible from, or does not run
928# from the same memory as, Linux
c0317210 929config ARCH_HIBERNATION_POSSIBLE
ed309ce5 930 def_bool NONPORTABLE
c0317210
SJH
931
932config ARCH_HIBERNATION_HEADER
933 def_bool HIBERNATION
934
c1f048a6
SS
935config ARCH_SUSPEND_POSSIBLE
936 def_bool y
937
2f66a3d0 938endmenu # "Power management options"
d7071743 939
f6e64b66
AP
940menu "CPU Power Management"
941
942source "drivers/cpuidle/Kconfig"
943
effae0e3
LP
944source "drivers/cpufreq/Kconfig"
945
2f66a3d0 946endmenu # "CPU Power Management"
f6e64b66 947
99cdc6c1 948source "arch/riscv/kvm/Kconfig"
a91a9ffb
S
949
950source "drivers/acpi/Kconfig"
This page took 0.556987 seconds and 4 git commands to generate.