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 7config 64BIT 8 bool 9 10config 32BIT 11 bool 12 13config RISCV 14 def_bool y 15 select ARCH_CLOCKSOURCE_INIT 16 select ARCH_SUPPORTS_ATOMIC_RMW 17 select ARCH_STACKWALK 18 select ARCH_HAS_BINFMT_FLAT 19 select ARCH_HAS_DEBUG_VM_PGTABLE 20 select ARCH_HAS_DEBUG_VIRTUAL if MMU 21 select ARCH_HAS_DEBUG_WX 22 select ARCH_HAS_GCOV_PROFILE_ALL 23 select ARCH_HAS_GIGANTIC_PAGE 24 select ARCH_HAS_KCOV 25 select ARCH_HAS_MMIOWB 26 select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE 27 select ARCH_HAS_PTE_SPECIAL 28 select ARCH_HAS_SET_DIRECT_MAP 29 select ARCH_HAS_SET_MEMORY 30 select ARCH_HAS_STRICT_KERNEL_RWX if MMU 31 select ARCH_OPTIONAL_KERNEL_RWX if ARCH_HAS_STRICT_KERNEL_RWX 32 select ARCH_OPTIONAL_KERNEL_RWX_DEFAULT 33 select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU 34 select ARCH_WANT_FRAME_POINTERS 35 select ARCH_WANT_HUGE_PMD_SHARE if 64BIT 36 select CLONE_BACKWARDS 37 select CLINT_TIMER if !MMU 38 select COMMON_CLK 39 select EDAC_SUPPORT 40 select GENERIC_ARCH_TOPOLOGY 41 select GENERIC_ATOMIC64 if !64BIT 42 select GENERIC_CLOCKEVENTS 43 select GENERIC_EARLY_IOREMAP 44 select GENERIC_GETTIMEOFDAY if HAVE_GENERIC_VDSO 45 select GENERIC_IOREMAP 46 select GENERIC_IRQ_MULTI_HANDLER 47 select GENERIC_IRQ_SHOW 48 select GENERIC_PCI_IOMAP 49 select GENERIC_PTDUMP if MMU 50 select GENERIC_SCHED_CLOCK 51 select GENERIC_SMP_IDLE_THREAD 52 select GENERIC_STRNCPY_FROM_USER if MMU 53 select GENERIC_STRNLEN_USER if MMU 54 select GENERIC_TIME_VSYSCALL if MMU && 64BIT 55 select HANDLE_DOMAIN_IRQ 56 select HAVE_ARCH_AUDITSYSCALL 57 select HAVE_ARCH_JUMP_LABEL 58 select HAVE_ARCH_JUMP_LABEL_RELATIVE 59 select HAVE_ARCH_KASAN if MMU && 64BIT 60 select HAVE_ARCH_KGDB 61 select HAVE_ARCH_KGDB_QXFER_PKT 62 select HAVE_ARCH_MMAP_RND_BITS if MMU 63 select HAVE_ARCH_SECCOMP_FILTER 64 select HAVE_ARCH_TRACEHOOK 65 select HAVE_ASM_MODVERSIONS 66 select HAVE_CONTEXT_TRACKING 67 select HAVE_DEBUG_KMEMLEAK 68 select HAVE_DMA_CONTIGUOUS if MMU 69 select HAVE_EBPF_JIT if MMU 70 select HAVE_FUTEX_CMPXCHG if FUTEX 71 select HAVE_GCC_PLUGINS 72 select HAVE_GENERIC_VDSO if MMU && 64BIT 73 select HAVE_PCI 74 select HAVE_PERF_EVENTS 75 select HAVE_PERF_REGS 76 select HAVE_PERF_USER_STACK_DUMP 77 select HAVE_STACKPROTECTOR 78 select HAVE_SYSCALL_TRACEPOINTS 79 select IRQ_DOMAIN 80 select MODULES_USE_ELF_RELA if MODULES 81 select MODULE_SECTIONS if MODULES 82 select OF 83 select OF_EARLY_FLATTREE 84 select OF_IRQ 85 select PCI_DOMAINS_GENERIC if PCI 86 select PCI_MSI if PCI 87 select RISCV_INTC 88 select RISCV_TIMER if RISCV_SBI 89 select SPARSE_IRQ 90 select SYSCTL_EXCEPTION_TRACE 91 select THREAD_INFO_IN_TASK 92 select UACCESS_MEMCPY if !MMU 93 94config ARCH_MMAP_RND_BITS_MIN 95 default 18 if 64BIT 96 default 8 97 98# max bits determined by the following formula: 99# VA_BITS - PAGE_SHIFT - 3 100config ARCH_MMAP_RND_BITS_MAX 101 default 24 if 64BIT # SV39 based 102 default 17 103 104# set if we run in machine mode, cleared if we run in supervisor mode 105config RISCV_M_MODE 106 bool 107 default !MMU 108 109# set if we are running in S-mode and can use SBI calls 110config RISCV_SBI 111 bool 112 depends on !RISCV_M_MODE 113 default y 114 115config MMU 116 bool "MMU-based Paged Memory Management Support" 117 default y 118 help 119 Select if you want MMU-based virtualised addressing space 120 support by paged memory management. If unsure, say 'Y'. 121 122config ZONE_DMA32 123 bool 124 default y if 64BIT 125 126config VA_BITS 127 int 128 default 32 if 32BIT 129 default 39 if 64BIT 130 131config PA_BITS 132 int 133 default 34 if 32BIT 134 default 56 if 64BIT 135 136config PAGE_OFFSET 137 hex 138 default 0xC0000000 if 32BIT && MAXPHYSMEM_1GB 139 default 0x80000000 if 64BIT && !MMU 140 default 0xffffffff80000000 if 64BIT && MAXPHYSMEM_2GB 141 default 0xffffffe000000000 if 64BIT && MAXPHYSMEM_128GB 142 143config KASAN_SHADOW_OFFSET 144 hex 145 depends on KASAN_GENERIC 146 default 0xdfffffc800000000 if 64BIT 147 default 0xffffffff if 32BIT 148 149config ARCH_FLATMEM_ENABLE 150 def_bool y 151 152config ARCH_SPARSEMEM_ENABLE 153 def_bool y 154 depends on MMU 155 select SPARSEMEM_STATIC if 32BIT && SPARSEMEM 156 select SPARSEMEM_VMEMMAP_ENABLE if 64BIT 157 158config ARCH_SELECT_MEMORY_MODEL 159 def_bool ARCH_SPARSEMEM_ENABLE 160 161config ARCH_WANT_GENERAL_HUGETLB 162 def_bool y 163 164config ARCH_SUPPORTS_DEBUG_PAGEALLOC 165 def_bool y 166 167config SYS_SUPPORTS_HUGETLBFS 168 depends on MMU 169 def_bool y 170 171config STACKTRACE_SUPPORT 172 def_bool y 173 174config TRACE_IRQFLAGS_SUPPORT 175 def_bool y 176 177config GENERIC_BUG 178 def_bool y 179 depends on BUG 180 select GENERIC_BUG_RELATIVE_POINTERS if 64BIT 181 182config GENERIC_BUG_RELATIVE_POINTERS 183 bool 184 185config GENERIC_CALIBRATE_DELAY 186 def_bool y 187 188config GENERIC_CSUM 189 def_bool y 190 191config GENERIC_HWEIGHT 192 def_bool y 193 194config FIX_EARLYCON_MEM 195 def_bool MMU 196 197config PGTABLE_LEVELS 198 int 199 default 3 if 64BIT 200 default 2 201 202config LOCKDEP_SUPPORT 203 def_bool y 204 205source "arch/riscv/Kconfig.socs" 206 207menu "Platform type" 208 209choice 210 prompt "Base ISA" 211 default ARCH_RV64I 212 help 213 This selects the base ISA that this kernel will target and must match 214 the target platform. 215 216config ARCH_RV32I 217 bool "RV32I" 218 select 32BIT 219 select GENERIC_LIB_ASHLDI3 220 select GENERIC_LIB_ASHRDI3 221 select GENERIC_LIB_LSHRDI3 222 select GENERIC_LIB_UCMPDI2 223 select MMU 224 225config ARCH_RV64I 226 bool "RV64I" 227 select 64BIT 228 select ARCH_SUPPORTS_INT128 if CC_HAS_INT128 && GCC_VERSION >= 50000 229 select HAVE_DYNAMIC_FTRACE if MMU 230 select HAVE_DYNAMIC_FTRACE_WITH_REGS if HAVE_DYNAMIC_FTRACE 231 select HAVE_FTRACE_MCOUNT_RECORD 232 select HAVE_FUNCTION_GRAPH_TRACER 233 select HAVE_FUNCTION_TRACER 234 select SWIOTLB if MMU 235 236endchoice 237 238# We must be able to map all physical memory into the kernel, but the compiler 239# is still a bit more efficient when generating code if it's setup in a manner 240# such that it can only map 2GiB of memory. 241choice 242 prompt "Kernel Code Model" 243 default CMODEL_MEDLOW if 32BIT 244 default CMODEL_MEDANY if 64BIT 245 246 config CMODEL_MEDLOW 247 bool "medium low code model" 248 config CMODEL_MEDANY 249 bool "medium any code model" 250endchoice 251 252config MODULE_SECTIONS 253 bool 254 select HAVE_MOD_ARCH_SPECIFIC 255 256choice 257 prompt "Maximum Physical Memory" 258 default MAXPHYSMEM_1GB if 32BIT 259 default MAXPHYSMEM_2GB if 64BIT && CMODEL_MEDLOW 260 default MAXPHYSMEM_128GB if 64BIT && CMODEL_MEDANY 261 262 config MAXPHYSMEM_1GB 263 depends on 32BIT 264 bool "1GiB" 265 config MAXPHYSMEM_2GB 266 depends on 64BIT && CMODEL_MEDLOW 267 bool "2GiB" 268 config MAXPHYSMEM_128GB 269 depends on 64BIT && CMODEL_MEDANY 270 bool "128GiB" 271endchoice 272 273 274config SMP 275 bool "Symmetric Multi-Processing" 276 help 277 This enables support for systems with more than one CPU. If 278 you say N here, the kernel will run on single and 279 multiprocessor machines, but will use only one CPU of a 280 multiprocessor machine. If you say Y here, the kernel will run 281 on many, but not all, single processor machines. On a single 282 processor machine, the kernel will run faster if you say N 283 here. 284 285 If you don't know what to do here, say N. 286 287config NR_CPUS 288 int "Maximum number of CPUs (2-32)" 289 range 2 32 290 depends on SMP 291 default "8" 292 293config HOTPLUG_CPU 294 bool "Support for hot-pluggable CPUs" 295 depends on SMP 296 select GENERIC_IRQ_MIGRATION 297 help 298 299 Say Y here to experiment with turning CPUs off and on. CPUs 300 can be controlled through /sys/devices/system/cpu. 301 302 Say N if you want to disable CPU hotplug. 303 304choice 305 prompt "CPU Tuning" 306 default TUNE_GENERIC 307 308config TUNE_GENERIC 309 bool "generic" 310 311endchoice 312 313config RISCV_ISA_C 314 bool "Emit compressed instructions when building Linux" 315 default y 316 help 317 Adds "C" to the ISA subsets that the toolchain is allowed to emit 318 when building Linux, which results in compressed instructions in the 319 Linux binary. 320 321 If you don't know what to do here, say Y. 322 323menu "supported PMU type" 324 depends on PERF_EVENTS 325 326config RISCV_BASE_PMU 327 bool "Base Performance Monitoring Unit" 328 def_bool y 329 help 330 A base PMU that serves as a reference implementation and has limited 331 feature of perf. It can run on any RISC-V machines so serves as the 332 fallback, but this option can also be disable to reduce kernel size. 333 334endmenu 335 336config TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI 337 def_bool y 338 # https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=aed44286efa8ae8717a77d94b51ac3614e2ca6dc 339 depends on AS_IS_GNU && AS_VERSION >= 23800 340 help 341 Newer binutils versions default to ISA spec version 20191213 which 342 moves some instructions from the I extension to the Zicsr and Zifencei 343 extensions. 344 345config TOOLCHAIN_NEEDS_OLD_ISA_SPEC 346 def_bool y 347 depends on TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI 348 # https://github.com/llvm/llvm-project/commit/22e199e6afb1263c943c0c0d4498694e15bf8a16 349 depends on CC_IS_CLANG && CLANG_VERSION < 170000 350 help 351 Certain versions of clang do not support zicsr and zifencei via -march 352 but newer versions of binutils require it for the reasons noted in the 353 help text of CONFIG_TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI. This 354 option causes an older ISA spec compatible with these older versions 355 of clang to be passed to GAS, which has the same result as passing zicsr 356 and zifencei to -march. 357 358config FPU 359 bool "FPU support" 360 default y 361 help 362 Say N here if you want to disable all floating-point related procedure 363 in the kernel. 364 365 If you don't know what to do here, say Y. 366 367endmenu 368 369menu "Kernel features" 370 371source "kernel/Kconfig.hz" 372 373config RISCV_SBI_V01 374 bool "SBI v0.1 support" 375 default y 376 depends on RISCV_SBI 377 help 378 This config allows kernel to use SBI v0.1 APIs. This will be 379 deprecated in future once legacy M-mode software are no longer in use. 380endmenu 381 382menu "Boot options" 383 384config CMDLINE 385 string "Built-in kernel command line" 386 help 387 For most platforms, the arguments for the kernel's command line 388 are provided at run-time, during boot. However, there are cases 389 where either no arguments are being provided or the provided 390 arguments are insufficient or even invalid. 391 392 When that occurs, it is possible to define a built-in command 393 line here and choose how the kernel should use it later on. 394 395choice 396 prompt "Built-in command line usage" if CMDLINE != "" 397 default CMDLINE_FALLBACK 398 help 399 Choose how the kernel will handle the provided built-in command 400 line. 401 402config CMDLINE_FALLBACK 403 bool "Use bootloader kernel arguments if available" 404 help 405 Use the built-in command line as fallback in case we get nothing 406 during boot. This is the default behaviour. 407 408config CMDLINE_EXTEND 409 bool "Extend bootloader kernel arguments" 410 help 411 The command-line arguments provided during boot will be 412 appended to the built-in command line. This is useful in 413 cases where the provided arguments are insufficient and 414 you don't want to or cannot modify them. 415 416 417config CMDLINE_FORCE 418 bool "Always use the default kernel command string" 419 help 420 Always use the built-in command line, even if we get one during 421 boot. This is useful in case you need to override the provided 422 command line on systems where you don't have or want control 423 over it. 424 425endchoice 426 427config EFI_STUB 428 bool 429 430config EFI 431 bool "UEFI runtime support" 432 depends on OF 433 select LIBFDT 434 select UCS2_STRING 435 select EFI_PARAMS_FROM_FDT 436 select EFI_STUB 437 select EFI_GENERIC_STUB 438 select EFI_RUNTIME_WRAPPERS 439 select RISCV_ISA_C 440 depends on MMU 441 default y 442 help 443 This option provides support for runtime services provided 444 by UEFI firmware (such as non-volatile variables, realtime 445 clock, and platform reset). A UEFI stub is also provided to 446 allow the kernel to be booted as an EFI application. This 447 is only useful on systems that have UEFI firmware. 448 449endmenu 450 451config BUILTIN_DTB 452 def_bool n 453 depends on RISCV_M_MODE 454 depends on OF 455 456menu "Power management options" 457 458source "kernel/power/Kconfig" 459 460endmenu 461 462source "drivers/firmware/Kconfig" 463