162306a36Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0-only
262306a36Sopenharmony_ci#
362306a36Sopenharmony_ci# For a description of the syntax of this configuration file,
462306a36Sopenharmony_ci# see Documentation/kbuild/kconfig-language.rst.
562306a36Sopenharmony_ci#
662306a36Sopenharmony_ci
762306a36Sopenharmony_ciconfig 64BIT
862306a36Sopenharmony_ci	bool
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ciconfig 32BIT
1162306a36Sopenharmony_ci	bool
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ciconfig RISCV
1462306a36Sopenharmony_ci	def_bool y
1562306a36Sopenharmony_ci	select ACPI_GENERIC_GSI if ACPI
1662306a36Sopenharmony_ci	select ACPI_REDUCED_HARDWARE_ONLY if ACPI
1762306a36Sopenharmony_ci	select ARCH_DMA_DEFAULT_COHERENT
1862306a36Sopenharmony_ci	select ARCH_ENABLE_HUGEPAGE_MIGRATION if HUGETLB_PAGE && MIGRATION
1962306a36Sopenharmony_ci	select ARCH_ENABLE_SPLIT_PMD_PTLOCK if PGTABLE_LEVELS > 2
2062306a36Sopenharmony_ci	select ARCH_ENABLE_THP_MIGRATION if TRANSPARENT_HUGEPAGE
2162306a36Sopenharmony_ci	select ARCH_HAS_BINFMT_FLAT
2262306a36Sopenharmony_ci	select ARCH_HAS_CURRENT_STACK_POINTER
2362306a36Sopenharmony_ci	select ARCH_HAS_DEBUG_VIRTUAL if MMU
2462306a36Sopenharmony_ci	select ARCH_HAS_DEBUG_VM_PGTABLE
2562306a36Sopenharmony_ci	select ARCH_HAS_DEBUG_WX
2662306a36Sopenharmony_ci	select ARCH_HAS_FORTIFY_SOURCE
2762306a36Sopenharmony_ci	select ARCH_HAS_GCOV_PROFILE_ALL
2862306a36Sopenharmony_ci	select ARCH_HAS_GIGANTIC_PAGE
2962306a36Sopenharmony_ci	select ARCH_HAS_KCOV
3062306a36Sopenharmony_ci	select ARCH_HAS_MMIOWB
3162306a36Sopenharmony_ci	select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
3262306a36Sopenharmony_ci	select ARCH_HAS_PMEM_API
3362306a36Sopenharmony_ci	select ARCH_HAS_PTE_SPECIAL
3462306a36Sopenharmony_ci	select ARCH_HAS_SET_DIRECT_MAP if MMU
3562306a36Sopenharmony_ci	select ARCH_HAS_SET_MEMORY if MMU
3662306a36Sopenharmony_ci	select ARCH_HAS_STRICT_KERNEL_RWX if MMU && !XIP_KERNEL
3762306a36Sopenharmony_ci	select ARCH_HAS_STRICT_MODULE_RWX if MMU && !XIP_KERNEL
3862306a36Sopenharmony_ci	select ARCH_HAS_SYSCALL_WRAPPER
3962306a36Sopenharmony_ci	select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
4062306a36Sopenharmony_ci	select ARCH_HAS_UBSAN_SANITIZE_ALL
4162306a36Sopenharmony_ci	select ARCH_HAS_VDSO_DATA
4262306a36Sopenharmony_ci	select ARCH_OPTIONAL_KERNEL_RWX if ARCH_HAS_STRICT_KERNEL_RWX
4362306a36Sopenharmony_ci	select ARCH_OPTIONAL_KERNEL_RWX_DEFAULT
4462306a36Sopenharmony_ci	select ARCH_STACKWALK
4562306a36Sopenharmony_ci	select ARCH_SUPPORTS_ATOMIC_RMW
4662306a36Sopenharmony_ci	select ARCH_SUPPORTS_CFI_CLANG
4762306a36Sopenharmony_ci	select ARCH_SUPPORTS_DEBUG_PAGEALLOC if MMU
4862306a36Sopenharmony_ci	select ARCH_SUPPORTS_HUGETLBFS if MMU
4962306a36Sopenharmony_ci	select ARCH_SUPPORTS_PAGE_TABLE_CHECK if MMU
5062306a36Sopenharmony_ci	select ARCH_SUPPORTS_PER_VMA_LOCK if MMU
5162306a36Sopenharmony_ci	select ARCH_USE_MEMTEST
5262306a36Sopenharmony_ci	select ARCH_USE_QUEUED_RWLOCKS
5362306a36Sopenharmony_ci	select ARCH_USES_CFI_TRAPS if CFI_CLANG
5462306a36Sopenharmony_ci	select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU
5562306a36Sopenharmony_ci	select ARCH_WANT_FRAME_POINTERS
5662306a36Sopenharmony_ci	select ARCH_WANT_GENERAL_HUGETLB if !RISCV_ISA_SVNAPOT
5762306a36Sopenharmony_ci	select ARCH_WANT_HUGE_PMD_SHARE if 64BIT
5862306a36Sopenharmony_ci	select ARCH_WANT_LD_ORPHAN_WARN if !XIP_KERNEL
5962306a36Sopenharmony_ci	select ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP
6062306a36Sopenharmony_ci	select ARCH_WANTS_THP_SWAP if HAVE_ARCH_TRANSPARENT_HUGEPAGE
6162306a36Sopenharmony_ci	select BINFMT_FLAT_NO_DATA_START_OFFSET if !MMU
6262306a36Sopenharmony_ci	select BUILDTIME_TABLE_SORT if MMU
6362306a36Sopenharmony_ci	select CLINT_TIMER if !MMU
6462306a36Sopenharmony_ci	select CLONE_BACKWARDS
6562306a36Sopenharmony_ci	select COMMON_CLK
6662306a36Sopenharmony_ci	select CPU_PM if CPU_IDLE || HIBERNATION
6762306a36Sopenharmony_ci	select EDAC_SUPPORT
6862306a36Sopenharmony_ci	select FRAME_POINTER if PERF_EVENTS || (FUNCTION_TRACER && !DYNAMIC_FTRACE)
6962306a36Sopenharmony_ci	select GENERIC_ARCH_TOPOLOGY
7062306a36Sopenharmony_ci	select GENERIC_ATOMIC64 if !64BIT
7162306a36Sopenharmony_ci	select GENERIC_CLOCKEVENTS_BROADCAST if SMP
7262306a36Sopenharmony_ci	select GENERIC_EARLY_IOREMAP
7362306a36Sopenharmony_ci	select GENERIC_ENTRY
7462306a36Sopenharmony_ci	select GENERIC_GETTIMEOFDAY if HAVE_GENERIC_VDSO
7562306a36Sopenharmony_ci	select GENERIC_IDLE_POLL_SETUP
7662306a36Sopenharmony_ci	select GENERIC_IOREMAP if MMU
7762306a36Sopenharmony_ci	select GENERIC_IRQ_IPI if SMP
7862306a36Sopenharmony_ci	select GENERIC_IRQ_IPI_MUX if SMP
7962306a36Sopenharmony_ci	select GENERIC_IRQ_MULTI_HANDLER
8062306a36Sopenharmony_ci	select GENERIC_IRQ_SHOW
8162306a36Sopenharmony_ci	select GENERIC_IRQ_SHOW_LEVEL
8262306a36Sopenharmony_ci	select GENERIC_LIB_DEVMEM_IS_ALLOWED
8362306a36Sopenharmony_ci	select GENERIC_PCI_IOMAP
8462306a36Sopenharmony_ci	select GENERIC_PTDUMP if MMU
8562306a36Sopenharmony_ci	select GENERIC_SCHED_CLOCK
8662306a36Sopenharmony_ci	select GENERIC_SMP_IDLE_THREAD
8762306a36Sopenharmony_ci	select GENERIC_TIME_VSYSCALL if MMU && 64BIT
8862306a36Sopenharmony_ci	select GENERIC_VDSO_TIME_NS if HAVE_GENERIC_VDSO
8962306a36Sopenharmony_ci	select HARDIRQS_SW_RESEND
9062306a36Sopenharmony_ci	select HAS_IOPORT if MMU
9162306a36Sopenharmony_ci	select HAVE_ARCH_AUDITSYSCALL
9262306a36Sopenharmony_ci	select HAVE_ARCH_HUGE_VMALLOC if HAVE_ARCH_HUGE_VMAP
9362306a36Sopenharmony_ci	select HAVE_ARCH_HUGE_VMAP if MMU && 64BIT && !XIP_KERNEL
9462306a36Sopenharmony_ci	select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL
9562306a36Sopenharmony_ci	select HAVE_ARCH_JUMP_LABEL_RELATIVE if !XIP_KERNEL
9662306a36Sopenharmony_ci	select HAVE_ARCH_KASAN if MMU && 64BIT
9762306a36Sopenharmony_ci	select HAVE_ARCH_KASAN_VMALLOC if MMU && 64BIT
9862306a36Sopenharmony_ci	select HAVE_ARCH_KFENCE if MMU && 64BIT
9962306a36Sopenharmony_ci	select HAVE_ARCH_KGDB if !XIP_KERNEL
10062306a36Sopenharmony_ci	select HAVE_ARCH_KGDB_QXFER_PKT
10162306a36Sopenharmony_ci	select HAVE_ARCH_MMAP_RND_BITS if MMU
10262306a36Sopenharmony_ci	select HAVE_ARCH_MMAP_RND_COMPAT_BITS if COMPAT
10362306a36Sopenharmony_ci	select HAVE_ARCH_SECCOMP_FILTER
10462306a36Sopenharmony_ci	select HAVE_ARCH_THREAD_STRUCT_WHITELIST
10562306a36Sopenharmony_ci	select HAVE_ARCH_TRACEHOOK
10662306a36Sopenharmony_ci	select HAVE_ARCH_TRANSPARENT_HUGEPAGE if 64BIT && MMU
10762306a36Sopenharmony_ci	select HAVE_ARCH_USERFAULTFD_MINOR if 64BIT && USERFAULTFD
10862306a36Sopenharmony_ci	select HAVE_ARCH_VMAP_STACK if MMU && 64BIT
10962306a36Sopenharmony_ci	select HAVE_ASM_MODVERSIONS
11062306a36Sopenharmony_ci	select HAVE_CONTEXT_TRACKING_USER
11162306a36Sopenharmony_ci	select HAVE_DEBUG_KMEMLEAK
11262306a36Sopenharmony_ci	select HAVE_DMA_CONTIGUOUS if MMU
11362306a36Sopenharmony_ci	select HAVE_DYNAMIC_FTRACE if !XIP_KERNEL && MMU && (CLANG_SUPPORTS_DYNAMIC_FTRACE || GCC_SUPPORTS_DYNAMIC_FTRACE)
11462306a36Sopenharmony_ci	select HAVE_DYNAMIC_FTRACE_WITH_REGS if HAVE_DYNAMIC_FTRACE
11562306a36Sopenharmony_ci	select HAVE_FTRACE_MCOUNT_RECORD if !XIP_KERNEL
11662306a36Sopenharmony_ci	select HAVE_FUNCTION_GRAPH_TRACER
11762306a36Sopenharmony_ci	select HAVE_FUNCTION_GRAPH_RETVAL if HAVE_FUNCTION_GRAPH_TRACER
11862306a36Sopenharmony_ci	select HAVE_FUNCTION_TRACER if !XIP_KERNEL && !PREEMPTION
11962306a36Sopenharmony_ci	select HAVE_EBPF_JIT if MMU
12062306a36Sopenharmony_ci	select HAVE_FUNCTION_ARG_ACCESS_API
12162306a36Sopenharmony_ci	select HAVE_FUNCTION_ERROR_INJECTION
12262306a36Sopenharmony_ci	select HAVE_GCC_PLUGINS
12362306a36Sopenharmony_ci	select HAVE_GENERIC_VDSO if MMU && 64BIT
12462306a36Sopenharmony_ci	select HAVE_IRQ_TIME_ACCOUNTING
12562306a36Sopenharmony_ci	select HAVE_KPROBES if !XIP_KERNEL
12662306a36Sopenharmony_ci	select HAVE_KPROBES_ON_FTRACE if !XIP_KERNEL
12762306a36Sopenharmony_ci	select HAVE_KRETPROBES if !XIP_KERNEL
12862306a36Sopenharmony_ci	# https://github.com/ClangBuiltLinux/linux/issues/1881
12962306a36Sopenharmony_ci	select HAVE_LD_DEAD_CODE_DATA_ELIMINATION if !LD_IS_LLD
13062306a36Sopenharmony_ci	select HAVE_MOVE_PMD
13162306a36Sopenharmony_ci	select HAVE_MOVE_PUD
13262306a36Sopenharmony_ci	select HAVE_PCI
13362306a36Sopenharmony_ci	select HAVE_PERF_EVENTS
13462306a36Sopenharmony_ci	select HAVE_PERF_REGS
13562306a36Sopenharmony_ci	select HAVE_PERF_USER_STACK_DUMP
13662306a36Sopenharmony_ci	select HAVE_POSIX_CPU_TIMERS_TASK_WORK
13762306a36Sopenharmony_ci	select HAVE_PREEMPT_DYNAMIC_KEY if !XIP_KERNEL
13862306a36Sopenharmony_ci	select HAVE_REGS_AND_STACK_ACCESS_API
13962306a36Sopenharmony_ci	select HAVE_RETHOOK if !XIP_KERNEL
14062306a36Sopenharmony_ci	select HAVE_RSEQ
14162306a36Sopenharmony_ci	select HAVE_STACKPROTECTOR
14262306a36Sopenharmony_ci	select HAVE_SYSCALL_TRACEPOINTS
14362306a36Sopenharmony_ci	select HOTPLUG_CORE_SYNC_DEAD if HOTPLUG_CPU
14462306a36Sopenharmony_ci	select IRQ_DOMAIN
14562306a36Sopenharmony_ci	select IRQ_FORCED_THREADING
14662306a36Sopenharmony_ci	select KASAN_VMALLOC if KASAN
14762306a36Sopenharmony_ci	select LOCK_MM_AND_FIND_VMA
14862306a36Sopenharmony_ci	select MODULES_USE_ELF_RELA if MODULES
14962306a36Sopenharmony_ci	select MODULE_SECTIONS if MODULES
15062306a36Sopenharmony_ci	select OF
15162306a36Sopenharmony_ci	select OF_EARLY_FLATTREE
15262306a36Sopenharmony_ci	select OF_IRQ
15362306a36Sopenharmony_ci	select PCI_DOMAINS_GENERIC if PCI
15462306a36Sopenharmony_ci	select PCI_MSI if PCI
15562306a36Sopenharmony_ci	select RISCV_ALTERNATIVE if !XIP_KERNEL
15662306a36Sopenharmony_ci	select RISCV_INTC
15762306a36Sopenharmony_ci	select RISCV_TIMER if RISCV_SBI
15862306a36Sopenharmony_ci	select SIFIVE_PLIC
15962306a36Sopenharmony_ci	select SPARSE_IRQ
16062306a36Sopenharmony_ci	select SYSCTL_EXCEPTION_TRACE
16162306a36Sopenharmony_ci	select THREAD_INFO_IN_TASK
16262306a36Sopenharmony_ci	select TRACE_IRQFLAGS_SUPPORT
16362306a36Sopenharmony_ci	select UACCESS_MEMCPY if !MMU
16462306a36Sopenharmony_ci	select ZONE_DMA32 if 64BIT
16562306a36Sopenharmony_ci
16662306a36Sopenharmony_ciconfig CLANG_SUPPORTS_DYNAMIC_FTRACE
16762306a36Sopenharmony_ci	def_bool CC_IS_CLANG
16862306a36Sopenharmony_ci	# https://github.com/llvm/llvm-project/commit/6ab8927931851bb42b2c93a00801dc499d7d9b1e
16962306a36Sopenharmony_ci	depends on CLANG_VERSION >= 130000
17062306a36Sopenharmony_ci	# https://github.com/ClangBuiltLinux/linux/issues/1817
17162306a36Sopenharmony_ci	depends on AS_IS_GNU || (AS_IS_LLVM && (LD_IS_LLD || LD_VERSION >= 23600))
17262306a36Sopenharmony_ci
17362306a36Sopenharmony_ciconfig GCC_SUPPORTS_DYNAMIC_FTRACE
17462306a36Sopenharmony_ci	def_bool CC_IS_GCC
17562306a36Sopenharmony_ci	depends on $(cc-option,-fpatchable-function-entry=8)
17662306a36Sopenharmony_ci
17762306a36Sopenharmony_ciconfig ARCH_MMAP_RND_BITS_MIN
17862306a36Sopenharmony_ci	default 18 if 64BIT
17962306a36Sopenharmony_ci	default 8
18062306a36Sopenharmony_ci
18162306a36Sopenharmony_ciconfig ARCH_MMAP_RND_COMPAT_BITS_MIN
18262306a36Sopenharmony_ci	default 8
18362306a36Sopenharmony_ci
18462306a36Sopenharmony_ci# max bits determined by the following formula:
18562306a36Sopenharmony_ci#  VA_BITS - PAGE_SHIFT - 3
18662306a36Sopenharmony_ciconfig ARCH_MMAP_RND_BITS_MAX
18762306a36Sopenharmony_ci	default 24 if 64BIT # SV39 based
18862306a36Sopenharmony_ci	default 17
18962306a36Sopenharmony_ci
19062306a36Sopenharmony_ciconfig ARCH_MMAP_RND_COMPAT_BITS_MAX
19162306a36Sopenharmony_ci	default 17
19262306a36Sopenharmony_ci
19362306a36Sopenharmony_ci# set if we run in machine mode, cleared if we run in supervisor mode
19462306a36Sopenharmony_ciconfig RISCV_M_MODE
19562306a36Sopenharmony_ci	bool
19662306a36Sopenharmony_ci	default !MMU
19762306a36Sopenharmony_ci
19862306a36Sopenharmony_ci# set if we are running in S-mode and can use SBI calls
19962306a36Sopenharmony_ciconfig RISCV_SBI
20062306a36Sopenharmony_ci	bool
20162306a36Sopenharmony_ci	depends on !RISCV_M_MODE
20262306a36Sopenharmony_ci	default y
20362306a36Sopenharmony_ci
20462306a36Sopenharmony_ciconfig MMU
20562306a36Sopenharmony_ci	bool "MMU-based Paged Memory Management Support"
20662306a36Sopenharmony_ci	default y
20762306a36Sopenharmony_ci	help
20862306a36Sopenharmony_ci	  Select if you want MMU-based virtualised addressing space
20962306a36Sopenharmony_ci	  support by paged memory management. If unsure, say 'Y'.
21062306a36Sopenharmony_ci
21162306a36Sopenharmony_ciconfig PAGE_OFFSET
21262306a36Sopenharmony_ci	hex
21362306a36Sopenharmony_ci	default 0xC0000000 if 32BIT && MMU
21462306a36Sopenharmony_ci	default 0x80000000 if !MMU
21562306a36Sopenharmony_ci	default 0xff60000000000000 if 64BIT
21662306a36Sopenharmony_ci
21762306a36Sopenharmony_ciconfig KASAN_SHADOW_OFFSET
21862306a36Sopenharmony_ci	hex
21962306a36Sopenharmony_ci	depends on KASAN_GENERIC
22062306a36Sopenharmony_ci	default 0xdfffffff00000000 if 64BIT
22162306a36Sopenharmony_ci	default 0xffffffff if 32BIT
22262306a36Sopenharmony_ci
22362306a36Sopenharmony_ciconfig ARCH_FLATMEM_ENABLE
22462306a36Sopenharmony_ci	def_bool !NUMA
22562306a36Sopenharmony_ci
22662306a36Sopenharmony_ciconfig ARCH_SPARSEMEM_ENABLE
22762306a36Sopenharmony_ci	def_bool y
22862306a36Sopenharmony_ci	depends on MMU
22962306a36Sopenharmony_ci	select SPARSEMEM_STATIC if 32BIT && SPARSEMEM
23062306a36Sopenharmony_ci	select SPARSEMEM_VMEMMAP_ENABLE if 64BIT
23162306a36Sopenharmony_ci
23262306a36Sopenharmony_ciconfig ARCH_SELECT_MEMORY_MODEL
23362306a36Sopenharmony_ci	def_bool ARCH_SPARSEMEM_ENABLE
23462306a36Sopenharmony_ci
23562306a36Sopenharmony_ciconfig ARCH_SUPPORTS_UPROBES
23662306a36Sopenharmony_ci	def_bool y
23762306a36Sopenharmony_ci
23862306a36Sopenharmony_ciconfig STACKTRACE_SUPPORT
23962306a36Sopenharmony_ci	def_bool y
24062306a36Sopenharmony_ci
24162306a36Sopenharmony_ciconfig GENERIC_BUG
24262306a36Sopenharmony_ci	def_bool y
24362306a36Sopenharmony_ci	depends on BUG
24462306a36Sopenharmony_ci	select GENERIC_BUG_RELATIVE_POINTERS if 64BIT
24562306a36Sopenharmony_ci
24662306a36Sopenharmony_ciconfig GENERIC_BUG_RELATIVE_POINTERS
24762306a36Sopenharmony_ci	bool
24862306a36Sopenharmony_ci
24962306a36Sopenharmony_ciconfig GENERIC_CALIBRATE_DELAY
25062306a36Sopenharmony_ci	def_bool y
25162306a36Sopenharmony_ci
25262306a36Sopenharmony_ciconfig GENERIC_CSUM
25362306a36Sopenharmony_ci	def_bool y
25462306a36Sopenharmony_ci
25562306a36Sopenharmony_ciconfig GENERIC_HWEIGHT
25662306a36Sopenharmony_ci	def_bool y
25762306a36Sopenharmony_ci
25862306a36Sopenharmony_ciconfig FIX_EARLYCON_MEM
25962306a36Sopenharmony_ci	def_bool MMU
26062306a36Sopenharmony_ci
26162306a36Sopenharmony_ciconfig PGTABLE_LEVELS
26262306a36Sopenharmony_ci	int
26362306a36Sopenharmony_ci	default 5 if 64BIT
26462306a36Sopenharmony_ci	default 2
26562306a36Sopenharmony_ci
26662306a36Sopenharmony_ciconfig LOCKDEP_SUPPORT
26762306a36Sopenharmony_ci	def_bool y
26862306a36Sopenharmony_ci
26962306a36Sopenharmony_ciconfig RISCV_DMA_NONCOHERENT
27062306a36Sopenharmony_ci	bool
27162306a36Sopenharmony_ci	select ARCH_HAS_DMA_PREP_COHERENT
27262306a36Sopenharmony_ci	select ARCH_HAS_SETUP_DMA_OPS
27362306a36Sopenharmony_ci	select ARCH_HAS_SYNC_DMA_FOR_CPU
27462306a36Sopenharmony_ci	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
27562306a36Sopenharmony_ci	select DMA_BOUNCE_UNALIGNED_KMALLOC if SWIOTLB
27662306a36Sopenharmony_ci
27762306a36Sopenharmony_ciconfig RISCV_NONSTANDARD_CACHE_OPS
27862306a36Sopenharmony_ci	bool
27962306a36Sopenharmony_ci	help
28062306a36Sopenharmony_ci	  This enables function pointer support for non-standard noncoherent
28162306a36Sopenharmony_ci	  systems to handle cache management.
28262306a36Sopenharmony_ci
28362306a36Sopenharmony_ciconfig AS_HAS_INSN
28462306a36Sopenharmony_ci	def_bool $(as-instr,.insn r 51$(comma) 0$(comma) 0$(comma) t0$(comma) t0$(comma) zero)
28562306a36Sopenharmony_ci
28662306a36Sopenharmony_ciconfig AS_HAS_OPTION_ARCH
28762306a36Sopenharmony_ci	# https://reviews.llvm.org/D123515
28862306a36Sopenharmony_ci	def_bool y
28962306a36Sopenharmony_ci	depends on $(as-instr, .option arch$(comma) +m)
29062306a36Sopenharmony_ci
29162306a36Sopenharmony_cisource "arch/riscv/Kconfig.socs"
29262306a36Sopenharmony_cisource "arch/riscv/Kconfig.errata"
29362306a36Sopenharmony_ci
29462306a36Sopenharmony_cimenu "Platform type"
29562306a36Sopenharmony_ci
29662306a36Sopenharmony_ciconfig NONPORTABLE
29762306a36Sopenharmony_ci	bool "Allow configurations that result in non-portable kernels"
29862306a36Sopenharmony_ci	help
29962306a36Sopenharmony_ci	  RISC-V kernel binaries are compatible between all known systems
30062306a36Sopenharmony_ci	  whenever possible, but there are some use cases that can only be
30162306a36Sopenharmony_ci	  satisfied by configurations that result in kernel binaries that are
30262306a36Sopenharmony_ci	  not portable between systems.
30362306a36Sopenharmony_ci
30462306a36Sopenharmony_ci	  Selecting N does not guarantee kernels will be portable to all known
30562306a36Sopenharmony_ci	  systems.  Selecting any of the options guarded by NONPORTABLE will
30662306a36Sopenharmony_ci	  result in kernel binaries that are unlikely to be portable between
30762306a36Sopenharmony_ci	  systems.
30862306a36Sopenharmony_ci
30962306a36Sopenharmony_ci	  If unsure, say N.
31062306a36Sopenharmony_ci
31162306a36Sopenharmony_cichoice
31262306a36Sopenharmony_ci	prompt "Base ISA"
31362306a36Sopenharmony_ci	default ARCH_RV64I
31462306a36Sopenharmony_ci	help
31562306a36Sopenharmony_ci	  This selects the base ISA that this kernel will target and must match
31662306a36Sopenharmony_ci	  the target platform.
31762306a36Sopenharmony_ci
31862306a36Sopenharmony_ciconfig ARCH_RV32I
31962306a36Sopenharmony_ci	bool "RV32I"
32062306a36Sopenharmony_ci	depends on NONPORTABLE
32162306a36Sopenharmony_ci	select 32BIT
32262306a36Sopenharmony_ci	select GENERIC_LIB_ASHLDI3
32362306a36Sopenharmony_ci	select GENERIC_LIB_ASHRDI3
32462306a36Sopenharmony_ci	select GENERIC_LIB_LSHRDI3
32562306a36Sopenharmony_ci	select GENERIC_LIB_UCMPDI2
32662306a36Sopenharmony_ci
32762306a36Sopenharmony_ciconfig ARCH_RV64I
32862306a36Sopenharmony_ci	bool "RV64I"
32962306a36Sopenharmony_ci	select 64BIT
33062306a36Sopenharmony_ci	select ARCH_SUPPORTS_INT128 if CC_HAS_INT128
33162306a36Sopenharmony_ci	select SWIOTLB if MMU
33262306a36Sopenharmony_ci
33362306a36Sopenharmony_ciendchoice
33462306a36Sopenharmony_ci
33562306a36Sopenharmony_ci# We must be able to map all physical memory into the kernel, but the compiler
33662306a36Sopenharmony_ci# is still a bit more efficient when generating code if it's setup in a manner
33762306a36Sopenharmony_ci# such that it can only map 2GiB of memory.
33862306a36Sopenharmony_cichoice
33962306a36Sopenharmony_ci	prompt "Kernel Code Model"
34062306a36Sopenharmony_ci	default CMODEL_MEDLOW if 32BIT
34162306a36Sopenharmony_ci	default CMODEL_MEDANY if 64BIT
34262306a36Sopenharmony_ci
34362306a36Sopenharmony_ci	config CMODEL_MEDLOW
34462306a36Sopenharmony_ci		bool "medium low code model"
34562306a36Sopenharmony_ci	config CMODEL_MEDANY
34662306a36Sopenharmony_ci		bool "medium any code model"
34762306a36Sopenharmony_ciendchoice
34862306a36Sopenharmony_ci
34962306a36Sopenharmony_ciconfig MODULE_SECTIONS
35062306a36Sopenharmony_ci	bool
35162306a36Sopenharmony_ci	select HAVE_MOD_ARCH_SPECIFIC
35262306a36Sopenharmony_ci
35362306a36Sopenharmony_ciconfig SMP
35462306a36Sopenharmony_ci	bool "Symmetric Multi-Processing"
35562306a36Sopenharmony_ci	help
35662306a36Sopenharmony_ci	  This enables support for systems with more than one CPU.  If
35762306a36Sopenharmony_ci	  you say N here, the kernel will run on single and
35862306a36Sopenharmony_ci	  multiprocessor machines, but will use only one CPU of a
35962306a36Sopenharmony_ci	  multiprocessor machine. If you say Y here, the kernel will run
36062306a36Sopenharmony_ci	  on many, but not all, single processor machines. On a single
36162306a36Sopenharmony_ci	  processor machine, the kernel will run faster if you say N
36262306a36Sopenharmony_ci	  here.
36362306a36Sopenharmony_ci
36462306a36Sopenharmony_ci	  If you don't know what to do here, say N.
36562306a36Sopenharmony_ci
36662306a36Sopenharmony_ciconfig SCHED_MC
36762306a36Sopenharmony_ci	bool "Multi-core scheduler support"
36862306a36Sopenharmony_ci	depends on SMP
36962306a36Sopenharmony_ci	help
37062306a36Sopenharmony_ci	  Multi-core scheduler support improves the CPU scheduler's decision
37162306a36Sopenharmony_ci	  making when dealing with multi-core CPU chips at a cost of slightly
37262306a36Sopenharmony_ci	  increased overhead in some places. If unsure say N here.
37362306a36Sopenharmony_ci
37462306a36Sopenharmony_ciconfig NR_CPUS
37562306a36Sopenharmony_ci	int "Maximum number of CPUs (2-512)"
37662306a36Sopenharmony_ci	depends on SMP
37762306a36Sopenharmony_ci	range 2 512 if !RISCV_SBI_V01
37862306a36Sopenharmony_ci	range 2 32 if RISCV_SBI_V01 && 32BIT
37962306a36Sopenharmony_ci	range 2 64 if RISCV_SBI_V01 && 64BIT
38062306a36Sopenharmony_ci	default "32" if 32BIT
38162306a36Sopenharmony_ci	default "64" if 64BIT
38262306a36Sopenharmony_ci
38362306a36Sopenharmony_ciconfig HOTPLUG_CPU
38462306a36Sopenharmony_ci	bool "Support for hot-pluggable CPUs"
38562306a36Sopenharmony_ci	depends on SMP
38662306a36Sopenharmony_ci	select GENERIC_IRQ_MIGRATION
38762306a36Sopenharmony_ci	help
38862306a36Sopenharmony_ci
38962306a36Sopenharmony_ci	  Say Y here to experiment with turning CPUs off and on.  CPUs
39062306a36Sopenharmony_ci	  can be controlled through /sys/devices/system/cpu.
39162306a36Sopenharmony_ci
39262306a36Sopenharmony_ci	  Say N if you want to disable CPU hotplug.
39362306a36Sopenharmony_ci
39462306a36Sopenharmony_cichoice
39562306a36Sopenharmony_ci	prompt "CPU Tuning"
39662306a36Sopenharmony_ci	default TUNE_GENERIC
39762306a36Sopenharmony_ci
39862306a36Sopenharmony_ciconfig TUNE_GENERIC
39962306a36Sopenharmony_ci	bool "generic"
40062306a36Sopenharmony_ci
40162306a36Sopenharmony_ciendchoice
40262306a36Sopenharmony_ci
40362306a36Sopenharmony_ci# Common NUMA Features
40462306a36Sopenharmony_ciconfig NUMA
40562306a36Sopenharmony_ci	bool "NUMA Memory Allocation and Scheduler Support"
40662306a36Sopenharmony_ci	depends on SMP && MMU
40762306a36Sopenharmony_ci	select ARCH_SUPPORTS_NUMA_BALANCING
40862306a36Sopenharmony_ci	select GENERIC_ARCH_NUMA
40962306a36Sopenharmony_ci	select NEED_PER_CPU_EMBED_FIRST_CHUNK
41062306a36Sopenharmony_ci	select OF_NUMA
41162306a36Sopenharmony_ci	select USE_PERCPU_NUMA_NODE_ID
41262306a36Sopenharmony_ci	help
41362306a36Sopenharmony_ci	  Enable NUMA (Non-Uniform Memory Access) support.
41462306a36Sopenharmony_ci
41562306a36Sopenharmony_ci	  The kernel will try to allocate memory used by a CPU on the
41662306a36Sopenharmony_ci	  local memory of the CPU and add some more NUMA awareness to the kernel.
41762306a36Sopenharmony_ci
41862306a36Sopenharmony_ciconfig NODES_SHIFT
41962306a36Sopenharmony_ci	int "Maximum NUMA Nodes (as a power of 2)"
42062306a36Sopenharmony_ci	range 1 10
42162306a36Sopenharmony_ci	default "2"
42262306a36Sopenharmony_ci	depends on NUMA
42362306a36Sopenharmony_ci	help
42462306a36Sopenharmony_ci	  Specify the maximum number of NUMA Nodes available on the target
42562306a36Sopenharmony_ci	  system.  Increases memory reserved to accommodate various tables.
42662306a36Sopenharmony_ci
42762306a36Sopenharmony_ciconfig RISCV_ALTERNATIVE
42862306a36Sopenharmony_ci	bool
42962306a36Sopenharmony_ci	depends on !XIP_KERNEL
43062306a36Sopenharmony_ci	help
43162306a36Sopenharmony_ci	  This Kconfig allows the kernel to automatically patch the
43262306a36Sopenharmony_ci	  erratum or cpufeature required by the execution platform at run
43362306a36Sopenharmony_ci	  time. The code patching overhead is minimal, as it's only done
43462306a36Sopenharmony_ci	  once at boot and once on each module load.
43562306a36Sopenharmony_ci
43662306a36Sopenharmony_ciconfig RISCV_ALTERNATIVE_EARLY
43762306a36Sopenharmony_ci	bool
43862306a36Sopenharmony_ci	depends on RISCV_ALTERNATIVE
43962306a36Sopenharmony_ci	help
44062306a36Sopenharmony_ci	  Allows early patching of the kernel for special errata
44162306a36Sopenharmony_ci
44262306a36Sopenharmony_ciconfig RISCV_ISA_C
44362306a36Sopenharmony_ci	bool "Emit compressed instructions when building Linux"
44462306a36Sopenharmony_ci	default y
44562306a36Sopenharmony_ci	help
44662306a36Sopenharmony_ci	  Adds "C" to the ISA subsets that the toolchain is allowed to emit
44762306a36Sopenharmony_ci	  when building Linux, which results in compressed instructions in the
44862306a36Sopenharmony_ci	  Linux binary.
44962306a36Sopenharmony_ci
45062306a36Sopenharmony_ci	  If you don't know what to do here, say Y.
45162306a36Sopenharmony_ci
45262306a36Sopenharmony_ciconfig RISCV_ISA_SVNAPOT
45362306a36Sopenharmony_ci	bool "Svnapot extension support for supervisor mode NAPOT pages"
45462306a36Sopenharmony_ci	depends on 64BIT && MMU
45562306a36Sopenharmony_ci	depends on RISCV_ALTERNATIVE
45662306a36Sopenharmony_ci	default y
45762306a36Sopenharmony_ci	help
45862306a36Sopenharmony_ci	  Allow kernel to detect the Svnapot ISA-extension dynamically at boot
45962306a36Sopenharmony_ci	  time and enable its usage.
46062306a36Sopenharmony_ci
46162306a36Sopenharmony_ci	  The Svnapot extension is used to mark contiguous PTEs as a range
46262306a36Sopenharmony_ci	  of contiguous virtual-to-physical translations for a naturally
46362306a36Sopenharmony_ci	  aligned power-of-2 (NAPOT) granularity larger than the base 4KB page
46462306a36Sopenharmony_ci	  size. When HUGETLBFS is also selected this option unconditionally
46562306a36Sopenharmony_ci	  allocates some memory for each NAPOT page size supported by the kernel.
46662306a36Sopenharmony_ci	  When optimizing for low memory consumption and for platforms without
46762306a36Sopenharmony_ci	  the Svnapot extension, it may be better to say N here.
46862306a36Sopenharmony_ci
46962306a36Sopenharmony_ci	  If you don't know what to do here, say Y.
47062306a36Sopenharmony_ci
47162306a36Sopenharmony_ciconfig RISCV_ISA_SVPBMT
47262306a36Sopenharmony_ci	bool "Svpbmt extension support for supervisor mode page-based memory types"
47362306a36Sopenharmony_ci	depends on 64BIT && MMU
47462306a36Sopenharmony_ci	depends on RISCV_ALTERNATIVE
47562306a36Sopenharmony_ci	default y
47662306a36Sopenharmony_ci	help
47762306a36Sopenharmony_ci	   Adds support to dynamically detect the presence of the Svpbmt
47862306a36Sopenharmony_ci	   ISA-extension (Supervisor-mode: page-based memory types) and
47962306a36Sopenharmony_ci	   enable its usage.
48062306a36Sopenharmony_ci
48162306a36Sopenharmony_ci	   The memory type for a page contains a combination of attributes
48262306a36Sopenharmony_ci	   that indicate the cacheability, idempotency, and ordering
48362306a36Sopenharmony_ci	   properties for access to that page.
48462306a36Sopenharmony_ci
48562306a36Sopenharmony_ci	   The Svpbmt extension is only available on 64-bit cpus.
48662306a36Sopenharmony_ci
48762306a36Sopenharmony_ci	   If you don't know what to do here, say Y.
48862306a36Sopenharmony_ci
48962306a36Sopenharmony_ciconfig TOOLCHAIN_HAS_V
49062306a36Sopenharmony_ci	bool
49162306a36Sopenharmony_ci	default y
49262306a36Sopenharmony_ci	depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64iv)
49362306a36Sopenharmony_ci	depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32iv)
49462306a36Sopenharmony_ci	depends on LLD_VERSION >= 140000 || LD_VERSION >= 23800
49562306a36Sopenharmony_ci	depends on AS_HAS_OPTION_ARCH
49662306a36Sopenharmony_ci
49762306a36Sopenharmony_ciconfig RISCV_ISA_V
49862306a36Sopenharmony_ci	bool "VECTOR extension support"
49962306a36Sopenharmony_ci	depends on TOOLCHAIN_HAS_V
50062306a36Sopenharmony_ci	depends on FPU
50162306a36Sopenharmony_ci	select DYNAMIC_SIGFRAME
50262306a36Sopenharmony_ci	default y
50362306a36Sopenharmony_ci	help
50462306a36Sopenharmony_ci	  Say N here if you want to disable all vector related procedure
50562306a36Sopenharmony_ci	  in the kernel.
50662306a36Sopenharmony_ci
50762306a36Sopenharmony_ci	  If you don't know what to do here, say Y.
50862306a36Sopenharmony_ci
50962306a36Sopenharmony_ciconfig RISCV_ISA_V_DEFAULT_ENABLE
51062306a36Sopenharmony_ci	bool "Enable userspace Vector by default"
51162306a36Sopenharmony_ci	depends on RISCV_ISA_V
51262306a36Sopenharmony_ci	default y
51362306a36Sopenharmony_ci	help
51462306a36Sopenharmony_ci	  Say Y here if you want to enable Vector in userspace by default.
51562306a36Sopenharmony_ci	  Otherwise, userspace has to make explicit prctl() call to enable
51662306a36Sopenharmony_ci	  Vector, or enable it via the sysctl interface.
51762306a36Sopenharmony_ci
51862306a36Sopenharmony_ci	  If you don't know what to do here, say Y.
51962306a36Sopenharmony_ci
52062306a36Sopenharmony_ciconfig TOOLCHAIN_HAS_ZBB
52162306a36Sopenharmony_ci	bool
52262306a36Sopenharmony_ci	default y
52362306a36Sopenharmony_ci	depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64ima_zbb)
52462306a36Sopenharmony_ci	depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32ima_zbb)
52562306a36Sopenharmony_ci	depends on LLD_VERSION >= 150000 || LD_VERSION >= 23900
52662306a36Sopenharmony_ci	depends on AS_HAS_OPTION_ARCH
52762306a36Sopenharmony_ci
52862306a36Sopenharmony_ciconfig RISCV_ISA_ZBB
52962306a36Sopenharmony_ci	bool "Zbb extension support for bit manipulation instructions"
53062306a36Sopenharmony_ci	depends on TOOLCHAIN_HAS_ZBB
53162306a36Sopenharmony_ci	depends on MMU
53262306a36Sopenharmony_ci	depends on RISCV_ALTERNATIVE
53362306a36Sopenharmony_ci	default y
53462306a36Sopenharmony_ci	help
53562306a36Sopenharmony_ci	   Adds support to dynamically detect the presence of the ZBB
53662306a36Sopenharmony_ci	   extension (basic bit manipulation) and enable its usage.
53762306a36Sopenharmony_ci
53862306a36Sopenharmony_ci	   The Zbb extension provides instructions to accelerate a number
53962306a36Sopenharmony_ci	   of bit-specific operations (count bit population, sign extending,
54062306a36Sopenharmony_ci	   bitrotation, etc).
54162306a36Sopenharmony_ci
54262306a36Sopenharmony_ci	   If you don't know what to do here, say Y.
54362306a36Sopenharmony_ci
54462306a36Sopenharmony_ciconfig RISCV_ISA_ZICBOM
54562306a36Sopenharmony_ci	bool "Zicbom extension support for non-coherent DMA operation"
54662306a36Sopenharmony_ci	depends on MMU
54762306a36Sopenharmony_ci	depends on RISCV_ALTERNATIVE
54862306a36Sopenharmony_ci	default y
54962306a36Sopenharmony_ci	select RISCV_DMA_NONCOHERENT
55062306a36Sopenharmony_ci	select DMA_DIRECT_REMAP
55162306a36Sopenharmony_ci	help
55262306a36Sopenharmony_ci	   Adds support to dynamically detect the presence of the ZICBOM
55362306a36Sopenharmony_ci	   extension (Cache Block Management Operations) and enable its
55462306a36Sopenharmony_ci	   usage.
55562306a36Sopenharmony_ci
55662306a36Sopenharmony_ci	   The Zicbom extension can be used to handle for example
55762306a36Sopenharmony_ci	   non-coherent DMA support on devices that need it.
55862306a36Sopenharmony_ci
55962306a36Sopenharmony_ci	   If you don't know what to do here, say Y.
56062306a36Sopenharmony_ci
56162306a36Sopenharmony_ciconfig RISCV_ISA_ZICBOZ
56262306a36Sopenharmony_ci	bool "Zicboz extension support for faster zeroing of memory"
56362306a36Sopenharmony_ci	depends on MMU
56462306a36Sopenharmony_ci	depends on RISCV_ALTERNATIVE
56562306a36Sopenharmony_ci	default y
56662306a36Sopenharmony_ci	help
56762306a36Sopenharmony_ci	   Enable the use of the Zicboz extension (cbo.zero instruction)
56862306a36Sopenharmony_ci	   when available.
56962306a36Sopenharmony_ci
57062306a36Sopenharmony_ci	   The Zicboz extension is used for faster zeroing of memory.
57162306a36Sopenharmony_ci
57262306a36Sopenharmony_ci	   If you don't know what to do here, say Y.
57362306a36Sopenharmony_ci
57462306a36Sopenharmony_ciconfig TOOLCHAIN_HAS_ZIHINTPAUSE
57562306a36Sopenharmony_ci	bool
57662306a36Sopenharmony_ci	default y
57762306a36Sopenharmony_ci	depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64ima_zihintpause)
57862306a36Sopenharmony_ci	depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32ima_zihintpause)
57962306a36Sopenharmony_ci	depends on LLD_VERSION >= 150000 || LD_VERSION >= 23600
58062306a36Sopenharmony_ci
58162306a36Sopenharmony_ciconfig TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI
58262306a36Sopenharmony_ci	def_bool y
58362306a36Sopenharmony_ci	# https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=aed44286efa8ae8717a77d94b51ac3614e2ca6dc
58462306a36Sopenharmony_ci	# https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=98416dbb0a62579d4a7a4a76bab51b5b52fec2cd
58562306a36Sopenharmony_ci	depends on AS_IS_GNU && AS_VERSION >= 23600
58662306a36Sopenharmony_ci	help
58762306a36Sopenharmony_ci	  Binutils-2.38 and GCC-12.1.0 bumped the default ISA spec to the newer
58862306a36Sopenharmony_ci	  20191213 version, which moves some instructions from the I extension to
58962306a36Sopenharmony_ci	  the Zicsr and Zifencei extensions. This requires explicitly specifying
59062306a36Sopenharmony_ci	  Zicsr and Zifencei when binutils >= 2.38 or GCC >= 12.1.0. Zicsr
59162306a36Sopenharmony_ci	  and Zifencei are supported in binutils from version 2.36 onwards.
59262306a36Sopenharmony_ci	  To make life easier, and avoid forcing toolchains that default to a
59362306a36Sopenharmony_ci	  newer ISA spec to version 2.2, relax the check to binutils >= 2.36.
59462306a36Sopenharmony_ci	  For clang < 17 or GCC < 11.3.0, for which this is not possible or need
59562306a36Sopenharmony_ci	  special treatment, this is dealt with in TOOLCHAIN_NEEDS_OLD_ISA_SPEC.
59662306a36Sopenharmony_ci
59762306a36Sopenharmony_ciconfig TOOLCHAIN_NEEDS_OLD_ISA_SPEC
59862306a36Sopenharmony_ci	def_bool y
59962306a36Sopenharmony_ci	depends on TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI
60062306a36Sopenharmony_ci	# https://github.com/llvm/llvm-project/commit/22e199e6afb1263c943c0c0d4498694e15bf8a16
60162306a36Sopenharmony_ci	# https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=d29f5d6ab513c52fd872f532c492e35ae9fd6671
60262306a36Sopenharmony_ci	depends on (CC_IS_CLANG && CLANG_VERSION < 170000) || (CC_IS_GCC && GCC_VERSION < 110300)
60362306a36Sopenharmony_ci	help
60462306a36Sopenharmony_ci	  Certain versions of clang and GCC do not support zicsr and zifencei via
60562306a36Sopenharmony_ci	  -march. This option causes an older ISA spec compatible with these older
60662306a36Sopenharmony_ci	  versions of clang and GCC to be passed to GAS, which has the same result
60762306a36Sopenharmony_ci	  as passing zicsr and zifencei to -march.
60862306a36Sopenharmony_ci
60962306a36Sopenharmony_ciconfig FPU
61062306a36Sopenharmony_ci	bool "FPU support"
61162306a36Sopenharmony_ci	default y
61262306a36Sopenharmony_ci	help
61362306a36Sopenharmony_ci	  Say N here if you want to disable all floating-point related procedure
61462306a36Sopenharmony_ci	  in the kernel.
61562306a36Sopenharmony_ci
61662306a36Sopenharmony_ci	  If you don't know what to do here, say Y.
61762306a36Sopenharmony_ci
61862306a36Sopenharmony_ciconfig IRQ_STACKS
61962306a36Sopenharmony_ci	bool "Independent irq & softirq stacks" if EXPERT
62062306a36Sopenharmony_ci	default y
62162306a36Sopenharmony_ci	select HAVE_IRQ_EXIT_ON_IRQ_STACK
62262306a36Sopenharmony_ci	select HAVE_SOFTIRQ_ON_OWN_STACK
62362306a36Sopenharmony_ci	help
62462306a36Sopenharmony_ci	  Add independent irq & softirq stacks for percpu to prevent kernel stack
62562306a36Sopenharmony_ci	  overflows. We may save some memory footprint by disabling IRQ_STACKS.
62662306a36Sopenharmony_ci
62762306a36Sopenharmony_ciconfig THREAD_SIZE_ORDER
62862306a36Sopenharmony_ci	int "Kernel stack size (in power-of-two numbers of page size)" if VMAP_STACK && EXPERT
62962306a36Sopenharmony_ci	range 0 4
63062306a36Sopenharmony_ci	default 1 if 32BIT && !KASAN
63162306a36Sopenharmony_ci	default 3 if 64BIT && KASAN
63262306a36Sopenharmony_ci	default 2
63362306a36Sopenharmony_ci	help
63462306a36Sopenharmony_ci	  Specify the Pages of thread stack size (from 4KB to 64KB), which also
63562306a36Sopenharmony_ci	  affects irq stack size, which is equal to thread stack size.
63662306a36Sopenharmony_ci
63762306a36Sopenharmony_ciendmenu # "Platform type"
63862306a36Sopenharmony_ci
63962306a36Sopenharmony_cimenu "Kernel features"
64062306a36Sopenharmony_ci
64162306a36Sopenharmony_cisource "kernel/Kconfig.hz"
64262306a36Sopenharmony_ci
64362306a36Sopenharmony_ciconfig RISCV_SBI_V01
64462306a36Sopenharmony_ci	bool "SBI v0.1 support"
64562306a36Sopenharmony_ci	depends on RISCV_SBI
64662306a36Sopenharmony_ci	help
64762306a36Sopenharmony_ci	  This config allows kernel to use SBI v0.1 APIs. This will be
64862306a36Sopenharmony_ci	  deprecated in future once legacy M-mode software are no longer in use.
64962306a36Sopenharmony_ci
65062306a36Sopenharmony_ciconfig RISCV_BOOT_SPINWAIT
65162306a36Sopenharmony_ci	bool "Spinwait booting method"
65262306a36Sopenharmony_ci	depends on SMP
65362306a36Sopenharmony_ci	default y if RISCV_SBI_V01 || RISCV_M_MODE
65462306a36Sopenharmony_ci	help
65562306a36Sopenharmony_ci	  This enables support for booting Linux via spinwait method. In the
65662306a36Sopenharmony_ci	  spinwait method, all cores randomly jump to Linux. One of the cores
65762306a36Sopenharmony_ci	  gets chosen via lottery and all other keep spinning on a percpu
65862306a36Sopenharmony_ci	  variable. This method cannot support CPU hotplug and sparse hartid
65962306a36Sopenharmony_ci	  scheme. It should be only enabled for M-mode Linux or platforms relying
66062306a36Sopenharmony_ci	  on older firmware without SBI HSM extension. All other platforms should
66162306a36Sopenharmony_ci	  rely on ordered booting via SBI HSM extension which gets chosen
66262306a36Sopenharmony_ci	  dynamically at runtime if the firmware supports it.
66362306a36Sopenharmony_ci
66462306a36Sopenharmony_ci	  Since spinwait is incompatible with sparse hart IDs, it requires
66562306a36Sopenharmony_ci	  NR_CPUS be large enough to contain the physical hart ID of the first
66662306a36Sopenharmony_ci	  hart to enter Linux.
66762306a36Sopenharmony_ci
66862306a36Sopenharmony_ci	  If unsure what to do here, say N.
66962306a36Sopenharmony_ci
67062306a36Sopenharmony_ciconfig ARCH_SUPPORTS_KEXEC
67162306a36Sopenharmony_ci	def_bool y
67262306a36Sopenharmony_ci
67362306a36Sopenharmony_ciconfig ARCH_SELECTS_KEXEC
67462306a36Sopenharmony_ci	def_bool y
67562306a36Sopenharmony_ci	depends on KEXEC
67662306a36Sopenharmony_ci	select HOTPLUG_CPU if SMP
67762306a36Sopenharmony_ci
67862306a36Sopenharmony_ciconfig ARCH_SUPPORTS_KEXEC_FILE
67962306a36Sopenharmony_ci	def_bool 64BIT
68062306a36Sopenharmony_ci
68162306a36Sopenharmony_ciconfig ARCH_SELECTS_KEXEC_FILE
68262306a36Sopenharmony_ci	def_bool y
68362306a36Sopenharmony_ci	depends on KEXEC_FILE
68462306a36Sopenharmony_ci	select HAVE_IMA_KEXEC if IMA
68562306a36Sopenharmony_ci	select KEXEC_ELF
68662306a36Sopenharmony_ci
68762306a36Sopenharmony_ciconfig ARCH_SUPPORTS_KEXEC_PURGATORY
68862306a36Sopenharmony_ci	def_bool ARCH_SUPPORTS_KEXEC_FILE
68962306a36Sopenharmony_ci
69062306a36Sopenharmony_ciconfig ARCH_SUPPORTS_CRASH_DUMP
69162306a36Sopenharmony_ci	def_bool y
69262306a36Sopenharmony_ci
69362306a36Sopenharmony_ciconfig COMPAT
69462306a36Sopenharmony_ci	bool "Kernel support for 32-bit U-mode"
69562306a36Sopenharmony_ci	default 64BIT
69662306a36Sopenharmony_ci	depends on 64BIT && MMU
69762306a36Sopenharmony_ci	help
69862306a36Sopenharmony_ci	  This option enables support for a 32-bit U-mode running under a 64-bit
69962306a36Sopenharmony_ci	  kernel at S-mode. riscv32-specific components such as system calls,
70062306a36Sopenharmony_ci	  the user helper functions (vdso), signal rt_frame functions and the
70162306a36Sopenharmony_ci	  ptrace interface are handled appropriately by the kernel.
70262306a36Sopenharmony_ci
70362306a36Sopenharmony_ci	  If you want to execute 32-bit userspace applications, say Y.
70462306a36Sopenharmony_ci
70562306a36Sopenharmony_ciconfig RELOCATABLE
70662306a36Sopenharmony_ci	bool "Build a relocatable kernel"
70762306a36Sopenharmony_ci	depends on MMU && 64BIT && !XIP_KERNEL
70862306a36Sopenharmony_ci	help
70962306a36Sopenharmony_ci          This builds a kernel as a Position Independent Executable (PIE),
71062306a36Sopenharmony_ci          which retains all relocation metadata required to relocate the
71162306a36Sopenharmony_ci          kernel binary at runtime to a different virtual address than the
71262306a36Sopenharmony_ci          address it was linked at.
71362306a36Sopenharmony_ci          Since RISCV uses the RELA relocation format, this requires a
71462306a36Sopenharmony_ci          relocation pass at runtime even if the kernel is loaded at the
71562306a36Sopenharmony_ci          same address it was linked at.
71662306a36Sopenharmony_ci
71762306a36Sopenharmony_ci          If unsure, say N.
71862306a36Sopenharmony_ci
71962306a36Sopenharmony_ciconfig RANDOMIZE_BASE
72062306a36Sopenharmony_ci        bool "Randomize the address of the kernel image"
72162306a36Sopenharmony_ci        select RELOCATABLE
72262306a36Sopenharmony_ci        depends on MMU && 64BIT && !XIP_KERNEL
72362306a36Sopenharmony_ci        help
72462306a36Sopenharmony_ci          Randomizes the virtual address at which the kernel image is
72562306a36Sopenharmony_ci          loaded, as a security feature that deters exploit attempts
72662306a36Sopenharmony_ci          relying on knowledge of the location of kernel internals.
72762306a36Sopenharmony_ci
72862306a36Sopenharmony_ci          It is the bootloader's job to provide entropy, by passing a
72962306a36Sopenharmony_ci          random u64 value in /chosen/kaslr-seed at kernel entry.
73062306a36Sopenharmony_ci
73162306a36Sopenharmony_ci          When booting via the UEFI stub, it will invoke the firmware's
73262306a36Sopenharmony_ci          EFI_RNG_PROTOCOL implementation (if available) to supply entropy
73362306a36Sopenharmony_ci          to the kernel proper. In addition, it will randomise the physical
73462306a36Sopenharmony_ci          location of the kernel Image as well.
73562306a36Sopenharmony_ci
73662306a36Sopenharmony_ci          If unsure, say N.
73762306a36Sopenharmony_ci
73862306a36Sopenharmony_ciendmenu # "Kernel features"
73962306a36Sopenharmony_ci
74062306a36Sopenharmony_cimenu "Boot options"
74162306a36Sopenharmony_ci
74262306a36Sopenharmony_ciconfig CMDLINE
74362306a36Sopenharmony_ci	string "Built-in kernel command line"
74462306a36Sopenharmony_ci	help
74562306a36Sopenharmony_ci	  For most platforms, the arguments for the kernel's command line
74662306a36Sopenharmony_ci	  are provided at run-time, during boot. However, there are cases
74762306a36Sopenharmony_ci	  where either no arguments are being provided or the provided
74862306a36Sopenharmony_ci	  arguments are insufficient or even invalid.
74962306a36Sopenharmony_ci
75062306a36Sopenharmony_ci	  When that occurs, it is possible to define a built-in command
75162306a36Sopenharmony_ci	  line here and choose how the kernel should use it later on.
75262306a36Sopenharmony_ci
75362306a36Sopenharmony_cichoice
75462306a36Sopenharmony_ci	prompt "Built-in command line usage" if CMDLINE != ""
75562306a36Sopenharmony_ci	default CMDLINE_FALLBACK
75662306a36Sopenharmony_ci	help
75762306a36Sopenharmony_ci	  Choose how the kernel will handle the provided built-in command
75862306a36Sopenharmony_ci	  line.
75962306a36Sopenharmony_ci
76062306a36Sopenharmony_ciconfig CMDLINE_FALLBACK
76162306a36Sopenharmony_ci	bool "Use bootloader kernel arguments if available"
76262306a36Sopenharmony_ci	help
76362306a36Sopenharmony_ci	  Use the built-in command line as fallback in case we get nothing
76462306a36Sopenharmony_ci	  during boot. This is the default behaviour.
76562306a36Sopenharmony_ci
76662306a36Sopenharmony_ciconfig CMDLINE_EXTEND
76762306a36Sopenharmony_ci	bool "Extend bootloader kernel arguments"
76862306a36Sopenharmony_ci	help
76962306a36Sopenharmony_ci	  The command-line arguments provided during boot will be
77062306a36Sopenharmony_ci	  appended to the built-in command line. This is useful in
77162306a36Sopenharmony_ci	  cases where the provided arguments are insufficient and
77262306a36Sopenharmony_ci	  you don't want to or cannot modify them.
77362306a36Sopenharmony_ci
77462306a36Sopenharmony_ciconfig CMDLINE_FORCE
77562306a36Sopenharmony_ci	bool "Always use the default kernel command string"
77662306a36Sopenharmony_ci	help
77762306a36Sopenharmony_ci	  Always use the built-in command line, even if we get one during
77862306a36Sopenharmony_ci	  boot. This is useful in case you need to override the provided
77962306a36Sopenharmony_ci	  command line on systems where you don't have or want control
78062306a36Sopenharmony_ci	  over it.
78162306a36Sopenharmony_ci
78262306a36Sopenharmony_ciendchoice
78362306a36Sopenharmony_ci
78462306a36Sopenharmony_ciconfig EFI_STUB
78562306a36Sopenharmony_ci	bool
78662306a36Sopenharmony_ci
78762306a36Sopenharmony_ciconfig EFI
78862306a36Sopenharmony_ci	bool "UEFI runtime support"
78962306a36Sopenharmony_ci	depends on OF && !XIP_KERNEL
79062306a36Sopenharmony_ci	depends on MMU
79162306a36Sopenharmony_ci	default y
79262306a36Sopenharmony_ci	select ARCH_SUPPORTS_ACPI if 64BIT
79362306a36Sopenharmony_ci	select EFI_GENERIC_STUB
79462306a36Sopenharmony_ci	select EFI_PARAMS_FROM_FDT
79562306a36Sopenharmony_ci	select EFI_RUNTIME_WRAPPERS
79662306a36Sopenharmony_ci	select EFI_STUB
79762306a36Sopenharmony_ci	select LIBFDT
79862306a36Sopenharmony_ci	select RISCV_ISA_C
79962306a36Sopenharmony_ci	select UCS2_STRING
80062306a36Sopenharmony_ci	help
80162306a36Sopenharmony_ci	  This option provides support for runtime services provided
80262306a36Sopenharmony_ci	  by UEFI firmware (such as non-volatile variables, realtime
80362306a36Sopenharmony_ci	  clock, and platform reset). A UEFI stub is also provided to
80462306a36Sopenharmony_ci	  allow the kernel to be booted as an EFI application. This
80562306a36Sopenharmony_ci	  is only useful on systems that have UEFI firmware.
80662306a36Sopenharmony_ci
80762306a36Sopenharmony_ciconfig CC_HAVE_STACKPROTECTOR_TLS
80862306a36Sopenharmony_ci	def_bool $(cc-option,-mstack-protector-guard=tls -mstack-protector-guard-reg=tp -mstack-protector-guard-offset=0)
80962306a36Sopenharmony_ci
81062306a36Sopenharmony_ciconfig STACKPROTECTOR_PER_TASK
81162306a36Sopenharmony_ci	def_bool y
81262306a36Sopenharmony_ci	depends on !RANDSTRUCT
81362306a36Sopenharmony_ci	depends on STACKPROTECTOR && CC_HAVE_STACKPROTECTOR_TLS
81462306a36Sopenharmony_ci
81562306a36Sopenharmony_ciconfig PHYS_RAM_BASE_FIXED
81662306a36Sopenharmony_ci	bool "Explicitly specified physical RAM address"
81762306a36Sopenharmony_ci	depends on NONPORTABLE
81862306a36Sopenharmony_ci	default n
81962306a36Sopenharmony_ci
82062306a36Sopenharmony_ciconfig PHYS_RAM_BASE
82162306a36Sopenharmony_ci	hex "Platform Physical RAM address"
82262306a36Sopenharmony_ci	depends on PHYS_RAM_BASE_FIXED
82362306a36Sopenharmony_ci	default "0x80000000"
82462306a36Sopenharmony_ci	help
82562306a36Sopenharmony_ci	  This is the physical address of RAM in the system. It has to be
82662306a36Sopenharmony_ci	  explicitly specified to run early relocations of read-write data
82762306a36Sopenharmony_ci	  from flash to RAM.
82862306a36Sopenharmony_ci
82962306a36Sopenharmony_ciconfig XIP_KERNEL
83062306a36Sopenharmony_ci	bool "Kernel Execute-In-Place from ROM"
83162306a36Sopenharmony_ci	depends on MMU && SPARSEMEM && NONPORTABLE
83262306a36Sopenharmony_ci	# This prevents XIP from being enabled by all{yes,mod}config, which
83362306a36Sopenharmony_ci	# fail to build since XIP doesn't support large kernels.
83462306a36Sopenharmony_ci	depends on !COMPILE_TEST
83562306a36Sopenharmony_ci	select PHYS_RAM_BASE_FIXED
83662306a36Sopenharmony_ci	help
83762306a36Sopenharmony_ci	  Execute-In-Place allows the kernel to run from non-volatile storage
83862306a36Sopenharmony_ci	  directly addressable by the CPU, such as NOR flash. This saves RAM
83962306a36Sopenharmony_ci	  space since the text section of the kernel is not loaded from flash
84062306a36Sopenharmony_ci	  to RAM.  Read-write sections, such as the data section and stack,
84162306a36Sopenharmony_ci	  are still copied to RAM.  The XIP kernel is not compressed since
84262306a36Sopenharmony_ci	  it has to run directly from flash, so it will take more space to
84362306a36Sopenharmony_ci	  store it.  The flash address used to link the kernel object files,
84462306a36Sopenharmony_ci	  and for storing it, is configuration dependent. Therefore, if you
84562306a36Sopenharmony_ci	  say Y here, you must know the proper physical address where to
84662306a36Sopenharmony_ci	  store the kernel image depending on your own flash memory usage.
84762306a36Sopenharmony_ci
84862306a36Sopenharmony_ci	  Also note that the make target becomes "make xipImage" rather than
84962306a36Sopenharmony_ci	  "make zImage" or "make Image".  The final kernel binary to put in
85062306a36Sopenharmony_ci	  ROM memory will be arch/riscv/boot/xipImage.
85162306a36Sopenharmony_ci
85262306a36Sopenharmony_ci	  SPARSEMEM is required because the kernel text and rodata that are
85362306a36Sopenharmony_ci	  flash resident are not backed by memmap, then any attempt to get
85462306a36Sopenharmony_ci	  a struct page on those regions will trigger a fault.
85562306a36Sopenharmony_ci
85662306a36Sopenharmony_ci	  If unsure, say N.
85762306a36Sopenharmony_ci
85862306a36Sopenharmony_ciconfig XIP_PHYS_ADDR
85962306a36Sopenharmony_ci	hex "XIP Kernel Physical Location"
86062306a36Sopenharmony_ci	depends on XIP_KERNEL
86162306a36Sopenharmony_ci	default "0x21000000"
86262306a36Sopenharmony_ci	help
86362306a36Sopenharmony_ci	  This is the physical address in your flash memory the kernel will
86462306a36Sopenharmony_ci	  be linked for and stored to.  This address is dependent on your
86562306a36Sopenharmony_ci	  own flash usage.
86662306a36Sopenharmony_ci
86762306a36Sopenharmony_ciconfig RISCV_ISA_FALLBACK
86862306a36Sopenharmony_ci	bool "Permit falling back to parsing riscv,isa for extension support by default"
86962306a36Sopenharmony_ci	default y
87062306a36Sopenharmony_ci	help
87162306a36Sopenharmony_ci	  Parsing the "riscv,isa" devicetree property has been deprecated and
87262306a36Sopenharmony_ci	  replaced by a list of explicitly defined strings. For compatibility
87362306a36Sopenharmony_ci	  with existing platforms, the kernel will fall back to parsing the
87462306a36Sopenharmony_ci	  "riscv,isa" property if the replacements are not found.
87562306a36Sopenharmony_ci
87662306a36Sopenharmony_ci	  Selecting N here will result in a kernel that does not use the
87762306a36Sopenharmony_ci	  fallback, unless the commandline "riscv_isa_fallback" parameter is
87862306a36Sopenharmony_ci	  present.
87962306a36Sopenharmony_ci
88062306a36Sopenharmony_ci	  Please see the dt-binding, located at
88162306a36Sopenharmony_ci	  Documentation/devicetree/bindings/riscv/extensions.yaml for details
88262306a36Sopenharmony_ci	  on the replacement properties, "riscv,isa-base" and
88362306a36Sopenharmony_ci	  "riscv,isa-extensions".
88462306a36Sopenharmony_ci
88562306a36Sopenharmony_ciendmenu # "Boot options"
88662306a36Sopenharmony_ci
88762306a36Sopenharmony_ciconfig BUILTIN_DTB
88862306a36Sopenharmony_ci	bool
88962306a36Sopenharmony_ci	depends on OF && NONPORTABLE
89062306a36Sopenharmony_ci	default y if XIP_KERNEL
89162306a36Sopenharmony_ci
89262306a36Sopenharmony_ciconfig PORTABLE
89362306a36Sopenharmony_ci	bool
89462306a36Sopenharmony_ci	default !NONPORTABLE
89562306a36Sopenharmony_ci	select EFI
89662306a36Sopenharmony_ci	select MMU
89762306a36Sopenharmony_ci	select OF
89862306a36Sopenharmony_ci
89962306a36Sopenharmony_cimenu "Power management options"
90062306a36Sopenharmony_ci
90162306a36Sopenharmony_cisource "kernel/power/Kconfig"
90262306a36Sopenharmony_ci
90362306a36Sopenharmony_ci# Hibernation is only possible on systems where the SBI implementation has
90462306a36Sopenharmony_ci# marked its reserved memory as not accessible from, or does not run
90562306a36Sopenharmony_ci# from the same memory as, Linux
90662306a36Sopenharmony_ciconfig ARCH_HIBERNATION_POSSIBLE
90762306a36Sopenharmony_ci	def_bool NONPORTABLE
90862306a36Sopenharmony_ci
90962306a36Sopenharmony_ciconfig ARCH_HIBERNATION_HEADER
91062306a36Sopenharmony_ci	def_bool HIBERNATION
91162306a36Sopenharmony_ci
91262306a36Sopenharmony_ciconfig ARCH_SUSPEND_POSSIBLE
91362306a36Sopenharmony_ci	def_bool y
91462306a36Sopenharmony_ci
91562306a36Sopenharmony_ciendmenu # "Power management options"
91662306a36Sopenharmony_ci
91762306a36Sopenharmony_cimenu "CPU Power Management"
91862306a36Sopenharmony_ci
91962306a36Sopenharmony_cisource "drivers/cpuidle/Kconfig"
92062306a36Sopenharmony_ci
92162306a36Sopenharmony_cisource "drivers/cpufreq/Kconfig"
92262306a36Sopenharmony_ci
92362306a36Sopenharmony_ciendmenu # "CPU Power Management"
92462306a36Sopenharmony_ci
92562306a36Sopenharmony_cisource "arch/riscv/kvm/Kconfig"
92662306a36Sopenharmony_ci
92762306a36Sopenharmony_cisource "drivers/acpi/Kconfig"
928