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