xref: /linux/arch/riscv/Kconfig (revision 390db60f8e2bd21fae544917eb3a8618265c058c)
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
198f772955SSunil V L	select ACPI_RIMT if ACPI
2038738947SSia Jee Heng	select ACPI_SPCR_TABLE if ACPI
21c00a60d6SJiaxun Yang	select ARCH_DMA_DEFAULT_COHERENT
22c24a1967SChen Wandun	select ARCH_ENABLE_HUGEPAGE_MIGRATION if HUGETLB_PAGE && MIGRATION
23f8c2a240SBjörn Töpel	select ARCH_ENABLE_MEMORY_HOTPLUG if SPARSEMEM_VMEMMAP
24f8c2a240SBjörn Töpel	select ARCH_ENABLE_MEMORY_HOTREMOVE if MEMORY_HOTPLUG
255a7ac592SKefeng Wang	select ARCH_ENABLE_SPLIT_PMD_PTLOCK if PGTABLE_LEVELS > 2
265f365c13SConor Dooley	select ARCH_ENABLE_THP_MIGRATION if TRANSPARENT_HUGEPAGE
27ad97f9dfSChristoph Hellwig	select ARCH_HAS_BINFMT_FLAT
28fdecfea0SKees Cook	select ARCH_HAS_CURRENT_STACK_POINTER
29e8c7ef7dSPalmer Dabbelt	select ARCH_HAS_DEBUG_VIRTUAL if MMU
305f365c13SConor Dooley	select ARCH_HAS_DEBUG_VM_PGTABLE
31b422d28bSZong Li	select ARCH_HAS_DEBUG_WX
32*7882d2c4SThomas Weißschuh	select ARCH_HAS_ELF_CORE_EFLAGS if BINFMT_ELF && ELF_CORE
3348b4fc66SJisheng Zhang	select ARCH_HAS_FAST_MULTIPLIER
3495301414SKefeng Wang	select ARCH_HAS_FORTIFY_SOURCE
35e8c7ef7dSPalmer Dabbelt	select ARCH_HAS_GCOV_PROFILE_ALL
36e8c7ef7dSPalmer Dabbelt	select ARCH_HAS_GIGANTIC_PAGE
3794a7734dSYong-Xuan Wang	select ARCH_HAS_HW_PTE_YOUNG
3820d38f7cSTobias Klauser	select ARCH_HAS_KCOV
3977acc6b5SSamuel Holland	select ARCH_HAS_KERNEL_FPU_SUPPORT if 64BIT && FPU
40d6cfd177SAndrea Parri	select ARCH_HAS_MEMBARRIER_CALLBACKS
41cd9b2901SAndrea Parri	select ARCH_HAS_MEMBARRIER_SYNC_CORE
42e8c7ef7dSPalmer Dabbelt	select ARCH_HAS_MMIOWB
4399a670b2SRuan Jinjie	select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
44a49ab905SAnup Patel	select ARCH_HAS_PMEM_API
4522aaec35SJisheng Zhang	select ARCH_HAS_PREEMPT_LAZY
46cd9b2901SAndrea Parri	select ARCH_HAS_PREPARE_SYNC_CORE_CMD
47f9aad622SAnshuman Khandual	select ARCH_HAS_PTDUMP if MMU
48e8c7ef7dSPalmer Dabbelt	select ARCH_HAS_PTE_SPECIAL
4910cc3278SMike Rapoport	select ARCH_HAS_SET_DIRECT_MAP if MMU
5010cc3278SMike Rapoport	select ARCH_HAS_SET_MEMORY if MMU
5144c92257SVitaly Wool	select ARCH_HAS_STRICT_KERNEL_RWX if MMU && !XIP_KERNEL
5244c92257SVitaly Wool	select ARCH_HAS_STRICT_MODULE_RWX if MMU && !XIP_KERNEL
53cd9b2901SAndrea Parri	select ARCH_HAS_SYNC_CORE_BEFORE_USERMODE
5408d0ce30SSami Tolvanen	select ARCH_HAS_SYSCALL_WRAPPER
552f100585SGuo Ren	select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
56918327e9SKees Cook	select ARCH_HAS_UBSAN
57eb3b66aaSThomas Weißschuh	select ARCH_HAS_VDSO_ARCH_DATA if HAVE_GENERIC_VDSO
58205cbc71SPu Lehui	select ARCH_HAVE_NMI_SAFE_CMPXCHG
59e8065df5SSunil V L	select ARCH_KEEP_MEMBLOCK if ACPI
60f8c2a240SBjörn Töpel	select ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE	if 64BIT && MMU
61fc0c769fSVincent Chen	select ARCH_OPTIONAL_KERNEL_RWX if ARCH_HAS_STRICT_KERNEL_RWX
62fc0c769fSVincent Chen	select ARCH_OPTIONAL_KERNEL_RWX_DEFAULT
637f85b04bSJisheng Zhang	select ARCH_STACKWALK
647f85b04bSJisheng Zhang	select ARCH_SUPPORTS_ATOMIC_RMW
656f49743aSNathan Chancellor	# clang >= 17: https://github.com/llvm/llvm-project/commit/62fa708ceb027713b386c7e0efda994f8bdc27e2
6623ef9d43SKees Cook	select ARCH_SUPPORTS_CFI if (!CC_IS_CLANG || CLANG_VERSION >= 170000)
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
7095ee3364SNathan Chancellor	select ARCH_SUPPORTS_LTO_CLANG if CMODEL_MEDANY
716578a1ffSNathan Chancellor	select ARCH_SUPPORTS_LTO_CLANG_THIN
72a869b8c2SJisheng Zhang	select ARCH_SUPPORTS_MSEAL_SYSTEM_MAPPINGS if 64BIT && MMU
7334c0a5b0SYueHaibing	select ARCH_SUPPORTS_PAGE_TABLE_CHECK if MMU
74648321faSJisheng Zhang	select ARCH_SUPPORTS_PER_VMA_LOCK if MMU
752638e4e6SSebastian Andrzej Siewior	select ARCH_SUPPORTS_RT
76d1584d79SSami Tolvanen	select ARCH_SUPPORTS_SHADOW_CALL_STACK if HAVE_SHADOW_CALL_STACK
777bd291abSPeter Zijlstra	select ARCH_SUPPORTS_SCHED_MC if SMP
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
8223ef9d43SKees Cook	select ARCH_USES_CFI_TRAPS if CFI
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
9926b537edSKuan-Wei Chiu	select CPU_NO_EFFICIENT_FFS if !RISCV_ISA_ZBB
1004dc4af9cSAndrew Jones	select CPU_PM if CPU_IDLE || HIBERNATION || SUSPEND
1015874ca4cSAlexandre Ghiti	select DYNAMIC_FTRACE if FUNCTION_TRACER
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
113eb3b66aaSThomas Weißschuh	select GENERIC_GETTIMEOFDAY if HAVE_GENERIC_VDSO && 64BIT
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
126eb3b66aaSThomas Weißschuh	select GENERIC_TIME_VSYSCALL if GENERIC_GETTIMEOFDAY
127c45fc916SConor Dooley	select HARDIRQS_SW_RESEND
128fcbfe812SNiklas Schnelle	select HAS_IOPORT if MMU
129f7bd2be7SAlexandre Ghiti	select HAVE_ALIGNED_STRUCT_PAGE
130efe75c49SDavid Abdurachmanov	select HAVE_ARCH_AUDITSYSCALL
131be79afc7SLiu Shixin	select HAVE_ARCH_HUGE_VMALLOC if HAVE_ARCH_HUGE_VMAP
1327bed5161SNam Cao	select HAVE_ARCH_HUGE_VMAP if MMU && 64BIT
13342e0e0b4SJisheng Zhang	select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL
13442e0e0b4SJisheng Zhang	select HAVE_ARCH_JUMP_LABEL_RELATIVE if !XIP_KERNEL
135e8c7ef7dSPalmer Dabbelt	select HAVE_ARCH_KASAN if MMU && 64BIT
136e178d670SNylon Chen	select HAVE_ARCH_KASAN_VMALLOC if MMU && 64BIT
13747513f24SLiu Shixin	select HAVE_ARCH_KFENCE if MMU && 64BIT
13857fbad15SKees Cook	select HAVE_ARCH_KSTACK_ERASE
13942e0e0b4SJisheng Zhang	select HAVE_ARCH_KGDB if !XIP_KERNEL
140e8c7ef7dSPalmer Dabbelt	select HAVE_ARCH_KGDB_QXFER_PKT
141e8c7ef7dSPalmer Dabbelt	select HAVE_ARCH_MMAP_RND_BITS if MMU
1429be84592SGuo Ren	select HAVE_ARCH_MMAP_RND_COMPAT_BITS if COMPAT
14305d450aaSSong Shuai	select HAVE_ARCH_RANDOMIZE_KSTACK_OFFSET
1445340627eSDavid Abdurachmanov	select HAVE_ARCH_SECCOMP_FILTER
1455f365c13SConor Dooley	select HAVE_ARCH_THREAD_STRUCT_WHITELIST
146e8c7ef7dSPalmer Dabbelt	select HAVE_ARCH_TRACEHOOK
1479b76d71fSLinus Torvalds	select HAVE_ARCH_TRANSPARENT_HUGEPAGE if 64BIT && MMU
148c3cc2a4aSAlexandre Ghiti	select HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD if 64BIT && MMU
149a2492ca8SSamuel Holland	select HAVE_ARCH_USERFAULTFD_MINOR if 64BIT && USERFAULTFD
15031da94c2STong Tiangen	select HAVE_ARCH_VMAP_STACK if MMU && 64BIT
1512ff2b7ecSMasahiro Yamada	select HAVE_ASM_MODVERSIONS
15224a9c541SFrederic Weisbecker	select HAVE_CONTEXT_TRACKING_USER
153cbb3d91dSTobias Klauser	select HAVE_DEBUG_KMEMLEAK
1546bd33e1eSChristoph Hellwig	select HAVE_DMA_CONTIGUOUS if MMU
155ab7fa6b0SJisheng Zhang	select HAVE_DYNAMIC_FTRACE if !XIP_KERNEL && MMU && (CLANG_SUPPORTS_DYNAMIC_FTRACE || GCC_SUPPORTS_DYNAMIC_FTRACE)
156c41bf432SAndy Chiu	select FUNCTION_ALIGNMENT_4B if HAVE_DYNAMIC_FTRACE && RISCV_ISA_C
157b21cdb95SAndy Chiu	select HAVE_DYNAMIC_FTRACE_WITH_DIRECT_CALLS if HAVE_DYNAMIC_FTRACE_WITH_CALL_OPS
15823ef9d43SKees Cook	select HAVE_DYNAMIC_FTRACE_WITH_CALL_OPS if (DYNAMIC_FTRACE_WITH_ARGS && !CFI)
1597caa9765SPuranjay Mohan	select HAVE_DYNAMIC_FTRACE_WITH_ARGS if HAVE_DYNAMIC_FTRACE
160a762e926SMasami Hiramatsu (Google)	select HAVE_FTRACE_GRAPH_FUNC
161e8eb8e1bSPu Lehui	select HAVE_FUNCTION_GRAPH_TRACER if HAVE_DYNAMIC_FTRACE_WITH_ARGS
162a3ed4157SMasami Hiramatsu (Google)	select HAVE_FUNCTION_GRAPH_FREGS
1635874ca4cSAlexandre Ghiti	select HAVE_FUNCTION_TRACER if !XIP_KERNEL && HAVE_DYNAMIC_FTRACE
164e8c7ef7dSPalmer Dabbelt	select HAVE_EBPF_JIT if MMU
16541e871f2SThomas Gleixner	select HAVE_GENERIC_TIF_BITS
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
170eb3b66aaSThomas Weißschuh	select HAVE_GENERIC_VDSO if MMU
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
226eb3b66aaSThomas Weißschuh	select VDSO_GETRANDOM if HAVE_GENERIC_VDSO && 64BIT
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
252ae84ff9aSNathan Chancellor# https://github.com/llvm/llvm-project/commit/bbc0f99f3bc96f1db16f649fc21dd18e5b0918f6
253ae84ff9aSNathan Chancellorconfig ARCH_HAS_BROKEN_DWARF5
254ae84ff9aSNathan Chancellor	def_bool y
255ae84ff9aSNathan Chancellor	# https://github.com/llvm/llvm-project/commit/1df5ea29b43690b6622db2cad7b745607ca4de6a
256ae84ff9aSNathan Chancellor	depends on AS_IS_LLVM && AS_VERSION < 180000
257ae84ff9aSNathan Chancellor	# https://github.com/llvm/llvm-project/commit/7ffabb61a5569444b5ac9322e22e5471cc5e4a77
258ae84ff9aSNathan Chancellor	depends on LD_IS_LLD && LLD_VERSION < 180000
259ae84ff9aSNathan Chancellor
26054c95a11SAlexandre Ghiticonfig ARCH_MMAP_RND_BITS_MIN
26154c95a11SAlexandre Ghiti	default 18 if 64BIT
26254c95a11SAlexandre Ghiti	default 8
26354c95a11SAlexandre Ghiti
2649be84592SGuo Renconfig ARCH_MMAP_RND_COMPAT_BITS_MIN
2659be84592SGuo Ren	default 8
2669be84592SGuo Ren
26754c95a11SAlexandre Ghiti# max bits determined by the following formula:
26854c95a11SAlexandre Ghiti#  VA_BITS - PAGE_SHIFT - 3
26954c95a11SAlexandre Ghiticonfig ARCH_MMAP_RND_BITS_MAX
27054c95a11SAlexandre Ghiti	default 24 if 64BIT # SV39 based
27154c95a11SAlexandre Ghiti	default 17
272fbe934d6SPalmer Dabbelt
2739be84592SGuo Renconfig ARCH_MMAP_RND_COMPAT_BITS_MAX
2749be84592SGuo Ren	default 17
2759be84592SGuo Ren
276a4c3733dSChristoph Hellwig# set if we run in machine mode, cleared if we run in supervisor mode
277a4c3733dSChristoph Hellwigconfig RISCV_M_MODE
278f862bbf4SSamuel Holland	bool "Build a kernel that runs in machine mode"
279f862bbf4SSamuel Holland	depends on !MMU
280f862bbf4SSamuel Holland	default y
281f862bbf4SSamuel Holland	help
282f862bbf4SSamuel Holland	  Select this option if you want to run the kernel in M-mode,
283f862bbf4SSamuel Holland	  without the assistance of any other firmware.
284a4c3733dSChristoph Hellwig
285eded8bc6SDamien Le Moal# set if we are running in S-mode and can use SBI calls
286eded8bc6SDamien Le Moalconfig RISCV_SBI
287eded8bc6SDamien Le Moal	bool
288eded8bc6SDamien Le Moal	depends on !RISCV_M_MODE
289eded8bc6SDamien Le Moal	default y
290eded8bc6SDamien Le Moal
291fbe934d6SPalmer Dabbeltconfig MMU
2926bd33e1eSChristoph Hellwig	bool "MMU-based Paged Memory Management Support"
2936bd33e1eSChristoph Hellwig	default y
2946bd33e1eSChristoph Hellwig	help
2956bd33e1eSChristoph Hellwig	  Select if you want MMU-based virtualised addressing space
2966bd33e1eSChristoph Hellwig	  support by paged memory management. If unsure, say 'Y'.
297fbe934d6SPalmer Dabbelt
29854c5639dSAlexandre Ghiticonfig KASAN_SHADOW_OFFSET
29954c5639dSAlexandre Ghiti	hex
30054c5639dSAlexandre Ghiti	depends on KASAN_GENERIC
301f7ae0233SAlexandre Ghiti	default 0xdfffffff00000000 if 64BIT
30254c5639dSAlexandre Ghiti	default 0xffffffff if 32BIT
30354c5639dSAlexandre Ghiti
304d95f1a54SLogan Gunthorpeconfig ARCH_FLATMEM_ENABLE
3054f0e8eefSAtish Patra	def_bool !NUMA
306d95f1a54SLogan Gunthorpe
307d95f1a54SLogan Gunthorpeconfig ARCH_SPARSEMEM_ENABLE
308d95f1a54SLogan Gunthorpe	def_bool y
309aa273420SDamien Le Moal	depends on MMU
310199fc6b8SKefeng Wang	select SPARSEMEM_STATIC if 32BIT && SPARSEMEM
311a5406a7fSKefeng Wang	select SPARSEMEM_VMEMMAP_ENABLE if 64BIT
312d95f1a54SLogan Gunthorpe
313d95f1a54SLogan Gunthorpeconfig ARCH_SELECT_MEMORY_MODEL
314d95f1a54SLogan Gunthorpe	def_bool ARCH_SPARSEMEM_ENABLE
315d95f1a54SLogan Gunthorpe
31674784081SGuo Renconfig ARCH_SUPPORTS_UPROBES
31774784081SGuo Ren	def_bool y
31874784081SGuo Ren
319fbe934d6SPalmer Dabbeltconfig STACKTRACE_SUPPORT
320fbe934d6SPalmer Dabbelt	def_bool y
321fbe934d6SPalmer Dabbelt
322fbe934d6SPalmer Dabbeltconfig GENERIC_BUG
323fbe934d6SPalmer Dabbelt	def_bool y
324fbe934d6SPalmer Dabbelt	depends on BUG
325fbe934d6SPalmer Dabbelt	select GENERIC_BUG_RELATIVE_POINTERS if 64BIT
326fbe934d6SPalmer Dabbelt
327fbe934d6SPalmer Dabbeltconfig GENERIC_BUG_RELATIVE_POINTERS
328fbe934d6SPalmer Dabbelt	bool
329fbe934d6SPalmer Dabbelt
330fbe934d6SPalmer Dabbeltconfig GENERIC_CALIBRATE_DELAY
331fbe934d6SPalmer Dabbelt	def_bool y
332fbe934d6SPalmer Dabbelt
333fbe934d6SPalmer Dabbeltconfig GENERIC_CSUM
334fbe934d6SPalmer Dabbelt	def_bool y
335fbe934d6SPalmer Dabbelt
336fbe934d6SPalmer Dabbeltconfig GENERIC_HWEIGHT
337fbe934d6SPalmer Dabbelt	def_bool y
338fbe934d6SPalmer Dabbelt
339f2c17aabSAnup Patelconfig FIX_EARLYCON_MEM
3400312a3d4SAndreas Schwab	def_bool MMU
341f2c17aabSAnup Patel
3425c178472SJisheng Zhangconfig ILLEGAL_POINTER_VALUE
3435c178472SJisheng Zhang	hex
3445c178472SJisheng Zhang	default 0 if 32BIT
3455c178472SJisheng Zhang	default 0xdead000000000000 if 64BIT
3465c178472SJisheng Zhang
347fbe934d6SPalmer Dabbeltconfig PGTABLE_LEVELS
348fbe934d6SPalmer Dabbelt	int
349011f09d1SQinglin Pan	default 5 if 64BIT
350fbe934d6SPalmer Dabbelt	default 2
351fbe934d6SPalmer Dabbelt
3523c469798SGuo Renconfig LOCKDEP_SUPPORT
3533c469798SGuo Ren	def_bool y
3543c469798SGuo Ren
3551631ba12SHeiko Stuebnerconfig RISCV_DMA_NONCOHERENT
3561631ba12SHeiko Stuebner	bool
3571631ba12SHeiko Stuebner	select ARCH_HAS_DMA_PREP_COHERENT
3581631ba12SHeiko Stuebner	select ARCH_HAS_SETUP_DMA_OPS
3595f365c13SConor Dooley	select ARCH_HAS_SYNC_DMA_FOR_CPU
3605f365c13SConor Dooley	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
361f51f7a0fSJisheng Zhang	select DMA_BOUNCE_UNALIGNED_KMALLOC if SWIOTLB
3621631ba12SHeiko Stuebner
363b79f300cSLad Prabhakarconfig RISCV_NONSTANDARD_CACHE_OPS
364b79f300cSLad Prabhakar	bool
365b79f300cSLad Prabhakar	help
366b79f300cSLad Prabhakar	  This enables function pointer support for non-standard noncoherent
367b79f300cSLad Prabhakar	  systems to handle cache management.
368b79f300cSLad Prabhakar
3695ac43ab2SAndrew Jonesconfig AS_HAS_INSN
3705ac43ab2SAndrew Jones	def_bool $(as-instr,.insn r 51$(comma) 0$(comma) 0$(comma) t0$(comma) t0$(comma) zero)
3715ac43ab2SAndrew Jones
372e4bb020fSAndy Chiuconfig AS_HAS_OPTION_ARCH
373fafdea34SNathan Chancellor	# https://github.com/llvm/llvm-project/commit/9e8ed3403c191ab9c4903e8eeb8f732ff8a43cb4
374e4bb020fSAndy Chiu	def_bool y
375e4bb020fSAndy Chiu	depends on $(as-instr, .option arch$(comma) +m)
376e4bb020fSAndy Chiu
3770cbb8a32SLoys Olliviersource "arch/riscv/Kconfig.socs"
378a3d095acSAndrew Jonessource "arch/riscv/Kconfig.errata"
3790cbb8a32SLoys Ollivier
380fbe934d6SPalmer Dabbeltmenu "Platform type"
381fbe934d6SPalmer Dabbelt
38244c1e84aSPalmer Dabbeltconfig NONPORTABLE
38344c1e84aSPalmer Dabbelt	bool "Allow configurations that result in non-portable kernels"
38444c1e84aSPalmer Dabbelt	help
38544c1e84aSPalmer Dabbelt	  RISC-V kernel binaries are compatible between all known systems
38644c1e84aSPalmer Dabbelt	  whenever possible, but there are some use cases that can only be
38744c1e84aSPalmer Dabbelt	  satisfied by configurations that result in kernel binaries that are
38844c1e84aSPalmer Dabbelt	  not portable between systems.
38944c1e84aSPalmer Dabbelt
39044c1e84aSPalmer Dabbelt	  Selecting N does not guarantee kernels will be portable to all known
39144c1e84aSPalmer Dabbelt	  systems.  Selecting any of the options guarded by NONPORTABLE will
39244c1e84aSPalmer Dabbelt	  result in kernel binaries that are unlikely to be portable between
39344c1e84aSPalmer Dabbelt	  systems.
39444c1e84aSPalmer Dabbelt
39544c1e84aSPalmer Dabbelt	  If unsure, say N.
39644c1e84aSPalmer Dabbelt
397fbe934d6SPalmer Dabbeltchoice
398fbe934d6SPalmer Dabbelt	prompt "Base ISA"
399fbe934d6SPalmer Dabbelt	default ARCH_RV64I
400fbe934d6SPalmer Dabbelt	help
40186cca81aSAntony Pavlov	  This selects the base ISA that this kernel will target and must match
402fbe934d6SPalmer Dabbelt	  the target platform.
403fbe934d6SPalmer Dabbelt
404fbe934d6SPalmer Dabbeltconfig ARCH_RV32I
405fbe934d6SPalmer Dabbelt	bool "RV32I"
40644c1e84aSPalmer Dabbelt	depends on NONPORTABLE
407fbe934d6SPalmer Dabbelt	select 32BIT
408e3d59805SMatt Redfearn	select GENERIC_LIB_ASHLDI3
409e3d59805SMatt Redfearn	select GENERIC_LIB_ASHRDI3
410e3d59805SMatt Redfearn	select GENERIC_LIB_LSHRDI3
4118f79125dSZong Li	select GENERIC_LIB_UCMPDI2
412fbe934d6SPalmer Dabbelt
413fbe934d6SPalmer Dabbeltconfig ARCH_RV64I
414fbe934d6SPalmer Dabbelt	bool "RV64I"
415fbe934d6SPalmer Dabbelt	select 64BIT
416d2075895SNick Desaulniers	select ARCH_SUPPORTS_INT128 if CC_HAS_INT128
4176bd33e1eSChristoph Hellwig	select SWIOTLB if MMU
418fbe934d6SPalmer Dabbelt
419fbe934d6SPalmer Dabbeltendchoice
420fbe934d6SPalmer Dabbelt
421fbe934d6SPalmer Dabbelt# We must be able to map all physical memory into the kernel, but the compiler
422fbe934d6SPalmer Dabbelt# is still a bit more efficient when generating code if it's setup in a manner
423fbe934d6SPalmer Dabbelt# such that it can only map 2GiB of memory.
424fbe934d6SPalmer Dabbeltchoice
425fbe934d6SPalmer Dabbelt	prompt "Kernel Code Model"
426fbe934d6SPalmer Dabbelt	default CMODEL_MEDLOW if 32BIT
427fbe934d6SPalmer Dabbelt	default CMODEL_MEDANY if 64BIT
428fbe934d6SPalmer Dabbelt
429fbe934d6SPalmer Dabbelt	config CMODEL_MEDLOW
430fbe934d6SPalmer Dabbelt		bool "medium low code model"
431fbe934d6SPalmer Dabbelt	config CMODEL_MEDANY
432fbe934d6SPalmer Dabbelt		bool "medium any code model"
433fbe934d6SPalmer Dabbeltendchoice
434fbe934d6SPalmer Dabbelt
435ab1ef68eSZong Liconfig MODULE_SECTIONS
436ab1ef68eSZong Li	bool
437ab1ef68eSZong Li	select HAVE_MOD_ARCH_SPECIFIC
438ab1ef68eSZong Li
439fbe934d6SPalmer Dabbeltconfig SMP
440fbe934d6SPalmer Dabbelt	bool "Symmetric Multi-Processing"
441fbe934d6SPalmer Dabbelt	help
442fbe934d6SPalmer Dabbelt	  This enables support for systems with more than one CPU.  If
443fbe934d6SPalmer Dabbelt	  you say N here, the kernel will run on single and
444fbe934d6SPalmer Dabbelt	  multiprocessor machines, but will use only one CPU of a
445fbe934d6SPalmer Dabbelt	  multiprocessor machine. If you say Y here, the kernel will run
446fbe934d6SPalmer Dabbelt	  on many, but not all, single processor machines. On a single
447fbe934d6SPalmer Dabbelt	  processor machine, the kernel will run faster if you say N
448fbe934d6SPalmer Dabbelt	  here.
449fbe934d6SPalmer Dabbelt
450fbe934d6SPalmer Dabbelt	  If you don't know what to do here, say N.
451fbe934d6SPalmer Dabbelt
452fbe934d6SPalmer Dabbeltconfig NR_CPUS
453e623715fSAnup Patel	int "Maximum number of CPUs (2-512)"
454fbe934d6SPalmer Dabbelt	depends on SMP
4551d6b5ed4SSamuel Holland	range 2 512 if !RISCV_SBI_V01
4561d6b5ed4SSamuel Holland	range 2 32 if RISCV_SBI_V01 && 32BIT
4571d6b5ed4SSamuel Holland	range 2 64 if RISCV_SBI_V01 && 64BIT
458e623715fSAnup Patel	default "32" if 32BIT
459e623715fSAnup Patel	default "64" if 64BIT
460fbe934d6SPalmer Dabbelt
461f1e58583SAtish Patraconfig HOTPLUG_CPU
462f1e58583SAtish Patra	bool "Support for hot-pluggable CPUs"
463f1e58583SAtish Patra	depends on SMP
464f1e58583SAtish Patra	select GENERIC_IRQ_MIGRATION
465f1e58583SAtish Patra	help
466f1e58583SAtish Patra
467f1e58583SAtish Patra	  Say Y here to experiment with turning CPUs off and on.  CPUs
468f1e58583SAtish Patra	  can be controlled through /sys/devices/system/cpu.
469f1e58583SAtish Patra
470f1e58583SAtish Patra	  Say N if you want to disable CPU hotplug.
471f1e58583SAtish Patra
472fbe934d6SPalmer Dabbeltchoice
473fbe934d6SPalmer Dabbelt	prompt "CPU Tuning"
474fbe934d6SPalmer Dabbelt	default TUNE_GENERIC
475fbe934d6SPalmer Dabbelt
476fbe934d6SPalmer Dabbeltconfig TUNE_GENERIC
477fbe934d6SPalmer Dabbelt	bool "generic"
478fbe934d6SPalmer Dabbelt
479fbe934d6SPalmer Dabbeltendchoice
480fbe934d6SPalmer Dabbelt
4814f0e8eefSAtish Patra# Common NUMA Features
4824f0e8eefSAtish Patraconfig NUMA
4834f0e8eefSAtish Patra	bool "NUMA Memory Allocation and Scheduler Support"
4841adbc294SKefeng Wang	depends on SMP && MMU
4854f0e8eefSAtish Patra	select ARCH_SUPPORTS_NUMA_BALANCING
4865f365c13SConor Dooley	select GENERIC_ARCH_NUMA
4876b9f29b8SAlexandre Ghiti	select HAVE_SETUP_PER_CPU_AREA
4887ecd19cfSKefeng Wang	select NEED_PER_CPU_EMBED_FIRST_CHUNK
4896b9f29b8SAlexandre Ghiti	select NEED_PER_CPU_PAGE_FIRST_CHUNK
4905f365c13SConor Dooley	select OF_NUMA
4915f365c13SConor Dooley	select USE_PERCPU_NUMA_NODE_ID
4924f0e8eefSAtish Patra	help
4934f0e8eefSAtish Patra	  Enable NUMA (Non-Uniform Memory Access) support.
4944f0e8eefSAtish Patra
4954f0e8eefSAtish Patra	  The kernel will try to allocate memory used by a CPU on the
4964f0e8eefSAtish Patra	  local memory of the CPU and add some more NUMA awareness to the kernel.
4974f0e8eefSAtish Patra
4984f0e8eefSAtish Patraconfig NODES_SHIFT
4994f0e8eefSAtish Patra	int "Maximum NUMA Nodes (as a power of 2)"
5004f0e8eefSAtish Patra	range 1 10
5014f0e8eefSAtish Patra	default "2"
502a9ee6cf5SMike Rapoport	depends on NUMA
5034f0e8eefSAtish Patra	help
5044f0e8eefSAtish Patra	  Specify the maximum number of NUMA Nodes available on the target
5054f0e8eefSAtish Patra	  system.  Increases memory reserved to accommodate various tables.
5064f0e8eefSAtish Patra
507ab83647fSAlexandre Ghitichoice
508ab83647fSAlexandre Ghiti	prompt "RISC-V spinlock type"
509ab83647fSAlexandre Ghiti	default RISCV_COMBO_SPINLOCKS
510ab83647fSAlexandre Ghiti
511ab83647fSAlexandre Ghiticonfig RISCV_TICKET_SPINLOCKS
512ab83647fSAlexandre Ghiti	bool "Using ticket spinlock"
513ab83647fSAlexandre Ghiti
514ab83647fSAlexandre Ghiticonfig RISCV_QUEUED_SPINLOCKS
515ab83647fSAlexandre Ghiti	bool "Using queued spinlock"
516ab83647fSAlexandre Ghiti	depends on SMP && MMU && NONPORTABLE
517ab83647fSAlexandre Ghiti	select ARCH_USE_QUEUED_SPINLOCKS
518ab83647fSAlexandre Ghiti	help
519ab83647fSAlexandre Ghiti	  The queued spinlock implementation requires the forward progress
520ab83647fSAlexandre Ghiti	  guarantee of cmpxchg()/xchg() atomic operations: CAS with Zabha or
521ab83647fSAlexandre Ghiti	  LR/SC with Ziccrse provide such guarantee.
522ab83647fSAlexandre Ghiti
523ab83647fSAlexandre Ghiti	  Select this if and only if Zabha or Ziccrse is available on your
524ab83647fSAlexandre Ghiti	  platform, RISCV_QUEUED_SPINLOCKS must not be selected for platforms
525ab83647fSAlexandre Ghiti	  without one of those extensions.
526ab83647fSAlexandre Ghiti
527ab83647fSAlexandre Ghiti	  If unsure, select RISCV_COMBO_SPINLOCKS, which will use qspinlocks
528ab83647fSAlexandre Ghiti	  when supported and otherwise ticket spinlocks.
529ab83647fSAlexandre Ghiti
530ab83647fSAlexandre Ghiticonfig RISCV_COMBO_SPINLOCKS
531ab83647fSAlexandre Ghiti	bool "Using combo spinlock"
532ab83647fSAlexandre Ghiti	depends on SMP && MMU
533ab83647fSAlexandre Ghiti	select ARCH_USE_QUEUED_SPINLOCKS
534ab83647fSAlexandre Ghiti	help
535ab83647fSAlexandre Ghiti	  Embed both queued spinlock and ticket lock so that the spinlock
536ab83647fSAlexandre Ghiti	  implementation can be chosen at runtime.
537ab83647fSAlexandre Ghiti
538ab83647fSAlexandre Ghitiendchoice
539ab83647fSAlexandre Ghiti
540e64f737aSHeiko Stuebnerconfig RISCV_ALTERNATIVE
541e64f737aSHeiko Stuebner	bool
542e64f737aSHeiko Stuebner	depends on !XIP_KERNEL
543e64f737aSHeiko Stuebner	help
544e64f737aSHeiko Stuebner	  This Kconfig allows the kernel to automatically patch the
545ff19a8deSAndrew Jones	  erratum or cpufeature required by the execution platform at run
546ff19a8deSAndrew Jones	  time. The code patching overhead is minimal, as it's only done
547ff19a8deSAndrew Jones	  once at boot and once on each module load.
548e64f737aSHeiko Stuebner
549a35707c3SHeiko Stuebnerconfig RISCV_ALTERNATIVE_EARLY
550a35707c3SHeiko Stuebner	bool
551a35707c3SHeiko Stuebner	depends on RISCV_ALTERNATIVE
552a35707c3SHeiko Stuebner	help
553a35707c3SHeiko Stuebner	  Allows early patching of the kernel for special errata
554a35707c3SHeiko Stuebner
555fbe934d6SPalmer Dabbeltconfig RISCV_ISA_C
556fbe934d6SPalmer Dabbelt	bool "Emit compressed instructions when building Linux"
557fbe934d6SPalmer Dabbelt	default y
558fbe934d6SPalmer Dabbelt	help
559fbe934d6SPalmer Dabbelt	  Adds "C" to the ISA subsets that the toolchain is allowed to emit
560fbe934d6SPalmer Dabbelt	  when building Linux, which results in compressed instructions in the
5616216182fSConor Dooley	  Linux binary. This option produces a kernel that will not run on
5626216182fSConor Dooley	  systems that do not support compressed instructions.
563fbe934d6SPalmer Dabbelt
564fbe934d6SPalmer Dabbelt	  If you don't know what to do here, say Y.
565fbe934d6SPalmer Dabbelt
56609d6775fSSamuel Hollandconfig RISCV_ISA_SUPM
56709d6775fSSamuel Holland	bool "Supm extension for userspace pointer masking"
56809d6775fSSamuel Holland	depends on 64BIT
56909d6775fSSamuel Holland	default y
57009d6775fSSamuel Holland	help
57109d6775fSSamuel Holland	  Add support for pointer masking in userspace (Supm) when the
57209d6775fSSamuel Holland	  underlying hardware extension (Smnpm or Ssnpm) is detected at boot.
57309d6775fSSamuel Holland
57409d6775fSSamuel Holland	  If this option is disabled, userspace will be unable to use
57509d6775fSSamuel Holland	  the prctl(PR_{SET,GET}_TAGGED_ADDR_CTRL) API.
57609d6775fSSamuel Holland
57723ad288aSQinglin Panconfig RISCV_ISA_SVNAPOT
5785464912cSConor Dooley	bool "Svnapot extension support for supervisor mode NAPOT pages"
579ff689fd2SHeiko Stuebner	depends on 64BIT && MMU
5801ee7fc3fSConor Dooley	depends on RISCV_ALTERNATIVE
581ff689fd2SHeiko Stuebner	default y
582ff689fd2SHeiko Stuebner	help
5836216182fSConor Dooley	  Enable support for the Svnapot ISA-extension when it is detected
5846216182fSConor Dooley	  at boot.
58523ad288aSQinglin Pan
5865464912cSConor Dooley	  The Svnapot extension is used to mark contiguous PTEs as a range
58723ad288aSQinglin Pan	  of contiguous virtual-to-physical translations for a naturally
58823ad288aSQinglin Pan	  aligned power-of-2 (NAPOT) granularity larger than the base 4KB page
58923ad288aSQinglin Pan	  size. When HUGETLBFS is also selected this option unconditionally
59023ad288aSQinglin Pan	  allocates some memory for each NAPOT page size supported by the kernel.
59123ad288aSQinglin Pan	  When optimizing for low memory consumption and for platforms without
5925464912cSConor Dooley	  the Svnapot extension, it may be better to say N here.
59323ad288aSQinglin Pan
59423ad288aSQinglin Pan	  If you don't know what to do here, say Y.
59523ad288aSQinglin Pan
596ff689fd2SHeiko Stuebnerconfig RISCV_ISA_SVPBMT
5975464912cSConor Dooley	bool "Svpbmt extension support for supervisor mode page-based memory types"
598ff689fd2SHeiko Stuebner	depends on 64BIT && MMU
599ff689fd2SHeiko Stuebner	depends on RISCV_ALTERNATIVE
600ff689fd2SHeiko Stuebner	default y
601ff689fd2SHeiko Stuebner	help
6026216182fSConor Dooley	   Add support for the Svpbmt ISA-extension (Supervisor-mode:
6036216182fSConor Dooley	   page-based memory types) in the kernel when it is detected at boot.
604924cbb8cSHeiko Stuebner
605924cbb8cSHeiko Stuebner	   The memory type for a page contains a combination of attributes
606924cbb8cSHeiko Stuebner	   that indicate the cacheability, idempotency, and ordering
607924cbb8cSHeiko Stuebner	   properties for access to that page.
608ff689fd2SHeiko Stuebner
6095464912cSConor Dooley	   The Svpbmt extension is only available on 64-bit cpus.
610ff689fd2SHeiko Stuebner
611ff689fd2SHeiko Stuebner	   If you don't know what to do here, say Y.
612ff689fd2SHeiko Stuebner
613fa8e7cceSGuo Renconfig TOOLCHAIN_HAS_V
614fa8e7cceSGuo Ren	bool
615fa8e7cceSGuo Ren	default y
6165ba7a75aSAnton Blanchard	depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64imv)
6175ba7a75aSAnton Blanchard	depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32imv)
61887b28d71SNathan Chancellor	depends on LD_IS_LLD || LD_VERSION >= 23800
619fa8e7cceSGuo Ren	depends on AS_HAS_OPTION_ARCH
620fa8e7cceSGuo Ren
621fa8e7cceSGuo Renconfig RISCV_ISA_V
6226216182fSConor Dooley	bool "Vector extension support"
623fa8e7cceSGuo Ren	depends on TOOLCHAIN_HAS_V
624fa8e7cceSGuo Ren	depends on FPU
625fa8e7cceSGuo Ren	select DYNAMIC_SIGFRAME
626fa8e7cceSGuo Ren	default y
627fa8e7cceSGuo Ren	help
6286216182fSConor Dooley	  Add support for the Vector extension when it is detected at boot.
6296216182fSConor Dooley	  When this option is disabled, neither the kernel nor userspace may
6306216182fSConor Dooley	  use vector procedures.
631fa8e7cceSGuo Ren
632fa8e7cceSGuo Ren	  If you don't know what to do here, say Y.
633fa8e7cceSGuo Ren
634fa8e7cceSGuo Renconfig RISCV_ISA_V_DEFAULT_ENABLE
635fa8e7cceSGuo Ren	bool "Enable userspace Vector by default"
636fa8e7cceSGuo Ren	depends on RISCV_ISA_V
637fa8e7cceSGuo Ren	default y
638fa8e7cceSGuo Ren	help
639fa8e7cceSGuo Ren	  Say Y here if you want to enable Vector in userspace by default.
640fa8e7cceSGuo Ren	  Otherwise, userspace has to make explicit prctl() call to enable
641fa8e7cceSGuo Ren	  Vector, or enable it via the sysctl interface.
642fa8e7cceSGuo Ren
643fa8e7cceSGuo Ren	  If you don't know what to do here, say Y.
644fa8e7cceSGuo Ren
645c2a658d4SAndy Chiuconfig RISCV_ISA_V_UCOPY_THRESHOLD
646c2a658d4SAndy Chiu	int "Threshold size for vectorized user copies"
647c2a658d4SAndy Chiu	depends on RISCV_ISA_V
648c2a658d4SAndy Chiu	default 768
649c2a658d4SAndy Chiu	help
650c2a658d4SAndy Chiu	  Prefer using vectorized copy_to_user()/copy_from_user() when the
651c2a658d4SAndy Chiu	  workload size exceeds this value.
652c2a658d4SAndy Chiu
6532080ff94SAndy Chiuconfig RISCV_ISA_V_PREEMPTIVE
6542080ff94SAndy Chiu	bool "Run kernel-mode Vector with kernel preemption"
6552080ff94SAndy Chiu	depends on PREEMPTION
6562080ff94SAndy Chiu	depends on RISCV_ISA_V
6572080ff94SAndy Chiu	default y
6582080ff94SAndy Chiu	help
6592080ff94SAndy Chiu	  Usually, in-kernel SIMD routines are run with preemption disabled.
660c39d5375SMiquel Sabaté Solà	  Functions which invoke long running SIMD thus must yield the core's
6612080ff94SAndy Chiu	  vector unit to prevent blocking other tasks for too long.
6622080ff94SAndy Chiu
663c39d5375SMiquel Sabaté Solà	  This config allows the kernel to run SIMD without explicitly disabling
664c39d5375SMiquel Sabaté Solà	  preemption. Enabling this config will result in higher memory consumption
665c39d5375SMiquel Sabaté Solà	  due to the allocation of per-task's kernel Vector context.
6662080ff94SAndy Chiu
667b8ddb0dfSChristoph Müllnerconfig RISCV_ISA_ZAWRS
668b8ddb0dfSChristoph Müllner	bool "Zawrs extension support for more efficient busy waiting"
669b8ddb0dfSChristoph Müllner	depends on RISCV_ALTERNATIVE
670b8ddb0dfSChristoph Müllner	default y
671b8ddb0dfSChristoph Müllner	help
672b8ddb0dfSChristoph Müllner	  The Zawrs extension defines instructions to be used in polling loops
673b8ddb0dfSChristoph Müllner	  which allow a hart to enter a low-power state or to trap to the
674b8ddb0dfSChristoph Müllner	  hypervisor while waiting on a store to a memory location. Enable the
675b8ddb0dfSChristoph Müllner	  use of these instructions in the kernel when the Zawrs extension is
676b8ddb0dfSChristoph Müllner	  detected at boot.
677b8ddb0dfSChristoph Müllner
6781658ef43SAlexandre Ghiticonfig TOOLCHAIN_HAS_ZABHA
6791658ef43SAlexandre Ghiti	bool
6801658ef43SAlexandre Ghiti	default y
6811658ef43SAlexandre Ghiti	depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64ima_zabha)
6821658ef43SAlexandre Ghiti	depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32ima_zabha)
6831658ef43SAlexandre Ghiti	depends on AS_HAS_OPTION_ARCH
6841658ef43SAlexandre Ghiti
6851658ef43SAlexandre Ghiticonfig RISCV_ISA_ZABHA
6861658ef43SAlexandre Ghiti	bool "Zabha extension support for atomic byte/halfword operations"
6871658ef43SAlexandre Ghiti	depends on TOOLCHAIN_HAS_ZABHA
6881658ef43SAlexandre Ghiti	depends on RISCV_ALTERNATIVE
6891658ef43SAlexandre Ghiti	default y
6901658ef43SAlexandre Ghiti	help
6911658ef43SAlexandre Ghiti	  Enable the use of the Zabha ISA-extension to implement kernel
6921658ef43SAlexandre Ghiti	  byte/halfword atomic memory operations when it is detected at boot.
6931658ef43SAlexandre Ghiti
6941658ef43SAlexandre Ghiti	  If you don't know what to do here, say Y.
6951658ef43SAlexandre Ghiti
69638acdee3SAlexandre Ghiticonfig TOOLCHAIN_HAS_ZACAS
69738acdee3SAlexandre Ghiti	bool
69838acdee3SAlexandre Ghiti	default y
69938acdee3SAlexandre Ghiti	depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64ima_zacas)
70038acdee3SAlexandre Ghiti	depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32ima_zacas)
70138acdee3SAlexandre Ghiti	depends on AS_HAS_OPTION_ARCH
70238acdee3SAlexandre Ghiti
70338acdee3SAlexandre Ghiticonfig RISCV_ISA_ZACAS
70438acdee3SAlexandre Ghiti	bool "Zacas extension support for atomic CAS"
70538acdee3SAlexandre Ghiti	depends on RISCV_ALTERNATIVE
70638acdee3SAlexandre Ghiti	default y
70738acdee3SAlexandre Ghiti	help
70838acdee3SAlexandre Ghiti	  Enable the use of the Zacas ISA-extension to implement kernel atomic
70938acdee3SAlexandre Ghiti	  cmpxchg operations when it is detected at boot.
71038acdee3SAlexandre Ghiti
711b8ddb0dfSChristoph Müllner	  If you don't know what to do here, say Y.
712b8ddb0dfSChristoph Müllner
713b6fcdb19SHeiko Stuebnerconfig TOOLCHAIN_HAS_ZBB
7141631ba12SHeiko Stuebner	bool
715b8c86872SConor Dooley	default y
716b6fcdb19SHeiko Stuebner	depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64ima_zbb)
717b6fcdb19SHeiko Stuebner	depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32ima_zbb)
71887b28d71SNathan Chancellor	depends on LD_IS_LLD || LD_VERSION >= 23900
719e4bb020fSAndy Chiu	depends on AS_HAS_OPTION_ARCH
720b6fcdb19SHeiko Stuebner
72134ca4ec6SEric Biggers# This symbol indicates that the toolchain supports all v1.0 vector crypto
72234ca4ec6SEric Biggers# extensions, including Zvk*, Zvbb, and Zvbc.  LLVM added all of these at once.
72334ca4ec6SEric Biggers# binutils added all except Zvkb, then added Zvkb.  So we just check for Zvkb.
72434ca4ec6SEric Biggersconfig TOOLCHAIN_HAS_VECTOR_CRYPTO
725886516faSEric Biggers	def_bool $(as-instr, .option arch$(comma) +v$(comma) +zvkb)
72634ca4ec6SEric Biggers	depends on AS_HAS_OPTION_ARCH
72734ca4ec6SEric Biggers
7288a2f20acSAlexandre Ghiticonfig TOOLCHAIN_HAS_ZBA
7298a2f20acSAlexandre Ghiti	bool
7308a2f20acSAlexandre Ghiti	default y
7318a2f20acSAlexandre Ghiti	depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64ima_zba)
7328a2f20acSAlexandre Ghiti	depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32ima_zba)
73387b28d71SNathan Chancellor	depends on LD_IS_LLD || LD_VERSION >= 23900
7348a2f20acSAlexandre Ghiti	depends on AS_HAS_OPTION_ARCH
7358a2f20acSAlexandre Ghiti
736c12603e7SXiao Wangconfig RISCV_ISA_ZBA
737c12603e7SXiao Wang	bool "Zba extension support for bit manipulation instructions"
738c12603e7SXiao Wang	default y
739c12603e7SXiao Wang	help
740c12603e7SXiao Wang	   Add support for enabling optimisations in the kernel when the Zba
741c12603e7SXiao Wang	   extension is detected at boot.
742c12603e7SXiao Wang
743c12603e7SXiao Wang	   The Zba extension provides instructions to accelerate the generation
744c12603e7SXiao Wang	   of addresses that index into arrays of basic data types.
745c12603e7SXiao Wang
746c12603e7SXiao Wang	   If you don't know what to do here, say Y.
747c12603e7SXiao Wang
748b6fcdb19SHeiko Stuebnerconfig RISCV_ISA_ZBB
749b6fcdb19SHeiko Stuebner	bool "Zbb extension support for bit manipulation instructions"
7501ee7fc3fSConor Dooley	depends on RISCV_ALTERNATIVE
751b6fcdb19SHeiko Stuebner	default y
752b6fcdb19SHeiko Stuebner	help
7536216182fSConor Dooley	   Add support for enabling optimisations in the kernel when the
7549343aabaSConor Dooley	   Zbb extension is detected at boot. Some optimisations may
7559343aabaSConor Dooley	   additionally depend on toolchain support for Zbb.
756b6fcdb19SHeiko Stuebner
757b6fcdb19SHeiko Stuebner	   The Zbb extension provides instructions to accelerate a number
758b6fcdb19SHeiko Stuebner	   of bit-specific operations (count bit population, sign extending,
759b6fcdb19SHeiko Stuebner	   bitrotation, etc).
760b6fcdb19SHeiko Stuebner
761b6fcdb19SHeiko Stuebner	   If you don't know what to do here, say Y.
7621631ba12SHeiko Stuebner
763a43fe27dSXiao Wangconfig TOOLCHAIN_HAS_ZBC
764a43fe27dSXiao Wang	bool
765a43fe27dSXiao Wang	default y
766a43fe27dSXiao Wang	depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64ima_zbc)
767a43fe27dSXiao Wang	depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32ima_zbc)
76887b28d71SNathan Chancellor	depends on LD_IS_LLD || LD_VERSION >= 23900
769a43fe27dSXiao Wang	depends on AS_HAS_OPTION_ARCH
770a43fe27dSXiao Wang
771a43fe27dSXiao Wangconfig RISCV_ISA_ZBC
772a43fe27dSXiao Wang	bool "Zbc extension support for carry-less multiplication instructions"
773a43fe27dSXiao Wang	depends on TOOLCHAIN_HAS_ZBC
774a43fe27dSXiao Wang	depends on MMU
775a43fe27dSXiao Wang	depends on RISCV_ALTERNATIVE
776a43fe27dSXiao Wang	default y
777a43fe27dSXiao Wang	help
778a43fe27dSXiao Wang	   Adds support to dynamically detect the presence of the Zbc
779a43fe27dSXiao Wang	   extension (carry-less multiplication) and enable its usage.
780a43fe27dSXiao Wang
781a43fe27dSXiao Wang	   The Zbc extension could accelerate CRC (cyclic redundancy check)
782a43fe27dSXiao Wang	   calculations.
783a43fe27dSXiao Wang
784a43fe27dSXiao Wang	   If you don't know what to do here, say Y.
785a43fe27dSXiao Wang
786a44fb572SCharlie Jenkinsconfig TOOLCHAIN_HAS_ZBKB
787a44fb572SCharlie Jenkins	bool
788a44fb572SCharlie Jenkins	default y
789a44fb572SCharlie Jenkins	depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64ima_zbkb)
790a44fb572SCharlie Jenkins	depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32ima_zbkb)
79187b28d71SNathan Chancellor	depends on LD_IS_LLD || LD_VERSION >= 23900
792a44fb572SCharlie Jenkins	depends on AS_HAS_OPTION_ARCH
793a44fb572SCharlie Jenkins
794a44fb572SCharlie Jenkinsconfig RISCV_ISA_ZBKB
795a44fb572SCharlie Jenkins	bool "Zbkb extension support for bit manipulation instructions"
796a44fb572SCharlie Jenkins	depends on TOOLCHAIN_HAS_ZBKB
797a44fb572SCharlie Jenkins	depends on RISCV_ALTERNATIVE
798a44fb572SCharlie Jenkins	default y
799a44fb572SCharlie Jenkins	help
800a44fb572SCharlie Jenkins	   Adds support to dynamically detect the presence of the ZBKB
801a44fb572SCharlie Jenkins	   extension (bit manipulation for cryptography) and enable its usage.
802a44fb572SCharlie Jenkins
803a44fb572SCharlie Jenkins	   The Zbkb extension provides instructions to accelerate a number
804a44fb572SCharlie Jenkins	   of common cryptography operations (pack, zip, etc).
805a44fb572SCharlie Jenkins
806a44fb572SCharlie Jenkins	   If you don't know what to do here, say Y.
807a44fb572SCharlie Jenkins
8081631ba12SHeiko Stuebnerconfig RISCV_ISA_ZICBOM
8091631ba12SHeiko Stuebner	bool "Zicbom extension support for non-coherent DMA operation"
8101ee7fc3fSConor Dooley	depends on MMU
8111ee7fc3fSConor Dooley	depends on RISCV_ALTERNATIVE
8121631ba12SHeiko Stuebner	default y
8135f365c13SConor Dooley	select RISCV_DMA_NONCOHERENT
814381cae16SChristoph Hellwig	select DMA_DIRECT_REMAP
8151631ba12SHeiko Stuebner	help
8166216182fSConor Dooley	   Add support for the Zicbom extension (Cache Block Management
8176216182fSConor Dooley	   Operations) and enable its use in the kernel when it is detected
8186216182fSConor Dooley	   at boot.
8191631ba12SHeiko Stuebner
8201631ba12SHeiko Stuebner	   The Zicbom extension can be used to handle for example
8211631ba12SHeiko Stuebner	   non-coherent DMA support on devices that need it.
8221631ba12SHeiko Stuebner
8231631ba12SHeiko Stuebner	   If you don't know what to do here, say Y.
8241631ba12SHeiko Stuebner
825ab0f7746SAndrew Jonesconfig RISCV_ISA_ZICBOZ
826ab0f7746SAndrew Jones	bool "Zicboz extension support for faster zeroing of memory"
827d34a6b71SConor Dooley	depends on RISCV_ALTERNATIVE
828ab0f7746SAndrew Jones	default y
829ab0f7746SAndrew Jones	help
8305464912cSConor Dooley	   Enable the use of the Zicboz extension (cbo.zero instruction)
8316216182fSConor Dooley	   in the kernel when it is detected at boot.
832ab0f7746SAndrew Jones
833ab0f7746SAndrew Jones	   The Zicboz extension is used for faster zeroing of memory.
834ab0f7746SAndrew Jones
835ab0f7746SAndrew Jones	   If you don't know what to do here, say Y.
836ab0f7746SAndrew Jones
8378d496b5aSAlexandre Ghiticonfig RISCV_ISA_ZICBOP
8388d496b5aSAlexandre Ghiti	bool "Zicbop extension support for cache block prefetch"
8398d496b5aSAlexandre Ghiti	depends on MMU
8408d496b5aSAlexandre Ghiti	depends on RISCV_ALTERNATIVE
8418d496b5aSAlexandre Ghiti	default y
8428d496b5aSAlexandre Ghiti	help
8438d496b5aSAlexandre Ghiti	  Adds support to dynamically detect the presence of the ZICBOP
8448d496b5aSAlexandre Ghiti	  extension (Cache Block Prefetch Operations) and enable its
8458d496b5aSAlexandre Ghiti	  usage.
8468d496b5aSAlexandre Ghiti
8478d496b5aSAlexandre Ghiti	  The Zicbop extension can be used to prefetch cache blocks for
8488d496b5aSAlexandre Ghiti	  read/write fetch.
8498d496b5aSAlexandre Ghiti
8508d496b5aSAlexandre Ghiti	  If you don't know what to do here, say Y.
8518d496b5aSAlexandre Ghiti
852e89c2e81SNathan Chancellorconfig TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI
853e89c2e81SNathan Chancellor	def_bool y
854e89c2e81SNathan Chancellor	# https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=aed44286efa8ae8717a77d94b51ac3614e2ca6dc
855ca09f772SMingzheng Xing	# https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=98416dbb0a62579d4a7a4a76bab51b5b52fec2cd
856ca09f772SMingzheng Xing	depends on AS_IS_GNU && AS_VERSION >= 23600
857e89c2e81SNathan Chancellor	help
858ca09f772SMingzheng Xing	  Binutils-2.38 and GCC-12.1.0 bumped the default ISA spec to the newer
859ca09f772SMingzheng Xing	  20191213 version, which moves some instructions from the I extension to
860ca09f772SMingzheng Xing	  the Zicsr and Zifencei extensions. This requires explicitly specifying
861ca09f772SMingzheng Xing	  Zicsr and Zifencei when binutils >= 2.38 or GCC >= 12.1.0. Zicsr
862ca09f772SMingzheng Xing	  and Zifencei are supported in binutils from version 2.36 onwards.
863ca09f772SMingzheng Xing	  To make life easier, and avoid forcing toolchains that default to a
864ca09f772SMingzheng Xing	  newer ISA spec to version 2.2, relax the check to binutils >= 2.36.
865ef21fa7cSMingzheng Xing	  For clang < 17 or GCC < 11.3.0, for which this is not possible or need
866ef21fa7cSMingzheng Xing	  special treatment, this is dealt with in TOOLCHAIN_NEEDS_OLD_ISA_SPEC.
867e89c2e81SNathan Chancellor
868e89c2e81SNathan Chancellorconfig TOOLCHAIN_NEEDS_OLD_ISA_SPEC
869e89c2e81SNathan Chancellor	def_bool y
870e89c2e81SNathan Chancellor	depends on TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI
871e89c2e81SNathan Chancellor	# https://github.com/llvm/llvm-project/commit/22e199e6afb1263c943c0c0d4498694e15bf8a16
872ef21fa7cSMingzheng Xing	# https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=d29f5d6ab513c52fd872f532c492e35ae9fd6671
873ef21fa7cSMingzheng Xing	depends on (CC_IS_CLANG && CLANG_VERSION < 170000) || (CC_IS_GCC && GCC_VERSION < 110300)
874e89c2e81SNathan Chancellor	help
875ca09f772SMingzheng Xing	  Certain versions of clang and GCC do not support zicsr and zifencei via
876ca09f772SMingzheng Xing	  -march. This option causes an older ISA spec compatible with these older
877ca09f772SMingzheng Xing	  versions of clang and GCC to be passed to GAS, which has the same result
878ca09f772SMingzheng Xing	  as passing zicsr and zifencei to -march.
879e89c2e81SNathan Chancellor
8809671f706SAlan Kaoconfig FPU
8819671f706SAlan Kao	bool "FPU support"
8829671f706SAlan Kao	default y
8839671f706SAlan Kao	help
8846216182fSConor Dooley	  Add support for floating point operations when an FPU is detected at
8856216182fSConor Dooley	  boot. When this option is disabled, neither the kernel nor userspace
8866216182fSConor Dooley	  may use the floating point unit.
8879671f706SAlan Kao
8889671f706SAlan Kao	  If you don't know what to do here, say Y.
8899671f706SAlan Kao
890163e76ccSGuo Renconfig IRQ_STACKS
891dd69d07aSGuo Ren	bool "Independent irq & softirq stacks" if EXPERT
892163e76ccSGuo Ren	default y
893163e76ccSGuo Ren	select HAVE_IRQ_EXIT_ON_IRQ_STACK
894dd69d07aSGuo Ren	select HAVE_SOFTIRQ_ON_OWN_STACK
895163e76ccSGuo Ren	help
896dd69d07aSGuo Ren	  Add independent irq & softirq stacks for percpu to prevent kernel stack
897dd69d07aSGuo Ren	  overflows. We may save some memory footprint by disabling IRQ_STACKS.
898163e76ccSGuo Ren
899a7555f6bSGuo Renconfig THREAD_SIZE_ORDER
900a7555f6bSGuo Ren	int "Kernel stack size (in power-of-two numbers of page size)" if VMAP_STACK && EXPERT
901a7555f6bSGuo Ren	range 0 4
902cfb10de1SAlexandre Ghiti	default 1 if 32BIT
903a7555f6bSGuo Ren	default 2
904a7555f6bSGuo Ren	help
905a7555f6bSGuo Ren	  Specify the Pages of thread stack size (from 4KB to 64KB), which also
906a7555f6bSGuo Ren	  affects irq stack size, which is equal to thread stack size.
907a7555f6bSGuo Ren
9087c832321SClément Légerconfig RISCV_MISALIGNED
909f413aae9SCharlie Jenkins	bool
910d1703dc7SJesse Taube	help
911d1703dc7SJesse Taube	  Embed support for detecting and emulating misaligned
912d1703dc7SJesse Taube	  scalar or vector loads and stores.
913d1703dc7SJesse Taube
914c05a62c9SJesse Taubeconfig RISCV_SCALAR_MISALIGNED
9157c832321SClément Léger	bool
916d1703dc7SJesse Taube	select RISCV_MISALIGNED
917bc38f613SClément Léger	select SYSCTL_ARCH_UNALIGN_ALLOW
9187c832321SClément Léger	help
919f413aae9SCharlie Jenkins	  Embed support for emulating misaligned loads and stores.
920f413aae9SCharlie Jenkins
921d1703dc7SJesse Taubeconfig RISCV_VECTOR_MISALIGNED
922d1703dc7SJesse Taube	bool
923d1703dc7SJesse Taube	select RISCV_MISALIGNED
924d1703dc7SJesse Taube	depends on RISCV_ISA_V
925d1703dc7SJesse Taube	help
926d1703dc7SJesse Taube	  Enable detecting support for vector misaligned loads and stores.
927d1703dc7SJesse Taube
928f413aae9SCharlie Jenkinschoice
929f413aae9SCharlie Jenkins	prompt "Unaligned Accesses Support"
930f413aae9SCharlie Jenkins	default RISCV_PROBE_UNALIGNED_ACCESS
931f413aae9SCharlie Jenkins	help
932f413aae9SCharlie Jenkins	  This determines the level of support for unaligned accesses. This
933f413aae9SCharlie Jenkins	  information is used by the kernel to perform optimizations. It is also
934f413aae9SCharlie Jenkins	  exposed to user space via the hwprobe syscall. The hardware will be
935f413aae9SCharlie Jenkins	  probed at boot by default.
936f413aae9SCharlie Jenkins
937f413aae9SCharlie Jenkinsconfig RISCV_PROBE_UNALIGNED_ACCESS
938f413aae9SCharlie Jenkins	bool "Probe for hardware unaligned access support"
939c05a62c9SJesse Taube	select RISCV_SCALAR_MISALIGNED
940f413aae9SCharlie Jenkins	help
941f413aae9SCharlie Jenkins	  During boot, the kernel will run a series of tests to determine the
942f413aae9SCharlie Jenkins	  speed of unaligned accesses. This probing will dynamically determine
943f413aae9SCharlie Jenkins	  the speed of unaligned accesses on the underlying system. If unaligned
944f413aae9SCharlie Jenkins	  memory accesses trap into the kernel as they are not supported by the
945f413aae9SCharlie Jenkins	  system, the kernel will emulate the unaligned accesses to preserve the
946f413aae9SCharlie Jenkins	  UABI.
947f413aae9SCharlie Jenkins
948f413aae9SCharlie Jenkinsconfig RISCV_EMULATED_UNALIGNED_ACCESS
949f413aae9SCharlie Jenkins	bool "Emulate unaligned access where system support is missing"
950c05a62c9SJesse Taube	select RISCV_SCALAR_MISALIGNED
951f413aae9SCharlie Jenkins	help
952f413aae9SCharlie Jenkins	  If unaligned memory accesses trap into the kernel as they are not
953f413aae9SCharlie Jenkins	  supported by the system, the kernel will emulate the unaligned
954f413aae9SCharlie Jenkins	  accesses to preserve the UABI. When the underlying system does support
955f413aae9SCharlie Jenkins	  unaligned accesses, the unaligned accesses are assumed to be slow.
956f413aae9SCharlie Jenkins
957f413aae9SCharlie Jenkinsconfig RISCV_SLOW_UNALIGNED_ACCESS
958f413aae9SCharlie Jenkins	bool "Assume the system supports slow unaligned memory accesses"
959f413aae9SCharlie Jenkins	depends on NONPORTABLE
960f413aae9SCharlie Jenkins	help
961f413aae9SCharlie Jenkins	  Assume that the system supports slow unaligned memory accesses. The
962f413aae9SCharlie Jenkins	  kernel and userspace programs may not be able to run at all on systems
963f413aae9SCharlie Jenkins	  that do not support unaligned memory accesses.
9647c832321SClément Léger
965b6da6cbeSJisheng Zhangconfig RISCV_EFFICIENT_UNALIGNED_ACCESS
966f413aae9SCharlie Jenkins	bool "Assume the system supports fast unaligned memory accesses"
967b6da6cbeSJisheng Zhang	depends on NONPORTABLE
968d0fdc20bSJisheng Zhang	select DCACHE_WORD_ACCESS if MMU
969b6da6cbeSJisheng Zhang	select HAVE_EFFICIENT_UNALIGNED_ACCESS
970b6da6cbeSJisheng Zhang	help
971f413aae9SCharlie Jenkins	  Assume that the system supports fast unaligned memory accesses. When
972f413aae9SCharlie Jenkins	  enabled, this option improves the performance of the kernel on such
973f413aae9SCharlie Jenkins	  systems. However, the kernel and userspace programs will run much more
974f413aae9SCharlie Jenkins	  slowly, or will not be able to run at all, on systems that do not
975f413aae9SCharlie Jenkins	  support efficient unaligned memory accesses.
976b6da6cbeSJisheng Zhang
977f413aae9SCharlie Jenkinsendchoice
978b6da6cbeSJisheng Zhang
979d1703dc7SJesse Taubechoice
980d1703dc7SJesse Taube	prompt "Vector unaligned Accesses Support"
981d1703dc7SJesse Taube	depends on RISCV_ISA_V
982d1703dc7SJesse Taube	default RISCV_PROBE_VECTOR_UNALIGNED_ACCESS
983d1703dc7SJesse Taube	help
984d1703dc7SJesse Taube	  This determines the level of support for vector unaligned accesses. This
985d1703dc7SJesse Taube	  information is used by the kernel to perform optimizations. It is also
986d1703dc7SJesse Taube	  exposed to user space via the hwprobe syscall. The hardware will be
987d1703dc7SJesse Taube	  probed at boot by default.
988d1703dc7SJesse Taube
989d1703dc7SJesse Taubeconfig RISCV_PROBE_VECTOR_UNALIGNED_ACCESS
990d1703dc7SJesse Taube	bool "Probe speed of vector unaligned accesses"
991d1703dc7SJesse Taube	select RISCV_VECTOR_MISALIGNED
992d1703dc7SJesse Taube	depends on RISCV_ISA_V
993d1703dc7SJesse Taube	help
994d1703dc7SJesse Taube	  During boot, the kernel will run a series of tests to determine the
995d1703dc7SJesse Taube	  speed of vector unaligned accesses if they are supported. This probing
996d1703dc7SJesse Taube	  will dynamically determine the speed of vector unaligned accesses on
997d1703dc7SJesse Taube	  the underlying system if they are supported.
998d1703dc7SJesse Taube
999e7c9d66eSJesse Taubeconfig RISCV_SLOW_VECTOR_UNALIGNED_ACCESS
1000e7c9d66eSJesse Taube	bool "Assume the system supports slow vector unaligned memory accesses"
1001e7c9d66eSJesse Taube	depends on NONPORTABLE
1002e7c9d66eSJesse Taube	help
1003e7c9d66eSJesse Taube	  Assume that the system supports slow vector unaligned memory accesses. The
1004e7c9d66eSJesse Taube	  kernel and userspace programs may not be able to run at all on systems
1005e7c9d66eSJesse Taube	  that do not support unaligned memory accesses.
1006e7c9d66eSJesse Taube
1007e7c9d66eSJesse Taubeconfig RISCV_EFFICIENT_VECTOR_UNALIGNED_ACCESS
1008e7c9d66eSJesse Taube	bool "Assume the system supports fast vector unaligned memory accesses"
1009e7c9d66eSJesse Taube	depends on NONPORTABLE
1010e7c9d66eSJesse Taube	help
1011e7c9d66eSJesse Taube	  Assume that the system supports fast vector unaligned memory accesses. When
1012e7c9d66eSJesse Taube	  enabled, this option improves the performance of the kernel on such
1013e7c9d66eSJesse Taube	  systems. However, the kernel and userspace programs will run much more
1014e7c9d66eSJesse Taube	  slowly, or will not be able to run at all, on systems that do not
1015e7c9d66eSJesse Taube	  support efficient unaligned memory accesses.
1016e7c9d66eSJesse Taube
1017d1703dc7SJesse Taubeendchoice
1018d1703dc7SJesse Taube
101923c996fcSCharlie Jenkinssource "arch/riscv/Kconfig.vendor"
102023c996fcSCharlie Jenkins
10212f66a3d0SJuerg Haefligerendmenu # "Platform type"
1022fbe934d6SPalmer Dabbelt
1023aef53f97SNick Kossifidismenu "Kernel features"
1024fbe934d6SPalmer Dabbelt
1025fbe934d6SPalmer Dabbeltsource "kernel/Kconfig.hz"
1026fbe934d6SPalmer Dabbelt
1027efca1398SAtish Patraconfig RISCV_SBI_V01
1028efca1398SAtish Patra	bool "SBI v0.1 support"
1029efca1398SAtish Patra	depends on RISCV_SBI
1030efca1398SAtish Patra	help
1031efca1398SAtish Patra	  This config allows kernel to use SBI v0.1 APIs. This will be
1032efca1398SAtish Patra	  deprecated in future once legacy M-mode software are no longer in use.
1033fba8a867SNick Kossifidis
10342ffc48fcSAtish Patraconfig RISCV_BOOT_SPINWAIT
10352ffc48fcSAtish Patra	bool "Spinwait booting method"
10362ffc48fcSAtish Patra	depends on SMP
103777d707a3SPalmer Dabbelt	default y if RISCV_SBI_V01 || RISCV_M_MODE
10382ffc48fcSAtish Patra	help
10392ffc48fcSAtish Patra	  This enables support for booting Linux via spinwait method. In the
10402ffc48fcSAtish Patra	  spinwait method, all cores randomly jump to Linux. One of the cores
10412ffc48fcSAtish Patra	  gets chosen via lottery and all other keep spinning on a percpu
10422ffc48fcSAtish Patra	  variable. This method cannot support CPU hotplug and sparse hartid
10432ffc48fcSAtish Patra	  scheme. It should be only enabled for M-mode Linux or platforms relying
10442ffc48fcSAtish Patra	  on older firmware without SBI HSM extension. All other platforms should
10452ffc48fcSAtish Patra	  rely on ordered booting via SBI HSM extension which gets chosen
10462ffc48fcSAtish Patra	  dynamically at runtime if the firmware supports it.
10472ffc48fcSAtish Patra
104877d707a3SPalmer Dabbelt	  Since spinwait is incompatible with sparse hart IDs, it requires
104977d707a3SPalmer Dabbelt	  NR_CPUS be large enough to contain the physical hart ID of the first
105077d707a3SPalmer Dabbelt	  hart to enter Linux.
105177d707a3SPalmer Dabbelt
105277d707a3SPalmer Dabbelt	  If unsure what to do here, say N.
105377d707a3SPalmer Dabbelt
10541f0d6efeSEric DeVolderconfig ARCH_SUPPORTS_KEXEC
1055c41bd251SIgnat Korchagin	def_bool y
10561f0d6efeSEric DeVolder
10571f0d6efeSEric DeVolderconfig ARCH_SELECTS_KEXEC
10581f0d6efeSEric DeVolder	def_bool y
10591f0d6efeSEric DeVolder	depends on KEXEC
10605f365c13SConor Dooley	select HOTPLUG_CPU if SMP
1061fba8a867SNick Kossifidis
10621f0d6efeSEric DeVolderconfig ARCH_SUPPORTS_KEXEC_FILE
1063c41bd251SIgnat Korchagin	def_bool 64BIT
1064fba8a867SNick Kossifidis
10651f0d6efeSEric DeVolderconfig ARCH_SELECTS_KEXEC_FILE
10661f0d6efeSEric DeVolder	def_bool y
10671f0d6efeSEric DeVolder	depends on KEXEC_FILE
10685f365c13SConor Dooley	select HAVE_IMA_KEXEC if IMA
10696261586eSLiao Chang	select KEXEC_ELF
10706261586eSLiao Chang
1071e6265fe7SEric DeVolderconfig ARCH_SUPPORTS_KEXEC_PURGATORY
1072c1ad12eeSArnd Bergmann	def_bool ARCH_SUPPORTS_KEXEC_FILE
1073736e30afSLi Zhengyu
10741f0d6efeSEric DeVolderconfig ARCH_SUPPORTS_CRASH_DUMP
10751f0d6efeSEric DeVolder	def_bool y
1076fba8a867SNick Kossifidis
107731daa343SDave Vasilevskyconfig ARCH_DEFAULT_CRASH_DUMP
107831daa343SDave Vasilevsky	def_bool y
107931daa343SDave Vasilevsky
108039365395SBaoquan Heconfig ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION
108185fcde40SBaoquan He	def_bool CRASH_RESERVE
108239365395SBaoquan He
10839be84592SGuo Renconfig COMPAT
10849be84592SGuo Ren	bool "Kernel support for 32-bit U-mode"
10859be84592SGuo Ren	default 64BIT
10869be84592SGuo Ren	depends on 64BIT && MMU
10879be84592SGuo Ren	help
10889be84592SGuo Ren	  This option enables support for a 32-bit U-mode running under a 64-bit
10899be84592SGuo Ren	  kernel at S-mode. riscv32-specific components such as system calls,
10909be84592SGuo Ren	  the user helper functions (vdso), signal rt_frame functions and the
10919be84592SGuo Ren	  ptrace interface are handled appropriately by the kernel.
10929be84592SGuo Ren
10939be84592SGuo Ren	  If you want to execute 32-bit userspace applications, say Y.
10949be84592SGuo Ren
1095fdf68accSAndrew Jonesconfig PARAVIRT
1096fdf68accSAndrew Jones	bool "Enable paravirtualization code"
1097fdf68accSAndrew Jones	depends on RISCV_SBI
1098fdf68accSAndrew Jones	help
1099fdf68accSAndrew Jones	  This changes the kernel so it can modify itself when it is run
1100fdf68accSAndrew Jones	  under a hypervisor, potentially improving performance significantly
1101fdf68accSAndrew Jones	  over full virtualization.
1102fdf68accSAndrew Jones
1103fdf68accSAndrew Jonesconfig PARAVIRT_TIME_ACCOUNTING
1104fdf68accSAndrew Jones	bool "Paravirtual steal time accounting"
1105fdf68accSAndrew Jones	depends on PARAVIRT
1106fdf68accSAndrew Jones	help
1107fdf68accSAndrew Jones	  Select this option to enable fine granularity task steal time
1108fdf68accSAndrew Jones	  accounting. Time spent executing other tasks in parallel with
1109fdf68accSAndrew Jones	  the current vCPU is discounted from the vCPU power. To account for
1110fdf68accSAndrew Jones	  that, there can be a small performance impact.
1111fdf68accSAndrew Jones
1112fdf68accSAndrew Jones	  If in doubt, say N here.
1113fdf68accSAndrew Jones
111439b33072SAlexandre Ghiticonfig RELOCATABLE
111539b33072SAlexandre Ghiti	bool "Build a relocatable kernel"
1116ea2bde36SSamuel Holland	depends on !XIP_KERNEL
11172aff5f95SQingfang Deng	select MODULE_SECTIONS if MODULES
11189b400d17SArd Biesheuvel	select ARCH_VMLINUX_NEEDS_RELOCS
111939b33072SAlexandre Ghiti	help
112039b33072SAlexandre Ghiti          This builds a kernel as a Position Independent Executable (PIE),
112139b33072SAlexandre Ghiti          which retains all relocation metadata required to relocate the
112239b33072SAlexandre Ghiti          kernel binary at runtime to a different virtual address than the
112339b33072SAlexandre Ghiti          address it was linked at.
112439b33072SAlexandre Ghiti          Since RISCV uses the RELA relocation format, this requires a
112539b33072SAlexandre Ghiti          relocation pass at runtime even if the kernel is loaded at the
112639b33072SAlexandre Ghiti          same address it was linked at.
112739b33072SAlexandre Ghiti
112839b33072SAlexandre Ghiti          If unsure, say N.
112939b33072SAlexandre Ghiti
113084fe419dSAlexandre Ghiticonfig RANDOMIZE_BASE
113184fe419dSAlexandre Ghiti        bool "Randomize the address of the kernel image"
113284fe419dSAlexandre Ghiti        select RELOCATABLE
113384fe419dSAlexandre Ghiti        depends on MMU && 64BIT && !XIP_KERNEL
113484fe419dSAlexandre Ghiti        help
113584fe419dSAlexandre Ghiti          Randomizes the virtual address at which the kernel image is
113684fe419dSAlexandre Ghiti          loaded, as a security feature that deters exploit attempts
113784fe419dSAlexandre Ghiti          relying on knowledge of the location of kernel internals.
113884fe419dSAlexandre Ghiti
113984fe419dSAlexandre Ghiti          It is the bootloader's job to provide entropy, by passing a
114084fe419dSAlexandre Ghiti          random u64 value in /chosen/kaslr-seed at kernel entry.
114184fe419dSAlexandre Ghiti
114284fe419dSAlexandre Ghiti          When booting via the UEFI stub, it will invoke the firmware's
114384fe419dSAlexandre Ghiti          EFI_RNG_PROTOCOL implementation (if available) to supply entropy
114484fe419dSAlexandre Ghiti          to the kernel proper. In addition, it will randomise the physical
114584fe419dSAlexandre Ghiti          location of the kernel Image as well.
114684fe419dSAlexandre Ghiti
114784fe419dSAlexandre Ghiti          If unsure, say N.
114884fe419dSAlexandre Ghiti
11492f66a3d0SJuerg Haefligerendmenu # "Kernel features"
1150fbe934d6SPalmer Dabbelt
1151aef53f97SNick Kossifidismenu "Boot options"
1152aef53f97SNick Kossifidis
1153aef53f97SNick Kossifidisconfig CMDLINE
11543aed8c43SNick Kossifidis	string "Built-in kernel command line"
1155aef53f97SNick Kossifidis	help
11563aed8c43SNick Kossifidis	  For most platforms, the arguments for the kernel's command line
11573aed8c43SNick Kossifidis	  are provided at run-time, during boot. However, there are cases
11583aed8c43SNick Kossifidis	  where either no arguments are being provided or the provided
11593aed8c43SNick Kossifidis	  arguments are insufficient or even invalid.
11603aed8c43SNick Kossifidis
11613aed8c43SNick Kossifidis	  When that occurs, it is possible to define a built-in command
11623aed8c43SNick Kossifidis	  line here and choose how the kernel should use it later on.
11633aed8c43SNick Kossifidis
11643aed8c43SNick Kossifidischoice
1165b9d73218SMasahiro Yamada	prompt "Built-in command line usage"
1166b9d73218SMasahiro Yamada	depends on CMDLINE != ""
11673aed8c43SNick Kossifidis	default CMDLINE_FALLBACK
11683aed8c43SNick Kossifidis	help
11693aed8c43SNick Kossifidis	  Choose how the kernel will handle the provided built-in command
11703aed8c43SNick Kossifidis	  line.
11713aed8c43SNick Kossifidis
11723aed8c43SNick Kossifidisconfig CMDLINE_FALLBACK
11733aed8c43SNick Kossifidis	bool "Use bootloader kernel arguments if available"
11743aed8c43SNick Kossifidis	help
11753aed8c43SNick Kossifidis	  Use the built-in command line as fallback in case we get nothing
11763aed8c43SNick Kossifidis	  during boot. This is the default behaviour.
11773aed8c43SNick Kossifidis
11783aed8c43SNick Kossifidisconfig CMDLINE_EXTEND
11793aed8c43SNick Kossifidis	bool "Extend bootloader kernel arguments"
11803aed8c43SNick Kossifidis	help
118148d9aabfS谢致邦 (XIE Zhibang)	  The built-in command line will be appended to the command-
118248d9aabfS谢致邦 (XIE Zhibang)	  line arguments provided during boot. This is useful in
11833aed8c43SNick Kossifidis	  cases where the provided arguments are insufficient and
11843aed8c43SNick Kossifidis	  you don't want to or cannot modify them.
11853aed8c43SNick Kossifidis
1186aef53f97SNick Kossifidisconfig CMDLINE_FORCE
11873aed8c43SNick Kossifidis	bool "Always use the default kernel command string"
1188aef53f97SNick Kossifidis	help
11893aed8c43SNick Kossifidis	  Always use the built-in command line, even if we get one during
11903aed8c43SNick Kossifidis	  boot. This is useful in case you need to override the provided
11913aed8c43SNick Kossifidis	  command line on systems where you don't have or want control
11923aed8c43SNick Kossifidis	  over it.
1193aef53f97SNick Kossifidis
11943aed8c43SNick Kossifidisendchoice
1195aef53f97SNick Kossifidis
1196d7071743SAtish Patraconfig EFI_STUB
1197d7071743SAtish Patra	bool
1198d7071743SAtish Patra
1199d7071743SAtish Patraconfig EFI
1200d7071743SAtish Patra	bool "UEFI runtime support"
120144c92257SVitaly Wool	depends on OF && !XIP_KERNEL
1202b91540d5SAtish Patra	depends on MMU
1203d7071743SAtish Patra	default y
1204a91a9ffbSSunil V L	select ARCH_SUPPORTS_ACPI if 64BIT
12055f365c13SConor Dooley	select EFI_GENERIC_STUB
12065f365c13SConor Dooley	select EFI_PARAMS_FROM_FDT
12075f365c13SConor Dooley	select EFI_RUNTIME_WRAPPERS
12085f365c13SConor Dooley	select EFI_STUB
12095f365c13SConor Dooley	select LIBFDT
12105f365c13SConor Dooley	select RISCV_ISA_C
12115f365c13SConor Dooley	select UCS2_STRING
1212d7071743SAtish Patra	help
1213d7071743SAtish Patra	  This option provides support for runtime services provided
1214d7071743SAtish Patra	  by UEFI firmware (such as non-volatile variables, realtime
1215d7071743SAtish Patra	  clock, and platform reset). A UEFI stub is also provided to
1216d7071743SAtish Patra	  allow the kernel to be booted as an EFI application. This
1217d7071743SAtish Patra	  is only useful on systems that have UEFI firmware.
1218d7071743SAtish Patra
1219d6ecd188SHaibo Xuconfig DMI
1220d6ecd188SHaibo Xu	bool "Enable support for SMBIOS (DMI) tables"
1221d6ecd188SHaibo Xu	depends on EFI
1222d6ecd188SHaibo Xu	default y
1223d6ecd188SHaibo Xu	help
1224d6ecd188SHaibo Xu	  This enables SMBIOS/DMI feature for systems.
1225d6ecd188SHaibo Xu
1226d6ecd188SHaibo Xu	  This option is only useful on systems that have UEFI firmware.
1227d6ecd188SHaibo Xu	  However, even with this option, the resultant kernel should
1228d6ecd188SHaibo Xu	  continue to boot on existing non-UEFI platforms.
1229d6ecd188SHaibo Xu
1230fea2fed2SGuo Renconfig CC_HAVE_STACKPROTECTOR_TLS
1231fea2fed2SGuo Ren	def_bool $(cc-option,-mstack-protector-guard=tls -mstack-protector-guard-reg=tp -mstack-protector-guard-offset=0)
1232fea2fed2SGuo Ren
1233fea2fed2SGuo Renconfig STACKPROTECTOR_PER_TASK
1234fea2fed2SGuo Ren	def_bool y
1235595b893eSKees Cook	depends on !RANDSTRUCT
1236fea2fed2SGuo Ren	depends on STACKPROTECTOR && CC_HAVE_STACKPROTECTOR_TLS
1237fea2fed2SGuo Ren
1238867432beSAlexandre Ghiticonfig PHYS_RAM_BASE_FIXED
1239867432beSAlexandre Ghiti	bool "Explicitly specified physical RAM address"
124044c1e84aSPalmer Dabbelt	depends on NONPORTABLE
1241867432beSAlexandre Ghiti	default n
1242867432beSAlexandre Ghiti
124344c92257SVitaly Woolconfig PHYS_RAM_BASE
124444c92257SVitaly Wool	hex "Platform Physical RAM address"
1245867432beSAlexandre Ghiti	depends on PHYS_RAM_BASE_FIXED
124644c92257SVitaly Wool	default "0x80000000"
124744c92257SVitaly Wool	help
124844c92257SVitaly Wool	  This is the physical address of RAM in the system. It has to be
124944c92257SVitaly Wool	  explicitly specified to run early relocations of read-write data
125044c92257SVitaly Wool	  from flash to RAM.
125144c92257SVitaly Wool
125244c92257SVitaly Woolconfig XIP_KERNEL
125344c92257SVitaly Wool	bool "Kernel Execute-In-Place from ROM"
125444c1e84aSPalmer Dabbelt	depends on MMU && SPARSEMEM && NONPORTABLE
125544c92257SVitaly Wool	# This prevents XIP from being enabled by all{yes,mod}config, which
125644c92257SVitaly Wool	# fail to build since XIP doesn't support large kernels.
125744c92257SVitaly Wool	depends on !COMPILE_TEST
1258867432beSAlexandre Ghiti	select PHYS_RAM_BASE_FIXED
125944c92257SVitaly Wool	help
126044c92257SVitaly Wool	  Execute-In-Place allows the kernel to run from non-volatile storage
126144c92257SVitaly Wool	  directly addressable by the CPU, such as NOR flash. This saves RAM
126244c92257SVitaly Wool	  space since the text section of the kernel is not loaded from flash
126344c92257SVitaly Wool	  to RAM.  Read-write sections, such as the data section and stack,
126444c92257SVitaly Wool	  are still copied to RAM.  The XIP kernel is not compressed since
126544c92257SVitaly Wool	  it has to run directly from flash, so it will take more space to
126644c92257SVitaly Wool	  store it.  The flash address used to link the kernel object files,
126744c92257SVitaly Wool	  and for storing it, is configuration dependent. Therefore, if you
126844c92257SVitaly Wool	  say Y here, you must know the proper physical address where to
126944c92257SVitaly Wool	  store the kernel image depending on your own flash memory usage.
127044c92257SVitaly Wool
127144c92257SVitaly Wool	  Also note that the make target becomes "make xipImage" rather than
127244c92257SVitaly Wool	  "make zImage" or "make Image".  The final kernel binary to put in
127344c92257SVitaly Wool	  ROM memory will be arch/riscv/boot/xipImage.
127444c92257SVitaly Wool
127544c92257SVitaly Wool	  SPARSEMEM is required because the kernel text and rodata that are
127644c92257SVitaly Wool	  flash resident are not backed by memmap, then any attempt to get
127744c92257SVitaly Wool	  a struct page on those regions will trigger a fault.
127844c92257SVitaly Wool
127944c92257SVitaly Wool	  If unsure, say N.
128044c92257SVitaly Wool
128144c92257SVitaly Woolconfig XIP_PHYS_ADDR
128244c92257SVitaly Wool	hex "XIP Kernel Physical Location"
128344c92257SVitaly Wool	depends on XIP_KERNEL
128444c92257SVitaly Wool	default "0x21000000"
128544c92257SVitaly Wool	help
128644c92257SVitaly Wool	  This is the physical address in your flash memory the kernel will
128744c92257SVitaly Wool	  be linked for and stored to.  This address is dependent on your
128844c92257SVitaly Wool	  own flash usage.
128944c92257SVitaly Wool
1290496ea826SConor Dooleyconfig RISCV_ISA_FALLBACK
1291496ea826SConor Dooley	bool "Permit falling back to parsing riscv,isa for extension support by default"
1292496ea826SConor Dooley	default y
1293496ea826SConor Dooley	help
1294496ea826SConor Dooley	  Parsing the "riscv,isa" devicetree property has been deprecated and
1295496ea826SConor Dooley	  replaced by a list of explicitly defined strings. For compatibility
1296496ea826SConor Dooley	  with existing platforms, the kernel will fall back to parsing the
1297496ea826SConor Dooley	  "riscv,isa" property if the replacements are not found.
1298496ea826SConor Dooley
1299496ea826SConor Dooley	  Selecting N here will result in a kernel that does not use the
1300496ea826SConor Dooley	  fallback, unless the commandline "riscv_isa_fallback" parameter is
1301496ea826SConor Dooley	  present.
1302496ea826SConor Dooley
1303496ea826SConor Dooley	  Please see the dt-binding, located at
1304496ea826SConor Dooley	  Documentation/devicetree/bindings/riscv/extensions.yaml for details
1305496ea826SConor Dooley	  on the replacement properties, "riscv,isa-base" and
1306496ea826SConor Dooley	  "riscv,isa-extensions".
1307496ea826SConor Dooley
13082d268251SPalmer Dabbeltconfig BUILTIN_DTB
13096c4a2f63SFrederik Haxel	bool "Built-in device tree"
131044c1e84aSPalmer Dabbelt	depends on OF && NONPORTABLE
131182e81b89SMasahiro Yamada	select GENERIC_BUILTIN_DTB
13122672031bSYangyu Chen	help
13132672031bSYangyu Chen	  Build a device tree into the Linux image.
13142672031bSYangyu Chen	  This option should be selected if no bootloader is being used.
13152672031bSYangyu Chen	  If unsure, say N.
13162672031bSYangyu Chen
13172672031bSYangyu Chen
131882e81b89SMasahiro Yamadaconfig BUILTIN_DTB_NAME
13192672031bSYangyu Chen	string "Built-in device tree source"
13202672031bSYangyu Chen	depends on BUILTIN_DTB
13212672031bSYangyu Chen	help
13222672031bSYangyu Chen	  DTS file path (without suffix, relative to arch/riscv/boot/dts)
13232672031bSYangyu Chen	  for the DTS file that will be used to produce the DTB linked into the
13242672031bSYangyu Chen	  kernel.
13252d268251SPalmer Dabbelt
13266c4a2f63SFrederik Haxelendmenu # "Boot options"
13276c4a2f63SFrederik Haxel
132844c1e84aSPalmer Dabbeltconfig PORTABLE
132944c1e84aSPalmer Dabbelt	bool
133044c1e84aSPalmer Dabbelt	default !NONPORTABLE
133144c1e84aSPalmer Dabbelt	select EFI
133244c1e84aSPalmer Dabbelt	select MMU
13335f365c13SConor Dooley	select OF
133444c1e84aSPalmer Dabbelt
1335e0c0a7c3SAndreas Schwabconfig ARCH_PROC_KCORE_TEXT
1336e0c0a7c3SAndreas Schwab	def_bool y
1337e0c0a7c3SAndreas Schwab
1338fbe934d6SPalmer Dabbeltmenu "Power management options"
1339fbe934d6SPalmer Dabbelt
13408636a1f9SMasahiro Yamadasource "kernel/power/Kconfig"
1341fbe934d6SPalmer Dabbelt
1342c0317210SSia Jee Hengconfig ARCH_HIBERNATION_POSSIBLE
1343e2d6b54bSConor Dooley	def_bool y
1344c0317210SSia Jee Heng
1345c0317210SSia Jee Hengconfig ARCH_HIBERNATION_HEADER
1346c0317210SSia Jee Heng	def_bool HIBERNATION
1347c0317210SSia Jee Heng
1348c1f048a6SSong Shuaiconfig ARCH_SUSPEND_POSSIBLE
1349c1f048a6SSong Shuai	def_bool y
1350c1f048a6SSong Shuai
13512f66a3d0SJuerg Haefligerendmenu # "Power management options"
1352d7071743SAtish Patra
1353f6e64b66SAnup Patelmenu "CPU Power Management"
1354f6e64b66SAnup Patel
1355f6e64b66SAnup Patelsource "drivers/cpuidle/Kconfig"
1356f6e64b66SAnup Patel
1357effae0e3SLad Prabhakarsource "drivers/cpufreq/Kconfig"
1358effae0e3SLad Prabhakar
13592f66a3d0SJuerg Haefligerendmenu # "CPU Power Management"
1360f6e64b66SAnup Patel
136199cdc6c1SAnup Patelsource "arch/riscv/kvm/Kconfig"
1362a91a9ffbSSunil V L
1363a91a9ffbSSunil V Lsource "drivers/acpi/Kconfig"
1364