hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/arch/riscv/Kconfig
....@@ -1,6 +1,7 @@
1
+# SPDX-License-Identifier: GPL-2.0-only
12 #
23 # For a description of the syntax of this configuration file,
3
-# see Documentation/kbuild/kconfig-language.txt.
4
+# see Documentation/kbuild/kconfig-language.rst.
45 #
56
67 config 64BIT
....@@ -11,60 +12,164 @@
1112
1213 config RISCV
1314 def_bool y
14
- # even on 32-bit, physical (and DMA) addresses are > 32-bits
15
- select PHYS_ADDR_T_64BIT
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
1680 select OF
1781 select OF_EARLY_FLATTREE
1882 select OF_IRQ
19
- select ARCH_WANT_FRAME_POINTERS
20
- select CLONE_BACKWARDS
21
- select COMMON_CLK
22
- select DMA_DIRECT_OPS
23
- select GENERIC_CLOCKEVENTS
24
- select GENERIC_CPU_DEVICES
25
- select GENERIC_IRQ_SHOW
26
- select GENERIC_PCI_IOMAP
27
- select GENERIC_STRNCPY_FROM_USER
28
- select GENERIC_STRNLEN_USER
29
- select GENERIC_SMP_IDLE_THREAD
30
- select GENERIC_ATOMIC64 if !64BIT || !RISCV_ISA_A
31
- select HAVE_MEMBLOCK
32
- select HAVE_MEMBLOCK_NODE_MAP
33
- select HAVE_DMA_CONTIGUOUS
34
- select HAVE_GENERIC_DMA_COHERENT
35
- select HAVE_PERF_EVENTS
36
- select IRQ_DOMAIN
37
- select NO_BOOTMEM
38
- select RISCV_ISA_A if SMP
83
+ select PCI_DOMAINS_GENERIC if PCI
84
+ select PCI_MSI if PCI
85
+ select RISCV_INTC
86
+ select RISCV_TIMER if RISCV_SBI
3987 select SPARSE_IRQ
4088 select SYSCTL_EXCEPTION_TRACE
41
- select HAVE_ARCH_TRACEHOOK
42
- select MODULES_USE_ELF_RELA if MODULES
4389 select THREAD_INFO_IN_TASK
44
- select RISCV_TIMER
45
- select GENERIC_IRQ_MULTI_HANDLER
46
- select ARCH_HAS_PTE_SPECIAL
90
+ select UACCESS_MEMCPY if !MMU
91
+
92
+config 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
98
+config 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
103
+config RISCV_M_MODE
104
+ bool
105
+ default !MMU
106
+
107
+# set if we are running in S-mode and can use SBI calls
108
+config RISCV_SBI
109
+ bool
110
+ depends on !RISCV_M_MODE
111
+ default y
47112
48113 config MMU
49
- def_bool y
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'.
50119
51120 config ZONE_DMA32
52121 bool
53122 default y if 64BIT
54123
124
+config VA_BITS
125
+ int
126
+ default 32 if 32BIT
127
+ default 39 if 64BIT
128
+
129
+config PA_BITS
130
+ int
131
+ default 34 if 32BIT
132
+ default 56 if 64BIT
133
+
55134 config PAGE_OFFSET
56135 hex
57
- default 0xC0000000 if 32BIT && MAXPHYSMEM_2GB
136
+ default 0xC0000000 if 32BIT && MAXPHYSMEM_1GB
137
+ default 0x80000000 if 64BIT && !MMU
58138 default 0xffffffff80000000 if 64BIT && MAXPHYSMEM_2GB
59139 default 0xffffffe000000000 if 64BIT && MAXPHYSMEM_128GB
140
+
141
+config KASAN_SHADOW_OFFSET
142
+ hex
143
+ depends on KASAN_GENERIC
144
+ default 0xdfffffc800000000 if 64BIT
145
+ default 0xffffffff if 32BIT
146
+
147
+config ARCH_FLATMEM_ENABLE
148
+ def_bool y
149
+
150
+config 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
+
156
+config ARCH_SELECT_MEMORY_MODEL
157
+ def_bool ARCH_SPARSEMEM_ENABLE
158
+
159
+config ARCH_WANT_GENERAL_HUGETLB
160
+ def_bool y
161
+
162
+config ARCH_SUPPORTS_DEBUG_PAGEALLOC
163
+ def_bool y
164
+
165
+config SYS_SUPPORTS_HUGETLBFS
166
+ depends on MMU
167
+ def_bool y
60168
61169 config STACKTRACE_SUPPORT
62170 def_bool y
63171
64172 config TRACE_IRQFLAGS_SUPPORT
65
- def_bool y
66
-
67
-config RWSEM_GENERIC_SPINLOCK
68173 def_bool y
69174
70175 config GENERIC_BUG
....@@ -84,13 +189,18 @@
84189 config GENERIC_HWEIGHT
85190 def_bool y
86191
192
+config FIX_EARLYCON_MEM
193
+ def_bool MMU
194
+
87195 config PGTABLE_LEVELS
88196 int
89197 default 3 if 64BIT
90198 default 2
91199
92
-config HAVE_KPROBES
93
- def_bool n
200
+config LOCKDEP_SUPPORT
201
+ def_bool y
202
+
203
+source "arch/riscv/Kconfig.socs"
94204
95205 menu "Platform type"
96206
....@@ -98,7 +208,7 @@
98208 prompt "Base ISA"
99209 default ARCH_RV64I
100210 help
101
- This selects the base ISA that this kernel will traget and must match
211
+ This selects the base ISA that this kernel will target and must match
102212 the target platform.
103213
104214 config ARCH_RV32I
....@@ -108,16 +218,18 @@
108218 select GENERIC_LIB_ASHRDI3
109219 select GENERIC_LIB_LSHRDI3
110220 select GENERIC_LIB_UCMPDI2
221
+ select MMU
111222
112223 config ARCH_RV64I
113224 bool "RV64I"
114225 select 64BIT
115
- select HAVE_FUNCTION_TRACER
116
- select HAVE_FUNCTION_GRAPH_TRACER
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
117229 select HAVE_FTRACE_MCOUNT_RECORD
118
- select HAVE_DYNAMIC_FTRACE
119
- select HAVE_DYNAMIC_FTRACE_WITH_REGS
120
- select SWIOTLB
230
+ select HAVE_FUNCTION_GRAPH_TRACER
231
+ select HAVE_FUNCTION_TRACER
232
+ select SWIOTLB if MMU
121233
122234 endchoice
123235
....@@ -141,15 +253,18 @@
141253
142254 choice
143255 prompt "Maximum Physical Memory"
144
- default MAXPHYSMEM_2GB if 32BIT
256
+ default MAXPHYSMEM_1GB if 32BIT
145257 default MAXPHYSMEM_2GB if 64BIT && CMODEL_MEDLOW
146258 default MAXPHYSMEM_128GB if 64BIT && CMODEL_MEDANY
147259
260
+ config MAXPHYSMEM_1GB
261
+ depends on 32BIT
262
+ bool "1GiB"
148263 config MAXPHYSMEM_2GB
264
+ depends on 64BIT && CMODEL_MEDLOW
149265 bool "2GiB"
150266 config MAXPHYSMEM_128GB
151267 depends on 64BIT && CMODEL_MEDANY
152
- select MODULE_SECTIONS if MODULES
153268 bool "128GiB"
154269 endchoice
155270
....@@ -173,6 +288,17 @@
173288 depends on SMP
174289 default "8"
175290
291
+config 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
+
176302 choice
177303 prompt "CPU Tuning"
178304 default TUNE_GENERIC
....@@ -192,9 +318,6 @@
192318
193319 If you don't know what to do here, say Y.
194320
195
-config RISCV_ISA_A
196
- def_bool y
197
-
198321 menu "supported PMU type"
199322 depends on PERF_EVENTS
200323
....@@ -208,38 +331,108 @@
208331
209332 endmenu
210333
211
-endmenu
212
-
213
-menu "Kernel type"
214
-
215
-source "kernel/Kconfig.hz"
216
-
217
-endmenu
218
-
219
-menu "Bus support"
220
-
221
-config PCI
222
- bool "PCI support"
223
- select PCI_MSI
334
+config FPU
335
+ bool "FPU support"
336
+ default y
224337 help
225
- This feature enables support for PCI bus system. If you say Y
226
- here, the kernel will include drivers and infrastructure code
227
- to support PCI bus devices.
338
+ Say N here if you want to disable all floating-point related procedure
339
+ in the kernel.
228340
229341 If you don't know what to do here, say Y.
230342
231
-config PCI_DOMAINS
232
- def_bool PCI
343
+endmenu
233344
234
-config PCI_DOMAINS_GENERIC
235
- def_bool PCI
345
+menu "Kernel features"
236346
237
-source "drivers/pci/Kconfig"
347
+source "kernel/Kconfig.hz"
348
+
349
+config 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.
356
+endmenu
357
+
358
+menu "Boot options"
359
+
360
+config 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
+
371
+choice
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
+
378
+config 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
+
384
+config 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
+
393
+config 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
+
401
+endchoice
402
+
403
+config EFI_STUB
404
+ bool
405
+
406
+config 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.
238424
239425 endmenu
426
+
427
+config BUILTIN_DTB
428
+ def_bool n
429
+ depends on RISCV_M_MODE
430
+ depends on OF
240431
241432 menu "Power management options"
242433
243
-source kernel/power/Kconfig
434
+source "kernel/power/Kconfig"
244435
245436 endmenu
437
+
438
+source "drivers/firmware/Kconfig"