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