xref: /linux/arch/riscv/Kconfig (revision 26b537edc533058c48f6351569d676703d7d1af3)
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
27d36cebe0SEric Biggers	select ARCH_HAS_CRC32 if RISCV_ISA_ZBC
28511484faSEric Biggers	select ARCH_HAS_CRC64 if 64BIT && RISCV_ISA_ZBC
298bf3e178SEric Biggers	select ARCH_HAS_CRC_T10DIF if RISCV_ISA_ZBC
30fdecfea0SKees Cook	select ARCH_HAS_CURRENT_STACK_POINTER
31e8c7ef7dSPalmer Dabbelt	select ARCH_HAS_DEBUG_VIRTUAL if MMU
325f365c13SConor Dooley	select ARCH_HAS_DEBUG_VM_PGTABLE
33b422d28bSZong Li	select ARCH_HAS_DEBUG_WX
3448b4fc66SJisheng Zhang	select ARCH_HAS_FAST_MULTIPLIER
3595301414SKefeng Wang	select ARCH_HAS_FORTIFY_SOURCE
36e8c7ef7dSPalmer Dabbelt	select ARCH_HAS_GCOV_PROFILE_ALL
37e8c7ef7dSPalmer Dabbelt	select ARCH_HAS_GIGANTIC_PAGE
3894a7734dSYong-Xuan Wang	select ARCH_HAS_HW_PTE_YOUNG
3920d38f7cSTobias Klauser	select ARCH_HAS_KCOV
4077acc6b5SSamuel Holland	select ARCH_HAS_KERNEL_FPU_SUPPORT if 64BIT && FPU
41d6cfd177SAndrea Parri	select ARCH_HAS_MEMBARRIER_CALLBACKS
42cd9b2901SAndrea Parri	select ARCH_HAS_MEMBARRIER_SYNC_CORE
43e8c7ef7dSPalmer Dabbelt	select ARCH_HAS_MMIOWB
4499a670b2SRuan Jinjie	select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
45a49ab905SAnup Patel	select ARCH_HAS_PMEM_API
4622aaec35SJisheng Zhang	select ARCH_HAS_PREEMPT_LAZY
47cd9b2901SAndrea Parri	select ARCH_HAS_PREPARE_SYNC_CORE_CMD
48f9aad622SAnshuman Khandual	select ARCH_HAS_PTDUMP if MMU
49216e04bfSBjörn Töpel	select ARCH_HAS_PTE_DEVMAP if 64BIT && MMU
50e8c7ef7dSPalmer Dabbelt	select ARCH_HAS_PTE_SPECIAL
5110cc3278SMike Rapoport	select ARCH_HAS_SET_DIRECT_MAP if MMU
5210cc3278SMike Rapoport	select ARCH_HAS_SET_MEMORY if MMU
5344c92257SVitaly Wool	select ARCH_HAS_STRICT_KERNEL_RWX if MMU && !XIP_KERNEL
5444c92257SVitaly Wool	select ARCH_HAS_STRICT_MODULE_RWX if MMU && !XIP_KERNEL
55cd9b2901SAndrea Parri	select ARCH_HAS_SYNC_CORE_BEFORE_USERMODE
5608d0ce30SSami Tolvanen	select ARCH_HAS_SYSCALL_WRAPPER
572f100585SGuo Ren	select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
58918327e9SKees Cook	select ARCH_HAS_UBSAN
5946fe55b2SThomas Weißschuh	select ARCH_HAS_VDSO_ARCH_DATA if GENERIC_VDSO_DATA_STORE
60e8065df5SSunil V L	select ARCH_KEEP_MEMBLOCK if ACPI
61f8c2a240SBjörn Töpel	select ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE	if 64BIT && MMU
62fc0c769fSVincent Chen	select ARCH_OPTIONAL_KERNEL_RWX if ARCH_HAS_STRICT_KERNEL_RWX
63fc0c769fSVincent Chen	select ARCH_OPTIONAL_KERNEL_RWX_DEFAULT
647f85b04bSJisheng Zhang	select ARCH_STACKWALK
657f85b04bSJisheng Zhang	select ARCH_SUPPORTS_ATOMIC_RMW
666f49743aSNathan Chancellor	# clang >= 17: https://github.com/llvm/llvm-project/commit/62fa708ceb027713b386c7e0efda994f8bdc27e2
676f49743aSNathan Chancellor	select ARCH_SUPPORTS_CFI_CLANG if CLANG_VERSION >= 170000
687f85b04bSJisheng Zhang	select ARCH_SUPPORTS_DEBUG_PAGEALLOC if MMU
6903dc00a2SAndrew Bresticker	select ARCH_SUPPORTS_HUGE_PFNMAP if TRANSPARENT_HUGEPAGE
70855f9a8eSAnshuman Khandual	select ARCH_SUPPORTS_HUGETLBFS if MMU
71021d2342SWende Tan	# LLD >= 14: https://github.com/llvm/llvm-project/issues/50505
72021d2342SWende Tan	select ARCH_SUPPORTS_LTO_CLANG if LLD_VERSION >= 140000
73021d2342SWende Tan	select ARCH_SUPPORTS_LTO_CLANG_THIN if LLD_VERSION >= 140000
74a869b8c2SJisheng Zhang	select ARCH_SUPPORTS_MSEAL_SYSTEM_MAPPINGS if 64BIT && MMU
7534c0a5b0SYueHaibing	select ARCH_SUPPORTS_PAGE_TABLE_CHECK if MMU
76648321faSJisheng Zhang	select ARCH_SUPPORTS_PER_VMA_LOCK if MMU
772638e4e6SSebastian Andrzej Siewior	select ARCH_SUPPORTS_RT
78d1584d79SSami Tolvanen	select ARCH_SUPPORTS_SHADOW_CALL_STACK if HAVE_SHADOW_CALL_STACK
79eb1e5037SJisheng Zhang	select ARCH_USE_CMPXCHG_LOCKREF if 64BIT
8097a03108SKefeng Wang	select ARCH_USE_MEMTEST
81c9c0b0baSPalmer Dabbelt	select ARCH_USE_QUEUED_RWLOCKS
827c9d980eSJisheng Zhang	select ARCH_USE_SYM_ANNOTATIONS
83af0ead42SSami Tolvanen	select ARCH_USES_CFI_TRAPS if CFI_CLANG
84c6026d35SSamuel Holland	select ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH if MMU
85e8c7ef7dSPalmer Dabbelt	select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU
86fbe934d6SPalmer Dabbelt	select ARCH_WANT_FRAME_POINTERS
8782a1a1f3SQinglin Pan	select ARCH_WANT_GENERAL_HUGETLB if !RISCV_ISA_SVNAPOT
88e8c7ef7dSPalmer Dabbelt	select ARCH_WANT_HUGE_PMD_SHARE if 64BIT
89f4b71bffSJisheng Zhang	select ARCH_WANT_LD_ORPHAN_WARN if !XIP_KERNEL
904705c157SBjörn Töpel	select ARCH_WANT_OPTIMIZE_DAX_VMEMMAP
910b6f1582SAneesh Kumar K.V	select ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP
92cfbc4f81SJisheng Zhang	select ARCH_WANTS_NO_INSTR
9387f81e66SJisheng Zhang	select ARCH_WANTS_THP_SWAP if HAVE_ARCH_TRANSPARENT_HUGEPAGE
94ab83647fSAlexandre Ghiti	select ARCH_WEAK_RELEASE_ACQUIRE if ARCH_USE_QUEUED_SPINLOCKS
9509accc3aSDamien Le Moal	select BINFMT_FLAT_NO_DATA_START_OFFSET if !MMU
9654fed35fSJisheng Zhang	select BUILDTIME_TABLE_SORT if MMU
97f862bbf4SSamuel Holland	select CLINT_TIMER if RISCV_M_MODE
985f365c13SConor Dooley	select CLONE_BACKWARDS
99fbe934d6SPalmer Dabbelt	select COMMON_CLK
100*26b537edSKuan-Wei Chiu	select CPU_NO_EFFICIENT_FFS if !RISCV_ISA_ZBB
1014dc4af9cSAndrew Jones	select CPU_PM if CPU_IDLE || HIBERNATION || SUSPEND
102e8c7ef7dSPalmer Dabbelt	select EDAC_SUPPORT
1039f944d2eSBjörn Töpel	select FRAME_POINTER if PERF_EVENTS || (FUNCTION_TRACER && !DYNAMIC_FTRACE)
104b546d636SSong Shuai	select FTRACE_MCOUNT_USE_PATCHABLE_FUNCTION_ENTRY if DYNAMIC_FTRACE
105c217157bSPuranjay Mohan	select FUNCTION_ALIGNMENT_8B if DYNAMIC_FTRACE_WITH_CALL_OPS
106fbd92809SConor Dooley	select GENERIC_ARCH_TOPOLOGY
107e8c7ef7dSPalmer Dabbelt	select GENERIC_ATOMIC64 if !64BIT
1082f100585SGuo Ren	select GENERIC_CLOCKEVENTS_BROADCAST if SMP
10996cf2036SJames Morse	select GENERIC_CPU_DEVICES
1100e3f3649SJinjie Ruan	select GENERIC_CPU_VULNERABILITIES
1116262f661SAtish Patra	select GENERIC_EARLY_IOREMAP
112f0bddf50SGuo Ren	select GENERIC_ENTRY
113ad5d1122SVincent Chen	select GENERIC_GETTIMEOFDAY if HAVE_GENERIC_VDSO
114bcf11b5eSKefeng Wang	select GENERIC_IDLE_POLL_SETUP
1158350229fSChristoph Hellwig	select GENERIC_IOREMAP if MMU
116832f15f4SAnup Patel	select GENERIC_IRQ_IPI if SMP
117832f15f4SAnup Patel	select GENERIC_IRQ_IPI_MUX if SMP
118e8c7ef7dSPalmer Dabbelt	select GENERIC_IRQ_MULTI_HANDLER
119fbe934d6SPalmer Dabbelt	select GENERIC_IRQ_SHOW
120ecd4916cSKefeng Wang	select GENERIC_IRQ_SHOW_LEVEL
12178ed473cSPalmer Dabbelt	select GENERIC_LIB_DEVMEM_IS_ALLOWED
12258d868b6SAnup Patel	select GENERIC_PENDING_IRQ if SMP
123fbe934d6SPalmer Dabbelt	select GENERIC_PCI_IOMAP
1249b9afe4aSAnup Patel	select GENERIC_SCHED_CLOCK
125e8c7ef7dSPalmer Dabbelt	select GENERIC_SMP_IDLE_THREAD
126ad5d1122SVincent Chen	select GENERIC_TIME_VSYSCALL if MMU && 64BIT
12746fe55b2SThomas Weißschuh	select GENERIC_VDSO_DATA_STORE if MMU
128dffe11e2STong Tiangen	select GENERIC_VDSO_TIME_NS if HAVE_GENERIC_VDSO
129c45fc916SConor Dooley	select HARDIRQS_SW_RESEND
130fcbfe812SNiklas Schnelle	select HAS_IOPORT if MMU
131f7bd2be7SAlexandre Ghiti	select HAVE_ALIGNED_STRUCT_PAGE
132efe75c49SDavid Abdurachmanov	select HAVE_ARCH_AUDITSYSCALL
133be79afc7SLiu Shixin	select HAVE_ARCH_HUGE_VMALLOC if HAVE_ARCH_HUGE_VMAP
1347bed5161SNam Cao	select HAVE_ARCH_HUGE_VMAP if MMU && 64BIT
13542e0e0b4SJisheng Zhang	select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL
13642e0e0b4SJisheng Zhang	select HAVE_ARCH_JUMP_LABEL_RELATIVE if !XIP_KERNEL
137e8c7ef7dSPalmer Dabbelt	select HAVE_ARCH_KASAN if MMU && 64BIT
138e178d670SNylon Chen	select HAVE_ARCH_KASAN_VMALLOC if MMU && 64BIT
13947513f24SLiu Shixin	select HAVE_ARCH_KFENCE if MMU && 64BIT
14042e0e0b4SJisheng Zhang	select HAVE_ARCH_KGDB if !XIP_KERNEL
141e8c7ef7dSPalmer Dabbelt	select HAVE_ARCH_KGDB_QXFER_PKT
142e8c7ef7dSPalmer Dabbelt	select HAVE_ARCH_MMAP_RND_BITS if MMU
1439be84592SGuo Ren	select HAVE_ARCH_MMAP_RND_COMPAT_BITS if COMPAT
14405d450aaSSong Shuai	select HAVE_ARCH_RANDOMIZE_KSTACK_OFFSET
1455340627eSDavid Abdurachmanov	select HAVE_ARCH_SECCOMP_FILTER
146b5db73fbSJisheng Zhang	select HAVE_ARCH_STACKLEAK
1475f365c13SConor Dooley	select HAVE_ARCH_THREAD_STRUCT_WHITELIST
148e8c7ef7dSPalmer Dabbelt	select HAVE_ARCH_TRACEHOOK
1499b76d71fSLinus Torvalds	select HAVE_ARCH_TRANSPARENT_HUGEPAGE if 64BIT && MMU
150c3cc2a4aSAlexandre Ghiti	select HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD if 64BIT && MMU
151a2492ca8SSamuel Holland	select HAVE_ARCH_USERFAULTFD_MINOR if 64BIT && USERFAULTFD
15231da94c2STong Tiangen	select HAVE_ARCH_VMAP_STACK if MMU && 64BIT
1532ff2b7ecSMasahiro Yamada	select HAVE_ASM_MODVERSIONS
15424a9c541SFrederic Weisbecker	select HAVE_CONTEXT_TRACKING_USER
155cbb3d91dSTobias Klauser	select HAVE_DEBUG_KMEMLEAK
1566bd33e1eSChristoph Hellwig	select HAVE_DMA_CONTIGUOUS if MMU
157ab7fa6b0SJisheng Zhang	select HAVE_DYNAMIC_FTRACE if !XIP_KERNEL && MMU && (CLANG_SUPPORTS_DYNAMIC_FTRACE || GCC_SUPPORTS_DYNAMIC_FTRACE)
158c41bf432SAndy Chiu	select FUNCTION_ALIGNMENT_4B if HAVE_DYNAMIC_FTRACE && RISCV_ISA_C
159b21cdb95SAndy Chiu	select HAVE_DYNAMIC_FTRACE_WITH_DIRECT_CALLS if HAVE_DYNAMIC_FTRACE_WITH_CALL_OPS
160c217157bSPuranjay Mohan	select HAVE_DYNAMIC_FTRACE_WITH_CALL_OPS if (DYNAMIC_FTRACE_WITH_ARGS && !CFI_CLANG)
1617caa9765SPuranjay Mohan	select HAVE_DYNAMIC_FTRACE_WITH_ARGS if HAVE_DYNAMIC_FTRACE
162a762e926SMasami Hiramatsu (Google)	select HAVE_FTRACE_GRAPH_FUNC
163ab7fa6b0SJisheng Zhang	select HAVE_FTRACE_MCOUNT_RECORD if !XIP_KERNEL
164e8eb8e1bSPu Lehui	select HAVE_FUNCTION_GRAPH_TRACER if HAVE_DYNAMIC_FTRACE_WITH_ARGS
165a3ed4157SMasami Hiramatsu (Google)	select HAVE_FUNCTION_GRAPH_FREGS
166d0262e90SAndy Chiu	select HAVE_FUNCTION_TRACER if !XIP_KERNEL
167e8c7ef7dSPalmer Dabbelt	select HAVE_EBPF_JIT if MMU
16825176ad0SDavid Hildenbrand	select HAVE_GUP_FAST if MMU
1695f365c13SConor Dooley	select HAVE_FUNCTION_ARG_ACCESS_API
170ee55ff80SGuo Ren	select HAVE_FUNCTION_ERROR_INJECTION
17120d38f7cSTobias Klauser	select HAVE_GCC_PLUGINS
172ad5d1122SVincent Chen	select HAVE_GENERIC_VDSO if MMU && 64BIT
17331564b8bSKefeng Wang	select HAVE_IRQ_TIME_ACCOUNTING
174e79dfcbfSEmil Renner Berthing	select HAVE_KERNEL_BZIP2 if !XIP_KERNEL && !EFI_ZBOOT
175e79dfcbfSEmil Renner Berthing	select HAVE_KERNEL_GZIP if !XIP_KERNEL && !EFI_ZBOOT
176e79dfcbfSEmil Renner Berthing	select HAVE_KERNEL_LZ4 if !XIP_KERNEL && !EFI_ZBOOT
177e79dfcbfSEmil Renner Berthing	select HAVE_KERNEL_LZMA if !XIP_KERNEL && !EFI_ZBOOT
178e79dfcbfSEmil Renner Berthing	select HAVE_KERNEL_LZO if !XIP_KERNEL && !EFI_ZBOOT
179e79dfcbfSEmil Renner Berthing	select HAVE_KERNEL_UNCOMPRESSED if !XIP_KERNEL && !EFI_ZBOOT
180e79dfcbfSEmil Renner Berthing	select HAVE_KERNEL_ZSTD if !XIP_KERNEL && !EFI_ZBOOT
181ab4ce983SLasse Collin	select HAVE_KERNEL_XZ if !XIP_KERNEL && !EFI_ZBOOT
18242e0e0b4SJisheng Zhang	select HAVE_KPROBES if !XIP_KERNEL
18342e0e0b4SJisheng Zhang	select HAVE_KRETPROBES if !XIP_KERNEL
184f7584322SNick Desaulniers	# https://github.com/ClangBuiltLinux/linux/issues/1881
185f7584322SNick Desaulniers	select HAVE_LD_DEAD_CODE_DATA_ELIMINATION if !LD_IS_LLD
1863332f419SJisheng Zhang	select HAVE_MOVE_PMD
1873332f419SJisheng Zhang	select HAVE_MOVE_PUD
1885394f1e9SArnd Bergmann	select HAVE_PAGE_SIZE_4KB
189e8c7ef7dSPalmer Dabbelt	select HAVE_PCI
190178e9fc4SAlan Kao	select HAVE_PERF_EVENTS
19198a93b0bSMao Han	select HAVE_PERF_REGS
19298a93b0bSMao Han	select HAVE_PERF_USER_STACK_DUMP
193b60ca697SJisheng Zhang	select HAVE_POSIX_CPU_TIMERS_TASK_WORK
1944e90d052SJisheng Zhang	select HAVE_PREEMPT_DYNAMIC_KEY if !XIP_KERNEL
195dcdc7a53SPatrick Stählin	select HAVE_REGS_AND_STACK_ACCESS_API
196ab7fa6b0SJisheng Zhang	select HAVE_RETHOOK if !XIP_KERNEL
1975f365c13SConor Dooley	select HAVE_RSEQ
19833549fcfSConor Dooley	select HAVE_RUST if RUSTC_SUPPORTS_RISCV && CC_IS_CLANG
199629291ddSSong Shuai	select HAVE_SAMPLE_FTRACE_DIRECT
200629291ddSSong Shuai	select HAVE_SAMPLE_FTRACE_DIRECT_MULTI
201f2c9699fSGuo Ren	select HAVE_STACKPROTECTOR
2025aeb1b36SDavid Abdurachmanov	select HAVE_SYSCALL_TRACEPOINTS
20372b11aa7SThomas Gleixner	select HOTPLUG_CORE_SYNC_DEAD if HOTPLUG_CPU
204fbe934d6SPalmer Dabbelt	select IRQ_DOMAIN
2058165c6aeSKefeng Wang	select IRQ_FORCED_THREADING
206864046c5SAlexandre Ghiti	select KASAN_VMALLOC if KASAN
2077267ef7bSBen Hutchings	select LOCK_MM_AND_FIND_VMA
20869be3fb1SJisheng Zhang	select MMU_GATHER_RCU_TABLE_FREE if SMP && MMU
209fbe934d6SPalmer Dabbelt	select MODULES_USE_ELF_RELA if MODULES
210e8c7ef7dSPalmer Dabbelt	select OF
211e8c7ef7dSPalmer Dabbelt	select OF_EARLY_FLATTREE
212e8c7ef7dSPalmer Dabbelt	select OF_IRQ
2132eac9c2dSChristoph Hellwig	select PCI_DOMAINS_GENERIC if PCI
21401415e78SSunil V L	select PCI_ECAM if (ACPI && PCI)
215eb01d42aSChristoph Hellwig	select PCI_MSI if PCI
216e1cf2d00SSamuel Holland	select RELOCATABLE if !MMU && !PHYS_RAM_BASE_FIXED
2171ee7fc3fSConor Dooley	select RISCV_ALTERNATIVE if !XIP_KERNEL
2180eebc69dSAnup Patel	select RISCV_APLIC
2190eebc69dSAnup Patel	select RISCV_IMSIC
220e71ee06eSAnup Patel	select RISCV_INTC
2212bc3fc87SAnup Patel	select RISCV_TIMER if RISCV_SBI
222bf3d7b1dSConor Dooley	select SIFIVE_PLIC
223e8c7ef7dSPalmer Dabbelt	select SPARSE_IRQ
224e8c7ef7dSPalmer Dabbelt	select SYSCTL_EXCEPTION_TRACE
225e8c7ef7dSPalmer Dabbelt	select THREAD_INFO_IN_TASK
2264aae683fSMasahiro Yamada	select TRACE_IRQFLAGS_SUPPORT
22711129e8eSChristoph Hellwig	select UACCESS_MEMCPY if !MMU
228ee0d0305SXi Ruoyao	select VDSO_GETRANDOM if HAVE_GENERIC_VDSO
2291a748331SJinjie Ruan	select USER_STACKTRACE_SUPPORT
23063703f37SKefeng Wang	select ZONE_DMA32 if 64BIT
23154c95a11SAlexandre Ghiti
232d077242dSAlice Ryhlconfig RUSTC_SUPPORTS_RISCV
233d077242dSAlice Ryhl	def_bool y
234d077242dSAlice Ryhl	depends on 64BIT
235d077242dSAlice Ryhl	# Shadow call stack requires rustc version 1.82+ due to use of the
236d077242dSAlice Ryhl	# -Zsanitizer=shadow-call-stack flag.
237d077242dSAlice Ryhl	depends on !SHADOW_CALL_STACK || RUSTC_VERSION >= 108200
238d077242dSAlice Ryhl
239b3d6bdfeSNathan Chancellorconfig CLANG_SUPPORTS_DYNAMIC_FTRACE
240b3d6bdfeSNathan Chancellor	def_bool CC_IS_CLANG
241b3d6bdfeSNathan Chancellor	# https://github.com/ClangBuiltLinux/linux/issues/1817
242b3d6bdfeSNathan Chancellor	depends on AS_IS_GNU || (AS_IS_LLVM && (LD_IS_LLD || LD_VERSION >= 23600))
243b3d6bdfeSNathan Chancellor
244b3d6bdfeSNathan Chancellorconfig GCC_SUPPORTS_DYNAMIC_FTRACE
245b3d6bdfeSNathan Chancellor	def_bool CC_IS_GCC
246b3d6bdfeSNathan Chancellor	depends on $(cc-option,-fpatchable-function-entry=8)
247c41bf432SAndy Chiu	depends on CC_HAS_MIN_FUNCTION_ALIGNMENT || !RISCV_ISA_C
248b3d6bdfeSNathan Chancellor
249d1584d79SSami Tolvanenconfig HAVE_SHADOW_CALL_STACK
250d1584d79SSami Tolvanen	def_bool $(cc-option,-fsanitize=shadow-call-stack)
251d1584d79SSami Tolvanen	# https://github.com/riscv-non-isa/riscv-elf-psabi-doc/commit/a484e843e6eeb51f0cb7b8819e50da6d2444d769
252d1584d79SSami Tolvanen	depends on $(ld-option,--no-relax-gp)
253d1584d79SSami Tolvanen
25455b71d2cSNathan Chancellorconfig RISCV_USE_LINKER_RELAXATION
25555b71d2cSNathan Chancellor	def_bool y
25655b71d2cSNathan Chancellor	# https://github.com/llvm/llvm-project/commit/6611d58f5bbcbec77262d392e2923e1d680f6985
25755b71d2cSNathan Chancellor	depends on !LD_IS_LLD || LLD_VERSION >= 150000
25855b71d2cSNathan Chancellor
259ae84ff9aSNathan Chancellor# https://github.com/llvm/llvm-project/commit/bbc0f99f3bc96f1db16f649fc21dd18e5b0918f6
260ae84ff9aSNathan Chancellorconfig ARCH_HAS_BROKEN_DWARF5
261ae84ff9aSNathan Chancellor	def_bool y
262ae84ff9aSNathan Chancellor	depends on RISCV_USE_LINKER_RELAXATION
263ae84ff9aSNathan Chancellor	# https://github.com/llvm/llvm-project/commit/1df5ea29b43690b6622db2cad7b745607ca4de6a
264ae84ff9aSNathan Chancellor	depends on AS_IS_LLVM && AS_VERSION < 180000
265ae84ff9aSNathan Chancellor	# https://github.com/llvm/llvm-project/commit/7ffabb61a5569444b5ac9322e22e5471cc5e4a77
266ae84ff9aSNathan Chancellor	depends on LD_IS_LLD && LLD_VERSION < 180000
267ae84ff9aSNathan Chancellor
26854c95a11SAlexandre Ghiticonfig ARCH_MMAP_RND_BITS_MIN
26954c95a11SAlexandre Ghiti	default 18 if 64BIT
27054c95a11SAlexandre Ghiti	default 8
27154c95a11SAlexandre Ghiti
2729be84592SGuo Renconfig ARCH_MMAP_RND_COMPAT_BITS_MIN
2739be84592SGuo Ren	default 8
2749be84592SGuo Ren
27554c95a11SAlexandre Ghiti# max bits determined by the following formula:
27654c95a11SAlexandre Ghiti#  VA_BITS - PAGE_SHIFT - 3
27754c95a11SAlexandre Ghiticonfig ARCH_MMAP_RND_BITS_MAX
27854c95a11SAlexandre Ghiti	default 24 if 64BIT # SV39 based
27954c95a11SAlexandre Ghiti	default 17
280fbe934d6SPalmer Dabbelt
2819be84592SGuo Renconfig ARCH_MMAP_RND_COMPAT_BITS_MAX
2829be84592SGuo Ren	default 17
2839be84592SGuo Ren
284a4c3733dSChristoph Hellwig# set if we run in machine mode, cleared if we run in supervisor mode
285a4c3733dSChristoph Hellwigconfig RISCV_M_MODE
286f862bbf4SSamuel Holland	bool "Build a kernel that runs in machine mode"
287f862bbf4SSamuel Holland	depends on !MMU
288f862bbf4SSamuel Holland	default y
289f862bbf4SSamuel Holland	help
290f862bbf4SSamuel Holland	  Select this option if you want to run the kernel in M-mode,
291f862bbf4SSamuel Holland	  without the assistance of any other firmware.
292a4c3733dSChristoph Hellwig
293eded8bc6SDamien Le Moal# set if we are running in S-mode and can use SBI calls
294eded8bc6SDamien Le Moalconfig RISCV_SBI
295eded8bc6SDamien Le Moal	bool
296eded8bc6SDamien Le Moal	depends on !RISCV_M_MODE
297eded8bc6SDamien Le Moal	default y
298eded8bc6SDamien Le Moal
299fbe934d6SPalmer Dabbeltconfig MMU
3006bd33e1eSChristoph Hellwig	bool "MMU-based Paged Memory Management Support"
3016bd33e1eSChristoph Hellwig	default y
3026bd33e1eSChristoph Hellwig	help
3036bd33e1eSChristoph Hellwig	  Select if you want MMU-based virtualised addressing space
3046bd33e1eSChristoph Hellwig	  support by paged memory management. If unsure, say 'Y'.
305fbe934d6SPalmer Dabbelt
30654c5639dSAlexandre Ghiticonfig KASAN_SHADOW_OFFSET
30754c5639dSAlexandre Ghiti	hex
30854c5639dSAlexandre Ghiti	depends on KASAN_GENERIC
309f7ae0233SAlexandre Ghiti	default 0xdfffffff00000000 if 64BIT
31054c5639dSAlexandre Ghiti	default 0xffffffff if 32BIT
31154c5639dSAlexandre Ghiti
312d95f1a54SLogan Gunthorpeconfig ARCH_FLATMEM_ENABLE
3134f0e8eefSAtish Patra	def_bool !NUMA
314d95f1a54SLogan Gunthorpe
315d95f1a54SLogan Gunthorpeconfig ARCH_SPARSEMEM_ENABLE
316d95f1a54SLogan Gunthorpe	def_bool y
317aa273420SDamien Le Moal	depends on MMU
318199fc6b8SKefeng Wang	select SPARSEMEM_STATIC if 32BIT && SPARSEMEM
319a5406a7fSKefeng Wang	select SPARSEMEM_VMEMMAP_ENABLE if 64BIT
320d95f1a54SLogan Gunthorpe
321d95f1a54SLogan Gunthorpeconfig ARCH_SELECT_MEMORY_MODEL
322d95f1a54SLogan Gunthorpe	def_bool ARCH_SPARSEMEM_ENABLE
323d95f1a54SLogan Gunthorpe
32474784081SGuo Renconfig ARCH_SUPPORTS_UPROBES
32574784081SGuo Ren	def_bool y
32674784081SGuo Ren
327fbe934d6SPalmer Dabbeltconfig STACKTRACE_SUPPORT
328fbe934d6SPalmer Dabbelt	def_bool y
329fbe934d6SPalmer Dabbelt
330fbe934d6SPalmer Dabbeltconfig GENERIC_BUG
331fbe934d6SPalmer Dabbelt	def_bool y
332fbe934d6SPalmer Dabbelt	depends on BUG
333fbe934d6SPalmer Dabbelt	select GENERIC_BUG_RELATIVE_POINTERS if 64BIT
334fbe934d6SPalmer Dabbelt
335fbe934d6SPalmer Dabbeltconfig GENERIC_BUG_RELATIVE_POINTERS
336fbe934d6SPalmer Dabbelt	bool
337fbe934d6SPalmer Dabbelt
338fbe934d6SPalmer Dabbeltconfig GENERIC_CALIBRATE_DELAY
339fbe934d6SPalmer Dabbelt	def_bool y
340fbe934d6SPalmer Dabbelt
341fbe934d6SPalmer Dabbeltconfig GENERIC_CSUM
342fbe934d6SPalmer Dabbelt	def_bool y
343fbe934d6SPalmer Dabbelt
344fbe934d6SPalmer Dabbeltconfig GENERIC_HWEIGHT
345fbe934d6SPalmer Dabbelt	def_bool y
346fbe934d6SPalmer Dabbelt
347f2c17aabSAnup Patelconfig FIX_EARLYCON_MEM
3480312a3d4SAndreas Schwab	def_bool MMU
349f2c17aabSAnup Patel
3505c178472SJisheng Zhangconfig ILLEGAL_POINTER_VALUE
3515c178472SJisheng Zhang	hex
3525c178472SJisheng Zhang	default 0 if 32BIT
3535c178472SJisheng Zhang	default 0xdead000000000000 if 64BIT
3545c178472SJisheng Zhang
355fbe934d6SPalmer Dabbeltconfig PGTABLE_LEVELS
356fbe934d6SPalmer Dabbelt	int
357011f09d1SQinglin Pan	default 5 if 64BIT
358fbe934d6SPalmer Dabbelt	default 2
359fbe934d6SPalmer Dabbelt
3603c469798SGuo Renconfig LOCKDEP_SUPPORT
3613c469798SGuo Ren	def_bool y
3623c469798SGuo Ren
3631631ba12SHeiko Stuebnerconfig RISCV_DMA_NONCOHERENT
3641631ba12SHeiko Stuebner	bool
3651631ba12SHeiko Stuebner	select ARCH_HAS_DMA_PREP_COHERENT
3661631ba12SHeiko Stuebner	select ARCH_HAS_SETUP_DMA_OPS
3675f365c13SConor Dooley	select ARCH_HAS_SYNC_DMA_FOR_CPU
3685f365c13SConor Dooley	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
369f51f7a0fSJisheng Zhang	select DMA_BOUNCE_UNALIGNED_KMALLOC if SWIOTLB
3701631ba12SHeiko Stuebner
371b79f300cSLad Prabhakarconfig RISCV_NONSTANDARD_CACHE_OPS
372b79f300cSLad Prabhakar	bool
373b79f300cSLad Prabhakar	help
374b79f300cSLad Prabhakar	  This enables function pointer support for non-standard noncoherent
375b79f300cSLad Prabhakar	  systems to handle cache management.
376b79f300cSLad Prabhakar
3775ac43ab2SAndrew Jonesconfig AS_HAS_INSN
3785ac43ab2SAndrew Jones	def_bool $(as-instr,.insn r 51$(comma) 0$(comma) 0$(comma) t0$(comma) t0$(comma) zero)
3795ac43ab2SAndrew Jones
380e4bb020fSAndy Chiuconfig AS_HAS_OPTION_ARCH
381fafdea34SNathan Chancellor	# https://github.com/llvm/llvm-project/commit/9e8ed3403c191ab9c4903e8eeb8f732ff8a43cb4
382e4bb020fSAndy Chiu	def_bool y
383e4bb020fSAndy Chiu	depends on $(as-instr, .option arch$(comma) +m)
384e4bb020fSAndy Chiu
3850cbb8a32SLoys Olliviersource "arch/riscv/Kconfig.socs"
386a3d095acSAndrew Jonessource "arch/riscv/Kconfig.errata"
3870cbb8a32SLoys Ollivier
388fbe934d6SPalmer Dabbeltmenu "Platform type"
389fbe934d6SPalmer Dabbelt
39044c1e84aSPalmer Dabbeltconfig NONPORTABLE
39144c1e84aSPalmer Dabbelt	bool "Allow configurations that result in non-portable kernels"
39244c1e84aSPalmer Dabbelt	help
39344c1e84aSPalmer Dabbelt	  RISC-V kernel binaries are compatible between all known systems
39444c1e84aSPalmer Dabbelt	  whenever possible, but there are some use cases that can only be
39544c1e84aSPalmer Dabbelt	  satisfied by configurations that result in kernel binaries that are
39644c1e84aSPalmer Dabbelt	  not portable between systems.
39744c1e84aSPalmer Dabbelt
39844c1e84aSPalmer Dabbelt	  Selecting N does not guarantee kernels will be portable to all known
39944c1e84aSPalmer Dabbelt	  systems.  Selecting any of the options guarded by NONPORTABLE will
40044c1e84aSPalmer Dabbelt	  result in kernel binaries that are unlikely to be portable between
40144c1e84aSPalmer Dabbelt	  systems.
40244c1e84aSPalmer Dabbelt
40344c1e84aSPalmer Dabbelt	  If unsure, say N.
40444c1e84aSPalmer Dabbelt
405fbe934d6SPalmer Dabbeltchoice
406fbe934d6SPalmer Dabbelt	prompt "Base ISA"
407fbe934d6SPalmer Dabbelt	default ARCH_RV64I
408fbe934d6SPalmer Dabbelt	help
40986cca81aSAntony Pavlov	  This selects the base ISA that this kernel will target and must match
410fbe934d6SPalmer Dabbelt	  the target platform.
411fbe934d6SPalmer Dabbelt
412fbe934d6SPalmer Dabbeltconfig ARCH_RV32I
413fbe934d6SPalmer Dabbelt	bool "RV32I"
41444c1e84aSPalmer Dabbelt	depends on NONPORTABLE
415fbe934d6SPalmer Dabbelt	select 32BIT
416e3d59805SMatt Redfearn	select GENERIC_LIB_ASHLDI3
417e3d59805SMatt Redfearn	select GENERIC_LIB_ASHRDI3
418e3d59805SMatt Redfearn	select GENERIC_LIB_LSHRDI3
4198f79125dSZong Li	select GENERIC_LIB_UCMPDI2
420fbe934d6SPalmer Dabbelt
421fbe934d6SPalmer Dabbeltconfig ARCH_RV64I
422fbe934d6SPalmer Dabbelt	bool "RV64I"
423fbe934d6SPalmer Dabbelt	select 64BIT
424d2075895SNick Desaulniers	select ARCH_SUPPORTS_INT128 if CC_HAS_INT128
4256bd33e1eSChristoph Hellwig	select SWIOTLB if MMU
426fbe934d6SPalmer Dabbelt
427fbe934d6SPalmer Dabbeltendchoice
428fbe934d6SPalmer Dabbelt
429fbe934d6SPalmer Dabbelt# We must be able to map all physical memory into the kernel, but the compiler
430fbe934d6SPalmer Dabbelt# is still a bit more efficient when generating code if it's setup in a manner
431fbe934d6SPalmer Dabbelt# such that it can only map 2GiB of memory.
432fbe934d6SPalmer Dabbeltchoice
433fbe934d6SPalmer Dabbelt	prompt "Kernel Code Model"
434fbe934d6SPalmer Dabbelt	default CMODEL_MEDLOW if 32BIT
435fbe934d6SPalmer Dabbelt	default CMODEL_MEDANY if 64BIT
436fbe934d6SPalmer Dabbelt
437fbe934d6SPalmer Dabbelt	config CMODEL_MEDLOW
438fbe934d6SPalmer Dabbelt		bool "medium low code model"
439fbe934d6SPalmer Dabbelt	config CMODEL_MEDANY
440fbe934d6SPalmer Dabbelt		bool "medium any code model"
441fbe934d6SPalmer Dabbeltendchoice
442fbe934d6SPalmer Dabbelt
443ab1ef68eSZong Liconfig MODULE_SECTIONS
444ab1ef68eSZong Li	bool
445ab1ef68eSZong Li	select HAVE_MOD_ARCH_SPECIFIC
446ab1ef68eSZong Li
447fbe934d6SPalmer Dabbeltconfig SMP
448fbe934d6SPalmer Dabbelt	bool "Symmetric Multi-Processing"
449fbe934d6SPalmer Dabbelt	help
450fbe934d6SPalmer Dabbelt	  This enables support for systems with more than one CPU.  If
451fbe934d6SPalmer Dabbelt	  you say N here, the kernel will run on single and
452fbe934d6SPalmer Dabbelt	  multiprocessor machines, but will use only one CPU of a
453fbe934d6SPalmer Dabbelt	  multiprocessor machine. If you say Y here, the kernel will run
454fbe934d6SPalmer Dabbelt	  on many, but not all, single processor machines. On a single
455fbe934d6SPalmer Dabbelt	  processor machine, the kernel will run faster if you say N
456fbe934d6SPalmer Dabbelt	  here.
457fbe934d6SPalmer Dabbelt
458fbe934d6SPalmer Dabbelt	  If you don't know what to do here, say N.
459fbe934d6SPalmer Dabbelt
4608bf7b3b6SSong Shuaiconfig SCHED_MC
4618bf7b3b6SSong Shuai	bool "Multi-core scheduler support"
4628bf7b3b6SSong Shuai	depends on SMP
4638bf7b3b6SSong Shuai	help
4648bf7b3b6SSong Shuai	  Multi-core scheduler support improves the CPU scheduler's decision
4658bf7b3b6SSong Shuai	  making when dealing with multi-core CPU chips at a cost of slightly
4668bf7b3b6SSong Shuai	  increased overhead in some places. If unsure say N here.
4678bf7b3b6SSong Shuai
468fbe934d6SPalmer Dabbeltconfig NR_CPUS
469e623715fSAnup Patel	int "Maximum number of CPUs (2-512)"
470fbe934d6SPalmer Dabbelt	depends on SMP
4711d6b5ed4SSamuel Holland	range 2 512 if !RISCV_SBI_V01
4721d6b5ed4SSamuel Holland	range 2 32 if RISCV_SBI_V01 && 32BIT
4731d6b5ed4SSamuel Holland	range 2 64 if RISCV_SBI_V01 && 64BIT
474e623715fSAnup Patel	default "32" if 32BIT
475e623715fSAnup Patel	default "64" if 64BIT
476fbe934d6SPalmer Dabbelt
477f1e58583SAtish Patraconfig HOTPLUG_CPU
478f1e58583SAtish Patra	bool "Support for hot-pluggable CPUs"
479f1e58583SAtish Patra	depends on SMP
480f1e58583SAtish Patra	select GENERIC_IRQ_MIGRATION
481f1e58583SAtish Patra	help
482f1e58583SAtish Patra
483f1e58583SAtish Patra	  Say Y here to experiment with turning CPUs off and on.  CPUs
484f1e58583SAtish Patra	  can be controlled through /sys/devices/system/cpu.
485f1e58583SAtish Patra
486f1e58583SAtish Patra	  Say N if you want to disable CPU hotplug.
487f1e58583SAtish Patra
488fbe934d6SPalmer Dabbeltchoice
489fbe934d6SPalmer Dabbelt	prompt "CPU Tuning"
490fbe934d6SPalmer Dabbelt	default TUNE_GENERIC
491fbe934d6SPalmer Dabbelt
492fbe934d6SPalmer Dabbeltconfig TUNE_GENERIC
493fbe934d6SPalmer Dabbelt	bool "generic"
494fbe934d6SPalmer Dabbelt
495fbe934d6SPalmer Dabbeltendchoice
496fbe934d6SPalmer Dabbelt
4974f0e8eefSAtish Patra# Common NUMA Features
4984f0e8eefSAtish Patraconfig NUMA
4994f0e8eefSAtish Patra	bool "NUMA Memory Allocation and Scheduler Support"
5001adbc294SKefeng Wang	depends on SMP && MMU
5014f0e8eefSAtish Patra	select ARCH_SUPPORTS_NUMA_BALANCING
5025f365c13SConor Dooley	select GENERIC_ARCH_NUMA
5036b9f29b8SAlexandre Ghiti	select HAVE_SETUP_PER_CPU_AREA
5047ecd19cfSKefeng Wang	select NEED_PER_CPU_EMBED_FIRST_CHUNK
5056b9f29b8SAlexandre Ghiti	select NEED_PER_CPU_PAGE_FIRST_CHUNK
5065f365c13SConor Dooley	select OF_NUMA
5075f365c13SConor Dooley	select USE_PERCPU_NUMA_NODE_ID
5084f0e8eefSAtish Patra	help
5094f0e8eefSAtish Patra	  Enable NUMA (Non-Uniform Memory Access) support.
5104f0e8eefSAtish Patra
5114f0e8eefSAtish Patra	  The kernel will try to allocate memory used by a CPU on the
5124f0e8eefSAtish Patra	  local memory of the CPU and add some more NUMA awareness to the kernel.
5134f0e8eefSAtish Patra
5144f0e8eefSAtish Patraconfig NODES_SHIFT
5154f0e8eefSAtish Patra	int "Maximum NUMA Nodes (as a power of 2)"
5164f0e8eefSAtish Patra	range 1 10
5174f0e8eefSAtish Patra	default "2"
518a9ee6cf5SMike Rapoport	depends on NUMA
5194f0e8eefSAtish Patra	help
5204f0e8eefSAtish Patra	  Specify the maximum number of NUMA Nodes available on the target
5214f0e8eefSAtish Patra	  system.  Increases memory reserved to accommodate various tables.
5224f0e8eefSAtish Patra
523ab83647fSAlexandre Ghitichoice
524ab83647fSAlexandre Ghiti	prompt "RISC-V spinlock type"
525ab83647fSAlexandre Ghiti	default RISCV_COMBO_SPINLOCKS
526ab83647fSAlexandre Ghiti
527ab83647fSAlexandre Ghiticonfig RISCV_TICKET_SPINLOCKS
528ab83647fSAlexandre Ghiti	bool "Using ticket spinlock"
529ab83647fSAlexandre Ghiti
530ab83647fSAlexandre Ghiticonfig RISCV_QUEUED_SPINLOCKS
531ab83647fSAlexandre Ghiti	bool "Using queued spinlock"
532ab83647fSAlexandre Ghiti	depends on SMP && MMU && NONPORTABLE
533ab83647fSAlexandre Ghiti	select ARCH_USE_QUEUED_SPINLOCKS
534ab83647fSAlexandre Ghiti	help
535ab83647fSAlexandre Ghiti	  The queued spinlock implementation requires the forward progress
536ab83647fSAlexandre Ghiti	  guarantee of cmpxchg()/xchg() atomic operations: CAS with Zabha or
537ab83647fSAlexandre Ghiti	  LR/SC with Ziccrse provide such guarantee.
538ab83647fSAlexandre Ghiti
539ab83647fSAlexandre Ghiti	  Select this if and only if Zabha or Ziccrse is available on your
540ab83647fSAlexandre Ghiti	  platform, RISCV_QUEUED_SPINLOCKS must not be selected for platforms
541ab83647fSAlexandre Ghiti	  without one of those extensions.
542ab83647fSAlexandre Ghiti
543ab83647fSAlexandre Ghiti	  If unsure, select RISCV_COMBO_SPINLOCKS, which will use qspinlocks
544ab83647fSAlexandre Ghiti	  when supported and otherwise ticket spinlocks.
545ab83647fSAlexandre Ghiti
546ab83647fSAlexandre Ghiticonfig RISCV_COMBO_SPINLOCKS
547ab83647fSAlexandre Ghiti	bool "Using combo spinlock"
548ab83647fSAlexandre Ghiti	depends on SMP && MMU
549ab83647fSAlexandre Ghiti	select ARCH_USE_QUEUED_SPINLOCKS
550ab83647fSAlexandre Ghiti	help
551ab83647fSAlexandre Ghiti	  Embed both queued spinlock and ticket lock so that the spinlock
552ab83647fSAlexandre Ghiti	  implementation can be chosen at runtime.
553ab83647fSAlexandre Ghiti
554ab83647fSAlexandre Ghitiendchoice
555ab83647fSAlexandre Ghiti
556e64f737aSHeiko Stuebnerconfig RISCV_ALTERNATIVE
557e64f737aSHeiko Stuebner	bool
558e64f737aSHeiko Stuebner	depends on !XIP_KERNEL
559e64f737aSHeiko Stuebner	help
560e64f737aSHeiko Stuebner	  This Kconfig allows the kernel to automatically patch the
561ff19a8deSAndrew Jones	  erratum or cpufeature required by the execution platform at run
562ff19a8deSAndrew Jones	  time. The code patching overhead is minimal, as it's only done
563ff19a8deSAndrew Jones	  once at boot and once on each module load.
564e64f737aSHeiko Stuebner
565a35707c3SHeiko Stuebnerconfig RISCV_ALTERNATIVE_EARLY
566a35707c3SHeiko Stuebner	bool
567a35707c3SHeiko Stuebner	depends on RISCV_ALTERNATIVE
568a35707c3SHeiko Stuebner	help
569a35707c3SHeiko Stuebner	  Allows early patching of the kernel for special errata
570a35707c3SHeiko Stuebner
571fbe934d6SPalmer Dabbeltconfig RISCV_ISA_C
572fbe934d6SPalmer Dabbelt	bool "Emit compressed instructions when building Linux"
573fbe934d6SPalmer Dabbelt	default y
574fbe934d6SPalmer Dabbelt	help
575fbe934d6SPalmer Dabbelt	  Adds "C" to the ISA subsets that the toolchain is allowed to emit
576fbe934d6SPalmer Dabbelt	  when building Linux, which results in compressed instructions in the
5776216182fSConor Dooley	  Linux binary. This option produces a kernel that will not run on
5786216182fSConor Dooley	  systems that do not support compressed instructions.
579fbe934d6SPalmer Dabbelt
580fbe934d6SPalmer Dabbelt	  If you don't know what to do here, say Y.
581fbe934d6SPalmer Dabbelt
58209d6775fSSamuel Hollandconfig RISCV_ISA_SUPM
58309d6775fSSamuel Holland	bool "Supm extension for userspace pointer masking"
58409d6775fSSamuel Holland	depends on 64BIT
58509d6775fSSamuel Holland	default y
58609d6775fSSamuel Holland	help
58709d6775fSSamuel Holland	  Add support for pointer masking in userspace (Supm) when the
58809d6775fSSamuel Holland	  underlying hardware extension (Smnpm or Ssnpm) is detected at boot.
58909d6775fSSamuel Holland
59009d6775fSSamuel Holland	  If this option is disabled, userspace will be unable to use
59109d6775fSSamuel Holland	  the prctl(PR_{SET,GET}_TAGGED_ADDR_CTRL) API.
59209d6775fSSamuel Holland
59323ad288aSQinglin Panconfig RISCV_ISA_SVNAPOT
5945464912cSConor Dooley	bool "Svnapot extension support for supervisor mode NAPOT pages"
595ff689fd2SHeiko Stuebner	depends on 64BIT && MMU
5961ee7fc3fSConor Dooley	depends on RISCV_ALTERNATIVE
597ff689fd2SHeiko Stuebner	default y
598ff689fd2SHeiko Stuebner	help
5996216182fSConor Dooley	  Enable support for the Svnapot ISA-extension when it is detected
6006216182fSConor Dooley	  at boot.
60123ad288aSQinglin Pan
6025464912cSConor Dooley	  The Svnapot extension is used to mark contiguous PTEs as a range
60323ad288aSQinglin Pan	  of contiguous virtual-to-physical translations for a naturally
60423ad288aSQinglin Pan	  aligned power-of-2 (NAPOT) granularity larger than the base 4KB page
60523ad288aSQinglin Pan	  size. When HUGETLBFS is also selected this option unconditionally
60623ad288aSQinglin Pan	  allocates some memory for each NAPOT page size supported by the kernel.
60723ad288aSQinglin Pan	  When optimizing for low memory consumption and for platforms without
6085464912cSConor Dooley	  the Svnapot extension, it may be better to say N here.
60923ad288aSQinglin Pan
61023ad288aSQinglin Pan	  If you don't know what to do here, say Y.
61123ad288aSQinglin Pan
612ff689fd2SHeiko Stuebnerconfig RISCV_ISA_SVPBMT
6135464912cSConor Dooley	bool "Svpbmt extension support for supervisor mode page-based memory types"
614ff689fd2SHeiko Stuebner	depends on 64BIT && MMU
615ff689fd2SHeiko Stuebner	depends on RISCV_ALTERNATIVE
616ff689fd2SHeiko Stuebner	default y
617ff689fd2SHeiko Stuebner	help
6186216182fSConor Dooley	   Add support for the Svpbmt ISA-extension (Supervisor-mode:
6196216182fSConor Dooley	   page-based memory types) in the kernel when it is detected at boot.
620924cbb8cSHeiko Stuebner
621924cbb8cSHeiko Stuebner	   The memory type for a page contains a combination of attributes
622924cbb8cSHeiko Stuebner	   that indicate the cacheability, idempotency, and ordering
623924cbb8cSHeiko Stuebner	   properties for access to that page.
624ff689fd2SHeiko Stuebner
6255464912cSConor Dooley	   The Svpbmt extension is only available on 64-bit cpus.
626ff689fd2SHeiko Stuebner
627ff689fd2SHeiko Stuebner	   If you don't know what to do here, say Y.
628ff689fd2SHeiko Stuebner
629fa8e7cceSGuo Renconfig TOOLCHAIN_HAS_V
630fa8e7cceSGuo Ren	bool
631fa8e7cceSGuo Ren	default y
6325ba7a75aSAnton Blanchard	depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64imv)
6335ba7a75aSAnton Blanchard	depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32imv)
634fa8e7cceSGuo Ren	depends on LLD_VERSION >= 140000 || LD_VERSION >= 23800
635fa8e7cceSGuo Ren	depends on AS_HAS_OPTION_ARCH
636fa8e7cceSGuo Ren
637fa8e7cceSGuo Renconfig RISCV_ISA_V
6386216182fSConor Dooley	bool "Vector extension support"
639fa8e7cceSGuo Ren	depends on TOOLCHAIN_HAS_V
640fa8e7cceSGuo Ren	depends on FPU
641fa8e7cceSGuo Ren	select DYNAMIC_SIGFRAME
642fa8e7cceSGuo Ren	default y
643fa8e7cceSGuo Ren	help
6446216182fSConor Dooley	  Add support for the Vector extension when it is detected at boot.
6456216182fSConor Dooley	  When this option is disabled, neither the kernel nor userspace may
6466216182fSConor Dooley	  use vector procedures.
647fa8e7cceSGuo Ren
648fa8e7cceSGuo Ren	  If you don't know what to do here, say Y.
649fa8e7cceSGuo Ren
650fa8e7cceSGuo Renconfig RISCV_ISA_V_DEFAULT_ENABLE
651fa8e7cceSGuo Ren	bool "Enable userspace Vector by default"
652fa8e7cceSGuo Ren	depends on RISCV_ISA_V
653fa8e7cceSGuo Ren	default y
654fa8e7cceSGuo Ren	help
655fa8e7cceSGuo Ren	  Say Y here if you want to enable Vector in userspace by default.
656fa8e7cceSGuo Ren	  Otherwise, userspace has to make explicit prctl() call to enable
657fa8e7cceSGuo Ren	  Vector, or enable it via the sysctl interface.
658fa8e7cceSGuo Ren
659fa8e7cceSGuo Ren	  If you don't know what to do here, say Y.
660fa8e7cceSGuo Ren
661c2a658d4SAndy Chiuconfig RISCV_ISA_V_UCOPY_THRESHOLD
662c2a658d4SAndy Chiu	int "Threshold size for vectorized user copies"
663c2a658d4SAndy Chiu	depends on RISCV_ISA_V
664c2a658d4SAndy Chiu	default 768
665c2a658d4SAndy Chiu	help
666c2a658d4SAndy Chiu	  Prefer using vectorized copy_to_user()/copy_from_user() when the
667c2a658d4SAndy Chiu	  workload size exceeds this value.
668c2a658d4SAndy Chiu
6692080ff94SAndy Chiuconfig RISCV_ISA_V_PREEMPTIVE
6702080ff94SAndy Chiu	bool "Run kernel-mode Vector with kernel preemption"
6712080ff94SAndy Chiu	depends on PREEMPTION
6722080ff94SAndy Chiu	depends on RISCV_ISA_V
6732080ff94SAndy Chiu	default y
6742080ff94SAndy Chiu	help
6752080ff94SAndy Chiu	  Usually, in-kernel SIMD routines are run with preemption disabled.
676c39d5375SMiquel Sabaté Solà	  Functions which invoke long running SIMD thus must yield the core's
6772080ff94SAndy Chiu	  vector unit to prevent blocking other tasks for too long.
6782080ff94SAndy Chiu
679c39d5375SMiquel Sabaté Solà	  This config allows the kernel to run SIMD without explicitly disabling
680c39d5375SMiquel Sabaté Solà	  preemption. Enabling this config will result in higher memory consumption
681c39d5375SMiquel Sabaté Solà	  due to the allocation of per-task's kernel Vector context.
6822080ff94SAndy Chiu
683b8ddb0dfSChristoph Müllnerconfig RISCV_ISA_ZAWRS
684b8ddb0dfSChristoph Müllner	bool "Zawrs extension support for more efficient busy waiting"
685b8ddb0dfSChristoph Müllner	depends on RISCV_ALTERNATIVE
686b8ddb0dfSChristoph Müllner	default y
687b8ddb0dfSChristoph Müllner	help
688b8ddb0dfSChristoph Müllner	  The Zawrs extension defines instructions to be used in polling loops
689b8ddb0dfSChristoph Müllner	  which allow a hart to enter a low-power state or to trap to the
690b8ddb0dfSChristoph Müllner	  hypervisor while waiting on a store to a memory location. Enable the
691b8ddb0dfSChristoph Müllner	  use of these instructions in the kernel when the Zawrs extension is
692b8ddb0dfSChristoph Müllner	  detected at boot.
693b8ddb0dfSChristoph Müllner
6941658ef43SAlexandre Ghiticonfig TOOLCHAIN_HAS_ZABHA
6951658ef43SAlexandre Ghiti	bool
6961658ef43SAlexandre Ghiti	default y
6971658ef43SAlexandre Ghiti	depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64ima_zabha)
6981658ef43SAlexandre Ghiti	depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32ima_zabha)
6991658ef43SAlexandre Ghiti	depends on AS_HAS_OPTION_ARCH
7001658ef43SAlexandre Ghiti
7011658ef43SAlexandre Ghiticonfig RISCV_ISA_ZABHA
7021658ef43SAlexandre Ghiti	bool "Zabha extension support for atomic byte/halfword operations"
7031658ef43SAlexandre Ghiti	depends on TOOLCHAIN_HAS_ZABHA
7041658ef43SAlexandre Ghiti	depends on RISCV_ALTERNATIVE
7051658ef43SAlexandre Ghiti	default y
7061658ef43SAlexandre Ghiti	help
7071658ef43SAlexandre Ghiti	  Enable the use of the Zabha ISA-extension to implement kernel
7081658ef43SAlexandre Ghiti	  byte/halfword atomic memory operations when it is detected at boot.
7091658ef43SAlexandre Ghiti
7101658ef43SAlexandre Ghiti	  If you don't know what to do here, say Y.
7111658ef43SAlexandre Ghiti
71238acdee3SAlexandre Ghiticonfig TOOLCHAIN_HAS_ZACAS
71338acdee3SAlexandre Ghiti	bool
71438acdee3SAlexandre Ghiti	default y
71538acdee3SAlexandre Ghiti	depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64ima_zacas)
71638acdee3SAlexandre Ghiti	depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32ima_zacas)
71738acdee3SAlexandre Ghiti	depends on AS_HAS_OPTION_ARCH
71838acdee3SAlexandre Ghiti
71938acdee3SAlexandre Ghiticonfig RISCV_ISA_ZACAS
72038acdee3SAlexandre Ghiti	bool "Zacas extension support for atomic CAS"
72138acdee3SAlexandre Ghiti	depends on TOOLCHAIN_HAS_ZACAS
72238acdee3SAlexandre Ghiti	depends on RISCV_ALTERNATIVE
72338acdee3SAlexandre Ghiti	default y
72438acdee3SAlexandre Ghiti	help
72538acdee3SAlexandre Ghiti	  Enable the use of the Zacas ISA-extension to implement kernel atomic
72638acdee3SAlexandre Ghiti	  cmpxchg operations when it is detected at boot.
72738acdee3SAlexandre Ghiti
728b8ddb0dfSChristoph Müllner	  If you don't know what to do here, say Y.
729b8ddb0dfSChristoph Müllner
730b6fcdb19SHeiko Stuebnerconfig TOOLCHAIN_HAS_ZBB
7311631ba12SHeiko Stuebner	bool
732b8c86872SConor Dooley	default y
733b6fcdb19SHeiko Stuebner	depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64ima_zbb)
734b6fcdb19SHeiko Stuebner	depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32ima_zbb)
735b6fcdb19SHeiko Stuebner	depends on LLD_VERSION >= 150000 || LD_VERSION >= 23900
736e4bb020fSAndy Chiu	depends on AS_HAS_OPTION_ARCH
737b6fcdb19SHeiko Stuebner
73834ca4ec6SEric Biggers# This symbol indicates that the toolchain supports all v1.0 vector crypto
73934ca4ec6SEric Biggers# extensions, including Zvk*, Zvbb, and Zvbc.  LLVM added all of these at once.
74034ca4ec6SEric Biggers# binutils added all except Zvkb, then added Zvkb.  So we just check for Zvkb.
74134ca4ec6SEric Biggersconfig TOOLCHAIN_HAS_VECTOR_CRYPTO
742886516faSEric Biggers	def_bool $(as-instr, .option arch$(comma) +v$(comma) +zvkb)
74334ca4ec6SEric Biggers	depends on AS_HAS_OPTION_ARCH
74434ca4ec6SEric Biggers
7458a2f20acSAlexandre Ghiticonfig TOOLCHAIN_HAS_ZBA
7468a2f20acSAlexandre Ghiti	bool
7478a2f20acSAlexandre Ghiti	default y
7488a2f20acSAlexandre Ghiti	depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64ima_zba)
7498a2f20acSAlexandre Ghiti	depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32ima_zba)
7508a2f20acSAlexandre Ghiti	depends on LLD_VERSION >= 150000 || LD_VERSION >= 23900
7518a2f20acSAlexandre Ghiti	depends on AS_HAS_OPTION_ARCH
7528a2f20acSAlexandre Ghiti
753c12603e7SXiao Wangconfig RISCV_ISA_ZBA
754c12603e7SXiao Wang	bool "Zba extension support for bit manipulation instructions"
755c12603e7SXiao Wang	default y
756c12603e7SXiao Wang	help
757c12603e7SXiao Wang	   Add support for enabling optimisations in the kernel when the Zba
758c12603e7SXiao Wang	   extension is detected at boot.
759c12603e7SXiao Wang
760c12603e7SXiao Wang	   The Zba extension provides instructions to accelerate the generation
761c12603e7SXiao Wang	   of addresses that index into arrays of basic data types.
762c12603e7SXiao Wang
763c12603e7SXiao Wang	   If you don't know what to do here, say Y.
764c12603e7SXiao Wang
765b6fcdb19SHeiko Stuebnerconfig RISCV_ISA_ZBB
766b6fcdb19SHeiko Stuebner	bool "Zbb extension support for bit manipulation instructions"
7671ee7fc3fSConor Dooley	depends on RISCV_ALTERNATIVE
768b6fcdb19SHeiko Stuebner	default y
769b6fcdb19SHeiko Stuebner	help
7706216182fSConor Dooley	   Add support for enabling optimisations in the kernel when the
7719343aabaSConor Dooley	   Zbb extension is detected at boot. Some optimisations may
7729343aabaSConor Dooley	   additionally depend on toolchain support for Zbb.
773b6fcdb19SHeiko Stuebner
774b6fcdb19SHeiko Stuebner	   The Zbb extension provides instructions to accelerate a number
775b6fcdb19SHeiko Stuebner	   of bit-specific operations (count bit population, sign extending,
776b6fcdb19SHeiko Stuebner	   bitrotation, etc).
777b6fcdb19SHeiko Stuebner
778b6fcdb19SHeiko Stuebner	   If you don't know what to do here, say Y.
7791631ba12SHeiko Stuebner
780a43fe27dSXiao Wangconfig TOOLCHAIN_HAS_ZBC
781a43fe27dSXiao Wang	bool
782a43fe27dSXiao Wang	default y
783a43fe27dSXiao Wang	depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64ima_zbc)
784a43fe27dSXiao Wang	depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32ima_zbc)
785a43fe27dSXiao Wang	depends on LLD_VERSION >= 150000 || LD_VERSION >= 23900
786a43fe27dSXiao Wang	depends on AS_HAS_OPTION_ARCH
787a43fe27dSXiao Wang
788a43fe27dSXiao Wangconfig RISCV_ISA_ZBC
789a43fe27dSXiao Wang	bool "Zbc extension support for carry-less multiplication instructions"
790a43fe27dSXiao Wang	depends on TOOLCHAIN_HAS_ZBC
791a43fe27dSXiao Wang	depends on MMU
792a43fe27dSXiao Wang	depends on RISCV_ALTERNATIVE
793a43fe27dSXiao Wang	default y
794a43fe27dSXiao Wang	help
795a43fe27dSXiao Wang	   Adds support to dynamically detect the presence of the Zbc
796a43fe27dSXiao Wang	   extension (carry-less multiplication) and enable its usage.
797a43fe27dSXiao Wang
798a43fe27dSXiao Wang	   The Zbc extension could accelerate CRC (cyclic redundancy check)
799a43fe27dSXiao Wang	   calculations.
800a43fe27dSXiao Wang
801a43fe27dSXiao Wang	   If you don't know what to do here, say Y.
802a43fe27dSXiao Wang
803a44fb572SCharlie Jenkinsconfig TOOLCHAIN_HAS_ZBKB
804a44fb572SCharlie Jenkins	bool
805a44fb572SCharlie Jenkins	default y
806a44fb572SCharlie Jenkins	depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64ima_zbkb)
807a44fb572SCharlie Jenkins	depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32ima_zbkb)
808a44fb572SCharlie Jenkins	depends on LLD_VERSION >= 150000 || LD_VERSION >= 23900
809a44fb572SCharlie Jenkins	depends on AS_HAS_OPTION_ARCH
810a44fb572SCharlie Jenkins
811a44fb572SCharlie Jenkinsconfig RISCV_ISA_ZBKB
812a44fb572SCharlie Jenkins	bool "Zbkb extension support for bit manipulation instructions"
813a44fb572SCharlie Jenkins	depends on TOOLCHAIN_HAS_ZBKB
814a44fb572SCharlie Jenkins	depends on RISCV_ALTERNATIVE
815a44fb572SCharlie Jenkins	default y
816a44fb572SCharlie Jenkins	help
817a44fb572SCharlie Jenkins	   Adds support to dynamically detect the presence of the ZBKB
818a44fb572SCharlie Jenkins	   extension (bit manipulation for cryptography) and enable its usage.
819a44fb572SCharlie Jenkins
820a44fb572SCharlie Jenkins	   The Zbkb extension provides instructions to accelerate a number
821a44fb572SCharlie Jenkins	   of common cryptography operations (pack, zip, etc).
822a44fb572SCharlie Jenkins
823a44fb572SCharlie Jenkins	   If you don't know what to do here, say Y.
824a44fb572SCharlie Jenkins
8251631ba12SHeiko Stuebnerconfig RISCV_ISA_ZICBOM
8261631ba12SHeiko Stuebner	bool "Zicbom extension support for non-coherent DMA operation"
8271ee7fc3fSConor Dooley	depends on MMU
8281ee7fc3fSConor Dooley	depends on RISCV_ALTERNATIVE
8291631ba12SHeiko Stuebner	default y
8305f365c13SConor Dooley	select RISCV_DMA_NONCOHERENT
831381cae16SChristoph Hellwig	select DMA_DIRECT_REMAP
8321631ba12SHeiko Stuebner	help
8336216182fSConor Dooley	   Add support for the Zicbom extension (Cache Block Management
8346216182fSConor Dooley	   Operations) and enable its use in the kernel when it is detected
8356216182fSConor Dooley	   at boot.
8361631ba12SHeiko Stuebner
8371631ba12SHeiko Stuebner	   The Zicbom extension can be used to handle for example
8381631ba12SHeiko Stuebner	   non-coherent DMA support on devices that need it.
8391631ba12SHeiko Stuebner
8401631ba12SHeiko Stuebner	   If you don't know what to do here, say Y.
8411631ba12SHeiko Stuebner
842ab0f7746SAndrew Jonesconfig RISCV_ISA_ZICBOZ
843ab0f7746SAndrew Jones	bool "Zicboz extension support for faster zeroing of memory"
844d34a6b71SConor Dooley	depends on RISCV_ALTERNATIVE
845ab0f7746SAndrew Jones	default y
846ab0f7746SAndrew Jones	help
8475464912cSConor Dooley	   Enable the use of the Zicboz extension (cbo.zero instruction)
8486216182fSConor Dooley	   in the kernel when it is detected at boot.
849ab0f7746SAndrew Jones
850ab0f7746SAndrew Jones	   The Zicboz extension is used for faster zeroing of memory.
851ab0f7746SAndrew Jones
852ab0f7746SAndrew Jones	   If you don't know what to do here, say Y.
853ab0f7746SAndrew Jones
8548d496b5aSAlexandre Ghiticonfig RISCV_ISA_ZICBOP
8558d496b5aSAlexandre Ghiti	bool "Zicbop extension support for cache block prefetch"
8568d496b5aSAlexandre Ghiti	depends on MMU
8578d496b5aSAlexandre Ghiti	depends on RISCV_ALTERNATIVE
8588d496b5aSAlexandre Ghiti	default y
8598d496b5aSAlexandre Ghiti	help
8608d496b5aSAlexandre Ghiti	  Adds support to dynamically detect the presence of the ZICBOP
8618d496b5aSAlexandre Ghiti	  extension (Cache Block Prefetch Operations) and enable its
8628d496b5aSAlexandre Ghiti	  usage.
8638d496b5aSAlexandre Ghiti
8648d496b5aSAlexandre Ghiti	  The Zicbop extension can be used to prefetch cache blocks for
8658d496b5aSAlexandre Ghiti	  read/write fetch.
8668d496b5aSAlexandre Ghiti
8678d496b5aSAlexandre Ghiti	  If you don't know what to do here, say Y.
8688d496b5aSAlexandre Ghiti
869e89c2e81SNathan Chancellorconfig TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI
870e89c2e81SNathan Chancellor	def_bool y
871e89c2e81SNathan Chancellor	# https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=aed44286efa8ae8717a77d94b51ac3614e2ca6dc
872ca09f772SMingzheng Xing	# https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=98416dbb0a62579d4a7a4a76bab51b5b52fec2cd
873ca09f772SMingzheng Xing	depends on AS_IS_GNU && AS_VERSION >= 23600
874e89c2e81SNathan Chancellor	help
875ca09f772SMingzheng Xing	  Binutils-2.38 and GCC-12.1.0 bumped the default ISA spec to the newer
876ca09f772SMingzheng Xing	  20191213 version, which moves some instructions from the I extension to
877ca09f772SMingzheng Xing	  the Zicsr and Zifencei extensions. This requires explicitly specifying
878ca09f772SMingzheng Xing	  Zicsr and Zifencei when binutils >= 2.38 or GCC >= 12.1.0. Zicsr
879ca09f772SMingzheng Xing	  and Zifencei are supported in binutils from version 2.36 onwards.
880ca09f772SMingzheng Xing	  To make life easier, and avoid forcing toolchains that default to a
881ca09f772SMingzheng Xing	  newer ISA spec to version 2.2, relax the check to binutils >= 2.36.
882ef21fa7cSMingzheng Xing	  For clang < 17 or GCC < 11.3.0, for which this is not possible or need
883ef21fa7cSMingzheng Xing	  special treatment, this is dealt with in TOOLCHAIN_NEEDS_OLD_ISA_SPEC.
884e89c2e81SNathan Chancellor
885e89c2e81SNathan Chancellorconfig TOOLCHAIN_NEEDS_OLD_ISA_SPEC
886e89c2e81SNathan Chancellor	def_bool y
887e89c2e81SNathan Chancellor	depends on TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI
888e89c2e81SNathan Chancellor	# https://github.com/llvm/llvm-project/commit/22e199e6afb1263c943c0c0d4498694e15bf8a16
889ef21fa7cSMingzheng Xing	# https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=d29f5d6ab513c52fd872f532c492e35ae9fd6671
890ef21fa7cSMingzheng Xing	depends on (CC_IS_CLANG && CLANG_VERSION < 170000) || (CC_IS_GCC && GCC_VERSION < 110300)
891e89c2e81SNathan Chancellor	help
892ca09f772SMingzheng Xing	  Certain versions of clang and GCC do not support zicsr and zifencei via
893ca09f772SMingzheng Xing	  -march. This option causes an older ISA spec compatible with these older
894ca09f772SMingzheng Xing	  versions of clang and GCC to be passed to GAS, which has the same result
895ca09f772SMingzheng Xing	  as passing zicsr and zifencei to -march.
896e89c2e81SNathan Chancellor
8979671f706SAlan Kaoconfig FPU
8989671f706SAlan Kao	bool "FPU support"
8999671f706SAlan Kao	default y
9009671f706SAlan Kao	help
9016216182fSConor Dooley	  Add support for floating point operations when an FPU is detected at
9026216182fSConor Dooley	  boot. When this option is disabled, neither the kernel nor userspace
9036216182fSConor Dooley	  may use the floating point unit.
9049671f706SAlan Kao
9059671f706SAlan Kao	  If you don't know what to do here, say Y.
9069671f706SAlan Kao
907163e76ccSGuo Renconfig IRQ_STACKS
908dd69d07aSGuo Ren	bool "Independent irq & softirq stacks" if EXPERT
909163e76ccSGuo Ren	default y
910163e76ccSGuo Ren	select HAVE_IRQ_EXIT_ON_IRQ_STACK
911dd69d07aSGuo Ren	select HAVE_SOFTIRQ_ON_OWN_STACK
912163e76ccSGuo Ren	help
913dd69d07aSGuo Ren	  Add independent irq & softirq stacks for percpu to prevent kernel stack
914dd69d07aSGuo Ren	  overflows. We may save some memory footprint by disabling IRQ_STACKS.
915163e76ccSGuo Ren
916a7555f6bSGuo Renconfig THREAD_SIZE_ORDER
917a7555f6bSGuo Ren	int "Kernel stack size (in power-of-two numbers of page size)" if VMAP_STACK && EXPERT
918a7555f6bSGuo Ren	range 0 4
919cfb10de1SAlexandre Ghiti	default 1 if 32BIT
920a7555f6bSGuo Ren	default 2
921a7555f6bSGuo Ren	help
922a7555f6bSGuo Ren	  Specify the Pages of thread stack size (from 4KB to 64KB), which also
923a7555f6bSGuo Ren	  affects irq stack size, which is equal to thread stack size.
924a7555f6bSGuo Ren
9257c832321SClément Légerconfig RISCV_MISALIGNED
926f413aae9SCharlie Jenkins	bool
927d1703dc7SJesse Taube	help
928d1703dc7SJesse Taube	  Embed support for detecting and emulating misaligned
929d1703dc7SJesse Taube	  scalar or vector loads and stores.
930d1703dc7SJesse Taube
931c05a62c9SJesse Taubeconfig RISCV_SCALAR_MISALIGNED
9327c832321SClément Léger	bool
933d1703dc7SJesse Taube	select RISCV_MISALIGNED
934bc38f613SClément Léger	select SYSCTL_ARCH_UNALIGN_ALLOW
9357c832321SClément Léger	help
936f413aae9SCharlie Jenkins	  Embed support for emulating misaligned loads and stores.
937f413aae9SCharlie Jenkins
938d1703dc7SJesse Taubeconfig RISCV_VECTOR_MISALIGNED
939d1703dc7SJesse Taube	bool
940d1703dc7SJesse Taube	select RISCV_MISALIGNED
941d1703dc7SJesse Taube	depends on RISCV_ISA_V
942d1703dc7SJesse Taube	help
943d1703dc7SJesse Taube	  Enable detecting support for vector misaligned loads and stores.
944d1703dc7SJesse Taube
945f413aae9SCharlie Jenkinschoice
946f413aae9SCharlie Jenkins	prompt "Unaligned Accesses Support"
947f413aae9SCharlie Jenkins	default RISCV_PROBE_UNALIGNED_ACCESS
948f413aae9SCharlie Jenkins	help
949f413aae9SCharlie Jenkins	  This determines the level of support for unaligned accesses. This
950f413aae9SCharlie Jenkins	  information is used by the kernel to perform optimizations. It is also
951f413aae9SCharlie Jenkins	  exposed to user space via the hwprobe syscall. The hardware will be
952f413aae9SCharlie Jenkins	  probed at boot by default.
953f413aae9SCharlie Jenkins
954f413aae9SCharlie Jenkinsconfig RISCV_PROBE_UNALIGNED_ACCESS
955f413aae9SCharlie Jenkins	bool "Probe for hardware unaligned access support"
956c05a62c9SJesse Taube	select RISCV_SCALAR_MISALIGNED
957f413aae9SCharlie Jenkins	help
958f413aae9SCharlie Jenkins	  During boot, the kernel will run a series of tests to determine the
959f413aae9SCharlie Jenkins	  speed of unaligned accesses. This probing will dynamically determine
960f413aae9SCharlie Jenkins	  the speed of unaligned accesses on the underlying system. If unaligned
961f413aae9SCharlie Jenkins	  memory accesses trap into the kernel as they are not supported by the
962f413aae9SCharlie Jenkins	  system, the kernel will emulate the unaligned accesses to preserve the
963f413aae9SCharlie Jenkins	  UABI.
964f413aae9SCharlie Jenkins
965f413aae9SCharlie Jenkinsconfig RISCV_EMULATED_UNALIGNED_ACCESS
966f413aae9SCharlie Jenkins	bool "Emulate unaligned access where system support is missing"
967c05a62c9SJesse Taube	select RISCV_SCALAR_MISALIGNED
968f413aae9SCharlie Jenkins	help
969f413aae9SCharlie Jenkins	  If unaligned memory accesses trap into the kernel as they are not
970f413aae9SCharlie Jenkins	  supported by the system, the kernel will emulate the unaligned
971f413aae9SCharlie Jenkins	  accesses to preserve the UABI. When the underlying system does support
972f413aae9SCharlie Jenkins	  unaligned accesses, the unaligned accesses are assumed to be slow.
973f413aae9SCharlie Jenkins
974f413aae9SCharlie Jenkinsconfig RISCV_SLOW_UNALIGNED_ACCESS
975f413aae9SCharlie Jenkins	bool "Assume the system supports slow unaligned memory accesses"
976f413aae9SCharlie Jenkins	depends on NONPORTABLE
977f413aae9SCharlie Jenkins	help
978f413aae9SCharlie Jenkins	  Assume that the system supports slow unaligned memory accesses. The
979f413aae9SCharlie Jenkins	  kernel and userspace programs may not be able to run at all on systems
980f413aae9SCharlie Jenkins	  that do not support unaligned memory accesses.
9817c832321SClément Léger
982b6da6cbeSJisheng Zhangconfig RISCV_EFFICIENT_UNALIGNED_ACCESS
983f413aae9SCharlie Jenkins	bool "Assume the system supports fast unaligned memory accesses"
984b6da6cbeSJisheng Zhang	depends on NONPORTABLE
985d0fdc20bSJisheng Zhang	select DCACHE_WORD_ACCESS if MMU
986b6da6cbeSJisheng Zhang	select HAVE_EFFICIENT_UNALIGNED_ACCESS
987b6da6cbeSJisheng Zhang	help
988f413aae9SCharlie Jenkins	  Assume that the system supports fast unaligned memory accesses. When
989f413aae9SCharlie Jenkins	  enabled, this option improves the performance of the kernel on such
990f413aae9SCharlie Jenkins	  systems. However, the kernel and userspace programs will run much more
991f413aae9SCharlie Jenkins	  slowly, or will not be able to run at all, on systems that do not
992f413aae9SCharlie Jenkins	  support efficient unaligned memory accesses.
993b6da6cbeSJisheng Zhang
994f413aae9SCharlie Jenkinsendchoice
995b6da6cbeSJisheng Zhang
996d1703dc7SJesse Taubechoice
997d1703dc7SJesse Taube	prompt "Vector unaligned Accesses Support"
998d1703dc7SJesse Taube	depends on RISCV_ISA_V
999d1703dc7SJesse Taube	default RISCV_PROBE_VECTOR_UNALIGNED_ACCESS
1000d1703dc7SJesse Taube	help
1001d1703dc7SJesse Taube	  This determines the level of support for vector unaligned accesses. This
1002d1703dc7SJesse Taube	  information is used by the kernel to perform optimizations. It is also
1003d1703dc7SJesse Taube	  exposed to user space via the hwprobe syscall. The hardware will be
1004d1703dc7SJesse Taube	  probed at boot by default.
1005d1703dc7SJesse Taube
1006d1703dc7SJesse Taubeconfig RISCV_PROBE_VECTOR_UNALIGNED_ACCESS
1007d1703dc7SJesse Taube	bool "Probe speed of vector unaligned accesses"
1008d1703dc7SJesse Taube	select RISCV_VECTOR_MISALIGNED
1009d1703dc7SJesse Taube	depends on RISCV_ISA_V
1010d1703dc7SJesse Taube	help
1011d1703dc7SJesse Taube	  During boot, the kernel will run a series of tests to determine the
1012d1703dc7SJesse Taube	  speed of vector unaligned accesses if they are supported. This probing
1013d1703dc7SJesse Taube	  will dynamically determine the speed of vector unaligned accesses on
1014d1703dc7SJesse Taube	  the underlying system if they are supported.
1015d1703dc7SJesse Taube
1016e7c9d66eSJesse Taubeconfig RISCV_SLOW_VECTOR_UNALIGNED_ACCESS
1017e7c9d66eSJesse Taube	bool "Assume the system supports slow vector unaligned memory accesses"
1018e7c9d66eSJesse Taube	depends on NONPORTABLE
1019e7c9d66eSJesse Taube	help
1020e7c9d66eSJesse Taube	  Assume that the system supports slow vector unaligned memory accesses. The
1021e7c9d66eSJesse Taube	  kernel and userspace programs may not be able to run at all on systems
1022e7c9d66eSJesse Taube	  that do not support unaligned memory accesses.
1023e7c9d66eSJesse Taube
1024e7c9d66eSJesse Taubeconfig RISCV_EFFICIENT_VECTOR_UNALIGNED_ACCESS
1025e7c9d66eSJesse Taube	bool "Assume the system supports fast vector unaligned memory accesses"
1026e7c9d66eSJesse Taube	depends on NONPORTABLE
1027e7c9d66eSJesse Taube	help
1028e7c9d66eSJesse Taube	  Assume that the system supports fast vector unaligned memory accesses. When
1029e7c9d66eSJesse Taube	  enabled, this option improves the performance of the kernel on such
1030e7c9d66eSJesse Taube	  systems. However, the kernel and userspace programs will run much more
1031e7c9d66eSJesse Taube	  slowly, or will not be able to run at all, on systems that do not
1032e7c9d66eSJesse Taube	  support efficient unaligned memory accesses.
1033e7c9d66eSJesse Taube
1034d1703dc7SJesse Taubeendchoice
1035d1703dc7SJesse Taube
103623c996fcSCharlie Jenkinssource "arch/riscv/Kconfig.vendor"
103723c996fcSCharlie Jenkins
10382f66a3d0SJuerg Haefligerendmenu # "Platform type"
1039fbe934d6SPalmer Dabbelt
1040aef53f97SNick Kossifidismenu "Kernel features"
1041fbe934d6SPalmer Dabbelt
1042fbe934d6SPalmer Dabbeltsource "kernel/Kconfig.hz"
1043fbe934d6SPalmer Dabbelt
1044efca1398SAtish Patraconfig RISCV_SBI_V01
1045efca1398SAtish Patra	bool "SBI v0.1 support"
1046efca1398SAtish Patra	depends on RISCV_SBI
1047efca1398SAtish Patra	help
1048efca1398SAtish Patra	  This config allows kernel to use SBI v0.1 APIs. This will be
1049efca1398SAtish Patra	  deprecated in future once legacy M-mode software are no longer in use.
1050fba8a867SNick Kossifidis
10512ffc48fcSAtish Patraconfig RISCV_BOOT_SPINWAIT
10522ffc48fcSAtish Patra	bool "Spinwait booting method"
10532ffc48fcSAtish Patra	depends on SMP
105477d707a3SPalmer Dabbelt	default y if RISCV_SBI_V01 || RISCV_M_MODE
10552ffc48fcSAtish Patra	help
10562ffc48fcSAtish Patra	  This enables support for booting Linux via spinwait method. In the
10572ffc48fcSAtish Patra	  spinwait method, all cores randomly jump to Linux. One of the cores
10582ffc48fcSAtish Patra	  gets chosen via lottery and all other keep spinning on a percpu
10592ffc48fcSAtish Patra	  variable. This method cannot support CPU hotplug and sparse hartid
10602ffc48fcSAtish Patra	  scheme. It should be only enabled for M-mode Linux or platforms relying
10612ffc48fcSAtish Patra	  on older firmware without SBI HSM extension. All other platforms should
10622ffc48fcSAtish Patra	  rely on ordered booting via SBI HSM extension which gets chosen
10632ffc48fcSAtish Patra	  dynamically at runtime if the firmware supports it.
10642ffc48fcSAtish Patra
106577d707a3SPalmer Dabbelt	  Since spinwait is incompatible with sparse hart IDs, it requires
106677d707a3SPalmer Dabbelt	  NR_CPUS be large enough to contain the physical hart ID of the first
106777d707a3SPalmer Dabbelt	  hart to enter Linux.
106877d707a3SPalmer Dabbelt
106977d707a3SPalmer Dabbelt	  If unsure what to do here, say N.
107077d707a3SPalmer Dabbelt
10711f0d6efeSEric DeVolderconfig ARCH_SUPPORTS_KEXEC
1072c41bd251SIgnat Korchagin	def_bool y
10731f0d6efeSEric DeVolder
10741f0d6efeSEric DeVolderconfig ARCH_SELECTS_KEXEC
10751f0d6efeSEric DeVolder	def_bool y
10761f0d6efeSEric DeVolder	depends on KEXEC
10775f365c13SConor Dooley	select HOTPLUG_CPU if SMP
1078fba8a867SNick Kossifidis
10791f0d6efeSEric DeVolderconfig ARCH_SUPPORTS_KEXEC_FILE
1080c41bd251SIgnat Korchagin	def_bool 64BIT
1081fba8a867SNick Kossifidis
10821f0d6efeSEric DeVolderconfig ARCH_SELECTS_KEXEC_FILE
10831f0d6efeSEric DeVolder	def_bool y
10841f0d6efeSEric DeVolder	depends on KEXEC_FILE
10855f365c13SConor Dooley	select HAVE_IMA_KEXEC if IMA
10866261586eSLiao Chang	select KEXEC_ELF
10876261586eSLiao Chang
1088e6265fe7SEric DeVolderconfig ARCH_SUPPORTS_KEXEC_PURGATORY
1089c1ad12eeSArnd Bergmann	def_bool ARCH_SUPPORTS_KEXEC_FILE
1090736e30afSLi Zhengyu
10911f0d6efeSEric DeVolderconfig ARCH_SUPPORTS_CRASH_DUMP
10921f0d6efeSEric DeVolder	def_bool y
1093fba8a867SNick Kossifidis
109431daa343SDave Vasilevskyconfig ARCH_DEFAULT_CRASH_DUMP
109531daa343SDave Vasilevsky	def_bool y
109631daa343SDave Vasilevsky
109739365395SBaoquan Heconfig ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION
109885fcde40SBaoquan He	def_bool CRASH_RESERVE
109939365395SBaoquan He
11009be84592SGuo Renconfig COMPAT
11019be84592SGuo Ren	bool "Kernel support for 32-bit U-mode"
11029be84592SGuo Ren	default 64BIT
11039be84592SGuo Ren	depends on 64BIT && MMU
11049be84592SGuo Ren	help
11059be84592SGuo Ren	  This option enables support for a 32-bit U-mode running under a 64-bit
11069be84592SGuo Ren	  kernel at S-mode. riscv32-specific components such as system calls,
11079be84592SGuo Ren	  the user helper functions (vdso), signal rt_frame functions and the
11089be84592SGuo Ren	  ptrace interface are handled appropriately by the kernel.
11099be84592SGuo Ren
11109be84592SGuo Ren	  If you want to execute 32-bit userspace applications, say Y.
11119be84592SGuo Ren
1112fdf68accSAndrew Jonesconfig PARAVIRT
1113fdf68accSAndrew Jones	bool "Enable paravirtualization code"
1114fdf68accSAndrew Jones	depends on RISCV_SBI
1115fdf68accSAndrew Jones	help
1116fdf68accSAndrew Jones	  This changes the kernel so it can modify itself when it is run
1117fdf68accSAndrew Jones	  under a hypervisor, potentially improving performance significantly
1118fdf68accSAndrew Jones	  over full virtualization.
1119fdf68accSAndrew Jones
1120fdf68accSAndrew Jonesconfig PARAVIRT_TIME_ACCOUNTING
1121fdf68accSAndrew Jones	bool "Paravirtual steal time accounting"
1122fdf68accSAndrew Jones	depends on PARAVIRT
1123fdf68accSAndrew Jones	help
1124fdf68accSAndrew Jones	  Select this option to enable fine granularity task steal time
1125fdf68accSAndrew Jones	  accounting. Time spent executing other tasks in parallel with
1126fdf68accSAndrew Jones	  the current vCPU is discounted from the vCPU power. To account for
1127fdf68accSAndrew Jones	  that, there can be a small performance impact.
1128fdf68accSAndrew Jones
1129fdf68accSAndrew Jones	  If in doubt, say N here.
1130fdf68accSAndrew Jones
113139b33072SAlexandre Ghiticonfig RELOCATABLE
113239b33072SAlexandre Ghiti	bool "Build a relocatable kernel"
1133ea2bde36SSamuel Holland	depends on !XIP_KERNEL
11342aff5f95SQingfang Deng	select MODULE_SECTIONS if MODULES
11359b400d17SArd Biesheuvel	select ARCH_VMLINUX_NEEDS_RELOCS
113639b33072SAlexandre Ghiti	help
113739b33072SAlexandre Ghiti          This builds a kernel as a Position Independent Executable (PIE),
113839b33072SAlexandre Ghiti          which retains all relocation metadata required to relocate the
113939b33072SAlexandre Ghiti          kernel binary at runtime to a different virtual address than the
114039b33072SAlexandre Ghiti          address it was linked at.
114139b33072SAlexandre Ghiti          Since RISCV uses the RELA relocation format, this requires a
114239b33072SAlexandre Ghiti          relocation pass at runtime even if the kernel is loaded at the
114339b33072SAlexandre Ghiti          same address it was linked at.
114439b33072SAlexandre Ghiti
114539b33072SAlexandre Ghiti          If unsure, say N.
114639b33072SAlexandre Ghiti
114784fe419dSAlexandre Ghiticonfig RANDOMIZE_BASE
114884fe419dSAlexandre Ghiti        bool "Randomize the address of the kernel image"
114984fe419dSAlexandre Ghiti        select RELOCATABLE
115084fe419dSAlexandre Ghiti        depends on MMU && 64BIT && !XIP_KERNEL
115184fe419dSAlexandre Ghiti        help
115284fe419dSAlexandre Ghiti          Randomizes the virtual address at which the kernel image is
115384fe419dSAlexandre Ghiti          loaded, as a security feature that deters exploit attempts
115484fe419dSAlexandre Ghiti          relying on knowledge of the location of kernel internals.
115584fe419dSAlexandre Ghiti
115684fe419dSAlexandre Ghiti          It is the bootloader's job to provide entropy, by passing a
115784fe419dSAlexandre Ghiti          random u64 value in /chosen/kaslr-seed at kernel entry.
115884fe419dSAlexandre Ghiti
115984fe419dSAlexandre Ghiti          When booting via the UEFI stub, it will invoke the firmware's
116084fe419dSAlexandre Ghiti          EFI_RNG_PROTOCOL implementation (if available) to supply entropy
116184fe419dSAlexandre Ghiti          to the kernel proper. In addition, it will randomise the physical
116284fe419dSAlexandre Ghiti          location of the kernel Image as well.
116384fe419dSAlexandre Ghiti
116484fe419dSAlexandre Ghiti          If unsure, say N.
116584fe419dSAlexandre Ghiti
11662f66a3d0SJuerg Haefligerendmenu # "Kernel features"
1167fbe934d6SPalmer Dabbelt
1168aef53f97SNick Kossifidismenu "Boot options"
1169aef53f97SNick Kossifidis
1170aef53f97SNick Kossifidisconfig CMDLINE
11713aed8c43SNick Kossifidis	string "Built-in kernel command line"
1172aef53f97SNick Kossifidis	help
11733aed8c43SNick Kossifidis	  For most platforms, the arguments for the kernel's command line
11743aed8c43SNick Kossifidis	  are provided at run-time, during boot. However, there are cases
11753aed8c43SNick Kossifidis	  where either no arguments are being provided or the provided
11763aed8c43SNick Kossifidis	  arguments are insufficient or even invalid.
11773aed8c43SNick Kossifidis
11783aed8c43SNick Kossifidis	  When that occurs, it is possible to define a built-in command
11793aed8c43SNick Kossifidis	  line here and choose how the kernel should use it later on.
11803aed8c43SNick Kossifidis
11813aed8c43SNick Kossifidischoice
1182b9d73218SMasahiro Yamada	prompt "Built-in command line usage"
1183b9d73218SMasahiro Yamada	depends on CMDLINE != ""
11843aed8c43SNick Kossifidis	default CMDLINE_FALLBACK
11853aed8c43SNick Kossifidis	help
11863aed8c43SNick Kossifidis	  Choose how the kernel will handle the provided built-in command
11873aed8c43SNick Kossifidis	  line.
11883aed8c43SNick Kossifidis
11893aed8c43SNick Kossifidisconfig CMDLINE_FALLBACK
11903aed8c43SNick Kossifidis	bool "Use bootloader kernel arguments if available"
11913aed8c43SNick Kossifidis	help
11923aed8c43SNick Kossifidis	  Use the built-in command line as fallback in case we get nothing
11933aed8c43SNick Kossifidis	  during boot. This is the default behaviour.
11943aed8c43SNick Kossifidis
11953aed8c43SNick Kossifidisconfig CMDLINE_EXTEND
11963aed8c43SNick Kossifidis	bool "Extend bootloader kernel arguments"
11973aed8c43SNick Kossifidis	help
119848d9aabfS谢致邦 (XIE Zhibang)	  The built-in command line will be appended to the command-
119948d9aabfS谢致邦 (XIE Zhibang)	  line arguments provided during boot. This is useful in
12003aed8c43SNick Kossifidis	  cases where the provided arguments are insufficient and
12013aed8c43SNick Kossifidis	  you don't want to or cannot modify them.
12023aed8c43SNick Kossifidis
1203aef53f97SNick Kossifidisconfig CMDLINE_FORCE
12043aed8c43SNick Kossifidis	bool "Always use the default kernel command string"
1205aef53f97SNick Kossifidis	help
12063aed8c43SNick Kossifidis	  Always use the built-in command line, even if we get one during
12073aed8c43SNick Kossifidis	  boot. This is useful in case you need to override the provided
12083aed8c43SNick Kossifidis	  command line on systems where you don't have or want control
12093aed8c43SNick Kossifidis	  over it.
1210aef53f97SNick Kossifidis
12113aed8c43SNick Kossifidisendchoice
1212aef53f97SNick Kossifidis
1213d7071743SAtish Patraconfig EFI_STUB
1214d7071743SAtish Patra	bool
1215d7071743SAtish Patra
1216d7071743SAtish Patraconfig EFI
1217d7071743SAtish Patra	bool "UEFI runtime support"
121844c92257SVitaly Wool	depends on OF && !XIP_KERNEL
1219b91540d5SAtish Patra	depends on MMU
1220d7071743SAtish Patra	default y
1221a91a9ffbSSunil V L	select ARCH_SUPPORTS_ACPI if 64BIT
12225f365c13SConor Dooley	select EFI_GENERIC_STUB
12235f365c13SConor Dooley	select EFI_PARAMS_FROM_FDT
12245f365c13SConor Dooley	select EFI_RUNTIME_WRAPPERS
12255f365c13SConor Dooley	select EFI_STUB
12265f365c13SConor Dooley	select LIBFDT
12275f365c13SConor Dooley	select RISCV_ISA_C
12285f365c13SConor Dooley	select UCS2_STRING
1229d7071743SAtish Patra	help
1230d7071743SAtish Patra	  This option provides support for runtime services provided
1231d7071743SAtish Patra	  by UEFI firmware (such as non-volatile variables, realtime
1232d7071743SAtish Patra	  clock, and platform reset). A UEFI stub is also provided to
1233d7071743SAtish Patra	  allow the kernel to be booted as an EFI application. This
1234d7071743SAtish Patra	  is only useful on systems that have UEFI firmware.
1235d7071743SAtish Patra
1236d6ecd188SHaibo Xuconfig DMI
1237d6ecd188SHaibo Xu	bool "Enable support for SMBIOS (DMI) tables"
1238d6ecd188SHaibo Xu	depends on EFI
1239d6ecd188SHaibo Xu	default y
1240d6ecd188SHaibo Xu	help
1241d6ecd188SHaibo Xu	  This enables SMBIOS/DMI feature for systems.
1242d6ecd188SHaibo Xu
1243d6ecd188SHaibo Xu	  This option is only useful on systems that have UEFI firmware.
1244d6ecd188SHaibo Xu	  However, even with this option, the resultant kernel should
1245d6ecd188SHaibo Xu	  continue to boot on existing non-UEFI platforms.
1246d6ecd188SHaibo Xu
1247fea2fed2SGuo Renconfig CC_HAVE_STACKPROTECTOR_TLS
1248fea2fed2SGuo Ren	def_bool $(cc-option,-mstack-protector-guard=tls -mstack-protector-guard-reg=tp -mstack-protector-guard-offset=0)
1249fea2fed2SGuo Ren
1250fea2fed2SGuo Renconfig STACKPROTECTOR_PER_TASK
1251fea2fed2SGuo Ren	def_bool y
1252595b893eSKees Cook	depends on !RANDSTRUCT
1253fea2fed2SGuo Ren	depends on STACKPROTECTOR && CC_HAVE_STACKPROTECTOR_TLS
1254fea2fed2SGuo Ren
1255867432beSAlexandre Ghiticonfig PHYS_RAM_BASE_FIXED
1256867432beSAlexandre Ghiti	bool "Explicitly specified physical RAM address"
125744c1e84aSPalmer Dabbelt	depends on NONPORTABLE
1258867432beSAlexandre Ghiti	default n
1259867432beSAlexandre Ghiti
126044c92257SVitaly Woolconfig PHYS_RAM_BASE
126144c92257SVitaly Wool	hex "Platform Physical RAM address"
1262867432beSAlexandre Ghiti	depends on PHYS_RAM_BASE_FIXED
126344c92257SVitaly Wool	default "0x80000000"
126444c92257SVitaly Wool	help
126544c92257SVitaly Wool	  This is the physical address of RAM in the system. It has to be
126644c92257SVitaly Wool	  explicitly specified to run early relocations of read-write data
126744c92257SVitaly Wool	  from flash to RAM.
126844c92257SVitaly Wool
126944c92257SVitaly Woolconfig XIP_KERNEL
127044c92257SVitaly Wool	bool "Kernel Execute-In-Place from ROM"
127144c1e84aSPalmer Dabbelt	depends on MMU && SPARSEMEM && NONPORTABLE
127244c92257SVitaly Wool	# This prevents XIP from being enabled by all{yes,mod}config, which
127344c92257SVitaly Wool	# fail to build since XIP doesn't support large kernels.
127444c92257SVitaly Wool	depends on !COMPILE_TEST
1275867432beSAlexandre Ghiti	select PHYS_RAM_BASE_FIXED
127644c92257SVitaly Wool	help
127744c92257SVitaly Wool	  Execute-In-Place allows the kernel to run from non-volatile storage
127844c92257SVitaly Wool	  directly addressable by the CPU, such as NOR flash. This saves RAM
127944c92257SVitaly Wool	  space since the text section of the kernel is not loaded from flash
128044c92257SVitaly Wool	  to RAM.  Read-write sections, such as the data section and stack,
128144c92257SVitaly Wool	  are still copied to RAM.  The XIP kernel is not compressed since
128244c92257SVitaly Wool	  it has to run directly from flash, so it will take more space to
128344c92257SVitaly Wool	  store it.  The flash address used to link the kernel object files,
128444c92257SVitaly Wool	  and for storing it, is configuration dependent. Therefore, if you
128544c92257SVitaly Wool	  say Y here, you must know the proper physical address where to
128644c92257SVitaly Wool	  store the kernel image depending on your own flash memory usage.
128744c92257SVitaly Wool
128844c92257SVitaly Wool	  Also note that the make target becomes "make xipImage" rather than
128944c92257SVitaly Wool	  "make zImage" or "make Image".  The final kernel binary to put in
129044c92257SVitaly Wool	  ROM memory will be arch/riscv/boot/xipImage.
129144c92257SVitaly Wool
129244c92257SVitaly Wool	  SPARSEMEM is required because the kernel text and rodata that are
129344c92257SVitaly Wool	  flash resident are not backed by memmap, then any attempt to get
129444c92257SVitaly Wool	  a struct page on those regions will trigger a fault.
129544c92257SVitaly Wool
129644c92257SVitaly Wool	  If unsure, say N.
129744c92257SVitaly Wool
129844c92257SVitaly Woolconfig XIP_PHYS_ADDR
129944c92257SVitaly Wool	hex "XIP Kernel Physical Location"
130044c92257SVitaly Wool	depends on XIP_KERNEL
130144c92257SVitaly Wool	default "0x21000000"
130244c92257SVitaly Wool	help
130344c92257SVitaly Wool	  This is the physical address in your flash memory the kernel will
130444c92257SVitaly Wool	  be linked for and stored to.  This address is dependent on your
130544c92257SVitaly Wool	  own flash usage.
130644c92257SVitaly Wool
1307496ea826SConor Dooleyconfig RISCV_ISA_FALLBACK
1308496ea826SConor Dooley	bool "Permit falling back to parsing riscv,isa for extension support by default"
1309496ea826SConor Dooley	default y
1310496ea826SConor Dooley	help
1311496ea826SConor Dooley	  Parsing the "riscv,isa" devicetree property has been deprecated and
1312496ea826SConor Dooley	  replaced by a list of explicitly defined strings. For compatibility
1313496ea826SConor Dooley	  with existing platforms, the kernel will fall back to parsing the
1314496ea826SConor Dooley	  "riscv,isa" property if the replacements are not found.
1315496ea826SConor Dooley
1316496ea826SConor Dooley	  Selecting N here will result in a kernel that does not use the
1317496ea826SConor Dooley	  fallback, unless the commandline "riscv_isa_fallback" parameter is
1318496ea826SConor Dooley	  present.
1319496ea826SConor Dooley
1320496ea826SConor Dooley	  Please see the dt-binding, located at
1321496ea826SConor Dooley	  Documentation/devicetree/bindings/riscv/extensions.yaml for details
1322496ea826SConor Dooley	  on the replacement properties, "riscv,isa-base" and
1323496ea826SConor Dooley	  "riscv,isa-extensions".
1324496ea826SConor Dooley
13252d268251SPalmer Dabbeltconfig BUILTIN_DTB
13266c4a2f63SFrederik Haxel	bool "Built-in device tree"
132744c1e84aSPalmer Dabbelt	depends on OF && NONPORTABLE
132882e81b89SMasahiro Yamada	select GENERIC_BUILTIN_DTB
13292672031bSYangyu Chen	help
13302672031bSYangyu Chen	  Build a device tree into the Linux image.
13312672031bSYangyu Chen	  This option should be selected if no bootloader is being used.
13322672031bSYangyu Chen	  If unsure, say N.
13332672031bSYangyu Chen
13342672031bSYangyu Chen
133582e81b89SMasahiro Yamadaconfig BUILTIN_DTB_NAME
13362672031bSYangyu Chen	string "Built-in device tree source"
13372672031bSYangyu Chen	depends on BUILTIN_DTB
13382672031bSYangyu Chen	help
13392672031bSYangyu Chen	  DTS file path (without suffix, relative to arch/riscv/boot/dts)
13402672031bSYangyu Chen	  for the DTS file that will be used to produce the DTB linked into the
13412672031bSYangyu Chen	  kernel.
13422d268251SPalmer Dabbelt
13436c4a2f63SFrederik Haxelendmenu # "Boot options"
13446c4a2f63SFrederik Haxel
134544c1e84aSPalmer Dabbeltconfig PORTABLE
134644c1e84aSPalmer Dabbelt	bool
134744c1e84aSPalmer Dabbelt	default !NONPORTABLE
134844c1e84aSPalmer Dabbelt	select EFI
134944c1e84aSPalmer Dabbelt	select MMU
13505f365c13SConor Dooley	select OF
135144c1e84aSPalmer Dabbelt
1352e0c0a7c3SAndreas Schwabconfig ARCH_PROC_KCORE_TEXT
1353e0c0a7c3SAndreas Schwab	def_bool y
1354e0c0a7c3SAndreas Schwab
1355fbe934d6SPalmer Dabbeltmenu "Power management options"
1356fbe934d6SPalmer Dabbelt
13578636a1f9SMasahiro Yamadasource "kernel/power/Kconfig"
1358fbe934d6SPalmer Dabbelt
1359c0317210SSia Jee Hengconfig ARCH_HIBERNATION_POSSIBLE
1360e2d6b54bSConor Dooley	def_bool y
1361c0317210SSia Jee Heng
1362c0317210SSia Jee Hengconfig ARCH_HIBERNATION_HEADER
1363c0317210SSia Jee Heng	def_bool HIBERNATION
1364c0317210SSia Jee Heng
1365c1f048a6SSong Shuaiconfig ARCH_SUSPEND_POSSIBLE
1366c1f048a6SSong Shuai	def_bool y
1367c1f048a6SSong Shuai
13682f66a3d0SJuerg Haefligerendmenu # "Power management options"
1369d7071743SAtish Patra
1370f6e64b66SAnup Patelmenu "CPU Power Management"
1371f6e64b66SAnup Patel
1372f6e64b66SAnup Patelsource "drivers/cpuidle/Kconfig"
1373f6e64b66SAnup Patel
1374effae0e3SLad Prabhakarsource "drivers/cpufreq/Kconfig"
1375effae0e3SLad Prabhakar
13762f66a3d0SJuerg Haefligerendmenu # "CPU Power Management"
1377f6e64b66SAnup Patel
137899cdc6c1SAnup Patelsource "arch/riscv/kvm/Kconfig"
1379a91a9ffbSSunil V L
1380a91a9ffbSSunil V Lsource "drivers/acpi/Kconfig"
1381