xref: /openbmc/linux/arch/riscv/Kconfig (revision fac59652993f075d57860769c99045b3ca18780d)
1ec8f24b7SThomas Gleixner# SPDX-License-Identifier: GPL-2.0-only
2fbe934d6SPalmer Dabbelt#
3fbe934d6SPalmer Dabbelt# For a description of the syntax of this configuration file,
4cd238effSMauro Carvalho Chehab# see Documentation/kbuild/kconfig-language.rst.
5fbe934d6SPalmer Dabbelt#
6fbe934d6SPalmer Dabbelt
7c3e4ed01SChristoph Hellwigconfig 64BIT
8c3e4ed01SChristoph Hellwig	bool
9c3e4ed01SChristoph Hellwig
10c3e4ed01SChristoph Hellwigconfig 32BIT
11c3e4ed01SChristoph Hellwig	bool
12c3e4ed01SChristoph Hellwig
13fbe934d6SPalmer Dabbeltconfig RISCV
14fbe934d6SPalmer Dabbelt	def_bool y
15a91a9ffbSSunil V L	select ACPI_GENERIC_GSI if ACPI
16a91a9ffbSSunil V L	select ACPI_REDUCED_HARDWARE_ONLY if ACPI
17c00a60d6SJiaxun Yang	select ARCH_DMA_DEFAULT_COHERENT
18c24a1967SChen Wandun	select ARCH_ENABLE_HUGEPAGE_MIGRATION if HUGETLB_PAGE && MIGRATION
195a7ac592SKefeng Wang	select ARCH_ENABLE_SPLIT_PMD_PTLOCK if PGTABLE_LEVELS > 2
205f365c13SConor Dooley	select ARCH_ENABLE_THP_MIGRATION if TRANSPARENT_HUGEPAGE
21ad97f9dfSChristoph Hellwig	select ARCH_HAS_BINFMT_FLAT
22fdecfea0SKees Cook	select ARCH_HAS_CURRENT_STACK_POINTER
23e8c7ef7dSPalmer Dabbelt	select ARCH_HAS_DEBUG_VIRTUAL if MMU
245f365c13SConor Dooley	select ARCH_HAS_DEBUG_VM_PGTABLE
25b422d28bSZong Li	select ARCH_HAS_DEBUG_WX
2695301414SKefeng Wang	select ARCH_HAS_FORTIFY_SOURCE
27e8c7ef7dSPalmer Dabbelt	select ARCH_HAS_GCOV_PROFILE_ALL
28e8c7ef7dSPalmer Dabbelt	select ARCH_HAS_GIGANTIC_PAGE
2920d38f7cSTobias Klauser	select ARCH_HAS_KCOV
30a2977c0cSAndrea Parri	select ARCH_HAS_MEMBARRIER_CALLBACKS
31e8c7ef7dSPalmer Dabbelt	select ARCH_HAS_MMIOWB
3299a670b2SRuan Jinjie	select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
33a49ab905SAnup Patel	select ARCH_HAS_PMEM_API
34e8c7ef7dSPalmer Dabbelt	select ARCH_HAS_PTE_SPECIAL
3510cc3278SMike Rapoport	select ARCH_HAS_SET_DIRECT_MAP if MMU
3610cc3278SMike Rapoport	select ARCH_HAS_SET_MEMORY if MMU
3744c92257SVitaly Wool	select ARCH_HAS_STRICT_KERNEL_RWX if MMU && !XIP_KERNEL
3844c92257SVitaly Wool	select ARCH_HAS_STRICT_MODULE_RWX if MMU && !XIP_KERNEL
3908d0ce30SSami Tolvanen	select ARCH_HAS_SYSCALL_WRAPPER
402f100585SGuo Ren	select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
418341dcfbSJisheng Zhang	select ARCH_HAS_UBSAN_SANITIZE_ALL
42aa5af0aaSEvan Green	select ARCH_HAS_VDSO_DATA
43fc0c769fSVincent Chen	select ARCH_OPTIONAL_KERNEL_RWX if ARCH_HAS_STRICT_KERNEL_RWX
44fc0c769fSVincent Chen	select ARCH_OPTIONAL_KERNEL_RWX_DEFAULT
457f85b04bSJisheng Zhang	select ARCH_STACKWALK
467f85b04bSJisheng Zhang	select ARCH_SUPPORTS_ATOMIC_RMW
4774f8fc31SSami Tolvanen	select ARCH_SUPPORTS_CFI_CLANG
487f85b04bSJisheng Zhang	select ARCH_SUPPORTS_DEBUG_PAGEALLOC if MMU
49855f9a8eSAnshuman Khandual	select ARCH_SUPPORTS_HUGETLBFS if MMU
5034c0a5b0SYueHaibing	select ARCH_SUPPORTS_PAGE_TABLE_CHECK if MMU
51648321faSJisheng Zhang	select ARCH_SUPPORTS_PER_VMA_LOCK if MMU
5297a03108SKefeng Wang	select ARCH_USE_MEMTEST
53c9c0b0baSPalmer Dabbelt	select ARCH_USE_QUEUED_RWLOCKS
54af0ead42SSami Tolvanen	select ARCH_USES_CFI_TRAPS if CFI_CLANG
55e8c7ef7dSPalmer Dabbelt	select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU
56fbe934d6SPalmer Dabbelt	select ARCH_WANT_FRAME_POINTERS
5782a1a1f3SQinglin Pan	select ARCH_WANT_GENERAL_HUGETLB if !RISCV_ISA_SVNAPOT
58e8c7ef7dSPalmer Dabbelt	select ARCH_WANT_HUGE_PMD_SHARE if 64BIT
59f4b71bffSJisheng Zhang	select ARCH_WANT_LD_ORPHAN_WARN if !XIP_KERNEL
600b6f1582SAneesh Kumar K.V	select ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP
6187f81e66SJisheng Zhang	select ARCH_WANTS_THP_SWAP if HAVE_ARCH_TRANSPARENT_HUGEPAGE
6209accc3aSDamien Le Moal	select BINFMT_FLAT_NO_DATA_START_OFFSET if !MMU
6354fed35fSJisheng Zhang	select BUILDTIME_TABLE_SORT if MMU
64d5be89a8SPalmer Dabbelt	select CLINT_TIMER if !MMU
655f365c13SConor Dooley	select CLONE_BACKWARDS
66fbe934d6SPalmer Dabbelt	select COMMON_CLK
67c0317210SSia Jee Heng	select CPU_PM if CPU_IDLE || HIBERNATION
68e8c7ef7dSPalmer Dabbelt	select EDAC_SUPPORT
699f944d2eSBjörn Töpel	select FRAME_POINTER if PERF_EVENTS || (FUNCTION_TRACER && !DYNAMIC_FTRACE)
70fbd92809SConor Dooley	select GENERIC_ARCH_TOPOLOGY
71e8c7ef7dSPalmer Dabbelt	select GENERIC_ATOMIC64 if !64BIT
722f100585SGuo Ren	select GENERIC_CLOCKEVENTS_BROADCAST if SMP
736262f661SAtish Patra	select GENERIC_EARLY_IOREMAP
74f0bddf50SGuo Ren	select GENERIC_ENTRY
75ad5d1122SVincent Chen	select GENERIC_GETTIMEOFDAY if HAVE_GENERIC_VDSO
76bcf11b5eSKefeng Wang	select GENERIC_IDLE_POLL_SETUP
778350229fSChristoph Hellwig	select GENERIC_IOREMAP if MMU
78832f15f4SAnup Patel	select GENERIC_IRQ_IPI if SMP
79832f15f4SAnup Patel	select GENERIC_IRQ_IPI_MUX if SMP
80e8c7ef7dSPalmer Dabbelt	select GENERIC_IRQ_MULTI_HANDLER
81fbe934d6SPalmer Dabbelt	select GENERIC_IRQ_SHOW
82ecd4916cSKefeng Wang	select GENERIC_IRQ_SHOW_LEVEL
8378ed473cSPalmer Dabbelt	select GENERIC_LIB_DEVMEM_IS_ALLOWED
84fbe934d6SPalmer Dabbelt	select GENERIC_PCI_IOMAP
85e8c7ef7dSPalmer Dabbelt	select GENERIC_PTDUMP if MMU
869b9afe4aSAnup Patel	select GENERIC_SCHED_CLOCK
87e8c7ef7dSPalmer Dabbelt	select GENERIC_SMP_IDLE_THREAD
88ad5d1122SVincent Chen	select GENERIC_TIME_VSYSCALL if MMU && 64BIT
89dffe11e2STong Tiangen	select GENERIC_VDSO_TIME_NS if HAVE_GENERIC_VDSO
90c45fc916SConor Dooley	select HARDIRQS_SW_RESEND
91fcbfe812SNiklas Schnelle	select HAS_IOPORT if MMU
92efe75c49SDavid Abdurachmanov	select HAVE_ARCH_AUDITSYSCALL
93be79afc7SLiu Shixin	select HAVE_ARCH_HUGE_VMALLOC if HAVE_ARCH_HUGE_VMAP
94310f541aSLiu Shixin	select HAVE_ARCH_HUGE_VMAP if MMU && 64BIT && !XIP_KERNEL
9542e0e0b4SJisheng Zhang	select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL
9642e0e0b4SJisheng Zhang	select HAVE_ARCH_JUMP_LABEL_RELATIVE if !XIP_KERNEL
97e8c7ef7dSPalmer Dabbelt	select HAVE_ARCH_KASAN if MMU && 64BIT
98e178d670SNylon Chen	select HAVE_ARCH_KASAN_VMALLOC if MMU && 64BIT
9947513f24SLiu Shixin	select HAVE_ARCH_KFENCE if MMU && 64BIT
10042e0e0b4SJisheng Zhang	select HAVE_ARCH_KGDB if !XIP_KERNEL
101e8c7ef7dSPalmer Dabbelt	select HAVE_ARCH_KGDB_QXFER_PKT
102e8c7ef7dSPalmer Dabbelt	select HAVE_ARCH_MMAP_RND_BITS if MMU
1039be84592SGuo Ren	select HAVE_ARCH_MMAP_RND_COMPAT_BITS if COMPAT
1045340627eSDavid Abdurachmanov	select HAVE_ARCH_SECCOMP_FILTER
1055f365c13SConor Dooley	select HAVE_ARCH_THREAD_STRUCT_WHITELIST
106e8c7ef7dSPalmer Dabbelt	select HAVE_ARCH_TRACEHOOK
1079b76d71fSLinus Torvalds	select HAVE_ARCH_TRANSPARENT_HUGEPAGE if 64BIT && MMU
108a2492ca8SSamuel Holland	select HAVE_ARCH_USERFAULTFD_MINOR if 64BIT && USERFAULTFD
10931da94c2STong Tiangen	select HAVE_ARCH_VMAP_STACK if MMU && 64BIT
1102ff2b7ecSMasahiro Yamada	select HAVE_ASM_MODVERSIONS
11124a9c541SFrederic Weisbecker	select HAVE_CONTEXT_TRACKING_USER
112cbb3d91dSTobias Klauser	select HAVE_DEBUG_KMEMLEAK
1136bd33e1eSChristoph Hellwig	select HAVE_DMA_CONTIGUOUS if MMU
114ab7fa6b0SJisheng Zhang	select HAVE_DYNAMIC_FTRACE if !XIP_KERNEL && MMU && (CLANG_SUPPORTS_DYNAMIC_FTRACE || GCC_SUPPORTS_DYNAMIC_FTRACE)
115ab7fa6b0SJisheng Zhang	select HAVE_DYNAMIC_FTRACE_WITH_REGS if HAVE_DYNAMIC_FTRACE
116ab7fa6b0SJisheng Zhang	select HAVE_FTRACE_MCOUNT_RECORD if !XIP_KERNEL
117ab7fa6b0SJisheng Zhang	select HAVE_FUNCTION_GRAPH_TRACER
1184f6b6c2bSLinus Torvalds	select HAVE_FUNCTION_GRAPH_RETVAL if HAVE_FUNCTION_GRAPH_TRACER
119ab7fa6b0SJisheng Zhang	select HAVE_FUNCTION_TRACER if !XIP_KERNEL && !PREEMPTION
120e8c7ef7dSPalmer Dabbelt	select HAVE_EBPF_JIT if MMU
1215f365c13SConor Dooley	select HAVE_FUNCTION_ARG_ACCESS_API
122ee55ff80SGuo Ren	select HAVE_FUNCTION_ERROR_INJECTION
12320d38f7cSTobias Klauser	select HAVE_GCC_PLUGINS
124ad5d1122SVincent Chen	select HAVE_GENERIC_VDSO if MMU && 64BIT
12531564b8bSKefeng Wang	select HAVE_IRQ_TIME_ACCOUNTING
12642e0e0b4SJisheng Zhang	select HAVE_KPROBES if !XIP_KERNEL
12742e0e0b4SJisheng Zhang	select HAVE_KPROBES_ON_FTRACE if !XIP_KERNEL
12842e0e0b4SJisheng Zhang	select HAVE_KRETPROBES if !XIP_KERNEL
129f7584322SNick Desaulniers	# https://github.com/ClangBuiltLinux/linux/issues/1881
130f7584322SNick Desaulniers	select HAVE_LD_DEAD_CODE_DATA_ELIMINATION if !LD_IS_LLD
1313332f419SJisheng Zhang	select HAVE_MOVE_PMD
1323332f419SJisheng Zhang	select HAVE_MOVE_PUD
133e8c7ef7dSPalmer Dabbelt	select HAVE_PCI
134178e9fc4SAlan Kao	select HAVE_PERF_EVENTS
13598a93b0bSMao Han	select HAVE_PERF_REGS
13698a93b0bSMao Han	select HAVE_PERF_USER_STACK_DUMP
137b60ca697SJisheng Zhang	select HAVE_POSIX_CPU_TIMERS_TASK_WORK
1384e90d052SJisheng Zhang	select HAVE_PREEMPT_DYNAMIC_KEY if !XIP_KERNEL
139dcdc7a53SPatrick Stählin	select HAVE_REGS_AND_STACK_ACCESS_API
140ab7fa6b0SJisheng Zhang	select HAVE_RETHOOK if !XIP_KERNEL
1415f365c13SConor Dooley	select HAVE_RSEQ
142f2c9699fSGuo Ren	select HAVE_STACKPROTECTOR
1435aeb1b36SDavid Abdurachmanov	select HAVE_SYSCALL_TRACEPOINTS
14472b11aa7SThomas Gleixner	select HOTPLUG_CORE_SYNC_DEAD if HOTPLUG_CPU
145fbe934d6SPalmer Dabbelt	select IRQ_DOMAIN
1468165c6aeSKefeng Wang	select IRQ_FORCED_THREADING
147864046c5SAlexandre Ghiti	select KASAN_VMALLOC if KASAN
1487267ef7bSBen Hutchings	select LOCK_MM_AND_FIND_VMA
149fbe934d6SPalmer Dabbelt	select MODULES_USE_ELF_RELA if MODULES
1502cffc956SZong Li	select MODULE_SECTIONS if MODULES
151e8c7ef7dSPalmer Dabbelt	select OF
152e8c7ef7dSPalmer Dabbelt	select OF_EARLY_FLATTREE
153e8c7ef7dSPalmer Dabbelt	select OF_IRQ
1542eac9c2dSChristoph Hellwig	select PCI_DOMAINS_GENERIC if PCI
155eb01d42aSChristoph Hellwig	select PCI_MSI if PCI
1561ee7fc3fSConor Dooley	select RISCV_ALTERNATIVE if !XIP_KERNEL
157e71ee06eSAnup Patel	select RISCV_INTC
1582bc3fc87SAnup Patel	select RISCV_TIMER if RISCV_SBI
159bf3d7b1dSConor Dooley	select SIFIVE_PLIC
160e8c7ef7dSPalmer Dabbelt	select SPARSE_IRQ
161e8c7ef7dSPalmer Dabbelt	select SYSCTL_EXCEPTION_TRACE
162e8c7ef7dSPalmer Dabbelt	select THREAD_INFO_IN_TASK
1634aae683fSMasahiro Yamada	select TRACE_IRQFLAGS_SUPPORT
16411129e8eSChristoph Hellwig	select UACCESS_MEMCPY if !MMU
16563703f37SKefeng Wang	select ZONE_DMA32 if 64BIT
16654c95a11SAlexandre Ghiti
167b3d6bdfeSNathan Chancellorconfig CLANG_SUPPORTS_DYNAMIC_FTRACE
168b3d6bdfeSNathan Chancellor	def_bool CC_IS_CLANG
169b3d6bdfeSNathan Chancellor	# https://github.com/llvm/llvm-project/commit/6ab8927931851bb42b2c93a00801dc499d7d9b1e
170b3d6bdfeSNathan Chancellor	depends on CLANG_VERSION >= 130000
171b3d6bdfeSNathan Chancellor	# https://github.com/ClangBuiltLinux/linux/issues/1817
172b3d6bdfeSNathan Chancellor	depends on AS_IS_GNU || (AS_IS_LLVM && (LD_IS_LLD || LD_VERSION >= 23600))
173b3d6bdfeSNathan Chancellor
174b3d6bdfeSNathan Chancellorconfig GCC_SUPPORTS_DYNAMIC_FTRACE
175b3d6bdfeSNathan Chancellor	def_bool CC_IS_GCC
176b3d6bdfeSNathan Chancellor	depends on $(cc-option,-fpatchable-function-entry=8)
177b3d6bdfeSNathan Chancellor
17854c95a11SAlexandre Ghiticonfig ARCH_MMAP_RND_BITS_MIN
17954c95a11SAlexandre Ghiti	default 18 if 64BIT
18054c95a11SAlexandre Ghiti	default 8
18154c95a11SAlexandre Ghiti
1829be84592SGuo Renconfig ARCH_MMAP_RND_COMPAT_BITS_MIN
1839be84592SGuo Ren	default 8
1849be84592SGuo Ren
18554c95a11SAlexandre Ghiti# max bits determined by the following formula:
18654c95a11SAlexandre Ghiti#  VA_BITS - PAGE_SHIFT - 3
18754c95a11SAlexandre Ghiticonfig ARCH_MMAP_RND_BITS_MAX
18854c95a11SAlexandre Ghiti	default 24 if 64BIT # SV39 based
18954c95a11SAlexandre Ghiti	default 17
190fbe934d6SPalmer Dabbelt
1919be84592SGuo Renconfig ARCH_MMAP_RND_COMPAT_BITS_MAX
1929be84592SGuo Ren	default 17
1939be84592SGuo Ren
194a4c3733dSChristoph Hellwig# set if we run in machine mode, cleared if we run in supervisor mode
195a4c3733dSChristoph Hellwigconfig RISCV_M_MODE
196a4c3733dSChristoph Hellwig	bool
1976bd33e1eSChristoph Hellwig	default !MMU
198a4c3733dSChristoph Hellwig
199eded8bc6SDamien Le Moal# set if we are running in S-mode and can use SBI calls
200eded8bc6SDamien Le Moalconfig RISCV_SBI
201eded8bc6SDamien Le Moal	bool
202eded8bc6SDamien Le Moal	depends on !RISCV_M_MODE
203eded8bc6SDamien Le Moal	default y
204eded8bc6SDamien Le Moal
205fbe934d6SPalmer Dabbeltconfig MMU
2066bd33e1eSChristoph Hellwig	bool "MMU-based Paged Memory Management Support"
2076bd33e1eSChristoph Hellwig	default y
2086bd33e1eSChristoph Hellwig	help
2096bd33e1eSChristoph Hellwig	  Select if you want MMU-based virtualised addressing space
2106bd33e1eSChristoph Hellwig	  support by paged memory management. If unsure, say 'Y'.
211fbe934d6SPalmer Dabbelt
212fbe934d6SPalmer Dabbeltconfig PAGE_OFFSET
213fbe934d6SPalmer Dabbelt	hex
214b5e2c507SYimin Gu	default 0xC0000000 if 32BIT && MMU
215b5e2c507SYimin Gu	default 0x80000000 if !MMU
216011f09d1SQinglin Pan	default 0xff60000000000000 if 64BIT
217fbe934d6SPalmer Dabbelt
21854c5639dSAlexandre Ghiticonfig KASAN_SHADOW_OFFSET
21954c5639dSAlexandre Ghiti	hex
22054c5639dSAlexandre Ghiti	depends on KASAN_GENERIC
221f7ae0233SAlexandre Ghiti	default 0xdfffffff00000000 if 64BIT
22254c5639dSAlexandre Ghiti	default 0xffffffff if 32BIT
22354c5639dSAlexandre Ghiti
224d95f1a54SLogan Gunthorpeconfig ARCH_FLATMEM_ENABLE
2254f0e8eefSAtish Patra	def_bool !NUMA
226d95f1a54SLogan Gunthorpe
227d95f1a54SLogan Gunthorpeconfig ARCH_SPARSEMEM_ENABLE
228d95f1a54SLogan Gunthorpe	def_bool y
229aa273420SDamien Le Moal	depends on MMU
230199fc6b8SKefeng Wang	select SPARSEMEM_STATIC if 32BIT && SPARSEMEM
231a5406a7fSKefeng Wang	select SPARSEMEM_VMEMMAP_ENABLE if 64BIT
232d95f1a54SLogan Gunthorpe
233d95f1a54SLogan Gunthorpeconfig ARCH_SELECT_MEMORY_MODEL
234d95f1a54SLogan Gunthorpe	def_bool ARCH_SPARSEMEM_ENABLE
235d95f1a54SLogan Gunthorpe
23674784081SGuo Renconfig ARCH_SUPPORTS_UPROBES
23774784081SGuo Ren	def_bool y
23874784081SGuo Ren
239fbe934d6SPalmer Dabbeltconfig STACKTRACE_SUPPORT
240fbe934d6SPalmer Dabbelt	def_bool y
241fbe934d6SPalmer Dabbelt
242fbe934d6SPalmer Dabbeltconfig GENERIC_BUG
243fbe934d6SPalmer Dabbelt	def_bool y
244fbe934d6SPalmer Dabbelt	depends on BUG
245fbe934d6SPalmer Dabbelt	select GENERIC_BUG_RELATIVE_POINTERS if 64BIT
246fbe934d6SPalmer Dabbelt
247fbe934d6SPalmer Dabbeltconfig GENERIC_BUG_RELATIVE_POINTERS
248fbe934d6SPalmer Dabbelt	bool
249fbe934d6SPalmer Dabbelt
250fbe934d6SPalmer Dabbeltconfig GENERIC_CALIBRATE_DELAY
251fbe934d6SPalmer Dabbelt	def_bool y
252fbe934d6SPalmer Dabbelt
253fbe934d6SPalmer Dabbeltconfig GENERIC_CSUM
254fbe934d6SPalmer Dabbelt	def_bool y
255fbe934d6SPalmer Dabbelt
256fbe934d6SPalmer Dabbeltconfig GENERIC_HWEIGHT
257fbe934d6SPalmer Dabbelt	def_bool y
258fbe934d6SPalmer Dabbelt
259f2c17aabSAnup Patelconfig FIX_EARLYCON_MEM
2600312a3d4SAndreas Schwab	def_bool MMU
261f2c17aabSAnup Patel
2629a2585adSJisheng Zhangconfig ILLEGAL_POINTER_VALUE
2639a2585adSJisheng Zhang	hex
2649a2585adSJisheng Zhang	default 0 if 32BIT
2659a2585adSJisheng Zhang	default 0xdead000000000000 if 64BIT
2669a2585adSJisheng Zhang
267fbe934d6SPalmer Dabbeltconfig PGTABLE_LEVELS
268fbe934d6SPalmer Dabbelt	int
269011f09d1SQinglin Pan	default 5 if 64BIT
270fbe934d6SPalmer Dabbelt	default 2
271fbe934d6SPalmer Dabbelt
2723c469798SGuo Renconfig LOCKDEP_SUPPORT
2733c469798SGuo Ren	def_bool y
2743c469798SGuo Ren
2751631ba12SHeiko Stuebnerconfig RISCV_DMA_NONCOHERENT
2761631ba12SHeiko Stuebner	bool
2771631ba12SHeiko Stuebner	select ARCH_HAS_DMA_PREP_COHERENT
2781631ba12SHeiko Stuebner	select ARCH_HAS_SETUP_DMA_OPS
2795f365c13SConor Dooley	select ARCH_HAS_SYNC_DMA_FOR_CPU
2805f365c13SConor Dooley	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
281f51f7a0fSJisheng Zhang	select DMA_BOUNCE_UNALIGNED_KMALLOC if SWIOTLB
2821631ba12SHeiko Stuebner
283b79f300cSLad Prabhakarconfig RISCV_NONSTANDARD_CACHE_OPS
284b79f300cSLad Prabhakar	bool
285b79f300cSLad Prabhakar	help
286b79f300cSLad Prabhakar	  This enables function pointer support for non-standard noncoherent
287b79f300cSLad Prabhakar	  systems to handle cache management.
288b79f300cSLad Prabhakar
2895ac43ab2SAndrew Jonesconfig AS_HAS_INSN
2905ac43ab2SAndrew Jones	def_bool $(as-instr,.insn r 51$(comma) 0$(comma) 0$(comma) t0$(comma) t0$(comma) zero)
2915ac43ab2SAndrew Jones
292e4bb020fSAndy Chiuconfig AS_HAS_OPTION_ARCH
293e4bb020fSAndy Chiu	# https://reviews.llvm.org/D123515
294e4bb020fSAndy Chiu	def_bool y
295e4bb020fSAndy Chiu	depends on $(as-instr, .option arch$(comma) +m)
296e4bb020fSAndy Chiu
2970cbb8a32SLoys Olliviersource "arch/riscv/Kconfig.socs"
298a3d095acSAndrew Jonessource "arch/riscv/Kconfig.errata"
2990cbb8a32SLoys Ollivier
300fbe934d6SPalmer Dabbeltmenu "Platform type"
301fbe934d6SPalmer Dabbelt
30244c1e84aSPalmer Dabbeltconfig NONPORTABLE
30344c1e84aSPalmer Dabbelt	bool "Allow configurations that result in non-portable kernels"
30444c1e84aSPalmer Dabbelt	help
30544c1e84aSPalmer Dabbelt	  RISC-V kernel binaries are compatible between all known systems
30644c1e84aSPalmer Dabbelt	  whenever possible, but there are some use cases that can only be
30744c1e84aSPalmer Dabbelt	  satisfied by configurations that result in kernel binaries that are
30844c1e84aSPalmer Dabbelt	  not portable between systems.
30944c1e84aSPalmer Dabbelt
31044c1e84aSPalmer Dabbelt	  Selecting N does not guarantee kernels will be portable to all known
31144c1e84aSPalmer Dabbelt	  systems.  Selecting any of the options guarded by NONPORTABLE will
31244c1e84aSPalmer Dabbelt	  result in kernel binaries that are unlikely to be portable between
31344c1e84aSPalmer Dabbelt	  systems.
31444c1e84aSPalmer Dabbelt
31544c1e84aSPalmer Dabbelt	  If unsure, say N.
31644c1e84aSPalmer Dabbelt
317fbe934d6SPalmer Dabbeltchoice
318fbe934d6SPalmer Dabbelt	prompt "Base ISA"
319fbe934d6SPalmer Dabbelt	default ARCH_RV64I
320fbe934d6SPalmer Dabbelt	help
32186cca81aSAntony Pavlov	  This selects the base ISA that this kernel will target and must match
322fbe934d6SPalmer Dabbelt	  the target platform.
323fbe934d6SPalmer Dabbelt
324fbe934d6SPalmer Dabbeltconfig ARCH_RV32I
325fbe934d6SPalmer Dabbelt	bool "RV32I"
32644c1e84aSPalmer Dabbelt	depends on NONPORTABLE
327fbe934d6SPalmer Dabbelt	select 32BIT
328e3d59805SMatt Redfearn	select GENERIC_LIB_ASHLDI3
329e3d59805SMatt Redfearn	select GENERIC_LIB_ASHRDI3
330e3d59805SMatt Redfearn	select GENERIC_LIB_LSHRDI3
3318f79125dSZong Li	select GENERIC_LIB_UCMPDI2
332fbe934d6SPalmer Dabbelt
333fbe934d6SPalmer Dabbeltconfig ARCH_RV64I
334fbe934d6SPalmer Dabbelt	bool "RV64I"
335fbe934d6SPalmer Dabbelt	select 64BIT
336d2075895SNick Desaulniers	select ARCH_SUPPORTS_INT128 if CC_HAS_INT128
3376bd33e1eSChristoph Hellwig	select SWIOTLB if MMU
338fbe934d6SPalmer Dabbelt
339fbe934d6SPalmer Dabbeltendchoice
340fbe934d6SPalmer Dabbelt
341fbe934d6SPalmer Dabbelt# We must be able to map all physical memory into the kernel, but the compiler
342fbe934d6SPalmer Dabbelt# is still a bit more efficient when generating code if it's setup in a manner
343fbe934d6SPalmer Dabbelt# such that it can only map 2GiB of memory.
344fbe934d6SPalmer Dabbeltchoice
345fbe934d6SPalmer Dabbelt	prompt "Kernel Code Model"
346fbe934d6SPalmer Dabbelt	default CMODEL_MEDLOW if 32BIT
347fbe934d6SPalmer Dabbelt	default CMODEL_MEDANY if 64BIT
348fbe934d6SPalmer Dabbelt
349fbe934d6SPalmer Dabbelt	config CMODEL_MEDLOW
350fbe934d6SPalmer Dabbelt		bool "medium low code model"
351fbe934d6SPalmer Dabbelt	config CMODEL_MEDANY
352fbe934d6SPalmer Dabbelt		bool "medium any code model"
353fbe934d6SPalmer Dabbeltendchoice
354fbe934d6SPalmer Dabbelt
355ab1ef68eSZong Liconfig MODULE_SECTIONS
356ab1ef68eSZong Li	bool
357ab1ef68eSZong Li	select HAVE_MOD_ARCH_SPECIFIC
358ab1ef68eSZong Li
359fbe934d6SPalmer Dabbeltconfig SMP
360fbe934d6SPalmer Dabbelt	bool "Symmetric Multi-Processing"
361fbe934d6SPalmer Dabbelt	help
362fbe934d6SPalmer Dabbelt	  This enables support for systems with more than one CPU.  If
363fbe934d6SPalmer Dabbelt	  you say N here, the kernel will run on single and
364fbe934d6SPalmer Dabbelt	  multiprocessor machines, but will use only one CPU of a
365fbe934d6SPalmer Dabbelt	  multiprocessor machine. If you say Y here, the kernel will run
366fbe934d6SPalmer Dabbelt	  on many, but not all, single processor machines. On a single
367fbe934d6SPalmer Dabbelt	  processor machine, the kernel will run faster if you say N
368fbe934d6SPalmer Dabbelt	  here.
369fbe934d6SPalmer Dabbelt
370fbe934d6SPalmer Dabbelt	  If you don't know what to do here, say N.
371fbe934d6SPalmer Dabbelt
3728bf7b3b6SSong Shuaiconfig SCHED_MC
3738bf7b3b6SSong Shuai	bool "Multi-core scheduler support"
3748bf7b3b6SSong Shuai	depends on SMP
3758bf7b3b6SSong Shuai	help
3768bf7b3b6SSong Shuai	  Multi-core scheduler support improves the CPU scheduler's decision
3778bf7b3b6SSong Shuai	  making when dealing with multi-core CPU chips at a cost of slightly
3788bf7b3b6SSong Shuai	  increased overhead in some places. If unsure say N here.
3798bf7b3b6SSong Shuai
380fbe934d6SPalmer Dabbeltconfig NR_CPUS
381e623715fSAnup Patel	int "Maximum number of CPUs (2-512)"
382fbe934d6SPalmer Dabbelt	depends on SMP
3831d6b5ed4SSamuel Holland	range 2 512 if !RISCV_SBI_V01
3841d6b5ed4SSamuel Holland	range 2 32 if RISCV_SBI_V01 && 32BIT
3851d6b5ed4SSamuel Holland	range 2 64 if RISCV_SBI_V01 && 64BIT
386e623715fSAnup Patel	default "32" if 32BIT
387e623715fSAnup Patel	default "64" if 64BIT
388fbe934d6SPalmer Dabbelt
389f1e58583SAtish Patraconfig HOTPLUG_CPU
390f1e58583SAtish Patra	bool "Support for hot-pluggable CPUs"
391f1e58583SAtish Patra	depends on SMP
392f1e58583SAtish Patra	select GENERIC_IRQ_MIGRATION
393f1e58583SAtish Patra	help
394f1e58583SAtish Patra
395f1e58583SAtish Patra	  Say Y here to experiment with turning CPUs off and on.  CPUs
396f1e58583SAtish Patra	  can be controlled through /sys/devices/system/cpu.
397f1e58583SAtish Patra
398f1e58583SAtish Patra	  Say N if you want to disable CPU hotplug.
399f1e58583SAtish Patra
400fbe934d6SPalmer Dabbeltchoice
401fbe934d6SPalmer Dabbelt	prompt "CPU Tuning"
402fbe934d6SPalmer Dabbelt	default TUNE_GENERIC
403fbe934d6SPalmer Dabbelt
404fbe934d6SPalmer Dabbeltconfig TUNE_GENERIC
405fbe934d6SPalmer Dabbelt	bool "generic"
406fbe934d6SPalmer Dabbelt
407fbe934d6SPalmer Dabbeltendchoice
408fbe934d6SPalmer Dabbelt
4094f0e8eefSAtish Patra# Common NUMA Features
4104f0e8eefSAtish Patraconfig NUMA
4114f0e8eefSAtish Patra	bool "NUMA Memory Allocation and Scheduler Support"
4121adbc294SKefeng Wang	depends on SMP && MMU
4134f0e8eefSAtish Patra	select ARCH_SUPPORTS_NUMA_BALANCING
4145f365c13SConor Dooley	select GENERIC_ARCH_NUMA
4157ecd19cfSKefeng Wang	select NEED_PER_CPU_EMBED_FIRST_CHUNK
4165f365c13SConor Dooley	select OF_NUMA
4175f365c13SConor Dooley	select USE_PERCPU_NUMA_NODE_ID
4184f0e8eefSAtish Patra	help
4194f0e8eefSAtish Patra	  Enable NUMA (Non-Uniform Memory Access) support.
4204f0e8eefSAtish Patra
4214f0e8eefSAtish Patra	  The kernel will try to allocate memory used by a CPU on the
4224f0e8eefSAtish Patra	  local memory of the CPU and add some more NUMA awareness to the kernel.
4234f0e8eefSAtish Patra
4244f0e8eefSAtish Patraconfig NODES_SHIFT
4254f0e8eefSAtish Patra	int "Maximum NUMA Nodes (as a power of 2)"
4264f0e8eefSAtish Patra	range 1 10
4274f0e8eefSAtish Patra	default "2"
428a9ee6cf5SMike Rapoport	depends on NUMA
4294f0e8eefSAtish Patra	help
4304f0e8eefSAtish Patra	  Specify the maximum number of NUMA Nodes available on the target
4314f0e8eefSAtish Patra	  system.  Increases memory reserved to accommodate various tables.
4324f0e8eefSAtish Patra
433e64f737aSHeiko Stuebnerconfig RISCV_ALTERNATIVE
434e64f737aSHeiko Stuebner	bool
435e64f737aSHeiko Stuebner	depends on !XIP_KERNEL
436e64f737aSHeiko Stuebner	help
437e64f737aSHeiko Stuebner	  This Kconfig allows the kernel to automatically patch the
438ff19a8deSAndrew Jones	  erratum or cpufeature required by the execution platform at run
439ff19a8deSAndrew Jones	  time. The code patching overhead is minimal, as it's only done
440ff19a8deSAndrew Jones	  once at boot and once on each module load.
441e64f737aSHeiko Stuebner
442a35707c3SHeiko Stuebnerconfig RISCV_ALTERNATIVE_EARLY
443a35707c3SHeiko Stuebner	bool
444a35707c3SHeiko Stuebner	depends on RISCV_ALTERNATIVE
445a35707c3SHeiko Stuebner	help
446a35707c3SHeiko Stuebner	  Allows early patching of the kernel for special errata
447a35707c3SHeiko Stuebner
448fbe934d6SPalmer Dabbeltconfig RISCV_ISA_C
449fbe934d6SPalmer Dabbelt	bool "Emit compressed instructions when building Linux"
450fbe934d6SPalmer Dabbelt	default y
451fbe934d6SPalmer Dabbelt	help
452fbe934d6SPalmer Dabbelt	  Adds "C" to the ISA subsets that the toolchain is allowed to emit
453fbe934d6SPalmer Dabbelt	  when building Linux, which results in compressed instructions in the
454fbe934d6SPalmer Dabbelt	  Linux binary.
455fbe934d6SPalmer Dabbelt
456fbe934d6SPalmer Dabbelt	  If you don't know what to do here, say Y.
457fbe934d6SPalmer Dabbelt
45823ad288aSQinglin Panconfig RISCV_ISA_SVNAPOT
4595464912cSConor Dooley	bool "Svnapot extension support for supervisor mode NAPOT pages"
460ff689fd2SHeiko Stuebner	depends on 64BIT && MMU
4611ee7fc3fSConor Dooley	depends on RISCV_ALTERNATIVE
462ff689fd2SHeiko Stuebner	default y
463ff689fd2SHeiko Stuebner	help
4645464912cSConor Dooley	  Allow kernel to detect the Svnapot ISA-extension dynamically at boot
46523ad288aSQinglin Pan	  time and enable its usage.
46623ad288aSQinglin Pan
4675464912cSConor Dooley	  The Svnapot extension is used to mark contiguous PTEs as a range
46823ad288aSQinglin Pan	  of contiguous virtual-to-physical translations for a naturally
46923ad288aSQinglin Pan	  aligned power-of-2 (NAPOT) granularity larger than the base 4KB page
47023ad288aSQinglin Pan	  size. When HUGETLBFS is also selected this option unconditionally
47123ad288aSQinglin Pan	  allocates some memory for each NAPOT page size supported by the kernel.
47223ad288aSQinglin Pan	  When optimizing for low memory consumption and for platforms without
4735464912cSConor Dooley	  the Svnapot extension, it may be better to say N here.
47423ad288aSQinglin Pan
47523ad288aSQinglin Pan	  If you don't know what to do here, say Y.
47623ad288aSQinglin Pan
477ff689fd2SHeiko Stuebnerconfig RISCV_ISA_SVPBMT
4785464912cSConor Dooley	bool "Svpbmt extension support for supervisor mode page-based memory types"
479ff689fd2SHeiko Stuebner	depends on 64BIT && MMU
480ff689fd2SHeiko Stuebner	depends on RISCV_ALTERNATIVE
481ff689fd2SHeiko Stuebner	default y
482ff689fd2SHeiko Stuebner	help
4835464912cSConor Dooley	   Adds support to dynamically detect the presence of the Svpbmt
484924cbb8cSHeiko Stuebner	   ISA-extension (Supervisor-mode: page-based memory types) and
485924cbb8cSHeiko Stuebner	   enable its usage.
486924cbb8cSHeiko Stuebner
487924cbb8cSHeiko Stuebner	   The memory type for a page contains a combination of attributes
488924cbb8cSHeiko Stuebner	   that indicate the cacheability, idempotency, and ordering
489924cbb8cSHeiko Stuebner	   properties for access to that page.
490ff689fd2SHeiko Stuebner
4915464912cSConor Dooley	   The Svpbmt extension is only available on 64-bit cpus.
492ff689fd2SHeiko Stuebner
493ff689fd2SHeiko Stuebner	   If you don't know what to do here, say Y.
494ff689fd2SHeiko Stuebner
495fa8e7cceSGuo Renconfig TOOLCHAIN_HAS_V
496fa8e7cceSGuo Ren	bool
497fa8e7cceSGuo Ren	default y
4988289dc91SAnton Blanchard	depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64imv)
4998289dc91SAnton Blanchard	depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32imv)
500fa8e7cceSGuo Ren	depends on LLD_VERSION >= 140000 || LD_VERSION >= 23800
501fa8e7cceSGuo Ren	depends on AS_HAS_OPTION_ARCH
502fa8e7cceSGuo Ren
503fa8e7cceSGuo Renconfig RISCV_ISA_V
504fa8e7cceSGuo Ren	bool "VECTOR extension support"
505fa8e7cceSGuo Ren	depends on TOOLCHAIN_HAS_V
506fa8e7cceSGuo Ren	depends on FPU
507fa8e7cceSGuo Ren	select DYNAMIC_SIGFRAME
508fa8e7cceSGuo Ren	default y
509fa8e7cceSGuo Ren	help
510fa8e7cceSGuo Ren	  Say N here if you want to disable all vector related procedure
511fa8e7cceSGuo Ren	  in the kernel.
512fa8e7cceSGuo Ren
513fa8e7cceSGuo Ren	  If you don't know what to do here, say Y.
514fa8e7cceSGuo Ren
515fa8e7cceSGuo Renconfig RISCV_ISA_V_DEFAULT_ENABLE
516fa8e7cceSGuo Ren	bool "Enable userspace Vector by default"
517fa8e7cceSGuo Ren	depends on RISCV_ISA_V
518fa8e7cceSGuo Ren	default y
519fa8e7cceSGuo Ren	help
520fa8e7cceSGuo Ren	  Say Y here if you want to enable Vector in userspace by default.
521fa8e7cceSGuo Ren	  Otherwise, userspace has to make explicit prctl() call to enable
522fa8e7cceSGuo Ren	  Vector, or enable it via the sysctl interface.
523fa8e7cceSGuo Ren
524fa8e7cceSGuo Ren	  If you don't know what to do here, say Y.
525fa8e7cceSGuo Ren
526b6fcdb19SHeiko Stuebnerconfig TOOLCHAIN_HAS_ZBB
5271631ba12SHeiko Stuebner	bool
528b8c86872SConor Dooley	default y
529b6fcdb19SHeiko Stuebner	depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64ima_zbb)
530b6fcdb19SHeiko Stuebner	depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32ima_zbb)
531b6fcdb19SHeiko Stuebner	depends on LLD_VERSION >= 150000 || LD_VERSION >= 23900
532e4bb020fSAndy Chiu	depends on AS_HAS_OPTION_ARCH
533b6fcdb19SHeiko Stuebner
534b6fcdb19SHeiko Stuebnerconfig RISCV_ISA_ZBB
535b6fcdb19SHeiko Stuebner	bool "Zbb extension support for bit manipulation instructions"
536b6fcdb19SHeiko Stuebner	depends on TOOLCHAIN_HAS_ZBB
5371ee7fc3fSConor Dooley	depends on MMU
5381ee7fc3fSConor Dooley	depends on RISCV_ALTERNATIVE
539b6fcdb19SHeiko Stuebner	default y
540b6fcdb19SHeiko Stuebner	help
541b6fcdb19SHeiko Stuebner	   Adds support to dynamically detect the presence of the ZBB
542b6fcdb19SHeiko Stuebner	   extension (basic bit manipulation) and enable its usage.
543b6fcdb19SHeiko Stuebner
544b6fcdb19SHeiko Stuebner	   The Zbb extension provides instructions to accelerate a number
545b6fcdb19SHeiko Stuebner	   of bit-specific operations (count bit population, sign extending,
546b6fcdb19SHeiko Stuebner	   bitrotation, etc).
547b6fcdb19SHeiko Stuebner
548b6fcdb19SHeiko Stuebner	   If you don't know what to do here, say Y.
5491631ba12SHeiko Stuebner
5501631ba12SHeiko Stuebnerconfig RISCV_ISA_ZICBOM
5511631ba12SHeiko Stuebner	bool "Zicbom extension support for non-coherent DMA operation"
5521ee7fc3fSConor Dooley	depends on MMU
5531ee7fc3fSConor Dooley	depends on RISCV_ALTERNATIVE
5541631ba12SHeiko Stuebner	default y
5555f365c13SConor Dooley	select RISCV_DMA_NONCOHERENT
556381cae16SChristoph Hellwig	select DMA_DIRECT_REMAP
5571631ba12SHeiko Stuebner	help
5581631ba12SHeiko Stuebner	   Adds support to dynamically detect the presence of the ZICBOM
5591631ba12SHeiko Stuebner	   extension (Cache Block Management Operations) and enable its
5601631ba12SHeiko Stuebner	   usage.
5611631ba12SHeiko Stuebner
5621631ba12SHeiko Stuebner	   The Zicbom extension can be used to handle for example
5631631ba12SHeiko Stuebner	   non-coherent DMA support on devices that need it.
5641631ba12SHeiko Stuebner
5651631ba12SHeiko Stuebner	   If you don't know what to do here, say Y.
5661631ba12SHeiko Stuebner
567ab0f7746SAndrew Jonesconfig RISCV_ISA_ZICBOZ
568ab0f7746SAndrew Jones	bool "Zicboz extension support for faster zeroing of memory"
569d34a6b71SConor Dooley	depends on MMU
570d34a6b71SConor Dooley	depends on RISCV_ALTERNATIVE
571ab0f7746SAndrew Jones	default y
572ab0f7746SAndrew Jones	help
5735464912cSConor Dooley	   Enable the use of the Zicboz extension (cbo.zero instruction)
574ab0f7746SAndrew Jones	   when available.
575ab0f7746SAndrew Jones
576ab0f7746SAndrew Jones	   The Zicboz extension is used for faster zeroing of memory.
577ab0f7746SAndrew Jones
578ab0f7746SAndrew Jones	   If you don't know what to do here, say Y.
579ab0f7746SAndrew Jones
580aae538cdSConor Dooleyconfig TOOLCHAIN_HAS_ZIHINTPAUSE
581aae538cdSConor Dooley	bool
582aae538cdSConor Dooley	default y
583aae538cdSConor Dooley	depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64ima_zihintpause)
584aae538cdSConor Dooley	depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32ima_zihintpause)
585aae538cdSConor Dooley	depends on LLD_VERSION >= 150000 || LD_VERSION >= 23600
586aae538cdSConor Dooley
587e89c2e81SNathan Chancellorconfig TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI
588e89c2e81SNathan Chancellor	def_bool y
589e89c2e81SNathan Chancellor	# https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=aed44286efa8ae8717a77d94b51ac3614e2ca6dc
590ca09f772SMingzheng Xing	# https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=98416dbb0a62579d4a7a4a76bab51b5b52fec2cd
591ca09f772SMingzheng Xing	depends on AS_IS_GNU && AS_VERSION >= 23600
592e89c2e81SNathan Chancellor	help
593ca09f772SMingzheng Xing	  Binutils-2.38 and GCC-12.1.0 bumped the default ISA spec to the newer
594ca09f772SMingzheng Xing	  20191213 version, which moves some instructions from the I extension to
595ca09f772SMingzheng Xing	  the Zicsr and Zifencei extensions. This requires explicitly specifying
596ca09f772SMingzheng Xing	  Zicsr and Zifencei when binutils >= 2.38 or GCC >= 12.1.0. Zicsr
597ca09f772SMingzheng Xing	  and Zifencei are supported in binutils from version 2.36 onwards.
598ca09f772SMingzheng Xing	  To make life easier, and avoid forcing toolchains that default to a
599ca09f772SMingzheng Xing	  newer ISA spec to version 2.2, relax the check to binutils >= 2.36.
600ef21fa7cSMingzheng Xing	  For clang < 17 or GCC < 11.3.0, for which this is not possible or need
601ef21fa7cSMingzheng Xing	  special treatment, this is dealt with in TOOLCHAIN_NEEDS_OLD_ISA_SPEC.
602e89c2e81SNathan Chancellor
603e89c2e81SNathan Chancellorconfig TOOLCHAIN_NEEDS_OLD_ISA_SPEC
604e89c2e81SNathan Chancellor	def_bool y
605e89c2e81SNathan Chancellor	depends on TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI
606e89c2e81SNathan Chancellor	# https://github.com/llvm/llvm-project/commit/22e199e6afb1263c943c0c0d4498694e15bf8a16
607ef21fa7cSMingzheng Xing	# https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=d29f5d6ab513c52fd872f532c492e35ae9fd6671
608ef21fa7cSMingzheng Xing	depends on (CC_IS_CLANG && CLANG_VERSION < 170000) || (CC_IS_GCC && GCC_VERSION < 110300)
609e89c2e81SNathan Chancellor	help
610ca09f772SMingzheng Xing	  Certain versions of clang and GCC do not support zicsr and zifencei via
611ca09f772SMingzheng Xing	  -march. This option causes an older ISA spec compatible with these older
612ca09f772SMingzheng Xing	  versions of clang and GCC to be passed to GAS, which has the same result
613ca09f772SMingzheng Xing	  as passing zicsr and zifencei to -march.
614e89c2e81SNathan Chancellor
6159671f706SAlan Kaoconfig FPU
6169671f706SAlan Kao	bool "FPU support"
6179671f706SAlan Kao	default y
6189671f706SAlan Kao	help
6199671f706SAlan Kao	  Say N here if you want to disable all floating-point related procedure
6209671f706SAlan Kao	  in the kernel.
6219671f706SAlan Kao
6229671f706SAlan Kao	  If you don't know what to do here, say Y.
6239671f706SAlan Kao
624163e76ccSGuo Renconfig IRQ_STACKS
625dd69d07aSGuo Ren	bool "Independent irq & softirq stacks" if EXPERT
626163e76ccSGuo Ren	default y
627163e76ccSGuo Ren	select HAVE_IRQ_EXIT_ON_IRQ_STACK
628dd69d07aSGuo Ren	select HAVE_SOFTIRQ_ON_OWN_STACK
629163e76ccSGuo Ren	help
630dd69d07aSGuo Ren	  Add independent irq & softirq stacks for percpu to prevent kernel stack
631dd69d07aSGuo Ren	  overflows. We may save some memory footprint by disabling IRQ_STACKS.
632163e76ccSGuo Ren
633a7555f6bSGuo Renconfig THREAD_SIZE_ORDER
634a7555f6bSGuo Ren	int "Kernel stack size (in power-of-two numbers of page size)" if VMAP_STACK && EXPERT
635a7555f6bSGuo Ren	range 0 4
636*1587db11SAlexandre Ghiti	default 1 if 32BIT
637a7555f6bSGuo Ren	default 2
638a7555f6bSGuo Ren	help
639a7555f6bSGuo Ren	  Specify the Pages of thread stack size (from 4KB to 64KB), which also
640a7555f6bSGuo Ren	  affects irq stack size, which is equal to thread stack size.
641a7555f6bSGuo Ren
6422f66a3d0SJuerg Haefligerendmenu # "Platform type"
643fbe934d6SPalmer Dabbelt
644aef53f97SNick Kossifidismenu "Kernel features"
645fbe934d6SPalmer Dabbelt
646fbe934d6SPalmer Dabbeltsource "kernel/Kconfig.hz"
647fbe934d6SPalmer Dabbelt
648efca1398SAtish Patraconfig RISCV_SBI_V01
649efca1398SAtish Patra	bool "SBI v0.1 support"
650efca1398SAtish Patra	depends on RISCV_SBI
651efca1398SAtish Patra	help
652efca1398SAtish Patra	  This config allows kernel to use SBI v0.1 APIs. This will be
653efca1398SAtish Patra	  deprecated in future once legacy M-mode software are no longer in use.
654fba8a867SNick Kossifidis
6552ffc48fcSAtish Patraconfig RISCV_BOOT_SPINWAIT
6562ffc48fcSAtish Patra	bool "Spinwait booting method"
6572ffc48fcSAtish Patra	depends on SMP
65877d707a3SPalmer Dabbelt	default y if RISCV_SBI_V01 || RISCV_M_MODE
6592ffc48fcSAtish Patra	help
6602ffc48fcSAtish Patra	  This enables support for booting Linux via spinwait method. In the
6612ffc48fcSAtish Patra	  spinwait method, all cores randomly jump to Linux. One of the cores
6622ffc48fcSAtish Patra	  gets chosen via lottery and all other keep spinning on a percpu
6632ffc48fcSAtish Patra	  variable. This method cannot support CPU hotplug and sparse hartid
6642ffc48fcSAtish Patra	  scheme. It should be only enabled for M-mode Linux or platforms relying
6652ffc48fcSAtish Patra	  on older firmware without SBI HSM extension. All other platforms should
6662ffc48fcSAtish Patra	  rely on ordered booting via SBI HSM extension which gets chosen
6672ffc48fcSAtish Patra	  dynamically at runtime if the firmware supports it.
6682ffc48fcSAtish Patra
66977d707a3SPalmer Dabbelt	  Since spinwait is incompatible with sparse hart IDs, it requires
67077d707a3SPalmer Dabbelt	  NR_CPUS be large enough to contain the physical hart ID of the first
67177d707a3SPalmer Dabbelt	  hart to enter Linux.
67277d707a3SPalmer Dabbelt
67377d707a3SPalmer Dabbelt	  If unsure what to do here, say N.
67477d707a3SPalmer Dabbelt
6751f0d6efeSEric DeVolderconfig ARCH_SUPPORTS_KEXEC
67637b561d5SIgnat Korchagin	def_bool y
6771f0d6efeSEric DeVolder
6781f0d6efeSEric DeVolderconfig ARCH_SELECTS_KEXEC
6791f0d6efeSEric DeVolder	def_bool y
6801f0d6efeSEric DeVolder	depends on KEXEC
6815f365c13SConor Dooley	select HOTPLUG_CPU if SMP
682fba8a867SNick Kossifidis
6831f0d6efeSEric DeVolderconfig ARCH_SUPPORTS_KEXEC_FILE
68437b561d5SIgnat Korchagin	def_bool 64BIT
685fba8a867SNick Kossifidis
6861f0d6efeSEric DeVolderconfig ARCH_SELECTS_KEXEC_FILE
6871f0d6efeSEric DeVolder	def_bool y
6881f0d6efeSEric DeVolder	depends on KEXEC_FILE
6895f365c13SConor Dooley	select HAVE_IMA_KEXEC if IMA
6906261586eSLiao Chang	select KEXEC_ELF
6916261586eSLiao Chang
692e6265fe7SEric DeVolderconfig ARCH_SUPPORTS_KEXEC_PURGATORY
69378422b74SArnd Bergmann	def_bool ARCH_SUPPORTS_KEXEC_FILE
694736e30afSLi Zhengyu
6951f0d6efeSEric DeVolderconfig ARCH_SUPPORTS_CRASH_DUMP
6961f0d6efeSEric DeVolder	def_bool y
697fba8a867SNick Kossifidis
6989be84592SGuo Renconfig COMPAT
6999be84592SGuo Ren	bool "Kernel support for 32-bit U-mode"
7009be84592SGuo Ren	default 64BIT
7019be84592SGuo Ren	depends on 64BIT && MMU
7029be84592SGuo Ren	help
7039be84592SGuo Ren	  This option enables support for a 32-bit U-mode running under a 64-bit
7049be84592SGuo Ren	  kernel at S-mode. riscv32-specific components such as system calls,
7059be84592SGuo Ren	  the user helper functions (vdso), signal rt_frame functions and the
7069be84592SGuo Ren	  ptrace interface are handled appropriately by the kernel.
7079be84592SGuo Ren
7089be84592SGuo Ren	  If you want to execute 32-bit userspace applications, say Y.
7099be84592SGuo Ren
71039b33072SAlexandre Ghiticonfig RELOCATABLE
71139b33072SAlexandre Ghiti	bool "Build a relocatable kernel"
71239b33072SAlexandre Ghiti	depends on MMU && 64BIT && !XIP_KERNEL
71339b33072SAlexandre Ghiti	help
71439b33072SAlexandre Ghiti          This builds a kernel as a Position Independent Executable (PIE),
71539b33072SAlexandre Ghiti          which retains all relocation metadata required to relocate the
71639b33072SAlexandre Ghiti          kernel binary at runtime to a different virtual address than the
71739b33072SAlexandre Ghiti          address it was linked at.
71839b33072SAlexandre Ghiti          Since RISCV uses the RELA relocation format, this requires a
71939b33072SAlexandre Ghiti          relocation pass at runtime even if the kernel is loaded at the
72039b33072SAlexandre Ghiti          same address it was linked at.
72139b33072SAlexandre Ghiti
72239b33072SAlexandre Ghiti          If unsure, say N.
72339b33072SAlexandre Ghiti
72484fe419dSAlexandre Ghiticonfig RANDOMIZE_BASE
72584fe419dSAlexandre Ghiti        bool "Randomize the address of the kernel image"
72684fe419dSAlexandre Ghiti        select RELOCATABLE
72784fe419dSAlexandre Ghiti        depends on MMU && 64BIT && !XIP_KERNEL
72884fe419dSAlexandre Ghiti        help
72984fe419dSAlexandre Ghiti          Randomizes the virtual address at which the kernel image is
73084fe419dSAlexandre Ghiti          loaded, as a security feature that deters exploit attempts
73184fe419dSAlexandre Ghiti          relying on knowledge of the location of kernel internals.
73284fe419dSAlexandre Ghiti
73384fe419dSAlexandre Ghiti          It is the bootloader's job to provide entropy, by passing a
73484fe419dSAlexandre Ghiti          random u64 value in /chosen/kaslr-seed at kernel entry.
73584fe419dSAlexandre Ghiti
73684fe419dSAlexandre Ghiti          When booting via the UEFI stub, it will invoke the firmware's
73784fe419dSAlexandre Ghiti          EFI_RNG_PROTOCOL implementation (if available) to supply entropy
73884fe419dSAlexandre Ghiti          to the kernel proper. In addition, it will randomise the physical
73984fe419dSAlexandre Ghiti          location of the kernel Image as well.
74084fe419dSAlexandre Ghiti
74184fe419dSAlexandre Ghiti          If unsure, say N.
74284fe419dSAlexandre Ghiti
7432f66a3d0SJuerg Haefligerendmenu # "Kernel features"
744fbe934d6SPalmer Dabbelt
745aef53f97SNick Kossifidismenu "Boot options"
746aef53f97SNick Kossifidis
747aef53f97SNick Kossifidisconfig CMDLINE
7483aed8c43SNick Kossifidis	string "Built-in kernel command line"
749aef53f97SNick Kossifidis	help
7503aed8c43SNick Kossifidis	  For most platforms, the arguments for the kernel's command line
7513aed8c43SNick Kossifidis	  are provided at run-time, during boot. However, there are cases
7523aed8c43SNick Kossifidis	  where either no arguments are being provided or the provided
7533aed8c43SNick Kossifidis	  arguments are insufficient or even invalid.
7543aed8c43SNick Kossifidis
7553aed8c43SNick Kossifidis	  When that occurs, it is possible to define a built-in command
7563aed8c43SNick Kossifidis	  line here and choose how the kernel should use it later on.
7573aed8c43SNick Kossifidis
7583aed8c43SNick Kossifidischoice
7593aed8c43SNick Kossifidis	prompt "Built-in command line usage" if CMDLINE != ""
7603aed8c43SNick Kossifidis	default CMDLINE_FALLBACK
7613aed8c43SNick Kossifidis	help
7623aed8c43SNick Kossifidis	  Choose how the kernel will handle the provided built-in command
7633aed8c43SNick Kossifidis	  line.
7643aed8c43SNick Kossifidis
7653aed8c43SNick Kossifidisconfig CMDLINE_FALLBACK
7663aed8c43SNick Kossifidis	bool "Use bootloader kernel arguments if available"
7673aed8c43SNick Kossifidis	help
7683aed8c43SNick Kossifidis	  Use the built-in command line as fallback in case we get nothing
7693aed8c43SNick Kossifidis	  during boot. This is the default behaviour.
7703aed8c43SNick Kossifidis
7713aed8c43SNick Kossifidisconfig CMDLINE_EXTEND
7723aed8c43SNick Kossifidis	bool "Extend bootloader kernel arguments"
7733aed8c43SNick Kossifidis	help
7743aed8c43SNick Kossifidis	  The command-line arguments provided during boot will be
7753aed8c43SNick Kossifidis	  appended to the built-in command line. This is useful in
7763aed8c43SNick Kossifidis	  cases where the provided arguments are insufficient and
7773aed8c43SNick Kossifidis	  you don't want to or cannot modify them.
7783aed8c43SNick Kossifidis
779aef53f97SNick Kossifidisconfig CMDLINE_FORCE
7803aed8c43SNick Kossifidis	bool "Always use the default kernel command string"
781aef53f97SNick Kossifidis	help
7823aed8c43SNick Kossifidis	  Always use the built-in command line, even if we get one during
7833aed8c43SNick Kossifidis	  boot. This is useful in case you need to override the provided
7843aed8c43SNick Kossifidis	  command line on systems where you don't have or want control
7853aed8c43SNick Kossifidis	  over it.
786aef53f97SNick Kossifidis
7873aed8c43SNick Kossifidisendchoice
788aef53f97SNick Kossifidis
789d7071743SAtish Patraconfig EFI_STUB
790d7071743SAtish Patra	bool
791d7071743SAtish Patra
792d7071743SAtish Patraconfig EFI
793d7071743SAtish Patra	bool "UEFI runtime support"
79444c92257SVitaly Wool	depends on OF && !XIP_KERNEL
795b91540d5SAtish Patra	depends on MMU
796d7071743SAtish Patra	default y
797a91a9ffbSSunil V L	select ARCH_SUPPORTS_ACPI if 64BIT
7985f365c13SConor Dooley	select EFI_GENERIC_STUB
7995f365c13SConor Dooley	select EFI_PARAMS_FROM_FDT
8005f365c13SConor Dooley	select EFI_RUNTIME_WRAPPERS
8015f365c13SConor Dooley	select EFI_STUB
8025f365c13SConor Dooley	select LIBFDT
8035f365c13SConor Dooley	select RISCV_ISA_C
8045f365c13SConor Dooley	select UCS2_STRING
805d7071743SAtish Patra	help
806d7071743SAtish Patra	  This option provides support for runtime services provided
807d7071743SAtish Patra	  by UEFI firmware (such as non-volatile variables, realtime
808d7071743SAtish Patra	  clock, and platform reset). A UEFI stub is also provided to
809d7071743SAtish Patra	  allow the kernel to be booted as an EFI application. This
810d7071743SAtish Patra	  is only useful on systems that have UEFI firmware.
811d7071743SAtish Patra
812fea2fed2SGuo Renconfig CC_HAVE_STACKPROTECTOR_TLS
813fea2fed2SGuo Ren	def_bool $(cc-option,-mstack-protector-guard=tls -mstack-protector-guard-reg=tp -mstack-protector-guard-offset=0)
814fea2fed2SGuo Ren
815fea2fed2SGuo Renconfig STACKPROTECTOR_PER_TASK
816fea2fed2SGuo Ren	def_bool y
817595b893eSKees Cook	depends on !RANDSTRUCT
818fea2fed2SGuo Ren	depends on STACKPROTECTOR && CC_HAVE_STACKPROTECTOR_TLS
819fea2fed2SGuo Ren
820867432beSAlexandre Ghiticonfig PHYS_RAM_BASE_FIXED
821867432beSAlexandre Ghiti	bool "Explicitly specified physical RAM address"
82244c1e84aSPalmer Dabbelt	depends on NONPORTABLE
823867432beSAlexandre Ghiti	default n
824867432beSAlexandre Ghiti
82544c92257SVitaly Woolconfig PHYS_RAM_BASE
82644c92257SVitaly Wool	hex "Platform Physical RAM address"
827867432beSAlexandre Ghiti	depends on PHYS_RAM_BASE_FIXED
82844c92257SVitaly Wool	default "0x80000000"
82944c92257SVitaly Wool	help
83044c92257SVitaly Wool	  This is the physical address of RAM in the system. It has to be
83144c92257SVitaly Wool	  explicitly specified to run early relocations of read-write data
83244c92257SVitaly Wool	  from flash to RAM.
83344c92257SVitaly Wool
83444c92257SVitaly Woolconfig XIP_KERNEL
83544c92257SVitaly Wool	bool "Kernel Execute-In-Place from ROM"
83644c1e84aSPalmer Dabbelt	depends on MMU && SPARSEMEM && NONPORTABLE
83744c92257SVitaly Wool	# This prevents XIP from being enabled by all{yes,mod}config, which
83844c92257SVitaly Wool	# fail to build since XIP doesn't support large kernels.
83944c92257SVitaly Wool	depends on !COMPILE_TEST
840867432beSAlexandre Ghiti	select PHYS_RAM_BASE_FIXED
84144c92257SVitaly Wool	help
84244c92257SVitaly Wool	  Execute-In-Place allows the kernel to run from non-volatile storage
84344c92257SVitaly Wool	  directly addressable by the CPU, such as NOR flash. This saves RAM
84444c92257SVitaly Wool	  space since the text section of the kernel is not loaded from flash
84544c92257SVitaly Wool	  to RAM.  Read-write sections, such as the data section and stack,
84644c92257SVitaly Wool	  are still copied to RAM.  The XIP kernel is not compressed since
84744c92257SVitaly Wool	  it has to run directly from flash, so it will take more space to
84844c92257SVitaly Wool	  store it.  The flash address used to link the kernel object files,
84944c92257SVitaly Wool	  and for storing it, is configuration dependent. Therefore, if you
85044c92257SVitaly Wool	  say Y here, you must know the proper physical address where to
85144c92257SVitaly Wool	  store the kernel image depending on your own flash memory usage.
85244c92257SVitaly Wool
85344c92257SVitaly Wool	  Also note that the make target becomes "make xipImage" rather than
85444c92257SVitaly Wool	  "make zImage" or "make Image".  The final kernel binary to put in
85544c92257SVitaly Wool	  ROM memory will be arch/riscv/boot/xipImage.
85644c92257SVitaly Wool
85744c92257SVitaly Wool	  SPARSEMEM is required because the kernel text and rodata that are
85844c92257SVitaly Wool	  flash resident are not backed by memmap, then any attempt to get
85944c92257SVitaly Wool	  a struct page on those regions will trigger a fault.
86044c92257SVitaly Wool
86144c92257SVitaly Wool	  If unsure, say N.
86244c92257SVitaly Wool
86344c92257SVitaly Woolconfig XIP_PHYS_ADDR
86444c92257SVitaly Wool	hex "XIP Kernel Physical Location"
86544c92257SVitaly Wool	depends on XIP_KERNEL
86644c92257SVitaly Wool	default "0x21000000"
86744c92257SVitaly Wool	help
86844c92257SVitaly Wool	  This is the physical address in your flash memory the kernel will
86944c92257SVitaly Wool	  be linked for and stored to.  This address is dependent on your
87044c92257SVitaly Wool	  own flash usage.
87144c92257SVitaly Wool
872496ea826SConor Dooleyconfig RISCV_ISA_FALLBACK
873496ea826SConor Dooley	bool "Permit falling back to parsing riscv,isa for extension support by default"
874496ea826SConor Dooley	default y
875496ea826SConor Dooley	help
876496ea826SConor Dooley	  Parsing the "riscv,isa" devicetree property has been deprecated and
877496ea826SConor Dooley	  replaced by a list of explicitly defined strings. For compatibility
878496ea826SConor Dooley	  with existing platforms, the kernel will fall back to parsing the
879496ea826SConor Dooley	  "riscv,isa" property if the replacements are not found.
880496ea826SConor Dooley
881496ea826SConor Dooley	  Selecting N here will result in a kernel that does not use the
882496ea826SConor Dooley	  fallback, unless the commandline "riscv_isa_fallback" parameter is
883496ea826SConor Dooley	  present.
884496ea826SConor Dooley
885496ea826SConor Dooley	  Please see the dt-binding, located at
886496ea826SConor Dooley	  Documentation/devicetree/bindings/riscv/extensions.yaml for details
887496ea826SConor Dooley	  on the replacement properties, "riscv,isa-base" and
888496ea826SConor Dooley	  "riscv,isa-extensions".
889496ea826SConor Dooley
8902f66a3d0SJuerg Haefligerendmenu # "Boot options"
891aef53f97SNick Kossifidis
8922d268251SPalmer Dabbeltconfig BUILTIN_DTB
89344c92257SVitaly Wool	bool
89444c1e84aSPalmer Dabbelt	depends on OF && NONPORTABLE
89544c92257SVitaly Wool	default y if XIP_KERNEL
8962d268251SPalmer Dabbelt
89744c1e84aSPalmer Dabbeltconfig PORTABLE
89844c1e84aSPalmer Dabbelt	bool
89944c1e84aSPalmer Dabbelt	default !NONPORTABLE
90044c1e84aSPalmer Dabbelt	select EFI
90144c1e84aSPalmer Dabbelt	select MMU
9025f365c13SConor Dooley	select OF
90344c1e84aSPalmer Dabbelt
904fbe934d6SPalmer Dabbeltmenu "Power management options"
905fbe934d6SPalmer Dabbelt
9068636a1f9SMasahiro Yamadasource "kernel/power/Kconfig"
907fbe934d6SPalmer Dabbelt
908ed309ce5SConor Dooley# Hibernation is only possible on systems where the SBI implementation has
909ed309ce5SConor Dooley# marked its reserved memory as not accessible from, or does not run
910ed309ce5SConor Dooley# from the same memory as, Linux
911c0317210SSia Jee Hengconfig ARCH_HIBERNATION_POSSIBLE
912ed309ce5SConor Dooley	def_bool NONPORTABLE
913c0317210SSia Jee Heng
914c0317210SSia Jee Hengconfig ARCH_HIBERNATION_HEADER
915c0317210SSia Jee Heng	def_bool HIBERNATION
916c0317210SSia Jee Heng
917c1f048a6SSong Shuaiconfig ARCH_SUSPEND_POSSIBLE
918c1f048a6SSong Shuai	def_bool y
919c1f048a6SSong Shuai
9202f66a3d0SJuerg Haefligerendmenu # "Power management options"
921d7071743SAtish Patra
922f6e64b66SAnup Patelmenu "CPU Power Management"
923f6e64b66SAnup Patel
924f6e64b66SAnup Patelsource "drivers/cpuidle/Kconfig"
925f6e64b66SAnup Patel
926effae0e3SLad Prabhakarsource "drivers/cpufreq/Kconfig"
927effae0e3SLad Prabhakar
9282f66a3d0SJuerg Haefligerendmenu # "CPU Power Management"
929f6e64b66SAnup Patel
93099cdc6c1SAnup Patelsource "arch/riscv/kvm/Kconfig"
931a91a9ffbSSunil V L
932a91a9ffbSSunil V Lsource "drivers/acpi/Kconfig"
933