1# SPDX-License-Identifier: GPL-2.0 2config LOONGARCH 3 bool 4 default y 5 select ACPI 6 select ACPI_GENERIC_GSI if ACPI 7 select ACPI_MCFG if ACPI 8 select ACPI_SYSTEM_POWER_STATES_SUPPORT if ACPI 9 select ARCH_BINFMT_ELF_STATE 10 select ARCH_ENABLE_MEMORY_HOTPLUG 11 select ARCH_ENABLE_MEMORY_HOTREMOVE 12 select ARCH_HAS_ACPI_TABLE_UPGRADE if ACPI 13 select ARCH_HAS_FORTIFY_SOURCE 14 select ARCH_HAS_NMI_SAFE_THIS_CPU_OPS 15 select ARCH_HAS_PTE_SPECIAL 16 select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST 17 select ARCH_INLINE_READ_LOCK if !PREEMPTION 18 select ARCH_INLINE_READ_LOCK_BH if !PREEMPTION 19 select ARCH_INLINE_READ_LOCK_IRQ if !PREEMPTION 20 select ARCH_INLINE_READ_LOCK_IRQSAVE if !PREEMPTION 21 select ARCH_INLINE_READ_UNLOCK if !PREEMPTION 22 select ARCH_INLINE_READ_UNLOCK_BH if !PREEMPTION 23 select ARCH_INLINE_READ_UNLOCK_IRQ if !PREEMPTION 24 select ARCH_INLINE_READ_UNLOCK_IRQRESTORE if !PREEMPTION 25 select ARCH_INLINE_WRITE_LOCK if !PREEMPTION 26 select ARCH_INLINE_WRITE_LOCK_BH if !PREEMPTION 27 select ARCH_INLINE_WRITE_LOCK_IRQ if !PREEMPTION 28 select ARCH_INLINE_WRITE_LOCK_IRQSAVE if !PREEMPTION 29 select ARCH_INLINE_WRITE_UNLOCK if !PREEMPTION 30 select ARCH_INLINE_WRITE_UNLOCK_BH if !PREEMPTION 31 select ARCH_INLINE_WRITE_UNLOCK_IRQ if !PREEMPTION 32 select ARCH_INLINE_WRITE_UNLOCK_IRQRESTORE if !PREEMPTION 33 select ARCH_INLINE_SPIN_TRYLOCK if !PREEMPTION 34 select ARCH_INLINE_SPIN_TRYLOCK_BH if !PREEMPTION 35 select ARCH_INLINE_SPIN_LOCK if !PREEMPTION 36 select ARCH_INLINE_SPIN_LOCK_BH if !PREEMPTION 37 select ARCH_INLINE_SPIN_LOCK_IRQ if !PREEMPTION 38 select ARCH_INLINE_SPIN_LOCK_IRQSAVE if !PREEMPTION 39 select ARCH_INLINE_SPIN_UNLOCK if !PREEMPTION 40 select ARCH_INLINE_SPIN_UNLOCK_BH if !PREEMPTION 41 select ARCH_INLINE_SPIN_UNLOCK_IRQ if !PREEMPTION 42 select ARCH_INLINE_SPIN_UNLOCK_IRQRESTORE if !PREEMPTION 43 select ARCH_KEEP_MEMBLOCK 44 select ARCH_MIGHT_HAVE_PC_PARPORT 45 select ARCH_MIGHT_HAVE_PC_SERIO 46 select ARCH_SPARSEMEM_ENABLE 47 select ARCH_STACKWALK 48 select ARCH_SUPPORTS_ACPI 49 select ARCH_SUPPORTS_ATOMIC_RMW 50 select ARCH_SUPPORTS_HUGETLBFS 51 select ARCH_SUPPORTS_NUMA_BALANCING 52 select ARCH_USE_BUILTIN_BSWAP 53 select ARCH_USE_CMPXCHG_LOCKREF 54 select ARCH_USE_QUEUED_RWLOCKS 55 select ARCH_USE_QUEUED_SPINLOCKS 56 select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT 57 select ARCH_WANT_LD_ORPHAN_WARN 58 select ARCH_WANT_OPTIMIZE_VMEMMAP 59 select ARCH_WANTS_NO_INSTR 60 select BUILDTIME_TABLE_SORT 61 select COMMON_CLK 62 select CPU_PM 63 select EFI 64 select GENERIC_CLOCKEVENTS 65 select GENERIC_CMOS_UPDATE 66 select GENERIC_CPU_AUTOPROBE 67 select GENERIC_ENTRY 68 select GENERIC_GETTIMEOFDAY 69 select GENERIC_IOREMAP if !ARCH_IOREMAP 70 select GENERIC_IRQ_MULTI_HANDLER 71 select GENERIC_IRQ_PROBE 72 select GENERIC_IRQ_SHOW 73 select GENERIC_LIB_ASHLDI3 74 select GENERIC_LIB_ASHRDI3 75 select GENERIC_LIB_CMPDI2 76 select GENERIC_LIB_LSHRDI3 77 select GENERIC_LIB_UCMPDI2 78 select GENERIC_LIB_DEVMEM_IS_ALLOWED 79 select GENERIC_PCI_IOMAP 80 select GENERIC_SCHED_CLOCK 81 select GENERIC_SMP_IDLE_THREAD 82 select GENERIC_TIME_VSYSCALL 83 select GPIOLIB 84 select HAS_IOPORT 85 select HAVE_ARCH_AUDITSYSCALL 86 select HAVE_ARCH_MMAP_RND_BITS if MMU 87 select HAVE_ARCH_SECCOMP_FILTER 88 select HAVE_ARCH_TRACEHOOK 89 select HAVE_ARCH_TRANSPARENT_HUGEPAGE 90 select HAVE_ASM_MODVERSIONS 91 select HAVE_CONTEXT_TRACKING_USER 92 select HAVE_C_RECORDMCOUNT 93 select HAVE_DEBUG_STACKOVERFLOW 94 select HAVE_DMA_CONTIGUOUS 95 select HAVE_DYNAMIC_FTRACE 96 select HAVE_DYNAMIC_FTRACE_WITH_ARGS 97 select HAVE_DYNAMIC_FTRACE_WITH_DIRECT_CALLS 98 select HAVE_DYNAMIC_FTRACE_WITH_REGS 99 select HAVE_EBPF_JIT 100 select HAVE_EFFICIENT_UNALIGNED_ACCESS if !ARCH_STRICT_ALIGN 101 select HAVE_EXIT_THREAD 102 select HAVE_FAST_GUP 103 select HAVE_FTRACE_MCOUNT_RECORD 104 select HAVE_FUNCTION_ARG_ACCESS_API 105 select HAVE_FUNCTION_ERROR_INJECTION 106 select HAVE_FUNCTION_GRAPH_TRACER 107 select HAVE_FUNCTION_TRACER 108 select HAVE_GENERIC_VDSO 109 select HAVE_HW_BREAKPOINT if PERF_EVENTS 110 select HAVE_IOREMAP_PROT 111 select HAVE_IRQ_EXIT_ON_IRQ_STACK 112 select HAVE_IRQ_TIME_ACCOUNTING 113 select HAVE_KPROBES 114 select HAVE_KPROBES_ON_FTRACE 115 select HAVE_KRETPROBES 116 select HAVE_MOD_ARCH_SPECIFIC 117 select HAVE_NMI 118 select HAVE_PCI 119 select HAVE_PERF_EVENTS 120 select HAVE_PERF_REGS 121 select HAVE_PERF_USER_STACK_DUMP 122 select HAVE_REGS_AND_STACK_ACCESS_API 123 select HAVE_RSEQ 124 select HAVE_SAMPLE_FTRACE_DIRECT 125 select HAVE_SAMPLE_FTRACE_DIRECT_MULTI 126 select HAVE_SETUP_PER_CPU_AREA if NUMA 127 select HAVE_STACKPROTECTOR 128 select HAVE_SYSCALL_TRACEPOINTS 129 select HAVE_TIF_NOHZ 130 select HAVE_VIRT_CPU_ACCOUNTING_GEN if !SMP 131 select IRQ_FORCED_THREADING 132 select IRQ_LOONGARCH_CPU 133 select MMU_GATHER_MERGE_VMAS if MMU 134 select MODULES_USE_ELF_RELA if MODULES 135 select NEED_PER_CPU_EMBED_FIRST_CHUNK 136 select NEED_PER_CPU_PAGE_FIRST_CHUNK 137 select OF 138 select OF_EARLY_FLATTREE 139 select PCI 140 select PCI_DOMAINS_GENERIC 141 select PCI_ECAM if ACPI 142 select PCI_LOONGSON 143 select PCI_MSI_ARCH_FALLBACKS 144 select PCI_QUIRKS 145 select PERF_USE_VMALLOC 146 select RTC_LIB 147 select SMP 148 select SPARSE_IRQ 149 select SYSCTL_ARCH_UNALIGN_ALLOW 150 select SYSCTL_ARCH_UNALIGN_NO_WARN 151 select SYSCTL_EXCEPTION_TRACE 152 select SWIOTLB 153 select TRACE_IRQFLAGS_SUPPORT 154 select USE_PERCPU_NUMA_NODE_ID 155 select USER_STACKTRACE_SUPPORT 156 select ZONE_DMA32 157 158config 32BIT 159 bool 160 161config 64BIT 162 def_bool y 163 164config CPU_HAS_FPU 165 bool 166 default y 167 168config CPU_HAS_PREFETCH 169 bool 170 default y 171 172config GENERIC_BUG 173 def_bool y 174 depends on BUG 175 176config GENERIC_BUG_RELATIVE_POINTERS 177 def_bool y 178 depends on GENERIC_BUG 179 180config GENERIC_CALIBRATE_DELAY 181 def_bool y 182 183config GENERIC_CSUM 184 def_bool y 185 186config GENERIC_HWEIGHT 187 def_bool y 188 189config L1_CACHE_SHIFT 190 int 191 default "6" 192 193config LOCKDEP_SUPPORT 194 bool 195 default y 196 197config STACKTRACE_SUPPORT 198 bool 199 default y 200 201# MACH_LOONGSON32 and MACH_LOONGSON64 are deliberately carried over from the 202# MIPS Loongson code, to preserve Loongson-specific code paths in drivers that 203# are shared between architectures, and specifically expecting the symbols. 204config MACH_LOONGSON32 205 def_bool 32BIT 206 207config MACH_LOONGSON64 208 def_bool 64BIT 209 210config FIX_EARLYCON_MEM 211 def_bool y 212 213config PAGE_SIZE_4KB 214 bool 215 216config PAGE_SIZE_16KB 217 bool 218 219config PAGE_SIZE_64KB 220 bool 221 222config PGTABLE_2LEVEL 223 bool 224 225config PGTABLE_3LEVEL 226 bool 227 228config PGTABLE_4LEVEL 229 bool 230 231config PGTABLE_LEVELS 232 int 233 default 2 if PGTABLE_2LEVEL 234 default 3 if PGTABLE_3LEVEL 235 default 4 if PGTABLE_4LEVEL 236 237config SCHED_OMIT_FRAME_POINTER 238 bool 239 default y 240 241config AS_HAS_EXPLICIT_RELOCS 242 def_bool $(as-instr,x:pcalau12i \$t0$(comma)%pc_hi20(x)) 243 244menu "Kernel type and options" 245 246source "kernel/Kconfig.hz" 247 248choice 249 prompt "Page Table Layout" 250 default 16KB_2LEVEL if 32BIT 251 default 16KB_3LEVEL if 64BIT 252 help 253 Allows choosing the page table layout, which is a combination 254 of page size and page table levels. The size of virtual memory 255 address space are determined by the page table layout. 256 257config 4KB_3LEVEL 258 bool "4KB with 3 levels" 259 select PAGE_SIZE_4KB 260 select PGTABLE_3LEVEL 261 help 262 This option selects 4KB page size with 3 level page tables, which 263 support a maximum of 39 bits of application virtual memory. 264 265config 4KB_4LEVEL 266 bool "4KB with 4 levels" 267 select PAGE_SIZE_4KB 268 select PGTABLE_4LEVEL 269 help 270 This option selects 4KB page size with 4 level page tables, which 271 support a maximum of 48 bits of application virtual memory. 272 273config 16KB_2LEVEL 274 bool "16KB with 2 levels" 275 select PAGE_SIZE_16KB 276 select PGTABLE_2LEVEL 277 help 278 This option selects 16KB page size with 2 level page tables, which 279 support a maximum of 36 bits of application virtual memory. 280 281config 16KB_3LEVEL 282 bool "16KB with 3 levels" 283 select PAGE_SIZE_16KB 284 select PGTABLE_3LEVEL 285 help 286 This option selects 16KB page size with 3 level page tables, which 287 support a maximum of 47 bits of application virtual memory. 288 289config 64KB_2LEVEL 290 bool "64KB with 2 levels" 291 select PAGE_SIZE_64KB 292 select PGTABLE_2LEVEL 293 help 294 This option selects 64KB page size with 2 level page tables, which 295 support a maximum of 42 bits of application virtual memory. 296 297config 64KB_3LEVEL 298 bool "64KB with 3 levels" 299 select PAGE_SIZE_64KB 300 select PGTABLE_3LEVEL 301 help 302 This option selects 64KB page size with 3 level page tables, which 303 support a maximum of 55 bits of application virtual memory. 304 305endchoice 306 307config CMDLINE 308 string "Built-in kernel command line" 309 help 310 For most platforms, the arguments for the kernel's command line 311 are provided at run-time, during boot. However, there are cases 312 where either no arguments are being provided or the provided 313 arguments are insufficient or even invalid. 314 315 When that occurs, it is possible to define a built-in command 316 line here and choose how the kernel should use it later on. 317 318choice 319 prompt "Kernel command line type" 320 default CMDLINE_BOOTLOADER 321 help 322 Choose how the kernel will handle the provided built-in command 323 line. 324 325config CMDLINE_BOOTLOADER 326 bool "Use bootloader kernel arguments if available" 327 help 328 Prefer the command-line passed by the boot loader if available. 329 Use the built-in command line as fallback in case we get nothing 330 during boot. This is the default behaviour. 331 332config CMDLINE_EXTEND 333 bool "Use built-in to extend bootloader kernel arguments" 334 help 335 The command-line arguments provided during boot will be 336 appended to the built-in command line. This is useful in 337 cases where the provided arguments are insufficient and 338 you don't want to or cannot modify them. 339 340config CMDLINE_FORCE 341 bool "Always use the built-in kernel command string" 342 help 343 Always use the built-in command line, even if we get one during 344 boot. This is useful in case you need to override the provided 345 command line on systems where you don't have or want control 346 over it. 347 348endchoice 349 350config DMI 351 bool "Enable DMI scanning" 352 select DMI_SCAN_MACHINE_NON_EFI_FALLBACK 353 default y 354 help 355 This enables SMBIOS/DMI feature for systems, and scanning of 356 DMI to identify machine quirks. 357 358config EFI 359 bool "EFI runtime service support" 360 select UCS2_STRING 361 select EFI_RUNTIME_WRAPPERS 362 help 363 This enables the kernel to use EFI runtime services that are 364 available (such as the EFI variable services). 365 366config EFI_STUB 367 bool "EFI boot stub support" 368 default y 369 depends on EFI 370 select EFI_GENERIC_STUB 371 help 372 This kernel feature allows the kernel to be loaded directly by 373 EFI firmware without the use of a bootloader. 374 375config SMP 376 bool "Multi-Processing support" 377 help 378 This enables support for systems with more than one CPU. If you have 379 a system with only one CPU, say N. If you have a system with more 380 than one CPU, say Y. 381 382 If you say N here, the kernel will run on uni- and multiprocessor 383 machines, but will use only one CPU of a multiprocessor machine. If 384 you say Y here, the kernel will run on many, but not all, 385 uniprocessor machines. On a uniprocessor machine, the kernel 386 will run faster if you say N here. 387 388 See also the SMP-HOWTO available at <http://www.tldp.org/docs.html#howto>. 389 390 If you don't know what to do here, say N. 391 392config HOTPLUG_CPU 393 bool "Support for hot-pluggable CPUs" 394 depends on SMP 395 select GENERIC_IRQ_MIGRATION 396 help 397 Say Y here to allow turning CPUs off and on. CPUs can be 398 controlled through /sys/devices/system/cpu. 399 (Note: power management support will enable this option 400 automatically on SMP systems. ) 401 Say N if you want to disable CPU hotplug. 402 403config NR_CPUS 404 int "Maximum number of CPUs (2-256)" 405 range 2 256 406 depends on SMP 407 default "64" 408 help 409 This allows you to specify the maximum number of CPUs which this 410 kernel will support. 411 412config NUMA 413 bool "NUMA Support" 414 select SMP 415 select ACPI_NUMA if ACPI 416 help 417 Say Y to compile the kernel with NUMA (Non-Uniform Memory Access) 418 support. This option improves performance on systems with more 419 than one NUMA node; on single node systems it is generally better 420 to leave it disabled. 421 422config NODES_SHIFT 423 int 424 default "6" 425 depends on NUMA 426 427config ARCH_FORCE_MAX_ORDER 428 int "Maximum zone order" 429 default "13" if PAGE_SIZE_64KB 430 default "11" if PAGE_SIZE_16KB 431 default "10" 432 help 433 The kernel memory allocator divides physically contiguous memory 434 blocks into "zones", where each zone is a power of two number of 435 pages. This option selects the largest power of two that the kernel 436 keeps in the memory allocator. If you need to allocate very large 437 blocks of physically contiguous memory, then you may need to 438 increase this value. 439 440 The page size is not necessarily 4KB. Keep this in mind 441 when choosing a value for this option. 442 443config ARCH_IOREMAP 444 bool "Enable LoongArch DMW-based ioremap()" 445 help 446 We use generic TLB-based ioremap() by default since it has page 447 protection support. However, you can enable LoongArch DMW-based 448 ioremap() for better performance. 449 450config ARCH_WRITECOMBINE 451 bool "Enable WriteCombine (WUC) for ioremap()" 452 help 453 LoongArch maintains cache coherency in hardware, but when paired 454 with LS7A chipsets the WUC attribute (Weak-ordered UnCached, which 455 is similar to WriteCombine) is out of the scope of cache coherency 456 machanism for PCIe devices (this is a PCIe protocol violation, which 457 may be fixed in newer chipsets). 458 459 This means WUC can only used for write-only memory regions now, so 460 this option is disabled by default, making WUC silently fallback to 461 SUC for ioremap(). You can enable this option if the kernel is ensured 462 to run on hardware without this bug. 463 464 You can override this setting via writecombine=on/off boot parameter. 465 466config ARCH_STRICT_ALIGN 467 bool "Enable -mstrict-align to prevent unaligned accesses" if EXPERT 468 default y 469 help 470 Not all LoongArch cores support h/w unaligned access, we can use 471 -mstrict-align build parameter to prevent unaligned accesses. 472 473 CPUs with h/w unaligned access support: 474 Loongson-2K2000/2K3000/3A5000/3C5000/3D5000. 475 476 CPUs without h/w unaligned access support: 477 Loongson-2K500/2K1000. 478 479 This option is enabled by default to make the kernel be able to run 480 on all LoongArch systems. But you can disable it manually if you want 481 to run kernel only on systems with h/w unaligned access support in 482 order to optimise for performance. 483 484config KEXEC 485 bool "Kexec system call" 486 select KEXEC_CORE 487 help 488 kexec is a system call that implements the ability to shutdown your 489 current kernel, and to start another kernel. It is like a reboot 490 but it is independent of the system firmware. And like a reboot 491 you can start any kernel with it, not just Linux. 492 493 The name comes from the similarity to the exec system call. 494 495config CRASH_DUMP 496 bool "Build kdump crash kernel" 497 select RELOCATABLE 498 help 499 Generate crash dump after being started by kexec. This should 500 be normally only set in special crash dump kernels which are 501 loaded in the main kernel with kexec-tools into a specially 502 reserved region and then later executed after a crash by 503 kdump/kexec. 504 505 For more details see Documentation/admin-guide/kdump/kdump.rst 506 507config RELOCATABLE 508 bool "Relocatable kernel" 509 help 510 This builds the kernel as a Position Independent Executable (PIE), 511 which retains all relocation metadata required, so as to relocate 512 the kernel binary at runtime to a different virtual address from 513 its link address. 514 515config RANDOMIZE_BASE 516 bool "Randomize the address of the kernel (KASLR)" 517 depends on RELOCATABLE 518 help 519 Randomizes the physical and virtual address at which the 520 kernel image is loaded, as a security feature that 521 deters exploit attempts relying on knowledge of the location 522 of kernel internals. 523 524 The kernel will be offset by up to RANDOMIZE_BASE_MAX_OFFSET. 525 526 If unsure, say N. 527 528config RANDOMIZE_BASE_MAX_OFFSET 529 hex "Maximum KASLR offset" if EXPERT 530 depends on RANDOMIZE_BASE 531 range 0x0 0x10000000 532 default "0x01000000" 533 help 534 When KASLR is active, this provides the maximum offset that will 535 be applied to the kernel image. It should be set according to the 536 amount of physical RAM available in the target system. 537 538 This is limited by the size of the lower address memory, 256MB. 539 540config SECCOMP 541 bool "Enable seccomp to safely compute untrusted bytecode" 542 depends on PROC_FS 543 default y 544 help 545 This kernel feature is useful for number crunching applications 546 that may need to compute untrusted bytecode during their 547 execution. By using pipes or other transports made available to 548 the process as file descriptors supporting the read/write 549 syscalls, it's possible to isolate those applications in 550 their own address space using seccomp. Once seccomp is 551 enabled via /proc/<pid>/seccomp, it cannot be disabled 552 and the task is only allowed to execute a few safe syscalls 553 defined by each seccomp mode. 554 555 If unsure, say Y. Only embedded should say N here. 556 557endmenu 558 559config ARCH_SELECT_MEMORY_MODEL 560 def_bool y 561 562config ARCH_FLATMEM_ENABLE 563 def_bool y 564 depends on !NUMA 565 566config ARCH_SPARSEMEM_ENABLE 567 def_bool y 568 select SPARSEMEM_VMEMMAP_ENABLE 569 help 570 Say Y to support efficient handling of sparse physical memory, 571 for architectures which are either NUMA (Non-Uniform Memory Access) 572 or have huge holes in the physical address space for other reasons. 573 See <file:Documentation/mm/numa.rst> for more. 574 575config ARCH_ENABLE_THP_MIGRATION 576 def_bool y 577 depends on TRANSPARENT_HUGEPAGE 578 579config ARCH_MEMORY_PROBE 580 def_bool y 581 depends on MEMORY_HOTPLUG 582 583config MMU 584 bool 585 default y 586 587config ARCH_MMAP_RND_BITS_MIN 588 default 12 589 590config ARCH_MMAP_RND_BITS_MAX 591 default 18 592 593menu "Power management options" 594 595config ARCH_SUSPEND_POSSIBLE 596 def_bool y 597 598config ARCH_HIBERNATION_POSSIBLE 599 def_bool y 600 601source "kernel/power/Kconfig" 602source "drivers/acpi/Kconfig" 603 604endmenu 605 606source "drivers/firmware/Kconfig" 607