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