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_ENABLE_HUGEPAGE_MIGRATION if HUGETLB_PAGE && MIGRATION 17 select ARCH_ENABLE_SPLIT_PMD_PTLOCK if PGTABLE_LEVELS > 2 18 select ARCH_HAS_BINFMT_FLAT 19 select ARCH_HAS_CURRENT_STACK_POINTER 20 select ARCH_HAS_DEBUG_VM_PGTABLE 21 select ARCH_HAS_DEBUG_VIRTUAL if MMU 22 select ARCH_HAS_DEBUG_WX 23 select ARCH_HAS_FORTIFY_SOURCE 24 select ARCH_HAS_GCOV_PROFILE_ALL 25 select ARCH_HAS_GIGANTIC_PAGE 26 select ARCH_HAS_KCOV 27 select ARCH_HAS_MMIOWB 28 select ARCH_HAS_PTE_SPECIAL 29 select ARCH_HAS_SET_DIRECT_MAP if MMU 30 select ARCH_HAS_SET_MEMORY if MMU 31 select ARCH_HAS_STRICT_KERNEL_RWX if MMU && !XIP_KERNEL 32 select ARCH_HAS_STRICT_MODULE_RWX if MMU && !XIP_KERNEL 33 select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST 34 select ARCH_HAS_UBSAN_SANITIZE_ALL 35 select ARCH_OPTIONAL_KERNEL_RWX if ARCH_HAS_STRICT_KERNEL_RWX 36 select ARCH_OPTIONAL_KERNEL_RWX_DEFAULT 37 select ARCH_STACKWALK 38 select ARCH_SUPPORTS_ATOMIC_RMW 39 select ARCH_SUPPORTS_DEBUG_PAGEALLOC if MMU 40 select ARCH_SUPPORTS_HUGETLBFS if MMU 41 select ARCH_USE_MEMTEST 42 select ARCH_USE_QUEUED_RWLOCKS 43 select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU 44 select ARCH_WANT_FRAME_POINTERS 45 select ARCH_WANT_GENERAL_HUGETLB 46 select ARCH_WANT_HUGE_PMD_SHARE if 64BIT 47 select BINFMT_FLAT_NO_DATA_START_OFFSET if !MMU 48 select BUILDTIME_TABLE_SORT if MMU 49 select CLONE_BACKWARDS 50 select CLINT_TIMER if !MMU 51 select COMMON_CLK 52 select CPU_PM if CPU_IDLE 53 select EDAC_SUPPORT 54 select GENERIC_ARCH_TOPOLOGY if SMP 55 select GENERIC_ATOMIC64 if !64BIT 56 select GENERIC_CLOCKEVENTS_BROADCAST if SMP 57 select GENERIC_EARLY_IOREMAP 58 select GENERIC_GETTIMEOFDAY if HAVE_GENERIC_VDSO 59 select GENERIC_IDLE_POLL_SETUP 60 select GENERIC_IOREMAP if MMU 61 select GENERIC_IRQ_MULTI_HANDLER 62 select GENERIC_IRQ_SHOW 63 select GENERIC_IRQ_SHOW_LEVEL 64 select GENERIC_LIB_DEVMEM_IS_ALLOWED 65 select GENERIC_PCI_IOMAP 66 select GENERIC_PTDUMP if MMU 67 select GENERIC_SCHED_CLOCK 68 select GENERIC_SMP_IDLE_THREAD 69 select GENERIC_TIME_VSYSCALL if MMU && 64BIT 70 select GENERIC_VDSO_TIME_NS if HAVE_GENERIC_VDSO 71 select HAVE_ARCH_AUDITSYSCALL 72 select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL 73 select HAVE_ARCH_JUMP_LABEL_RELATIVE if !XIP_KERNEL 74 select HAVE_ARCH_KASAN if MMU && 64BIT 75 select HAVE_ARCH_KASAN_VMALLOC if MMU && 64BIT 76 select HAVE_ARCH_KFENCE if MMU && 64BIT 77 select HAVE_ARCH_KGDB if !XIP_KERNEL 78 select HAVE_ARCH_KGDB_QXFER_PKT 79 select HAVE_ARCH_MMAP_RND_BITS if MMU 80 select HAVE_ARCH_SECCOMP_FILTER 81 select HAVE_ARCH_TRACEHOOK 82 select HAVE_ARCH_TRANSPARENT_HUGEPAGE if 64BIT && MMU 83 select ARCH_ENABLE_THP_MIGRATION if TRANSPARENT_HUGEPAGE 84 select HAVE_ARCH_THREAD_STRUCT_WHITELIST 85 select HAVE_ARCH_VMAP_STACK if MMU && 64BIT 86 select HAVE_ASM_MODVERSIONS 87 select HAVE_CONTEXT_TRACKING 88 select HAVE_DEBUG_KMEMLEAK 89 select HAVE_DMA_CONTIGUOUS if MMU 90 select HAVE_EBPF_JIT if MMU 91 select HAVE_FUNCTION_ERROR_INJECTION 92 select HAVE_GCC_PLUGINS 93 select HAVE_GENERIC_VDSO if MMU && 64BIT 94 select HAVE_IRQ_TIME_ACCOUNTING 95 select HAVE_KPROBES if !XIP_KERNEL 96 select HAVE_KPROBES_ON_FTRACE if !XIP_KERNEL 97 select HAVE_KRETPROBES if !XIP_KERNEL 98 select HAVE_MOVE_PMD 99 select HAVE_MOVE_PUD 100 select HAVE_PCI 101 select HAVE_PERF_EVENTS 102 select HAVE_PERF_REGS 103 select HAVE_PERF_USER_STACK_DUMP 104 select HAVE_REGS_AND_STACK_ACCESS_API 105 select HAVE_FUNCTION_ARG_ACCESS_API 106 select HAVE_STACKPROTECTOR 107 select HAVE_SYSCALL_TRACEPOINTS 108 select HAVE_RSEQ 109 select IRQ_DOMAIN 110 select IRQ_FORCED_THREADING 111 select MODULES_USE_ELF_RELA if MODULES 112 select MODULE_SECTIONS if MODULES 113 select OF 114 select OF_EARLY_FLATTREE 115 select OF_IRQ 116 select PCI_DOMAINS_GENERIC if PCI 117 select PCI_MSI if PCI 118 select RISCV_INTC 119 select RISCV_TIMER if RISCV_SBI 120 select SPARSE_IRQ 121 select SYSCTL_EXCEPTION_TRACE 122 select THREAD_INFO_IN_TASK 123 select TRACE_IRQFLAGS_SUPPORT 124 select UACCESS_MEMCPY if !MMU 125 select ZONE_DMA32 if 64BIT 126 127config ARCH_MMAP_RND_BITS_MIN 128 default 18 if 64BIT 129 default 8 130 131# max bits determined by the following formula: 132# VA_BITS - PAGE_SHIFT - 3 133config ARCH_MMAP_RND_BITS_MAX 134 default 24 if 64BIT # SV39 based 135 default 17 136 137# set if we run in machine mode, cleared if we run in supervisor mode 138config RISCV_M_MODE 139 bool 140 default !MMU 141 142# set if we are running in S-mode and can use SBI calls 143config RISCV_SBI 144 bool 145 depends on !RISCV_M_MODE 146 default y 147 148config MMU 149 bool "MMU-based Paged Memory Management Support" 150 default y 151 help 152 Select if you want MMU-based virtualised addressing space 153 support by paged memory management. If unsure, say 'Y'. 154 155config PAGE_OFFSET 156 hex 157 default 0xC0000000 if 32BIT 158 default 0x80000000 if 64BIT && !MMU 159 default 0xff60000000000000 if 64BIT 160 161config KASAN_SHADOW_OFFSET 162 hex 163 depends on KASAN_GENERIC 164 default 0xdfffffff00000000 if 64BIT 165 default 0xffffffff if 32BIT 166 167config ARCH_FLATMEM_ENABLE 168 def_bool !NUMA 169 170config ARCH_SPARSEMEM_ENABLE 171 def_bool y 172 depends on MMU 173 select SPARSEMEM_STATIC if 32BIT && SPARSEMEM 174 select SPARSEMEM_VMEMMAP_ENABLE if 64BIT 175 176config ARCH_SELECT_MEMORY_MODEL 177 def_bool ARCH_SPARSEMEM_ENABLE 178 179config ARCH_SUPPORTS_UPROBES 180 def_bool y 181 182config STACKTRACE_SUPPORT 183 def_bool y 184 185config GENERIC_BUG 186 def_bool y 187 depends on BUG 188 select GENERIC_BUG_RELATIVE_POINTERS if 64BIT 189 190config GENERIC_BUG_RELATIVE_POINTERS 191 bool 192 193config GENERIC_CALIBRATE_DELAY 194 def_bool y 195 196config GENERIC_CSUM 197 def_bool y 198 199config GENERIC_HWEIGHT 200 def_bool y 201 202config FIX_EARLYCON_MEM 203 def_bool MMU 204 205config PGTABLE_LEVELS 206 int 207 default 5 if 64BIT 208 default 2 209 210config LOCKDEP_SUPPORT 211 def_bool y 212 213source "arch/riscv/Kconfig.socs" 214source "arch/riscv/Kconfig.erratas" 215 216menu "Platform type" 217 218choice 219 prompt "Base ISA" 220 default ARCH_RV64I 221 help 222 This selects the base ISA that this kernel will target and must match 223 the target platform. 224 225config ARCH_RV32I 226 bool "RV32I" 227 select 32BIT 228 select GENERIC_LIB_ASHLDI3 229 select GENERIC_LIB_ASHRDI3 230 select GENERIC_LIB_LSHRDI3 231 select GENERIC_LIB_UCMPDI2 232 select MMU 233 234config ARCH_RV64I 235 bool "RV64I" 236 select 64BIT 237 select ARCH_SUPPORTS_INT128 if CC_HAS_INT128 238 select HAVE_DYNAMIC_FTRACE if !XIP_KERNEL && MMU && $(cc-option,-fpatchable-function-entry=8) 239 select HAVE_DYNAMIC_FTRACE_WITH_REGS if HAVE_DYNAMIC_FTRACE 240 select HAVE_FTRACE_MCOUNT_RECORD if !XIP_KERNEL 241 select HAVE_FUNCTION_GRAPH_TRACER 242 select HAVE_FUNCTION_TRACER if !XIP_KERNEL 243 select SWIOTLB if MMU 244 245endchoice 246 247# We must be able to map all physical memory into the kernel, but the compiler 248# is still a bit more efficient when generating code if it's setup in a manner 249# such that it can only map 2GiB of memory. 250choice 251 prompt "Kernel Code Model" 252 default CMODEL_MEDLOW if 32BIT 253 default CMODEL_MEDANY if 64BIT 254 255 config CMODEL_MEDLOW 256 bool "medium low code model" 257 config CMODEL_MEDANY 258 bool "medium any code model" 259endchoice 260 261config MODULE_SECTIONS 262 bool 263 select HAVE_MOD_ARCH_SPECIFIC 264 265config SMP 266 bool "Symmetric Multi-Processing" 267 help 268 This enables support for systems with more than one CPU. If 269 you say N here, the kernel will run on single and 270 multiprocessor machines, but will use only one CPU of a 271 multiprocessor machine. If you say Y here, the kernel will run 272 on many, but not all, single processor machines. On a single 273 processor machine, the kernel will run faster if you say N 274 here. 275 276 If you don't know what to do here, say N. 277 278config NR_CPUS 279 int "Maximum number of CPUs (2-32)" 280 range 2 32 281 depends on SMP 282 default "8" 283 284config HOTPLUG_CPU 285 bool "Support for hot-pluggable CPUs" 286 depends on SMP 287 select GENERIC_IRQ_MIGRATION 288 help 289 290 Say Y here to experiment with turning CPUs off and on. CPUs 291 can be controlled through /sys/devices/system/cpu. 292 293 Say N if you want to disable CPU hotplug. 294 295choice 296 prompt "CPU Tuning" 297 default TUNE_GENERIC 298 299config TUNE_GENERIC 300 bool "generic" 301 302endchoice 303 304# Common NUMA Features 305config NUMA 306 bool "NUMA Memory Allocation and Scheduler Support" 307 depends on SMP && MMU 308 select GENERIC_ARCH_NUMA 309 select OF_NUMA 310 select ARCH_SUPPORTS_NUMA_BALANCING 311 select USE_PERCPU_NUMA_NODE_ID 312 select NEED_PER_CPU_EMBED_FIRST_CHUNK 313 help 314 Enable NUMA (Non-Uniform Memory Access) support. 315 316 The kernel will try to allocate memory used by a CPU on the 317 local memory of the CPU and add some more NUMA awareness to the kernel. 318 319config NODES_SHIFT 320 int "Maximum NUMA Nodes (as a power of 2)" 321 range 1 10 322 default "2" 323 depends on NUMA 324 help 325 Specify the maximum number of NUMA Nodes available on the target 326 system. Increases memory reserved to accommodate various tables. 327 328config RISCV_ISA_C 329 bool "Emit compressed instructions when building Linux" 330 default y 331 help 332 Adds "C" to the ISA subsets that the toolchain is allowed to emit 333 when building Linux, which results in compressed instructions in the 334 Linux binary. 335 336 If you don't know what to do here, say Y. 337 338config FPU 339 bool "FPU support" 340 default y 341 help 342 Say N here if you want to disable all floating-point related procedure 343 in the kernel. 344 345 If you don't know what to do here, say Y. 346 347endmenu 348 349menu "Kernel features" 350 351source "kernel/Kconfig.hz" 352 353config RISCV_SBI_V01 354 bool "SBI v0.1 support" 355 depends on RISCV_SBI 356 help 357 This config allows kernel to use SBI v0.1 APIs. This will be 358 deprecated in future once legacy M-mode software are no longer in use. 359 360config RISCV_BOOT_SPINWAIT 361 bool "Spinwait booting method" 362 depends on SMP 363 default y 364 help 365 This enables support for booting Linux via spinwait method. In the 366 spinwait method, all cores randomly jump to Linux. One of the cores 367 gets chosen via lottery and all other keep spinning on a percpu 368 variable. This method cannot support CPU hotplug and sparse hartid 369 scheme. It should be only enabled for M-mode Linux or platforms relying 370 on older firmware without SBI HSM extension. All other platforms should 371 rely on ordered booting via SBI HSM extension which gets chosen 372 dynamically at runtime if the firmware supports it. 373 374config KEXEC 375 bool "Kexec system call" 376 select KEXEC_CORE 377 select HOTPLUG_CPU if SMP 378 depends on MMU 379 help 380 kexec is a system call that implements the ability to shutdown your 381 current kernel, and to start another kernel. It is like a reboot 382 but it is independent of the system firmware. And like a reboot 383 you can start any kernel with it, not just Linux. 384 385 The name comes from the similarity to the exec system call. 386 387config CRASH_DUMP 388 bool "Build kdump crash kernel" 389 help 390 Generate crash dump after being started by kexec. This should 391 be normally only set in special crash dump kernels which are 392 loaded in the main kernel with kexec-tools into a specially 393 reserved region and then later executed after a crash by 394 kdump/kexec. 395 396 For more details see Documentation/admin-guide/kdump/kdump.rst 397 398endmenu 399 400menu "Boot options" 401 402config CMDLINE 403 string "Built-in kernel command line" 404 help 405 For most platforms, the arguments for the kernel's command line 406 are provided at run-time, during boot. However, there are cases 407 where either no arguments are being provided or the provided 408 arguments are insufficient or even invalid. 409 410 When that occurs, it is possible to define a built-in command 411 line here and choose how the kernel should use it later on. 412 413choice 414 prompt "Built-in command line usage" if CMDLINE != "" 415 default CMDLINE_FALLBACK 416 help 417 Choose how the kernel will handle the provided built-in command 418 line. 419 420config CMDLINE_FALLBACK 421 bool "Use bootloader kernel arguments if available" 422 help 423 Use the built-in command line as fallback in case we get nothing 424 during boot. This is the default behaviour. 425 426config CMDLINE_EXTEND 427 bool "Extend bootloader kernel arguments" 428 help 429 The command-line arguments provided during boot will be 430 appended to the built-in command line. This is useful in 431 cases where the provided arguments are insufficient and 432 you don't want to or cannot modify them. 433 434 435config CMDLINE_FORCE 436 bool "Always use the default kernel command string" 437 help 438 Always use the built-in command line, even if we get one during 439 boot. This is useful in case you need to override the provided 440 command line on systems where you don't have or want control 441 over it. 442 443endchoice 444 445config EFI_STUB 446 bool 447 448config EFI 449 bool "UEFI runtime support" 450 depends on OF && !XIP_KERNEL 451 select LIBFDT 452 select UCS2_STRING 453 select EFI_PARAMS_FROM_FDT 454 select EFI_STUB 455 select EFI_GENERIC_STUB 456 select EFI_RUNTIME_WRAPPERS 457 select RISCV_ISA_C 458 depends on MMU 459 default y 460 help 461 This option provides support for runtime services provided 462 by UEFI firmware (such as non-volatile variables, realtime 463 clock, and platform reset). A UEFI stub is also provided to 464 allow the kernel to be booted as an EFI application. This 465 is only useful on systems that have UEFI firmware. 466 467config CC_HAVE_STACKPROTECTOR_TLS 468 def_bool $(cc-option,-mstack-protector-guard=tls -mstack-protector-guard-reg=tp -mstack-protector-guard-offset=0) 469 470config STACKPROTECTOR_PER_TASK 471 def_bool y 472 depends on !GCC_PLUGIN_RANDSTRUCT 473 depends on STACKPROTECTOR && CC_HAVE_STACKPROTECTOR_TLS 474 475config PHYS_RAM_BASE_FIXED 476 bool "Explicitly specified physical RAM address" 477 default n 478 479config PHYS_RAM_BASE 480 hex "Platform Physical RAM address" 481 depends on PHYS_RAM_BASE_FIXED 482 default "0x80000000" 483 help 484 This is the physical address of RAM in the system. It has to be 485 explicitly specified to run early relocations of read-write data 486 from flash to RAM. 487 488config XIP_KERNEL 489 bool "Kernel Execute-In-Place from ROM" 490 depends on MMU && SPARSEMEM 491 # This prevents XIP from being enabled by all{yes,mod}config, which 492 # fail to build since XIP doesn't support large kernels. 493 depends on !COMPILE_TEST 494 select PHYS_RAM_BASE_FIXED 495 help 496 Execute-In-Place allows the kernel to run from non-volatile storage 497 directly addressable by the CPU, such as NOR flash. This saves RAM 498 space since the text section of the kernel is not loaded from flash 499 to RAM. Read-write sections, such as the data section and stack, 500 are still copied to RAM. The XIP kernel is not compressed since 501 it has to run directly from flash, so it will take more space to 502 store it. The flash address used to link the kernel object files, 503 and for storing it, is configuration dependent. Therefore, if you 504 say Y here, you must know the proper physical address where to 505 store the kernel image depending on your own flash memory usage. 506 507 Also note that the make target becomes "make xipImage" rather than 508 "make zImage" or "make Image". The final kernel binary to put in 509 ROM memory will be arch/riscv/boot/xipImage. 510 511 SPARSEMEM is required because the kernel text and rodata that are 512 flash resident are not backed by memmap, then any attempt to get 513 a struct page on those regions will trigger a fault. 514 515 If unsure, say N. 516 517config XIP_PHYS_ADDR 518 hex "XIP Kernel Physical Location" 519 depends on XIP_KERNEL 520 default "0x21000000" 521 help 522 This is the physical address in your flash memory the kernel will 523 be linked for and stored to. This address is dependent on your 524 own flash usage. 525 526endmenu 527 528config BUILTIN_DTB 529 bool 530 depends on OF 531 default y if XIP_KERNEL 532 533menu "Power management options" 534 535source "kernel/power/Kconfig" 536 537endmenu 538 539menu "CPU Power Management" 540 541source "drivers/cpuidle/Kconfig" 542 543endmenu 544 545source "arch/riscv/kvm/Kconfig" 546