xref: /linux/arch/riscv/Kconfig (revision a578dd095dfe8b56c167201d9aea43e47d27f807)
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
1601415e78SSunil V L	select ACPI_MCFG if (ACPI && PCI)
1766381d36SYunhui Cui	select ACPI_PPTT if ACPI
18a91a9ffbSSunil V L	select ACPI_REDUCED_HARDWARE_ONLY if ACPI
1938738947SSia Jee Heng	select ACPI_SPCR_TABLE if ACPI
20c00a60d6SJiaxun Yang	select ARCH_DMA_DEFAULT_COHERENT
21c24a1967SChen Wandun	select ARCH_ENABLE_HUGEPAGE_MIGRATION if HUGETLB_PAGE && MIGRATION
22f8c2a240SBjörn Töpel	select ARCH_ENABLE_MEMORY_HOTPLUG if SPARSEMEM_VMEMMAP
23f8c2a240SBjörn Töpel	select ARCH_ENABLE_MEMORY_HOTREMOVE if MEMORY_HOTPLUG
245a7ac592SKefeng Wang	select ARCH_ENABLE_SPLIT_PMD_PTLOCK if PGTABLE_LEVELS > 2
255f365c13SConor Dooley	select ARCH_ENABLE_THP_MIGRATION if TRANSPARENT_HUGEPAGE
26ad97f9dfSChristoph Hellwig	select ARCH_HAS_BINFMT_FLAT
27fdecfea0SKees Cook	select ARCH_HAS_CURRENT_STACK_POINTER
28e8c7ef7dSPalmer Dabbelt	select ARCH_HAS_DEBUG_VIRTUAL if MMU
295f365c13SConor Dooley	select ARCH_HAS_DEBUG_VM_PGTABLE
30b422d28bSZong Li	select ARCH_HAS_DEBUG_WX
3148b4fc66SJisheng Zhang	select ARCH_HAS_FAST_MULTIPLIER
3295301414SKefeng Wang	select ARCH_HAS_FORTIFY_SOURCE
33e8c7ef7dSPalmer Dabbelt	select ARCH_HAS_GCOV_PROFILE_ALL
34e8c7ef7dSPalmer Dabbelt	select ARCH_HAS_GIGANTIC_PAGE
3594a7734dSYong-Xuan Wang	select ARCH_HAS_HW_PTE_YOUNG
3620d38f7cSTobias Klauser	select ARCH_HAS_KCOV
3777acc6b5SSamuel Holland	select ARCH_HAS_KERNEL_FPU_SUPPORT if 64BIT && FPU
38d6cfd177SAndrea Parri	select ARCH_HAS_MEMBARRIER_CALLBACKS
39cd9b2901SAndrea Parri	select ARCH_HAS_MEMBARRIER_SYNC_CORE
40e8c7ef7dSPalmer Dabbelt	select ARCH_HAS_MMIOWB
4199a670b2SRuan Jinjie	select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
42a49ab905SAnup Patel	select ARCH_HAS_PMEM_API
4322aaec35SJisheng Zhang	select ARCH_HAS_PREEMPT_LAZY
44cd9b2901SAndrea Parri	select ARCH_HAS_PREPARE_SYNC_CORE_CMD
45f9aad622SAnshuman Khandual	select ARCH_HAS_PTDUMP if MMU
46216e04bfSBjörn Töpel	select ARCH_HAS_PTE_DEVMAP if 64BIT && MMU
47e8c7ef7dSPalmer Dabbelt	select ARCH_HAS_PTE_SPECIAL
4810cc3278SMike Rapoport	select ARCH_HAS_SET_DIRECT_MAP if MMU
4910cc3278SMike Rapoport	select ARCH_HAS_SET_MEMORY if MMU
5044c92257SVitaly Wool	select ARCH_HAS_STRICT_KERNEL_RWX if MMU && !XIP_KERNEL
5144c92257SVitaly Wool	select ARCH_HAS_STRICT_MODULE_RWX if MMU && !XIP_KERNEL
52cd9b2901SAndrea Parri	select ARCH_HAS_SYNC_CORE_BEFORE_USERMODE
5308d0ce30SSami Tolvanen	select ARCH_HAS_SYSCALL_WRAPPER
542f100585SGuo Ren	select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
55918327e9SKees Cook	select ARCH_HAS_UBSAN
5646fe55b2SThomas Weißschuh	select ARCH_HAS_VDSO_ARCH_DATA if GENERIC_VDSO_DATA_STORE
57e8065df5SSunil V L	select ARCH_KEEP_MEMBLOCK if ACPI
58f8c2a240SBjörn Töpel	select ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE	if 64BIT && MMU
59fc0c769fSVincent Chen	select ARCH_OPTIONAL_KERNEL_RWX if ARCH_HAS_STRICT_KERNEL_RWX
60fc0c769fSVincent Chen	select ARCH_OPTIONAL_KERNEL_RWX_DEFAULT
617f85b04bSJisheng Zhang	select ARCH_STACKWALK
627f85b04bSJisheng Zhang	select ARCH_SUPPORTS_ATOMIC_RMW
636f49743aSNathan Chancellor	# clang >= 17: https://github.com/llvm/llvm-project/commit/62fa708ceb027713b386c7e0efda994f8bdc27e2
646f49743aSNathan Chancellor	select ARCH_SUPPORTS_CFI_CLANG if CLANG_VERSION >= 170000
657f85b04bSJisheng Zhang	select ARCH_SUPPORTS_DEBUG_PAGEALLOC if MMU
6603dc00a2SAndrew Bresticker	select ARCH_SUPPORTS_HUGE_PFNMAP if TRANSPARENT_HUGEPAGE
67855f9a8eSAnshuman Khandual	select ARCH_SUPPORTS_HUGETLBFS if MMU
68021d2342SWende Tan	# LLD >= 14: https://github.com/llvm/llvm-project/issues/50505
69021d2342SWende Tan	select ARCH_SUPPORTS_LTO_CLANG if LLD_VERSION >= 140000
70021d2342SWende Tan	select ARCH_SUPPORTS_LTO_CLANG_THIN if LLD_VERSION >= 140000
71a869b8c2SJisheng Zhang	select ARCH_SUPPORTS_MSEAL_SYSTEM_MAPPINGS if 64BIT && MMU
7234c0a5b0SYueHaibing	select ARCH_SUPPORTS_PAGE_TABLE_CHECK if MMU
73648321faSJisheng Zhang	select ARCH_SUPPORTS_PER_VMA_LOCK if MMU
742638e4e6SSebastian Andrzej Siewior	select ARCH_SUPPORTS_RT
75d1584d79SSami Tolvanen	select ARCH_SUPPORTS_SHADOW_CALL_STACK if HAVE_SHADOW_CALL_STACK
76eb1e5037SJisheng Zhang	select ARCH_USE_CMPXCHG_LOCKREF if 64BIT
7797a03108SKefeng Wang	select ARCH_USE_MEMTEST
78c9c0b0baSPalmer Dabbelt	select ARCH_USE_QUEUED_RWLOCKS
797c9d980eSJisheng Zhang	select ARCH_USE_SYM_ANNOTATIONS
80af0ead42SSami Tolvanen	select ARCH_USES_CFI_TRAPS if CFI_CLANG
81c6026d35SSamuel Holland	select ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH if MMU
82e8c7ef7dSPalmer Dabbelt	select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU
83fbe934d6SPalmer Dabbelt	select ARCH_WANT_FRAME_POINTERS
8482a1a1f3SQinglin Pan	select ARCH_WANT_GENERAL_HUGETLB if !RISCV_ISA_SVNAPOT
85e8c7ef7dSPalmer Dabbelt	select ARCH_WANT_HUGE_PMD_SHARE if 64BIT
86f4b71bffSJisheng Zhang	select ARCH_WANT_LD_ORPHAN_WARN if !XIP_KERNEL
874705c157SBjörn Töpel	select ARCH_WANT_OPTIMIZE_DAX_VMEMMAP
880b6f1582SAneesh Kumar K.V	select ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP
89cfbc4f81SJisheng Zhang	select ARCH_WANTS_NO_INSTR
9087f81e66SJisheng Zhang	select ARCH_WANTS_THP_SWAP if HAVE_ARCH_TRANSPARENT_HUGEPAGE
91ab83647fSAlexandre Ghiti	select ARCH_WEAK_RELEASE_ACQUIRE if ARCH_USE_QUEUED_SPINLOCKS
9209accc3aSDamien Le Moal	select BINFMT_FLAT_NO_DATA_START_OFFSET if !MMU
9354fed35fSJisheng Zhang	select BUILDTIME_TABLE_SORT if MMU
94f862bbf4SSamuel Holland	select CLINT_TIMER if RISCV_M_MODE
955f365c13SConor Dooley	select CLONE_BACKWARDS
96fbe934d6SPalmer Dabbelt	select COMMON_CLK
974dc4af9cSAndrew Jones	select CPU_PM if CPU_IDLE || HIBERNATION || SUSPEND
985874ca4cSAlexandre Ghiti	select DYNAMIC_FTRACE if FUNCTION_TRACER
99e8c7ef7dSPalmer Dabbelt	select EDAC_SUPPORT
1009f944d2eSBjörn Töpel	select FRAME_POINTER if PERF_EVENTS || (FUNCTION_TRACER && !DYNAMIC_FTRACE)
101b546d636SSong Shuai	select FTRACE_MCOUNT_USE_PATCHABLE_FUNCTION_ENTRY if DYNAMIC_FTRACE
102c217157bSPuranjay Mohan	select FUNCTION_ALIGNMENT_8B if DYNAMIC_FTRACE_WITH_CALL_OPS
103fbd92809SConor Dooley	select GENERIC_ARCH_TOPOLOGY
104e8c7ef7dSPalmer Dabbelt	select GENERIC_ATOMIC64 if !64BIT
1052f100585SGuo Ren	select GENERIC_CLOCKEVENTS_BROADCAST if SMP
10696cf2036SJames Morse	select GENERIC_CPU_DEVICES
1070e3f3649SJinjie Ruan	select GENERIC_CPU_VULNERABILITIES
1086262f661SAtish Patra	select GENERIC_EARLY_IOREMAP
109f0bddf50SGuo Ren	select GENERIC_ENTRY
110ad5d1122SVincent Chen	select GENERIC_GETTIMEOFDAY if HAVE_GENERIC_VDSO
111bcf11b5eSKefeng Wang	select GENERIC_IDLE_POLL_SETUP
1128350229fSChristoph Hellwig	select GENERIC_IOREMAP if MMU
113832f15f4SAnup Patel	select GENERIC_IRQ_IPI if SMP
114832f15f4SAnup Patel	select GENERIC_IRQ_IPI_MUX if SMP
115e8c7ef7dSPalmer Dabbelt	select GENERIC_IRQ_MULTI_HANDLER
116fbe934d6SPalmer Dabbelt	select GENERIC_IRQ_SHOW
117ecd4916cSKefeng Wang	select GENERIC_IRQ_SHOW_LEVEL
11878ed473cSPalmer Dabbelt	select GENERIC_LIB_DEVMEM_IS_ALLOWED
11958d868b6SAnup Patel	select GENERIC_PENDING_IRQ if SMP
120fbe934d6SPalmer Dabbelt	select GENERIC_PCI_IOMAP
1219b9afe4aSAnup Patel	select GENERIC_SCHED_CLOCK
122e8c7ef7dSPalmer Dabbelt	select GENERIC_SMP_IDLE_THREAD
123ad5d1122SVincent Chen	select GENERIC_TIME_VSYSCALL if MMU && 64BIT
12446fe55b2SThomas Weißschuh	select GENERIC_VDSO_DATA_STORE if MMU
125dffe11e2STong Tiangen	select GENERIC_VDSO_TIME_NS if HAVE_GENERIC_VDSO
126c45fc916SConor Dooley	select HARDIRQS_SW_RESEND
127fcbfe812SNiklas Schnelle	select HAS_IOPORT if MMU
128f7bd2be7SAlexandre Ghiti	select HAVE_ALIGNED_STRUCT_PAGE
129efe75c49SDavid Abdurachmanov	select HAVE_ARCH_AUDITSYSCALL
130be79afc7SLiu Shixin	select HAVE_ARCH_HUGE_VMALLOC if HAVE_ARCH_HUGE_VMAP
1317bed5161SNam Cao	select HAVE_ARCH_HUGE_VMAP if MMU && 64BIT
13242e0e0b4SJisheng Zhang	select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL
13342e0e0b4SJisheng Zhang	select HAVE_ARCH_JUMP_LABEL_RELATIVE if !XIP_KERNEL
134e8c7ef7dSPalmer Dabbelt	select HAVE_ARCH_KASAN if MMU && 64BIT
135e178d670SNylon Chen	select HAVE_ARCH_KASAN_VMALLOC if MMU && 64BIT
13647513f24SLiu Shixin	select HAVE_ARCH_KFENCE if MMU && 64BIT
137*57fbad15SKees Cook	select HAVE_ARCH_KSTACK_ERASE
13842e0e0b4SJisheng Zhang	select HAVE_ARCH_KGDB if !XIP_KERNEL
139e8c7ef7dSPalmer Dabbelt	select HAVE_ARCH_KGDB_QXFER_PKT
140e8c7ef7dSPalmer Dabbelt	select HAVE_ARCH_MMAP_RND_BITS if MMU
1419be84592SGuo Ren	select HAVE_ARCH_MMAP_RND_COMPAT_BITS if COMPAT
14205d450aaSSong Shuai	select HAVE_ARCH_RANDOMIZE_KSTACK_OFFSET
1435340627eSDavid Abdurachmanov	select HAVE_ARCH_SECCOMP_FILTER
1445f365c13SConor Dooley	select HAVE_ARCH_THREAD_STRUCT_WHITELIST
145e8c7ef7dSPalmer Dabbelt	select HAVE_ARCH_TRACEHOOK
1469b76d71fSLinus Torvalds	select HAVE_ARCH_TRANSPARENT_HUGEPAGE if 64BIT && MMU
147c3cc2a4aSAlexandre Ghiti	select HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD if 64BIT && MMU
148a2492ca8SSamuel Holland	select HAVE_ARCH_USERFAULTFD_MINOR if 64BIT && USERFAULTFD
14931da94c2STong Tiangen	select HAVE_ARCH_VMAP_STACK if MMU && 64BIT
1502ff2b7ecSMasahiro Yamada	select HAVE_ASM_MODVERSIONS
15124a9c541SFrederic Weisbecker	select HAVE_CONTEXT_TRACKING_USER
152cbb3d91dSTobias Klauser	select HAVE_DEBUG_KMEMLEAK
1536bd33e1eSChristoph Hellwig	select HAVE_DMA_CONTIGUOUS if MMU
154ab7fa6b0SJisheng Zhang	select HAVE_DYNAMIC_FTRACE if !XIP_KERNEL && MMU && (CLANG_SUPPORTS_DYNAMIC_FTRACE || GCC_SUPPORTS_DYNAMIC_FTRACE)
155c41bf432SAndy Chiu	select FUNCTION_ALIGNMENT_4B if HAVE_DYNAMIC_FTRACE && RISCV_ISA_C
156b21cdb95SAndy Chiu	select HAVE_DYNAMIC_FTRACE_WITH_DIRECT_CALLS if HAVE_DYNAMIC_FTRACE_WITH_CALL_OPS
157c217157bSPuranjay Mohan	select HAVE_DYNAMIC_FTRACE_WITH_CALL_OPS if (DYNAMIC_FTRACE_WITH_ARGS && !CFI_CLANG)
1587caa9765SPuranjay Mohan	select HAVE_DYNAMIC_FTRACE_WITH_ARGS if HAVE_DYNAMIC_FTRACE
159a762e926SMasami Hiramatsu (Google)	select HAVE_FTRACE_GRAPH_FUNC
160ab7fa6b0SJisheng Zhang	select HAVE_FTRACE_MCOUNT_RECORD if !XIP_KERNEL
161e8eb8e1bSPu Lehui	select HAVE_FUNCTION_GRAPH_TRACER if HAVE_DYNAMIC_FTRACE_WITH_ARGS
162a3ed4157SMasami Hiramatsu (Google)	select HAVE_FUNCTION_GRAPH_FREGS
1635874ca4cSAlexandre Ghiti	select HAVE_FUNCTION_TRACER if !XIP_KERNEL && HAVE_DYNAMIC_FTRACE
164e8c7ef7dSPalmer Dabbelt	select HAVE_EBPF_JIT if MMU
16525176ad0SDavid Hildenbrand	select HAVE_GUP_FAST if MMU
1665f365c13SConor Dooley	select HAVE_FUNCTION_ARG_ACCESS_API
167ee55ff80SGuo Ren	select HAVE_FUNCTION_ERROR_INJECTION
16820d38f7cSTobias Klauser	select HAVE_GCC_PLUGINS
169ad5d1122SVincent Chen	select HAVE_GENERIC_VDSO if MMU && 64BIT
17031564b8bSKefeng Wang	select HAVE_IRQ_TIME_ACCOUNTING
171e79dfcbfSEmil Renner Berthing	select HAVE_KERNEL_BZIP2 if !XIP_KERNEL && !EFI_ZBOOT
172e79dfcbfSEmil Renner Berthing	select HAVE_KERNEL_GZIP if !XIP_KERNEL && !EFI_ZBOOT
173e79dfcbfSEmil Renner Berthing	select HAVE_KERNEL_LZ4 if !XIP_KERNEL && !EFI_ZBOOT
174e79dfcbfSEmil Renner Berthing	select HAVE_KERNEL_LZMA if !XIP_KERNEL && !EFI_ZBOOT
175e79dfcbfSEmil Renner Berthing	select HAVE_KERNEL_LZO if !XIP_KERNEL && !EFI_ZBOOT
176e79dfcbfSEmil Renner Berthing	select HAVE_KERNEL_UNCOMPRESSED if !XIP_KERNEL && !EFI_ZBOOT
177e79dfcbfSEmil Renner Berthing	select HAVE_KERNEL_ZSTD if !XIP_KERNEL && !EFI_ZBOOT
178ab4ce983SLasse Collin	select HAVE_KERNEL_XZ if !XIP_KERNEL && !EFI_ZBOOT
17942e0e0b4SJisheng Zhang	select HAVE_KPROBES if !XIP_KERNEL
18042e0e0b4SJisheng Zhang	select HAVE_KRETPROBES if !XIP_KERNEL
181f7584322SNick Desaulniers	# https://github.com/ClangBuiltLinux/linux/issues/1881
182f7584322SNick Desaulniers	select HAVE_LD_DEAD_CODE_DATA_ELIMINATION if !LD_IS_LLD
1833332f419SJisheng Zhang	select HAVE_MOVE_PMD
1843332f419SJisheng Zhang	select HAVE_MOVE_PUD
1855394f1e9SArnd Bergmann	select HAVE_PAGE_SIZE_4KB
186e8c7ef7dSPalmer Dabbelt	select HAVE_PCI
187178e9fc4SAlan Kao	select HAVE_PERF_EVENTS
18898a93b0bSMao Han	select HAVE_PERF_REGS
18998a93b0bSMao Han	select HAVE_PERF_USER_STACK_DUMP
190b60ca697SJisheng Zhang	select HAVE_POSIX_CPU_TIMERS_TASK_WORK
1914e90d052SJisheng Zhang	select HAVE_PREEMPT_DYNAMIC_KEY if !XIP_KERNEL
192dcdc7a53SPatrick Stählin	select HAVE_REGS_AND_STACK_ACCESS_API
193ab7fa6b0SJisheng Zhang	select HAVE_RETHOOK if !XIP_KERNEL
1945f365c13SConor Dooley	select HAVE_RSEQ
19533549fcfSConor Dooley	select HAVE_RUST if RUSTC_SUPPORTS_RISCV && CC_IS_CLANG
196629291ddSSong Shuai	select HAVE_SAMPLE_FTRACE_DIRECT
197629291ddSSong Shuai	select HAVE_SAMPLE_FTRACE_DIRECT_MULTI
198f2c9699fSGuo Ren	select HAVE_STACKPROTECTOR
1995aeb1b36SDavid Abdurachmanov	select HAVE_SYSCALL_TRACEPOINTS
20072b11aa7SThomas Gleixner	select HOTPLUG_CORE_SYNC_DEAD if HOTPLUG_CPU
201fbe934d6SPalmer Dabbelt	select IRQ_DOMAIN
2028165c6aeSKefeng Wang	select IRQ_FORCED_THREADING
203864046c5SAlexandre Ghiti	select KASAN_VMALLOC if KASAN
2047267ef7bSBen Hutchings	select LOCK_MM_AND_FIND_VMA
20569be3fb1SJisheng Zhang	select MMU_GATHER_RCU_TABLE_FREE if SMP && MMU
206fbe934d6SPalmer Dabbelt	select MODULES_USE_ELF_RELA if MODULES
207e8c7ef7dSPalmer Dabbelt	select OF
208e8c7ef7dSPalmer Dabbelt	select OF_EARLY_FLATTREE
209e8c7ef7dSPalmer Dabbelt	select OF_IRQ
2102eac9c2dSChristoph Hellwig	select PCI_DOMAINS_GENERIC if PCI
21101415e78SSunil V L	select PCI_ECAM if (ACPI && PCI)
212eb01d42aSChristoph Hellwig	select PCI_MSI if PCI
213e1cf2d00SSamuel Holland	select RELOCATABLE if !MMU && !PHYS_RAM_BASE_FIXED
2141ee7fc3fSConor Dooley	select RISCV_ALTERNATIVE if !XIP_KERNEL
2150eebc69dSAnup Patel	select RISCV_APLIC
2160eebc69dSAnup Patel	select RISCV_IMSIC
217e71ee06eSAnup Patel	select RISCV_INTC
2182bc3fc87SAnup Patel	select RISCV_TIMER if RISCV_SBI
219bf3d7b1dSConor Dooley	select SIFIVE_PLIC
220e8c7ef7dSPalmer Dabbelt	select SPARSE_IRQ
221e8c7ef7dSPalmer Dabbelt	select SYSCTL_EXCEPTION_TRACE
222e8c7ef7dSPalmer Dabbelt	select THREAD_INFO_IN_TASK
2234aae683fSMasahiro Yamada	select TRACE_IRQFLAGS_SUPPORT
22411129e8eSChristoph Hellwig	select UACCESS_MEMCPY if !MMU
225ee0d0305SXi Ruoyao	select VDSO_GETRANDOM if HAVE_GENERIC_VDSO
2261a748331SJinjie Ruan	select USER_STACKTRACE_SUPPORT
22763703f37SKefeng Wang	select ZONE_DMA32 if 64BIT
22854c95a11SAlexandre Ghiti
229d077242dSAlice Ryhlconfig RUSTC_SUPPORTS_RISCV
230d077242dSAlice Ryhl	def_bool y
231d077242dSAlice Ryhl	depends on 64BIT
232d077242dSAlice Ryhl	# Shadow call stack requires rustc version 1.82+ due to use of the
233d077242dSAlice Ryhl	# -Zsanitizer=shadow-call-stack flag.
234d077242dSAlice Ryhl	depends on !SHADOW_CALL_STACK || RUSTC_VERSION >= 108200
235d077242dSAlice Ryhl
236b3d6bdfeSNathan Chancellorconfig CLANG_SUPPORTS_DYNAMIC_FTRACE
237b3d6bdfeSNathan Chancellor	def_bool CC_IS_CLANG
238b3d6bdfeSNathan Chancellor	# https://github.com/ClangBuiltLinux/linux/issues/1817
239b3d6bdfeSNathan Chancellor	depends on AS_IS_GNU || (AS_IS_LLVM && (LD_IS_LLD || LD_VERSION >= 23600))
240b3d6bdfeSNathan Chancellor
241b3d6bdfeSNathan Chancellorconfig GCC_SUPPORTS_DYNAMIC_FTRACE
242b3d6bdfeSNathan Chancellor	def_bool CC_IS_GCC
243b3d6bdfeSNathan Chancellor	depends on $(cc-option,-fpatchable-function-entry=8)
244c41bf432SAndy Chiu	depends on CC_HAS_MIN_FUNCTION_ALIGNMENT || !RISCV_ISA_C
245b3d6bdfeSNathan Chancellor
246d1584d79SSami Tolvanenconfig HAVE_SHADOW_CALL_STACK
247d1584d79SSami Tolvanen	def_bool $(cc-option,-fsanitize=shadow-call-stack)
248d1584d79SSami Tolvanen	# https://github.com/riscv-non-isa/riscv-elf-psabi-doc/commit/a484e843e6eeb51f0cb7b8819e50da6d2444d769
249d1584d79SSami Tolvanen	depends on $(ld-option,--no-relax-gp)
250d1584d79SSami Tolvanen
25155b71d2cSNathan Chancellorconfig RISCV_USE_LINKER_RELAXATION
25255b71d2cSNathan Chancellor	def_bool y
25355b71d2cSNathan Chancellor	# https://github.com/llvm/llvm-project/commit/6611d58f5bbcbec77262d392e2923e1d680f6985
25455b71d2cSNathan Chancellor	depends on !LD_IS_LLD || LLD_VERSION >= 150000
25555b71d2cSNathan Chancellor
256ae84ff9aSNathan Chancellor# https://github.com/llvm/llvm-project/commit/bbc0f99f3bc96f1db16f649fc21dd18e5b0918f6
257ae84ff9aSNathan Chancellorconfig ARCH_HAS_BROKEN_DWARF5
258ae84ff9aSNathan Chancellor	def_bool y
259ae84ff9aSNathan Chancellor	depends on RISCV_USE_LINKER_RELAXATION
260ae84ff9aSNathan Chancellor	# https://github.com/llvm/llvm-project/commit/1df5ea29b43690b6622db2cad7b745607ca4de6a
261ae84ff9aSNathan Chancellor	depends on AS_IS_LLVM && AS_VERSION < 180000
262ae84ff9aSNathan Chancellor	# https://github.com/llvm/llvm-project/commit/7ffabb61a5569444b5ac9322e22e5471cc5e4a77
263ae84ff9aSNathan Chancellor	depends on LD_IS_LLD && LLD_VERSION < 180000
264ae84ff9aSNathan Chancellor
26554c95a11SAlexandre Ghiticonfig ARCH_MMAP_RND_BITS_MIN
26654c95a11SAlexandre Ghiti	default 18 if 64BIT
26754c95a11SAlexandre Ghiti	default 8
26854c95a11SAlexandre Ghiti
2699be84592SGuo Renconfig ARCH_MMAP_RND_COMPAT_BITS_MIN
2709be84592SGuo Ren	default 8
2719be84592SGuo Ren
27254c95a11SAlexandre Ghiti# max bits determined by the following formula:
27354c95a11SAlexandre Ghiti#  VA_BITS - PAGE_SHIFT - 3
27454c95a11SAlexandre Ghiticonfig ARCH_MMAP_RND_BITS_MAX
27554c95a11SAlexandre Ghiti	default 24 if 64BIT # SV39 based
27654c95a11SAlexandre Ghiti	default 17
277fbe934d6SPalmer Dabbelt
2789be84592SGuo Renconfig ARCH_MMAP_RND_COMPAT_BITS_MAX
2799be84592SGuo Ren	default 17
2809be84592SGuo Ren
281a4c3733dSChristoph Hellwig# set if we run in machine mode, cleared if we run in supervisor mode
282a4c3733dSChristoph Hellwigconfig RISCV_M_MODE
283f862bbf4SSamuel Holland	bool "Build a kernel that runs in machine mode"
284f862bbf4SSamuel Holland	depends on !MMU
285f862bbf4SSamuel Holland	default y
286f862bbf4SSamuel Holland	help
287f862bbf4SSamuel Holland	  Select this option if you want to run the kernel in M-mode,
288f862bbf4SSamuel Holland	  without the assistance of any other firmware.
289a4c3733dSChristoph Hellwig
290eded8bc6SDamien Le Moal# set if we are running in S-mode and can use SBI calls
291eded8bc6SDamien Le Moalconfig RISCV_SBI
292eded8bc6SDamien Le Moal	bool
293eded8bc6SDamien Le Moal	depends on !RISCV_M_MODE
294eded8bc6SDamien Le Moal	default y
295eded8bc6SDamien Le Moal
296fbe934d6SPalmer Dabbeltconfig MMU
2976bd33e1eSChristoph Hellwig	bool "MMU-based Paged Memory Management Support"
2986bd33e1eSChristoph Hellwig	default y
2996bd33e1eSChristoph Hellwig	help
3006bd33e1eSChristoph Hellwig	  Select if you want MMU-based virtualised addressing space
3016bd33e1eSChristoph Hellwig	  support by paged memory management. If unsure, say 'Y'.
302fbe934d6SPalmer Dabbelt
30354c5639dSAlexandre Ghiticonfig KASAN_SHADOW_OFFSET
30454c5639dSAlexandre Ghiti	hex
30554c5639dSAlexandre Ghiti	depends on KASAN_GENERIC
306f7ae0233SAlexandre Ghiti	default 0xdfffffff00000000 if 64BIT
30754c5639dSAlexandre Ghiti	default 0xffffffff if 32BIT
30854c5639dSAlexandre Ghiti
309d95f1a54SLogan Gunthorpeconfig ARCH_FLATMEM_ENABLE
3104f0e8eefSAtish Patra	def_bool !NUMA
311d95f1a54SLogan Gunthorpe
312d95f1a54SLogan Gunthorpeconfig ARCH_SPARSEMEM_ENABLE
313d95f1a54SLogan Gunthorpe	def_bool y
314aa273420SDamien Le Moal	depends on MMU
315199fc6b8SKefeng Wang	select SPARSEMEM_STATIC if 32BIT && SPARSEMEM
316a5406a7fSKefeng Wang	select SPARSEMEM_VMEMMAP_ENABLE if 64BIT
317d95f1a54SLogan Gunthorpe
318d95f1a54SLogan Gunthorpeconfig ARCH_SELECT_MEMORY_MODEL
319d95f1a54SLogan Gunthorpe	def_bool ARCH_SPARSEMEM_ENABLE
320d95f1a54SLogan Gunthorpe
32174784081SGuo Renconfig ARCH_SUPPORTS_UPROBES
32274784081SGuo Ren	def_bool y
32374784081SGuo Ren
324fbe934d6SPalmer Dabbeltconfig STACKTRACE_SUPPORT
325fbe934d6SPalmer Dabbelt	def_bool y
326fbe934d6SPalmer Dabbelt
327fbe934d6SPalmer Dabbeltconfig GENERIC_BUG
328fbe934d6SPalmer Dabbelt	def_bool y
329fbe934d6SPalmer Dabbelt	depends on BUG
330fbe934d6SPalmer Dabbelt	select GENERIC_BUG_RELATIVE_POINTERS if 64BIT
331fbe934d6SPalmer Dabbelt
332fbe934d6SPalmer Dabbeltconfig GENERIC_BUG_RELATIVE_POINTERS
333fbe934d6SPalmer Dabbelt	bool
334fbe934d6SPalmer Dabbelt
335fbe934d6SPalmer Dabbeltconfig GENERIC_CALIBRATE_DELAY
336fbe934d6SPalmer Dabbelt	def_bool y
337fbe934d6SPalmer Dabbelt
338fbe934d6SPalmer Dabbeltconfig GENERIC_CSUM
339fbe934d6SPalmer Dabbelt	def_bool y
340fbe934d6SPalmer Dabbelt
341fbe934d6SPalmer Dabbeltconfig GENERIC_HWEIGHT
342fbe934d6SPalmer Dabbelt	def_bool y
343fbe934d6SPalmer Dabbelt
344f2c17aabSAnup Patelconfig FIX_EARLYCON_MEM
3450312a3d4SAndreas Schwab	def_bool MMU
346f2c17aabSAnup Patel
3475c178472SJisheng Zhangconfig ILLEGAL_POINTER_VALUE
3485c178472SJisheng Zhang	hex
3495c178472SJisheng Zhang	default 0 if 32BIT
3505c178472SJisheng Zhang	default 0xdead000000000000 if 64BIT
3515c178472SJisheng Zhang
352fbe934d6SPalmer Dabbeltconfig PGTABLE_LEVELS
353fbe934d6SPalmer Dabbelt	int
354011f09d1SQinglin Pan	default 5 if 64BIT
355fbe934d6SPalmer Dabbelt	default 2
356fbe934d6SPalmer Dabbelt
3573c469798SGuo Renconfig LOCKDEP_SUPPORT
3583c469798SGuo Ren	def_bool y
3593c469798SGuo Ren
3601631ba12SHeiko Stuebnerconfig RISCV_DMA_NONCOHERENT
3611631ba12SHeiko Stuebner	bool
3621631ba12SHeiko Stuebner	select ARCH_HAS_DMA_PREP_COHERENT
3631631ba12SHeiko Stuebner	select ARCH_HAS_SETUP_DMA_OPS
3645f365c13SConor Dooley	select ARCH_HAS_SYNC_DMA_FOR_CPU
3655f365c13SConor Dooley	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
366f51f7a0fSJisheng Zhang	select DMA_BOUNCE_UNALIGNED_KMALLOC if SWIOTLB
3671631ba12SHeiko Stuebner
368b79f300cSLad Prabhakarconfig RISCV_NONSTANDARD_CACHE_OPS
369b79f300cSLad Prabhakar	bool
370b79f300cSLad Prabhakar	help
371b79f300cSLad Prabhakar	  This enables function pointer support for non-standard noncoherent
372b79f300cSLad Prabhakar	  systems to handle cache management.
373b79f300cSLad Prabhakar
3745ac43ab2SAndrew Jonesconfig AS_HAS_INSN
3755ac43ab2SAndrew Jones	def_bool $(as-instr,.insn r 51$(comma) 0$(comma) 0$(comma) t0$(comma) t0$(comma) zero)
3765ac43ab2SAndrew Jones
377e4bb020fSAndy Chiuconfig AS_HAS_OPTION_ARCH
378fafdea34SNathan Chancellor	# https://github.com/llvm/llvm-project/commit/9e8ed3403c191ab9c4903e8eeb8f732ff8a43cb4
379e4bb020fSAndy Chiu	def_bool y
380e4bb020fSAndy Chiu	depends on $(as-instr, .option arch$(comma) +m)
381e4bb020fSAndy Chiu
3820cbb8a32SLoys Olliviersource "arch/riscv/Kconfig.socs"
383a3d095acSAndrew Jonessource "arch/riscv/Kconfig.errata"
3840cbb8a32SLoys Ollivier
385fbe934d6SPalmer Dabbeltmenu "Platform type"
386fbe934d6SPalmer Dabbelt
38744c1e84aSPalmer Dabbeltconfig NONPORTABLE
38844c1e84aSPalmer Dabbelt	bool "Allow configurations that result in non-portable kernels"
38944c1e84aSPalmer Dabbelt	help
39044c1e84aSPalmer Dabbelt	  RISC-V kernel binaries are compatible between all known systems
39144c1e84aSPalmer Dabbelt	  whenever possible, but there are some use cases that can only be
39244c1e84aSPalmer Dabbelt	  satisfied by configurations that result in kernel binaries that are
39344c1e84aSPalmer Dabbelt	  not portable between systems.
39444c1e84aSPalmer Dabbelt
39544c1e84aSPalmer Dabbelt	  Selecting N does not guarantee kernels will be portable to all known
39644c1e84aSPalmer Dabbelt	  systems.  Selecting any of the options guarded by NONPORTABLE will
39744c1e84aSPalmer Dabbelt	  result in kernel binaries that are unlikely to be portable between
39844c1e84aSPalmer Dabbelt	  systems.
39944c1e84aSPalmer Dabbelt
40044c1e84aSPalmer Dabbelt	  If unsure, say N.
40144c1e84aSPalmer Dabbelt
402fbe934d6SPalmer Dabbeltchoice
403fbe934d6SPalmer Dabbelt	prompt "Base ISA"
404fbe934d6SPalmer Dabbelt	default ARCH_RV64I
405fbe934d6SPalmer Dabbelt	help
40686cca81aSAntony Pavlov	  This selects the base ISA that this kernel will target and must match
407fbe934d6SPalmer Dabbelt	  the target platform.
408fbe934d6SPalmer Dabbelt
409fbe934d6SPalmer Dabbeltconfig ARCH_RV32I
410fbe934d6SPalmer Dabbelt	bool "RV32I"
41144c1e84aSPalmer Dabbelt	depends on NONPORTABLE
412fbe934d6SPalmer Dabbelt	select 32BIT
413e3d59805SMatt Redfearn	select GENERIC_LIB_ASHLDI3
414e3d59805SMatt Redfearn	select GENERIC_LIB_ASHRDI3
415e3d59805SMatt Redfearn	select GENERIC_LIB_LSHRDI3
4168f79125dSZong Li	select GENERIC_LIB_UCMPDI2
417fbe934d6SPalmer Dabbelt
418fbe934d6SPalmer Dabbeltconfig ARCH_RV64I
419fbe934d6SPalmer Dabbelt	bool "RV64I"
420fbe934d6SPalmer Dabbelt	select 64BIT
421d2075895SNick Desaulniers	select ARCH_SUPPORTS_INT128 if CC_HAS_INT128
4226bd33e1eSChristoph Hellwig	select SWIOTLB if MMU
423fbe934d6SPalmer Dabbelt
424fbe934d6SPalmer Dabbeltendchoice
425fbe934d6SPalmer Dabbelt
426fbe934d6SPalmer Dabbelt# We must be able to map all physical memory into the kernel, but the compiler
427fbe934d6SPalmer Dabbelt# is still a bit more efficient when generating code if it's setup in a manner
428fbe934d6SPalmer Dabbelt# such that it can only map 2GiB of memory.
429fbe934d6SPalmer Dabbeltchoice
430fbe934d6SPalmer Dabbelt	prompt "Kernel Code Model"
431fbe934d6SPalmer Dabbelt	default CMODEL_MEDLOW if 32BIT
432fbe934d6SPalmer Dabbelt	default CMODEL_MEDANY if 64BIT
433fbe934d6SPalmer Dabbelt
434fbe934d6SPalmer Dabbelt	config CMODEL_MEDLOW
435fbe934d6SPalmer Dabbelt		bool "medium low code model"
436fbe934d6SPalmer Dabbelt	config CMODEL_MEDANY
437fbe934d6SPalmer Dabbelt		bool "medium any code model"
438fbe934d6SPalmer Dabbeltendchoice
439fbe934d6SPalmer Dabbelt
440ab1ef68eSZong Liconfig MODULE_SECTIONS
441ab1ef68eSZong Li	bool
442ab1ef68eSZong Li	select HAVE_MOD_ARCH_SPECIFIC
443ab1ef68eSZong Li
444fbe934d6SPalmer Dabbeltconfig SMP
445fbe934d6SPalmer Dabbelt	bool "Symmetric Multi-Processing"
446fbe934d6SPalmer Dabbelt	help
447fbe934d6SPalmer Dabbelt	  This enables support for systems with more than one CPU.  If
448fbe934d6SPalmer Dabbelt	  you say N here, the kernel will run on single and
449fbe934d6SPalmer Dabbelt	  multiprocessor machines, but will use only one CPU of a
450fbe934d6SPalmer Dabbelt	  multiprocessor machine. If you say Y here, the kernel will run
451fbe934d6SPalmer Dabbelt	  on many, but not all, single processor machines. On a single
452fbe934d6SPalmer Dabbelt	  processor machine, the kernel will run faster if you say N
453fbe934d6SPalmer Dabbelt	  here.
454fbe934d6SPalmer Dabbelt
455fbe934d6SPalmer Dabbelt	  If you don't know what to do here, say N.
456fbe934d6SPalmer Dabbelt
4578bf7b3b6SSong Shuaiconfig SCHED_MC
4588bf7b3b6SSong Shuai	bool "Multi-core scheduler support"
4598bf7b3b6SSong Shuai	depends on SMP
4608bf7b3b6SSong Shuai	help
4618bf7b3b6SSong Shuai	  Multi-core scheduler support improves the CPU scheduler's decision
4628bf7b3b6SSong Shuai	  making when dealing with multi-core CPU chips at a cost of slightly
4638bf7b3b6SSong Shuai	  increased overhead in some places. If unsure say N here.
4648bf7b3b6SSong Shuai
465fbe934d6SPalmer Dabbeltconfig NR_CPUS
466e623715fSAnup Patel	int "Maximum number of CPUs (2-512)"
467fbe934d6SPalmer Dabbelt	depends on SMP
4681d6b5ed4SSamuel Holland	range 2 512 if !RISCV_SBI_V01
4691d6b5ed4SSamuel Holland	range 2 32 if RISCV_SBI_V01 && 32BIT
4701d6b5ed4SSamuel Holland	range 2 64 if RISCV_SBI_V01 && 64BIT
471e623715fSAnup Patel	default "32" if 32BIT
472e623715fSAnup Patel	default "64" if 64BIT
473fbe934d6SPalmer Dabbelt
474f1e58583SAtish Patraconfig HOTPLUG_CPU
475f1e58583SAtish Patra	bool "Support for hot-pluggable CPUs"
476f1e58583SAtish Patra	depends on SMP
477f1e58583SAtish Patra	select GENERIC_IRQ_MIGRATION
478f1e58583SAtish Patra	help
479f1e58583SAtish Patra
480f1e58583SAtish Patra	  Say Y here to experiment with turning CPUs off and on.  CPUs
481f1e58583SAtish Patra	  can be controlled through /sys/devices/system/cpu.
482f1e58583SAtish Patra
483f1e58583SAtish Patra	  Say N if you want to disable CPU hotplug.
484f1e58583SAtish Patra
485fbe934d6SPalmer Dabbeltchoice
486fbe934d6SPalmer Dabbelt	prompt "CPU Tuning"
487fbe934d6SPalmer Dabbelt	default TUNE_GENERIC
488fbe934d6SPalmer Dabbelt
489fbe934d6SPalmer Dabbeltconfig TUNE_GENERIC
490fbe934d6SPalmer Dabbelt	bool "generic"
491fbe934d6SPalmer Dabbelt
492fbe934d6SPalmer Dabbeltendchoice
493fbe934d6SPalmer Dabbelt
4944f0e8eefSAtish Patra# Common NUMA Features
4954f0e8eefSAtish Patraconfig NUMA
4964f0e8eefSAtish Patra	bool "NUMA Memory Allocation and Scheduler Support"
4971adbc294SKefeng Wang	depends on SMP && MMU
4984f0e8eefSAtish Patra	select ARCH_SUPPORTS_NUMA_BALANCING
4995f365c13SConor Dooley	select GENERIC_ARCH_NUMA
5006b9f29b8SAlexandre Ghiti	select HAVE_SETUP_PER_CPU_AREA
5017ecd19cfSKefeng Wang	select NEED_PER_CPU_EMBED_FIRST_CHUNK
5026b9f29b8SAlexandre Ghiti	select NEED_PER_CPU_PAGE_FIRST_CHUNK
5035f365c13SConor Dooley	select OF_NUMA
5045f365c13SConor Dooley	select USE_PERCPU_NUMA_NODE_ID
5054f0e8eefSAtish Patra	help
5064f0e8eefSAtish Patra	  Enable NUMA (Non-Uniform Memory Access) support.
5074f0e8eefSAtish Patra
5084f0e8eefSAtish Patra	  The kernel will try to allocate memory used by a CPU on the
5094f0e8eefSAtish Patra	  local memory of the CPU and add some more NUMA awareness to the kernel.
5104f0e8eefSAtish Patra
5114f0e8eefSAtish Patraconfig NODES_SHIFT
5124f0e8eefSAtish Patra	int "Maximum NUMA Nodes (as a power of 2)"
5134f0e8eefSAtish Patra	range 1 10
5144f0e8eefSAtish Patra	default "2"
515a9ee6cf5SMike Rapoport	depends on NUMA
5164f0e8eefSAtish Patra	help
5174f0e8eefSAtish Patra	  Specify the maximum number of NUMA Nodes available on the target
5184f0e8eefSAtish Patra	  system.  Increases memory reserved to accommodate various tables.
5194f0e8eefSAtish Patra
520ab83647fSAlexandre Ghitichoice
521ab83647fSAlexandre Ghiti	prompt "RISC-V spinlock type"
522ab83647fSAlexandre Ghiti	default RISCV_COMBO_SPINLOCKS
523ab83647fSAlexandre Ghiti
524ab83647fSAlexandre Ghiticonfig RISCV_TICKET_SPINLOCKS
525ab83647fSAlexandre Ghiti	bool "Using ticket spinlock"
526ab83647fSAlexandre Ghiti
527ab83647fSAlexandre Ghiticonfig RISCV_QUEUED_SPINLOCKS
528ab83647fSAlexandre Ghiti	bool "Using queued spinlock"
529ab83647fSAlexandre Ghiti	depends on SMP && MMU && NONPORTABLE
530ab83647fSAlexandre Ghiti	select ARCH_USE_QUEUED_SPINLOCKS
531ab83647fSAlexandre Ghiti	help
532ab83647fSAlexandre Ghiti	  The queued spinlock implementation requires the forward progress
533ab83647fSAlexandre Ghiti	  guarantee of cmpxchg()/xchg() atomic operations: CAS with Zabha or
534ab83647fSAlexandre Ghiti	  LR/SC with Ziccrse provide such guarantee.
535ab83647fSAlexandre Ghiti
536ab83647fSAlexandre Ghiti	  Select this if and only if Zabha or Ziccrse is available on your
537ab83647fSAlexandre Ghiti	  platform, RISCV_QUEUED_SPINLOCKS must not be selected for platforms
538ab83647fSAlexandre Ghiti	  without one of those extensions.
539ab83647fSAlexandre Ghiti
540ab83647fSAlexandre Ghiti	  If unsure, select RISCV_COMBO_SPINLOCKS, which will use qspinlocks
541ab83647fSAlexandre Ghiti	  when supported and otherwise ticket spinlocks.
542ab83647fSAlexandre Ghiti
543ab83647fSAlexandre Ghiticonfig RISCV_COMBO_SPINLOCKS
544ab83647fSAlexandre Ghiti	bool "Using combo spinlock"
545ab83647fSAlexandre Ghiti	depends on SMP && MMU
546ab83647fSAlexandre Ghiti	select ARCH_USE_QUEUED_SPINLOCKS
547ab83647fSAlexandre Ghiti	help
548ab83647fSAlexandre Ghiti	  Embed both queued spinlock and ticket lock so that the spinlock
549ab83647fSAlexandre Ghiti	  implementation can be chosen at runtime.
550ab83647fSAlexandre Ghiti
551ab83647fSAlexandre Ghitiendchoice
552ab83647fSAlexandre Ghiti
553e64f737aSHeiko Stuebnerconfig RISCV_ALTERNATIVE
554e64f737aSHeiko Stuebner	bool
555e64f737aSHeiko Stuebner	depends on !XIP_KERNEL
556e64f737aSHeiko Stuebner	help
557e64f737aSHeiko Stuebner	  This Kconfig allows the kernel to automatically patch the
558ff19a8deSAndrew Jones	  erratum or cpufeature required by the execution platform at run
559ff19a8deSAndrew Jones	  time. The code patching overhead is minimal, as it's only done
560ff19a8deSAndrew Jones	  once at boot and once on each module load.
561e64f737aSHeiko Stuebner
562a35707c3SHeiko Stuebnerconfig RISCV_ALTERNATIVE_EARLY
563a35707c3SHeiko Stuebner	bool
564a35707c3SHeiko Stuebner	depends on RISCV_ALTERNATIVE
565a35707c3SHeiko Stuebner	help
566a35707c3SHeiko Stuebner	  Allows early patching of the kernel for special errata
567a35707c3SHeiko Stuebner
568fbe934d6SPalmer Dabbeltconfig RISCV_ISA_C
569fbe934d6SPalmer Dabbelt	bool "Emit compressed instructions when building Linux"
570fbe934d6SPalmer Dabbelt	default y
571fbe934d6SPalmer Dabbelt	help
572fbe934d6SPalmer Dabbelt	  Adds "C" to the ISA subsets that the toolchain is allowed to emit
573fbe934d6SPalmer Dabbelt	  when building Linux, which results in compressed instructions in the
5746216182fSConor Dooley	  Linux binary. This option produces a kernel that will not run on
5756216182fSConor Dooley	  systems that do not support compressed instructions.
576fbe934d6SPalmer Dabbelt
577fbe934d6SPalmer Dabbelt	  If you don't know what to do here, say Y.
578fbe934d6SPalmer Dabbelt
57909d6775fSSamuel Hollandconfig RISCV_ISA_SUPM
58009d6775fSSamuel Holland	bool "Supm extension for userspace pointer masking"
58109d6775fSSamuel Holland	depends on 64BIT
58209d6775fSSamuel Holland	default y
58309d6775fSSamuel Holland	help
58409d6775fSSamuel Holland	  Add support for pointer masking in userspace (Supm) when the
58509d6775fSSamuel Holland	  underlying hardware extension (Smnpm or Ssnpm) is detected at boot.
58609d6775fSSamuel Holland
58709d6775fSSamuel Holland	  If this option is disabled, userspace will be unable to use
58809d6775fSSamuel Holland	  the prctl(PR_{SET,GET}_TAGGED_ADDR_CTRL) API.
58909d6775fSSamuel Holland
59023ad288aSQinglin Panconfig RISCV_ISA_SVNAPOT
5915464912cSConor Dooley	bool "Svnapot extension support for supervisor mode NAPOT pages"
592ff689fd2SHeiko Stuebner	depends on 64BIT && MMU
5931ee7fc3fSConor Dooley	depends on RISCV_ALTERNATIVE
594ff689fd2SHeiko Stuebner	default y
595ff689fd2SHeiko Stuebner	help
5966216182fSConor Dooley	  Enable support for the Svnapot ISA-extension when it is detected
5976216182fSConor Dooley	  at boot.
59823ad288aSQinglin Pan
5995464912cSConor Dooley	  The Svnapot extension is used to mark contiguous PTEs as a range
60023ad288aSQinglin Pan	  of contiguous virtual-to-physical translations for a naturally
60123ad288aSQinglin Pan	  aligned power-of-2 (NAPOT) granularity larger than the base 4KB page
60223ad288aSQinglin Pan	  size. When HUGETLBFS is also selected this option unconditionally
60323ad288aSQinglin Pan	  allocates some memory for each NAPOT page size supported by the kernel.
60423ad288aSQinglin Pan	  When optimizing for low memory consumption and for platforms without
6055464912cSConor Dooley	  the Svnapot extension, it may be better to say N here.
60623ad288aSQinglin Pan
60723ad288aSQinglin Pan	  If you don't know what to do here, say Y.
60823ad288aSQinglin Pan
609ff689fd2SHeiko Stuebnerconfig RISCV_ISA_SVPBMT
6105464912cSConor Dooley	bool "Svpbmt extension support for supervisor mode page-based memory types"
611ff689fd2SHeiko Stuebner	depends on 64BIT && MMU
612ff689fd2SHeiko Stuebner	depends on RISCV_ALTERNATIVE
613ff689fd2SHeiko Stuebner	default y
614ff689fd2SHeiko Stuebner	help
6156216182fSConor Dooley	   Add support for the Svpbmt ISA-extension (Supervisor-mode:
6166216182fSConor Dooley	   page-based memory types) in the kernel when it is detected at boot.
617924cbb8cSHeiko Stuebner
618924cbb8cSHeiko Stuebner	   The memory type for a page contains a combination of attributes
619924cbb8cSHeiko Stuebner	   that indicate the cacheability, idempotency, and ordering
620924cbb8cSHeiko Stuebner	   properties for access to that page.
621ff689fd2SHeiko Stuebner
6225464912cSConor Dooley	   The Svpbmt extension is only available on 64-bit cpus.
623ff689fd2SHeiko Stuebner
624ff689fd2SHeiko Stuebner	   If you don't know what to do here, say Y.
625ff689fd2SHeiko Stuebner
626fa8e7cceSGuo Renconfig TOOLCHAIN_HAS_V
627fa8e7cceSGuo Ren	bool
628fa8e7cceSGuo Ren	default y
6295ba7a75aSAnton Blanchard	depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64imv)
6305ba7a75aSAnton Blanchard	depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32imv)
631fa8e7cceSGuo Ren	depends on LLD_VERSION >= 140000 || LD_VERSION >= 23800
632fa8e7cceSGuo Ren	depends on AS_HAS_OPTION_ARCH
633fa8e7cceSGuo Ren
634fa8e7cceSGuo Renconfig RISCV_ISA_V
6356216182fSConor Dooley	bool "Vector extension support"
636fa8e7cceSGuo Ren	depends on TOOLCHAIN_HAS_V
637fa8e7cceSGuo Ren	depends on FPU
638fa8e7cceSGuo Ren	select DYNAMIC_SIGFRAME
639fa8e7cceSGuo Ren	default y
640fa8e7cceSGuo Ren	help
6416216182fSConor Dooley	  Add support for the Vector extension when it is detected at boot.
6426216182fSConor Dooley	  When this option is disabled, neither the kernel nor userspace may
6436216182fSConor Dooley	  use vector procedures.
644fa8e7cceSGuo Ren
645fa8e7cceSGuo Ren	  If you don't know what to do here, say Y.
646fa8e7cceSGuo Ren
647fa8e7cceSGuo Renconfig RISCV_ISA_V_DEFAULT_ENABLE
648fa8e7cceSGuo Ren	bool "Enable userspace Vector by default"
649fa8e7cceSGuo Ren	depends on RISCV_ISA_V
650fa8e7cceSGuo Ren	default y
651fa8e7cceSGuo Ren	help
652fa8e7cceSGuo Ren	  Say Y here if you want to enable Vector in userspace by default.
653fa8e7cceSGuo Ren	  Otherwise, userspace has to make explicit prctl() call to enable
654fa8e7cceSGuo Ren	  Vector, or enable it via the sysctl interface.
655fa8e7cceSGuo Ren
656fa8e7cceSGuo Ren	  If you don't know what to do here, say Y.
657fa8e7cceSGuo Ren
658c2a658d4SAndy Chiuconfig RISCV_ISA_V_UCOPY_THRESHOLD
659c2a658d4SAndy Chiu	int "Threshold size for vectorized user copies"
660c2a658d4SAndy Chiu	depends on RISCV_ISA_V
661c2a658d4SAndy Chiu	default 768
662c2a658d4SAndy Chiu	help
663c2a658d4SAndy Chiu	  Prefer using vectorized copy_to_user()/copy_from_user() when the
664c2a658d4SAndy Chiu	  workload size exceeds this value.
665c2a658d4SAndy Chiu
6662080ff94SAndy Chiuconfig RISCV_ISA_V_PREEMPTIVE
6672080ff94SAndy Chiu	bool "Run kernel-mode Vector with kernel preemption"
6682080ff94SAndy Chiu	depends on PREEMPTION
6692080ff94SAndy Chiu	depends on RISCV_ISA_V
6702080ff94SAndy Chiu	default y
6712080ff94SAndy Chiu	help
6722080ff94SAndy Chiu	  Usually, in-kernel SIMD routines are run with preemption disabled.
673c39d5375SMiquel Sabaté Solà	  Functions which invoke long running SIMD thus must yield the core's
6742080ff94SAndy Chiu	  vector unit to prevent blocking other tasks for too long.
6752080ff94SAndy Chiu
676c39d5375SMiquel Sabaté Solà	  This config allows the kernel to run SIMD without explicitly disabling
677c39d5375SMiquel Sabaté Solà	  preemption. Enabling this config will result in higher memory consumption
678c39d5375SMiquel Sabaté Solà	  due to the allocation of per-task's kernel Vector context.
6792080ff94SAndy Chiu
680b8ddb0dfSChristoph Müllnerconfig RISCV_ISA_ZAWRS
681b8ddb0dfSChristoph Müllner	bool "Zawrs extension support for more efficient busy waiting"
682b8ddb0dfSChristoph Müllner	depends on RISCV_ALTERNATIVE
683b8ddb0dfSChristoph Müllner	default y
684b8ddb0dfSChristoph Müllner	help
685b8ddb0dfSChristoph Müllner	  The Zawrs extension defines instructions to be used in polling loops
686b8ddb0dfSChristoph Müllner	  which allow a hart to enter a low-power state or to trap to the
687b8ddb0dfSChristoph Müllner	  hypervisor while waiting on a store to a memory location. Enable the
688b8ddb0dfSChristoph Müllner	  use of these instructions in the kernel when the Zawrs extension is
689b8ddb0dfSChristoph Müllner	  detected at boot.
690b8ddb0dfSChristoph Müllner
6911658ef43SAlexandre Ghiticonfig TOOLCHAIN_HAS_ZABHA
6921658ef43SAlexandre Ghiti	bool
6931658ef43SAlexandre Ghiti	default y
6941658ef43SAlexandre Ghiti	depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64ima_zabha)
6951658ef43SAlexandre Ghiti	depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32ima_zabha)
6961658ef43SAlexandre Ghiti	depends on AS_HAS_OPTION_ARCH
6971658ef43SAlexandre Ghiti
6981658ef43SAlexandre Ghiticonfig RISCV_ISA_ZABHA
6991658ef43SAlexandre Ghiti	bool "Zabha extension support for atomic byte/halfword operations"
7001658ef43SAlexandre Ghiti	depends on TOOLCHAIN_HAS_ZABHA
7011658ef43SAlexandre Ghiti	depends on RISCV_ALTERNATIVE
7021658ef43SAlexandre Ghiti	default y
7031658ef43SAlexandre Ghiti	help
7041658ef43SAlexandre Ghiti	  Enable the use of the Zabha ISA-extension to implement kernel
7051658ef43SAlexandre Ghiti	  byte/halfword atomic memory operations when it is detected at boot.
7061658ef43SAlexandre Ghiti
7071658ef43SAlexandre Ghiti	  If you don't know what to do here, say Y.
7081658ef43SAlexandre Ghiti
70938acdee3SAlexandre Ghiticonfig TOOLCHAIN_HAS_ZACAS
71038acdee3SAlexandre Ghiti	bool
71138acdee3SAlexandre Ghiti	default y
71238acdee3SAlexandre Ghiti	depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64ima_zacas)
71338acdee3SAlexandre Ghiti	depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32ima_zacas)
71438acdee3SAlexandre Ghiti	depends on AS_HAS_OPTION_ARCH
71538acdee3SAlexandre Ghiti
71638acdee3SAlexandre Ghiticonfig RISCV_ISA_ZACAS
71738acdee3SAlexandre Ghiti	bool "Zacas extension support for atomic CAS"
71838acdee3SAlexandre Ghiti	depends on TOOLCHAIN_HAS_ZACAS
71938acdee3SAlexandre Ghiti	depends on RISCV_ALTERNATIVE
72038acdee3SAlexandre Ghiti	default y
72138acdee3SAlexandre Ghiti	help
72238acdee3SAlexandre Ghiti	  Enable the use of the Zacas ISA-extension to implement kernel atomic
72338acdee3SAlexandre Ghiti	  cmpxchg operations when it is detected at boot.
72438acdee3SAlexandre Ghiti
725b8ddb0dfSChristoph Müllner	  If you don't know what to do here, say Y.
726b8ddb0dfSChristoph Müllner
727b6fcdb19SHeiko Stuebnerconfig TOOLCHAIN_HAS_ZBB
7281631ba12SHeiko Stuebner	bool
729b8c86872SConor Dooley	default y
730b6fcdb19SHeiko Stuebner	depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64ima_zbb)
731b6fcdb19SHeiko Stuebner	depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32ima_zbb)
732b6fcdb19SHeiko Stuebner	depends on LLD_VERSION >= 150000 || LD_VERSION >= 23900
733e4bb020fSAndy Chiu	depends on AS_HAS_OPTION_ARCH
734b6fcdb19SHeiko Stuebner
73534ca4ec6SEric Biggers# This symbol indicates that the toolchain supports all v1.0 vector crypto
73634ca4ec6SEric Biggers# extensions, including Zvk*, Zvbb, and Zvbc.  LLVM added all of these at once.
73734ca4ec6SEric Biggers# binutils added all except Zvkb, then added Zvkb.  So we just check for Zvkb.
73834ca4ec6SEric Biggersconfig TOOLCHAIN_HAS_VECTOR_CRYPTO
739886516faSEric Biggers	def_bool $(as-instr, .option arch$(comma) +v$(comma) +zvkb)
74034ca4ec6SEric Biggers	depends on AS_HAS_OPTION_ARCH
74134ca4ec6SEric Biggers
7428a2f20acSAlexandre Ghiticonfig TOOLCHAIN_HAS_ZBA
7438a2f20acSAlexandre Ghiti	bool
7448a2f20acSAlexandre Ghiti	default y
7458a2f20acSAlexandre Ghiti	depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64ima_zba)
7468a2f20acSAlexandre Ghiti	depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32ima_zba)
7478a2f20acSAlexandre Ghiti	depends on LLD_VERSION >= 150000 || LD_VERSION >= 23900
7488a2f20acSAlexandre Ghiti	depends on AS_HAS_OPTION_ARCH
7498a2f20acSAlexandre Ghiti
750c12603e7SXiao Wangconfig RISCV_ISA_ZBA
751c12603e7SXiao Wang	bool "Zba extension support for bit manipulation instructions"
752c12603e7SXiao Wang	default y
753c12603e7SXiao Wang	help
754c12603e7SXiao Wang	   Add support for enabling optimisations in the kernel when the Zba
755c12603e7SXiao Wang	   extension is detected at boot.
756c12603e7SXiao Wang
757c12603e7SXiao Wang	   The Zba extension provides instructions to accelerate the generation
758c12603e7SXiao Wang	   of addresses that index into arrays of basic data types.
759c12603e7SXiao Wang
760c12603e7SXiao Wang	   If you don't know what to do here, say Y.
761c12603e7SXiao Wang
762b6fcdb19SHeiko Stuebnerconfig RISCV_ISA_ZBB
763b6fcdb19SHeiko Stuebner	bool "Zbb extension support for bit manipulation instructions"
7641ee7fc3fSConor Dooley	depends on RISCV_ALTERNATIVE
765b6fcdb19SHeiko Stuebner	default y
766b6fcdb19SHeiko Stuebner	help
7676216182fSConor Dooley	   Add support for enabling optimisations in the kernel when the
7689343aabaSConor Dooley	   Zbb extension is detected at boot. Some optimisations may
7699343aabaSConor Dooley	   additionally depend on toolchain support for Zbb.
770b6fcdb19SHeiko Stuebner
771b6fcdb19SHeiko Stuebner	   The Zbb extension provides instructions to accelerate a number
772b6fcdb19SHeiko Stuebner	   of bit-specific operations (count bit population, sign extending,
773b6fcdb19SHeiko Stuebner	   bitrotation, etc).
774b6fcdb19SHeiko Stuebner
775b6fcdb19SHeiko Stuebner	   If you don't know what to do here, say Y.
7761631ba12SHeiko Stuebner
777a43fe27dSXiao Wangconfig TOOLCHAIN_HAS_ZBC
778a43fe27dSXiao Wang	bool
779a43fe27dSXiao Wang	default y
780a43fe27dSXiao Wang	depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64ima_zbc)
781a43fe27dSXiao Wang	depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32ima_zbc)
782a43fe27dSXiao Wang	depends on LLD_VERSION >= 150000 || LD_VERSION >= 23900
783a43fe27dSXiao Wang	depends on AS_HAS_OPTION_ARCH
784a43fe27dSXiao Wang
785a43fe27dSXiao Wangconfig RISCV_ISA_ZBC
786a43fe27dSXiao Wang	bool "Zbc extension support for carry-less multiplication instructions"
787a43fe27dSXiao Wang	depends on TOOLCHAIN_HAS_ZBC
788a43fe27dSXiao Wang	depends on MMU
789a43fe27dSXiao Wang	depends on RISCV_ALTERNATIVE
790a43fe27dSXiao Wang	default y
791a43fe27dSXiao Wang	help
792a43fe27dSXiao Wang	   Adds support to dynamically detect the presence of the Zbc
793a43fe27dSXiao Wang	   extension (carry-less multiplication) and enable its usage.
794a43fe27dSXiao Wang
795a43fe27dSXiao Wang	   The Zbc extension could accelerate CRC (cyclic redundancy check)
796a43fe27dSXiao Wang	   calculations.
797a43fe27dSXiao Wang
798a43fe27dSXiao Wang	   If you don't know what to do here, say Y.
799a43fe27dSXiao Wang
800a44fb572SCharlie Jenkinsconfig TOOLCHAIN_HAS_ZBKB
801a44fb572SCharlie Jenkins	bool
802a44fb572SCharlie Jenkins	default y
803a44fb572SCharlie Jenkins	depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64ima_zbkb)
804a44fb572SCharlie Jenkins	depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32ima_zbkb)
805a44fb572SCharlie Jenkins	depends on LLD_VERSION >= 150000 || LD_VERSION >= 23900
806a44fb572SCharlie Jenkins	depends on AS_HAS_OPTION_ARCH
807a44fb572SCharlie Jenkins
808a44fb572SCharlie Jenkinsconfig RISCV_ISA_ZBKB
809a44fb572SCharlie Jenkins	bool "Zbkb extension support for bit manipulation instructions"
810a44fb572SCharlie Jenkins	depends on TOOLCHAIN_HAS_ZBKB
811a44fb572SCharlie Jenkins	depends on RISCV_ALTERNATIVE
812a44fb572SCharlie Jenkins	default y
813a44fb572SCharlie Jenkins	help
814a44fb572SCharlie Jenkins	   Adds support to dynamically detect the presence of the ZBKB
815a44fb572SCharlie Jenkins	   extension (bit manipulation for cryptography) and enable its usage.
816a44fb572SCharlie Jenkins
817a44fb572SCharlie Jenkins	   The Zbkb extension provides instructions to accelerate a number
818a44fb572SCharlie Jenkins	   of common cryptography operations (pack, zip, etc).
819a44fb572SCharlie Jenkins
820a44fb572SCharlie Jenkins	   If you don't know what to do here, say Y.
821a44fb572SCharlie Jenkins
8221631ba12SHeiko Stuebnerconfig RISCV_ISA_ZICBOM
8231631ba12SHeiko Stuebner	bool "Zicbom extension support for non-coherent DMA operation"
8241ee7fc3fSConor Dooley	depends on MMU
8251ee7fc3fSConor Dooley	depends on RISCV_ALTERNATIVE
8261631ba12SHeiko Stuebner	default y
8275f365c13SConor Dooley	select RISCV_DMA_NONCOHERENT
828381cae16SChristoph Hellwig	select DMA_DIRECT_REMAP
8291631ba12SHeiko Stuebner	help
8306216182fSConor Dooley	   Add support for the Zicbom extension (Cache Block Management
8316216182fSConor Dooley	   Operations) and enable its use in the kernel when it is detected
8326216182fSConor Dooley	   at boot.
8331631ba12SHeiko Stuebner
8341631ba12SHeiko Stuebner	   The Zicbom extension can be used to handle for example
8351631ba12SHeiko Stuebner	   non-coherent DMA support on devices that need it.
8361631ba12SHeiko Stuebner
8371631ba12SHeiko Stuebner	   If you don't know what to do here, say Y.
8381631ba12SHeiko Stuebner
839ab0f7746SAndrew Jonesconfig RISCV_ISA_ZICBOZ
840ab0f7746SAndrew Jones	bool "Zicboz extension support for faster zeroing of memory"
841d34a6b71SConor Dooley	depends on RISCV_ALTERNATIVE
842ab0f7746SAndrew Jones	default y
843ab0f7746SAndrew Jones	help
8445464912cSConor Dooley	   Enable the use of the Zicboz extension (cbo.zero instruction)
8456216182fSConor Dooley	   in the kernel when it is detected at boot.
846ab0f7746SAndrew Jones
847ab0f7746SAndrew Jones	   The Zicboz extension is used for faster zeroing of memory.
848ab0f7746SAndrew Jones
849ab0f7746SAndrew Jones	   If you don't know what to do here, say Y.
850ab0f7746SAndrew Jones
8518d496b5aSAlexandre Ghiticonfig RISCV_ISA_ZICBOP
8528d496b5aSAlexandre Ghiti	bool "Zicbop extension support for cache block prefetch"
8538d496b5aSAlexandre Ghiti	depends on MMU
8548d496b5aSAlexandre Ghiti	depends on RISCV_ALTERNATIVE
8558d496b5aSAlexandre Ghiti	default y
8568d496b5aSAlexandre Ghiti	help
8578d496b5aSAlexandre Ghiti	  Adds support to dynamically detect the presence of the ZICBOP
8588d496b5aSAlexandre Ghiti	  extension (Cache Block Prefetch Operations) and enable its
8598d496b5aSAlexandre Ghiti	  usage.
8608d496b5aSAlexandre Ghiti
8618d496b5aSAlexandre Ghiti	  The Zicbop extension can be used to prefetch cache blocks for
8628d496b5aSAlexandre Ghiti	  read/write fetch.
8638d496b5aSAlexandre Ghiti
8648d496b5aSAlexandre Ghiti	  If you don't know what to do here, say Y.
8658d496b5aSAlexandre Ghiti
866e89c2e81SNathan Chancellorconfig TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI
867e89c2e81SNathan Chancellor	def_bool y
868e89c2e81SNathan Chancellor	# https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=aed44286efa8ae8717a77d94b51ac3614e2ca6dc
869ca09f772SMingzheng Xing	# https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=98416dbb0a62579d4a7a4a76bab51b5b52fec2cd
870ca09f772SMingzheng Xing	depends on AS_IS_GNU && AS_VERSION >= 23600
871e89c2e81SNathan Chancellor	help
872ca09f772SMingzheng Xing	  Binutils-2.38 and GCC-12.1.0 bumped the default ISA spec to the newer
873ca09f772SMingzheng Xing	  20191213 version, which moves some instructions from the I extension to
874ca09f772SMingzheng Xing	  the Zicsr and Zifencei extensions. This requires explicitly specifying
875ca09f772SMingzheng Xing	  Zicsr and Zifencei when binutils >= 2.38 or GCC >= 12.1.0. Zicsr
876ca09f772SMingzheng Xing	  and Zifencei are supported in binutils from version 2.36 onwards.
877ca09f772SMingzheng Xing	  To make life easier, and avoid forcing toolchains that default to a
878ca09f772SMingzheng Xing	  newer ISA spec to version 2.2, relax the check to binutils >= 2.36.
879ef21fa7cSMingzheng Xing	  For clang < 17 or GCC < 11.3.0, for which this is not possible or need
880ef21fa7cSMingzheng Xing	  special treatment, this is dealt with in TOOLCHAIN_NEEDS_OLD_ISA_SPEC.
881e89c2e81SNathan Chancellor
882e89c2e81SNathan Chancellorconfig TOOLCHAIN_NEEDS_OLD_ISA_SPEC
883e89c2e81SNathan Chancellor	def_bool y
884e89c2e81SNathan Chancellor	depends on TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI
885e89c2e81SNathan Chancellor	# https://github.com/llvm/llvm-project/commit/22e199e6afb1263c943c0c0d4498694e15bf8a16
886ef21fa7cSMingzheng Xing	# https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=d29f5d6ab513c52fd872f532c492e35ae9fd6671
887ef21fa7cSMingzheng Xing	depends on (CC_IS_CLANG && CLANG_VERSION < 170000) || (CC_IS_GCC && GCC_VERSION < 110300)
888e89c2e81SNathan Chancellor	help
889ca09f772SMingzheng Xing	  Certain versions of clang and GCC do not support zicsr and zifencei via
890ca09f772SMingzheng Xing	  -march. This option causes an older ISA spec compatible with these older
891ca09f772SMingzheng Xing	  versions of clang and GCC to be passed to GAS, which has the same result
892ca09f772SMingzheng Xing	  as passing zicsr and zifencei to -march.
893e89c2e81SNathan Chancellor
8949671f706SAlan Kaoconfig FPU
8959671f706SAlan Kao	bool "FPU support"
8969671f706SAlan Kao	default y
8979671f706SAlan Kao	help
8986216182fSConor Dooley	  Add support for floating point operations when an FPU is detected at
8996216182fSConor Dooley	  boot. When this option is disabled, neither the kernel nor userspace
9006216182fSConor Dooley	  may use the floating point unit.
9019671f706SAlan Kao
9029671f706SAlan Kao	  If you don't know what to do here, say Y.
9039671f706SAlan Kao
904163e76ccSGuo Renconfig IRQ_STACKS
905dd69d07aSGuo Ren	bool "Independent irq & softirq stacks" if EXPERT
906163e76ccSGuo Ren	default y
907163e76ccSGuo Ren	select HAVE_IRQ_EXIT_ON_IRQ_STACK
908dd69d07aSGuo Ren	select HAVE_SOFTIRQ_ON_OWN_STACK
909163e76ccSGuo Ren	help
910dd69d07aSGuo Ren	  Add independent irq & softirq stacks for percpu to prevent kernel stack
911dd69d07aSGuo Ren	  overflows. We may save some memory footprint by disabling IRQ_STACKS.
912163e76ccSGuo Ren
913a7555f6bSGuo Renconfig THREAD_SIZE_ORDER
914a7555f6bSGuo Ren	int "Kernel stack size (in power-of-two numbers of page size)" if VMAP_STACK && EXPERT
915a7555f6bSGuo Ren	range 0 4
916cfb10de1SAlexandre Ghiti	default 1 if 32BIT
917a7555f6bSGuo Ren	default 2
918a7555f6bSGuo Ren	help
919a7555f6bSGuo Ren	  Specify the Pages of thread stack size (from 4KB to 64KB), which also
920a7555f6bSGuo Ren	  affects irq stack size, which is equal to thread stack size.
921a7555f6bSGuo Ren
9227c832321SClément Légerconfig RISCV_MISALIGNED
923f413aae9SCharlie Jenkins	bool
924d1703dc7SJesse Taube	help
925d1703dc7SJesse Taube	  Embed support for detecting and emulating misaligned
926d1703dc7SJesse Taube	  scalar or vector loads and stores.
927d1703dc7SJesse Taube
928c05a62c9SJesse Taubeconfig RISCV_SCALAR_MISALIGNED
9297c832321SClément Léger	bool
930d1703dc7SJesse Taube	select RISCV_MISALIGNED
931bc38f613SClément Léger	select SYSCTL_ARCH_UNALIGN_ALLOW
9327c832321SClément Léger	help
933f413aae9SCharlie Jenkins	  Embed support for emulating misaligned loads and stores.
934f413aae9SCharlie Jenkins
935d1703dc7SJesse Taubeconfig RISCV_VECTOR_MISALIGNED
936d1703dc7SJesse Taube	bool
937d1703dc7SJesse Taube	select RISCV_MISALIGNED
938d1703dc7SJesse Taube	depends on RISCV_ISA_V
939d1703dc7SJesse Taube	help
940d1703dc7SJesse Taube	  Enable detecting support for vector misaligned loads and stores.
941d1703dc7SJesse Taube
942f413aae9SCharlie Jenkinschoice
943f413aae9SCharlie Jenkins	prompt "Unaligned Accesses Support"
944f413aae9SCharlie Jenkins	default RISCV_PROBE_UNALIGNED_ACCESS
945f413aae9SCharlie Jenkins	help
946f413aae9SCharlie Jenkins	  This determines the level of support for unaligned accesses. This
947f413aae9SCharlie Jenkins	  information is used by the kernel to perform optimizations. It is also
948f413aae9SCharlie Jenkins	  exposed to user space via the hwprobe syscall. The hardware will be
949f413aae9SCharlie Jenkins	  probed at boot by default.
950f413aae9SCharlie Jenkins
951f413aae9SCharlie Jenkinsconfig RISCV_PROBE_UNALIGNED_ACCESS
952f413aae9SCharlie Jenkins	bool "Probe for hardware unaligned access support"
953c05a62c9SJesse Taube	select RISCV_SCALAR_MISALIGNED
954f413aae9SCharlie Jenkins	help
955f413aae9SCharlie Jenkins	  During boot, the kernel will run a series of tests to determine the
956f413aae9SCharlie Jenkins	  speed of unaligned accesses. This probing will dynamically determine
957f413aae9SCharlie Jenkins	  the speed of unaligned accesses on the underlying system. If unaligned
958f413aae9SCharlie Jenkins	  memory accesses trap into the kernel as they are not supported by the
959f413aae9SCharlie Jenkins	  system, the kernel will emulate the unaligned accesses to preserve the
960f413aae9SCharlie Jenkins	  UABI.
961f413aae9SCharlie Jenkins
962f413aae9SCharlie Jenkinsconfig RISCV_EMULATED_UNALIGNED_ACCESS
963f413aae9SCharlie Jenkins	bool "Emulate unaligned access where system support is missing"
964c05a62c9SJesse Taube	select RISCV_SCALAR_MISALIGNED
965f413aae9SCharlie Jenkins	help
966f413aae9SCharlie Jenkins	  If unaligned memory accesses trap into the kernel as they are not
967f413aae9SCharlie Jenkins	  supported by the system, the kernel will emulate the unaligned
968f413aae9SCharlie Jenkins	  accesses to preserve the UABI. When the underlying system does support
969f413aae9SCharlie Jenkins	  unaligned accesses, the unaligned accesses are assumed to be slow.
970f413aae9SCharlie Jenkins
971f413aae9SCharlie Jenkinsconfig RISCV_SLOW_UNALIGNED_ACCESS
972f413aae9SCharlie Jenkins	bool "Assume the system supports slow unaligned memory accesses"
973f413aae9SCharlie Jenkins	depends on NONPORTABLE
974f413aae9SCharlie Jenkins	help
975f413aae9SCharlie Jenkins	  Assume that the system supports slow unaligned memory accesses. The
976f413aae9SCharlie Jenkins	  kernel and userspace programs may not be able to run at all on systems
977f413aae9SCharlie Jenkins	  that do not support unaligned memory accesses.
9787c832321SClément Léger
979b6da6cbeSJisheng Zhangconfig RISCV_EFFICIENT_UNALIGNED_ACCESS
980f413aae9SCharlie Jenkins	bool "Assume the system supports fast unaligned memory accesses"
981b6da6cbeSJisheng Zhang	depends on NONPORTABLE
982d0fdc20bSJisheng Zhang	select DCACHE_WORD_ACCESS if MMU
983b6da6cbeSJisheng Zhang	select HAVE_EFFICIENT_UNALIGNED_ACCESS
984b6da6cbeSJisheng Zhang	help
985f413aae9SCharlie Jenkins	  Assume that the system supports fast unaligned memory accesses. When
986f413aae9SCharlie Jenkins	  enabled, this option improves the performance of the kernel on such
987f413aae9SCharlie Jenkins	  systems. However, the kernel and userspace programs will run much more
988f413aae9SCharlie Jenkins	  slowly, or will not be able to run at all, on systems that do not
989f413aae9SCharlie Jenkins	  support efficient unaligned memory accesses.
990b6da6cbeSJisheng Zhang
991f413aae9SCharlie Jenkinsendchoice
992b6da6cbeSJisheng Zhang
993d1703dc7SJesse Taubechoice
994d1703dc7SJesse Taube	prompt "Vector unaligned Accesses Support"
995d1703dc7SJesse Taube	depends on RISCV_ISA_V
996d1703dc7SJesse Taube	default RISCV_PROBE_VECTOR_UNALIGNED_ACCESS
997d1703dc7SJesse Taube	help
998d1703dc7SJesse Taube	  This determines the level of support for vector unaligned accesses. This
999d1703dc7SJesse Taube	  information is used by the kernel to perform optimizations. It is also
1000d1703dc7SJesse Taube	  exposed to user space via the hwprobe syscall. The hardware will be
1001d1703dc7SJesse Taube	  probed at boot by default.
1002d1703dc7SJesse Taube
1003d1703dc7SJesse Taubeconfig RISCV_PROBE_VECTOR_UNALIGNED_ACCESS
1004d1703dc7SJesse Taube	bool "Probe speed of vector unaligned accesses"
1005d1703dc7SJesse Taube	select RISCV_VECTOR_MISALIGNED
1006d1703dc7SJesse Taube	depends on RISCV_ISA_V
1007d1703dc7SJesse Taube	help
1008d1703dc7SJesse Taube	  During boot, the kernel will run a series of tests to determine the
1009d1703dc7SJesse Taube	  speed of vector unaligned accesses if they are supported. This probing
1010d1703dc7SJesse Taube	  will dynamically determine the speed of vector unaligned accesses on
1011d1703dc7SJesse Taube	  the underlying system if they are supported.
1012d1703dc7SJesse Taube
1013e7c9d66eSJesse Taubeconfig RISCV_SLOW_VECTOR_UNALIGNED_ACCESS
1014e7c9d66eSJesse Taube	bool "Assume the system supports slow vector unaligned memory accesses"
1015e7c9d66eSJesse Taube	depends on NONPORTABLE
1016e7c9d66eSJesse Taube	help
1017e7c9d66eSJesse Taube	  Assume that the system supports slow vector unaligned memory accesses. The
1018e7c9d66eSJesse Taube	  kernel and userspace programs may not be able to run at all on systems
1019e7c9d66eSJesse Taube	  that do not support unaligned memory accesses.
1020e7c9d66eSJesse Taube
1021e7c9d66eSJesse Taubeconfig RISCV_EFFICIENT_VECTOR_UNALIGNED_ACCESS
1022e7c9d66eSJesse Taube	bool "Assume the system supports fast vector unaligned memory accesses"
1023e7c9d66eSJesse Taube	depends on NONPORTABLE
1024e7c9d66eSJesse Taube	help
1025e7c9d66eSJesse Taube	  Assume that the system supports fast vector unaligned memory accesses. When
1026e7c9d66eSJesse Taube	  enabled, this option improves the performance of the kernel on such
1027e7c9d66eSJesse Taube	  systems. However, the kernel and userspace programs will run much more
1028e7c9d66eSJesse Taube	  slowly, or will not be able to run at all, on systems that do not
1029e7c9d66eSJesse Taube	  support efficient unaligned memory accesses.
1030e7c9d66eSJesse Taube
1031d1703dc7SJesse Taubeendchoice
1032d1703dc7SJesse Taube
103323c996fcSCharlie Jenkinssource "arch/riscv/Kconfig.vendor"
103423c996fcSCharlie Jenkins
10352f66a3d0SJuerg Haefligerendmenu # "Platform type"
1036fbe934d6SPalmer Dabbelt
1037aef53f97SNick Kossifidismenu "Kernel features"
1038fbe934d6SPalmer Dabbelt
1039fbe934d6SPalmer Dabbeltsource "kernel/Kconfig.hz"
1040fbe934d6SPalmer Dabbelt
1041efca1398SAtish Patraconfig RISCV_SBI_V01
1042efca1398SAtish Patra	bool "SBI v0.1 support"
1043efca1398SAtish Patra	depends on RISCV_SBI
1044efca1398SAtish Patra	help
1045efca1398SAtish Patra	  This config allows kernel to use SBI v0.1 APIs. This will be
1046efca1398SAtish Patra	  deprecated in future once legacy M-mode software are no longer in use.
1047fba8a867SNick Kossifidis
10482ffc48fcSAtish Patraconfig RISCV_BOOT_SPINWAIT
10492ffc48fcSAtish Patra	bool "Spinwait booting method"
10502ffc48fcSAtish Patra	depends on SMP
105177d707a3SPalmer Dabbelt	default y if RISCV_SBI_V01 || RISCV_M_MODE
10522ffc48fcSAtish Patra	help
10532ffc48fcSAtish Patra	  This enables support for booting Linux via spinwait method. In the
10542ffc48fcSAtish Patra	  spinwait method, all cores randomly jump to Linux. One of the cores
10552ffc48fcSAtish Patra	  gets chosen via lottery and all other keep spinning on a percpu
10562ffc48fcSAtish Patra	  variable. This method cannot support CPU hotplug and sparse hartid
10572ffc48fcSAtish Patra	  scheme. It should be only enabled for M-mode Linux or platforms relying
10582ffc48fcSAtish Patra	  on older firmware without SBI HSM extension. All other platforms should
10592ffc48fcSAtish Patra	  rely on ordered booting via SBI HSM extension which gets chosen
10602ffc48fcSAtish Patra	  dynamically at runtime if the firmware supports it.
10612ffc48fcSAtish Patra
106277d707a3SPalmer Dabbelt	  Since spinwait is incompatible with sparse hart IDs, it requires
106377d707a3SPalmer Dabbelt	  NR_CPUS be large enough to contain the physical hart ID of the first
106477d707a3SPalmer Dabbelt	  hart to enter Linux.
106577d707a3SPalmer Dabbelt
106677d707a3SPalmer Dabbelt	  If unsure what to do here, say N.
106777d707a3SPalmer Dabbelt
10681f0d6efeSEric DeVolderconfig ARCH_SUPPORTS_KEXEC
1069c41bd251SIgnat Korchagin	def_bool y
10701f0d6efeSEric DeVolder
10711f0d6efeSEric DeVolderconfig ARCH_SELECTS_KEXEC
10721f0d6efeSEric DeVolder	def_bool y
10731f0d6efeSEric DeVolder	depends on KEXEC
10745f365c13SConor Dooley	select HOTPLUG_CPU if SMP
1075fba8a867SNick Kossifidis
10761f0d6efeSEric DeVolderconfig ARCH_SUPPORTS_KEXEC_FILE
1077c41bd251SIgnat Korchagin	def_bool 64BIT
1078fba8a867SNick Kossifidis
10791f0d6efeSEric DeVolderconfig ARCH_SELECTS_KEXEC_FILE
10801f0d6efeSEric DeVolder	def_bool y
10811f0d6efeSEric DeVolder	depends on KEXEC_FILE
10825f365c13SConor Dooley	select HAVE_IMA_KEXEC if IMA
10836261586eSLiao Chang	select KEXEC_ELF
10846261586eSLiao Chang
1085e6265fe7SEric DeVolderconfig ARCH_SUPPORTS_KEXEC_PURGATORY
1086c1ad12eeSArnd Bergmann	def_bool ARCH_SUPPORTS_KEXEC_FILE
1087736e30afSLi Zhengyu
10881f0d6efeSEric DeVolderconfig ARCH_SUPPORTS_CRASH_DUMP
10891f0d6efeSEric DeVolder	def_bool y
1090fba8a867SNick Kossifidis
109131daa343SDave Vasilevskyconfig ARCH_DEFAULT_CRASH_DUMP
109231daa343SDave Vasilevsky	def_bool y
109331daa343SDave Vasilevsky
109439365395SBaoquan Heconfig ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION
109585fcde40SBaoquan He	def_bool CRASH_RESERVE
109639365395SBaoquan He
10979be84592SGuo Renconfig COMPAT
10989be84592SGuo Ren	bool "Kernel support for 32-bit U-mode"
10999be84592SGuo Ren	default 64BIT
11009be84592SGuo Ren	depends on 64BIT && MMU
11019be84592SGuo Ren	help
11029be84592SGuo Ren	  This option enables support for a 32-bit U-mode running under a 64-bit
11039be84592SGuo Ren	  kernel at S-mode. riscv32-specific components such as system calls,
11049be84592SGuo Ren	  the user helper functions (vdso), signal rt_frame functions and the
11059be84592SGuo Ren	  ptrace interface are handled appropriately by the kernel.
11069be84592SGuo Ren
11079be84592SGuo Ren	  If you want to execute 32-bit userspace applications, say Y.
11089be84592SGuo Ren
1109fdf68accSAndrew Jonesconfig PARAVIRT
1110fdf68accSAndrew Jones	bool "Enable paravirtualization code"
1111fdf68accSAndrew Jones	depends on RISCV_SBI
1112fdf68accSAndrew Jones	help
1113fdf68accSAndrew Jones	  This changes the kernel so it can modify itself when it is run
1114fdf68accSAndrew Jones	  under a hypervisor, potentially improving performance significantly
1115fdf68accSAndrew Jones	  over full virtualization.
1116fdf68accSAndrew Jones
1117fdf68accSAndrew Jonesconfig PARAVIRT_TIME_ACCOUNTING
1118fdf68accSAndrew Jones	bool "Paravirtual steal time accounting"
1119fdf68accSAndrew Jones	depends on PARAVIRT
1120fdf68accSAndrew Jones	help
1121fdf68accSAndrew Jones	  Select this option to enable fine granularity task steal time
1122fdf68accSAndrew Jones	  accounting. Time spent executing other tasks in parallel with
1123fdf68accSAndrew Jones	  the current vCPU is discounted from the vCPU power. To account for
1124fdf68accSAndrew Jones	  that, there can be a small performance impact.
1125fdf68accSAndrew Jones
1126fdf68accSAndrew Jones	  If in doubt, say N here.
1127fdf68accSAndrew Jones
112839b33072SAlexandre Ghiticonfig RELOCATABLE
112939b33072SAlexandre Ghiti	bool "Build a relocatable kernel"
1130ea2bde36SSamuel Holland	depends on !XIP_KERNEL
11312aff5f95SQingfang Deng	select MODULE_SECTIONS if MODULES
11329b400d17SArd Biesheuvel	select ARCH_VMLINUX_NEEDS_RELOCS
113339b33072SAlexandre Ghiti	help
113439b33072SAlexandre Ghiti          This builds a kernel as a Position Independent Executable (PIE),
113539b33072SAlexandre Ghiti          which retains all relocation metadata required to relocate the
113639b33072SAlexandre Ghiti          kernel binary at runtime to a different virtual address than the
113739b33072SAlexandre Ghiti          address it was linked at.
113839b33072SAlexandre Ghiti          Since RISCV uses the RELA relocation format, this requires a
113939b33072SAlexandre Ghiti          relocation pass at runtime even if the kernel is loaded at the
114039b33072SAlexandre Ghiti          same address it was linked at.
114139b33072SAlexandre Ghiti
114239b33072SAlexandre Ghiti          If unsure, say N.
114339b33072SAlexandre Ghiti
114484fe419dSAlexandre Ghiticonfig RANDOMIZE_BASE
114584fe419dSAlexandre Ghiti        bool "Randomize the address of the kernel image"
114684fe419dSAlexandre Ghiti        select RELOCATABLE
114784fe419dSAlexandre Ghiti        depends on MMU && 64BIT && !XIP_KERNEL
114884fe419dSAlexandre Ghiti        help
114984fe419dSAlexandre Ghiti          Randomizes the virtual address at which the kernel image is
115084fe419dSAlexandre Ghiti          loaded, as a security feature that deters exploit attempts
115184fe419dSAlexandre Ghiti          relying on knowledge of the location of kernel internals.
115284fe419dSAlexandre Ghiti
115384fe419dSAlexandre Ghiti          It is the bootloader's job to provide entropy, by passing a
115484fe419dSAlexandre Ghiti          random u64 value in /chosen/kaslr-seed at kernel entry.
115584fe419dSAlexandre Ghiti
115684fe419dSAlexandre Ghiti          When booting via the UEFI stub, it will invoke the firmware's
115784fe419dSAlexandre Ghiti          EFI_RNG_PROTOCOL implementation (if available) to supply entropy
115884fe419dSAlexandre Ghiti          to the kernel proper. In addition, it will randomise the physical
115984fe419dSAlexandre Ghiti          location of the kernel Image as well.
116084fe419dSAlexandre Ghiti
116184fe419dSAlexandre Ghiti          If unsure, say N.
116284fe419dSAlexandre Ghiti
11632f66a3d0SJuerg Haefligerendmenu # "Kernel features"
1164fbe934d6SPalmer Dabbelt
1165aef53f97SNick Kossifidismenu "Boot options"
1166aef53f97SNick Kossifidis
1167aef53f97SNick Kossifidisconfig CMDLINE
11683aed8c43SNick Kossifidis	string "Built-in kernel command line"
1169aef53f97SNick Kossifidis	help
11703aed8c43SNick Kossifidis	  For most platforms, the arguments for the kernel's command line
11713aed8c43SNick Kossifidis	  are provided at run-time, during boot. However, there are cases
11723aed8c43SNick Kossifidis	  where either no arguments are being provided or the provided
11733aed8c43SNick Kossifidis	  arguments are insufficient or even invalid.
11743aed8c43SNick Kossifidis
11753aed8c43SNick Kossifidis	  When that occurs, it is possible to define a built-in command
11763aed8c43SNick Kossifidis	  line here and choose how the kernel should use it later on.
11773aed8c43SNick Kossifidis
11783aed8c43SNick Kossifidischoice
1179b9d73218SMasahiro Yamada	prompt "Built-in command line usage"
1180b9d73218SMasahiro Yamada	depends on CMDLINE != ""
11813aed8c43SNick Kossifidis	default CMDLINE_FALLBACK
11823aed8c43SNick Kossifidis	help
11833aed8c43SNick Kossifidis	  Choose how the kernel will handle the provided built-in command
11843aed8c43SNick Kossifidis	  line.
11853aed8c43SNick Kossifidis
11863aed8c43SNick Kossifidisconfig CMDLINE_FALLBACK
11873aed8c43SNick Kossifidis	bool "Use bootloader kernel arguments if available"
11883aed8c43SNick Kossifidis	help
11893aed8c43SNick Kossifidis	  Use the built-in command line as fallback in case we get nothing
11903aed8c43SNick Kossifidis	  during boot. This is the default behaviour.
11913aed8c43SNick Kossifidis
11923aed8c43SNick Kossifidisconfig CMDLINE_EXTEND
11933aed8c43SNick Kossifidis	bool "Extend bootloader kernel arguments"
11943aed8c43SNick Kossifidis	help
119548d9aabfS谢致邦 (XIE Zhibang)	  The built-in command line will be appended to the command-
119648d9aabfS谢致邦 (XIE Zhibang)	  line arguments provided during boot. This is useful in
11973aed8c43SNick Kossifidis	  cases where the provided arguments are insufficient and
11983aed8c43SNick Kossifidis	  you don't want to or cannot modify them.
11993aed8c43SNick Kossifidis
1200aef53f97SNick Kossifidisconfig CMDLINE_FORCE
12013aed8c43SNick Kossifidis	bool "Always use the default kernel command string"
1202aef53f97SNick Kossifidis	help
12033aed8c43SNick Kossifidis	  Always use the built-in command line, even if we get one during
12043aed8c43SNick Kossifidis	  boot. This is useful in case you need to override the provided
12053aed8c43SNick Kossifidis	  command line on systems where you don't have or want control
12063aed8c43SNick Kossifidis	  over it.
1207aef53f97SNick Kossifidis
12083aed8c43SNick Kossifidisendchoice
1209aef53f97SNick Kossifidis
1210d7071743SAtish Patraconfig EFI_STUB
1211d7071743SAtish Patra	bool
1212d7071743SAtish Patra
1213d7071743SAtish Patraconfig EFI
1214d7071743SAtish Patra	bool "UEFI runtime support"
121544c92257SVitaly Wool	depends on OF && !XIP_KERNEL
1216b91540d5SAtish Patra	depends on MMU
1217d7071743SAtish Patra	default y
1218a91a9ffbSSunil V L	select ARCH_SUPPORTS_ACPI if 64BIT
12195f365c13SConor Dooley	select EFI_GENERIC_STUB
12205f365c13SConor Dooley	select EFI_PARAMS_FROM_FDT
12215f365c13SConor Dooley	select EFI_RUNTIME_WRAPPERS
12225f365c13SConor Dooley	select EFI_STUB
12235f365c13SConor Dooley	select LIBFDT
12245f365c13SConor Dooley	select RISCV_ISA_C
12255f365c13SConor Dooley	select UCS2_STRING
1226d7071743SAtish Patra	help
1227d7071743SAtish Patra	  This option provides support for runtime services provided
1228d7071743SAtish Patra	  by UEFI firmware (such as non-volatile variables, realtime
1229d7071743SAtish Patra	  clock, and platform reset). A UEFI stub is also provided to
1230d7071743SAtish Patra	  allow the kernel to be booted as an EFI application. This
1231d7071743SAtish Patra	  is only useful on systems that have UEFI firmware.
1232d7071743SAtish Patra
1233d6ecd188SHaibo Xuconfig DMI
1234d6ecd188SHaibo Xu	bool "Enable support for SMBIOS (DMI) tables"
1235d6ecd188SHaibo Xu	depends on EFI
1236d6ecd188SHaibo Xu	default y
1237d6ecd188SHaibo Xu	help
1238d6ecd188SHaibo Xu	  This enables SMBIOS/DMI feature for systems.
1239d6ecd188SHaibo Xu
1240d6ecd188SHaibo Xu	  This option is only useful on systems that have UEFI firmware.
1241d6ecd188SHaibo Xu	  However, even with this option, the resultant kernel should
1242d6ecd188SHaibo Xu	  continue to boot on existing non-UEFI platforms.
1243d6ecd188SHaibo Xu
1244fea2fed2SGuo Renconfig CC_HAVE_STACKPROTECTOR_TLS
1245fea2fed2SGuo Ren	def_bool $(cc-option,-mstack-protector-guard=tls -mstack-protector-guard-reg=tp -mstack-protector-guard-offset=0)
1246fea2fed2SGuo Ren
1247fea2fed2SGuo Renconfig STACKPROTECTOR_PER_TASK
1248fea2fed2SGuo Ren	def_bool y
1249595b893eSKees Cook	depends on !RANDSTRUCT
1250fea2fed2SGuo Ren	depends on STACKPROTECTOR && CC_HAVE_STACKPROTECTOR_TLS
1251fea2fed2SGuo Ren
1252867432beSAlexandre Ghiticonfig PHYS_RAM_BASE_FIXED
1253867432beSAlexandre Ghiti	bool "Explicitly specified physical RAM address"
125444c1e84aSPalmer Dabbelt	depends on NONPORTABLE
1255867432beSAlexandre Ghiti	default n
1256867432beSAlexandre Ghiti
125744c92257SVitaly Woolconfig PHYS_RAM_BASE
125844c92257SVitaly Wool	hex "Platform Physical RAM address"
1259867432beSAlexandre Ghiti	depends on PHYS_RAM_BASE_FIXED
126044c92257SVitaly Wool	default "0x80000000"
126144c92257SVitaly Wool	help
126244c92257SVitaly Wool	  This is the physical address of RAM in the system. It has to be
126344c92257SVitaly Wool	  explicitly specified to run early relocations of read-write data
126444c92257SVitaly Wool	  from flash to RAM.
126544c92257SVitaly Wool
126644c92257SVitaly Woolconfig XIP_KERNEL
126744c92257SVitaly Wool	bool "Kernel Execute-In-Place from ROM"
126844c1e84aSPalmer Dabbelt	depends on MMU && SPARSEMEM && NONPORTABLE
126944c92257SVitaly Wool	# This prevents XIP from being enabled by all{yes,mod}config, which
127044c92257SVitaly Wool	# fail to build since XIP doesn't support large kernels.
127144c92257SVitaly Wool	depends on !COMPILE_TEST
1272867432beSAlexandre Ghiti	select PHYS_RAM_BASE_FIXED
127344c92257SVitaly Wool	help
127444c92257SVitaly Wool	  Execute-In-Place allows the kernel to run from non-volatile storage
127544c92257SVitaly Wool	  directly addressable by the CPU, such as NOR flash. This saves RAM
127644c92257SVitaly Wool	  space since the text section of the kernel is not loaded from flash
127744c92257SVitaly Wool	  to RAM.  Read-write sections, such as the data section and stack,
127844c92257SVitaly Wool	  are still copied to RAM.  The XIP kernel is not compressed since
127944c92257SVitaly Wool	  it has to run directly from flash, so it will take more space to
128044c92257SVitaly Wool	  store it.  The flash address used to link the kernel object files,
128144c92257SVitaly Wool	  and for storing it, is configuration dependent. Therefore, if you
128244c92257SVitaly Wool	  say Y here, you must know the proper physical address where to
128344c92257SVitaly Wool	  store the kernel image depending on your own flash memory usage.
128444c92257SVitaly Wool
128544c92257SVitaly Wool	  Also note that the make target becomes "make xipImage" rather than
128644c92257SVitaly Wool	  "make zImage" or "make Image".  The final kernel binary to put in
128744c92257SVitaly Wool	  ROM memory will be arch/riscv/boot/xipImage.
128844c92257SVitaly Wool
128944c92257SVitaly Wool	  SPARSEMEM is required because the kernel text and rodata that are
129044c92257SVitaly Wool	  flash resident are not backed by memmap, then any attempt to get
129144c92257SVitaly Wool	  a struct page on those regions will trigger a fault.
129244c92257SVitaly Wool
129344c92257SVitaly Wool	  If unsure, say N.
129444c92257SVitaly Wool
129544c92257SVitaly Woolconfig XIP_PHYS_ADDR
129644c92257SVitaly Wool	hex "XIP Kernel Physical Location"
129744c92257SVitaly Wool	depends on XIP_KERNEL
129844c92257SVitaly Wool	default "0x21000000"
129944c92257SVitaly Wool	help
130044c92257SVitaly Wool	  This is the physical address in your flash memory the kernel will
130144c92257SVitaly Wool	  be linked for and stored to.  This address is dependent on your
130244c92257SVitaly Wool	  own flash usage.
130344c92257SVitaly Wool
1304496ea826SConor Dooleyconfig RISCV_ISA_FALLBACK
1305496ea826SConor Dooley	bool "Permit falling back to parsing riscv,isa for extension support by default"
1306496ea826SConor Dooley	default y
1307496ea826SConor Dooley	help
1308496ea826SConor Dooley	  Parsing the "riscv,isa" devicetree property has been deprecated and
1309496ea826SConor Dooley	  replaced by a list of explicitly defined strings. For compatibility
1310496ea826SConor Dooley	  with existing platforms, the kernel will fall back to parsing the
1311496ea826SConor Dooley	  "riscv,isa" property if the replacements are not found.
1312496ea826SConor Dooley
1313496ea826SConor Dooley	  Selecting N here will result in a kernel that does not use the
1314496ea826SConor Dooley	  fallback, unless the commandline "riscv_isa_fallback" parameter is
1315496ea826SConor Dooley	  present.
1316496ea826SConor Dooley
1317496ea826SConor Dooley	  Please see the dt-binding, located at
1318496ea826SConor Dooley	  Documentation/devicetree/bindings/riscv/extensions.yaml for details
1319496ea826SConor Dooley	  on the replacement properties, "riscv,isa-base" and
1320496ea826SConor Dooley	  "riscv,isa-extensions".
1321496ea826SConor Dooley
13222d268251SPalmer Dabbeltconfig BUILTIN_DTB
13236c4a2f63SFrederik Haxel	bool "Built-in device tree"
132444c1e84aSPalmer Dabbelt	depends on OF && NONPORTABLE
132582e81b89SMasahiro Yamada	select GENERIC_BUILTIN_DTB
13262672031bSYangyu Chen	help
13272672031bSYangyu Chen	  Build a device tree into the Linux image.
13282672031bSYangyu Chen	  This option should be selected if no bootloader is being used.
13292672031bSYangyu Chen	  If unsure, say N.
13302672031bSYangyu Chen
13312672031bSYangyu Chen
133282e81b89SMasahiro Yamadaconfig BUILTIN_DTB_NAME
13332672031bSYangyu Chen	string "Built-in device tree source"
13342672031bSYangyu Chen	depends on BUILTIN_DTB
13352672031bSYangyu Chen	help
13362672031bSYangyu Chen	  DTS file path (without suffix, relative to arch/riscv/boot/dts)
13372672031bSYangyu Chen	  for the DTS file that will be used to produce the DTB linked into the
13382672031bSYangyu Chen	  kernel.
13392d268251SPalmer Dabbelt
13406c4a2f63SFrederik Haxelendmenu # "Boot options"
13416c4a2f63SFrederik Haxel
134244c1e84aSPalmer Dabbeltconfig PORTABLE
134344c1e84aSPalmer Dabbelt	bool
134444c1e84aSPalmer Dabbelt	default !NONPORTABLE
134544c1e84aSPalmer Dabbelt	select EFI
134644c1e84aSPalmer Dabbelt	select MMU
13475f365c13SConor Dooley	select OF
134844c1e84aSPalmer Dabbelt
1349e0c0a7c3SAndreas Schwabconfig ARCH_PROC_KCORE_TEXT
1350e0c0a7c3SAndreas Schwab	def_bool y
1351e0c0a7c3SAndreas Schwab
1352fbe934d6SPalmer Dabbeltmenu "Power management options"
1353fbe934d6SPalmer Dabbelt
13548636a1f9SMasahiro Yamadasource "kernel/power/Kconfig"
1355fbe934d6SPalmer Dabbelt
1356c0317210SSia Jee Hengconfig ARCH_HIBERNATION_POSSIBLE
1357e2d6b54bSConor Dooley	def_bool y
1358c0317210SSia Jee Heng
1359c0317210SSia Jee Hengconfig ARCH_HIBERNATION_HEADER
1360c0317210SSia Jee Heng	def_bool HIBERNATION
1361c0317210SSia Jee Heng
1362c1f048a6SSong Shuaiconfig ARCH_SUSPEND_POSSIBLE
1363c1f048a6SSong Shuai	def_bool y
1364c1f048a6SSong Shuai
13652f66a3d0SJuerg Haefligerendmenu # "Power management options"
1366d7071743SAtish Patra
1367f6e64b66SAnup Patelmenu "CPU Power Management"
1368f6e64b66SAnup Patel
1369f6e64b66SAnup Patelsource "drivers/cpuidle/Kconfig"
1370f6e64b66SAnup Patel
1371effae0e3SLad Prabhakarsource "drivers/cpufreq/Kconfig"
1372effae0e3SLad Prabhakar
13732f66a3d0SJuerg Haefligerendmenu # "CPU Power Management"
1374f6e64b66SAnup Patel
137599cdc6c1SAnup Patelsource "arch/riscv/kvm/Kconfig"
1376a91a9ffbSSunil V L
1377a91a9ffbSSunil V Lsource "drivers/acpi/Kconfig"
1378