xref: /linux/arch/loongarch/Kconfig (revision b49024d79fb7304f646003fcd8846ef26dea7e92)
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_HOTPLUG_CPU if ACPI_PROCESSOR && HOTPLUG_CPU
9	select ACPI_PPTT if ACPI
10	select ACPI_SYSTEM_POWER_STATES_SUPPORT	if ACPI
11	select ARCH_BINFMT_ELF_STATE
12	select ARCH_NEEDS_DEFER_KASAN
13	select ARCH_DISABLE_KASAN_INLINE
14	select ARCH_ENABLE_MEMORY_HOTPLUG
15	select ARCH_HAS_PMD_SOFTLEAVES if TRANSPARENT_HUGEPAGE
16	select ARCH_HAS_ACPI_TABLE_UPGRADE	if ACPI
17	select ARCH_HAS_CPU_FINALIZE_INIT
18	select ARCH_HAS_CURRENT_STACK_POINTER
19	select ARCH_HAS_DEBUG_VM_PGTABLE
20	select ARCH_HAS_FAST_MULTIPLIER
21	select ARCH_HAS_FORTIFY_SOURCE
22	select ARCH_HAS_KCOV
23	select ARCH_HAS_KERNEL_FPU_SUPPORT if 64BIT && CPU_HAS_FPU
24	select ARCH_HAS_NMI_SAFE_THIS_CPU_OPS
25	select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
26	select ARCH_HAS_PREEMPT_LAZY
27	select ARCH_HAS_PTE_SPECIAL if 64BIT
28	select ARCH_HAS_SET_MEMORY
29	select ARCH_HAS_SET_DIRECT_MAP
30	select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
31	select ARCH_HAS_UBSAN
32	select ARCH_HAS_VDSO_ARCH_DATA
33	select ARCH_INLINE_READ_LOCK if !PREEMPTION
34	select ARCH_INLINE_READ_LOCK_BH if !PREEMPTION
35	select ARCH_INLINE_READ_LOCK_IRQ if !PREEMPTION
36	select ARCH_INLINE_READ_LOCK_IRQSAVE if !PREEMPTION
37	select ARCH_INLINE_READ_UNLOCK if !PREEMPTION
38	select ARCH_INLINE_READ_UNLOCK_BH if !PREEMPTION
39	select ARCH_INLINE_READ_UNLOCK_IRQ if !PREEMPTION
40	select ARCH_INLINE_READ_UNLOCK_IRQRESTORE if !PREEMPTION
41	select ARCH_INLINE_WRITE_LOCK if !PREEMPTION
42	select ARCH_INLINE_WRITE_LOCK_BH if !PREEMPTION
43	select ARCH_INLINE_WRITE_LOCK_IRQ if !PREEMPTION
44	select ARCH_INLINE_WRITE_LOCK_IRQSAVE if !PREEMPTION
45	select ARCH_INLINE_WRITE_UNLOCK if !PREEMPTION
46	select ARCH_INLINE_WRITE_UNLOCK_BH if !PREEMPTION
47	select ARCH_INLINE_WRITE_UNLOCK_IRQ if !PREEMPTION
48	select ARCH_INLINE_WRITE_UNLOCK_IRQRESTORE if !PREEMPTION
49	select ARCH_INLINE_SPIN_TRYLOCK if !PREEMPTION
50	select ARCH_INLINE_SPIN_TRYLOCK_BH if !PREEMPTION
51	select ARCH_INLINE_SPIN_LOCK if !PREEMPTION
52	select ARCH_INLINE_SPIN_LOCK_BH if !PREEMPTION
53	select ARCH_INLINE_SPIN_LOCK_IRQ if !PREEMPTION
54	select ARCH_INLINE_SPIN_LOCK_IRQSAVE if !PREEMPTION
55	select ARCH_INLINE_SPIN_UNLOCK if !PREEMPTION
56	select ARCH_INLINE_SPIN_UNLOCK_BH if !PREEMPTION
57	select ARCH_INLINE_SPIN_UNLOCK_IRQ if !PREEMPTION
58	select ARCH_INLINE_SPIN_UNLOCK_IRQRESTORE if !PREEMPTION
59	select ARCH_KEEP_MEMBLOCK
60	select ARCH_MIGHT_HAVE_PC_PARPORT
61	select ARCH_MIGHT_HAVE_PC_SERIO
62	select ARCH_STACKWALK
63	select ARCH_SUPPORTS_ACPI
64	select ARCH_SUPPORTS_ATOMIC_RMW
65	select ARCH_SUPPORTS_HUGETLBFS if 64BIT
66	select ARCH_SUPPORTS_INT128 if CC_HAS_INT128
67	select ARCH_SUPPORTS_LTO_CLANG
68	select ARCH_SUPPORTS_LTO_CLANG_THIN
69	select ARCH_SUPPORTS_MSEAL_SYSTEM_MAPPINGS
70	select ARCH_HAS_PTE_PROTNONE if 64BIT
71	select ARCH_SUPPORTS_NUMA_BALANCING if NUMA
72	select ARCH_SUPPORTS_PER_VMA_LOCK
73	select ARCH_SUPPORTS_RT
74	select ARCH_SUPPORTS_SCHED_SMT if SMP
75	select ARCH_SUPPORTS_SCHED_MC  if SMP
76	select ARCH_USE_BUILTIN_BSWAP
77	select ARCH_USE_CMPXCHG_LOCKREF
78	select ARCH_USE_MEMTEST
79	select ARCH_USE_QUEUED_RWLOCKS
80	select ARCH_USE_QUEUED_SPINLOCKS
81	select ARCH_WANT_DEFAULT_BPF_JIT if HAVE_EBPF_JIT
82	select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT
83	select ARCH_WANT_LD_ORPHAN_WARN
84	select ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP if 64BIT
85	select ARCH_WANTS_NO_INSTR
86	select ARCH_WANTS_THP_SWAP if HAVE_ARCH_TRANSPARENT_HUGEPAGE
87	select BUILDTIME_TABLE_SORT
88	select COMMON_CLK
89	select CPU_PM
90	select EDAC_SUPPORT
91	select EFI
92	select GENERIC_ATOMIC64 if 32BIT
93	select GENERIC_CLOCKEVENTS
94	select GENERIC_CMOS_UPDATE
95	select GENERIC_CPU_AUTOPROBE
96	select GENERIC_CPU_DEVICES
97	select GENERIC_CPU_VULNERABILITIES
98	select GENERIC_ENTRY
99	select GENERIC_GETTIMEOFDAY if 64BIT
100	select GENERIC_IOREMAP if !ARCH_IOREMAP
101	select GENERIC_IRQ_MATRIX_ALLOCATOR
102	select GENERIC_IRQ_MULTI_HANDLER
103	select GENERIC_IRQ_PROBE
104	select GENERIC_IRQ_SHOW
105	select GENERIC_LIB_ASHLDI3
106	select GENERIC_LIB_ASHRDI3
107	select GENERIC_LIB_CMPDI2
108	select GENERIC_LIB_LSHRDI3
109	select GENERIC_LIB_UCMPDI2
110	select GENERIC_LIB_DEVMEM_IS_ALLOWED
111	select GENERIC_PCI_IOMAP
112	select GENERIC_SCHED_CLOCK
113	select GENERIC_SMP_IDLE_THREAD
114	select GPIOLIB
115	select HAS_IOPORT
116	select HAVE_ALIGNED_STRUCT_PAGE if 64BIT
117	select HAVE_ARCH_AUDITSYSCALL
118	select HAVE_ARCH_BITREVERSE if 64BIT && BITREVERSE
119	select HAVE_ARCH_JUMP_LABEL
120	select HAVE_ARCH_JUMP_LABEL_RELATIVE
121	select HAVE_ARCH_KASAN if 64BIT
122	select HAVE_ARCH_KFENCE if 64BIT
123	select HAVE_ARCH_KGDB if PERF_EVENTS
124	select HAVE_ARCH_KSTACK_ERASE
125	select HAVE_ARCH_MMAP_RND_BITS if MMU
126	select HAVE_ARCH_RANDOMIZE_KSTACK_OFFSET
127	select HAVE_ARCH_SECCOMP
128	select HAVE_ARCH_SECCOMP_FILTER
129	select HAVE_ARCH_TRACEHOOK
130	select HAVE_ARCH_TRANSPARENT_HUGEPAGE if 64BIT
131	select HAVE_ARCH_USERFAULTFD_MINOR if 64BIT && USERFAULTFD
132	select HAVE_ASM_MODVERSIONS
133	select HAVE_CMPXCHG_DOUBLE
134	select HAVE_CMPXCHG_LOCAL
135	select HAVE_CONTEXT_TRACKING_USER
136	select HAVE_C_RECORDMCOUNT
137	select HAVE_DEBUG_KMEMLEAK
138	select HAVE_DEBUG_STACKOVERFLOW
139	select HAVE_DMA_CONTIGUOUS
140	select HAVE_DYNAMIC_FTRACE
141	select HAVE_DYNAMIC_FTRACE_WITH_ARGS
142	select HAVE_FTRACE_REGS_HAVING_PT_REGS
143	select HAVE_DYNAMIC_FTRACE_WITH_DIRECT_CALLS
144	select HAVE_DYNAMIC_FTRACE_WITH_REGS
145	select HAVE_EBPF_JIT if 64BIT
146	select HAVE_EFFICIENT_UNALIGNED_ACCESS if !ARCH_STRICT_ALIGN
147	select HAVE_EXIT_THREAD
148	select HAVE_GENERIC_TIF_BITS
149	select HAVE_GUP_FAST
150	select HAVE_FTRACE_GRAPH_FUNC
151	select HAVE_FUNCTION_ARG_ACCESS_API
152	select HAVE_FUNCTION_ERROR_INJECTION
153	select HAVE_FUNCTION_GRAPH_FREGS
154	select HAVE_FUNCTION_GRAPH_TRACER
155	select HAVE_FUNCTION_TRACER
156	select HAVE_GCC_PLUGINS
157	select HAVE_HW_BREAKPOINT if PERF_EVENTS
158	select HAVE_IOREMAP_PROT
159	select HAVE_IRQ_EXIT_ON_IRQ_STACK
160	select HAVE_IRQ_TIME_ACCOUNTING
161	select HAVE_KPROBES
162	select HAVE_KPROBES_ON_FTRACE
163	select HAVE_KRETPROBES
164	select HAVE_LIVEPATCH
165	select HAVE_MOD_ARCH_SPECIFIC
166	select HAVE_NMI
167	select HAVE_OBJTOOL if AS_HAS_EXPLICIT_RELOCS && AS_HAS_THIN_ADD_SUB && 64BIT
168	select HAVE_PCI
169	select HAVE_PERF_EVENTS if 64BIT
170	select HAVE_PERF_REGS
171	select HAVE_PERF_USER_STACK_DUMP
172	select HAVE_POSIX_CPU_TIMERS_TASK_WORK
173	select HAVE_PREEMPT_DYNAMIC_KEY
174	select HAVE_REGS_AND_STACK_ACCESS_API
175	select HAVE_RELIABLE_STACKTRACE if UNWINDER_ORC
176	select HAVE_RETHOOK
177	select HAVE_RSEQ
178	select HAVE_RUST
179	select HAVE_SAMPLE_FTRACE_DIRECT
180	select HAVE_SAMPLE_FTRACE_DIRECT_MULTI
181	select HAVE_SETUP_PER_CPU_AREA if NUMA
182	select HAVE_STACK_VALIDATION if HAVE_OBJTOOL
183	select HAVE_STACKPROTECTOR
184	select HAVE_SYSCALL_TRACEPOINTS
185	select HAVE_TIF_NOHZ
186	select HAVE_VIRT_CPU_ACCOUNTING_GEN
187	select HOTPLUG_SMT if HOTPLUG_CPU
188	select IRQ_FORCED_THREADING
189	select IRQ_LOONGARCH_CPU
190	select LOCK_MM_AND_FIND_VMA
191	select MMU_GATHER_MERGE_VMAS if MMU
192	select MMU_GATHER_RCU_TABLE_FREE
193	select MODULES_USE_ELF_RELA if MODULES
194	select NEED_PER_CPU_EMBED_FIRST_CHUNK
195	select NEED_PER_CPU_PAGE_FIRST_CHUNK
196	select NUMA_MEMBLKS if NUMA
197	select OF
198	select OF_EARLY_FLATTREE
199	select PCI
200	select PCI_DOMAINS_GENERIC
201	select PCI_ECAM if ACPI
202	select PCI_LOONGSON
203	select PCI_MSI_ARCH_FALLBACKS
204	select PCI_QUIRKS
205	select PERF_USE_VMALLOC
206	select RTC_LIB
207	select SPARSE_IRQ
208	select SYSCTL_ARCH_UNALIGN_ALLOW
209	select SYSCTL_ARCH_UNALIGN_NO_WARN
210	select SYSCTL_EXCEPTION_TRACE
211	select SWIOTLB if 64BIT
212	select THREAD_INFO_IN_TASK
213	select TRACE_IRQFLAGS_SUPPORT
214	select USE_PERCPU_NUMA_NODE_ID
215	select USER_STACKTRACE_SUPPORT
216	select VDSO_DATASTORE
217	select VDSO_GETRANDOM
218	select ZONE_DMA32 if 64BIT
219
220menu "Kernel type and options"
221
222choice
223	prompt "Kernel type"
224	default 64BIT # Keep existing behavior
225
226config 32BIT
227	bool "32-bit kernel"
228	help
229	  Select this option if you want to build a 32-bit kernel.
230
231config 64BIT
232	bool "64-bit kernel"
233	help
234	  Select this option if you want to build a 64-bit kernel.
235
236endchoice
237
238if 32BIT
239
240choice
241	prompt "32-bit kernel sub-type"
242
243config 32BIT_REDUCED
244	bool "32-bit kernel for LA32R"
245	help
246	  Select this option if you want to build a 32-bit kernel for
247	  LoongArch32 Reduced (LA32R).
248
249config 32BIT_STANDARD
250	bool "32-bit kernel for LA32S"
251	help
252	  Select this option if you want to build a 32-bit kernel for
253	  LoongArch32 Standard (LA32S).
254
255endchoice
256
257endif
258
259config GENERIC_BUG
260	def_bool y
261	depends on BUG
262
263config GENERIC_BUG_RELATIVE_POINTERS
264	def_bool y
265	depends on GENERIC_BUG
266
267config GENERIC_CALIBRATE_DELAY
268	def_bool y
269
270config GENERIC_CSUM
271	def_bool y
272
273config GENERIC_HWEIGHT
274	def_bool y
275
276config L1_CACHE_SHIFT
277	int
278	default "6"
279
280config LOCKDEP_SUPPORT
281	bool
282	default y
283
284config STACKTRACE_SUPPORT
285	bool
286	default y
287
288# MACH_LOONGSON32 and MACH_LOONGSON64 are deliberately carried over from the
289# MIPS Loongson code, to preserve Loongson-specific code paths in drivers that
290# are shared between architectures, and specifically expecting the symbols.
291config MACH_LOONGSON32
292	def_bool 32BIT
293
294config MACH_LOONGSON64
295	def_bool 64BIT
296
297config FIX_EARLYCON_MEM
298	def_bool !ARCH_IOREMAP
299
300config PGTABLE_2LEVEL
301	bool
302
303config PGTABLE_3LEVEL
304	bool
305
306config PGTABLE_4LEVEL
307	bool
308
309config PGTABLE_LEVELS
310	int
311	default 2 if PGTABLE_2LEVEL
312	default 3 if PGTABLE_3LEVEL
313	default 4 if PGTABLE_4LEVEL
314
315config SCHED_OMIT_FRAME_POINTER
316	bool
317	default y
318
319config AS_HAS_EXPLICIT_RELOCS
320	def_bool $(as-instr,x:pcalau12i \$t0$(comma)%pc_hi20(x))
321
322config AS_HAS_FCSR_CLASS
323	def_bool $(as-instr,movfcsr2gr \$t0$(comma)\$fcsr0)
324
325config AS_HAS_THIN_ADD_SUB
326	def_bool $(cc-option,-Wa$(comma)-mthin-add-sub) || AS_IS_LLVM
327
328config AS_HAS_LSX_EXTENSION
329	def_bool $(as-instr,vld \$vr0$(comma)\$a0$(comma)0)
330
331config AS_HAS_LASX_EXTENSION
332	def_bool $(as-instr,xvld \$xr0$(comma)\$a0$(comma)0)
333
334config AS_HAS_LBT_EXTENSION
335	def_bool $(as-instr,movscr2gr \$a0$(comma)\$scr0)
336
337config AS_HAS_LVZ_EXTENSION
338	def_bool $(as-instr,hvcl 0)
339
340config AS_HAS_SCQ_EXTENSION
341	def_bool $(as-instr,sc.q \$t0$(comma)\$t1$(comma)\$t2)
342
343config CC_HAS_ANNOTATE_TABLEJUMP
344	def_bool $(cc-option,-mannotate-tablejump)
345
346config RUSTC_HAS_ANNOTATE_TABLEJUMP
347	depends on RUST
348	def_bool $(rustc-option,-Cllvm-args=--loongarch-annotate-tablejump)
349
350source "kernel/Kconfig.hz"
351
352config HIGHMEM
353	bool "High Memory Support"
354	depends on 32BIT
355	select KMAP_LOCAL
356
357choice
358	prompt "Page Table Layout"
359	default 16KB_2LEVEL if 32BIT
360	default 16KB_3LEVEL if 64BIT
361	help
362	  Allows choosing the page table layout, which is a combination
363	  of page size and page table levels. The size of virtual memory
364	  address space are determined by the page table layout.
365
366config 4KB_2LEVEL
367	bool "4KB with 2 levels"
368	select HAVE_PAGE_SIZE_4KB
369	select PGTABLE_2LEVEL
370	help
371	  This option selects 4KB page size with 2 level page tables, which
372	  support a maximum of 32 bits of application virtual memory.
373
374config 4KB_3LEVEL
375	bool "4KB with 3 levels"
376	depends on 64BIT
377	select HAVE_PAGE_SIZE_4KB
378	select PGTABLE_3LEVEL
379	help
380	  This option selects 4KB page size with 3 level page tables, which
381	  support a maximum of 39 bits of application virtual memory.
382
383config 4KB_4LEVEL
384	bool "4KB with 4 levels"
385	depends on 64BIT
386	select HAVE_PAGE_SIZE_4KB
387	select PGTABLE_4LEVEL
388	help
389	  This option selects 4KB page size with 4 level page tables, which
390	  support a maximum of 48 bits of application virtual memory.
391
392config 16KB_2LEVEL
393	bool "16KB with 2 levels"
394	select HAVE_PAGE_SIZE_16KB
395	select PGTABLE_2LEVEL
396	help
397	  This option selects 16KB page size with 2 level page tables, which
398	  support a maximum of 36 bits of application virtual memory.
399
400config 16KB_3LEVEL
401	bool "16KB with 3 levels"
402	depends on 64BIT
403	select HAVE_PAGE_SIZE_16KB
404	select PGTABLE_3LEVEL
405	help
406	  This option selects 16KB page size with 3 level page tables, which
407	  support a maximum of 47 bits of application virtual memory.
408
409config 64KB_2LEVEL
410	bool "64KB with 2 levels"
411	select HAVE_PAGE_SIZE_64KB
412	select PGTABLE_2LEVEL
413	help
414	  This option selects 64KB page size with 2 level page tables, which
415	  support a maximum of 42 bits of application virtual memory.
416
417config 64KB_3LEVEL
418	bool "64KB with 3 levels"
419	depends on 64BIT
420	select HAVE_PAGE_SIZE_64KB
421	select PGTABLE_3LEVEL
422	help
423	  This option selects 64KB page size with 3 level page tables, which
424	  support a maximum of 55 bits of application virtual memory.
425
426endchoice
427
428config CMDLINE
429	string "Built-in kernel command line"
430	help
431	  For most platforms, the arguments for the kernel's command line
432	  are provided at run-time, during boot. However, there are cases
433	  where either no arguments are being provided or the provided
434	  arguments are insufficient or even invalid.
435
436	  When that occurs, it is possible to define a built-in command
437	  line here and choose how the kernel should use it later on.
438
439choice
440	prompt "Kernel command line type"
441	default CMDLINE_BOOTLOADER
442	help
443	  Choose how the kernel will handle the provided built-in command
444	  line.
445
446config CMDLINE_BOOTLOADER
447	bool "Use bootloader kernel arguments if available"
448	help
449	  Prefer the command-line passed by the boot loader if available.
450	  Use the built-in command line as fallback in case we get nothing
451	  during boot. This is the default behaviour.
452
453config CMDLINE_EXTEND
454	bool "Use built-in to extend bootloader kernel arguments"
455	help
456	  The built-in command line will be appended to the command-
457	  line arguments provided during boot. This is useful in
458	  cases where the provided arguments are insufficient and
459	  you don't want to or cannot modify them.
460
461config CMDLINE_FORCE
462	bool "Always use the built-in kernel command string"
463	help
464	  Always use the built-in command line, even if we get one during
465	  boot. This is useful in case you need to override the provided
466	  command line on systems where you don't have or want control
467	  over it.
468
469endchoice
470
471config BUILTIN_DTB
472	bool "Enable built-in dtb in kernel"
473	depends on OF
474	select GENERIC_BUILTIN_DTB
475	help
476	  Some existing systems do not provide a canonical device tree to
477	  the kernel at boot time. Let's provide a device tree table in the
478	  kernel, keyed by the dts filename, containing the relevant DTBs.
479
480	  Built-in DTBs are generic enough and can be used as references.
481
482config BUILTIN_DTB_NAME
483	string "Source file for built-in dtb"
484	depends on BUILTIN_DTB
485	help
486	  Base name (without suffix, relative to arch/loongarch/boot/dts/)
487	  for the DTS file that will be used to produce the DTB linked into
488	  the kernel.
489
490config DMI
491	bool "Enable DMI scanning"
492	select DMI_SCAN_MACHINE_NON_EFI_FALLBACK
493	default y
494	help
495	  This enables SMBIOS/DMI feature for systems, and scanning of
496	  DMI to identify machine quirks.
497
498config EFI
499	bool "EFI runtime service support"
500	select UCS2_STRING
501	select EFI_RUNTIME_WRAPPERS
502	help
503	  This enables the kernel to use EFI runtime services that are
504	  available (such as the EFI variable services).
505
506config EFI_STUB
507	bool "EFI boot stub support"
508	default y
509	depends on EFI
510	select EFI_GENERIC_STUB
511	help
512	  This kernel feature allows the kernel to be loaded directly by
513	  EFI firmware without the use of a bootloader.
514
515config SMP
516	bool "Multi-Processing support"
517	depends on 64BIT
518	help
519	  This enables support for systems with more than one CPU. If you have
520	  a system with only one CPU, say N. If you have a system with more
521	  than one CPU, say Y.
522
523	  If you say N here, the kernel will run on uni- and multiprocessor
524	  machines, but will use only one CPU of a multiprocessor machine. If
525	  you say Y here, the kernel will run on many, but not all,
526	  uniprocessor machines. On a uniprocessor machine, the kernel
527	  will run faster if you say N here.
528
529	  See also the SMP-HOWTO available at <http://www.tldp.org/docs.html#howto>.
530
531	  If you don't know what to do here, say N.
532
533config HOTPLUG_CPU
534	bool "Support for hot-pluggable CPUs"
535	depends on SMP
536	select GENERIC_IRQ_MIGRATION
537	help
538	  Say Y here to allow turning CPUs off and on. CPUs can be
539	  controlled through /sys/devices/system/cpu.
540	  (Note: power management support will enable this option
541	    automatically on SMP systems. )
542	  Say N if you want to disable CPU hotplug.
543
544config NR_CPUS
545	int "Maximum number of CPUs (2-2048)"
546	range 2 2048
547	default "2048"
548	depends on SMP
549	help
550	  This allows you to specify the maximum number of CPUs which this
551	  kernel will support.
552
553config NUMA
554	bool "NUMA Support"
555	select SMP
556	depends on 64BIT
557	help
558	  Say Y to compile the kernel with NUMA (Non-Uniform Memory Access)
559	  support.  This option improves performance on systems with more
560	  than one NUMA node; on single node systems it is generally better
561	  to leave it disabled.
562
563config NODES_SHIFT
564	int
565	default "6"
566	depends on NUMA
567
568config ARCH_FORCE_MAX_ORDER
569	int "Maximum zone order"
570	default "13" if PAGE_SIZE_64KB
571	default "11" if PAGE_SIZE_16KB
572	default "10"
573	help
574	  The kernel memory allocator divides physically contiguous memory
575	  blocks into "zones", where each zone is a power of two number of
576	  pages.  This option selects the largest power of two that the kernel
577	  keeps in the memory allocator.  If you need to allocate very large
578	  blocks of physically contiguous memory, then you may need to
579	  increase this value.
580
581	  The page size is not necessarily 4KB.  Keep this in mind
582	  when choosing a value for this option.
583
584config ARCH_IOREMAP
585	bool "Enable LoongArch DMW-based ioremap()"
586	help
587	  We use generic TLB-based ioremap() by default since it has page
588	  protection support. However, you can enable LoongArch DMW-based
589	  ioremap() for better performance.
590
591config ARCH_WRITECOMBINE
592	bool "Enable WriteCombine (WUC) for ioremap()"
593	help
594	  LoongArch maintains cache coherency in hardware, but when paired
595	  with LS7A chipsets the WUC attribute (Weak-ordered UnCached, which
596	  is similar to WriteCombine) is out of the scope of cache coherency
597	  machanism for PCIe devices (this is a PCIe protocol violation, which
598	  may be fixed in newer chipsets).
599
600	  This means WUC can only used for write-only memory regions now, so
601	  this option is disabled by default, making WUC silently fallback to
602	  SUC for ioremap(). You can enable this option if the kernel is ensured
603	  to run on hardware without this bug.
604
605	  You can override this setting via writecombine=on/off boot parameter.
606
607config ARCH_STRICT_ALIGN
608	bool "Enable -mstrict-align to prevent unaligned accesses" if EXPERT
609	default y
610	help
611	  Not all LoongArch cores support h/w unaligned access, we can use
612	  -mstrict-align build parameter to prevent unaligned accesses.
613
614	  CPUs with h/w unaligned access support:
615	  Loongson-2K2000/2K3000 and all of Loongson-3 series processors
616	  based on LoongArch.
617
618	  CPUs without h/w unaligned access support:
619	  Loongson-2K0300/2K0500/2K1000.
620
621	  If you want to make sure whether to support unaligned memory access
622	  on your hardware, please read the bit 20 (UAL) of CPUCFG1 register.
623
624	  This option is enabled by default to make the kernel be able to run
625	  on all LoongArch systems. But you can disable it manually if you want
626	  to run kernel only on systems with h/w unaligned access support in
627	  order to optimise for performance.
628
629config CPU_HAS_AMO
630	bool
631	default 64BIT
632
633config CPU_HAS_FPU
634	bool
635	default y
636
637config CPU_HAS_LSX
638	bool "Support for the Loongson SIMD Extension"
639	depends on AS_HAS_LSX_EXTENSION && 64BIT
640	help
641	  Loongson SIMD Extension (LSX) introduces 128 bit wide vector registers
642	  and a set of SIMD instructions to operate on them. When this option
643	  is enabled the kernel will support allocating & switching LSX
644	  vector register contexts. If you know that your kernel will only be
645	  running on CPUs which do not support LSX or that your userland will
646	  not be making use of it then you may wish to say N here to reduce
647	  the size & complexity of your kernel.
648
649	  If unsure, say Y.
650
651config CPU_HAS_LASX
652	bool "Support for the Loongson Advanced SIMD Extension"
653	depends on CPU_HAS_LSX
654	depends on AS_HAS_LASX_EXTENSION && 64BIT
655	help
656	  Loongson Advanced SIMD Extension (LASX) introduces 256 bit wide vector
657	  registers and a set of SIMD instructions to operate on them. When this
658	  option is enabled the kernel will support allocating & switching LASX
659	  vector register contexts. If you know that your kernel will only be
660	  running on CPUs which do not support LASX or that your userland will
661	  not be making use of it then you may wish to say N here to reduce
662	  the size & complexity of your kernel.
663
664	  If unsure, say Y.
665
666config CPU_HAS_LBT
667	bool "Support for the Loongson Binary Translation Extension"
668	depends on AS_HAS_LBT_EXTENSION && 64BIT
669	help
670	  Loongson Binary Translation (LBT) introduces 4 scratch registers (SCR0
671	  to SCR3), x86/ARM eflags (eflags) and x87 fpu stack pointer (ftop).
672	  Enabling this option allows the kernel to allocate and switch registers
673	  specific to LBT.
674
675	  If you want to use this feature, such as the Loongson Architecture
676	  Translator (LAT), say Y.
677
678config CPU_HAS_PREFETCH
679	bool
680	default y
681
682config ARCH_SUPPORTS_KEXEC
683	def_bool y
684
685config ARCH_SUPPORTS_KEXEC_FILE
686	def_bool 64BIT
687
688config ARCH_SELECTS_KEXEC_FILE
689	def_bool 64BIT
690	depends on KEXEC_FILE
691	select KEXEC_ELF
692	select RELOCATABLE
693	select HAVE_IMA_KEXEC if IMA
694
695config ARCH_SUPPORTS_CRASH_DUMP
696	def_bool 64BIT
697
698config ARCH_DEFAULT_CRASH_DUMP
699	def_bool 64BIT
700
701config ARCH_SELECTS_CRASH_DUMP
702	def_bool 64BIT
703	depends on CRASH_DUMP
704	select RELOCATABLE
705
706config ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION
707	def_bool CRASH_RESERVE
708
709config RELOCATABLE
710	bool "Relocatable kernel"
711	depends on 64BIT
712	select ARCH_HAS_RELR
713	help
714	  This builds the kernel as a Position Independent Executable (PIE),
715	  which retains all relocation metadata required, so as to relocate
716	  the kernel binary at runtime to a different virtual address from
717	  its link address.
718
719config RANDOMIZE_BASE
720	bool "Randomize the address of the kernel (KASLR)"
721	depends on RELOCATABLE
722	help
723	   Randomizes the physical and virtual address at which the
724	   kernel image is loaded, as a security feature that
725	   deters exploit attempts relying on knowledge of the location
726	   of kernel internals.
727
728	   The kernel will be offset by up to RANDOMIZE_BASE_MAX_OFFSET.
729
730	   If unsure, say N.
731
732config RANDOMIZE_BASE_MAX_OFFSET
733	hex "Maximum KASLR offset" if EXPERT
734	depends on RANDOMIZE_BASE
735	range 0x0 0x10000000
736	default "0x01000000"
737	help
738	  When KASLR is active, this provides the maximum offset that will
739	  be applied to the kernel image. It should be set according to the
740	  amount of physical RAM available in the target system.
741
742	  This is limited by the size of the lower address memory, 256MB.
743
744source "kernel/livepatch/Kconfig"
745
746config PARAVIRT
747	bool "Enable paravirtualization code"
748	depends on AS_HAS_LVZ_EXTENSION && 64BIT
749	select HAVE_PV_STEAL_CLOCK_GEN
750	help
751	  This changes the kernel so it can modify itself when it is run
752	  under a hypervisor, potentially improving performance significantly
753	  over full virtualization.  However, when run without a hypervisor
754	  the kernel is theoretically slower and slightly larger.
755
756config PARAVIRT_TIME_ACCOUNTING
757	bool "Paravirtual steal time accounting"
758	depends on PARAVIRT
759	help
760	  Select this option to enable fine granularity task steal time
761	  accounting. Time spent executing other tasks in parallel with
762	  the current vCPU is discounted from the vCPU power. To account for
763	  that, there can be a small performance impact.
764
765	  If in doubt, say N here.
766
767endmenu
768
769config ARCH_SELECT_MEMORY_MODEL
770	def_bool y
771
772config ARCH_FLATMEM_ENABLE
773	def_bool y
774	depends on !NUMA
775
776config ARCH_SPARSEMEM_ENABLE
777	def_bool 64BIT
778	select SPARSEMEM_VMEMMAP_ENABLE
779	help
780	  Say Y to support efficient handling of sparse physical memory,
781	  for architectures which are either NUMA (Non-Uniform Memory Access)
782	  or have huge holes in the physical address space for other reasons.
783	  See <file:Documentation/mm/numa.rst> for more.
784
785config ARCH_MEMORY_PROBE
786	def_bool y
787	depends on MEMORY_HOTPLUG
788
789config MMU
790	bool
791	default y
792
793config ARCH_MMAP_RND_BITS_MIN
794	default 10 if 32BIT
795	default 12 if 64BIT
796
797config ARCH_MMAP_RND_BITS_MAX
798	default 15 if 32BIT
799	default 20 if 64BIT
800
801config ARCH_SUPPORTS_UPROBES
802	def_bool y
803
804config KASAN_SHADOW_OFFSET
805	hex
806	default 0x0
807	depends on KASAN
808
809menu "Power management options"
810
811config ARCH_SUSPEND_POSSIBLE
812	def_bool y
813
814config ARCH_HIBERNATION_POSSIBLE
815	def_bool y
816
817source "kernel/power/Kconfig"
818source "drivers/acpi/Kconfig"
819source "drivers/cpufreq/Kconfig"
820
821endmenu
822
823source "arch/loongarch/kvm/Kconfig"
824