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_NMI_SAFE_THIS_CPU_OPS 14 select ARCH_HAS_PTE_SPECIAL 15 select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST 16 select ARCH_INLINE_READ_LOCK if !PREEMPTION 17 select ARCH_INLINE_READ_LOCK_BH if !PREEMPTION 18 select ARCH_INLINE_READ_LOCK_IRQ if !PREEMPTION 19 select ARCH_INLINE_READ_LOCK_IRQSAVE if !PREEMPTION 20 select ARCH_INLINE_READ_UNLOCK if !PREEMPTION 21 select ARCH_INLINE_READ_UNLOCK_BH if !PREEMPTION 22 select ARCH_INLINE_READ_UNLOCK_IRQ if !PREEMPTION 23 select ARCH_INLINE_READ_UNLOCK_IRQRESTORE if !PREEMPTION 24 select ARCH_INLINE_WRITE_LOCK if !PREEMPTION 25 select ARCH_INLINE_WRITE_LOCK_BH if !PREEMPTION 26 select ARCH_INLINE_WRITE_LOCK_IRQ if !PREEMPTION 27 select ARCH_INLINE_WRITE_LOCK_IRQSAVE if !PREEMPTION 28 select ARCH_INLINE_WRITE_UNLOCK if !PREEMPTION 29 select ARCH_INLINE_WRITE_UNLOCK_BH if !PREEMPTION 30 select ARCH_INLINE_WRITE_UNLOCK_IRQ if !PREEMPTION 31 select ARCH_INLINE_WRITE_UNLOCK_IRQRESTORE if !PREEMPTION 32 select ARCH_INLINE_SPIN_TRYLOCK if !PREEMPTION 33 select ARCH_INLINE_SPIN_TRYLOCK_BH if !PREEMPTION 34 select ARCH_INLINE_SPIN_LOCK if !PREEMPTION 35 select ARCH_INLINE_SPIN_LOCK_BH if !PREEMPTION 36 select ARCH_INLINE_SPIN_LOCK_IRQ if !PREEMPTION 37 select ARCH_INLINE_SPIN_LOCK_IRQSAVE if !PREEMPTION 38 select ARCH_INLINE_SPIN_UNLOCK if !PREEMPTION 39 select ARCH_INLINE_SPIN_UNLOCK_BH if !PREEMPTION 40 select ARCH_INLINE_SPIN_UNLOCK_IRQ if !PREEMPTION 41 select ARCH_INLINE_SPIN_UNLOCK_IRQRESTORE if !PREEMPTION 42 select ARCH_KEEP_MEMBLOCK 43 select ARCH_MIGHT_HAVE_PC_PARPORT 44 select ARCH_MIGHT_HAVE_PC_SERIO 45 select ARCH_SPARSEMEM_ENABLE 46 select ARCH_STACKWALK 47 select ARCH_SUPPORTS_ACPI 48 select ARCH_SUPPORTS_ATOMIC_RMW 49 select ARCH_SUPPORTS_HUGETLBFS 50 select ARCH_SUPPORTS_NUMA_BALANCING 51 select ARCH_USE_BUILTIN_BSWAP 52 select ARCH_USE_CMPXCHG_LOCKREF 53 select ARCH_USE_QUEUED_RWLOCKS 54 select ARCH_USE_QUEUED_SPINLOCKS 55 select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT 56 select ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAP 57 select ARCH_WANT_LD_ORPHAN_WARN 58 select ARCH_WANTS_NO_INSTR 59 select BUILDTIME_TABLE_SORT 60 select COMMON_CLK 61 select CPU_PM 62 select EFI 63 select GENERIC_CLOCKEVENTS 64 select GENERIC_CMOS_UPDATE 65 select GENERIC_CPU_AUTOPROBE 66 select GENERIC_ENTRY 67 select GENERIC_GETTIMEOFDAY 68 select GENERIC_IOREMAP if !ARCH_IOREMAP 69 select GENERIC_IRQ_MULTI_HANDLER 70 select GENERIC_IRQ_PROBE 71 select GENERIC_IRQ_SHOW 72 select GENERIC_LIB_ASHLDI3 73 select GENERIC_LIB_ASHRDI3 74 select GENERIC_LIB_CMPDI2 75 select GENERIC_LIB_LSHRDI3 76 select GENERIC_LIB_UCMPDI2 77 select GENERIC_LIB_DEVMEM_IS_ALLOWED 78 select GENERIC_PCI_IOMAP 79 select GENERIC_SCHED_CLOCK 80 select GENERIC_SMP_IDLE_THREAD 81 select GENERIC_TIME_VSYSCALL 82 select GPIOLIB 83 select HAVE_ARCH_AUDITSYSCALL 84 select HAVE_ARCH_MMAP_RND_BITS if MMU 85 select HAVE_ARCH_SECCOMP_FILTER 86 select HAVE_ARCH_TRACEHOOK 87 select HAVE_ARCH_TRANSPARENT_HUGEPAGE 88 select HAVE_ASM_MODVERSIONS 89 select HAVE_CONTEXT_TRACKING_USER 90 select HAVE_C_RECORDMCOUNT 91 select HAVE_DEBUG_STACKOVERFLOW 92 select HAVE_DMA_CONTIGUOUS 93 select HAVE_DYNAMIC_FTRACE 94 select HAVE_DYNAMIC_FTRACE_WITH_ARGS 95 select HAVE_DYNAMIC_FTRACE_WITH_REGS 96 select HAVE_EBPF_JIT 97 select HAVE_EFFICIENT_UNALIGNED_ACCESS if !ARCH_STRICT_ALIGN 98 select HAVE_EXIT_THREAD 99 select HAVE_FAST_GUP 100 select HAVE_FTRACE_MCOUNT_RECORD 101 select HAVE_FUNCTION_ARG_ACCESS_API 102 select HAVE_FUNCTION_GRAPH_TRACER 103 select HAVE_FUNCTION_TRACER 104 select HAVE_GENERIC_VDSO 105 select HAVE_HW_BREAKPOINT if PERF_EVENTS 106 select HAVE_IOREMAP_PROT 107 select HAVE_IRQ_EXIT_ON_IRQ_STACK 108 select HAVE_IRQ_TIME_ACCOUNTING 109 select HAVE_KPROBES 110 select HAVE_KPROBES_ON_FTRACE 111 select HAVE_KRETPROBES 112 select HAVE_MOD_ARCH_SPECIFIC 113 select HAVE_NMI 114 select HAVE_PCI 115 select HAVE_PERF_EVENTS 116 select HAVE_PERF_REGS 117 select HAVE_PERF_USER_STACK_DUMP 118 select HAVE_REGS_AND_STACK_ACCESS_API 119 select HAVE_RSEQ 120 select HAVE_SETUP_PER_CPU_AREA if NUMA 121 select HAVE_STACKPROTECTOR 122 select HAVE_SYSCALL_TRACEPOINTS 123 select HAVE_TIF_NOHZ 124 select HAVE_VIRT_CPU_ACCOUNTING_GEN if !SMP 125 select IRQ_FORCED_THREADING 126 select IRQ_LOONGARCH_CPU 127 select MMU_GATHER_MERGE_VMAS if MMU 128 select MODULES_USE_ELF_RELA if MODULES 129 select NEED_PER_CPU_EMBED_FIRST_CHUNK 130 select NEED_PER_CPU_PAGE_FIRST_CHUNK 131 select OF 132 select OF_EARLY_FLATTREE 133 select PCI 134 select PCI_DOMAINS_GENERIC 135 select PCI_ECAM if ACPI 136 select PCI_LOONGSON 137 select PCI_MSI_ARCH_FALLBACKS 138 select PCI_QUIRKS 139 select PERF_USE_VMALLOC 140 select RTC_LIB 141 select SMP 142 select SPARSE_IRQ 143 select SYSCTL_ARCH_UNALIGN_ALLOW 144 select SYSCTL_ARCH_UNALIGN_NO_WARN 145 select SYSCTL_EXCEPTION_TRACE 146 select SWIOTLB 147 select TRACE_IRQFLAGS_SUPPORT 148 select USE_PERCPU_NUMA_NODE_ID 149 select USER_STACKTRACE_SUPPORT 150 select ZONE_DMA32 151 152config 32BIT 153 bool 154 155config 64BIT 156 def_bool y 157 158config CPU_HAS_FPU 159 bool 160 default y 161 162config CPU_HAS_PREFETCH 163 bool 164 default y 165 166config GENERIC_BUG 167 def_bool y 168 depends on BUG 169 170config GENERIC_BUG_RELATIVE_POINTERS 171 def_bool y 172 depends on GENERIC_BUG 173 174config GENERIC_CALIBRATE_DELAY 175 def_bool y 176 177config GENERIC_CSUM 178 def_bool y 179 180config GENERIC_HWEIGHT 181 def_bool y 182 183config L1_CACHE_SHIFT 184 int 185 default "6" 186 187config LOCKDEP_SUPPORT 188 bool 189 default y 190 191config STACKTRACE_SUPPORT 192 bool 193 default y 194 195# MACH_LOONGSON32 and MACH_LOONGSON64 are deliberately carried over from the 196# MIPS Loongson code, to preserve Loongson-specific code paths in drivers that 197# are shared between architectures, and specifically expecting the symbols. 198config MACH_LOONGSON32 199 def_bool 32BIT 200 201config MACH_LOONGSON64 202 def_bool 64BIT 203 204config FIX_EARLYCON_MEM 205 def_bool y 206 207config PAGE_SIZE_4KB 208 bool 209 210config PAGE_SIZE_16KB 211 bool 212 213config PAGE_SIZE_64KB 214 bool 215 216config PGTABLE_2LEVEL 217 bool 218 219config PGTABLE_3LEVEL 220 bool 221 222config PGTABLE_4LEVEL 223 bool 224 225config PGTABLE_LEVELS 226 int 227 default 2 if PGTABLE_2LEVEL 228 default 3 if PGTABLE_3LEVEL 229 default 4 if PGTABLE_4LEVEL 230 231config SCHED_OMIT_FRAME_POINTER 232 bool 233 default y 234 235config AS_HAS_EXPLICIT_RELOCS 236 def_bool $(as-instr,x:pcalau12i \$t0$(comma)%pc_hi20(x)) 237 238menu "Kernel type and options" 239 240source "kernel/Kconfig.hz" 241 242choice 243 prompt "Page Table Layout" 244 default 16KB_2LEVEL if 32BIT 245 default 16KB_3LEVEL if 64BIT 246 help 247 Allows choosing the page table layout, which is a combination 248 of page size and page table levels. The size of virtual memory 249 address space are determined by the page table layout. 250 251config 4KB_3LEVEL 252 bool "4KB with 3 levels" 253 select PAGE_SIZE_4KB 254 select PGTABLE_3LEVEL 255 help 256 This option selects 4KB page size with 3 level page tables, which 257 support a maximum of 39 bits of application virtual memory. 258 259config 4KB_4LEVEL 260 bool "4KB with 4 levels" 261 select PAGE_SIZE_4KB 262 select PGTABLE_4LEVEL 263 help 264 This option selects 4KB page size with 4 level page tables, which 265 support a maximum of 48 bits of application virtual memory. 266 267config 16KB_2LEVEL 268 bool "16KB with 2 levels" 269 select PAGE_SIZE_16KB 270 select PGTABLE_2LEVEL 271 help 272 This option selects 16KB page size with 2 level page tables, which 273 support a maximum of 36 bits of application virtual memory. 274 275config 16KB_3LEVEL 276 bool "16KB with 3 levels" 277 select PAGE_SIZE_16KB 278 select PGTABLE_3LEVEL 279 help 280 This option selects 16KB page size with 3 level page tables, which 281 support a maximum of 47 bits of application virtual memory. 282 283config 64KB_2LEVEL 284 bool "64KB with 2 levels" 285 select PAGE_SIZE_64KB 286 select PGTABLE_2LEVEL 287 help 288 This option selects 64KB page size with 2 level page tables, which 289 support a maximum of 42 bits of application virtual memory. 290 291config 64KB_3LEVEL 292 bool "64KB with 3 levels" 293 select PAGE_SIZE_64KB 294 select PGTABLE_3LEVEL 295 help 296 This option selects 64KB page size with 3 level page tables, which 297 support a maximum of 55 bits of application virtual memory. 298 299endchoice 300 301config CMDLINE 302 string "Built-in kernel command line" 303 help 304 For most platforms, the arguments for the kernel's command line 305 are provided at run-time, during boot. However, there are cases 306 where either no arguments are being provided or the provided 307 arguments are insufficient or even invalid. 308 309 When that occurs, it is possible to define a built-in command 310 line here and choose how the kernel should use it later on. 311 312choice 313 prompt "Kernel command line type" 314 default CMDLINE_BOOTLOADER 315 help 316 Choose how the kernel will handle the provided built-in command 317 line. 318 319config CMDLINE_BOOTLOADER 320 bool "Use bootloader kernel arguments if available" 321 help 322 Prefer the command-line passed by the boot loader if available. 323 Use the built-in command line as fallback in case we get nothing 324 during boot. This is the default behaviour. 325 326config CMDLINE_EXTEND 327 bool "Use built-in to extend bootloader kernel arguments" 328 help 329 The command-line arguments provided during boot will be 330 appended to the built-in command line. This is useful in 331 cases where the provided arguments are insufficient and 332 you don't want to or cannot modify them. 333 334config CMDLINE_FORCE 335 bool "Always use the built-in kernel command string" 336 help 337 Always use the built-in command line, even if we get one during 338 boot. This is useful in case you need to override the provided 339 command line on systems where you don't have or want control 340 over it. 341 342endchoice 343 344config DMI 345 bool "Enable DMI scanning" 346 select DMI_SCAN_MACHINE_NON_EFI_FALLBACK 347 default y 348 help 349 This enables SMBIOS/DMI feature for systems, and scanning of 350 DMI to identify machine quirks. 351 352config EFI 353 bool "EFI runtime service support" 354 select UCS2_STRING 355 select EFI_RUNTIME_WRAPPERS 356 help 357 This enables the kernel to use EFI runtime services that are 358 available (such as the EFI variable services). 359 360config EFI_STUB 361 bool "EFI boot stub support" 362 default y 363 depends on EFI 364 select EFI_GENERIC_STUB 365 help 366 This kernel feature allows the kernel to be loaded directly by 367 EFI firmware without the use of a bootloader. 368 369config SMP 370 bool "Multi-Processing support" 371 help 372 This enables support for systems with more than one CPU. If you have 373 a system with only one CPU, say N. If you have a system with more 374 than one CPU, say Y. 375 376 If you say N here, the kernel will run on uni- and multiprocessor 377 machines, but will use only one CPU of a multiprocessor machine. If 378 you say Y here, the kernel will run on many, but not all, 379 uniprocessor machines. On a uniprocessor machine, the kernel 380 will run faster if you say N here. 381 382 See also the SMP-HOWTO available at <http://www.tldp.org/docs.html#howto>. 383 384 If you don't know what to do here, say N. 385 386config HOTPLUG_CPU 387 bool "Support for hot-pluggable CPUs" 388 depends on SMP 389 select GENERIC_IRQ_MIGRATION 390 help 391 Say Y here to allow turning CPUs off and on. CPUs can be 392 controlled through /sys/devices/system/cpu. 393 (Note: power management support will enable this option 394 automatically on SMP systems. ) 395 Say N if you want to disable CPU hotplug. 396 397config NR_CPUS 398 int "Maximum number of CPUs (2-256)" 399 range 2 256 400 depends on SMP 401 default "64" 402 help 403 This allows you to specify the maximum number of CPUs which this 404 kernel will support. 405 406config NUMA 407 bool "NUMA Support" 408 select SMP 409 select ACPI_NUMA if ACPI 410 help 411 Say Y to compile the kernel with NUMA (Non-Uniform Memory Access) 412 support. This option improves performance on systems with more 413 than one NUMA node; on single node systems it is generally better 414 to leave it disabled. 415 416config NODES_SHIFT 417 int 418 default "6" 419 depends on NUMA 420 421config ARCH_FORCE_MAX_ORDER 422 int "Maximum zone order" 423 range 14 64 if PAGE_SIZE_64KB 424 default "14" if PAGE_SIZE_64KB 425 range 12 64 if PAGE_SIZE_16KB 426 default "12" if PAGE_SIZE_16KB 427 range 11 64 428 default "11" 429 help 430 The kernel memory allocator divides physically contiguous memory 431 blocks into "zones", where each zone is a power of two number of 432 pages. This option selects the largest power of two that the kernel 433 keeps in the memory allocator. If you need to allocate very large 434 blocks of physically contiguous memory, then you may need to 435 increase this value. 436 437 This config option is actually maximum order plus one. For example, 438 a value of 11 means that the largest free memory block is 2^10 pages. 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