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 ACPI_GENERIC_GSI if ACPI 16 select ACPI_MCFG if (ACPI && PCI) 17 select ACPI_PPTT if ACPI 18 select ACPI_REDUCED_HARDWARE_ONLY if ACPI 19 select ACPI_SPCR_TABLE if ACPI 20 select ARCH_DMA_DEFAULT_COHERENT 21 select ARCH_ENABLE_HUGEPAGE_MIGRATION if HUGETLB_PAGE && MIGRATION 22 select ARCH_ENABLE_MEMORY_HOTPLUG if SPARSEMEM_VMEMMAP 23 select ARCH_ENABLE_MEMORY_HOTREMOVE if MEMORY_HOTPLUG 24 select ARCH_ENABLE_SPLIT_PMD_PTLOCK if PGTABLE_LEVELS > 2 25 select ARCH_ENABLE_THP_MIGRATION if TRANSPARENT_HUGEPAGE 26 select ARCH_HAS_BINFMT_FLAT 27 select ARCH_HAS_CURRENT_STACK_POINTER 28 select ARCH_HAS_DEBUG_VIRTUAL if MMU 29 select ARCH_HAS_DEBUG_VM_PGTABLE 30 select ARCH_HAS_DEBUG_WX 31 select ARCH_HAS_FAST_MULTIPLIER 32 select ARCH_HAS_FORTIFY_SOURCE 33 select ARCH_HAS_GCOV_PROFILE_ALL 34 select ARCH_HAS_GIGANTIC_PAGE 35 select ARCH_HAS_KCOV 36 select ARCH_HAS_KERNEL_FPU_SUPPORT if 64BIT && FPU 37 select ARCH_HAS_MEMBARRIER_CALLBACKS 38 select ARCH_HAS_MEMBARRIER_SYNC_CORE 39 select ARCH_HAS_MMIOWB 40 select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE 41 select ARCH_HAS_PMEM_API 42 select ARCH_HAS_PREPARE_SYNC_CORE_CMD 43 select ARCH_HAS_PTE_DEVMAP if 64BIT && MMU 44 select ARCH_HAS_PTE_SPECIAL 45 select ARCH_HAS_SET_DIRECT_MAP if MMU 46 select ARCH_HAS_SET_MEMORY if MMU 47 select ARCH_HAS_STRICT_KERNEL_RWX if MMU && !XIP_KERNEL 48 select ARCH_HAS_STRICT_MODULE_RWX if MMU && !XIP_KERNEL 49 select ARCH_HAS_SYNC_CORE_BEFORE_USERMODE 50 select ARCH_HAS_SYSCALL_WRAPPER 51 select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST 52 select ARCH_HAS_UBSAN 53 select ARCH_HAS_VDSO_DATA 54 select ARCH_KEEP_MEMBLOCK if ACPI 55 select ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE if 64BIT && MMU 56 select ARCH_OPTIONAL_KERNEL_RWX if ARCH_HAS_STRICT_KERNEL_RWX 57 select ARCH_OPTIONAL_KERNEL_RWX_DEFAULT 58 select ARCH_STACKWALK 59 select ARCH_SUPPORTS_ATOMIC_RMW 60 select ARCH_SUPPORTS_CFI_CLANG 61 select ARCH_SUPPORTS_DEBUG_PAGEALLOC if MMU 62 select ARCH_SUPPORTS_HUGETLBFS if MMU 63 # LLD >= 14: https://github.com/llvm/llvm-project/issues/50505 64 select ARCH_SUPPORTS_LTO_CLANG if LLD_VERSION >= 140000 65 select ARCH_SUPPORTS_LTO_CLANG_THIN if LLD_VERSION >= 140000 66 select ARCH_SUPPORTS_PAGE_TABLE_CHECK if MMU 67 select ARCH_SUPPORTS_PER_VMA_LOCK if MMU 68 select ARCH_SUPPORTS_SHADOW_CALL_STACK if HAVE_SHADOW_CALL_STACK 69 select ARCH_USE_CMPXCHG_LOCKREF if 64BIT 70 select ARCH_USE_MEMTEST 71 select ARCH_USE_QUEUED_RWLOCKS 72 select ARCH_USES_CFI_TRAPS if CFI_CLANG 73 select ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH if MMU 74 select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU 75 select ARCH_WANT_FRAME_POINTERS 76 select ARCH_WANT_GENERAL_HUGETLB if !RISCV_ISA_SVNAPOT 77 select ARCH_WANT_HUGE_PMD_SHARE if 64BIT 78 select ARCH_WANT_LD_ORPHAN_WARN if !XIP_KERNEL 79 select ARCH_WANT_OPTIMIZE_DAX_VMEMMAP 80 select ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP 81 select ARCH_WANTS_NO_INSTR 82 select ARCH_WANTS_THP_SWAP if HAVE_ARCH_TRANSPARENT_HUGEPAGE 83 select BINFMT_FLAT_NO_DATA_START_OFFSET if !MMU 84 select BUILDTIME_TABLE_SORT if MMU 85 select CLINT_TIMER if RISCV_M_MODE 86 select CLONE_BACKWARDS 87 select COMMON_CLK 88 select CPU_PM if CPU_IDLE || HIBERNATION || SUSPEND 89 select EDAC_SUPPORT 90 select FRAME_POINTER if PERF_EVENTS || (FUNCTION_TRACER && !DYNAMIC_FTRACE) 91 select FTRACE_MCOUNT_USE_PATCHABLE_FUNCTION_ENTRY if DYNAMIC_FTRACE 92 select GENERIC_ARCH_TOPOLOGY 93 select GENERIC_ATOMIC64 if !64BIT 94 select GENERIC_CLOCKEVENTS_BROADCAST if SMP 95 select GENERIC_CPU_DEVICES 96 select GENERIC_EARLY_IOREMAP 97 select GENERIC_ENTRY 98 select GENERIC_GETTIMEOFDAY if HAVE_GENERIC_VDSO 99 select GENERIC_IDLE_POLL_SETUP 100 select GENERIC_IOREMAP if MMU 101 select GENERIC_IRQ_IPI if SMP 102 select GENERIC_IRQ_IPI_MUX if SMP 103 select GENERIC_IRQ_MULTI_HANDLER 104 select GENERIC_IRQ_SHOW 105 select GENERIC_IRQ_SHOW_LEVEL 106 select GENERIC_LIB_DEVMEM_IS_ALLOWED 107 select GENERIC_PCI_IOMAP 108 select GENERIC_PTDUMP if MMU 109 select GENERIC_SCHED_CLOCK 110 select GENERIC_SMP_IDLE_THREAD 111 select GENERIC_TIME_VSYSCALL if MMU && 64BIT 112 select GENERIC_VDSO_TIME_NS if HAVE_GENERIC_VDSO 113 select HARDIRQS_SW_RESEND 114 select HAS_IOPORT if MMU 115 select HAVE_ARCH_AUDITSYSCALL 116 select HAVE_ARCH_HUGE_VMALLOC if HAVE_ARCH_HUGE_VMAP 117 select HAVE_ARCH_HUGE_VMAP if MMU && 64BIT 118 select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL 119 select HAVE_ARCH_JUMP_LABEL_RELATIVE if !XIP_KERNEL 120 select HAVE_ARCH_KASAN if MMU && 64BIT 121 select HAVE_ARCH_KASAN_VMALLOC if MMU && 64BIT 122 select HAVE_ARCH_KFENCE if MMU && 64BIT 123 select HAVE_ARCH_KGDB if !XIP_KERNEL 124 select HAVE_ARCH_KGDB_QXFER_PKT 125 select HAVE_ARCH_MMAP_RND_BITS if MMU 126 select HAVE_ARCH_MMAP_RND_COMPAT_BITS if COMPAT 127 select HAVE_ARCH_RANDOMIZE_KSTACK_OFFSET 128 select HAVE_ARCH_SECCOMP_FILTER 129 select HAVE_ARCH_STACKLEAK 130 select HAVE_ARCH_THREAD_STRUCT_WHITELIST 131 select HAVE_ARCH_TRACEHOOK 132 select HAVE_ARCH_TRANSPARENT_HUGEPAGE if 64BIT && MMU 133 select HAVE_ARCH_USERFAULTFD_MINOR if 64BIT && USERFAULTFD 134 select HAVE_ARCH_VMAP_STACK if MMU && 64BIT 135 select HAVE_ASM_MODVERSIONS 136 select HAVE_CONTEXT_TRACKING_USER 137 select HAVE_DEBUG_KMEMLEAK 138 select HAVE_DMA_CONTIGUOUS if MMU 139 select HAVE_DYNAMIC_FTRACE if !XIP_KERNEL && MMU && (CLANG_SUPPORTS_DYNAMIC_FTRACE || GCC_SUPPORTS_DYNAMIC_FTRACE) 140 select HAVE_DYNAMIC_FTRACE_WITH_DIRECT_CALLS 141 select HAVE_DYNAMIC_FTRACE_WITH_ARGS if HAVE_DYNAMIC_FTRACE 142 select HAVE_FTRACE_MCOUNT_RECORD if !XIP_KERNEL 143 select HAVE_FUNCTION_GRAPH_TRACER 144 select HAVE_FUNCTION_GRAPH_RETVAL if HAVE_FUNCTION_GRAPH_TRACER 145 select HAVE_FUNCTION_TRACER if !XIP_KERNEL && !PREEMPTION 146 select HAVE_EBPF_JIT if MMU 147 select HAVE_GUP_FAST if MMU 148 select HAVE_FUNCTION_ARG_ACCESS_API 149 select HAVE_FUNCTION_ERROR_INJECTION 150 select HAVE_GCC_PLUGINS 151 select HAVE_GENERIC_VDSO if MMU && 64BIT 152 select HAVE_IRQ_TIME_ACCOUNTING 153 select HAVE_KERNEL_BZIP2 if !XIP_KERNEL && !EFI_ZBOOT 154 select HAVE_KERNEL_GZIP if !XIP_KERNEL && !EFI_ZBOOT 155 select HAVE_KERNEL_LZ4 if !XIP_KERNEL && !EFI_ZBOOT 156 select HAVE_KERNEL_LZMA if !XIP_KERNEL && !EFI_ZBOOT 157 select HAVE_KERNEL_LZO if !XIP_KERNEL && !EFI_ZBOOT 158 select HAVE_KERNEL_UNCOMPRESSED if !XIP_KERNEL && !EFI_ZBOOT 159 select HAVE_KERNEL_ZSTD if !XIP_KERNEL && !EFI_ZBOOT 160 select HAVE_KPROBES if !XIP_KERNEL 161 select HAVE_KRETPROBES if !XIP_KERNEL 162 # https://github.com/ClangBuiltLinux/linux/issues/1881 163 select HAVE_LD_DEAD_CODE_DATA_ELIMINATION if !LD_IS_LLD 164 select HAVE_MOVE_PMD 165 select HAVE_MOVE_PUD 166 select HAVE_PAGE_SIZE_4KB 167 select HAVE_PCI 168 select HAVE_PERF_EVENTS 169 select HAVE_PERF_REGS 170 select HAVE_PERF_USER_STACK_DUMP 171 select HAVE_POSIX_CPU_TIMERS_TASK_WORK 172 select HAVE_PREEMPT_DYNAMIC_KEY if !XIP_KERNEL 173 select HAVE_REGS_AND_STACK_ACCESS_API 174 select HAVE_RETHOOK if !XIP_KERNEL 175 select HAVE_RSEQ 176 select HAVE_RUST if 64BIT 177 select HAVE_SAMPLE_FTRACE_DIRECT 178 select HAVE_SAMPLE_FTRACE_DIRECT_MULTI 179 select HAVE_STACKPROTECTOR 180 select HAVE_SYSCALL_TRACEPOINTS 181 select HOTPLUG_CORE_SYNC_DEAD if HOTPLUG_CPU 182 select IRQ_DOMAIN 183 select IRQ_FORCED_THREADING 184 select KASAN_VMALLOC if KASAN 185 select LOCK_MM_AND_FIND_VMA 186 select MMU_GATHER_RCU_TABLE_FREE if SMP && MMU 187 select MODULES_USE_ELF_RELA if MODULES 188 select OF 189 select OF_EARLY_FLATTREE 190 select OF_IRQ 191 select PCI_DOMAINS_GENERIC if PCI 192 select PCI_ECAM if (ACPI && PCI) 193 select PCI_MSI if PCI 194 select RISCV_ALTERNATIVE if !XIP_KERNEL 195 select RISCV_APLIC 196 select RISCV_IMSIC 197 select RISCV_INTC 198 select RISCV_TIMER if RISCV_SBI 199 select SIFIVE_PLIC 200 select SPARSE_IRQ 201 select SYSCTL_EXCEPTION_TRACE 202 select THREAD_INFO_IN_TASK 203 select TRACE_IRQFLAGS_SUPPORT 204 select UACCESS_MEMCPY if !MMU 205 select ZONE_DMA32 if 64BIT 206 207config CLANG_SUPPORTS_DYNAMIC_FTRACE 208 def_bool CC_IS_CLANG 209 # https://github.com/ClangBuiltLinux/linux/issues/1817 210 depends on AS_IS_GNU || (AS_IS_LLVM && (LD_IS_LLD || LD_VERSION >= 23600)) 211 212config GCC_SUPPORTS_DYNAMIC_FTRACE 213 def_bool CC_IS_GCC 214 depends on $(cc-option,-fpatchable-function-entry=8) 215 216config HAVE_SHADOW_CALL_STACK 217 def_bool $(cc-option,-fsanitize=shadow-call-stack) 218 # https://github.com/riscv-non-isa/riscv-elf-psabi-doc/commit/a484e843e6eeb51f0cb7b8819e50da6d2444d769 219 depends on $(ld-option,--no-relax-gp) 220 221config RISCV_USE_LINKER_RELAXATION 222 def_bool y 223 # https://github.com/llvm/llvm-project/commit/6611d58f5bbcbec77262d392e2923e1d680f6985 224 depends on !LD_IS_LLD || LLD_VERSION >= 150000 225 226# https://github.com/llvm/llvm-project/commit/bbc0f99f3bc96f1db16f649fc21dd18e5b0918f6 227config ARCH_HAS_BROKEN_DWARF5 228 def_bool y 229 depends on RISCV_USE_LINKER_RELAXATION 230 # https://github.com/llvm/llvm-project/commit/1df5ea29b43690b6622db2cad7b745607ca4de6a 231 depends on AS_IS_LLVM && AS_VERSION < 180000 232 # https://github.com/llvm/llvm-project/commit/7ffabb61a5569444b5ac9322e22e5471cc5e4a77 233 depends on LD_IS_LLD && LLD_VERSION < 180000 234 235config ARCH_MMAP_RND_BITS_MIN 236 default 18 if 64BIT 237 default 8 238 239config ARCH_MMAP_RND_COMPAT_BITS_MIN 240 default 8 241 242# max bits determined by the following formula: 243# VA_BITS - PAGE_SHIFT - 3 244config ARCH_MMAP_RND_BITS_MAX 245 default 24 if 64BIT # SV39 based 246 default 17 247 248config ARCH_MMAP_RND_COMPAT_BITS_MAX 249 default 17 250 251# set if we run in machine mode, cleared if we run in supervisor mode 252config RISCV_M_MODE 253 bool "Build a kernel that runs in machine mode" 254 depends on !MMU 255 default y 256 help 257 Select this option if you want to run the kernel in M-mode, 258 without the assistance of any other firmware. 259 260# set if we are running in S-mode and can use SBI calls 261config RISCV_SBI 262 bool 263 depends on !RISCV_M_MODE 264 default y 265 266config MMU 267 bool "MMU-based Paged Memory Management Support" 268 default y 269 help 270 Select if you want MMU-based virtualised addressing space 271 support by paged memory management. If unsure, say 'Y'. 272 273config PAGE_OFFSET 274 hex 275 default 0x80000000 if !MMU && RISCV_M_MODE 276 default 0x80200000 if !MMU 277 default 0xc0000000 if 32BIT 278 default 0xff60000000000000 if 64BIT 279 280config KASAN_SHADOW_OFFSET 281 hex 282 depends on KASAN_GENERIC 283 default 0xdfffffff00000000 if 64BIT 284 default 0xffffffff if 32BIT 285 286config ARCH_FLATMEM_ENABLE 287 def_bool !NUMA 288 289config ARCH_SPARSEMEM_ENABLE 290 def_bool y 291 depends on MMU 292 select SPARSEMEM_STATIC if 32BIT && SPARSEMEM 293 select SPARSEMEM_VMEMMAP_ENABLE if 64BIT 294 295config ARCH_SELECT_MEMORY_MODEL 296 def_bool ARCH_SPARSEMEM_ENABLE 297 298config ARCH_SUPPORTS_UPROBES 299 def_bool y 300 301config STACKTRACE_SUPPORT 302 def_bool y 303 304config GENERIC_BUG 305 def_bool y 306 depends on BUG 307 select GENERIC_BUG_RELATIVE_POINTERS if 64BIT 308 309config GENERIC_BUG_RELATIVE_POINTERS 310 bool 311 312config GENERIC_CALIBRATE_DELAY 313 def_bool y 314 315config GENERIC_CSUM 316 def_bool y 317 318config GENERIC_HWEIGHT 319 def_bool y 320 321config FIX_EARLYCON_MEM 322 def_bool MMU 323 324config PGTABLE_LEVELS 325 int 326 default 5 if 64BIT 327 default 2 328 329config LOCKDEP_SUPPORT 330 def_bool y 331 332config RISCV_DMA_NONCOHERENT 333 bool 334 select ARCH_HAS_DMA_PREP_COHERENT 335 select ARCH_HAS_SETUP_DMA_OPS 336 select ARCH_HAS_SYNC_DMA_FOR_CPU 337 select ARCH_HAS_SYNC_DMA_FOR_DEVICE 338 select DMA_BOUNCE_UNALIGNED_KMALLOC if SWIOTLB 339 340config RISCV_NONSTANDARD_CACHE_OPS 341 bool 342 help 343 This enables function pointer support for non-standard noncoherent 344 systems to handle cache management. 345 346config AS_HAS_INSN 347 def_bool $(as-instr,.insn r 51$(comma) 0$(comma) 0$(comma) t0$(comma) t0$(comma) zero) 348 349config AS_HAS_OPTION_ARCH 350 # https://github.com/llvm/llvm-project/commit/9e8ed3403c191ab9c4903e8eeb8f732ff8a43cb4 351 def_bool y 352 depends on $(as-instr, .option arch$(comma) +m) 353 354source "arch/riscv/Kconfig.socs" 355source "arch/riscv/Kconfig.errata" 356 357menu "Platform type" 358 359config NONPORTABLE 360 bool "Allow configurations that result in non-portable kernels" 361 help 362 RISC-V kernel binaries are compatible between all known systems 363 whenever possible, but there are some use cases that can only be 364 satisfied by configurations that result in kernel binaries that are 365 not portable between systems. 366 367 Selecting N does not guarantee kernels will be portable to all known 368 systems. Selecting any of the options guarded by NONPORTABLE will 369 result in kernel binaries that are unlikely to be portable between 370 systems. 371 372 If unsure, say N. 373 374choice 375 prompt "Base ISA" 376 default ARCH_RV64I 377 help 378 This selects the base ISA that this kernel will target and must match 379 the target platform. 380 381config ARCH_RV32I 382 bool "RV32I" 383 depends on NONPORTABLE 384 select 32BIT 385 select GENERIC_LIB_ASHLDI3 386 select GENERIC_LIB_ASHRDI3 387 select GENERIC_LIB_LSHRDI3 388 select GENERIC_LIB_UCMPDI2 389 390config ARCH_RV64I 391 bool "RV64I" 392 select 64BIT 393 select ARCH_SUPPORTS_INT128 if CC_HAS_INT128 394 select SWIOTLB if MMU 395 396endchoice 397 398# We must be able to map all physical memory into the kernel, but the compiler 399# is still a bit more efficient when generating code if it's setup in a manner 400# such that it can only map 2GiB of memory. 401choice 402 prompt "Kernel Code Model" 403 default CMODEL_MEDLOW if 32BIT 404 default CMODEL_MEDANY if 64BIT 405 406 config CMODEL_MEDLOW 407 bool "medium low code model" 408 config CMODEL_MEDANY 409 bool "medium any code model" 410endchoice 411 412config MODULE_SECTIONS 413 bool 414 select HAVE_MOD_ARCH_SPECIFIC 415 416config SMP 417 bool "Symmetric Multi-Processing" 418 help 419 This enables support for systems with more than one CPU. If 420 you say N here, the kernel will run on single and 421 multiprocessor machines, but will use only one CPU of a 422 multiprocessor machine. If you say Y here, the kernel will run 423 on many, but not all, single processor machines. On a single 424 processor machine, the kernel will run faster if you say N 425 here. 426 427 If you don't know what to do here, say N. 428 429config SCHED_MC 430 bool "Multi-core scheduler support" 431 depends on SMP 432 help 433 Multi-core scheduler support improves the CPU scheduler's decision 434 making when dealing with multi-core CPU chips at a cost of slightly 435 increased overhead in some places. If unsure say N here. 436 437config NR_CPUS 438 int "Maximum number of CPUs (2-512)" 439 depends on SMP 440 range 2 512 if !RISCV_SBI_V01 441 range 2 32 if RISCV_SBI_V01 && 32BIT 442 range 2 64 if RISCV_SBI_V01 && 64BIT 443 default "32" if 32BIT 444 default "64" if 64BIT 445 446config HOTPLUG_CPU 447 bool "Support for hot-pluggable CPUs" 448 depends on SMP 449 select GENERIC_IRQ_MIGRATION 450 help 451 452 Say Y here to experiment with turning CPUs off and on. CPUs 453 can be controlled through /sys/devices/system/cpu. 454 455 Say N if you want to disable CPU hotplug. 456 457choice 458 prompt "CPU Tuning" 459 default TUNE_GENERIC 460 461config TUNE_GENERIC 462 bool "generic" 463 464endchoice 465 466# Common NUMA Features 467config NUMA 468 bool "NUMA Memory Allocation and Scheduler Support" 469 depends on SMP && MMU 470 select ARCH_SUPPORTS_NUMA_BALANCING 471 select GENERIC_ARCH_NUMA 472 select HAVE_SETUP_PER_CPU_AREA 473 select NEED_PER_CPU_EMBED_FIRST_CHUNK 474 select NEED_PER_CPU_PAGE_FIRST_CHUNK 475 select OF_NUMA 476 select USE_PERCPU_NUMA_NODE_ID 477 help 478 Enable NUMA (Non-Uniform Memory Access) support. 479 480 The kernel will try to allocate memory used by a CPU on the 481 local memory of the CPU and add some more NUMA awareness to the kernel. 482 483config NODES_SHIFT 484 int "Maximum NUMA Nodes (as a power of 2)" 485 range 1 10 486 default "2" 487 depends on NUMA 488 help 489 Specify the maximum number of NUMA Nodes available on the target 490 system. Increases memory reserved to accommodate various tables. 491 492config RISCV_ALTERNATIVE 493 bool 494 depends on !XIP_KERNEL 495 help 496 This Kconfig allows the kernel to automatically patch the 497 erratum or cpufeature required by the execution platform at run 498 time. The code patching overhead is minimal, as it's only done 499 once at boot and once on each module load. 500 501config RISCV_ALTERNATIVE_EARLY 502 bool 503 depends on RISCV_ALTERNATIVE 504 help 505 Allows early patching of the kernel for special errata 506 507config RISCV_ISA_C 508 bool "Emit compressed instructions when building Linux" 509 default y 510 help 511 Adds "C" to the ISA subsets that the toolchain is allowed to emit 512 when building Linux, which results in compressed instructions in the 513 Linux binary. 514 515 If you don't know what to do here, say Y. 516 517config RISCV_ISA_SVNAPOT 518 bool "Svnapot extension support for supervisor mode NAPOT pages" 519 depends on 64BIT && MMU 520 depends on RISCV_ALTERNATIVE 521 default y 522 help 523 Allow kernel to detect the Svnapot ISA-extension dynamically at boot 524 time and enable its usage. 525 526 The Svnapot extension is used to mark contiguous PTEs as a range 527 of contiguous virtual-to-physical translations for a naturally 528 aligned power-of-2 (NAPOT) granularity larger than the base 4KB page 529 size. When HUGETLBFS is also selected this option unconditionally 530 allocates some memory for each NAPOT page size supported by the kernel. 531 When optimizing for low memory consumption and for platforms without 532 the Svnapot extension, it may be better to say N here. 533 534 If you don't know what to do here, say Y. 535 536config RISCV_ISA_SVPBMT 537 bool "Svpbmt extension support for supervisor mode page-based memory types" 538 depends on 64BIT && MMU 539 depends on RISCV_ALTERNATIVE 540 default y 541 help 542 Adds support to dynamically detect the presence of the Svpbmt 543 ISA-extension (Supervisor-mode: page-based memory types) and 544 enable its usage. 545 546 The memory type for a page contains a combination of attributes 547 that indicate the cacheability, idempotency, and ordering 548 properties for access to that page. 549 550 The Svpbmt extension is only available on 64-bit cpus. 551 552 If you don't know what to do here, say Y. 553 554config TOOLCHAIN_HAS_V 555 bool 556 default y 557 depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64iv) 558 depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32iv) 559 depends on LLD_VERSION >= 140000 || LD_VERSION >= 23800 560 depends on AS_HAS_OPTION_ARCH 561 562config RISCV_ISA_V 563 bool "VECTOR extension support" 564 depends on TOOLCHAIN_HAS_V 565 depends on FPU 566 select DYNAMIC_SIGFRAME 567 default y 568 help 569 Say N here if you want to disable all vector related procedure 570 in the kernel. 571 572 If you don't know what to do here, say Y. 573 574config RISCV_ISA_V_DEFAULT_ENABLE 575 bool "Enable userspace Vector by default" 576 depends on RISCV_ISA_V 577 default y 578 help 579 Say Y here if you want to enable Vector in userspace by default. 580 Otherwise, userspace has to make explicit prctl() call to enable 581 Vector, or enable it via the sysctl interface. 582 583 If you don't know what to do here, say Y. 584 585config RISCV_ISA_V_UCOPY_THRESHOLD 586 int "Threshold size for vectorized user copies" 587 depends on RISCV_ISA_V 588 default 768 589 help 590 Prefer using vectorized copy_to_user()/copy_from_user() when the 591 workload size exceeds this value. 592 593config RISCV_ISA_V_PREEMPTIVE 594 bool "Run kernel-mode Vector with kernel preemption" 595 depends on PREEMPTION 596 depends on RISCV_ISA_V 597 default y 598 help 599 Usually, in-kernel SIMD routines are run with preemption disabled. 600 Functions which envoke long running SIMD thus must yield core's 601 vector unit to prevent blocking other tasks for too long. 602 603 This config allows kernel to run SIMD without explicitly disable 604 preemption. Enabling this config will result in higher memory 605 consumption due to the allocation of per-task's kernel Vector context. 606 607config RISCV_ISA_ZAWRS 608 bool "Zawrs extension support for more efficient busy waiting" 609 depends on RISCV_ALTERNATIVE 610 default y 611 help 612 The Zawrs extension defines instructions to be used in polling loops 613 which allow a hart to enter a low-power state or to trap to the 614 hypervisor while waiting on a store to a memory location. Enable the 615 use of these instructions in the kernel when the Zawrs extension is 616 detected at boot. 617 618 If you don't know what to do here, say Y. 619 620config TOOLCHAIN_HAS_ZBB 621 bool 622 default y 623 depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64ima_zbb) 624 depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32ima_zbb) 625 depends on LLD_VERSION >= 150000 || LD_VERSION >= 23900 626 depends on AS_HAS_OPTION_ARCH 627 628# This symbol indicates that the toolchain supports all v1.0 vector crypto 629# extensions, including Zvk*, Zvbb, and Zvbc. LLVM added all of these at once. 630# binutils added all except Zvkb, then added Zvkb. So we just check for Zvkb. 631config TOOLCHAIN_HAS_VECTOR_CRYPTO 632 def_bool $(as-instr, .option arch$(comma) +v$(comma) +zvkb) 633 depends on AS_HAS_OPTION_ARCH 634 635config RISCV_ISA_ZBA 636 bool "Zba extension support for bit manipulation instructions" 637 default y 638 help 639 Add support for enabling optimisations in the kernel when the Zba 640 extension is detected at boot. 641 642 The Zba extension provides instructions to accelerate the generation 643 of addresses that index into arrays of basic data types. 644 645 If you don't know what to do here, say Y. 646 647config RISCV_ISA_ZBB 648 bool "Zbb extension support for bit manipulation instructions" 649 depends on TOOLCHAIN_HAS_ZBB 650 depends on RISCV_ALTERNATIVE 651 default y 652 help 653 Adds support to dynamically detect the presence of the ZBB 654 extension (basic bit manipulation) and enable its usage. 655 656 The Zbb extension provides instructions to accelerate a number 657 of bit-specific operations (count bit population, sign extending, 658 bitrotation, etc). 659 660 If you don't know what to do here, say Y. 661 662config TOOLCHAIN_HAS_ZBC 663 bool 664 default y 665 depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64ima_zbc) 666 depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32ima_zbc) 667 depends on LLD_VERSION >= 150000 || LD_VERSION >= 23900 668 depends on AS_HAS_OPTION_ARCH 669 670config RISCV_ISA_ZBC 671 bool "Zbc extension support for carry-less multiplication instructions" 672 depends on TOOLCHAIN_HAS_ZBC 673 depends on MMU 674 depends on RISCV_ALTERNATIVE 675 default y 676 help 677 Adds support to dynamically detect the presence of the Zbc 678 extension (carry-less multiplication) and enable its usage. 679 680 The Zbc extension could accelerate CRC (cyclic redundancy check) 681 calculations. 682 683 If you don't know what to do here, say Y. 684 685config RISCV_ISA_ZICBOM 686 bool "Zicbom extension support for non-coherent DMA operation" 687 depends on MMU 688 depends on RISCV_ALTERNATIVE 689 default y 690 select RISCV_DMA_NONCOHERENT 691 select DMA_DIRECT_REMAP 692 help 693 Adds support to dynamically detect the presence of the ZICBOM 694 extension (Cache Block Management Operations) and enable its 695 usage. 696 697 The Zicbom extension can be used to handle for example 698 non-coherent DMA support on devices that need it. 699 700 If you don't know what to do here, say Y. 701 702config RISCV_ISA_ZICBOZ 703 bool "Zicboz extension support for faster zeroing of memory" 704 depends on RISCV_ALTERNATIVE 705 default y 706 help 707 Enable the use of the Zicboz extension (cbo.zero instruction) 708 when available. 709 710 The Zicboz extension is used for faster zeroing of memory. 711 712 If you don't know what to do here, say Y. 713 714config TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI 715 def_bool y 716 # https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=aed44286efa8ae8717a77d94b51ac3614e2ca6dc 717 # https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=98416dbb0a62579d4a7a4a76bab51b5b52fec2cd 718 depends on AS_IS_GNU && AS_VERSION >= 23600 719 help 720 Binutils-2.38 and GCC-12.1.0 bumped the default ISA spec to the newer 721 20191213 version, which moves some instructions from the I extension to 722 the Zicsr and Zifencei extensions. This requires explicitly specifying 723 Zicsr and Zifencei when binutils >= 2.38 or GCC >= 12.1.0. Zicsr 724 and Zifencei are supported in binutils from version 2.36 onwards. 725 To make life easier, and avoid forcing toolchains that default to a 726 newer ISA spec to version 2.2, relax the check to binutils >= 2.36. 727 For clang < 17 or GCC < 11.3.0, for which this is not possible or need 728 special treatment, this is dealt with in TOOLCHAIN_NEEDS_OLD_ISA_SPEC. 729 730config TOOLCHAIN_NEEDS_OLD_ISA_SPEC 731 def_bool y 732 depends on TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI 733 # https://github.com/llvm/llvm-project/commit/22e199e6afb1263c943c0c0d4498694e15bf8a16 734 # https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=d29f5d6ab513c52fd872f532c492e35ae9fd6671 735 depends on (CC_IS_CLANG && CLANG_VERSION < 170000) || (CC_IS_GCC && GCC_VERSION < 110300) 736 help 737 Certain versions of clang and GCC do not support zicsr and zifencei via 738 -march. This option causes an older ISA spec compatible with these older 739 versions of clang and GCC to be passed to GAS, which has the same result 740 as passing zicsr and zifencei to -march. 741 742config FPU 743 bool "FPU support" 744 default y 745 help 746 Say N here if you want to disable all floating-point related procedure 747 in the kernel. 748 749 If you don't know what to do here, say Y. 750 751config IRQ_STACKS 752 bool "Independent irq & softirq stacks" if EXPERT 753 default y 754 select HAVE_IRQ_EXIT_ON_IRQ_STACK 755 select HAVE_SOFTIRQ_ON_OWN_STACK 756 help 757 Add independent irq & softirq stacks for percpu to prevent kernel stack 758 overflows. We may save some memory footprint by disabling IRQ_STACKS. 759 760config THREAD_SIZE_ORDER 761 int "Kernel stack size (in power-of-two numbers of page size)" if VMAP_STACK && EXPERT 762 range 0 4 763 default 1 if 32BIT && !KASAN 764 default 3 if 64BIT && KASAN 765 default 2 766 help 767 Specify the Pages of thread stack size (from 4KB to 64KB), which also 768 affects irq stack size, which is equal to thread stack size. 769 770config RISCV_MISALIGNED 771 bool 772 select SYSCTL_ARCH_UNALIGN_ALLOW 773 help 774 Embed support for emulating misaligned loads and stores. 775 776choice 777 prompt "Unaligned Accesses Support" 778 default RISCV_PROBE_UNALIGNED_ACCESS 779 help 780 This determines the level of support for unaligned accesses. This 781 information is used by the kernel to perform optimizations. It is also 782 exposed to user space via the hwprobe syscall. The hardware will be 783 probed at boot by default. 784 785config RISCV_PROBE_UNALIGNED_ACCESS 786 bool "Probe for hardware unaligned access support" 787 select RISCV_MISALIGNED 788 help 789 During boot, the kernel will run a series of tests to determine the 790 speed of unaligned accesses. This probing will dynamically determine 791 the speed of unaligned accesses on the underlying system. If unaligned 792 memory accesses trap into the kernel as they are not supported by the 793 system, the kernel will emulate the unaligned accesses to preserve the 794 UABI. 795 796config RISCV_EMULATED_UNALIGNED_ACCESS 797 bool "Emulate unaligned access where system support is missing" 798 select RISCV_MISALIGNED 799 help 800 If unaligned memory accesses trap into the kernel as they are not 801 supported by the system, the kernel will emulate the unaligned 802 accesses to preserve the UABI. When the underlying system does support 803 unaligned accesses, the unaligned accesses are assumed to be slow. 804 805config RISCV_SLOW_UNALIGNED_ACCESS 806 bool "Assume the system supports slow unaligned memory accesses" 807 depends on NONPORTABLE 808 help 809 Assume that the system supports slow unaligned memory accesses. The 810 kernel and userspace programs may not be able to run at all on systems 811 that do not support unaligned memory accesses. 812 813config RISCV_EFFICIENT_UNALIGNED_ACCESS 814 bool "Assume the system supports fast unaligned memory accesses" 815 depends on NONPORTABLE 816 select DCACHE_WORD_ACCESS if MMU 817 select HAVE_EFFICIENT_UNALIGNED_ACCESS 818 help 819 Assume that the system supports fast unaligned memory accesses. When 820 enabled, this option improves the performance of the kernel on such 821 systems. However, the kernel and userspace programs will run much more 822 slowly, or will not be able to run at all, on systems that do not 823 support efficient unaligned memory accesses. 824 825endchoice 826 827source "arch/riscv/Kconfig.vendor" 828 829endmenu # "Platform type" 830 831menu "Kernel features" 832 833source "kernel/Kconfig.hz" 834 835config RISCV_SBI_V01 836 bool "SBI v0.1 support" 837 depends on RISCV_SBI 838 help 839 This config allows kernel to use SBI v0.1 APIs. This will be 840 deprecated in future once legacy M-mode software are no longer in use. 841 842config RISCV_BOOT_SPINWAIT 843 bool "Spinwait booting method" 844 depends on SMP 845 default y if RISCV_SBI_V01 || RISCV_M_MODE 846 help 847 This enables support for booting Linux via spinwait method. In the 848 spinwait method, all cores randomly jump to Linux. One of the cores 849 gets chosen via lottery and all other keep spinning on a percpu 850 variable. This method cannot support CPU hotplug and sparse hartid 851 scheme. It should be only enabled for M-mode Linux or platforms relying 852 on older firmware without SBI HSM extension. All other platforms should 853 rely on ordered booting via SBI HSM extension which gets chosen 854 dynamically at runtime if the firmware supports it. 855 856 Since spinwait is incompatible with sparse hart IDs, it requires 857 NR_CPUS be large enough to contain the physical hart ID of the first 858 hart to enter Linux. 859 860 If unsure what to do here, say N. 861 862config ARCH_SUPPORTS_KEXEC 863 def_bool y 864 865config ARCH_SELECTS_KEXEC 866 def_bool y 867 depends on KEXEC 868 select HOTPLUG_CPU if SMP 869 870config ARCH_SUPPORTS_KEXEC_FILE 871 def_bool 64BIT 872 873config ARCH_SELECTS_KEXEC_FILE 874 def_bool y 875 depends on KEXEC_FILE 876 select HAVE_IMA_KEXEC if IMA 877 select KEXEC_ELF 878 879config ARCH_SUPPORTS_KEXEC_PURGATORY 880 def_bool ARCH_SUPPORTS_KEXEC_FILE 881 882config ARCH_SUPPORTS_CRASH_DUMP 883 def_bool y 884 885config ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION 886 def_bool CRASH_RESERVE 887 888config COMPAT 889 bool "Kernel support for 32-bit U-mode" 890 default 64BIT 891 depends on 64BIT && MMU 892 help 893 This option enables support for a 32-bit U-mode running under a 64-bit 894 kernel at S-mode. riscv32-specific components such as system calls, 895 the user helper functions (vdso), signal rt_frame functions and the 896 ptrace interface are handled appropriately by the kernel. 897 898 If you want to execute 32-bit userspace applications, say Y. 899 900config PARAVIRT 901 bool "Enable paravirtualization code" 902 depends on RISCV_SBI 903 help 904 This changes the kernel so it can modify itself when it is run 905 under a hypervisor, potentially improving performance significantly 906 over full virtualization. 907 908config PARAVIRT_TIME_ACCOUNTING 909 bool "Paravirtual steal time accounting" 910 depends on PARAVIRT 911 help 912 Select this option to enable fine granularity task steal time 913 accounting. Time spent executing other tasks in parallel with 914 the current vCPU is discounted from the vCPU power. To account for 915 that, there can be a small performance impact. 916 917 If in doubt, say N here. 918 919config RELOCATABLE 920 bool "Build a relocatable kernel" 921 depends on MMU && 64BIT && !XIP_KERNEL 922 select MODULE_SECTIONS if MODULES 923 help 924 This builds a kernel as a Position Independent Executable (PIE), 925 which retains all relocation metadata required to relocate the 926 kernel binary at runtime to a different virtual address than the 927 address it was linked at. 928 Since RISCV uses the RELA relocation format, this requires a 929 relocation pass at runtime even if the kernel is loaded at the 930 same address it was linked at. 931 932 If unsure, say N. 933 934config RANDOMIZE_BASE 935 bool "Randomize the address of the kernel image" 936 select RELOCATABLE 937 depends on MMU && 64BIT && !XIP_KERNEL 938 help 939 Randomizes the virtual address at which the kernel image is 940 loaded, as a security feature that deters exploit attempts 941 relying on knowledge of the location of kernel internals. 942 943 It is the bootloader's job to provide entropy, by passing a 944 random u64 value in /chosen/kaslr-seed at kernel entry. 945 946 When booting via the UEFI stub, it will invoke the firmware's 947 EFI_RNG_PROTOCOL implementation (if available) to supply entropy 948 to the kernel proper. In addition, it will randomise the physical 949 location of the kernel Image as well. 950 951 If unsure, say N. 952 953endmenu # "Kernel features" 954 955menu "Boot options" 956 957config CMDLINE 958 string "Built-in kernel command line" 959 help 960 For most platforms, the arguments for the kernel's command line 961 are provided at run-time, during boot. However, there are cases 962 where either no arguments are being provided or the provided 963 arguments are insufficient or even invalid. 964 965 When that occurs, it is possible to define a built-in command 966 line here and choose how the kernel should use it later on. 967 968choice 969 prompt "Built-in command line usage" 970 depends on CMDLINE != "" 971 default CMDLINE_FALLBACK 972 help 973 Choose how the kernel will handle the provided built-in command 974 line. 975 976config CMDLINE_FALLBACK 977 bool "Use bootloader kernel arguments if available" 978 help 979 Use the built-in command line as fallback in case we get nothing 980 during boot. This is the default behaviour. 981 982config CMDLINE_EXTEND 983 bool "Extend bootloader kernel arguments" 984 help 985 The command-line arguments provided during boot will be 986 appended to the built-in command line. This is useful in 987 cases where the provided arguments are insufficient and 988 you don't want to or cannot modify them. 989 990config CMDLINE_FORCE 991 bool "Always use the default kernel command string" 992 help 993 Always use the built-in command line, even if we get one during 994 boot. This is useful in case you need to override the provided 995 command line on systems where you don't have or want control 996 over it. 997 998endchoice 999 1000config EFI_STUB 1001 bool 1002 1003config EFI 1004 bool "UEFI runtime support" 1005 depends on OF && !XIP_KERNEL 1006 depends on MMU 1007 default y 1008 select ARCH_SUPPORTS_ACPI if 64BIT 1009 select EFI_GENERIC_STUB 1010 select EFI_PARAMS_FROM_FDT 1011 select EFI_RUNTIME_WRAPPERS 1012 select EFI_STUB 1013 select LIBFDT 1014 select RISCV_ISA_C 1015 select UCS2_STRING 1016 help 1017 This option provides support for runtime services provided 1018 by UEFI firmware (such as non-volatile variables, realtime 1019 clock, and platform reset). A UEFI stub is also provided to 1020 allow the kernel to be booted as an EFI application. This 1021 is only useful on systems that have UEFI firmware. 1022 1023config DMI 1024 bool "Enable support for SMBIOS (DMI) tables" 1025 depends on EFI 1026 default y 1027 help 1028 This enables SMBIOS/DMI feature for systems. 1029 1030 This option is only useful on systems that have UEFI firmware. 1031 However, even with this option, the resultant kernel should 1032 continue to boot on existing non-UEFI platforms. 1033 1034config CC_HAVE_STACKPROTECTOR_TLS 1035 def_bool $(cc-option,-mstack-protector-guard=tls -mstack-protector-guard-reg=tp -mstack-protector-guard-offset=0) 1036 1037config STACKPROTECTOR_PER_TASK 1038 def_bool y 1039 depends on !RANDSTRUCT 1040 depends on STACKPROTECTOR && CC_HAVE_STACKPROTECTOR_TLS 1041 1042config PHYS_RAM_BASE_FIXED 1043 bool "Explicitly specified physical RAM address" 1044 depends on NONPORTABLE 1045 default n 1046 1047config PHYS_RAM_BASE 1048 hex "Platform Physical RAM address" 1049 depends on PHYS_RAM_BASE_FIXED 1050 default "0x80000000" 1051 help 1052 This is the physical address of RAM in the system. It has to be 1053 explicitly specified to run early relocations of read-write data 1054 from flash to RAM. 1055 1056config XIP_KERNEL 1057 bool "Kernel Execute-In-Place from ROM" 1058 depends on MMU && SPARSEMEM && NONPORTABLE 1059 # This prevents XIP from being enabled by all{yes,mod}config, which 1060 # fail to build since XIP doesn't support large kernels. 1061 depends on !COMPILE_TEST 1062 select PHYS_RAM_BASE_FIXED 1063 help 1064 Execute-In-Place allows the kernel to run from non-volatile storage 1065 directly addressable by the CPU, such as NOR flash. This saves RAM 1066 space since the text section of the kernel is not loaded from flash 1067 to RAM. Read-write sections, such as the data section and stack, 1068 are still copied to RAM. The XIP kernel is not compressed since 1069 it has to run directly from flash, so it will take more space to 1070 store it. The flash address used to link the kernel object files, 1071 and for storing it, is configuration dependent. Therefore, if you 1072 say Y here, you must know the proper physical address where to 1073 store the kernel image depending on your own flash memory usage. 1074 1075 Also note that the make target becomes "make xipImage" rather than 1076 "make zImage" or "make Image". The final kernel binary to put in 1077 ROM memory will be arch/riscv/boot/xipImage. 1078 1079 SPARSEMEM is required because the kernel text and rodata that are 1080 flash resident are not backed by memmap, then any attempt to get 1081 a struct page on those regions will trigger a fault. 1082 1083 If unsure, say N. 1084 1085config XIP_PHYS_ADDR 1086 hex "XIP Kernel Physical Location" 1087 depends on XIP_KERNEL 1088 default "0x21000000" 1089 help 1090 This is the physical address in your flash memory the kernel will 1091 be linked for and stored to. This address is dependent on your 1092 own flash usage. 1093 1094config RISCV_ISA_FALLBACK 1095 bool "Permit falling back to parsing riscv,isa for extension support by default" 1096 default y 1097 help 1098 Parsing the "riscv,isa" devicetree property has been deprecated and 1099 replaced by a list of explicitly defined strings. For compatibility 1100 with existing platforms, the kernel will fall back to parsing the 1101 "riscv,isa" property if the replacements are not found. 1102 1103 Selecting N here will result in a kernel that does not use the 1104 fallback, unless the commandline "riscv_isa_fallback" parameter is 1105 present. 1106 1107 Please see the dt-binding, located at 1108 Documentation/devicetree/bindings/riscv/extensions.yaml for details 1109 on the replacement properties, "riscv,isa-base" and 1110 "riscv,isa-extensions". 1111 1112config BUILTIN_DTB 1113 bool "Built-in device tree" 1114 depends on OF && NONPORTABLE 1115 help 1116 Build a device tree into the Linux image. 1117 This option should be selected if no bootloader is being used. 1118 If unsure, say N. 1119 1120 1121config BUILTIN_DTB_SOURCE 1122 string "Built-in device tree source" 1123 depends on BUILTIN_DTB 1124 help 1125 DTS file path (without suffix, relative to arch/riscv/boot/dts) 1126 for the DTS file that will be used to produce the DTB linked into the 1127 kernel. 1128 1129endmenu # "Boot options" 1130 1131config PORTABLE 1132 bool 1133 default !NONPORTABLE 1134 select EFI 1135 select MMU 1136 select OF 1137 1138config ARCH_PROC_KCORE_TEXT 1139 def_bool y 1140 1141menu "Power management options" 1142 1143source "kernel/power/Kconfig" 1144 1145config ARCH_HIBERNATION_POSSIBLE 1146 def_bool y 1147 1148config ARCH_HIBERNATION_HEADER 1149 def_bool HIBERNATION 1150 1151config ARCH_SUSPEND_POSSIBLE 1152 def_bool y 1153 1154endmenu # "Power management options" 1155 1156menu "CPU Power Management" 1157 1158source "drivers/cpuidle/Kconfig" 1159 1160source "drivers/cpufreq/Kconfig" 1161 1162endmenu # "CPU Power Management" 1163 1164source "arch/riscv/kvm/Kconfig" 1165 1166source "drivers/acpi/Kconfig" 1167