Merge tag 'io_uring-5.13-2021-05-07' of git://git.kernel.dk/linux-block
[linux-2.6-microblaze.git] / arch / riscv / Kconfig
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
7 config 64BIT
8         bool
9
10 config 32BIT
11         bool
12
13 config RISCV
14         def_bool y
15         select ARCH_CLOCKSOURCE_INIT
16         select ARCH_SUPPORTS_ATOMIC_RMW
17         select ARCH_SUPPORTS_DEBUG_PAGEALLOC if MMU
18         select ARCH_STACKWALK
19         select ARCH_HAS_BINFMT_FLAT
20         select ARCH_HAS_DEBUG_VM_PGTABLE
21         select ARCH_HAS_DEBUG_VIRTUAL if MMU
22         select ARCH_HAS_DEBUG_WX
23         select ARCH_HAS_FORTIFY_SOURCE
24         select ARCH_HAS_GCOV_PROFILE_ALL
25         select ARCH_HAS_GIGANTIC_PAGE
26         select ARCH_HAS_KCOV
27         select ARCH_HAS_MMIOWB
28         select ARCH_HAS_PTE_SPECIAL
29         select ARCH_HAS_SET_DIRECT_MAP
30         select ARCH_HAS_SET_MEMORY
31         select ARCH_HAS_STRICT_KERNEL_RWX if MMU && !XIP_KERNEL
32         select ARCH_HAS_STRICT_MODULE_RWX if MMU && !XIP_KERNEL
33         select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
34         select ARCH_OPTIONAL_KERNEL_RWX if ARCH_HAS_STRICT_KERNEL_RWX
35         select ARCH_OPTIONAL_KERNEL_RWX_DEFAULT
36         select ARCH_SUPPORTS_HUGETLBFS if MMU
37         select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU
38         select ARCH_WANT_FRAME_POINTERS
39         select ARCH_WANT_HUGE_PMD_SHARE if 64BIT
40         select BINFMT_FLAT_NO_DATA_START_OFFSET if !MMU
41         select CLONE_BACKWARDS
42         select CLINT_TIMER if !MMU
43         select COMMON_CLK
44         select EDAC_SUPPORT
45         select GENERIC_ARCH_TOPOLOGY if SMP
46         select GENERIC_ATOMIC64 if !64BIT
47         select GENERIC_CLOCKEVENTS_BROADCAST if SMP
48         select GENERIC_EARLY_IOREMAP
49         select GENERIC_GETTIMEOFDAY if HAVE_GENERIC_VDSO
50         select GENERIC_IOREMAP
51         select GENERIC_IRQ_MULTI_HANDLER
52         select GENERIC_IRQ_SHOW
53         select GENERIC_LIB_DEVMEM_IS_ALLOWED
54         select GENERIC_PCI_IOMAP
55         select GENERIC_PTDUMP if MMU
56         select GENERIC_SCHED_CLOCK
57         select GENERIC_SMP_IDLE_THREAD
58         select GENERIC_STRNCPY_FROM_USER if MMU
59         select GENERIC_STRNLEN_USER if MMU
60         select GENERIC_TIME_VSYSCALL if MMU && 64BIT
61         select HANDLE_DOMAIN_IRQ
62         select HAVE_ARCH_AUDITSYSCALL
63         select HAVE_ARCH_JUMP_LABEL
64         select HAVE_ARCH_JUMP_LABEL_RELATIVE
65         select HAVE_ARCH_KASAN if MMU && 64BIT
66         select HAVE_ARCH_KASAN_VMALLOC if MMU && 64BIT
67         select HAVE_ARCH_KGDB
68         select HAVE_ARCH_KGDB_QXFER_PKT
69         select HAVE_ARCH_MMAP_RND_BITS if MMU
70         select HAVE_ARCH_SECCOMP_FILTER
71         select HAVE_ARCH_TRACEHOOK
72         select HAVE_ASM_MODVERSIONS
73         select HAVE_CONTEXT_TRACKING
74         select HAVE_DEBUG_KMEMLEAK
75         select HAVE_DMA_CONTIGUOUS if MMU
76         select HAVE_EBPF_JIT if MMU
77         select HAVE_FUNCTION_ERROR_INJECTION
78         select HAVE_FUTEX_CMPXCHG if FUTEX
79         select HAVE_GCC_PLUGINS
80         select HAVE_GENERIC_VDSO if MMU && 64BIT
81         select HAVE_IRQ_TIME_ACCOUNTING
82         select HAVE_KPROBES
83         select HAVE_KPROBES_ON_FTRACE
84         select HAVE_KRETPROBES
85         select HAVE_PCI
86         select HAVE_PERF_EVENTS
87         select HAVE_PERF_REGS
88         select HAVE_PERF_USER_STACK_DUMP
89         select HAVE_REGS_AND_STACK_ACCESS_API
90         select HAVE_STACKPROTECTOR
91         select HAVE_SYSCALL_TRACEPOINTS
92         select IRQ_DOMAIN
93         select MODULES_USE_ELF_RELA if MODULES
94         select MODULE_SECTIONS if MODULES
95         select OF
96         select OF_EARLY_FLATTREE
97         select OF_IRQ
98         select PCI_DOMAINS_GENERIC if PCI
99         select PCI_MSI if PCI
100         select RISCV_INTC
101         select RISCV_TIMER if RISCV_SBI
102         select SPARSE_IRQ
103         select SYSCTL_EXCEPTION_TRACE
104         select THREAD_INFO_IN_TASK
105         select UACCESS_MEMCPY if !MMU
106
107 config ARCH_MMAP_RND_BITS_MIN
108         default 18 if 64BIT
109         default 8
110
111 # max bits determined by the following formula:
112 #  VA_BITS - PAGE_SHIFT - 3
113 config ARCH_MMAP_RND_BITS_MAX
114         default 24 if 64BIT # SV39 based
115         default 17
116
117 # set if we run in machine mode, cleared if we run in supervisor mode
118 config RISCV_M_MODE
119         bool
120         default !MMU
121
122 # set if we are running in S-mode and can use SBI calls
123 config RISCV_SBI
124         bool
125         depends on !RISCV_M_MODE
126         default y
127
128 config MMU
129         bool "MMU-based Paged Memory Management Support"
130         default y
131         help
132           Select if you want MMU-based virtualised addressing space
133           support by paged memory management. If unsure, say 'Y'.
134
135 config ZONE_DMA32
136         bool
137         default y if 64BIT
138
139 config VA_BITS
140         int
141         default 32 if 32BIT
142         default 39 if 64BIT
143
144 config PA_BITS
145         int
146         default 34 if 32BIT
147         default 56 if 64BIT
148
149 config PAGE_OFFSET
150         hex
151         default 0xC0000000 if 32BIT && MAXPHYSMEM_1GB
152         default 0x80000000 if 64BIT && !MMU
153         default 0xffffffff80000000 if 64BIT && MAXPHYSMEM_2GB
154         default 0xffffffe000000000 if 64BIT && MAXPHYSMEM_128GB
155
156 config ARCH_FLATMEM_ENABLE
157         def_bool !NUMA
158
159 config ARCH_SPARSEMEM_ENABLE
160         def_bool y
161         depends on MMU
162         select SPARSEMEM_STATIC if 32BIT && SPARSEMEM
163         select SPARSEMEM_VMEMMAP_ENABLE if 64BIT
164
165 config ARCH_SELECT_MEMORY_MODEL
166         def_bool ARCH_SPARSEMEM_ENABLE
167
168 config ARCH_WANT_GENERAL_HUGETLB
169         def_bool y
170
171 config ARCH_SUPPORTS_UPROBES
172         def_bool y
173
174 config STACKTRACE_SUPPORT
175         def_bool y
176
177 config TRACE_IRQFLAGS_SUPPORT
178         def_bool y
179
180 config GENERIC_BUG
181         def_bool y
182         depends on BUG
183         select GENERIC_BUG_RELATIVE_POINTERS if 64BIT
184
185 config GENERIC_BUG_RELATIVE_POINTERS
186         bool
187
188 config GENERIC_CALIBRATE_DELAY
189         def_bool y
190
191 config GENERIC_CSUM
192         def_bool y
193
194 config GENERIC_HWEIGHT
195         def_bool y
196
197 config FIX_EARLYCON_MEM
198         def_bool MMU
199
200 config PGTABLE_LEVELS
201         int
202         default 3 if 64BIT
203         default 2
204
205 config LOCKDEP_SUPPORT
206         def_bool y
207
208 source "arch/riscv/Kconfig.socs"
209 source "arch/riscv/Kconfig.erratas"
210
211 menu "Platform type"
212
213 choice
214         prompt "Base ISA"
215         default ARCH_RV64I
216         help
217           This selects the base ISA that this kernel will target and must match
218           the target platform.
219
220 config ARCH_RV32I
221         bool "RV32I"
222         select 32BIT
223         select GENERIC_LIB_ASHLDI3
224         select GENERIC_LIB_ASHRDI3
225         select GENERIC_LIB_LSHRDI3
226         select GENERIC_LIB_UCMPDI2
227         select MMU
228
229 config ARCH_RV64I
230         bool "RV64I"
231         select 64BIT
232         select ARCH_SUPPORTS_INT128 if CC_HAS_INT128 && GCC_VERSION >= 50000
233         select HAVE_DYNAMIC_FTRACE if MMU && $(cc-option,-fpatchable-function-entry=8)
234         select HAVE_DYNAMIC_FTRACE_WITH_REGS if HAVE_DYNAMIC_FTRACE
235         select HAVE_FTRACE_MCOUNT_RECORD
236         select HAVE_FUNCTION_GRAPH_TRACER
237         select HAVE_FUNCTION_TRACER
238         select SWIOTLB if MMU
239
240 endchoice
241
242 # We must be able to map all physical memory into the kernel, but the compiler
243 # is still a bit more efficient when generating code if it's setup in a manner
244 # such that it can only map 2GiB of memory.
245 choice
246         prompt "Kernel Code Model"
247         default CMODEL_MEDLOW if 32BIT
248         default CMODEL_MEDANY if 64BIT
249
250         config CMODEL_MEDLOW
251                 bool "medium low code model"
252         config CMODEL_MEDANY
253                 bool "medium any code model"
254 endchoice
255
256 config MODULE_SECTIONS
257         bool
258         select HAVE_MOD_ARCH_SPECIFIC
259
260 choice
261         prompt "Maximum Physical Memory"
262         default MAXPHYSMEM_1GB if 32BIT
263         default MAXPHYSMEM_2GB if 64BIT && CMODEL_MEDLOW
264         default MAXPHYSMEM_128GB if 64BIT && CMODEL_MEDANY
265
266         config MAXPHYSMEM_1GB
267                 depends on 32BIT
268                 bool "1GiB"
269         config MAXPHYSMEM_2GB
270                 depends on 64BIT && CMODEL_MEDLOW
271                 bool "2GiB"
272         config MAXPHYSMEM_128GB
273                 depends on 64BIT && CMODEL_MEDANY
274                 bool "128GiB"
275 endchoice
276
277
278 config SMP
279         bool "Symmetric Multi-Processing"
280         help
281           This enables support for systems with more than one CPU.  If
282           you say N here, the kernel will run on single and
283           multiprocessor machines, but will use only one CPU of a
284           multiprocessor machine. If you say Y here, the kernel will run
285           on many, but not all, single processor machines. On a single
286           processor machine, the kernel will run faster if you say N
287           here.
288
289           If you don't know what to do here, say N.
290
291 config NR_CPUS
292         int "Maximum number of CPUs (2-32)"
293         range 2 32
294         depends on SMP
295         default "8"
296
297 config HOTPLUG_CPU
298         bool "Support for hot-pluggable CPUs"
299         depends on SMP
300         select GENERIC_IRQ_MIGRATION
301         help
302
303           Say Y here to experiment with turning CPUs off and on.  CPUs
304           can be controlled through /sys/devices/system/cpu.
305
306           Say N if you want to disable CPU hotplug.
307
308 choice
309         prompt "CPU Tuning"
310         default TUNE_GENERIC
311
312 config TUNE_GENERIC
313         bool "generic"
314
315 endchoice
316
317 # Common NUMA Features
318 config NUMA
319         bool "NUMA Memory Allocation and Scheduler Support"
320         depends on SMP && MMU
321         select GENERIC_ARCH_NUMA
322         select OF_NUMA
323         select ARCH_SUPPORTS_NUMA_BALANCING
324         help
325           Enable NUMA (Non-Uniform Memory Access) support.
326
327           The kernel will try to allocate memory used by a CPU on the
328           local memory of the CPU and add some more NUMA awareness to the kernel.
329
330 config NODES_SHIFT
331         int "Maximum NUMA Nodes (as a power of 2)"
332         range 1 10
333         default "2"
334         depends on NEED_MULTIPLE_NODES
335         help
336           Specify the maximum number of NUMA Nodes available on the target
337           system.  Increases memory reserved to accommodate various tables.
338
339 config USE_PERCPU_NUMA_NODE_ID
340         def_bool y
341         depends on NUMA
342
343 config NEED_PER_CPU_EMBED_FIRST_CHUNK
344         def_bool y
345         depends on NUMA
346
347 config RISCV_ISA_C
348         bool "Emit compressed instructions when building Linux"
349         default y
350         help
351            Adds "C" to the ISA subsets that the toolchain is allowed to emit
352            when building Linux, which results in compressed instructions in the
353            Linux binary.
354
355            If you don't know what to do here, say Y.
356
357 menu "supported PMU type"
358         depends on PERF_EVENTS
359
360 config RISCV_BASE_PMU
361         bool "Base Performance Monitoring Unit"
362         def_bool y
363         help
364           A base PMU that serves as a reference implementation and has limited
365           feature of perf.  It can run on any RISC-V machines so serves as the
366           fallback, but this option can also be disable to reduce kernel size.
367
368 endmenu
369
370 config FPU
371         bool "FPU support"
372         default y
373         help
374           Say N here if you want to disable all floating-point related procedure
375           in the kernel.
376
377           If you don't know what to do here, say Y.
378
379 endmenu
380
381 menu "Kernel features"
382
383 source "kernel/Kconfig.hz"
384
385 config RISCV_SBI_V01
386         bool "SBI v0.1 support"
387         default y
388         depends on RISCV_SBI
389         help
390           This config allows kernel to use SBI v0.1 APIs. This will be
391           deprecated in future once legacy M-mode software are no longer in use.
392
393 config KEXEC
394         bool "Kexec system call"
395         select KEXEC_CORE
396         select HOTPLUG_CPU if SMP
397         depends on MMU
398         help
399           kexec is a system call that implements the ability to shutdown your
400           current kernel, and to start another kernel. It is like a reboot
401           but it is independent of the system firmware. And like a reboot
402           you can start any kernel with it, not just Linux.
403
404           The name comes from the similarity to the exec system call.
405
406 config CRASH_DUMP
407         bool "Build kdump crash kernel"
408         help
409           Generate crash dump after being started by kexec. This should
410           be normally only set in special crash dump kernels which are
411           loaded in the main kernel with kexec-tools into a specially
412           reserved region and then later executed after a crash by
413           kdump/kexec.
414
415           For more details see Documentation/admin-guide/kdump/kdump.rst
416
417 endmenu
418
419 menu "Boot options"
420
421 config CMDLINE
422         string "Built-in kernel command line"
423         help
424           For most platforms, the arguments for the kernel's command line
425           are provided at run-time, during boot. However, there are cases
426           where either no arguments are being provided or the provided
427           arguments are insufficient or even invalid.
428
429           When that occurs, it is possible to define a built-in command
430           line here and choose how the kernel should use it later on.
431
432 choice
433         prompt "Built-in command line usage" if CMDLINE != ""
434         default CMDLINE_FALLBACK
435         help
436           Choose how the kernel will handle the provided built-in command
437           line.
438
439 config CMDLINE_FALLBACK
440         bool "Use bootloader kernel arguments if available"
441         help
442           Use the built-in command line as fallback in case we get nothing
443           during boot. This is the default behaviour.
444
445 config CMDLINE_EXTEND
446         bool "Extend bootloader kernel arguments"
447         help
448           The command-line arguments provided during boot will be
449           appended to the built-in command line. This is useful in
450           cases where the provided arguments are insufficient and
451           you don't want to or cannot modify them.
452
453
454 config CMDLINE_FORCE
455         bool "Always use the default kernel command string"
456         help
457           Always use the built-in command line, even if we get one during
458           boot. This is useful in case you need to override the provided
459           command line on systems where you don't have or want control
460           over it.
461
462 endchoice
463
464 config EFI_STUB
465         bool
466
467 config EFI
468         bool "UEFI runtime support"
469         depends on OF && !XIP_KERNEL
470         select LIBFDT
471         select UCS2_STRING
472         select EFI_PARAMS_FROM_FDT
473         select EFI_STUB
474         select EFI_GENERIC_STUB
475         select EFI_RUNTIME_WRAPPERS
476         select RISCV_ISA_C
477         depends on MMU
478         default y
479         help
480           This option provides support for runtime services provided
481           by UEFI firmware (such as non-volatile variables, realtime
482           clock, and platform reset). A UEFI stub is also provided to
483           allow the kernel to be booted as an EFI application. This
484           is only useful on systems that have UEFI firmware.
485
486 config CC_HAVE_STACKPROTECTOR_TLS
487         def_bool $(cc-option,-mstack-protector-guard=tls -mstack-protector-guard-reg=tp -mstack-protector-guard-offset=0)
488
489 config STACKPROTECTOR_PER_TASK
490         def_bool y
491         depends on STACKPROTECTOR && CC_HAVE_STACKPROTECTOR_TLS
492
493 config PHYS_RAM_BASE_FIXED
494         bool "Explicitly specified physical RAM address"
495         default n
496
497 config PHYS_RAM_BASE
498         hex "Platform Physical RAM address"
499         depends on PHYS_RAM_BASE_FIXED
500         default "0x80000000"
501         help
502           This is the physical address of RAM in the system. It has to be
503           explicitly specified to run early relocations of read-write data
504           from flash to RAM.
505
506 config XIP_KERNEL
507         bool "Kernel Execute-In-Place from ROM"
508         depends on MMU && SPARSEMEM
509         # This prevents XIP from being enabled by all{yes,mod}config, which
510         # fail to build since XIP doesn't support large kernels.
511         depends on !COMPILE_TEST
512         select PHYS_RAM_BASE_FIXED
513         help
514           Execute-In-Place allows the kernel to run from non-volatile storage
515           directly addressable by the CPU, such as NOR flash. This saves RAM
516           space since the text section of the kernel is not loaded from flash
517           to RAM.  Read-write sections, such as the data section and stack,
518           are still copied to RAM.  The XIP kernel is not compressed since
519           it has to run directly from flash, so it will take more space to
520           store it.  The flash address used to link the kernel object files,
521           and for storing it, is configuration dependent. Therefore, if you
522           say Y here, you must know the proper physical address where to
523           store the kernel image depending on your own flash memory usage.
524
525           Also note that the make target becomes "make xipImage" rather than
526           "make zImage" or "make Image".  The final kernel binary to put in
527           ROM memory will be arch/riscv/boot/xipImage.
528
529           SPARSEMEM is required because the kernel text and rodata that are
530           flash resident are not backed by memmap, then any attempt to get
531           a struct page on those regions will trigger a fault.
532
533           If unsure, say N.
534
535 config XIP_PHYS_ADDR
536         hex "XIP Kernel Physical Location"
537         depends on XIP_KERNEL
538         default "0x21000000"
539         help
540           This is the physical address in your flash memory the kernel will
541           be linked for and stored to.  This address is dependent on your
542           own flash usage.
543
544 endmenu
545
546 config BUILTIN_DTB
547         bool
548         depends on OF
549         default y if XIP_KERNEL
550
551 menu "Power management options"
552
553 source "kernel/power/Kconfig"
554
555 endmenu
556
557 source "drivers/firmware/Kconfig"