xref: /linux/arch/riscv/Kconfig (revision 119b1e61a769aa98e68599f44721661a4d8c55f3)
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
6674f8fc31SSami Tolvanen	select ARCH_SUPPORTS_CFI_CLANG
677f85b04bSJisheng Zhang	select ARCH_SUPPORTS_DEBUG_PAGEALLOC if MMU
6803dc00a2SAndrew Bresticker	select ARCH_SUPPORTS_HUGE_PFNMAP if TRANSPARENT_HUGEPAGE
69855f9a8eSAnshuman Khandual	select ARCH_SUPPORTS_HUGETLBFS if MMU
70021d2342SWende Tan	# LLD >= 14: https://github.com/llvm/llvm-project/issues/50505
71021d2342SWende Tan	select ARCH_SUPPORTS_LTO_CLANG if LLD_VERSION >= 140000
72021d2342SWende Tan	select ARCH_SUPPORTS_LTO_CLANG_THIN if LLD_VERSION >= 140000
73a869b8c2SJisheng Zhang	select ARCH_SUPPORTS_MSEAL_SYSTEM_MAPPINGS if 64BIT && MMU
7434c0a5b0SYueHaibing	select ARCH_SUPPORTS_PAGE_TABLE_CHECK if MMU
75648321faSJisheng Zhang	select ARCH_SUPPORTS_PER_VMA_LOCK if MMU
762638e4e6SSebastian Andrzej Siewior	select ARCH_SUPPORTS_RT
77d1584d79SSami Tolvanen	select ARCH_SUPPORTS_SHADOW_CALL_STACK if HAVE_SHADOW_CALL_STACK
78eb1e5037SJisheng Zhang	select ARCH_USE_CMPXCHG_LOCKREF if 64BIT
7997a03108SKefeng Wang	select ARCH_USE_MEMTEST
80c9c0b0baSPalmer Dabbelt	select ARCH_USE_QUEUED_RWLOCKS
817c9d980eSJisheng Zhang	select ARCH_USE_SYM_ANNOTATIONS
82af0ead42SSami Tolvanen	select ARCH_USES_CFI_TRAPS if CFI_CLANG
83c6026d35SSamuel Holland	select ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH if MMU
84e8c7ef7dSPalmer Dabbelt	select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU
85fbe934d6SPalmer Dabbelt	select ARCH_WANT_FRAME_POINTERS
8682a1a1f3SQinglin Pan	select ARCH_WANT_GENERAL_HUGETLB if !RISCV_ISA_SVNAPOT
87e8c7ef7dSPalmer Dabbelt	select ARCH_WANT_HUGE_PMD_SHARE if 64BIT
88f4b71bffSJisheng Zhang	select ARCH_WANT_LD_ORPHAN_WARN if !XIP_KERNEL
894705c157SBjörn Töpel	select ARCH_WANT_OPTIMIZE_DAX_VMEMMAP
900b6f1582SAneesh Kumar K.V	select ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP
91cfbc4f81SJisheng Zhang	select ARCH_WANTS_NO_INSTR
9287f81e66SJisheng Zhang	select ARCH_WANTS_THP_SWAP if HAVE_ARCH_TRANSPARENT_HUGEPAGE
93ab83647fSAlexandre Ghiti	select ARCH_WEAK_RELEASE_ACQUIRE if ARCH_USE_QUEUED_SPINLOCKS
9409accc3aSDamien Le Moal	select BINFMT_FLAT_NO_DATA_START_OFFSET if !MMU
9554fed35fSJisheng Zhang	select BUILDTIME_TABLE_SORT if MMU
96f862bbf4SSamuel Holland	select CLINT_TIMER if RISCV_M_MODE
975f365c13SConor Dooley	select CLONE_BACKWARDS
98fbe934d6SPalmer Dabbelt	select COMMON_CLK
994dc4af9cSAndrew Jones	select CPU_PM if CPU_IDLE || HIBERNATION || SUSPEND
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
13842e0e0b4SJisheng Zhang	select HAVE_ARCH_KGDB if !XIP_KERNEL
139e8c7ef7dSPalmer Dabbelt	select HAVE_ARCH_KGDB_QXFER_PKT
140e8c7ef7dSPalmer Dabbelt	select HAVE_ARCH_MMAP_RND_BITS if MMU
1419be84592SGuo Ren	select HAVE_ARCH_MMAP_RND_COMPAT_BITS if COMPAT
14205d450aaSSong Shuai	select HAVE_ARCH_RANDOMIZE_KSTACK_OFFSET
1435340627eSDavid Abdurachmanov	select HAVE_ARCH_SECCOMP_FILTER
144b5db73fbSJisheng Zhang	select HAVE_ARCH_STACKLEAK
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
161ab7fa6b0SJisheng Zhang	select HAVE_FTRACE_MCOUNT_RECORD if !XIP_KERNEL
162e8eb8e1bSPu Lehui	select HAVE_FUNCTION_GRAPH_TRACER if HAVE_DYNAMIC_FTRACE_WITH_ARGS
163a3ed4157SMasami Hiramatsu (Google)	select HAVE_FUNCTION_GRAPH_FREGS
164d0262e90SAndy Chiu	select HAVE_FUNCTION_TRACER if !XIP_KERNEL
165e8c7ef7dSPalmer Dabbelt	select HAVE_EBPF_JIT if MMU
16625176ad0SDavid Hildenbrand	select HAVE_GUP_FAST if MMU
1675f365c13SConor Dooley	select HAVE_FUNCTION_ARG_ACCESS_API
168ee55ff80SGuo Ren	select HAVE_FUNCTION_ERROR_INJECTION
16920d38f7cSTobias Klauser	select HAVE_GCC_PLUGINS
170ad5d1122SVincent Chen	select HAVE_GENERIC_VDSO if MMU && 64BIT
17131564b8bSKefeng Wang	select HAVE_IRQ_TIME_ACCOUNTING
172e79dfcbfSEmil Renner Berthing	select HAVE_KERNEL_BZIP2 if !XIP_KERNEL && !EFI_ZBOOT
173e79dfcbfSEmil Renner Berthing	select HAVE_KERNEL_GZIP if !XIP_KERNEL && !EFI_ZBOOT
174e79dfcbfSEmil Renner Berthing	select HAVE_KERNEL_LZ4 if !XIP_KERNEL && !EFI_ZBOOT
175e79dfcbfSEmil Renner Berthing	select HAVE_KERNEL_LZMA if !XIP_KERNEL && !EFI_ZBOOT
176e79dfcbfSEmil Renner Berthing	select HAVE_KERNEL_LZO if !XIP_KERNEL && !EFI_ZBOOT
177e79dfcbfSEmil Renner Berthing	select HAVE_KERNEL_UNCOMPRESSED if !XIP_KERNEL && !EFI_ZBOOT
178e79dfcbfSEmil Renner Berthing	select HAVE_KERNEL_ZSTD if !XIP_KERNEL && !EFI_ZBOOT
179ab4ce983SLasse Collin	select HAVE_KERNEL_XZ if !XIP_KERNEL && !EFI_ZBOOT
18042e0e0b4SJisheng Zhang	select HAVE_KPROBES if !XIP_KERNEL
18142e0e0b4SJisheng Zhang	select HAVE_KRETPROBES if !XIP_KERNEL
182f7584322SNick Desaulniers	# https://github.com/ClangBuiltLinux/linux/issues/1881
183f7584322SNick Desaulniers	select HAVE_LD_DEAD_CODE_DATA_ELIMINATION if !LD_IS_LLD
1843332f419SJisheng Zhang	select HAVE_MOVE_PMD
1853332f419SJisheng Zhang	select HAVE_MOVE_PUD
1865394f1e9SArnd Bergmann	select HAVE_PAGE_SIZE_4KB
187e8c7ef7dSPalmer Dabbelt	select HAVE_PCI
188178e9fc4SAlan Kao	select HAVE_PERF_EVENTS
18998a93b0bSMao Han	select HAVE_PERF_REGS
19098a93b0bSMao Han	select HAVE_PERF_USER_STACK_DUMP
191b60ca697SJisheng Zhang	select HAVE_POSIX_CPU_TIMERS_TASK_WORK
1924e90d052SJisheng Zhang	select HAVE_PREEMPT_DYNAMIC_KEY if !XIP_KERNEL
193dcdc7a53SPatrick Stählin	select HAVE_REGS_AND_STACK_ACCESS_API
194ab7fa6b0SJisheng Zhang	select HAVE_RETHOOK if !XIP_KERNEL
1955f365c13SConor Dooley	select HAVE_RSEQ
19633549fcfSConor Dooley	select HAVE_RUST if RUSTC_SUPPORTS_RISCV && CC_IS_CLANG
197629291ddSSong Shuai	select HAVE_SAMPLE_FTRACE_DIRECT
198629291ddSSong Shuai	select HAVE_SAMPLE_FTRACE_DIRECT_MULTI
199f2c9699fSGuo Ren	select HAVE_STACKPROTECTOR
2005aeb1b36SDavid Abdurachmanov	select HAVE_SYSCALL_TRACEPOINTS
20172b11aa7SThomas Gleixner	select HOTPLUG_CORE_SYNC_DEAD if HOTPLUG_CPU
202fbe934d6SPalmer Dabbelt	select IRQ_DOMAIN
2038165c6aeSKefeng Wang	select IRQ_FORCED_THREADING
204864046c5SAlexandre Ghiti	select KASAN_VMALLOC if KASAN
2057267ef7bSBen Hutchings	select LOCK_MM_AND_FIND_VMA
20669be3fb1SJisheng Zhang	select MMU_GATHER_RCU_TABLE_FREE if SMP && MMU
207fbe934d6SPalmer Dabbelt	select MODULES_USE_ELF_RELA if MODULES
208e8c7ef7dSPalmer Dabbelt	select OF
209e8c7ef7dSPalmer Dabbelt	select OF_EARLY_FLATTREE
210e8c7ef7dSPalmer Dabbelt	select OF_IRQ
2112eac9c2dSChristoph Hellwig	select PCI_DOMAINS_GENERIC if PCI
21201415e78SSunil V L	select PCI_ECAM if (ACPI && PCI)
213eb01d42aSChristoph Hellwig	select PCI_MSI if PCI
214e1cf2d00SSamuel Holland	select RELOCATABLE if !MMU && !PHYS_RAM_BASE_FIXED
2151ee7fc3fSConor Dooley	select RISCV_ALTERNATIVE if !XIP_KERNEL
2160eebc69dSAnup Patel	select RISCV_APLIC
2170eebc69dSAnup Patel	select RISCV_IMSIC
218e71ee06eSAnup Patel	select RISCV_INTC
2192bc3fc87SAnup Patel	select RISCV_TIMER if RISCV_SBI
220bf3d7b1dSConor Dooley	select SIFIVE_PLIC
221e8c7ef7dSPalmer Dabbelt	select SPARSE_IRQ
222e8c7ef7dSPalmer Dabbelt	select SYSCTL_EXCEPTION_TRACE
223e8c7ef7dSPalmer Dabbelt	select THREAD_INFO_IN_TASK
2244aae683fSMasahiro Yamada	select TRACE_IRQFLAGS_SUPPORT
22511129e8eSChristoph Hellwig	select UACCESS_MEMCPY if !MMU
226*ee0d0305SXi Ruoyao	select VDSO_GETRANDOM if HAVE_GENERIC_VDSO
2271a748331SJinjie Ruan	select USER_STACKTRACE_SUPPORT
22863703f37SKefeng Wang	select ZONE_DMA32 if 64BIT
22954c95a11SAlexandre Ghiti
230d077242dSAlice Ryhlconfig RUSTC_SUPPORTS_RISCV
231d077242dSAlice Ryhl	def_bool y
232d077242dSAlice Ryhl	depends on 64BIT
233d077242dSAlice Ryhl	# Shadow call stack requires rustc version 1.82+ due to use of the
234d077242dSAlice Ryhl	# -Zsanitizer=shadow-call-stack flag.
235d077242dSAlice Ryhl	depends on !SHADOW_CALL_STACK || RUSTC_VERSION >= 108200
236d077242dSAlice Ryhl
237b3d6bdfeSNathan Chancellorconfig CLANG_SUPPORTS_DYNAMIC_FTRACE
238b3d6bdfeSNathan Chancellor	def_bool CC_IS_CLANG
239b3d6bdfeSNathan Chancellor	# https://github.com/ClangBuiltLinux/linux/issues/1817
240b3d6bdfeSNathan Chancellor	depends on AS_IS_GNU || (AS_IS_LLVM && (LD_IS_LLD || LD_VERSION >= 23600))
241b3d6bdfeSNathan Chancellor
242b3d6bdfeSNathan Chancellorconfig GCC_SUPPORTS_DYNAMIC_FTRACE
243b3d6bdfeSNathan Chancellor	def_bool CC_IS_GCC
244b3d6bdfeSNathan Chancellor	depends on $(cc-option,-fpatchable-function-entry=8)
245c41bf432SAndy Chiu	depends on CC_HAS_MIN_FUNCTION_ALIGNMENT || !RISCV_ISA_C
246b3d6bdfeSNathan Chancellor
247d1584d79SSami Tolvanenconfig HAVE_SHADOW_CALL_STACK
248d1584d79SSami Tolvanen	def_bool $(cc-option,-fsanitize=shadow-call-stack)
249d1584d79SSami Tolvanen	# https://github.com/riscv-non-isa/riscv-elf-psabi-doc/commit/a484e843e6eeb51f0cb7b8819e50da6d2444d769
250d1584d79SSami Tolvanen	depends on $(ld-option,--no-relax-gp)
251d1584d79SSami Tolvanen
25255b71d2cSNathan Chancellorconfig RISCV_USE_LINKER_RELAXATION
25355b71d2cSNathan Chancellor	def_bool y
25455b71d2cSNathan Chancellor	# https://github.com/llvm/llvm-project/commit/6611d58f5bbcbec77262d392e2923e1d680f6985
25555b71d2cSNathan Chancellor	depends on !LD_IS_LLD || LLD_VERSION >= 150000
25655b71d2cSNathan Chancellor
257ae84ff9aSNathan Chancellor# https://github.com/llvm/llvm-project/commit/bbc0f99f3bc96f1db16f649fc21dd18e5b0918f6
258ae84ff9aSNathan Chancellorconfig ARCH_HAS_BROKEN_DWARF5
259ae84ff9aSNathan Chancellor	def_bool y
260ae84ff9aSNathan Chancellor	depends on RISCV_USE_LINKER_RELAXATION
261ae84ff9aSNathan Chancellor	# https://github.com/llvm/llvm-project/commit/1df5ea29b43690b6622db2cad7b745607ca4de6a
262ae84ff9aSNathan Chancellor	depends on AS_IS_LLVM && AS_VERSION < 180000
263ae84ff9aSNathan Chancellor	# https://github.com/llvm/llvm-project/commit/7ffabb61a5569444b5ac9322e22e5471cc5e4a77
264ae84ff9aSNathan Chancellor	depends on LD_IS_LLD && LLD_VERSION < 180000
265ae84ff9aSNathan Chancellor
26654c95a11SAlexandre Ghiticonfig ARCH_MMAP_RND_BITS_MIN
26754c95a11SAlexandre Ghiti	default 18 if 64BIT
26854c95a11SAlexandre Ghiti	default 8
26954c95a11SAlexandre Ghiti
2709be84592SGuo Renconfig ARCH_MMAP_RND_COMPAT_BITS_MIN
2719be84592SGuo Ren	default 8
2729be84592SGuo Ren
27354c95a11SAlexandre Ghiti# max bits determined by the following formula:
27454c95a11SAlexandre Ghiti#  VA_BITS - PAGE_SHIFT - 3
27554c95a11SAlexandre Ghiticonfig ARCH_MMAP_RND_BITS_MAX
27654c95a11SAlexandre Ghiti	default 24 if 64BIT # SV39 based
27754c95a11SAlexandre Ghiti	default 17
278fbe934d6SPalmer Dabbelt
2799be84592SGuo Renconfig ARCH_MMAP_RND_COMPAT_BITS_MAX
2809be84592SGuo Ren	default 17
2819be84592SGuo Ren
282a4c3733dSChristoph Hellwig# set if we run in machine mode, cleared if we run in supervisor mode
283a4c3733dSChristoph Hellwigconfig RISCV_M_MODE
284f862bbf4SSamuel Holland	bool "Build a kernel that runs in machine mode"
285f862bbf4SSamuel Holland	depends on !MMU
286f862bbf4SSamuel Holland	default y
287f862bbf4SSamuel Holland	help
288f862bbf4SSamuel Holland	  Select this option if you want to run the kernel in M-mode,
289f862bbf4SSamuel Holland	  without the assistance of any other firmware.
290a4c3733dSChristoph Hellwig
291eded8bc6SDamien Le Moal# set if we are running in S-mode and can use SBI calls
292eded8bc6SDamien Le Moalconfig RISCV_SBI
293eded8bc6SDamien Le Moal	bool
294eded8bc6SDamien Le Moal	depends on !RISCV_M_MODE
295eded8bc6SDamien Le Moal	default y
296eded8bc6SDamien Le Moal
297fbe934d6SPalmer Dabbeltconfig MMU
2986bd33e1eSChristoph Hellwig	bool "MMU-based Paged Memory Management Support"
2996bd33e1eSChristoph Hellwig	default y
3006bd33e1eSChristoph Hellwig	help
3016bd33e1eSChristoph Hellwig	  Select if you want MMU-based virtualised addressing space
3026bd33e1eSChristoph Hellwig	  support by paged memory management. If unsure, say 'Y'.
303fbe934d6SPalmer Dabbelt
30454c5639dSAlexandre Ghiticonfig KASAN_SHADOW_OFFSET
30554c5639dSAlexandre Ghiti	hex
30654c5639dSAlexandre Ghiti	depends on KASAN_GENERIC
307f7ae0233SAlexandre Ghiti	default 0xdfffffff00000000 if 64BIT
30854c5639dSAlexandre Ghiti	default 0xffffffff if 32BIT
30954c5639dSAlexandre Ghiti
310d95f1a54SLogan Gunthorpeconfig ARCH_FLATMEM_ENABLE
3114f0e8eefSAtish Patra	def_bool !NUMA
312d95f1a54SLogan Gunthorpe
313d95f1a54SLogan Gunthorpeconfig ARCH_SPARSEMEM_ENABLE
314d95f1a54SLogan Gunthorpe	def_bool y
315aa273420SDamien Le Moal	depends on MMU
316199fc6b8SKefeng Wang	select SPARSEMEM_STATIC if 32BIT && SPARSEMEM
317a5406a7fSKefeng Wang	select SPARSEMEM_VMEMMAP_ENABLE if 64BIT
318d95f1a54SLogan Gunthorpe
319d95f1a54SLogan Gunthorpeconfig ARCH_SELECT_MEMORY_MODEL
320d95f1a54SLogan Gunthorpe	def_bool ARCH_SPARSEMEM_ENABLE
321d95f1a54SLogan Gunthorpe
32274784081SGuo Renconfig ARCH_SUPPORTS_UPROBES
32374784081SGuo Ren	def_bool y
32474784081SGuo Ren
325fbe934d6SPalmer Dabbeltconfig STACKTRACE_SUPPORT
326fbe934d6SPalmer Dabbelt	def_bool y
327fbe934d6SPalmer Dabbelt
328fbe934d6SPalmer Dabbeltconfig GENERIC_BUG
329fbe934d6SPalmer Dabbelt	def_bool y
330fbe934d6SPalmer Dabbelt	depends on BUG
331fbe934d6SPalmer Dabbelt	select GENERIC_BUG_RELATIVE_POINTERS if 64BIT
332fbe934d6SPalmer Dabbelt
333fbe934d6SPalmer Dabbeltconfig GENERIC_BUG_RELATIVE_POINTERS
334fbe934d6SPalmer Dabbelt	bool
335fbe934d6SPalmer Dabbelt
336fbe934d6SPalmer Dabbeltconfig GENERIC_CALIBRATE_DELAY
337fbe934d6SPalmer Dabbelt	def_bool y
338fbe934d6SPalmer Dabbelt
339fbe934d6SPalmer Dabbeltconfig GENERIC_CSUM
340fbe934d6SPalmer Dabbelt	def_bool y
341fbe934d6SPalmer Dabbelt
342fbe934d6SPalmer Dabbeltconfig GENERIC_HWEIGHT
343fbe934d6SPalmer Dabbelt	def_bool y
344fbe934d6SPalmer Dabbelt
345f2c17aabSAnup Patelconfig FIX_EARLYCON_MEM
3460312a3d4SAndreas Schwab	def_bool MMU
347f2c17aabSAnup Patel
3485c178472SJisheng Zhangconfig ILLEGAL_POINTER_VALUE
3495c178472SJisheng Zhang	hex
3505c178472SJisheng Zhang	default 0 if 32BIT
3515c178472SJisheng Zhang	default 0xdead000000000000 if 64BIT
3525c178472SJisheng Zhang
353fbe934d6SPalmer Dabbeltconfig PGTABLE_LEVELS
354fbe934d6SPalmer Dabbelt	int
355011f09d1SQinglin Pan	default 5 if 64BIT
356fbe934d6SPalmer Dabbelt	default 2
357fbe934d6SPalmer Dabbelt
3583c469798SGuo Renconfig LOCKDEP_SUPPORT
3593c469798SGuo Ren	def_bool y
3603c469798SGuo Ren
3611631ba12SHeiko Stuebnerconfig RISCV_DMA_NONCOHERENT
3621631ba12SHeiko Stuebner	bool
3631631ba12SHeiko Stuebner	select ARCH_HAS_DMA_PREP_COHERENT
3641631ba12SHeiko Stuebner	select ARCH_HAS_SETUP_DMA_OPS
3655f365c13SConor Dooley	select ARCH_HAS_SYNC_DMA_FOR_CPU
3665f365c13SConor Dooley	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
367f51f7a0fSJisheng Zhang	select DMA_BOUNCE_UNALIGNED_KMALLOC if SWIOTLB
3681631ba12SHeiko Stuebner
369b79f300cSLad Prabhakarconfig RISCV_NONSTANDARD_CACHE_OPS
370b79f300cSLad Prabhakar	bool
371b79f300cSLad Prabhakar	help
372b79f300cSLad Prabhakar	  This enables function pointer support for non-standard noncoherent
373b79f300cSLad Prabhakar	  systems to handle cache management.
374b79f300cSLad Prabhakar
3755ac43ab2SAndrew Jonesconfig AS_HAS_INSN
3765ac43ab2SAndrew Jones	def_bool $(as-instr,.insn r 51$(comma) 0$(comma) 0$(comma) t0$(comma) t0$(comma) zero)
3775ac43ab2SAndrew Jones
378e4bb020fSAndy Chiuconfig AS_HAS_OPTION_ARCH
379fafdea34SNathan Chancellor	# https://github.com/llvm/llvm-project/commit/9e8ed3403c191ab9c4903e8eeb8f732ff8a43cb4
380e4bb020fSAndy Chiu	def_bool y
381e4bb020fSAndy Chiu	depends on $(as-instr, .option arch$(comma) +m)
382e4bb020fSAndy Chiu
3830cbb8a32SLoys Olliviersource "arch/riscv/Kconfig.socs"
384a3d095acSAndrew Jonessource "arch/riscv/Kconfig.errata"
3850cbb8a32SLoys Ollivier
386fbe934d6SPalmer Dabbeltmenu "Platform type"
387fbe934d6SPalmer Dabbelt
38844c1e84aSPalmer Dabbeltconfig NONPORTABLE
38944c1e84aSPalmer Dabbelt	bool "Allow configurations that result in non-portable kernels"
39044c1e84aSPalmer Dabbelt	help
39144c1e84aSPalmer Dabbelt	  RISC-V kernel binaries are compatible between all known systems
39244c1e84aSPalmer Dabbelt	  whenever possible, but there are some use cases that can only be
39344c1e84aSPalmer Dabbelt	  satisfied by configurations that result in kernel binaries that are
39444c1e84aSPalmer Dabbelt	  not portable between systems.
39544c1e84aSPalmer Dabbelt
39644c1e84aSPalmer Dabbelt	  Selecting N does not guarantee kernels will be portable to all known
39744c1e84aSPalmer Dabbelt	  systems.  Selecting any of the options guarded by NONPORTABLE will
39844c1e84aSPalmer Dabbelt	  result in kernel binaries that are unlikely to be portable between
39944c1e84aSPalmer Dabbelt	  systems.
40044c1e84aSPalmer Dabbelt
40144c1e84aSPalmer Dabbelt	  If unsure, say N.
40244c1e84aSPalmer Dabbelt
403fbe934d6SPalmer Dabbeltchoice
404fbe934d6SPalmer Dabbelt	prompt "Base ISA"
405fbe934d6SPalmer Dabbelt	default ARCH_RV64I
406fbe934d6SPalmer Dabbelt	help
40786cca81aSAntony Pavlov	  This selects the base ISA that this kernel will target and must match
408fbe934d6SPalmer Dabbelt	  the target platform.
409fbe934d6SPalmer Dabbelt
410fbe934d6SPalmer Dabbeltconfig ARCH_RV32I
411fbe934d6SPalmer Dabbelt	bool "RV32I"
41244c1e84aSPalmer Dabbelt	depends on NONPORTABLE
413fbe934d6SPalmer Dabbelt	select 32BIT
414e3d59805SMatt Redfearn	select GENERIC_LIB_ASHLDI3
415e3d59805SMatt Redfearn	select GENERIC_LIB_ASHRDI3
416e3d59805SMatt Redfearn	select GENERIC_LIB_LSHRDI3
4178f79125dSZong Li	select GENERIC_LIB_UCMPDI2
418fbe934d6SPalmer Dabbelt
419fbe934d6SPalmer Dabbeltconfig ARCH_RV64I
420fbe934d6SPalmer Dabbelt	bool "RV64I"
421fbe934d6SPalmer Dabbelt	select 64BIT
422d2075895SNick Desaulniers	select ARCH_SUPPORTS_INT128 if CC_HAS_INT128
4236bd33e1eSChristoph Hellwig	select SWIOTLB if MMU
424fbe934d6SPalmer Dabbelt
425fbe934d6SPalmer Dabbeltendchoice
426fbe934d6SPalmer Dabbelt
427fbe934d6SPalmer Dabbelt# We must be able to map all physical memory into the kernel, but the compiler
428fbe934d6SPalmer Dabbelt# is still a bit more efficient when generating code if it's setup in a manner
429fbe934d6SPalmer Dabbelt# such that it can only map 2GiB of memory.
430fbe934d6SPalmer Dabbeltchoice
431fbe934d6SPalmer Dabbelt	prompt "Kernel Code Model"
432fbe934d6SPalmer Dabbelt	default CMODEL_MEDLOW if 32BIT
433fbe934d6SPalmer Dabbelt	default CMODEL_MEDANY if 64BIT
434fbe934d6SPalmer Dabbelt
435fbe934d6SPalmer Dabbelt	config CMODEL_MEDLOW
436fbe934d6SPalmer Dabbelt		bool "medium low code model"
437fbe934d6SPalmer Dabbelt	config CMODEL_MEDANY
438fbe934d6SPalmer Dabbelt		bool "medium any code model"
439fbe934d6SPalmer Dabbeltendchoice
440fbe934d6SPalmer Dabbelt
441ab1ef68eSZong Liconfig MODULE_SECTIONS
442ab1ef68eSZong Li	bool
443ab1ef68eSZong Li	select HAVE_MOD_ARCH_SPECIFIC
444ab1ef68eSZong Li
445fbe934d6SPalmer Dabbeltconfig SMP
446fbe934d6SPalmer Dabbelt	bool "Symmetric Multi-Processing"
447fbe934d6SPalmer Dabbelt	help
448fbe934d6SPalmer Dabbelt	  This enables support for systems with more than one CPU.  If
449fbe934d6SPalmer Dabbelt	  you say N here, the kernel will run on single and
450fbe934d6SPalmer Dabbelt	  multiprocessor machines, but will use only one CPU of a
451fbe934d6SPalmer Dabbelt	  multiprocessor machine. If you say Y here, the kernel will run
452fbe934d6SPalmer Dabbelt	  on many, but not all, single processor machines. On a single
453fbe934d6SPalmer Dabbelt	  processor machine, the kernel will run faster if you say N
454fbe934d6SPalmer Dabbelt	  here.
455fbe934d6SPalmer Dabbelt
456fbe934d6SPalmer Dabbelt	  If you don't know what to do here, say N.
457fbe934d6SPalmer Dabbelt
4588bf7b3b6SSong Shuaiconfig SCHED_MC
4598bf7b3b6SSong Shuai	bool "Multi-core scheduler support"
4608bf7b3b6SSong Shuai	depends on SMP
4618bf7b3b6SSong Shuai	help
4628bf7b3b6SSong Shuai	  Multi-core scheduler support improves the CPU scheduler's decision
4638bf7b3b6SSong Shuai	  making when dealing with multi-core CPU chips at a cost of slightly
4648bf7b3b6SSong Shuai	  increased overhead in some places. If unsure say N here.
4658bf7b3b6SSong Shuai
466fbe934d6SPalmer Dabbeltconfig NR_CPUS
467e623715fSAnup Patel	int "Maximum number of CPUs (2-512)"
468fbe934d6SPalmer Dabbelt	depends on SMP
4691d6b5ed4SSamuel Holland	range 2 512 if !RISCV_SBI_V01
4701d6b5ed4SSamuel Holland	range 2 32 if RISCV_SBI_V01 && 32BIT
4711d6b5ed4SSamuel Holland	range 2 64 if RISCV_SBI_V01 && 64BIT
472e623715fSAnup Patel	default "32" if 32BIT
473e623715fSAnup Patel	default "64" if 64BIT
474fbe934d6SPalmer Dabbelt
475f1e58583SAtish Patraconfig HOTPLUG_CPU
476f1e58583SAtish Patra	bool "Support for hot-pluggable CPUs"
477f1e58583SAtish Patra	depends on SMP
478f1e58583SAtish Patra	select GENERIC_IRQ_MIGRATION
479f1e58583SAtish Patra	help
480f1e58583SAtish Patra
481f1e58583SAtish Patra	  Say Y here to experiment with turning CPUs off and on.  CPUs
482f1e58583SAtish Patra	  can be controlled through /sys/devices/system/cpu.
483f1e58583SAtish Patra
484f1e58583SAtish Patra	  Say N if you want to disable CPU hotplug.
485f1e58583SAtish Patra
486fbe934d6SPalmer Dabbeltchoice
487fbe934d6SPalmer Dabbelt	prompt "CPU Tuning"
488fbe934d6SPalmer Dabbelt	default TUNE_GENERIC
489fbe934d6SPalmer Dabbelt
490fbe934d6SPalmer Dabbeltconfig TUNE_GENERIC
491fbe934d6SPalmer Dabbelt	bool "generic"
492fbe934d6SPalmer Dabbelt
493fbe934d6SPalmer Dabbeltendchoice
494fbe934d6SPalmer Dabbelt
4954f0e8eefSAtish Patra# Common NUMA Features
4964f0e8eefSAtish Patraconfig NUMA
4974f0e8eefSAtish Patra	bool "NUMA Memory Allocation and Scheduler Support"
4981adbc294SKefeng Wang	depends on SMP && MMU
4994f0e8eefSAtish Patra	select ARCH_SUPPORTS_NUMA_BALANCING
5005f365c13SConor Dooley	select GENERIC_ARCH_NUMA
5016b9f29b8SAlexandre Ghiti	select HAVE_SETUP_PER_CPU_AREA
5027ecd19cfSKefeng Wang	select NEED_PER_CPU_EMBED_FIRST_CHUNK
5036b9f29b8SAlexandre Ghiti	select NEED_PER_CPU_PAGE_FIRST_CHUNK
5045f365c13SConor Dooley	select OF_NUMA
5055f365c13SConor Dooley	select USE_PERCPU_NUMA_NODE_ID
5064f0e8eefSAtish Patra	help
5074f0e8eefSAtish Patra	  Enable NUMA (Non-Uniform Memory Access) support.
5084f0e8eefSAtish Patra
5094f0e8eefSAtish Patra	  The kernel will try to allocate memory used by a CPU on the
5104f0e8eefSAtish Patra	  local memory of the CPU and add some more NUMA awareness to the kernel.
5114f0e8eefSAtish Patra
5124f0e8eefSAtish Patraconfig NODES_SHIFT
5134f0e8eefSAtish Patra	int "Maximum NUMA Nodes (as a power of 2)"
5144f0e8eefSAtish Patra	range 1 10
5154f0e8eefSAtish Patra	default "2"
516a9ee6cf5SMike Rapoport	depends on NUMA
5174f0e8eefSAtish Patra	help
5184f0e8eefSAtish Patra	  Specify the maximum number of NUMA Nodes available on the target
5194f0e8eefSAtish Patra	  system.  Increases memory reserved to accommodate various tables.
5204f0e8eefSAtish Patra
521ab83647fSAlexandre Ghitichoice
522ab83647fSAlexandre Ghiti	prompt "RISC-V spinlock type"
523ab83647fSAlexandre Ghiti	default RISCV_COMBO_SPINLOCKS
524ab83647fSAlexandre Ghiti
525ab83647fSAlexandre Ghiticonfig RISCV_TICKET_SPINLOCKS
526ab83647fSAlexandre Ghiti	bool "Using ticket spinlock"
527ab83647fSAlexandre Ghiti
528ab83647fSAlexandre Ghiticonfig RISCV_QUEUED_SPINLOCKS
529ab83647fSAlexandre Ghiti	bool "Using queued spinlock"
530ab83647fSAlexandre Ghiti	depends on SMP && MMU && NONPORTABLE
531ab83647fSAlexandre Ghiti	select ARCH_USE_QUEUED_SPINLOCKS
532ab83647fSAlexandre Ghiti	help
533ab83647fSAlexandre Ghiti	  The queued spinlock implementation requires the forward progress
534ab83647fSAlexandre Ghiti	  guarantee of cmpxchg()/xchg() atomic operations: CAS with Zabha or
535ab83647fSAlexandre Ghiti	  LR/SC with Ziccrse provide such guarantee.
536ab83647fSAlexandre Ghiti
537ab83647fSAlexandre Ghiti	  Select this if and only if Zabha or Ziccrse is available on your
538ab83647fSAlexandre Ghiti	  platform, RISCV_QUEUED_SPINLOCKS must not be selected for platforms
539ab83647fSAlexandre Ghiti	  without one of those extensions.
540ab83647fSAlexandre Ghiti
541ab83647fSAlexandre Ghiti	  If unsure, select RISCV_COMBO_SPINLOCKS, which will use qspinlocks
542ab83647fSAlexandre Ghiti	  when supported and otherwise ticket spinlocks.
543ab83647fSAlexandre Ghiti
544ab83647fSAlexandre Ghiticonfig RISCV_COMBO_SPINLOCKS
545ab83647fSAlexandre Ghiti	bool "Using combo spinlock"
546ab83647fSAlexandre Ghiti	depends on SMP && MMU
547ab83647fSAlexandre Ghiti	select ARCH_USE_QUEUED_SPINLOCKS
548ab83647fSAlexandre Ghiti	help
549ab83647fSAlexandre Ghiti	  Embed both queued spinlock and ticket lock so that the spinlock
550ab83647fSAlexandre Ghiti	  implementation can be chosen at runtime.
551ab83647fSAlexandre Ghiti
552ab83647fSAlexandre Ghitiendchoice
553ab83647fSAlexandre Ghiti
554e64f737aSHeiko Stuebnerconfig RISCV_ALTERNATIVE
555e64f737aSHeiko Stuebner	bool
556e64f737aSHeiko Stuebner	depends on !XIP_KERNEL
557e64f737aSHeiko Stuebner	help
558e64f737aSHeiko Stuebner	  This Kconfig allows the kernel to automatically patch the
559ff19a8deSAndrew Jones	  erratum or cpufeature required by the execution platform at run
560ff19a8deSAndrew Jones	  time. The code patching overhead is minimal, as it's only done
561ff19a8deSAndrew Jones	  once at boot and once on each module load.
562e64f737aSHeiko Stuebner
563a35707c3SHeiko Stuebnerconfig RISCV_ALTERNATIVE_EARLY
564a35707c3SHeiko Stuebner	bool
565a35707c3SHeiko Stuebner	depends on RISCV_ALTERNATIVE
566a35707c3SHeiko Stuebner	help
567a35707c3SHeiko Stuebner	  Allows early patching of the kernel for special errata
568a35707c3SHeiko Stuebner
569fbe934d6SPalmer Dabbeltconfig RISCV_ISA_C
570fbe934d6SPalmer Dabbelt	bool "Emit compressed instructions when building Linux"
571fbe934d6SPalmer Dabbelt	default y
572fbe934d6SPalmer Dabbelt	help
573fbe934d6SPalmer Dabbelt	  Adds "C" to the ISA subsets that the toolchain is allowed to emit
574fbe934d6SPalmer Dabbelt	  when building Linux, which results in compressed instructions in the
5756216182fSConor Dooley	  Linux binary. This option produces a kernel that will not run on
5766216182fSConor Dooley	  systems that do not support compressed instructions.
577fbe934d6SPalmer Dabbelt
578fbe934d6SPalmer Dabbelt	  If you don't know what to do here, say Y.
579fbe934d6SPalmer Dabbelt
58009d6775fSSamuel Hollandconfig RISCV_ISA_SUPM
58109d6775fSSamuel Holland	bool "Supm extension for userspace pointer masking"
58209d6775fSSamuel Holland	depends on 64BIT
58309d6775fSSamuel Holland	default y
58409d6775fSSamuel Holland	help
58509d6775fSSamuel Holland	  Add support for pointer masking in userspace (Supm) when the
58609d6775fSSamuel Holland	  underlying hardware extension (Smnpm or Ssnpm) is detected at boot.
58709d6775fSSamuel Holland
58809d6775fSSamuel Holland	  If this option is disabled, userspace will be unable to use
58909d6775fSSamuel Holland	  the prctl(PR_{SET,GET}_TAGGED_ADDR_CTRL) API.
59009d6775fSSamuel Holland
59123ad288aSQinglin Panconfig RISCV_ISA_SVNAPOT
5925464912cSConor Dooley	bool "Svnapot extension support for supervisor mode NAPOT pages"
593ff689fd2SHeiko Stuebner	depends on 64BIT && MMU
5941ee7fc3fSConor Dooley	depends on RISCV_ALTERNATIVE
595ff689fd2SHeiko Stuebner	default y
596ff689fd2SHeiko Stuebner	help
5976216182fSConor Dooley	  Enable support for the Svnapot ISA-extension when it is detected
5986216182fSConor Dooley	  at boot.
59923ad288aSQinglin Pan
6005464912cSConor Dooley	  The Svnapot extension is used to mark contiguous PTEs as a range
60123ad288aSQinglin Pan	  of contiguous virtual-to-physical translations for a naturally
60223ad288aSQinglin Pan	  aligned power-of-2 (NAPOT) granularity larger than the base 4KB page
60323ad288aSQinglin Pan	  size. When HUGETLBFS is also selected this option unconditionally
60423ad288aSQinglin Pan	  allocates some memory for each NAPOT page size supported by the kernel.
60523ad288aSQinglin Pan	  When optimizing for low memory consumption and for platforms without
6065464912cSConor Dooley	  the Svnapot extension, it may be better to say N here.
60723ad288aSQinglin Pan
60823ad288aSQinglin Pan	  If you don't know what to do here, say Y.
60923ad288aSQinglin Pan
610ff689fd2SHeiko Stuebnerconfig RISCV_ISA_SVPBMT
6115464912cSConor Dooley	bool "Svpbmt extension support for supervisor mode page-based memory types"
612ff689fd2SHeiko Stuebner	depends on 64BIT && MMU
613ff689fd2SHeiko Stuebner	depends on RISCV_ALTERNATIVE
614ff689fd2SHeiko Stuebner	default y
615ff689fd2SHeiko Stuebner	help
6166216182fSConor Dooley	   Add support for the Svpbmt ISA-extension (Supervisor-mode:
6176216182fSConor Dooley	   page-based memory types) in the kernel when it is detected at boot.
618924cbb8cSHeiko Stuebner
619924cbb8cSHeiko Stuebner	   The memory type for a page contains a combination of attributes
620924cbb8cSHeiko Stuebner	   that indicate the cacheability, idempotency, and ordering
621924cbb8cSHeiko Stuebner	   properties for access to that page.
622ff689fd2SHeiko Stuebner
6235464912cSConor Dooley	   The Svpbmt extension is only available on 64-bit cpus.
624ff689fd2SHeiko Stuebner
625ff689fd2SHeiko Stuebner	   If you don't know what to do here, say Y.
626ff689fd2SHeiko Stuebner
627fa8e7cceSGuo Renconfig TOOLCHAIN_HAS_V
628fa8e7cceSGuo Ren	bool
629fa8e7cceSGuo Ren	default y
6305ba7a75aSAnton Blanchard	depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64imv)
6315ba7a75aSAnton Blanchard	depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32imv)
632fa8e7cceSGuo Ren	depends on LLD_VERSION >= 140000 || LD_VERSION >= 23800
633fa8e7cceSGuo Ren	depends on AS_HAS_OPTION_ARCH
634fa8e7cceSGuo Ren
635fa8e7cceSGuo Renconfig RISCV_ISA_V
6366216182fSConor Dooley	bool "Vector extension support"
637fa8e7cceSGuo Ren	depends on TOOLCHAIN_HAS_V
638fa8e7cceSGuo Ren	depends on FPU
639fa8e7cceSGuo Ren	select DYNAMIC_SIGFRAME
640fa8e7cceSGuo Ren	default y
641fa8e7cceSGuo Ren	help
6426216182fSConor Dooley	  Add support for the Vector extension when it is detected at boot.
6436216182fSConor Dooley	  When this option is disabled, neither the kernel nor userspace may
6446216182fSConor Dooley	  use vector procedures.
645fa8e7cceSGuo Ren
646fa8e7cceSGuo Ren	  If you don't know what to do here, say Y.
647fa8e7cceSGuo Ren
648fa8e7cceSGuo Renconfig RISCV_ISA_V_DEFAULT_ENABLE
649fa8e7cceSGuo Ren	bool "Enable userspace Vector by default"
650fa8e7cceSGuo Ren	depends on RISCV_ISA_V
651fa8e7cceSGuo Ren	default y
652fa8e7cceSGuo Ren	help
653fa8e7cceSGuo Ren	  Say Y here if you want to enable Vector in userspace by default.
654fa8e7cceSGuo Ren	  Otherwise, userspace has to make explicit prctl() call to enable
655fa8e7cceSGuo Ren	  Vector, or enable it via the sysctl interface.
656fa8e7cceSGuo Ren
657fa8e7cceSGuo Ren	  If you don't know what to do here, say Y.
658fa8e7cceSGuo Ren
659c2a658d4SAndy Chiuconfig RISCV_ISA_V_UCOPY_THRESHOLD
660c2a658d4SAndy Chiu	int "Threshold size for vectorized user copies"
661c2a658d4SAndy Chiu	depends on RISCV_ISA_V
662c2a658d4SAndy Chiu	default 768
663c2a658d4SAndy Chiu	help
664c2a658d4SAndy Chiu	  Prefer using vectorized copy_to_user()/copy_from_user() when the
665c2a658d4SAndy Chiu	  workload size exceeds this value.
666c2a658d4SAndy Chiu
6672080ff94SAndy Chiuconfig RISCV_ISA_V_PREEMPTIVE
6682080ff94SAndy Chiu	bool "Run kernel-mode Vector with kernel preemption"
6692080ff94SAndy Chiu	depends on PREEMPTION
6702080ff94SAndy Chiu	depends on RISCV_ISA_V
6712080ff94SAndy Chiu	default y
6722080ff94SAndy Chiu	help
6732080ff94SAndy Chiu	  Usually, in-kernel SIMD routines are run with preemption disabled.
674c39d5375SMiquel Sabaté Solà	  Functions which invoke long running SIMD thus must yield the core's
6752080ff94SAndy Chiu	  vector unit to prevent blocking other tasks for too long.
6762080ff94SAndy Chiu
677c39d5375SMiquel Sabaté Solà	  This config allows the kernel to run SIMD without explicitly disabling
678c39d5375SMiquel Sabaté Solà	  preemption. Enabling this config will result in higher memory consumption
679c39d5375SMiquel Sabaté Solà	  due to the allocation of per-task's kernel Vector context.
6802080ff94SAndy Chiu
681b8ddb0dfSChristoph Müllnerconfig RISCV_ISA_ZAWRS
682b8ddb0dfSChristoph Müllner	bool "Zawrs extension support for more efficient busy waiting"
683b8ddb0dfSChristoph Müllner	depends on RISCV_ALTERNATIVE
684b8ddb0dfSChristoph Müllner	default y
685b8ddb0dfSChristoph Müllner	help
686b8ddb0dfSChristoph Müllner	  The Zawrs extension defines instructions to be used in polling loops
687b8ddb0dfSChristoph Müllner	  which allow a hart to enter a low-power state or to trap to the
688b8ddb0dfSChristoph Müllner	  hypervisor while waiting on a store to a memory location. Enable the
689b8ddb0dfSChristoph Müllner	  use of these instructions in the kernel when the Zawrs extension is
690b8ddb0dfSChristoph Müllner	  detected at boot.
691b8ddb0dfSChristoph Müllner
6921658ef43SAlexandre Ghiticonfig TOOLCHAIN_HAS_ZABHA
6931658ef43SAlexandre Ghiti	bool
6941658ef43SAlexandre Ghiti	default y
6951658ef43SAlexandre Ghiti	depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64ima_zabha)
6961658ef43SAlexandre Ghiti	depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32ima_zabha)
6971658ef43SAlexandre Ghiti	depends on AS_HAS_OPTION_ARCH
6981658ef43SAlexandre Ghiti
6991658ef43SAlexandre Ghiticonfig RISCV_ISA_ZABHA
7001658ef43SAlexandre Ghiti	bool "Zabha extension support for atomic byte/halfword operations"
7011658ef43SAlexandre Ghiti	depends on TOOLCHAIN_HAS_ZABHA
7021658ef43SAlexandre Ghiti	depends on RISCV_ALTERNATIVE
7031658ef43SAlexandre Ghiti	default y
7041658ef43SAlexandre Ghiti	help
7051658ef43SAlexandre Ghiti	  Enable the use of the Zabha ISA-extension to implement kernel
7061658ef43SAlexandre Ghiti	  byte/halfword atomic memory operations when it is detected at boot.
7071658ef43SAlexandre Ghiti
7081658ef43SAlexandre Ghiti	  If you don't know what to do here, say Y.
7091658ef43SAlexandre Ghiti
71038acdee3SAlexandre Ghiticonfig TOOLCHAIN_HAS_ZACAS
71138acdee3SAlexandre Ghiti	bool
71238acdee3SAlexandre Ghiti	default y
71338acdee3SAlexandre Ghiti	depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64ima_zacas)
71438acdee3SAlexandre Ghiti	depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32ima_zacas)
71538acdee3SAlexandre Ghiti	depends on AS_HAS_OPTION_ARCH
71638acdee3SAlexandre Ghiti
71738acdee3SAlexandre Ghiticonfig RISCV_ISA_ZACAS
71838acdee3SAlexandre Ghiti	bool "Zacas extension support for atomic CAS"
71938acdee3SAlexandre Ghiti	depends on TOOLCHAIN_HAS_ZACAS
72038acdee3SAlexandre Ghiti	depends on RISCV_ALTERNATIVE
72138acdee3SAlexandre Ghiti	default y
72238acdee3SAlexandre Ghiti	help
72338acdee3SAlexandre Ghiti	  Enable the use of the Zacas ISA-extension to implement kernel atomic
72438acdee3SAlexandre Ghiti	  cmpxchg operations when it is detected at boot.
72538acdee3SAlexandre Ghiti
726b8ddb0dfSChristoph Müllner	  If you don't know what to do here, say Y.
727b8ddb0dfSChristoph Müllner
728b6fcdb19SHeiko Stuebnerconfig TOOLCHAIN_HAS_ZBB
7291631ba12SHeiko Stuebner	bool
730b8c86872SConor Dooley	default y
731b6fcdb19SHeiko Stuebner	depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64ima_zbb)
732b6fcdb19SHeiko Stuebner	depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32ima_zbb)
733b6fcdb19SHeiko Stuebner	depends on LLD_VERSION >= 150000 || LD_VERSION >= 23900
734e4bb020fSAndy Chiu	depends on AS_HAS_OPTION_ARCH
735b6fcdb19SHeiko Stuebner
73634ca4ec6SEric Biggers# This symbol indicates that the toolchain supports all v1.0 vector crypto
73734ca4ec6SEric Biggers# extensions, including Zvk*, Zvbb, and Zvbc.  LLVM added all of these at once.
73834ca4ec6SEric Biggers# binutils added all except Zvkb, then added Zvkb.  So we just check for Zvkb.
73934ca4ec6SEric Biggersconfig TOOLCHAIN_HAS_VECTOR_CRYPTO
740886516faSEric Biggers	def_bool $(as-instr, .option arch$(comma) +v$(comma) +zvkb)
74134ca4ec6SEric Biggers	depends on AS_HAS_OPTION_ARCH
74234ca4ec6SEric Biggers
7438a2f20acSAlexandre Ghiticonfig TOOLCHAIN_HAS_ZBA
7448a2f20acSAlexandre Ghiti	bool
7458a2f20acSAlexandre Ghiti	default y
7468a2f20acSAlexandre Ghiti	depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64ima_zba)
7478a2f20acSAlexandre Ghiti	depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32ima_zba)
7488a2f20acSAlexandre Ghiti	depends on LLD_VERSION >= 150000 || LD_VERSION >= 23900
7498a2f20acSAlexandre Ghiti	depends on AS_HAS_OPTION_ARCH
7508a2f20acSAlexandre Ghiti
751c12603e7SXiao Wangconfig RISCV_ISA_ZBA
752c12603e7SXiao Wang	bool "Zba extension support for bit manipulation instructions"
753c12603e7SXiao Wang	default y
754c12603e7SXiao Wang	help
755c12603e7SXiao Wang	   Add support for enabling optimisations in the kernel when the Zba
756c12603e7SXiao Wang	   extension is detected at boot.
757c12603e7SXiao Wang
758c12603e7SXiao Wang	   The Zba extension provides instructions to accelerate the generation
759c12603e7SXiao Wang	   of addresses that index into arrays of basic data types.
760c12603e7SXiao Wang
761c12603e7SXiao Wang	   If you don't know what to do here, say Y.
762c12603e7SXiao Wang
763b6fcdb19SHeiko Stuebnerconfig RISCV_ISA_ZBB
764b6fcdb19SHeiko Stuebner	bool "Zbb extension support for bit manipulation instructions"
7651ee7fc3fSConor Dooley	depends on RISCV_ALTERNATIVE
766b6fcdb19SHeiko Stuebner	default y
767b6fcdb19SHeiko Stuebner	help
7686216182fSConor Dooley	   Add support for enabling optimisations in the kernel when the
7699343aabaSConor Dooley	   Zbb extension is detected at boot. Some optimisations may
7709343aabaSConor Dooley	   additionally depend on toolchain support for Zbb.
771b6fcdb19SHeiko Stuebner
772b6fcdb19SHeiko Stuebner	   The Zbb extension provides instructions to accelerate a number
773b6fcdb19SHeiko Stuebner	   of bit-specific operations (count bit population, sign extending,
774b6fcdb19SHeiko Stuebner	   bitrotation, etc).
775b6fcdb19SHeiko Stuebner
776b6fcdb19SHeiko Stuebner	   If you don't know what to do here, say Y.
7771631ba12SHeiko Stuebner
778a43fe27dSXiao Wangconfig TOOLCHAIN_HAS_ZBC
779a43fe27dSXiao Wang	bool
780a43fe27dSXiao Wang	default y
781a43fe27dSXiao Wang	depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64ima_zbc)
782a43fe27dSXiao Wang	depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32ima_zbc)
783a43fe27dSXiao Wang	depends on LLD_VERSION >= 150000 || LD_VERSION >= 23900
784a43fe27dSXiao Wang	depends on AS_HAS_OPTION_ARCH
785a43fe27dSXiao Wang
786a43fe27dSXiao Wangconfig RISCV_ISA_ZBC
787a43fe27dSXiao Wang	bool "Zbc extension support for carry-less multiplication instructions"
788a43fe27dSXiao Wang	depends on TOOLCHAIN_HAS_ZBC
789a43fe27dSXiao Wang	depends on MMU
790a43fe27dSXiao Wang	depends on RISCV_ALTERNATIVE
791a43fe27dSXiao Wang	default y
792a43fe27dSXiao Wang	help
793a43fe27dSXiao Wang	   Adds support to dynamically detect the presence of the Zbc
794a43fe27dSXiao Wang	   extension (carry-less multiplication) and enable its usage.
795a43fe27dSXiao Wang
796a43fe27dSXiao Wang	   The Zbc extension could accelerate CRC (cyclic redundancy check)
797a43fe27dSXiao Wang	   calculations.
798a43fe27dSXiao Wang
799a43fe27dSXiao Wang	   If you don't know what to do here, say Y.
800a43fe27dSXiao Wang
801a44fb572SCharlie Jenkinsconfig TOOLCHAIN_HAS_ZBKB
802a44fb572SCharlie Jenkins	bool
803a44fb572SCharlie Jenkins	default y
804a44fb572SCharlie Jenkins	depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64ima_zbkb)
805a44fb572SCharlie Jenkins	depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32ima_zbkb)
806a44fb572SCharlie Jenkins	depends on LLD_VERSION >= 150000 || LD_VERSION >= 23900
807a44fb572SCharlie Jenkins	depends on AS_HAS_OPTION_ARCH
808a44fb572SCharlie Jenkins
809a44fb572SCharlie Jenkinsconfig RISCV_ISA_ZBKB
810a44fb572SCharlie Jenkins	bool "Zbkb extension support for bit manipulation instructions"
811a44fb572SCharlie Jenkins	depends on TOOLCHAIN_HAS_ZBKB
812a44fb572SCharlie Jenkins	depends on RISCV_ALTERNATIVE
813a44fb572SCharlie Jenkins	default y
814a44fb572SCharlie Jenkins	help
815a44fb572SCharlie Jenkins	   Adds support to dynamically detect the presence of the ZBKB
816a44fb572SCharlie Jenkins	   extension (bit manipulation for cryptography) and enable its usage.
817a44fb572SCharlie Jenkins
818a44fb572SCharlie Jenkins	   The Zbkb extension provides instructions to accelerate a number
819a44fb572SCharlie Jenkins	   of common cryptography operations (pack, zip, etc).
820a44fb572SCharlie Jenkins
821a44fb572SCharlie Jenkins	   If you don't know what to do here, say Y.
822a44fb572SCharlie Jenkins
8231631ba12SHeiko Stuebnerconfig RISCV_ISA_ZICBOM
8241631ba12SHeiko Stuebner	bool "Zicbom extension support for non-coherent DMA operation"
8251ee7fc3fSConor Dooley	depends on MMU
8261ee7fc3fSConor Dooley	depends on RISCV_ALTERNATIVE
8271631ba12SHeiko Stuebner	default y
8285f365c13SConor Dooley	select RISCV_DMA_NONCOHERENT
829381cae16SChristoph Hellwig	select DMA_DIRECT_REMAP
8301631ba12SHeiko Stuebner	help
8316216182fSConor Dooley	   Add support for the Zicbom extension (Cache Block Management
8326216182fSConor Dooley	   Operations) and enable its use in the kernel when it is detected
8336216182fSConor Dooley	   at boot.
8341631ba12SHeiko Stuebner
8351631ba12SHeiko Stuebner	   The Zicbom extension can be used to handle for example
8361631ba12SHeiko Stuebner	   non-coherent DMA support on devices that need it.
8371631ba12SHeiko Stuebner
8381631ba12SHeiko Stuebner	   If you don't know what to do here, say Y.
8391631ba12SHeiko Stuebner
840ab0f7746SAndrew Jonesconfig RISCV_ISA_ZICBOZ
841ab0f7746SAndrew Jones	bool "Zicboz extension support for faster zeroing of memory"
842d34a6b71SConor Dooley	depends on RISCV_ALTERNATIVE
843ab0f7746SAndrew Jones	default y
844ab0f7746SAndrew Jones	help
8455464912cSConor Dooley	   Enable the use of the Zicboz extension (cbo.zero instruction)
8466216182fSConor Dooley	   in the kernel when it is detected at boot.
847ab0f7746SAndrew Jones
848ab0f7746SAndrew Jones	   The Zicboz extension is used for faster zeroing of memory.
849ab0f7746SAndrew Jones
850ab0f7746SAndrew Jones	   If you don't know what to do here, say Y.
851ab0f7746SAndrew Jones
8528d496b5aSAlexandre Ghiticonfig RISCV_ISA_ZICBOP
8538d496b5aSAlexandre Ghiti	bool "Zicbop extension support for cache block prefetch"
8548d496b5aSAlexandre Ghiti	depends on MMU
8558d496b5aSAlexandre Ghiti	depends on RISCV_ALTERNATIVE
8568d496b5aSAlexandre Ghiti	default y
8578d496b5aSAlexandre Ghiti	help
8588d496b5aSAlexandre Ghiti	  Adds support to dynamically detect the presence of the ZICBOP
8598d496b5aSAlexandre Ghiti	  extension (Cache Block Prefetch Operations) and enable its
8608d496b5aSAlexandre Ghiti	  usage.
8618d496b5aSAlexandre Ghiti
8628d496b5aSAlexandre Ghiti	  The Zicbop extension can be used to prefetch cache blocks for
8638d496b5aSAlexandre Ghiti	  read/write fetch.
8648d496b5aSAlexandre Ghiti
8658d496b5aSAlexandre Ghiti	  If you don't know what to do here, say Y.
8668d496b5aSAlexandre Ghiti
867e89c2e81SNathan Chancellorconfig TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI
868e89c2e81SNathan Chancellor	def_bool y
869e89c2e81SNathan Chancellor	# https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=aed44286efa8ae8717a77d94b51ac3614e2ca6dc
870ca09f772SMingzheng Xing	# https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=98416dbb0a62579d4a7a4a76bab51b5b52fec2cd
871ca09f772SMingzheng Xing	depends on AS_IS_GNU && AS_VERSION >= 23600
872e89c2e81SNathan Chancellor	help
873ca09f772SMingzheng Xing	  Binutils-2.38 and GCC-12.1.0 bumped the default ISA spec to the newer
874ca09f772SMingzheng Xing	  20191213 version, which moves some instructions from the I extension to
875ca09f772SMingzheng Xing	  the Zicsr and Zifencei extensions. This requires explicitly specifying
876ca09f772SMingzheng Xing	  Zicsr and Zifencei when binutils >= 2.38 or GCC >= 12.1.0. Zicsr
877ca09f772SMingzheng Xing	  and Zifencei are supported in binutils from version 2.36 onwards.
878ca09f772SMingzheng Xing	  To make life easier, and avoid forcing toolchains that default to a
879ca09f772SMingzheng Xing	  newer ISA spec to version 2.2, relax the check to binutils >= 2.36.
880ef21fa7cSMingzheng Xing	  For clang < 17 or GCC < 11.3.0, for which this is not possible or need
881ef21fa7cSMingzheng Xing	  special treatment, this is dealt with in TOOLCHAIN_NEEDS_OLD_ISA_SPEC.
882e89c2e81SNathan Chancellor
883e89c2e81SNathan Chancellorconfig TOOLCHAIN_NEEDS_OLD_ISA_SPEC
884e89c2e81SNathan Chancellor	def_bool y
885e89c2e81SNathan Chancellor	depends on TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI
886e89c2e81SNathan Chancellor	# https://github.com/llvm/llvm-project/commit/22e199e6afb1263c943c0c0d4498694e15bf8a16
887ef21fa7cSMingzheng Xing	# https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=d29f5d6ab513c52fd872f532c492e35ae9fd6671
888ef21fa7cSMingzheng Xing	depends on (CC_IS_CLANG && CLANG_VERSION < 170000) || (CC_IS_GCC && GCC_VERSION < 110300)
889e89c2e81SNathan Chancellor	help
890ca09f772SMingzheng Xing	  Certain versions of clang and GCC do not support zicsr and zifencei via
891ca09f772SMingzheng Xing	  -march. This option causes an older ISA spec compatible with these older
892ca09f772SMingzheng Xing	  versions of clang and GCC to be passed to GAS, which has the same result
893ca09f772SMingzheng Xing	  as passing zicsr and zifencei to -march.
894e89c2e81SNathan Chancellor
8959671f706SAlan Kaoconfig FPU
8969671f706SAlan Kao	bool "FPU support"
8979671f706SAlan Kao	default y
8989671f706SAlan Kao	help
8996216182fSConor Dooley	  Add support for floating point operations when an FPU is detected at
9006216182fSConor Dooley	  boot. When this option is disabled, neither the kernel nor userspace
9016216182fSConor Dooley	  may use the floating point unit.
9029671f706SAlan Kao
9039671f706SAlan Kao	  If you don't know what to do here, say Y.
9049671f706SAlan Kao
905163e76ccSGuo Renconfig IRQ_STACKS
906dd69d07aSGuo Ren	bool "Independent irq & softirq stacks" if EXPERT
907163e76ccSGuo Ren	default y
908163e76ccSGuo Ren	select HAVE_IRQ_EXIT_ON_IRQ_STACK
909dd69d07aSGuo Ren	select HAVE_SOFTIRQ_ON_OWN_STACK
910163e76ccSGuo Ren	help
911dd69d07aSGuo Ren	  Add independent irq & softirq stacks for percpu to prevent kernel stack
912dd69d07aSGuo Ren	  overflows. We may save some memory footprint by disabling IRQ_STACKS.
913163e76ccSGuo Ren
914a7555f6bSGuo Renconfig THREAD_SIZE_ORDER
915a7555f6bSGuo Ren	int "Kernel stack size (in power-of-two numbers of page size)" if VMAP_STACK && EXPERT
916a7555f6bSGuo Ren	range 0 4
917cfb10de1SAlexandre Ghiti	default 1 if 32BIT
918a7555f6bSGuo Ren	default 2
919a7555f6bSGuo Ren	help
920a7555f6bSGuo Ren	  Specify the Pages of thread stack size (from 4KB to 64KB), which also
921a7555f6bSGuo Ren	  affects irq stack size, which is equal to thread stack size.
922a7555f6bSGuo Ren
9237c832321SClément Légerconfig RISCV_MISALIGNED
924f413aae9SCharlie Jenkins	bool
925d1703dc7SJesse Taube	help
926d1703dc7SJesse Taube	  Embed support for detecting and emulating misaligned
927d1703dc7SJesse Taube	  scalar or vector loads and stores.
928d1703dc7SJesse Taube
929c05a62c9SJesse Taubeconfig RISCV_SCALAR_MISALIGNED
9307c832321SClément Léger	bool
931d1703dc7SJesse Taube	select RISCV_MISALIGNED
932bc38f613SClément Léger	select SYSCTL_ARCH_UNALIGN_ALLOW
9337c832321SClément Léger	help
934f413aae9SCharlie Jenkins	  Embed support for emulating misaligned loads and stores.
935f413aae9SCharlie Jenkins
936d1703dc7SJesse Taubeconfig RISCV_VECTOR_MISALIGNED
937d1703dc7SJesse Taube	bool
938d1703dc7SJesse Taube	select RISCV_MISALIGNED
939d1703dc7SJesse Taube	depends on RISCV_ISA_V
940d1703dc7SJesse Taube	help
941d1703dc7SJesse Taube	  Enable detecting support for vector misaligned loads and stores.
942d1703dc7SJesse Taube
943f413aae9SCharlie Jenkinschoice
944f413aae9SCharlie Jenkins	prompt "Unaligned Accesses Support"
945f413aae9SCharlie Jenkins	default RISCV_PROBE_UNALIGNED_ACCESS
946f413aae9SCharlie Jenkins	help
947f413aae9SCharlie Jenkins	  This determines the level of support for unaligned accesses. This
948f413aae9SCharlie Jenkins	  information is used by the kernel to perform optimizations. It is also
949f413aae9SCharlie Jenkins	  exposed to user space via the hwprobe syscall. The hardware will be
950f413aae9SCharlie Jenkins	  probed at boot by default.
951f413aae9SCharlie Jenkins
952f413aae9SCharlie Jenkinsconfig RISCV_PROBE_UNALIGNED_ACCESS
953f413aae9SCharlie Jenkins	bool "Probe for hardware unaligned access support"
954c05a62c9SJesse Taube	select RISCV_SCALAR_MISALIGNED
955f413aae9SCharlie Jenkins	help
956f413aae9SCharlie Jenkins	  During boot, the kernel will run a series of tests to determine the
957f413aae9SCharlie Jenkins	  speed of unaligned accesses. This probing will dynamically determine
958f413aae9SCharlie Jenkins	  the speed of unaligned accesses on the underlying system. If unaligned
959f413aae9SCharlie Jenkins	  memory accesses trap into the kernel as they are not supported by the
960f413aae9SCharlie Jenkins	  system, the kernel will emulate the unaligned accesses to preserve the
961f413aae9SCharlie Jenkins	  UABI.
962f413aae9SCharlie Jenkins
963f413aae9SCharlie Jenkinsconfig RISCV_EMULATED_UNALIGNED_ACCESS
964f413aae9SCharlie Jenkins	bool "Emulate unaligned access where system support is missing"
965c05a62c9SJesse Taube	select RISCV_SCALAR_MISALIGNED
966f413aae9SCharlie Jenkins	help
967f413aae9SCharlie Jenkins	  If unaligned memory accesses trap into the kernel as they are not
968f413aae9SCharlie Jenkins	  supported by the system, the kernel will emulate the unaligned
969f413aae9SCharlie Jenkins	  accesses to preserve the UABI. When the underlying system does support
970f413aae9SCharlie Jenkins	  unaligned accesses, the unaligned accesses are assumed to be slow.
971f413aae9SCharlie Jenkins
972f413aae9SCharlie Jenkinsconfig RISCV_SLOW_UNALIGNED_ACCESS
973f413aae9SCharlie Jenkins	bool "Assume the system supports slow unaligned memory accesses"
974f413aae9SCharlie Jenkins	depends on NONPORTABLE
975f413aae9SCharlie Jenkins	help
976f413aae9SCharlie Jenkins	  Assume that the system supports slow unaligned memory accesses. The
977f413aae9SCharlie Jenkins	  kernel and userspace programs may not be able to run at all on systems
978f413aae9SCharlie Jenkins	  that do not support unaligned memory accesses.
9797c832321SClément Léger
980b6da6cbeSJisheng Zhangconfig RISCV_EFFICIENT_UNALIGNED_ACCESS
981f413aae9SCharlie Jenkins	bool "Assume the system supports fast unaligned memory accesses"
982b6da6cbeSJisheng Zhang	depends on NONPORTABLE
983d0fdc20bSJisheng Zhang	select DCACHE_WORD_ACCESS if MMU
984b6da6cbeSJisheng Zhang	select HAVE_EFFICIENT_UNALIGNED_ACCESS
985b6da6cbeSJisheng Zhang	help
986f413aae9SCharlie Jenkins	  Assume that the system supports fast unaligned memory accesses. When
987f413aae9SCharlie Jenkins	  enabled, this option improves the performance of the kernel on such
988f413aae9SCharlie Jenkins	  systems. However, the kernel and userspace programs will run much more
989f413aae9SCharlie Jenkins	  slowly, or will not be able to run at all, on systems that do not
990f413aae9SCharlie Jenkins	  support efficient unaligned memory accesses.
991b6da6cbeSJisheng Zhang
992f413aae9SCharlie Jenkinsendchoice
993b6da6cbeSJisheng Zhang
994d1703dc7SJesse Taubechoice
995d1703dc7SJesse Taube	prompt "Vector unaligned Accesses Support"
996d1703dc7SJesse Taube	depends on RISCV_ISA_V
997d1703dc7SJesse Taube	default RISCV_PROBE_VECTOR_UNALIGNED_ACCESS
998d1703dc7SJesse Taube	help
999d1703dc7SJesse Taube	  This determines the level of support for vector unaligned accesses. This
1000d1703dc7SJesse Taube	  information is used by the kernel to perform optimizations. It is also
1001d1703dc7SJesse Taube	  exposed to user space via the hwprobe syscall. The hardware will be
1002d1703dc7SJesse Taube	  probed at boot by default.
1003d1703dc7SJesse Taube
1004d1703dc7SJesse Taubeconfig RISCV_PROBE_VECTOR_UNALIGNED_ACCESS
1005d1703dc7SJesse Taube	bool "Probe speed of vector unaligned accesses"
1006d1703dc7SJesse Taube	select RISCV_VECTOR_MISALIGNED
1007d1703dc7SJesse Taube	depends on RISCV_ISA_V
1008d1703dc7SJesse Taube	help
1009d1703dc7SJesse Taube	  During boot, the kernel will run a series of tests to determine the
1010d1703dc7SJesse Taube	  speed of vector unaligned accesses if they are supported. This probing
1011d1703dc7SJesse Taube	  will dynamically determine the speed of vector unaligned accesses on
1012d1703dc7SJesse Taube	  the underlying system if they are supported.
1013d1703dc7SJesse Taube
1014e7c9d66eSJesse Taubeconfig RISCV_SLOW_VECTOR_UNALIGNED_ACCESS
1015e7c9d66eSJesse Taube	bool "Assume the system supports slow vector unaligned memory accesses"
1016e7c9d66eSJesse Taube	depends on NONPORTABLE
1017e7c9d66eSJesse Taube	help
1018e7c9d66eSJesse Taube	  Assume that the system supports slow vector unaligned memory accesses. The
1019e7c9d66eSJesse Taube	  kernel and userspace programs may not be able to run at all on systems
1020e7c9d66eSJesse Taube	  that do not support unaligned memory accesses.
1021e7c9d66eSJesse Taube
1022e7c9d66eSJesse Taubeconfig RISCV_EFFICIENT_VECTOR_UNALIGNED_ACCESS
1023e7c9d66eSJesse Taube	bool "Assume the system supports fast vector unaligned memory accesses"
1024e7c9d66eSJesse Taube	depends on NONPORTABLE
1025e7c9d66eSJesse Taube	help
1026e7c9d66eSJesse Taube	  Assume that the system supports fast vector unaligned memory accesses. When
1027e7c9d66eSJesse Taube	  enabled, this option improves the performance of the kernel on such
1028e7c9d66eSJesse Taube	  systems. However, the kernel and userspace programs will run much more
1029e7c9d66eSJesse Taube	  slowly, or will not be able to run at all, on systems that do not
1030e7c9d66eSJesse Taube	  support efficient unaligned memory accesses.
1031e7c9d66eSJesse Taube
1032d1703dc7SJesse Taubeendchoice
1033d1703dc7SJesse Taube
103423c996fcSCharlie Jenkinssource "arch/riscv/Kconfig.vendor"
103523c996fcSCharlie Jenkins
10362f66a3d0SJuerg Haefligerendmenu # "Platform type"
1037fbe934d6SPalmer Dabbelt
1038aef53f97SNick Kossifidismenu "Kernel features"
1039fbe934d6SPalmer Dabbelt
1040fbe934d6SPalmer Dabbeltsource "kernel/Kconfig.hz"
1041fbe934d6SPalmer Dabbelt
1042efca1398SAtish Patraconfig RISCV_SBI_V01
1043efca1398SAtish Patra	bool "SBI v0.1 support"
1044efca1398SAtish Patra	depends on RISCV_SBI
1045efca1398SAtish Patra	help
1046efca1398SAtish Patra	  This config allows kernel to use SBI v0.1 APIs. This will be
1047efca1398SAtish Patra	  deprecated in future once legacy M-mode software are no longer in use.
1048fba8a867SNick Kossifidis
10492ffc48fcSAtish Patraconfig RISCV_BOOT_SPINWAIT
10502ffc48fcSAtish Patra	bool "Spinwait booting method"
10512ffc48fcSAtish Patra	depends on SMP
105277d707a3SPalmer Dabbelt	default y if RISCV_SBI_V01 || RISCV_M_MODE
10532ffc48fcSAtish Patra	help
10542ffc48fcSAtish Patra	  This enables support for booting Linux via spinwait method. In the
10552ffc48fcSAtish Patra	  spinwait method, all cores randomly jump to Linux. One of the cores
10562ffc48fcSAtish Patra	  gets chosen via lottery and all other keep spinning on a percpu
10572ffc48fcSAtish Patra	  variable. This method cannot support CPU hotplug and sparse hartid
10582ffc48fcSAtish Patra	  scheme. It should be only enabled for M-mode Linux or platforms relying
10592ffc48fcSAtish Patra	  on older firmware without SBI HSM extension. All other platforms should
10602ffc48fcSAtish Patra	  rely on ordered booting via SBI HSM extension which gets chosen
10612ffc48fcSAtish Patra	  dynamically at runtime if the firmware supports it.
10622ffc48fcSAtish Patra
106377d707a3SPalmer Dabbelt	  Since spinwait is incompatible with sparse hart IDs, it requires
106477d707a3SPalmer Dabbelt	  NR_CPUS be large enough to contain the physical hart ID of the first
106577d707a3SPalmer Dabbelt	  hart to enter Linux.
106677d707a3SPalmer Dabbelt
106777d707a3SPalmer Dabbelt	  If unsure what to do here, say N.
106877d707a3SPalmer Dabbelt
10691f0d6efeSEric DeVolderconfig ARCH_SUPPORTS_KEXEC
1070c41bd251SIgnat Korchagin	def_bool y
10711f0d6efeSEric DeVolder
10721f0d6efeSEric DeVolderconfig ARCH_SELECTS_KEXEC
10731f0d6efeSEric DeVolder	def_bool y
10741f0d6efeSEric DeVolder	depends on KEXEC
10755f365c13SConor Dooley	select HOTPLUG_CPU if SMP
1076fba8a867SNick Kossifidis
10771f0d6efeSEric DeVolderconfig ARCH_SUPPORTS_KEXEC_FILE
1078c41bd251SIgnat Korchagin	def_bool 64BIT
1079fba8a867SNick Kossifidis
10801f0d6efeSEric DeVolderconfig ARCH_SELECTS_KEXEC_FILE
10811f0d6efeSEric DeVolder	def_bool y
10821f0d6efeSEric DeVolder	depends on KEXEC_FILE
10835f365c13SConor Dooley	select HAVE_IMA_KEXEC if IMA
10846261586eSLiao Chang	select KEXEC_ELF
10856261586eSLiao Chang
1086e6265fe7SEric DeVolderconfig ARCH_SUPPORTS_KEXEC_PURGATORY
1087c1ad12eeSArnd Bergmann	def_bool ARCH_SUPPORTS_KEXEC_FILE
1088736e30afSLi Zhengyu
10891f0d6efeSEric DeVolderconfig ARCH_SUPPORTS_CRASH_DUMP
10901f0d6efeSEric DeVolder	def_bool y
1091fba8a867SNick Kossifidis
109231daa343SDave Vasilevskyconfig ARCH_DEFAULT_CRASH_DUMP
109331daa343SDave Vasilevsky	def_bool y
109431daa343SDave Vasilevsky
109539365395SBaoquan Heconfig ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION
109685fcde40SBaoquan He	def_bool CRASH_RESERVE
109739365395SBaoquan He
10989be84592SGuo Renconfig COMPAT
10999be84592SGuo Ren	bool "Kernel support for 32-bit U-mode"
11009be84592SGuo Ren	default 64BIT
11019be84592SGuo Ren	depends on 64BIT && MMU
11029be84592SGuo Ren	help
11039be84592SGuo Ren	  This option enables support for a 32-bit U-mode running under a 64-bit
11049be84592SGuo Ren	  kernel at S-mode. riscv32-specific components such as system calls,
11059be84592SGuo Ren	  the user helper functions (vdso), signal rt_frame functions and the
11069be84592SGuo Ren	  ptrace interface are handled appropriately by the kernel.
11079be84592SGuo Ren
11089be84592SGuo Ren	  If you want to execute 32-bit userspace applications, say Y.
11099be84592SGuo Ren
1110fdf68accSAndrew Jonesconfig PARAVIRT
1111fdf68accSAndrew Jones	bool "Enable paravirtualization code"
1112fdf68accSAndrew Jones	depends on RISCV_SBI
1113fdf68accSAndrew Jones	help
1114fdf68accSAndrew Jones	  This changes the kernel so it can modify itself when it is run
1115fdf68accSAndrew Jones	  under a hypervisor, potentially improving performance significantly
1116fdf68accSAndrew Jones	  over full virtualization.
1117fdf68accSAndrew Jones
1118fdf68accSAndrew Jonesconfig PARAVIRT_TIME_ACCOUNTING
1119fdf68accSAndrew Jones	bool "Paravirtual steal time accounting"
1120fdf68accSAndrew Jones	depends on PARAVIRT
1121fdf68accSAndrew Jones	help
1122fdf68accSAndrew Jones	  Select this option to enable fine granularity task steal time
1123fdf68accSAndrew Jones	  accounting. Time spent executing other tasks in parallel with
1124fdf68accSAndrew Jones	  the current vCPU is discounted from the vCPU power. To account for
1125fdf68accSAndrew Jones	  that, there can be a small performance impact.
1126fdf68accSAndrew Jones
1127fdf68accSAndrew Jones	  If in doubt, say N here.
1128fdf68accSAndrew Jones
112939b33072SAlexandre Ghiticonfig RELOCATABLE
113039b33072SAlexandre Ghiti	bool "Build a relocatable kernel"
1131ea2bde36SSamuel Holland	depends on !XIP_KERNEL
11322aff5f95SQingfang Deng	select MODULE_SECTIONS if MODULES
11339b400d17SArd Biesheuvel	select ARCH_VMLINUX_NEEDS_RELOCS
113439b33072SAlexandre Ghiti	help
113539b33072SAlexandre Ghiti          This builds a kernel as a Position Independent Executable (PIE),
113639b33072SAlexandre Ghiti          which retains all relocation metadata required to relocate the
113739b33072SAlexandre Ghiti          kernel binary at runtime to a different virtual address than the
113839b33072SAlexandre Ghiti          address it was linked at.
113939b33072SAlexandre Ghiti          Since RISCV uses the RELA relocation format, this requires a
114039b33072SAlexandre Ghiti          relocation pass at runtime even if the kernel is loaded at the
114139b33072SAlexandre Ghiti          same address it was linked at.
114239b33072SAlexandre Ghiti
114339b33072SAlexandre Ghiti          If unsure, say N.
114439b33072SAlexandre Ghiti
114584fe419dSAlexandre Ghiticonfig RANDOMIZE_BASE
114684fe419dSAlexandre Ghiti        bool "Randomize the address of the kernel image"
114784fe419dSAlexandre Ghiti        select RELOCATABLE
114884fe419dSAlexandre Ghiti        depends on MMU && 64BIT && !XIP_KERNEL
114984fe419dSAlexandre Ghiti        help
115084fe419dSAlexandre Ghiti          Randomizes the virtual address at which the kernel image is
115184fe419dSAlexandre Ghiti          loaded, as a security feature that deters exploit attempts
115284fe419dSAlexandre Ghiti          relying on knowledge of the location of kernel internals.
115384fe419dSAlexandre Ghiti
115484fe419dSAlexandre Ghiti          It is the bootloader's job to provide entropy, by passing a
115584fe419dSAlexandre Ghiti          random u64 value in /chosen/kaslr-seed at kernel entry.
115684fe419dSAlexandre Ghiti
115784fe419dSAlexandre Ghiti          When booting via the UEFI stub, it will invoke the firmware's
115884fe419dSAlexandre Ghiti          EFI_RNG_PROTOCOL implementation (if available) to supply entropy
115984fe419dSAlexandre Ghiti          to the kernel proper. In addition, it will randomise the physical
116084fe419dSAlexandre Ghiti          location of the kernel Image as well.
116184fe419dSAlexandre Ghiti
116284fe419dSAlexandre Ghiti          If unsure, say N.
116384fe419dSAlexandre Ghiti
11642f66a3d0SJuerg Haefligerendmenu # "Kernel features"
1165fbe934d6SPalmer Dabbelt
1166aef53f97SNick Kossifidismenu "Boot options"
1167aef53f97SNick Kossifidis
1168aef53f97SNick Kossifidisconfig CMDLINE
11693aed8c43SNick Kossifidis	string "Built-in kernel command line"
1170aef53f97SNick Kossifidis	help
11713aed8c43SNick Kossifidis	  For most platforms, the arguments for the kernel's command line
11723aed8c43SNick Kossifidis	  are provided at run-time, during boot. However, there are cases
11733aed8c43SNick Kossifidis	  where either no arguments are being provided or the provided
11743aed8c43SNick Kossifidis	  arguments are insufficient or even invalid.
11753aed8c43SNick Kossifidis
11763aed8c43SNick Kossifidis	  When that occurs, it is possible to define a built-in command
11773aed8c43SNick Kossifidis	  line here and choose how the kernel should use it later on.
11783aed8c43SNick Kossifidis
11793aed8c43SNick Kossifidischoice
1180b9d73218SMasahiro Yamada	prompt "Built-in command line usage"
1181b9d73218SMasahiro Yamada	depends on CMDLINE != ""
11823aed8c43SNick Kossifidis	default CMDLINE_FALLBACK
11833aed8c43SNick Kossifidis	help
11843aed8c43SNick Kossifidis	  Choose how the kernel will handle the provided built-in command
11853aed8c43SNick Kossifidis	  line.
11863aed8c43SNick Kossifidis
11873aed8c43SNick Kossifidisconfig CMDLINE_FALLBACK
11883aed8c43SNick Kossifidis	bool "Use bootloader kernel arguments if available"
11893aed8c43SNick Kossifidis	help
11903aed8c43SNick Kossifidis	  Use the built-in command line as fallback in case we get nothing
11913aed8c43SNick Kossifidis	  during boot. This is the default behaviour.
11923aed8c43SNick Kossifidis
11933aed8c43SNick Kossifidisconfig CMDLINE_EXTEND
11943aed8c43SNick Kossifidis	bool "Extend bootloader kernel arguments"
11953aed8c43SNick Kossifidis	help
119648d9aabfS谢致邦 (XIE Zhibang)	  The built-in command line will be appended to the command-
119748d9aabfS谢致邦 (XIE Zhibang)	  line arguments provided during boot. This is useful in
11983aed8c43SNick Kossifidis	  cases where the provided arguments are insufficient and
11993aed8c43SNick Kossifidis	  you don't want to or cannot modify them.
12003aed8c43SNick Kossifidis
1201aef53f97SNick Kossifidisconfig CMDLINE_FORCE
12023aed8c43SNick Kossifidis	bool "Always use the default kernel command string"
1203aef53f97SNick Kossifidis	help
12043aed8c43SNick Kossifidis	  Always use the built-in command line, even if we get one during
12053aed8c43SNick Kossifidis	  boot. This is useful in case you need to override the provided
12063aed8c43SNick Kossifidis	  command line on systems where you don't have or want control
12073aed8c43SNick Kossifidis	  over it.
1208aef53f97SNick Kossifidis
12093aed8c43SNick Kossifidisendchoice
1210aef53f97SNick Kossifidis
1211d7071743SAtish Patraconfig EFI_STUB
1212d7071743SAtish Patra	bool
1213d7071743SAtish Patra
1214d7071743SAtish Patraconfig EFI
1215d7071743SAtish Patra	bool "UEFI runtime support"
121644c92257SVitaly Wool	depends on OF && !XIP_KERNEL
1217b91540d5SAtish Patra	depends on MMU
1218d7071743SAtish Patra	default y
1219a91a9ffbSSunil V L	select ARCH_SUPPORTS_ACPI if 64BIT
12205f365c13SConor Dooley	select EFI_GENERIC_STUB
12215f365c13SConor Dooley	select EFI_PARAMS_FROM_FDT
12225f365c13SConor Dooley	select EFI_RUNTIME_WRAPPERS
12235f365c13SConor Dooley	select EFI_STUB
12245f365c13SConor Dooley	select LIBFDT
12255f365c13SConor Dooley	select RISCV_ISA_C
12265f365c13SConor Dooley	select UCS2_STRING
1227d7071743SAtish Patra	help
1228d7071743SAtish Patra	  This option provides support for runtime services provided
1229d7071743SAtish Patra	  by UEFI firmware (such as non-volatile variables, realtime
1230d7071743SAtish Patra	  clock, and platform reset). A UEFI stub is also provided to
1231d7071743SAtish Patra	  allow the kernel to be booted as an EFI application. This
1232d7071743SAtish Patra	  is only useful on systems that have UEFI firmware.
1233d7071743SAtish Patra
1234d6ecd188SHaibo Xuconfig DMI
1235d6ecd188SHaibo Xu	bool "Enable support for SMBIOS (DMI) tables"
1236d6ecd188SHaibo Xu	depends on EFI
1237d6ecd188SHaibo Xu	default y
1238d6ecd188SHaibo Xu	help
1239d6ecd188SHaibo Xu	  This enables SMBIOS/DMI feature for systems.
1240d6ecd188SHaibo Xu
1241d6ecd188SHaibo Xu	  This option is only useful on systems that have UEFI firmware.
1242d6ecd188SHaibo Xu	  However, even with this option, the resultant kernel should
1243d6ecd188SHaibo Xu	  continue to boot on existing non-UEFI platforms.
1244d6ecd188SHaibo Xu
1245fea2fed2SGuo Renconfig CC_HAVE_STACKPROTECTOR_TLS
1246fea2fed2SGuo Ren	def_bool $(cc-option,-mstack-protector-guard=tls -mstack-protector-guard-reg=tp -mstack-protector-guard-offset=0)
1247fea2fed2SGuo Ren
1248fea2fed2SGuo Renconfig STACKPROTECTOR_PER_TASK
1249fea2fed2SGuo Ren	def_bool y
1250595b893eSKees Cook	depends on !RANDSTRUCT
1251fea2fed2SGuo Ren	depends on STACKPROTECTOR && CC_HAVE_STACKPROTECTOR_TLS
1252fea2fed2SGuo Ren
1253867432beSAlexandre Ghiticonfig PHYS_RAM_BASE_FIXED
1254867432beSAlexandre Ghiti	bool "Explicitly specified physical RAM address"
125544c1e84aSPalmer Dabbelt	depends on NONPORTABLE
1256867432beSAlexandre Ghiti	default n
1257867432beSAlexandre Ghiti
125844c92257SVitaly Woolconfig PHYS_RAM_BASE
125944c92257SVitaly Wool	hex "Platform Physical RAM address"
1260867432beSAlexandre Ghiti	depends on PHYS_RAM_BASE_FIXED
126144c92257SVitaly Wool	default "0x80000000"
126244c92257SVitaly Wool	help
126344c92257SVitaly Wool	  This is the physical address of RAM in the system. It has to be
126444c92257SVitaly Wool	  explicitly specified to run early relocations of read-write data
126544c92257SVitaly Wool	  from flash to RAM.
126644c92257SVitaly Wool
126744c92257SVitaly Woolconfig XIP_KERNEL
126844c92257SVitaly Wool	bool "Kernel Execute-In-Place from ROM"
126944c1e84aSPalmer Dabbelt	depends on MMU && SPARSEMEM && NONPORTABLE
127044c92257SVitaly Wool	# This prevents XIP from being enabled by all{yes,mod}config, which
127144c92257SVitaly Wool	# fail to build since XIP doesn't support large kernels.
127244c92257SVitaly Wool	depends on !COMPILE_TEST
1273867432beSAlexandre Ghiti	select PHYS_RAM_BASE_FIXED
127444c92257SVitaly Wool	help
127544c92257SVitaly Wool	  Execute-In-Place allows the kernel to run from non-volatile storage
127644c92257SVitaly Wool	  directly addressable by the CPU, such as NOR flash. This saves RAM
127744c92257SVitaly Wool	  space since the text section of the kernel is not loaded from flash
127844c92257SVitaly Wool	  to RAM.  Read-write sections, such as the data section and stack,
127944c92257SVitaly Wool	  are still copied to RAM.  The XIP kernel is not compressed since
128044c92257SVitaly Wool	  it has to run directly from flash, so it will take more space to
128144c92257SVitaly Wool	  store it.  The flash address used to link the kernel object files,
128244c92257SVitaly Wool	  and for storing it, is configuration dependent. Therefore, if you
128344c92257SVitaly Wool	  say Y here, you must know the proper physical address where to
128444c92257SVitaly Wool	  store the kernel image depending on your own flash memory usage.
128544c92257SVitaly Wool
128644c92257SVitaly Wool	  Also note that the make target becomes "make xipImage" rather than
128744c92257SVitaly Wool	  "make zImage" or "make Image".  The final kernel binary to put in
128844c92257SVitaly Wool	  ROM memory will be arch/riscv/boot/xipImage.
128944c92257SVitaly Wool
129044c92257SVitaly Wool	  SPARSEMEM is required because the kernel text and rodata that are
129144c92257SVitaly Wool	  flash resident are not backed by memmap, then any attempt to get
129244c92257SVitaly Wool	  a struct page on those regions will trigger a fault.
129344c92257SVitaly Wool
129444c92257SVitaly Wool	  If unsure, say N.
129544c92257SVitaly Wool
129644c92257SVitaly Woolconfig XIP_PHYS_ADDR
129744c92257SVitaly Wool	hex "XIP Kernel Physical Location"
129844c92257SVitaly Wool	depends on XIP_KERNEL
129944c92257SVitaly Wool	default "0x21000000"
130044c92257SVitaly Wool	help
130144c92257SVitaly Wool	  This is the physical address in your flash memory the kernel will
130244c92257SVitaly Wool	  be linked for and stored to.  This address is dependent on your
130344c92257SVitaly Wool	  own flash usage.
130444c92257SVitaly Wool
1305496ea826SConor Dooleyconfig RISCV_ISA_FALLBACK
1306496ea826SConor Dooley	bool "Permit falling back to parsing riscv,isa for extension support by default"
1307496ea826SConor Dooley	default y
1308496ea826SConor Dooley	help
1309496ea826SConor Dooley	  Parsing the "riscv,isa" devicetree property has been deprecated and
1310496ea826SConor Dooley	  replaced by a list of explicitly defined strings. For compatibility
1311496ea826SConor Dooley	  with existing platforms, the kernel will fall back to parsing the
1312496ea826SConor Dooley	  "riscv,isa" property if the replacements are not found.
1313496ea826SConor Dooley
1314496ea826SConor Dooley	  Selecting N here will result in a kernel that does not use the
1315496ea826SConor Dooley	  fallback, unless the commandline "riscv_isa_fallback" parameter is
1316496ea826SConor Dooley	  present.
1317496ea826SConor Dooley
1318496ea826SConor Dooley	  Please see the dt-binding, located at
1319496ea826SConor Dooley	  Documentation/devicetree/bindings/riscv/extensions.yaml for details
1320496ea826SConor Dooley	  on the replacement properties, "riscv,isa-base" and
1321496ea826SConor Dooley	  "riscv,isa-extensions".
1322496ea826SConor Dooley
13232d268251SPalmer Dabbeltconfig BUILTIN_DTB
13246c4a2f63SFrederik Haxel	bool "Built-in device tree"
132544c1e84aSPalmer Dabbelt	depends on OF && NONPORTABLE
132682e81b89SMasahiro Yamada	select GENERIC_BUILTIN_DTB
13272672031bSYangyu Chen	help
13282672031bSYangyu Chen	  Build a device tree into the Linux image.
13292672031bSYangyu Chen	  This option should be selected if no bootloader is being used.
13302672031bSYangyu Chen	  If unsure, say N.
13312672031bSYangyu Chen
13322672031bSYangyu Chen
133382e81b89SMasahiro Yamadaconfig BUILTIN_DTB_NAME
13342672031bSYangyu Chen	string "Built-in device tree source"
13352672031bSYangyu Chen	depends on BUILTIN_DTB
13362672031bSYangyu Chen	help
13372672031bSYangyu Chen	  DTS file path (without suffix, relative to arch/riscv/boot/dts)
13382672031bSYangyu Chen	  for the DTS file that will be used to produce the DTB linked into the
13392672031bSYangyu Chen	  kernel.
13402d268251SPalmer Dabbelt
13416c4a2f63SFrederik Haxelendmenu # "Boot options"
13426c4a2f63SFrederik Haxel
134344c1e84aSPalmer Dabbeltconfig PORTABLE
134444c1e84aSPalmer Dabbelt	bool
134544c1e84aSPalmer Dabbelt	default !NONPORTABLE
134644c1e84aSPalmer Dabbelt	select EFI
134744c1e84aSPalmer Dabbelt	select MMU
13485f365c13SConor Dooley	select OF
134944c1e84aSPalmer Dabbelt
1350e0c0a7c3SAndreas Schwabconfig ARCH_PROC_KCORE_TEXT
1351e0c0a7c3SAndreas Schwab	def_bool y
1352e0c0a7c3SAndreas Schwab
1353fbe934d6SPalmer Dabbeltmenu "Power management options"
1354fbe934d6SPalmer Dabbelt
13558636a1f9SMasahiro Yamadasource "kernel/power/Kconfig"
1356fbe934d6SPalmer Dabbelt
1357c0317210SSia Jee Hengconfig ARCH_HIBERNATION_POSSIBLE
1358e2d6b54bSConor Dooley	def_bool y
1359c0317210SSia Jee Heng
1360c0317210SSia Jee Hengconfig ARCH_HIBERNATION_HEADER
1361c0317210SSia Jee Heng	def_bool HIBERNATION
1362c0317210SSia Jee Heng
1363c1f048a6SSong Shuaiconfig ARCH_SUSPEND_POSSIBLE
1364c1f048a6SSong Shuai	def_bool y
1365c1f048a6SSong Shuai
13662f66a3d0SJuerg Haefligerendmenu # "Power management options"
1367d7071743SAtish Patra
1368f6e64b66SAnup Patelmenu "CPU Power Management"
1369f6e64b66SAnup Patel
1370f6e64b66SAnup Patelsource "drivers/cpuidle/Kconfig"
1371f6e64b66SAnup Patel
1372effae0e3SLad Prabhakarsource "drivers/cpufreq/Kconfig"
1373effae0e3SLad Prabhakar
13742f66a3d0SJuerg Haefligerendmenu # "CPU Power Management"
1375f6e64b66SAnup Patel
137699cdc6c1SAnup Patelsource "arch/riscv/kvm/Kconfig"
1377a91a9ffbSSunil V L
1378a91a9ffbSSunil V Lsource "drivers/acpi/Kconfig"
1379