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