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