xref: /linux/arch/riscv/Kconfig (revision 7bd291abe2da09f59dca81f35a4ec220e5e138a2)
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
46e8c7ef7dSPalmer Dabbelt	select ARCH_HAS_PTE_SPECIAL
4710cc3278SMike Rapoport	select ARCH_HAS_SET_DIRECT_MAP if MMU
4810cc3278SMike Rapoport	select ARCH_HAS_SET_MEMORY if MMU
4944c92257SVitaly Wool	select ARCH_HAS_STRICT_KERNEL_RWX if MMU && !XIP_KERNEL
5044c92257SVitaly Wool	select ARCH_HAS_STRICT_MODULE_RWX if MMU && !XIP_KERNEL
51cd9b2901SAndrea Parri	select ARCH_HAS_SYNC_CORE_BEFORE_USERMODE
5208d0ce30SSami Tolvanen	select ARCH_HAS_SYSCALL_WRAPPER
532f100585SGuo Ren	select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
54918327e9SKees Cook	select ARCH_HAS_UBSAN
5546fe55b2SThomas Weißschuh	select ARCH_HAS_VDSO_ARCH_DATA if GENERIC_VDSO_DATA_STORE
56e8065df5SSunil V L	select ARCH_KEEP_MEMBLOCK if ACPI
57f8c2a240SBjörn Töpel	select ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE	if 64BIT && MMU
58fc0c769fSVincent Chen	select ARCH_OPTIONAL_KERNEL_RWX if ARCH_HAS_STRICT_KERNEL_RWX
59fc0c769fSVincent Chen	select ARCH_OPTIONAL_KERNEL_RWX_DEFAULT
607f85b04bSJisheng Zhang	select ARCH_STACKWALK
617f85b04bSJisheng Zhang	select ARCH_SUPPORTS_ATOMIC_RMW
626f49743aSNathan Chancellor	# clang >= 17: https://github.com/llvm/llvm-project/commit/62fa708ceb027713b386c7e0efda994f8bdc27e2
636f49743aSNathan Chancellor	select ARCH_SUPPORTS_CFI_CLANG if CLANG_VERSION >= 170000
647f85b04bSJisheng Zhang	select ARCH_SUPPORTS_DEBUG_PAGEALLOC if MMU
6503dc00a2SAndrew Bresticker	select ARCH_SUPPORTS_HUGE_PFNMAP if TRANSPARENT_HUGEPAGE
66855f9a8eSAnshuman Khandual	select ARCH_SUPPORTS_HUGETLBFS if MMU
67021d2342SWende Tan	# LLD >= 14: https://github.com/llvm/llvm-project/issues/50505
68021d2342SWende Tan	select ARCH_SUPPORTS_LTO_CLANG if LLD_VERSION >= 140000
69021d2342SWende Tan	select ARCH_SUPPORTS_LTO_CLANG_THIN if LLD_VERSION >= 140000
70a869b8c2SJisheng Zhang	select ARCH_SUPPORTS_MSEAL_SYSTEM_MAPPINGS if 64BIT && MMU
7134c0a5b0SYueHaibing	select ARCH_SUPPORTS_PAGE_TABLE_CHECK if MMU
72648321faSJisheng Zhang	select ARCH_SUPPORTS_PER_VMA_LOCK if MMU
732638e4e6SSebastian Andrzej Siewior	select ARCH_SUPPORTS_RT
74d1584d79SSami Tolvanen	select ARCH_SUPPORTS_SHADOW_CALL_STACK if HAVE_SHADOW_CALL_STACK
75*7bd291abSPeter Zijlstra	select ARCH_SUPPORTS_SCHED_MC if SMP
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
9726b537edSKuan-Wei Chiu	select CPU_NO_EFFICIENT_FFS if !RISCV_ISA_ZBB
984dc4af9cSAndrew Jones	select CPU_PM if CPU_IDLE || HIBERNATION || SUSPEND
995874ca4cSAlexandre Ghiti	select DYNAMIC_FTRACE if FUNCTION_TRACER
100e8c7ef7dSPalmer Dabbelt	select EDAC_SUPPORT
1019f944d2eSBjörn Töpel	select FRAME_POINTER if PERF_EVENTS || (FUNCTION_TRACER && !DYNAMIC_FTRACE)
102b546d636SSong Shuai	select FTRACE_MCOUNT_USE_PATCHABLE_FUNCTION_ENTRY if DYNAMIC_FTRACE
103c217157bSPuranjay Mohan	select FUNCTION_ALIGNMENT_8B if DYNAMIC_FTRACE_WITH_CALL_OPS
104fbd92809SConor Dooley	select GENERIC_ARCH_TOPOLOGY
105e8c7ef7dSPalmer Dabbelt	select GENERIC_ATOMIC64 if !64BIT
1062f100585SGuo Ren	select GENERIC_CLOCKEVENTS_BROADCAST if SMP
10796cf2036SJames Morse	select GENERIC_CPU_DEVICES
1080e3f3649SJinjie Ruan	select GENERIC_CPU_VULNERABILITIES
1096262f661SAtish Patra	select GENERIC_EARLY_IOREMAP
110f0bddf50SGuo Ren	select GENERIC_ENTRY
111ad5d1122SVincent Chen	select GENERIC_GETTIMEOFDAY if HAVE_GENERIC_VDSO
112bcf11b5eSKefeng Wang	select GENERIC_IDLE_POLL_SETUP
1138350229fSChristoph Hellwig	select GENERIC_IOREMAP if MMU
114832f15f4SAnup Patel	select GENERIC_IRQ_IPI if SMP
115832f15f4SAnup Patel	select GENERIC_IRQ_IPI_MUX if SMP
116e8c7ef7dSPalmer Dabbelt	select GENERIC_IRQ_MULTI_HANDLER
117fbe934d6SPalmer Dabbelt	select GENERIC_IRQ_SHOW
118ecd4916cSKefeng Wang	select GENERIC_IRQ_SHOW_LEVEL
11978ed473cSPalmer Dabbelt	select GENERIC_LIB_DEVMEM_IS_ALLOWED
12058d868b6SAnup Patel	select GENERIC_PENDING_IRQ if SMP
121fbe934d6SPalmer Dabbelt	select GENERIC_PCI_IOMAP
1229b9afe4aSAnup Patel	select GENERIC_SCHED_CLOCK
123e8c7ef7dSPalmer Dabbelt	select GENERIC_SMP_IDLE_THREAD
124ad5d1122SVincent Chen	select GENERIC_TIME_VSYSCALL if MMU && 64BIT
12546fe55b2SThomas Weißschuh	select GENERIC_VDSO_DATA_STORE if MMU
126dffe11e2STong Tiangen	select GENERIC_VDSO_TIME_NS if HAVE_GENERIC_VDSO
127c45fc916SConor Dooley	select HARDIRQS_SW_RESEND
128fcbfe812SNiklas Schnelle	select HAS_IOPORT if MMU
129f7bd2be7SAlexandre Ghiti	select HAVE_ALIGNED_STRUCT_PAGE
130efe75c49SDavid Abdurachmanov	select HAVE_ARCH_AUDITSYSCALL
131be79afc7SLiu Shixin	select HAVE_ARCH_HUGE_VMALLOC if HAVE_ARCH_HUGE_VMAP
1327bed5161SNam Cao	select HAVE_ARCH_HUGE_VMAP if MMU && 64BIT
13342e0e0b4SJisheng Zhang	select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL
13442e0e0b4SJisheng Zhang	select HAVE_ARCH_JUMP_LABEL_RELATIVE if !XIP_KERNEL
135e8c7ef7dSPalmer Dabbelt	select HAVE_ARCH_KASAN if MMU && 64BIT
136e178d670SNylon Chen	select HAVE_ARCH_KASAN_VMALLOC if MMU && 64BIT
13747513f24SLiu Shixin	select HAVE_ARCH_KFENCE if MMU && 64BIT
13857fbad15SKees Cook	select HAVE_ARCH_KSTACK_ERASE
13942e0e0b4SJisheng Zhang	select HAVE_ARCH_KGDB if !XIP_KERNEL
140e8c7ef7dSPalmer Dabbelt	select HAVE_ARCH_KGDB_QXFER_PKT
141e8c7ef7dSPalmer Dabbelt	select HAVE_ARCH_MMAP_RND_BITS if MMU
1429be84592SGuo Ren	select HAVE_ARCH_MMAP_RND_COMPAT_BITS if COMPAT
14305d450aaSSong Shuai	select HAVE_ARCH_RANDOMIZE_KSTACK_OFFSET
1445340627eSDavid Abdurachmanov	select HAVE_ARCH_SECCOMP_FILTER
1455f365c13SConor Dooley	select HAVE_ARCH_THREAD_STRUCT_WHITELIST
146e8c7ef7dSPalmer Dabbelt	select HAVE_ARCH_TRACEHOOK
1479b76d71fSLinus Torvalds	select HAVE_ARCH_TRANSPARENT_HUGEPAGE if 64BIT && MMU
148c3cc2a4aSAlexandre Ghiti	select HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD if 64BIT && MMU
149a2492ca8SSamuel Holland	select HAVE_ARCH_USERFAULTFD_MINOR if 64BIT && USERFAULTFD
15031da94c2STong Tiangen	select HAVE_ARCH_VMAP_STACK if MMU && 64BIT
1512ff2b7ecSMasahiro Yamada	select HAVE_ASM_MODVERSIONS
15224a9c541SFrederic Weisbecker	select HAVE_CONTEXT_TRACKING_USER
153cbb3d91dSTobias Klauser	select HAVE_DEBUG_KMEMLEAK
1546bd33e1eSChristoph Hellwig	select HAVE_DMA_CONTIGUOUS if MMU
155ab7fa6b0SJisheng Zhang	select HAVE_DYNAMIC_FTRACE if !XIP_KERNEL && MMU && (CLANG_SUPPORTS_DYNAMIC_FTRACE || GCC_SUPPORTS_DYNAMIC_FTRACE)
156c41bf432SAndy Chiu	select FUNCTION_ALIGNMENT_4B if HAVE_DYNAMIC_FTRACE && RISCV_ISA_C
157b21cdb95SAndy Chiu	select HAVE_DYNAMIC_FTRACE_WITH_DIRECT_CALLS if HAVE_DYNAMIC_FTRACE_WITH_CALL_OPS
158c217157bSPuranjay Mohan	select HAVE_DYNAMIC_FTRACE_WITH_CALL_OPS if (DYNAMIC_FTRACE_WITH_ARGS && !CFI_CLANG)
1597caa9765SPuranjay Mohan	select HAVE_DYNAMIC_FTRACE_WITH_ARGS if HAVE_DYNAMIC_FTRACE
160a762e926SMasami Hiramatsu (Google)	select HAVE_FTRACE_GRAPH_FUNC
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
457fbe934d6SPalmer Dabbeltconfig NR_CPUS
458e623715fSAnup Patel	int "Maximum number of CPUs (2-512)"
459fbe934d6SPalmer Dabbelt	depends on SMP
4601d6b5ed4SSamuel Holland	range 2 512 if !RISCV_SBI_V01
4611d6b5ed4SSamuel Holland	range 2 32 if RISCV_SBI_V01 && 32BIT
4621d6b5ed4SSamuel Holland	range 2 64 if RISCV_SBI_V01 && 64BIT
463e623715fSAnup Patel	default "32" if 32BIT
464e623715fSAnup Patel	default "64" if 64BIT
465fbe934d6SPalmer Dabbelt
466f1e58583SAtish Patraconfig HOTPLUG_CPU
467f1e58583SAtish Patra	bool "Support for hot-pluggable CPUs"
468f1e58583SAtish Patra	depends on SMP
469f1e58583SAtish Patra	select GENERIC_IRQ_MIGRATION
470f1e58583SAtish Patra	help
471f1e58583SAtish Patra
472f1e58583SAtish Patra	  Say Y here to experiment with turning CPUs off and on.  CPUs
473f1e58583SAtish Patra	  can be controlled through /sys/devices/system/cpu.
474f1e58583SAtish Patra
475f1e58583SAtish Patra	  Say N if you want to disable CPU hotplug.
476f1e58583SAtish Patra
477fbe934d6SPalmer Dabbeltchoice
478fbe934d6SPalmer Dabbelt	prompt "CPU Tuning"
479fbe934d6SPalmer Dabbelt	default TUNE_GENERIC
480fbe934d6SPalmer Dabbelt
481fbe934d6SPalmer Dabbeltconfig TUNE_GENERIC
482fbe934d6SPalmer Dabbelt	bool "generic"
483fbe934d6SPalmer Dabbelt
484fbe934d6SPalmer Dabbeltendchoice
485fbe934d6SPalmer Dabbelt
4864f0e8eefSAtish Patra# Common NUMA Features
4874f0e8eefSAtish Patraconfig NUMA
4884f0e8eefSAtish Patra	bool "NUMA Memory Allocation and Scheduler Support"
4891adbc294SKefeng Wang	depends on SMP && MMU
4904f0e8eefSAtish Patra	select ARCH_SUPPORTS_NUMA_BALANCING
4915f365c13SConor Dooley	select GENERIC_ARCH_NUMA
4926b9f29b8SAlexandre Ghiti	select HAVE_SETUP_PER_CPU_AREA
4937ecd19cfSKefeng Wang	select NEED_PER_CPU_EMBED_FIRST_CHUNK
4946b9f29b8SAlexandre Ghiti	select NEED_PER_CPU_PAGE_FIRST_CHUNK
4955f365c13SConor Dooley	select OF_NUMA
4965f365c13SConor Dooley	select USE_PERCPU_NUMA_NODE_ID
4974f0e8eefSAtish Patra	help
4984f0e8eefSAtish Patra	  Enable NUMA (Non-Uniform Memory Access) support.
4994f0e8eefSAtish Patra
5004f0e8eefSAtish Patra	  The kernel will try to allocate memory used by a CPU on the
5014f0e8eefSAtish Patra	  local memory of the CPU and add some more NUMA awareness to the kernel.
5024f0e8eefSAtish Patra
5034f0e8eefSAtish Patraconfig NODES_SHIFT
5044f0e8eefSAtish Patra	int "Maximum NUMA Nodes (as a power of 2)"
5054f0e8eefSAtish Patra	range 1 10
5064f0e8eefSAtish Patra	default "2"
507a9ee6cf5SMike Rapoport	depends on NUMA
5084f0e8eefSAtish Patra	help
5094f0e8eefSAtish Patra	  Specify the maximum number of NUMA Nodes available on the target
5104f0e8eefSAtish Patra	  system.  Increases memory reserved to accommodate various tables.
5114f0e8eefSAtish Patra
512ab83647fSAlexandre Ghitichoice
513ab83647fSAlexandre Ghiti	prompt "RISC-V spinlock type"
514ab83647fSAlexandre Ghiti	default RISCV_COMBO_SPINLOCKS
515ab83647fSAlexandre Ghiti
516ab83647fSAlexandre Ghiticonfig RISCV_TICKET_SPINLOCKS
517ab83647fSAlexandre Ghiti	bool "Using ticket spinlock"
518ab83647fSAlexandre Ghiti
519ab83647fSAlexandre Ghiticonfig RISCV_QUEUED_SPINLOCKS
520ab83647fSAlexandre Ghiti	bool "Using queued spinlock"
521ab83647fSAlexandre Ghiti	depends on SMP && MMU && NONPORTABLE
522ab83647fSAlexandre Ghiti	select ARCH_USE_QUEUED_SPINLOCKS
523ab83647fSAlexandre Ghiti	help
524ab83647fSAlexandre Ghiti	  The queued spinlock implementation requires the forward progress
525ab83647fSAlexandre Ghiti	  guarantee of cmpxchg()/xchg() atomic operations: CAS with Zabha or
526ab83647fSAlexandre Ghiti	  LR/SC with Ziccrse provide such guarantee.
527ab83647fSAlexandre Ghiti
528ab83647fSAlexandre Ghiti	  Select this if and only if Zabha or Ziccrse is available on your
529ab83647fSAlexandre Ghiti	  platform, RISCV_QUEUED_SPINLOCKS must not be selected for platforms
530ab83647fSAlexandre Ghiti	  without one of those extensions.
531ab83647fSAlexandre Ghiti
532ab83647fSAlexandre Ghiti	  If unsure, select RISCV_COMBO_SPINLOCKS, which will use qspinlocks
533ab83647fSAlexandre Ghiti	  when supported and otherwise ticket spinlocks.
534ab83647fSAlexandre Ghiti
535ab83647fSAlexandre Ghiticonfig RISCV_COMBO_SPINLOCKS
536ab83647fSAlexandre Ghiti	bool "Using combo spinlock"
537ab83647fSAlexandre Ghiti	depends on SMP && MMU
538ab83647fSAlexandre Ghiti	select ARCH_USE_QUEUED_SPINLOCKS
539ab83647fSAlexandre Ghiti	help
540ab83647fSAlexandre Ghiti	  Embed both queued spinlock and ticket lock so that the spinlock
541ab83647fSAlexandre Ghiti	  implementation can be chosen at runtime.
542ab83647fSAlexandre Ghiti
543ab83647fSAlexandre Ghitiendchoice
544ab83647fSAlexandre Ghiti
545e64f737aSHeiko Stuebnerconfig RISCV_ALTERNATIVE
546e64f737aSHeiko Stuebner	bool
547e64f737aSHeiko Stuebner	depends on !XIP_KERNEL
548e64f737aSHeiko Stuebner	help
549e64f737aSHeiko Stuebner	  This Kconfig allows the kernel to automatically patch the
550ff19a8deSAndrew Jones	  erratum or cpufeature required by the execution platform at run
551ff19a8deSAndrew Jones	  time. The code patching overhead is minimal, as it's only done
552ff19a8deSAndrew Jones	  once at boot and once on each module load.
553e64f737aSHeiko Stuebner
554a35707c3SHeiko Stuebnerconfig RISCV_ALTERNATIVE_EARLY
555a35707c3SHeiko Stuebner	bool
556a35707c3SHeiko Stuebner	depends on RISCV_ALTERNATIVE
557a35707c3SHeiko Stuebner	help
558a35707c3SHeiko Stuebner	  Allows early patching of the kernel for special errata
559a35707c3SHeiko Stuebner
560fbe934d6SPalmer Dabbeltconfig RISCV_ISA_C
561fbe934d6SPalmer Dabbelt	bool "Emit compressed instructions when building Linux"
562fbe934d6SPalmer Dabbelt	default y
563fbe934d6SPalmer Dabbelt	help
564fbe934d6SPalmer Dabbelt	  Adds "C" to the ISA subsets that the toolchain is allowed to emit
565fbe934d6SPalmer Dabbelt	  when building Linux, which results in compressed instructions in the
5666216182fSConor Dooley	  Linux binary. This option produces a kernel that will not run on
5676216182fSConor Dooley	  systems that do not support compressed instructions.
568fbe934d6SPalmer Dabbelt
569fbe934d6SPalmer Dabbelt	  If you don't know what to do here, say Y.
570fbe934d6SPalmer Dabbelt
57109d6775fSSamuel Hollandconfig RISCV_ISA_SUPM
57209d6775fSSamuel Holland	bool "Supm extension for userspace pointer masking"
57309d6775fSSamuel Holland	depends on 64BIT
57409d6775fSSamuel Holland	default y
57509d6775fSSamuel Holland	help
57609d6775fSSamuel Holland	  Add support for pointer masking in userspace (Supm) when the
57709d6775fSSamuel Holland	  underlying hardware extension (Smnpm or Ssnpm) is detected at boot.
57809d6775fSSamuel Holland
57909d6775fSSamuel Holland	  If this option is disabled, userspace will be unable to use
58009d6775fSSamuel Holland	  the prctl(PR_{SET,GET}_TAGGED_ADDR_CTRL) API.
58109d6775fSSamuel Holland
58223ad288aSQinglin Panconfig RISCV_ISA_SVNAPOT
5835464912cSConor Dooley	bool "Svnapot extension support for supervisor mode NAPOT pages"
584ff689fd2SHeiko Stuebner	depends on 64BIT && MMU
5851ee7fc3fSConor Dooley	depends on RISCV_ALTERNATIVE
586ff689fd2SHeiko Stuebner	default y
587ff689fd2SHeiko Stuebner	help
5886216182fSConor Dooley	  Enable support for the Svnapot ISA-extension when it is detected
5896216182fSConor Dooley	  at boot.
59023ad288aSQinglin Pan
5915464912cSConor Dooley	  The Svnapot extension is used to mark contiguous PTEs as a range
59223ad288aSQinglin Pan	  of contiguous virtual-to-physical translations for a naturally
59323ad288aSQinglin Pan	  aligned power-of-2 (NAPOT) granularity larger than the base 4KB page
59423ad288aSQinglin Pan	  size. When HUGETLBFS is also selected this option unconditionally
59523ad288aSQinglin Pan	  allocates some memory for each NAPOT page size supported by the kernel.
59623ad288aSQinglin Pan	  When optimizing for low memory consumption and for platforms without
5975464912cSConor Dooley	  the Svnapot extension, it may be better to say N here.
59823ad288aSQinglin Pan
59923ad288aSQinglin Pan	  If you don't know what to do here, say Y.
60023ad288aSQinglin Pan
601ff689fd2SHeiko Stuebnerconfig RISCV_ISA_SVPBMT
6025464912cSConor Dooley	bool "Svpbmt extension support for supervisor mode page-based memory types"
603ff689fd2SHeiko Stuebner	depends on 64BIT && MMU
604ff689fd2SHeiko Stuebner	depends on RISCV_ALTERNATIVE
605ff689fd2SHeiko Stuebner	default y
606ff689fd2SHeiko Stuebner	help
6076216182fSConor Dooley	   Add support for the Svpbmt ISA-extension (Supervisor-mode:
6086216182fSConor Dooley	   page-based memory types) in the kernel when it is detected at boot.
609924cbb8cSHeiko Stuebner
610924cbb8cSHeiko Stuebner	   The memory type for a page contains a combination of attributes
611924cbb8cSHeiko Stuebner	   that indicate the cacheability, idempotency, and ordering
612924cbb8cSHeiko Stuebner	   properties for access to that page.
613ff689fd2SHeiko Stuebner
6145464912cSConor Dooley	   The Svpbmt extension is only available on 64-bit cpus.
615ff689fd2SHeiko Stuebner
616ff689fd2SHeiko Stuebner	   If you don't know what to do here, say Y.
617ff689fd2SHeiko Stuebner
618fa8e7cceSGuo Renconfig TOOLCHAIN_HAS_V
619fa8e7cceSGuo Ren	bool
620fa8e7cceSGuo Ren	default y
6215ba7a75aSAnton Blanchard	depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64imv)
6225ba7a75aSAnton Blanchard	depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32imv)
623fa8e7cceSGuo Ren	depends on LLD_VERSION >= 140000 || LD_VERSION >= 23800
624fa8e7cceSGuo Ren	depends on AS_HAS_OPTION_ARCH
625fa8e7cceSGuo Ren
626fa8e7cceSGuo Renconfig RISCV_ISA_V
6276216182fSConor Dooley	bool "Vector extension support"
628fa8e7cceSGuo Ren	depends on TOOLCHAIN_HAS_V
629fa8e7cceSGuo Ren	depends on FPU
630fa8e7cceSGuo Ren	select DYNAMIC_SIGFRAME
631fa8e7cceSGuo Ren	default y
632fa8e7cceSGuo Ren	help
6336216182fSConor Dooley	  Add support for the Vector extension when it is detected at boot.
6346216182fSConor Dooley	  When this option is disabled, neither the kernel nor userspace may
6356216182fSConor Dooley	  use vector procedures.
636fa8e7cceSGuo Ren
637fa8e7cceSGuo Ren	  If you don't know what to do here, say Y.
638fa8e7cceSGuo Ren
639fa8e7cceSGuo Renconfig RISCV_ISA_V_DEFAULT_ENABLE
640fa8e7cceSGuo Ren	bool "Enable userspace Vector by default"
641fa8e7cceSGuo Ren	depends on RISCV_ISA_V
642fa8e7cceSGuo Ren	default y
643fa8e7cceSGuo Ren	help
644fa8e7cceSGuo Ren	  Say Y here if you want to enable Vector in userspace by default.
645fa8e7cceSGuo Ren	  Otherwise, userspace has to make explicit prctl() call to enable
646fa8e7cceSGuo Ren	  Vector, or enable it via the sysctl interface.
647fa8e7cceSGuo Ren
648fa8e7cceSGuo Ren	  If you don't know what to do here, say Y.
649fa8e7cceSGuo Ren
650c2a658d4SAndy Chiuconfig RISCV_ISA_V_UCOPY_THRESHOLD
651c2a658d4SAndy Chiu	int "Threshold size for vectorized user copies"
652c2a658d4SAndy Chiu	depends on RISCV_ISA_V
653c2a658d4SAndy Chiu	default 768
654c2a658d4SAndy Chiu	help
655c2a658d4SAndy Chiu	  Prefer using vectorized copy_to_user()/copy_from_user() when the
656c2a658d4SAndy Chiu	  workload size exceeds this value.
657c2a658d4SAndy Chiu
6582080ff94SAndy Chiuconfig RISCV_ISA_V_PREEMPTIVE
6592080ff94SAndy Chiu	bool "Run kernel-mode Vector with kernel preemption"
6602080ff94SAndy Chiu	depends on PREEMPTION
6612080ff94SAndy Chiu	depends on RISCV_ISA_V
6622080ff94SAndy Chiu	default y
6632080ff94SAndy Chiu	help
6642080ff94SAndy Chiu	  Usually, in-kernel SIMD routines are run with preemption disabled.
665c39d5375SMiquel Sabaté Solà	  Functions which invoke long running SIMD thus must yield the core's
6662080ff94SAndy Chiu	  vector unit to prevent blocking other tasks for too long.
6672080ff94SAndy Chiu
668c39d5375SMiquel Sabaté Solà	  This config allows the kernel to run SIMD without explicitly disabling
669c39d5375SMiquel Sabaté Solà	  preemption. Enabling this config will result in higher memory consumption
670c39d5375SMiquel Sabaté Solà	  due to the allocation of per-task's kernel Vector context.
6712080ff94SAndy Chiu
672b8ddb0dfSChristoph Müllnerconfig RISCV_ISA_ZAWRS
673b8ddb0dfSChristoph Müllner	bool "Zawrs extension support for more efficient busy waiting"
674b8ddb0dfSChristoph Müllner	depends on RISCV_ALTERNATIVE
675b8ddb0dfSChristoph Müllner	default y
676b8ddb0dfSChristoph Müllner	help
677b8ddb0dfSChristoph Müllner	  The Zawrs extension defines instructions to be used in polling loops
678b8ddb0dfSChristoph Müllner	  which allow a hart to enter a low-power state or to trap to the
679b8ddb0dfSChristoph Müllner	  hypervisor while waiting on a store to a memory location. Enable the
680b8ddb0dfSChristoph Müllner	  use of these instructions in the kernel when the Zawrs extension is
681b8ddb0dfSChristoph Müllner	  detected at boot.
682b8ddb0dfSChristoph Müllner
6831658ef43SAlexandre Ghiticonfig TOOLCHAIN_HAS_ZABHA
6841658ef43SAlexandre Ghiti	bool
6851658ef43SAlexandre Ghiti	default y
6861658ef43SAlexandre Ghiti	depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64ima_zabha)
6871658ef43SAlexandre Ghiti	depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32ima_zabha)
6881658ef43SAlexandre Ghiti	depends on AS_HAS_OPTION_ARCH
6891658ef43SAlexandre Ghiti
6901658ef43SAlexandre Ghiticonfig RISCV_ISA_ZABHA
6911658ef43SAlexandre Ghiti	bool "Zabha extension support for atomic byte/halfword operations"
6921658ef43SAlexandre Ghiti	depends on TOOLCHAIN_HAS_ZABHA
6931658ef43SAlexandre Ghiti	depends on RISCV_ALTERNATIVE
6941658ef43SAlexandre Ghiti	default y
6951658ef43SAlexandre Ghiti	help
6961658ef43SAlexandre Ghiti	  Enable the use of the Zabha ISA-extension to implement kernel
6971658ef43SAlexandre Ghiti	  byte/halfword atomic memory operations when it is detected at boot.
6981658ef43SAlexandre Ghiti
6991658ef43SAlexandre Ghiti	  If you don't know what to do here, say Y.
7001658ef43SAlexandre Ghiti
70138acdee3SAlexandre Ghiticonfig TOOLCHAIN_HAS_ZACAS
70238acdee3SAlexandre Ghiti	bool
70338acdee3SAlexandre Ghiti	default y
70438acdee3SAlexandre Ghiti	depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64ima_zacas)
70538acdee3SAlexandre Ghiti	depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32ima_zacas)
70638acdee3SAlexandre Ghiti	depends on AS_HAS_OPTION_ARCH
70738acdee3SAlexandre Ghiti
70838acdee3SAlexandre Ghiticonfig RISCV_ISA_ZACAS
70938acdee3SAlexandre Ghiti	bool "Zacas extension support for atomic CAS"
71038acdee3SAlexandre Ghiti	depends on TOOLCHAIN_HAS_ZACAS
71138acdee3SAlexandre Ghiti	depends on RISCV_ALTERNATIVE
71238acdee3SAlexandre Ghiti	default y
71338acdee3SAlexandre Ghiti	help
71438acdee3SAlexandre Ghiti	  Enable the use of the Zacas ISA-extension to implement kernel atomic
71538acdee3SAlexandre Ghiti	  cmpxchg operations when it is detected at boot.
71638acdee3SAlexandre Ghiti
717b8ddb0dfSChristoph Müllner	  If you don't know what to do here, say Y.
718b8ddb0dfSChristoph Müllner
719b6fcdb19SHeiko Stuebnerconfig TOOLCHAIN_HAS_ZBB
7201631ba12SHeiko Stuebner	bool
721b8c86872SConor Dooley	default y
722b6fcdb19SHeiko Stuebner	depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64ima_zbb)
723b6fcdb19SHeiko Stuebner	depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32ima_zbb)
724b6fcdb19SHeiko Stuebner	depends on LLD_VERSION >= 150000 || LD_VERSION >= 23900
725e4bb020fSAndy Chiu	depends on AS_HAS_OPTION_ARCH
726b6fcdb19SHeiko Stuebner
72734ca4ec6SEric Biggers# This symbol indicates that the toolchain supports all v1.0 vector crypto
72834ca4ec6SEric Biggers# extensions, including Zvk*, Zvbb, and Zvbc.  LLVM added all of these at once.
72934ca4ec6SEric Biggers# binutils added all except Zvkb, then added Zvkb.  So we just check for Zvkb.
73034ca4ec6SEric Biggersconfig TOOLCHAIN_HAS_VECTOR_CRYPTO
731886516faSEric Biggers	def_bool $(as-instr, .option arch$(comma) +v$(comma) +zvkb)
73234ca4ec6SEric Biggers	depends on AS_HAS_OPTION_ARCH
73334ca4ec6SEric Biggers
7348a2f20acSAlexandre Ghiticonfig TOOLCHAIN_HAS_ZBA
7358a2f20acSAlexandre Ghiti	bool
7368a2f20acSAlexandre Ghiti	default y
7378a2f20acSAlexandre Ghiti	depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64ima_zba)
7388a2f20acSAlexandre Ghiti	depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32ima_zba)
7398a2f20acSAlexandre Ghiti	depends on LLD_VERSION >= 150000 || LD_VERSION >= 23900
7408a2f20acSAlexandre Ghiti	depends on AS_HAS_OPTION_ARCH
7418a2f20acSAlexandre Ghiti
742c12603e7SXiao Wangconfig RISCV_ISA_ZBA
743c12603e7SXiao Wang	bool "Zba extension support for bit manipulation instructions"
744c12603e7SXiao Wang	default y
745c12603e7SXiao Wang	help
746c12603e7SXiao Wang	   Add support for enabling optimisations in the kernel when the Zba
747c12603e7SXiao Wang	   extension is detected at boot.
748c12603e7SXiao Wang
749c12603e7SXiao Wang	   The Zba extension provides instructions to accelerate the generation
750c12603e7SXiao Wang	   of addresses that index into arrays of basic data types.
751c12603e7SXiao Wang
752c12603e7SXiao Wang	   If you don't know what to do here, say Y.
753c12603e7SXiao Wang
754b6fcdb19SHeiko Stuebnerconfig RISCV_ISA_ZBB
755b6fcdb19SHeiko Stuebner	bool "Zbb extension support for bit manipulation instructions"
7561ee7fc3fSConor Dooley	depends on RISCV_ALTERNATIVE
757b6fcdb19SHeiko Stuebner	default y
758b6fcdb19SHeiko Stuebner	help
7596216182fSConor Dooley	   Add support for enabling optimisations in the kernel when the
7609343aabaSConor Dooley	   Zbb extension is detected at boot. Some optimisations may
7619343aabaSConor Dooley	   additionally depend on toolchain support for Zbb.
762b6fcdb19SHeiko Stuebner
763b6fcdb19SHeiko Stuebner	   The Zbb extension provides instructions to accelerate a number
764b6fcdb19SHeiko Stuebner	   of bit-specific operations (count bit population, sign extending,
765b6fcdb19SHeiko Stuebner	   bitrotation, etc).
766b6fcdb19SHeiko Stuebner
767b6fcdb19SHeiko Stuebner	   If you don't know what to do here, say Y.
7681631ba12SHeiko Stuebner
769a43fe27dSXiao Wangconfig TOOLCHAIN_HAS_ZBC
770a43fe27dSXiao Wang	bool
771a43fe27dSXiao Wang	default y
772a43fe27dSXiao Wang	depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64ima_zbc)
773a43fe27dSXiao Wang	depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32ima_zbc)
774a43fe27dSXiao Wang	depends on LLD_VERSION >= 150000 || LD_VERSION >= 23900
775a43fe27dSXiao Wang	depends on AS_HAS_OPTION_ARCH
776a43fe27dSXiao Wang
777a43fe27dSXiao Wangconfig RISCV_ISA_ZBC
778a43fe27dSXiao Wang	bool "Zbc extension support for carry-less multiplication instructions"
779a43fe27dSXiao Wang	depends on TOOLCHAIN_HAS_ZBC
780a43fe27dSXiao Wang	depends on MMU
781a43fe27dSXiao Wang	depends on RISCV_ALTERNATIVE
782a43fe27dSXiao Wang	default y
783a43fe27dSXiao Wang	help
784a43fe27dSXiao Wang	   Adds support to dynamically detect the presence of the Zbc
785a43fe27dSXiao Wang	   extension (carry-less multiplication) and enable its usage.
786a43fe27dSXiao Wang
787a43fe27dSXiao Wang	   The Zbc extension could accelerate CRC (cyclic redundancy check)
788a43fe27dSXiao Wang	   calculations.
789a43fe27dSXiao Wang
790a43fe27dSXiao Wang	   If you don't know what to do here, say Y.
791a43fe27dSXiao Wang
792a44fb572SCharlie Jenkinsconfig TOOLCHAIN_HAS_ZBKB
793a44fb572SCharlie Jenkins	bool
794a44fb572SCharlie Jenkins	default y
795a44fb572SCharlie Jenkins	depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64ima_zbkb)
796a44fb572SCharlie Jenkins	depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32ima_zbkb)
797a44fb572SCharlie Jenkins	depends on LLD_VERSION >= 150000 || LD_VERSION >= 23900
798a44fb572SCharlie Jenkins	depends on AS_HAS_OPTION_ARCH
799a44fb572SCharlie Jenkins
800a44fb572SCharlie Jenkinsconfig RISCV_ISA_ZBKB
801a44fb572SCharlie Jenkins	bool "Zbkb extension support for bit manipulation instructions"
802a44fb572SCharlie Jenkins	depends on TOOLCHAIN_HAS_ZBKB
803a44fb572SCharlie Jenkins	depends on RISCV_ALTERNATIVE
804a44fb572SCharlie Jenkins	default y
805a44fb572SCharlie Jenkins	help
806a44fb572SCharlie Jenkins	   Adds support to dynamically detect the presence of the ZBKB
807a44fb572SCharlie Jenkins	   extension (bit manipulation for cryptography) and enable its usage.
808a44fb572SCharlie Jenkins
809a44fb572SCharlie Jenkins	   The Zbkb extension provides instructions to accelerate a number
810a44fb572SCharlie Jenkins	   of common cryptography operations (pack, zip, etc).
811a44fb572SCharlie Jenkins
812a44fb572SCharlie Jenkins	   If you don't know what to do here, say Y.
813a44fb572SCharlie Jenkins
8141631ba12SHeiko Stuebnerconfig RISCV_ISA_ZICBOM
8151631ba12SHeiko Stuebner	bool "Zicbom extension support for non-coherent DMA operation"
8161ee7fc3fSConor Dooley	depends on MMU
8171ee7fc3fSConor Dooley	depends on RISCV_ALTERNATIVE
8181631ba12SHeiko Stuebner	default y
8195f365c13SConor Dooley	select RISCV_DMA_NONCOHERENT
820381cae16SChristoph Hellwig	select DMA_DIRECT_REMAP
8211631ba12SHeiko Stuebner	help
8226216182fSConor Dooley	   Add support for the Zicbom extension (Cache Block Management
8236216182fSConor Dooley	   Operations) and enable its use in the kernel when it is detected
8246216182fSConor Dooley	   at boot.
8251631ba12SHeiko Stuebner
8261631ba12SHeiko Stuebner	   The Zicbom extension can be used to handle for example
8271631ba12SHeiko Stuebner	   non-coherent DMA support on devices that need it.
8281631ba12SHeiko Stuebner
8291631ba12SHeiko Stuebner	   If you don't know what to do here, say Y.
8301631ba12SHeiko Stuebner
831ab0f7746SAndrew Jonesconfig RISCV_ISA_ZICBOZ
832ab0f7746SAndrew Jones	bool "Zicboz extension support for faster zeroing of memory"
833d34a6b71SConor Dooley	depends on RISCV_ALTERNATIVE
834ab0f7746SAndrew Jones	default y
835ab0f7746SAndrew Jones	help
8365464912cSConor Dooley	   Enable the use of the Zicboz extension (cbo.zero instruction)
8376216182fSConor Dooley	   in the kernel when it is detected at boot.
838ab0f7746SAndrew Jones
839ab0f7746SAndrew Jones	   The Zicboz extension is used for faster zeroing of memory.
840ab0f7746SAndrew Jones
841ab0f7746SAndrew Jones	   If you don't know what to do here, say Y.
842ab0f7746SAndrew Jones
8438d496b5aSAlexandre Ghiticonfig RISCV_ISA_ZICBOP
8448d496b5aSAlexandre Ghiti	bool "Zicbop extension support for cache block prefetch"
8458d496b5aSAlexandre Ghiti	depends on MMU
8468d496b5aSAlexandre Ghiti	depends on RISCV_ALTERNATIVE
8478d496b5aSAlexandre Ghiti	default y
8488d496b5aSAlexandre Ghiti	help
8498d496b5aSAlexandre Ghiti	  Adds support to dynamically detect the presence of the ZICBOP
8508d496b5aSAlexandre Ghiti	  extension (Cache Block Prefetch Operations) and enable its
8518d496b5aSAlexandre Ghiti	  usage.
8528d496b5aSAlexandre Ghiti
8538d496b5aSAlexandre Ghiti	  The Zicbop extension can be used to prefetch cache blocks for
8548d496b5aSAlexandre Ghiti	  read/write fetch.
8558d496b5aSAlexandre Ghiti
8568d496b5aSAlexandre Ghiti	  If you don't know what to do here, say Y.
8578d496b5aSAlexandre Ghiti
858e89c2e81SNathan Chancellorconfig TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI
859e89c2e81SNathan Chancellor	def_bool y
860e89c2e81SNathan Chancellor	# https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=aed44286efa8ae8717a77d94b51ac3614e2ca6dc
861ca09f772SMingzheng Xing	# https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=98416dbb0a62579d4a7a4a76bab51b5b52fec2cd
862ca09f772SMingzheng Xing	depends on AS_IS_GNU && AS_VERSION >= 23600
863e89c2e81SNathan Chancellor	help
864ca09f772SMingzheng Xing	  Binutils-2.38 and GCC-12.1.0 bumped the default ISA spec to the newer
865ca09f772SMingzheng Xing	  20191213 version, which moves some instructions from the I extension to
866ca09f772SMingzheng Xing	  the Zicsr and Zifencei extensions. This requires explicitly specifying
867ca09f772SMingzheng Xing	  Zicsr and Zifencei when binutils >= 2.38 or GCC >= 12.1.0. Zicsr
868ca09f772SMingzheng Xing	  and Zifencei are supported in binutils from version 2.36 onwards.
869ca09f772SMingzheng Xing	  To make life easier, and avoid forcing toolchains that default to a
870ca09f772SMingzheng Xing	  newer ISA spec to version 2.2, relax the check to binutils >= 2.36.
871ef21fa7cSMingzheng Xing	  For clang < 17 or GCC < 11.3.0, for which this is not possible or need
872ef21fa7cSMingzheng Xing	  special treatment, this is dealt with in TOOLCHAIN_NEEDS_OLD_ISA_SPEC.
873e89c2e81SNathan Chancellor
874e89c2e81SNathan Chancellorconfig TOOLCHAIN_NEEDS_OLD_ISA_SPEC
875e89c2e81SNathan Chancellor	def_bool y
876e89c2e81SNathan Chancellor	depends on TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI
877e89c2e81SNathan Chancellor	# https://github.com/llvm/llvm-project/commit/22e199e6afb1263c943c0c0d4498694e15bf8a16
878ef21fa7cSMingzheng Xing	# https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=d29f5d6ab513c52fd872f532c492e35ae9fd6671
879ef21fa7cSMingzheng Xing	depends on (CC_IS_CLANG && CLANG_VERSION < 170000) || (CC_IS_GCC && GCC_VERSION < 110300)
880e89c2e81SNathan Chancellor	help
881ca09f772SMingzheng Xing	  Certain versions of clang and GCC do not support zicsr and zifencei via
882ca09f772SMingzheng Xing	  -march. This option causes an older ISA spec compatible with these older
883ca09f772SMingzheng Xing	  versions of clang and GCC to be passed to GAS, which has the same result
884ca09f772SMingzheng Xing	  as passing zicsr and zifencei to -march.
885e89c2e81SNathan Chancellor
8869671f706SAlan Kaoconfig FPU
8879671f706SAlan Kao	bool "FPU support"
8889671f706SAlan Kao	default y
8899671f706SAlan Kao	help
8906216182fSConor Dooley	  Add support for floating point operations when an FPU is detected at
8916216182fSConor Dooley	  boot. When this option is disabled, neither the kernel nor userspace
8926216182fSConor Dooley	  may use the floating point unit.
8939671f706SAlan Kao
8949671f706SAlan Kao	  If you don't know what to do here, say Y.
8959671f706SAlan Kao
896163e76ccSGuo Renconfig IRQ_STACKS
897dd69d07aSGuo Ren	bool "Independent irq & softirq stacks" if EXPERT
898163e76ccSGuo Ren	default y
899163e76ccSGuo Ren	select HAVE_IRQ_EXIT_ON_IRQ_STACK
900dd69d07aSGuo Ren	select HAVE_SOFTIRQ_ON_OWN_STACK
901163e76ccSGuo Ren	help
902dd69d07aSGuo Ren	  Add independent irq & softirq stacks for percpu to prevent kernel stack
903dd69d07aSGuo Ren	  overflows. We may save some memory footprint by disabling IRQ_STACKS.
904163e76ccSGuo Ren
905a7555f6bSGuo Renconfig THREAD_SIZE_ORDER
906a7555f6bSGuo Ren	int "Kernel stack size (in power-of-two numbers of page size)" if VMAP_STACK && EXPERT
907a7555f6bSGuo Ren	range 0 4
908cfb10de1SAlexandre Ghiti	default 1 if 32BIT
909a7555f6bSGuo Ren	default 2
910a7555f6bSGuo Ren	help
911a7555f6bSGuo Ren	  Specify the Pages of thread stack size (from 4KB to 64KB), which also
912a7555f6bSGuo Ren	  affects irq stack size, which is equal to thread stack size.
913a7555f6bSGuo Ren
9147c832321SClément Légerconfig RISCV_MISALIGNED
915f413aae9SCharlie Jenkins	bool
916d1703dc7SJesse Taube	help
917d1703dc7SJesse Taube	  Embed support for detecting and emulating misaligned
918d1703dc7SJesse Taube	  scalar or vector loads and stores.
919d1703dc7SJesse Taube
920c05a62c9SJesse Taubeconfig RISCV_SCALAR_MISALIGNED
9217c832321SClément Léger	bool
922d1703dc7SJesse Taube	select RISCV_MISALIGNED
923bc38f613SClément Léger	select SYSCTL_ARCH_UNALIGN_ALLOW
9247c832321SClément Léger	help
925f413aae9SCharlie Jenkins	  Embed support for emulating misaligned loads and stores.
926f413aae9SCharlie Jenkins
927d1703dc7SJesse Taubeconfig RISCV_VECTOR_MISALIGNED
928d1703dc7SJesse Taube	bool
929d1703dc7SJesse Taube	select RISCV_MISALIGNED
930d1703dc7SJesse Taube	depends on RISCV_ISA_V
931d1703dc7SJesse Taube	help
932d1703dc7SJesse Taube	  Enable detecting support for vector misaligned loads and stores.
933d1703dc7SJesse Taube
934f413aae9SCharlie Jenkinschoice
935f413aae9SCharlie Jenkins	prompt "Unaligned Accesses Support"
936f413aae9SCharlie Jenkins	default RISCV_PROBE_UNALIGNED_ACCESS
937f413aae9SCharlie Jenkins	help
938f413aae9SCharlie Jenkins	  This determines the level of support for unaligned accesses. This
939f413aae9SCharlie Jenkins	  information is used by the kernel to perform optimizations. It is also
940f413aae9SCharlie Jenkins	  exposed to user space via the hwprobe syscall. The hardware will be
941f413aae9SCharlie Jenkins	  probed at boot by default.
942f413aae9SCharlie Jenkins
943f413aae9SCharlie Jenkinsconfig RISCV_PROBE_UNALIGNED_ACCESS
944f413aae9SCharlie Jenkins	bool "Probe for hardware unaligned access support"
945c05a62c9SJesse Taube	select RISCV_SCALAR_MISALIGNED
946f413aae9SCharlie Jenkins	help
947f413aae9SCharlie Jenkins	  During boot, the kernel will run a series of tests to determine the
948f413aae9SCharlie Jenkins	  speed of unaligned accesses. This probing will dynamically determine
949f413aae9SCharlie Jenkins	  the speed of unaligned accesses on the underlying system. If unaligned
950f413aae9SCharlie Jenkins	  memory accesses trap into the kernel as they are not supported by the
951f413aae9SCharlie Jenkins	  system, the kernel will emulate the unaligned accesses to preserve the
952f413aae9SCharlie Jenkins	  UABI.
953f413aae9SCharlie Jenkins
954f413aae9SCharlie Jenkinsconfig RISCV_EMULATED_UNALIGNED_ACCESS
955f413aae9SCharlie Jenkins	bool "Emulate unaligned access where system support is missing"
956c05a62c9SJesse Taube	select RISCV_SCALAR_MISALIGNED
957f413aae9SCharlie Jenkins	help
958f413aae9SCharlie Jenkins	  If unaligned memory accesses trap into the kernel as they are not
959f413aae9SCharlie Jenkins	  supported by the system, the kernel will emulate the unaligned
960f413aae9SCharlie Jenkins	  accesses to preserve the UABI. When the underlying system does support
961f413aae9SCharlie Jenkins	  unaligned accesses, the unaligned accesses are assumed to be slow.
962f413aae9SCharlie Jenkins
963f413aae9SCharlie Jenkinsconfig RISCV_SLOW_UNALIGNED_ACCESS
964f413aae9SCharlie Jenkins	bool "Assume the system supports slow unaligned memory accesses"
965f413aae9SCharlie Jenkins	depends on NONPORTABLE
966f413aae9SCharlie Jenkins	help
967f413aae9SCharlie Jenkins	  Assume that the system supports slow unaligned memory accesses. The
968f413aae9SCharlie Jenkins	  kernel and userspace programs may not be able to run at all on systems
969f413aae9SCharlie Jenkins	  that do not support unaligned memory accesses.
9707c832321SClément Léger
971b6da6cbeSJisheng Zhangconfig RISCV_EFFICIENT_UNALIGNED_ACCESS
972f413aae9SCharlie Jenkins	bool "Assume the system supports fast unaligned memory accesses"
973b6da6cbeSJisheng Zhang	depends on NONPORTABLE
974d0fdc20bSJisheng Zhang	select DCACHE_WORD_ACCESS if MMU
975b6da6cbeSJisheng Zhang	select HAVE_EFFICIENT_UNALIGNED_ACCESS
976b6da6cbeSJisheng Zhang	help
977f413aae9SCharlie Jenkins	  Assume that the system supports fast unaligned memory accesses. When
978f413aae9SCharlie Jenkins	  enabled, this option improves the performance of the kernel on such
979f413aae9SCharlie Jenkins	  systems. However, the kernel and userspace programs will run much more
980f413aae9SCharlie Jenkins	  slowly, or will not be able to run at all, on systems that do not
981f413aae9SCharlie Jenkins	  support efficient unaligned memory accesses.
982b6da6cbeSJisheng Zhang
983f413aae9SCharlie Jenkinsendchoice
984b6da6cbeSJisheng Zhang
985d1703dc7SJesse Taubechoice
986d1703dc7SJesse Taube	prompt "Vector unaligned Accesses Support"
987d1703dc7SJesse Taube	depends on RISCV_ISA_V
988d1703dc7SJesse Taube	default RISCV_PROBE_VECTOR_UNALIGNED_ACCESS
989d1703dc7SJesse Taube	help
990d1703dc7SJesse Taube	  This determines the level of support for vector unaligned accesses. This
991d1703dc7SJesse Taube	  information is used by the kernel to perform optimizations. It is also
992d1703dc7SJesse Taube	  exposed to user space via the hwprobe syscall. The hardware will be
993d1703dc7SJesse Taube	  probed at boot by default.
994d1703dc7SJesse Taube
995d1703dc7SJesse Taubeconfig RISCV_PROBE_VECTOR_UNALIGNED_ACCESS
996d1703dc7SJesse Taube	bool "Probe speed of vector unaligned accesses"
997d1703dc7SJesse Taube	select RISCV_VECTOR_MISALIGNED
998d1703dc7SJesse Taube	depends on RISCV_ISA_V
999d1703dc7SJesse Taube	help
1000d1703dc7SJesse Taube	  During boot, the kernel will run a series of tests to determine the
1001d1703dc7SJesse Taube	  speed of vector unaligned accesses if they are supported. This probing
1002d1703dc7SJesse Taube	  will dynamically determine the speed of vector unaligned accesses on
1003d1703dc7SJesse Taube	  the underlying system if they are supported.
1004d1703dc7SJesse Taube
1005e7c9d66eSJesse Taubeconfig RISCV_SLOW_VECTOR_UNALIGNED_ACCESS
1006e7c9d66eSJesse Taube	bool "Assume the system supports slow vector unaligned memory accesses"
1007e7c9d66eSJesse Taube	depends on NONPORTABLE
1008e7c9d66eSJesse Taube	help
1009e7c9d66eSJesse Taube	  Assume that the system supports slow vector unaligned memory accesses. The
1010e7c9d66eSJesse Taube	  kernel and userspace programs may not be able to run at all on systems
1011e7c9d66eSJesse Taube	  that do not support unaligned memory accesses.
1012e7c9d66eSJesse Taube
1013e7c9d66eSJesse Taubeconfig RISCV_EFFICIENT_VECTOR_UNALIGNED_ACCESS
1014e7c9d66eSJesse Taube	bool "Assume the system supports fast vector unaligned memory accesses"
1015e7c9d66eSJesse Taube	depends on NONPORTABLE
1016e7c9d66eSJesse Taube	help
1017e7c9d66eSJesse Taube	  Assume that the system supports fast vector unaligned memory accesses. When
1018e7c9d66eSJesse Taube	  enabled, this option improves the performance of the kernel on such
1019e7c9d66eSJesse Taube	  systems. However, the kernel and userspace programs will run much more
1020e7c9d66eSJesse Taube	  slowly, or will not be able to run at all, on systems that do not
1021e7c9d66eSJesse Taube	  support efficient unaligned memory accesses.
1022e7c9d66eSJesse Taube
1023d1703dc7SJesse Taubeendchoice
1024d1703dc7SJesse Taube
102523c996fcSCharlie Jenkinssource "arch/riscv/Kconfig.vendor"
102623c996fcSCharlie Jenkins
10272f66a3d0SJuerg Haefligerendmenu # "Platform type"
1028fbe934d6SPalmer Dabbelt
1029aef53f97SNick Kossifidismenu "Kernel features"
1030fbe934d6SPalmer Dabbelt
1031fbe934d6SPalmer Dabbeltsource "kernel/Kconfig.hz"
1032fbe934d6SPalmer Dabbelt
1033efca1398SAtish Patraconfig RISCV_SBI_V01
1034efca1398SAtish Patra	bool "SBI v0.1 support"
1035efca1398SAtish Patra	depends on RISCV_SBI
1036efca1398SAtish Patra	help
1037efca1398SAtish Patra	  This config allows kernel to use SBI v0.1 APIs. This will be
1038efca1398SAtish Patra	  deprecated in future once legacy M-mode software are no longer in use.
1039fba8a867SNick Kossifidis
10402ffc48fcSAtish Patraconfig RISCV_BOOT_SPINWAIT
10412ffc48fcSAtish Patra	bool "Spinwait booting method"
10422ffc48fcSAtish Patra	depends on SMP
104377d707a3SPalmer Dabbelt	default y if RISCV_SBI_V01 || RISCV_M_MODE
10442ffc48fcSAtish Patra	help
10452ffc48fcSAtish Patra	  This enables support for booting Linux via spinwait method. In the
10462ffc48fcSAtish Patra	  spinwait method, all cores randomly jump to Linux. One of the cores
10472ffc48fcSAtish Patra	  gets chosen via lottery and all other keep spinning on a percpu
10482ffc48fcSAtish Patra	  variable. This method cannot support CPU hotplug and sparse hartid
10492ffc48fcSAtish Patra	  scheme. It should be only enabled for M-mode Linux or platforms relying
10502ffc48fcSAtish Patra	  on older firmware without SBI HSM extension. All other platforms should
10512ffc48fcSAtish Patra	  rely on ordered booting via SBI HSM extension which gets chosen
10522ffc48fcSAtish Patra	  dynamically at runtime if the firmware supports it.
10532ffc48fcSAtish Patra
105477d707a3SPalmer Dabbelt	  Since spinwait is incompatible with sparse hart IDs, it requires
105577d707a3SPalmer Dabbelt	  NR_CPUS be large enough to contain the physical hart ID of the first
105677d707a3SPalmer Dabbelt	  hart to enter Linux.
105777d707a3SPalmer Dabbelt
105877d707a3SPalmer Dabbelt	  If unsure what to do here, say N.
105977d707a3SPalmer Dabbelt
10601f0d6efeSEric DeVolderconfig ARCH_SUPPORTS_KEXEC
1061c41bd251SIgnat Korchagin	def_bool y
10621f0d6efeSEric DeVolder
10631f0d6efeSEric DeVolderconfig ARCH_SELECTS_KEXEC
10641f0d6efeSEric DeVolder	def_bool y
10651f0d6efeSEric DeVolder	depends on KEXEC
10665f365c13SConor Dooley	select HOTPLUG_CPU if SMP
1067fba8a867SNick Kossifidis
10681f0d6efeSEric DeVolderconfig ARCH_SUPPORTS_KEXEC_FILE
1069c41bd251SIgnat Korchagin	def_bool 64BIT
1070fba8a867SNick Kossifidis
10711f0d6efeSEric DeVolderconfig ARCH_SELECTS_KEXEC_FILE
10721f0d6efeSEric DeVolder	def_bool y
10731f0d6efeSEric DeVolder	depends on KEXEC_FILE
10745f365c13SConor Dooley	select HAVE_IMA_KEXEC if IMA
10756261586eSLiao Chang	select KEXEC_ELF
10766261586eSLiao Chang
1077e6265fe7SEric DeVolderconfig ARCH_SUPPORTS_KEXEC_PURGATORY
1078c1ad12eeSArnd Bergmann	def_bool ARCH_SUPPORTS_KEXEC_FILE
1079736e30afSLi Zhengyu
10801f0d6efeSEric DeVolderconfig ARCH_SUPPORTS_CRASH_DUMP
10811f0d6efeSEric DeVolder	def_bool y
1082fba8a867SNick Kossifidis
108331daa343SDave Vasilevskyconfig ARCH_DEFAULT_CRASH_DUMP
108431daa343SDave Vasilevsky	def_bool y
108531daa343SDave Vasilevsky
108639365395SBaoquan Heconfig ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION
108785fcde40SBaoquan He	def_bool CRASH_RESERVE
108839365395SBaoquan He
10899be84592SGuo Renconfig COMPAT
10909be84592SGuo Ren	bool "Kernel support for 32-bit U-mode"
10919be84592SGuo Ren	default 64BIT
10929be84592SGuo Ren	depends on 64BIT && MMU
10939be84592SGuo Ren	help
10949be84592SGuo Ren	  This option enables support for a 32-bit U-mode running under a 64-bit
10959be84592SGuo Ren	  kernel at S-mode. riscv32-specific components such as system calls,
10969be84592SGuo Ren	  the user helper functions (vdso), signal rt_frame functions and the
10979be84592SGuo Ren	  ptrace interface are handled appropriately by the kernel.
10989be84592SGuo Ren
10999be84592SGuo Ren	  If you want to execute 32-bit userspace applications, say Y.
11009be84592SGuo Ren
1101fdf68accSAndrew Jonesconfig PARAVIRT
1102fdf68accSAndrew Jones	bool "Enable paravirtualization code"
1103fdf68accSAndrew Jones	depends on RISCV_SBI
1104fdf68accSAndrew Jones	help
1105fdf68accSAndrew Jones	  This changes the kernel so it can modify itself when it is run
1106fdf68accSAndrew Jones	  under a hypervisor, potentially improving performance significantly
1107fdf68accSAndrew Jones	  over full virtualization.
1108fdf68accSAndrew Jones
1109fdf68accSAndrew Jonesconfig PARAVIRT_TIME_ACCOUNTING
1110fdf68accSAndrew Jones	bool "Paravirtual steal time accounting"
1111fdf68accSAndrew Jones	depends on PARAVIRT
1112fdf68accSAndrew Jones	help
1113fdf68accSAndrew Jones	  Select this option to enable fine granularity task steal time
1114fdf68accSAndrew Jones	  accounting. Time spent executing other tasks in parallel with
1115fdf68accSAndrew Jones	  the current vCPU is discounted from the vCPU power. To account for
1116fdf68accSAndrew Jones	  that, there can be a small performance impact.
1117fdf68accSAndrew Jones
1118fdf68accSAndrew Jones	  If in doubt, say N here.
1119fdf68accSAndrew Jones
112039b33072SAlexandre Ghiticonfig RELOCATABLE
112139b33072SAlexandre Ghiti	bool "Build a relocatable kernel"
1122ea2bde36SSamuel Holland	depends on !XIP_KERNEL
11232aff5f95SQingfang Deng	select MODULE_SECTIONS if MODULES
11249b400d17SArd Biesheuvel	select ARCH_VMLINUX_NEEDS_RELOCS
112539b33072SAlexandre Ghiti	help
112639b33072SAlexandre Ghiti          This builds a kernel as a Position Independent Executable (PIE),
112739b33072SAlexandre Ghiti          which retains all relocation metadata required to relocate the
112839b33072SAlexandre Ghiti          kernel binary at runtime to a different virtual address than the
112939b33072SAlexandre Ghiti          address it was linked at.
113039b33072SAlexandre Ghiti          Since RISCV uses the RELA relocation format, this requires a
113139b33072SAlexandre Ghiti          relocation pass at runtime even if the kernel is loaded at the
113239b33072SAlexandre Ghiti          same address it was linked at.
113339b33072SAlexandre Ghiti
113439b33072SAlexandre Ghiti          If unsure, say N.
113539b33072SAlexandre Ghiti
113684fe419dSAlexandre Ghiticonfig RANDOMIZE_BASE
113784fe419dSAlexandre Ghiti        bool "Randomize the address of the kernel image"
113884fe419dSAlexandre Ghiti        select RELOCATABLE
113984fe419dSAlexandre Ghiti        depends on MMU && 64BIT && !XIP_KERNEL
114084fe419dSAlexandre Ghiti        help
114184fe419dSAlexandre Ghiti          Randomizes the virtual address at which the kernel image is
114284fe419dSAlexandre Ghiti          loaded, as a security feature that deters exploit attempts
114384fe419dSAlexandre Ghiti          relying on knowledge of the location of kernel internals.
114484fe419dSAlexandre Ghiti
114584fe419dSAlexandre Ghiti          It is the bootloader's job to provide entropy, by passing a
114684fe419dSAlexandre Ghiti          random u64 value in /chosen/kaslr-seed at kernel entry.
114784fe419dSAlexandre Ghiti
114884fe419dSAlexandre Ghiti          When booting via the UEFI stub, it will invoke the firmware's
114984fe419dSAlexandre Ghiti          EFI_RNG_PROTOCOL implementation (if available) to supply entropy
115084fe419dSAlexandre Ghiti          to the kernel proper. In addition, it will randomise the physical
115184fe419dSAlexandre Ghiti          location of the kernel Image as well.
115284fe419dSAlexandre Ghiti
115384fe419dSAlexandre Ghiti          If unsure, say N.
115484fe419dSAlexandre Ghiti
11552f66a3d0SJuerg Haefligerendmenu # "Kernel features"
1156fbe934d6SPalmer Dabbelt
1157aef53f97SNick Kossifidismenu "Boot options"
1158aef53f97SNick Kossifidis
1159aef53f97SNick Kossifidisconfig CMDLINE
11603aed8c43SNick Kossifidis	string "Built-in kernel command line"
1161aef53f97SNick Kossifidis	help
11623aed8c43SNick Kossifidis	  For most platforms, the arguments for the kernel's command line
11633aed8c43SNick Kossifidis	  are provided at run-time, during boot. However, there are cases
11643aed8c43SNick Kossifidis	  where either no arguments are being provided or the provided
11653aed8c43SNick Kossifidis	  arguments are insufficient or even invalid.
11663aed8c43SNick Kossifidis
11673aed8c43SNick Kossifidis	  When that occurs, it is possible to define a built-in command
11683aed8c43SNick Kossifidis	  line here and choose how the kernel should use it later on.
11693aed8c43SNick Kossifidis
11703aed8c43SNick Kossifidischoice
1171b9d73218SMasahiro Yamada	prompt "Built-in command line usage"
1172b9d73218SMasahiro Yamada	depends on CMDLINE != ""
11733aed8c43SNick Kossifidis	default CMDLINE_FALLBACK
11743aed8c43SNick Kossifidis	help
11753aed8c43SNick Kossifidis	  Choose how the kernel will handle the provided built-in command
11763aed8c43SNick Kossifidis	  line.
11773aed8c43SNick Kossifidis
11783aed8c43SNick Kossifidisconfig CMDLINE_FALLBACK
11793aed8c43SNick Kossifidis	bool "Use bootloader kernel arguments if available"
11803aed8c43SNick Kossifidis	help
11813aed8c43SNick Kossifidis	  Use the built-in command line as fallback in case we get nothing
11823aed8c43SNick Kossifidis	  during boot. This is the default behaviour.
11833aed8c43SNick Kossifidis
11843aed8c43SNick Kossifidisconfig CMDLINE_EXTEND
11853aed8c43SNick Kossifidis	bool "Extend bootloader kernel arguments"
11863aed8c43SNick Kossifidis	help
118748d9aabfS谢致邦 (XIE Zhibang)	  The built-in command line will be appended to the command-
118848d9aabfS谢致邦 (XIE Zhibang)	  line arguments provided during boot. This is useful in
11893aed8c43SNick Kossifidis	  cases where the provided arguments are insufficient and
11903aed8c43SNick Kossifidis	  you don't want to or cannot modify them.
11913aed8c43SNick Kossifidis
1192aef53f97SNick Kossifidisconfig CMDLINE_FORCE
11933aed8c43SNick Kossifidis	bool "Always use the default kernel command string"
1194aef53f97SNick Kossifidis	help
11953aed8c43SNick Kossifidis	  Always use the built-in command line, even if we get one during
11963aed8c43SNick Kossifidis	  boot. This is useful in case you need to override the provided
11973aed8c43SNick Kossifidis	  command line on systems where you don't have or want control
11983aed8c43SNick Kossifidis	  over it.
1199aef53f97SNick Kossifidis
12003aed8c43SNick Kossifidisendchoice
1201aef53f97SNick Kossifidis
1202d7071743SAtish Patraconfig EFI_STUB
1203d7071743SAtish Patra	bool
1204d7071743SAtish Patra
1205d7071743SAtish Patraconfig EFI
1206d7071743SAtish Patra	bool "UEFI runtime support"
120744c92257SVitaly Wool	depends on OF && !XIP_KERNEL
1208b91540d5SAtish Patra	depends on MMU
1209d7071743SAtish Patra	default y
1210a91a9ffbSSunil V L	select ARCH_SUPPORTS_ACPI if 64BIT
12115f365c13SConor Dooley	select EFI_GENERIC_STUB
12125f365c13SConor Dooley	select EFI_PARAMS_FROM_FDT
12135f365c13SConor Dooley	select EFI_RUNTIME_WRAPPERS
12145f365c13SConor Dooley	select EFI_STUB
12155f365c13SConor Dooley	select LIBFDT
12165f365c13SConor Dooley	select RISCV_ISA_C
12175f365c13SConor Dooley	select UCS2_STRING
1218d7071743SAtish Patra	help
1219d7071743SAtish Patra	  This option provides support for runtime services provided
1220d7071743SAtish Patra	  by UEFI firmware (such as non-volatile variables, realtime
1221d7071743SAtish Patra	  clock, and platform reset). A UEFI stub is also provided to
1222d7071743SAtish Patra	  allow the kernel to be booted as an EFI application. This
1223d7071743SAtish Patra	  is only useful on systems that have UEFI firmware.
1224d7071743SAtish Patra
1225d6ecd188SHaibo Xuconfig DMI
1226d6ecd188SHaibo Xu	bool "Enable support for SMBIOS (DMI) tables"
1227d6ecd188SHaibo Xu	depends on EFI
1228d6ecd188SHaibo Xu	default y
1229d6ecd188SHaibo Xu	help
1230d6ecd188SHaibo Xu	  This enables SMBIOS/DMI feature for systems.
1231d6ecd188SHaibo Xu
1232d6ecd188SHaibo Xu	  This option is only useful on systems that have UEFI firmware.
1233d6ecd188SHaibo Xu	  However, even with this option, the resultant kernel should
1234d6ecd188SHaibo Xu	  continue to boot on existing non-UEFI platforms.
1235d6ecd188SHaibo Xu
1236fea2fed2SGuo Renconfig CC_HAVE_STACKPROTECTOR_TLS
1237fea2fed2SGuo Ren	def_bool $(cc-option,-mstack-protector-guard=tls -mstack-protector-guard-reg=tp -mstack-protector-guard-offset=0)
1238fea2fed2SGuo Ren
1239fea2fed2SGuo Renconfig STACKPROTECTOR_PER_TASK
1240fea2fed2SGuo Ren	def_bool y
1241595b893eSKees Cook	depends on !RANDSTRUCT
1242fea2fed2SGuo Ren	depends on STACKPROTECTOR && CC_HAVE_STACKPROTECTOR_TLS
1243fea2fed2SGuo Ren
1244867432beSAlexandre Ghiticonfig PHYS_RAM_BASE_FIXED
1245867432beSAlexandre Ghiti	bool "Explicitly specified physical RAM address"
124644c1e84aSPalmer Dabbelt	depends on NONPORTABLE
1247867432beSAlexandre Ghiti	default n
1248867432beSAlexandre Ghiti
124944c92257SVitaly Woolconfig PHYS_RAM_BASE
125044c92257SVitaly Wool	hex "Platform Physical RAM address"
1251867432beSAlexandre Ghiti	depends on PHYS_RAM_BASE_FIXED
125244c92257SVitaly Wool	default "0x80000000"
125344c92257SVitaly Wool	help
125444c92257SVitaly Wool	  This is the physical address of RAM in the system. It has to be
125544c92257SVitaly Wool	  explicitly specified to run early relocations of read-write data
125644c92257SVitaly Wool	  from flash to RAM.
125744c92257SVitaly Wool
125844c92257SVitaly Woolconfig XIP_KERNEL
125944c92257SVitaly Wool	bool "Kernel Execute-In-Place from ROM"
126044c1e84aSPalmer Dabbelt	depends on MMU && SPARSEMEM && NONPORTABLE
126144c92257SVitaly Wool	# This prevents XIP from being enabled by all{yes,mod}config, which
126244c92257SVitaly Wool	# fail to build since XIP doesn't support large kernels.
126344c92257SVitaly Wool	depends on !COMPILE_TEST
1264867432beSAlexandre Ghiti	select PHYS_RAM_BASE_FIXED
126544c92257SVitaly Wool	help
126644c92257SVitaly Wool	  Execute-In-Place allows the kernel to run from non-volatile storage
126744c92257SVitaly Wool	  directly addressable by the CPU, such as NOR flash. This saves RAM
126844c92257SVitaly Wool	  space since the text section of the kernel is not loaded from flash
126944c92257SVitaly Wool	  to RAM.  Read-write sections, such as the data section and stack,
127044c92257SVitaly Wool	  are still copied to RAM.  The XIP kernel is not compressed since
127144c92257SVitaly Wool	  it has to run directly from flash, so it will take more space to
127244c92257SVitaly Wool	  store it.  The flash address used to link the kernel object files,
127344c92257SVitaly Wool	  and for storing it, is configuration dependent. Therefore, if you
127444c92257SVitaly Wool	  say Y here, you must know the proper physical address where to
127544c92257SVitaly Wool	  store the kernel image depending on your own flash memory usage.
127644c92257SVitaly Wool
127744c92257SVitaly Wool	  Also note that the make target becomes "make xipImage" rather than
127844c92257SVitaly Wool	  "make zImage" or "make Image".  The final kernel binary to put in
127944c92257SVitaly Wool	  ROM memory will be arch/riscv/boot/xipImage.
128044c92257SVitaly Wool
128144c92257SVitaly Wool	  SPARSEMEM is required because the kernel text and rodata that are
128244c92257SVitaly Wool	  flash resident are not backed by memmap, then any attempt to get
128344c92257SVitaly Wool	  a struct page on those regions will trigger a fault.
128444c92257SVitaly Wool
128544c92257SVitaly Wool	  If unsure, say N.
128644c92257SVitaly Wool
128744c92257SVitaly Woolconfig XIP_PHYS_ADDR
128844c92257SVitaly Wool	hex "XIP Kernel Physical Location"
128944c92257SVitaly Wool	depends on XIP_KERNEL
129044c92257SVitaly Wool	default "0x21000000"
129144c92257SVitaly Wool	help
129244c92257SVitaly Wool	  This is the physical address in your flash memory the kernel will
129344c92257SVitaly Wool	  be linked for and stored to.  This address is dependent on your
129444c92257SVitaly Wool	  own flash usage.
129544c92257SVitaly Wool
1296496ea826SConor Dooleyconfig RISCV_ISA_FALLBACK
1297496ea826SConor Dooley	bool "Permit falling back to parsing riscv,isa for extension support by default"
1298496ea826SConor Dooley	default y
1299496ea826SConor Dooley	help
1300496ea826SConor Dooley	  Parsing the "riscv,isa" devicetree property has been deprecated and
1301496ea826SConor Dooley	  replaced by a list of explicitly defined strings. For compatibility
1302496ea826SConor Dooley	  with existing platforms, the kernel will fall back to parsing the
1303496ea826SConor Dooley	  "riscv,isa" property if the replacements are not found.
1304496ea826SConor Dooley
1305496ea826SConor Dooley	  Selecting N here will result in a kernel that does not use the
1306496ea826SConor Dooley	  fallback, unless the commandline "riscv_isa_fallback" parameter is
1307496ea826SConor Dooley	  present.
1308496ea826SConor Dooley
1309496ea826SConor Dooley	  Please see the dt-binding, located at
1310496ea826SConor Dooley	  Documentation/devicetree/bindings/riscv/extensions.yaml for details
1311496ea826SConor Dooley	  on the replacement properties, "riscv,isa-base" and
1312496ea826SConor Dooley	  "riscv,isa-extensions".
1313496ea826SConor Dooley
13142d268251SPalmer Dabbeltconfig BUILTIN_DTB
13156c4a2f63SFrederik Haxel	bool "Built-in device tree"
131644c1e84aSPalmer Dabbelt	depends on OF && NONPORTABLE
131782e81b89SMasahiro Yamada	select GENERIC_BUILTIN_DTB
13182672031bSYangyu Chen	help
13192672031bSYangyu Chen	  Build a device tree into the Linux image.
13202672031bSYangyu Chen	  This option should be selected if no bootloader is being used.
13212672031bSYangyu Chen	  If unsure, say N.
13222672031bSYangyu Chen
13232672031bSYangyu Chen
132482e81b89SMasahiro Yamadaconfig BUILTIN_DTB_NAME
13252672031bSYangyu Chen	string "Built-in device tree source"
13262672031bSYangyu Chen	depends on BUILTIN_DTB
13272672031bSYangyu Chen	help
13282672031bSYangyu Chen	  DTS file path (without suffix, relative to arch/riscv/boot/dts)
13292672031bSYangyu Chen	  for the DTS file that will be used to produce the DTB linked into the
13302672031bSYangyu Chen	  kernel.
13312d268251SPalmer Dabbelt
13326c4a2f63SFrederik Haxelendmenu # "Boot options"
13336c4a2f63SFrederik Haxel
133444c1e84aSPalmer Dabbeltconfig PORTABLE
133544c1e84aSPalmer Dabbelt	bool
133644c1e84aSPalmer Dabbelt	default !NONPORTABLE
133744c1e84aSPalmer Dabbelt	select EFI
133844c1e84aSPalmer Dabbelt	select MMU
13395f365c13SConor Dooley	select OF
134044c1e84aSPalmer Dabbelt
1341e0c0a7c3SAndreas Schwabconfig ARCH_PROC_KCORE_TEXT
1342e0c0a7c3SAndreas Schwab	def_bool y
1343e0c0a7c3SAndreas Schwab
1344fbe934d6SPalmer Dabbeltmenu "Power management options"
1345fbe934d6SPalmer Dabbelt
13468636a1f9SMasahiro Yamadasource "kernel/power/Kconfig"
1347fbe934d6SPalmer Dabbelt
1348c0317210SSia Jee Hengconfig ARCH_HIBERNATION_POSSIBLE
1349e2d6b54bSConor Dooley	def_bool y
1350c0317210SSia Jee Heng
1351c0317210SSia Jee Hengconfig ARCH_HIBERNATION_HEADER
1352c0317210SSia Jee Heng	def_bool HIBERNATION
1353c0317210SSia Jee Heng
1354c1f048a6SSong Shuaiconfig ARCH_SUSPEND_POSSIBLE
1355c1f048a6SSong Shuai	def_bool y
1356c1f048a6SSong Shuai
13572f66a3d0SJuerg Haefligerendmenu # "Power management options"
1358d7071743SAtish Patra
1359f6e64b66SAnup Patelmenu "CPU Power Management"
1360f6e64b66SAnup Patel
1361f6e64b66SAnup Patelsource "drivers/cpuidle/Kconfig"
1362f6e64b66SAnup Patel
1363effae0e3SLad Prabhakarsource "drivers/cpufreq/Kconfig"
1364effae0e3SLad Prabhakar
13652f66a3d0SJuerg Haefligerendmenu # "CPU Power Management"
1366f6e64b66SAnup Patel
136799cdc6c1SAnup Patelsource "arch/riscv/kvm/Kconfig"
1368a91a9ffbSSunil V L
1369a91a9ffbSSunil V Lsource "drivers/acpi/Kconfig"
1370