• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# SPDX-License-Identifier: GPL-2.0-only
2#
3# For a description of the syntax of this configuration file,
4# see Documentation/kbuild/kconfig-language.rst.
5#
6
7config 64BIT
8	bool
9
10config 32BIT
11	bool
12
13config RISCV
14	def_bool y
15	select ARCH_CLOCKSOURCE_INIT
16	select ARCH_SUPPORTS_ATOMIC_RMW
17	select ARCH_HAS_BINFMT_FLAT
18	select ARCH_HAS_DEBUG_VM_PGTABLE
19	select ARCH_HAS_DEBUG_VIRTUAL if MMU
20	select ARCH_HAS_DEBUG_WX
21	select ARCH_HAS_GCOV_PROFILE_ALL
22	select ARCH_HAS_GIGANTIC_PAGE
23	select ARCH_HAS_KCOV
24	select ARCH_HAS_MMIOWB
25	select ARCH_HAS_PTE_SPECIAL
26	select ARCH_HAS_SET_DIRECT_MAP
27	select ARCH_HAS_SET_MEMORY
28	select ARCH_HAS_STRICT_KERNEL_RWX if MMU
29	select ARCH_OPTIONAL_KERNEL_RWX if ARCH_HAS_STRICT_KERNEL_RWX
30	select ARCH_OPTIONAL_KERNEL_RWX_DEFAULT
31	select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU
32	select ARCH_WANT_FRAME_POINTERS
33	select ARCH_WANT_HUGE_PMD_SHARE if 64BIT
34	select CLONE_BACKWARDS
35	select CLINT_TIMER if !MMU
36	select COMMON_CLK
37	select EDAC_SUPPORT
38	select GENERIC_ARCH_TOPOLOGY
39	select GENERIC_ATOMIC64 if !64BIT
40	select GENERIC_CLOCKEVENTS
41	select GENERIC_EARLY_IOREMAP
42	select GENERIC_GETTIMEOFDAY if HAVE_GENERIC_VDSO
43	select GENERIC_IOREMAP
44	select GENERIC_IRQ_MULTI_HANDLER
45	select GENERIC_IRQ_SHOW
46	select GENERIC_PCI_IOMAP
47	select GENERIC_PTDUMP if MMU
48	select GENERIC_SCHED_CLOCK
49	select GENERIC_SMP_IDLE_THREAD
50	select GENERIC_STRNCPY_FROM_USER if MMU
51	select GENERIC_STRNLEN_USER if MMU
52	select GENERIC_TIME_VSYSCALL if MMU && 64BIT
53	select HANDLE_DOMAIN_IRQ
54	select HAVE_ARCH_AUDITSYSCALL
55	select HAVE_ARCH_JUMP_LABEL
56	select HAVE_ARCH_JUMP_LABEL_RELATIVE
57	select HAVE_ARCH_KASAN if MMU && 64BIT
58	select HAVE_ARCH_KGDB
59	select HAVE_ARCH_KGDB_QXFER_PKT
60	select HAVE_ARCH_MMAP_RND_BITS if MMU
61	select HAVE_ARCH_SECCOMP_FILTER
62	select HAVE_ARCH_TRACEHOOK
63	select HAVE_ASM_MODVERSIONS
64	select HAVE_CONTEXT_TRACKING
65	select HAVE_DEBUG_KMEMLEAK
66	select HAVE_DMA_CONTIGUOUS if MMU
67	select HAVE_EBPF_JIT if MMU
68	select HAVE_FUTEX_CMPXCHG if FUTEX
69	select HAVE_GCC_PLUGINS
70	select HAVE_GENERIC_VDSO if MMU && 64BIT
71	select HAVE_PCI
72	select HAVE_PERF_EVENTS
73	select HAVE_PERF_REGS
74	select HAVE_PERF_USER_STACK_DUMP
75	select HAVE_STACKPROTECTOR
76	select HAVE_SYSCALL_TRACEPOINTS
77	select IRQ_DOMAIN
78	select MODULES_USE_ELF_RELA if MODULES
79	select MODULE_SECTIONS if MODULES
80	select OF
81	select OF_EARLY_FLATTREE
82	select OF_IRQ
83	select PCI_DOMAINS_GENERIC if PCI
84	select PCI_MSI if PCI
85	select RISCV_INTC
86	select RISCV_TIMER if RISCV_SBI
87	select SPARSE_IRQ
88	select SYSCTL_EXCEPTION_TRACE
89	select THREAD_INFO_IN_TASK
90	select UACCESS_MEMCPY if !MMU
91
92config ARCH_MMAP_RND_BITS_MIN
93	default 18 if 64BIT
94	default 8
95
96# max bits determined by the following formula:
97#  VA_BITS - PAGE_SHIFT - 3
98config ARCH_MMAP_RND_BITS_MAX
99	default 24 if 64BIT # SV39 based
100	default 17
101
102# set if we run in machine mode, cleared if we run in supervisor mode
103config RISCV_M_MODE
104	bool
105	default !MMU
106
107# set if we are running in S-mode and can use SBI calls
108config RISCV_SBI
109	bool
110	depends on !RISCV_M_MODE
111	default y
112
113config MMU
114	bool "MMU-based Paged Memory Management Support"
115	default y
116	help
117	  Select if you want MMU-based virtualised addressing space
118	  support by paged memory management. If unsure, say 'Y'.
119
120config ZONE_DMA32
121	bool
122	default y if 64BIT
123
124config VA_BITS
125	int
126	default 32 if 32BIT
127	default 39 if 64BIT
128
129config PA_BITS
130	int
131	default 34 if 32BIT
132	default 56 if 64BIT
133
134config PAGE_OFFSET
135	hex
136	default 0xC0000000 if 32BIT && MAXPHYSMEM_1GB
137	default 0x80000000 if 64BIT && !MMU
138	default 0xffffffff80000000 if 64BIT && MAXPHYSMEM_2GB
139	default 0xffffffe000000000 if 64BIT && MAXPHYSMEM_128GB
140
141config KASAN_SHADOW_OFFSET
142	hex
143	depends on KASAN_GENERIC
144	default 0xdfffffc800000000 if 64BIT
145	default 0xffffffff if 32BIT
146
147config ARCH_FLATMEM_ENABLE
148	def_bool y
149
150config ARCH_SPARSEMEM_ENABLE
151	def_bool y
152	depends on MMU
153	select SPARSEMEM_STATIC if 32BIT && SPARSEMEM
154	select SPARSEMEM_VMEMMAP_ENABLE if 64BIT
155
156config ARCH_SELECT_MEMORY_MODEL
157	def_bool ARCH_SPARSEMEM_ENABLE
158
159config ARCH_WANT_GENERAL_HUGETLB
160	def_bool y
161
162config ARCH_SUPPORTS_DEBUG_PAGEALLOC
163	def_bool y
164
165config SYS_SUPPORTS_HUGETLBFS
166	depends on MMU
167	def_bool y
168
169config STACKTRACE_SUPPORT
170	def_bool y
171
172config TRACE_IRQFLAGS_SUPPORT
173	def_bool y
174
175config GENERIC_BUG
176	def_bool y
177	depends on BUG
178	select GENERIC_BUG_RELATIVE_POINTERS if 64BIT
179
180config GENERIC_BUG_RELATIVE_POINTERS
181	bool
182
183config GENERIC_CALIBRATE_DELAY
184	def_bool y
185
186config GENERIC_CSUM
187	def_bool y
188
189config GENERIC_HWEIGHT
190	def_bool y
191
192config FIX_EARLYCON_MEM
193	def_bool MMU
194
195config PGTABLE_LEVELS
196	int
197	default 3 if 64BIT
198	default 2
199
200config LOCKDEP_SUPPORT
201	def_bool y
202
203source "arch/riscv/Kconfig.socs"
204
205menu "Platform type"
206
207choice
208	prompt "Base ISA"
209	default ARCH_RV64I
210	help
211	  This selects the base ISA that this kernel will target and must match
212	  the target platform.
213
214config ARCH_RV32I
215	bool "RV32I"
216	select 32BIT
217	select GENERIC_LIB_ASHLDI3
218	select GENERIC_LIB_ASHRDI3
219	select GENERIC_LIB_LSHRDI3
220	select GENERIC_LIB_UCMPDI2
221	select MMU
222
223config ARCH_RV64I
224	bool "RV64I"
225	select 64BIT
226	select ARCH_SUPPORTS_INT128 if CC_HAS_INT128 && GCC_VERSION >= 50000
227	select HAVE_DYNAMIC_FTRACE if MMU
228	select HAVE_DYNAMIC_FTRACE_WITH_REGS if HAVE_DYNAMIC_FTRACE
229	select HAVE_FTRACE_MCOUNT_RECORD
230	select HAVE_FUNCTION_GRAPH_TRACER
231	select HAVE_FUNCTION_TRACER
232	select SWIOTLB if MMU
233
234endchoice
235
236# We must be able to map all physical memory into the kernel, but the compiler
237# is still a bit more efficient when generating code if it's setup in a manner
238# such that it can only map 2GiB of memory.
239choice
240	prompt "Kernel Code Model"
241	default CMODEL_MEDLOW if 32BIT
242	default CMODEL_MEDANY if 64BIT
243
244	config CMODEL_MEDLOW
245		bool "medium low code model"
246	config CMODEL_MEDANY
247		bool "medium any code model"
248endchoice
249
250config MODULE_SECTIONS
251	bool
252	select HAVE_MOD_ARCH_SPECIFIC
253
254choice
255	prompt "Maximum Physical Memory"
256	default MAXPHYSMEM_1GB if 32BIT
257	default MAXPHYSMEM_2GB if 64BIT && CMODEL_MEDLOW
258	default MAXPHYSMEM_128GB if 64BIT && CMODEL_MEDANY
259
260	config MAXPHYSMEM_1GB
261		depends on 32BIT
262		bool "1GiB"
263	config MAXPHYSMEM_2GB
264		depends on 64BIT && CMODEL_MEDLOW
265		bool "2GiB"
266	config MAXPHYSMEM_128GB
267		depends on 64BIT && CMODEL_MEDANY
268		bool "128GiB"
269endchoice
270
271
272config SMP
273	bool "Symmetric Multi-Processing"
274	help
275	  This enables support for systems with more than one CPU.  If
276	  you say N here, the kernel will run on single and
277	  multiprocessor machines, but will use only one CPU of a
278	  multiprocessor machine. If you say Y here, the kernel will run
279	  on many, but not all, single processor machines. On a single
280	  processor machine, the kernel will run faster if you say N
281	  here.
282
283	  If you don't know what to do here, say N.
284
285config NR_CPUS
286	int "Maximum number of CPUs (2-32)"
287	range 2 32
288	depends on SMP
289	default "8"
290
291config HOTPLUG_CPU
292	bool "Support for hot-pluggable CPUs"
293	depends on SMP
294	select GENERIC_IRQ_MIGRATION
295	help
296
297	  Say Y here to experiment with turning CPUs off and on.  CPUs
298	  can be controlled through /sys/devices/system/cpu.
299
300	  Say N if you want to disable CPU hotplug.
301
302choice
303	prompt "CPU Tuning"
304	default TUNE_GENERIC
305
306config TUNE_GENERIC
307	bool "generic"
308
309endchoice
310
311config RISCV_ISA_C
312	bool "Emit compressed instructions when building Linux"
313	default y
314	help
315	   Adds "C" to the ISA subsets that the toolchain is allowed to emit
316	   when building Linux, which results in compressed instructions in the
317	   Linux binary.
318
319	   If you don't know what to do here, say Y.
320
321menu "supported PMU type"
322	depends on PERF_EVENTS
323
324config RISCV_BASE_PMU
325	bool "Base Performance Monitoring Unit"
326	def_bool y
327	help
328	  A base PMU that serves as a reference implementation and has limited
329	  feature of perf.  It can run on any RISC-V machines so serves as the
330	  fallback, but this option can also be disable to reduce kernel size.
331
332endmenu
333
334config FPU
335	bool "FPU support"
336	default y
337	help
338	  Say N here if you want to disable all floating-point related procedure
339	  in the kernel.
340
341	  If you don't know what to do here, say Y.
342
343endmenu
344
345menu "Kernel features"
346
347source "kernel/Kconfig.hz"
348
349config RISCV_SBI_V01
350	bool "SBI v0.1 support"
351	default y
352	depends on RISCV_SBI
353	help
354	  This config allows kernel to use SBI v0.1 APIs. This will be
355	  deprecated in future once legacy M-mode software are no longer in use.
356endmenu
357
358menu "Boot options"
359
360config CMDLINE
361	string "Built-in kernel command line"
362	help
363	  For most platforms, the arguments for the kernel's command line
364	  are provided at run-time, during boot. However, there are cases
365	  where either no arguments are being provided or the provided
366	  arguments are insufficient or even invalid.
367
368	  When that occurs, it is possible to define a built-in command
369	  line here and choose how the kernel should use it later on.
370
371choice
372	prompt "Built-in command line usage" if CMDLINE != ""
373	default CMDLINE_FALLBACK
374	help
375	  Choose how the kernel will handle the provided built-in command
376	  line.
377
378config CMDLINE_FALLBACK
379	bool "Use bootloader kernel arguments if available"
380	help
381	  Use the built-in command line as fallback in case we get nothing
382	  during boot. This is the default behaviour.
383
384config CMDLINE_EXTEND
385	bool "Extend bootloader kernel arguments"
386	help
387	  The command-line arguments provided during boot will be
388	  appended to the built-in command line. This is useful in
389	  cases where the provided arguments are insufficient and
390	  you don't want to or cannot modify them.
391
392
393config CMDLINE_FORCE
394	bool "Always use the default kernel command string"
395	help
396	  Always use the built-in command line, even if we get one during
397	  boot. This is useful in case you need to override the provided
398	  command line on systems where you don't have or want control
399	  over it.
400
401endchoice
402
403config EFI_STUB
404	bool
405
406config EFI
407	bool "UEFI runtime support"
408	depends on OF
409	select LIBFDT
410	select UCS2_STRING
411	select EFI_PARAMS_FROM_FDT
412	select EFI_STUB
413	select EFI_GENERIC_STUB
414	select EFI_RUNTIME_WRAPPERS
415	select RISCV_ISA_C
416	depends on MMU
417	default y
418	help
419	  This option provides support for runtime services provided
420	  by UEFI firmware (such as non-volatile variables, realtime
421	  clock, and platform reset). A UEFI stub is also provided to
422	  allow the kernel to be booted as an EFI application. This
423	  is only useful on systems that have UEFI firmware.
424
425endmenu
426
427config BUILTIN_DTB
428	def_bool n
429	depends on RISCV_M_MODE
430	depends on OF
431
432menu "Power management options"
433
434source "kernel/power/Kconfig"
435
436endmenu
437
438source "drivers/firmware/Kconfig"
439