1# General architecture configuration options
2
3# Copyright (c) 2014-2015 Wind River Systems, Inc.
4# Copyright (c) 2015 Intel Corporation
5# Copyright (c) 2016 Cadence Design Systems, Inc.
6# SPDX-License-Identifier: Apache-2.0
7
8# Include these first so that any properties (e.g. defaults) below can be
9# overridden (by defining symbols in multiple locations)
10
11source "$(KCONFIG_BINARY_DIR)/arch/Kconfig"
12
13# ToDo: Generate a Kconfig.arch for loading of additional arch in HWMv2.
14osource "$(KCONFIG_BINARY_DIR)/Kconfig.arch"
15
16# Architecture symbols
17#
18# Should be 'select'ed by low-level symbols like SOC_SERIES_* or, lacking that,
19# by SOC_*.
20
21config ARC
22	bool
23	select ARCH_IS_SET
24	imply XIP
25	select ARCH_HAS_THREAD_LOCAL_STORAGE
26	select ARCH_SUPPORTS_ROM_START
27	select ARCH_HAS_DIRECTED_IPIS
28	help
29	  ARC architecture
30
31config ARM
32	bool
33	select ARCH_IS_SET
34	select ARCH_SUPPORTS_COREDUMP if CPU_CORTEX_M
35	select ARCH_SUPPORTS_COREDUMP_THREADS if CPU_CORTEX_M
36	select ARCH_SUPPORTS_COREDUMP_STACK_PTR if CPU_CORTEX_M
37	# FIXME: current state of the code for all ARM requires this, but
38	# is really only necessary for Cortex-M with ARM MPU!
39	select GEN_PRIV_STACKS
40	select ARCH_HAS_THREAD_LOCAL_STORAGE if CPU_AARCH32_CORTEX_R || CPU_CORTEX_M || CPU_AARCH32_CORTEX_A
41	select BARRIER_OPERATIONS_ARCH
42	help
43	  ARM architecture
44
45config ARM64
46	bool
47	select ARCH_IS_SET
48	select 64BIT
49	select ARCH_SUPPORTS_COREDUMP
50	select HAS_ARM_SMCCC
51	select ARCH_HAS_THREAD_LOCAL_STORAGE
52	select USE_SWITCH
53	select USE_SWITCH_SUPPORTED
54	select BARRIER_OPERATIONS_ARCH
55	select ARCH_HAS_DIRECTED_IPIS
56	select ARCH_HAS_DEMAND_PAGING
57	select ARCH_HAS_DEMAND_MAPPING
58	select ARCH_SUPPORTS_EVICTION_TRACKING
59	select EVICTION_TRACKING if DEMAND_PAGING
60	select MEM_DOMAIN_HAS_THREAD_LIST if ARM_MPU
61	help
62	  ARM64 (AArch64) architecture
63
64config MIPS
65	bool
66	select ARCH_IS_SET
67	select ATOMIC_OPERATIONS_C
68	help
69	  MIPS architecture
70
71config SPARC
72	bool
73	select ARCH_IS_SET
74	select USE_SWITCH
75	select USE_SWITCH_SUPPORTED
76	select BIG_ENDIAN
77	select ATOMIC_OPERATIONS_BUILTIN if SPARC_CASA
78	select ATOMIC_OPERATIONS_C if !SPARC_CASA
79	select ARCH_HAS_THREAD_LOCAL_STORAGE
80	select ARCH_HAS_EXTRA_EXCEPTION_INFO
81	help
82	  SPARC architecture
83
84config X86
85	bool
86	select ARCH_IS_SET
87	select ATOMIC_OPERATIONS_BUILTIN
88	select ARCH_SUPPORTS_COREDUMP
89	select ARCH_SUPPORTS_COREDUMP_PRIV_STACKS
90	select ARCH_SUPPORTS_ROM_START if !X86_64
91	select CPU_HAS_MMU
92	select ARCH_MEM_DOMAIN_DATA if USERSPACE && !X86_COMMON_PAGE_TABLE
93	select ARCH_MEM_DOMAIN_SYNCHRONOUS_API if USERSPACE
94	select ARCH_HAS_GDBSTUB if !X86_64
95	select ARCH_HAS_TIMING_FUNCTIONS
96	select ARCH_HAS_THREAD_LOCAL_STORAGE
97	select ARCH_HAS_DEMAND_PAGING if !X86_64
98	select ARCH_HAS_DEMAND_MAPPING if ARCH_HAS_DEMAND_PAGING
99	select NEED_LIBC_MEM_PARTITION if USERSPACE && TIMING_FUNCTIONS \
100					  && !BOARD_HAS_TIMING_FUNCTIONS \
101					  && !SOC_HAS_TIMING_FUNCTIONS
102	select ARCH_HAS_STACK_CANARIES_TLS
103	select ARCH_SUPPORTS_MEM_MAPPED_STACKS if X86_MMU && !DEMAND_PAGING
104	select ARCH_HAS_THREAD_PRIV_STACK_SPACE_GET if USERSPACE
105	help
106	  x86 architecture
107
108config RISCV
109	bool
110	select ARCH_IS_SET
111	select ATOMIC_OPERATIONS_C if !RISCV_ISA_EXT_A
112	select ATOMIC_OPERATIONS_BUILTIN if RISCV_ISA_EXT_A
113	select ARCH_SUPPORTS_COREDUMP
114	select ARCH_SUPPORTS_COREDUMP_PRIV_STACKS
115	select ARCH_SUPPORTS_ROM_START if !SOC_FAMILY_ESPRESSIF_ESP32
116	select ARCH_SUPPORTS_EMPTY_IRQ_SPURIOUS
117	select ARCH_HAS_CODE_DATA_RELOCATION
118	select ARCH_HAS_THREAD_LOCAL_STORAGE
119	select USE_SWITCH_SUPPORTED
120	select USE_SWITCH
121	select SCHED_IPI_SUPPORTED if SMP
122	select ARCH_HAS_DIRECTED_IPIS
123	select BARRIER_OPERATIONS_BUILTIN
124	select ARCH_HAS_THREAD_PRIV_STACK_SPACE_GET if USERSPACE
125	help
126	  RISCV architecture
127
128config XTENSA
129	bool
130	select ARCH_IS_SET
131	select USE_SWITCH
132	select USE_SWITCH_SUPPORTED
133	select ARCH_HAS_CODE_DATA_RELOCATION
134	select ARCH_HAS_TIMING_FUNCTIONS
135	select ARCH_MEM_DOMAIN_DATA if USERSPACE
136	select ARCH_HAS_DIRECTED_IPIS
137	select THREAD_STACK_INFO
138	select ARCH_HAS_THREAD_PRIV_STACK_SPACE_GET if USERSPACE
139	select ARCH_SUPPORTS_COREDUMP_STACK_PTR if !SMP
140	select ARCH_HAS_USERSPACE if XTENSA_MMU || XTENSA_MPU
141	imply ARCH_HAS_RESERVED_PAGE_FRAMES if XTENSA_MMU
142	help
143	  Xtensa architecture
144
145config ARCH_POSIX
146	bool
147	select ARCH_IS_SET
148	select ATOMIC_OPERATIONS_BUILTIN
149	select ARCH_HAS_CUSTOM_SWAP_TO_MAIN
150	select ARCH_HAS_CUSTOM_BUSY_WAIT
151	select ARCH_HAS_THREAD_ABORT
152	select ARCH_HAS_THREAD_NAME_HOOK
153	select NATIVE_BUILD
154	select HAS_COVERAGE_SUPPORT
155	select BARRIER_OPERATIONS_BUILTIN
156	# POSIX arch based targets get their memory cleared on entry by the host OS
157	select SKIP_BSS_CLEAR
158	help
159	  POSIX (native) architecture
160
161config RX
162	bool
163	select ARCH_IS_SET
164	select ATOMIC_OPERATIONS_C
165	select USE_SWITCH
166	select USE_SWITCH_SUPPORTED
167	help
168	  Renesas RX architecture
169
170config ARCH_IS_SET
171	bool
172	help
173	  Helper symbol to detect SoCs forgetting to select one of the arch
174	  symbols above. See the top-level CMakeLists.txt.
175
176menu "General Architecture Options"
177
178source "arch/common/Kconfig"
179
180module = ARCH
181module-str = arch
182source "subsys/logging/Kconfig.template.log_config"
183
184config BIG_ENDIAN
185	bool
186	help
187	  This option tells the build system that the target system is big-endian.
188	  Little-endian architecture is the default and should leave this option
189	  unselected.  This option is selected by arch/$ARCH/Kconfig,
190	  soc/**/Kconfig, or boards/**/Kconfig and the user should generally avoid
191	  modifying it.  The option is used to select linker script OUTPUT_FORMAT,
192	  the toolchain flags (TOOLCHAIN_C_FLAGS, TOOLCHAIN_LD_FLAGS), and command
193	  line option for gen_isr_tables.py.
194
195config LITTLE_ENDIAN
196	# Hidden Kconfig option representing the default little-endian architecture
197	# This is just the opposite of BIG_ENDIAN and is used for non-negative
198	# conditional compilation
199	bool
200	depends on !BIG_ENDIAN
201	default y
202
203config 64BIT
204	bool
205	help
206	  This option tells the build system that the target system is
207	  using a 64-bit address space, meaning that pointer and long types
208	  are 64 bits wide. This option is selected by arch/$ARCH/Kconfig,
209	  soc/**/Kconfig, or boards/**/Kconfig and the user should generally
210	  avoid modifying it.
211
212# Workaround for not being able to have commas in macro arguments
213DT_CHOSEN_Z_SRAM := zephyr,sram
214
215config SRAM_SIZE
216	int "SRAM Size in kB"
217	default $(dt_chosen_reg_size_int,$(DT_CHOSEN_Z_SRAM),0,K)
218	help
219	  The SRAM size in kB. The default value comes from /chosen/zephyr,sram in
220	  devicetree. The user should generally avoid changing it via menuconfig or
221	  in configuration files.
222
223config SRAM_BASE_ADDRESS
224	hex "SRAM Base Address"
225	default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_SRAM))
226	help
227	  The SRAM base address. The default value comes from
228	  /chosen/zephyr,sram in devicetree. The user should generally avoid
229	  changing it via menuconfig or in configuration files.
230
231config XIP
232	bool "Execute in place"
233	help
234	  This option allows zephyr to operate with its text and read-only
235	  sections residing in ROM (or similar read-only memory). Not all boards
236	  support this option so it must be used with care; you must also
237	  supply a linker command file when building your image. Enabling this
238	  option increases both the code and data footprint of the image.
239
240
241if ARC || ARM || ARM64 || X86 || RISCV || RX || ARCH_POSIX
242
243# Workaround for not being able to have commas in macro arguments
244DT_CHOSEN_Z_FLASH := zephyr,flash
245
246config FLASH_SIZE
247	int "Flash Size in kB"
248	default $(dt_chosen_reg_size_int,$(DT_CHOSEN_Z_FLASH),0,K) if (XIP && (ARM ||ARM64)) || !ARM
249	default 0 if !XIP
250	help
251	  This option specifies the size of the flash in kB.  It is normally set by
252	  the board's defconfig file and the user should generally avoid modifying
253	  it via the menu configuration.
254
255config FLASH_BASE_ADDRESS
256	hex "Flash Base Address"
257	default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_FLASH)) if (XIP && (ARM || ARM64)) || !ARM
258	default 0 if !XIP
259	help
260	  This option specifies the base address of the flash on the board. It is
261	  normally set by the board's defconfig file and the user should generally
262	  avoid modifying it via the menu configuration.
263
264endif # ARM || ARM64 || ARC || X86 || RISCV || RX || ARCH_POSIX
265
266if ARCH_HAS_TRUSTED_EXECUTION
267
268config TRUSTED_EXECUTION_SECURE
269	bool "Trusted Execution: Secure firmware image"
270	help
271	  Select this option to enable building a Secure firmware
272	  image for a platform that supports Trusted Execution. A
273	  Secure firmware image will execute in Secure state. It may
274	  allow the CPU to execute in Non-Secure (Normal) state.
275	  Therefore, a Secure firmware image shall be able to
276	  configure security attributions of CPU resources (memory
277	  areas, peripherals, interrupts, etc.) as well as to handle
278	  faults, related to security violations. It may optionally
279	  allow certain functions to be called from the Non-Secure
280	  (Normal) domain.
281
282config TRUSTED_EXECUTION_NONSECURE
283	depends on !TRUSTED_EXECUTION_SECURE
284	bool "Trusted Execution: Non-Secure firmware image"
285	help
286	  Select this option to enable building a Non-Secure
287	  firmware image for a platform that supports Trusted
288	  Execution. A Non-Secure firmware image will execute
289	  in Non-Secure (Normal) state. Therefore, it shall not
290	  access CPU resources (memory areas, peripherals,
291	  interrupts etc.) belonging to the Secure domain.
292
293endif # ARCH_HAS_TRUSTED_EXECUTION
294
295config HW_STACK_PROTECTION
296	bool "Hardware Stack Protection"
297	depends on ARCH_HAS_STACK_PROTECTION
298	help
299	  Select this option to enable hardware-based platform features to
300	  catch stack overflows when the system is running in privileged
301	  mode. If CONFIG_USERSPACE is not enabled, the system is always
302	  running in privileged mode.
303
304	  Note that this does not necessarily prevent corruption and assertions
305	  about the overall system state when a fault is triggered cannot be
306	  made.
307
308config USERSPACE
309	bool "User mode threads"
310	depends on ARCH_HAS_USERSPACE
311	depends on RUNTIME_ERROR_CHECKS
312	depends on SRAM_REGION_PERMISSIONS
313	select THREAD_STACK_INFO
314	select LINKER_USE_NO_RELAX
315	help
316	  When enabled, threads may be created or dropped down to user mode,
317	  which has significantly restricted permissions and must interact
318	  with the kernel via system calls. See Zephyr documentation for more
319	  details about this feature.
320
321	  If a user thread overflows its stack, this will be caught and the
322	  kernel itself will be shielded from harm. Enabling this option
323	  may or may not catch stack overflows when the system is in
324	  privileged mode or handling a system call; to ensure these are always
325	  caught, enable CONFIG_HW_STACK_PROTECTION.
326
327config NOINIT_SNIPPET_FIRST
328	bool "Place the no-init linker script snippet first"
329	help
330	  By default the include/zephyr/linker/common-noinit.ld file inserts the
331	  snippets-noinit.ld file at the end of the section.  There are times when
332	  the directives in the snippets-noinit.ld file apply to the other directives
333	  in this file.  And in that case the include statement for the snippets-noinit.ld
334	  file needs to come at the start of the section.  This configuration option
335	  allows that to happen.
336
337config PRIVILEGED_STACK_SIZE
338	int "Size of privileged stack"
339	default 2048 if EMUL
340	default 1024
341	depends on USERSPACE
342	help
343	  This option sets the privileged stack region size that will be used
344	  in addition to the user mode thread stack.  During normal execution,
345	  this region will be inaccessible from user mode.  During system calls,
346	  this region will be utilized by the system call. This value must be
347	  a multiple of the minimum stack alignment.
348
349config KOBJECT_TEXT_AREA
350	int "Size of kobject text area"
351	default 1024 if UBSAN
352	default 512 if COVERAGE_GCOV
353	default 512 if NO_OPTIMIZATIONS
354	default 512 if STACK_CANARIES && RISCV
355	default 256
356	depends on USERSPACE
357	help
358	  Size of kernel object text area. Used in linker script.
359
360config KOBJECT_DATA_AREA_RESERVE_EXTRA_PERCENT
361	int "Reserve extra kobject data area (in percentage)"
362	default 100
363	depends on USERSPACE
364	help
365	  Multiplication factor used to calculate the size of placeholder to
366	  reserve space for kobject metadata hash table. The hash table is
367	  generated via gperf is highly dependent on the absolute addresses of
368	  kobjects which might change between prebuilts. To reserve enough
369	  space for the hash table during final linking passes to keep
370	  kobjects in same place, the size of reserved space is calculated
371	  from the first prebuilt plus additional space calculated with
372	  this percentage (of the kobject data area in first prebuilt).
373
374config KOBJECT_RODATA_AREA_EXTRA_BYTES
375	int "Reserve extra bytes for kobject rodata area"
376	default 16
377	depends on USERSPACE
378	help
379	  Reserve a few more bytes for the RODATA region for kobject metadata.
380	  This is to account for the uncertainty of tables generated by gperf.
381
382config GEN_PRIV_STACKS
383	bool
384	help
385	  Selected if the architecture requires that privilege elevation stacks
386	  be allocated in a separate memory area. This is typical of arches
387	  whose MPUs require regions to be power-of-two aligned/sized.
388
389	  FIXME: This should be removed and replaced with checks against
390	  CONFIG_MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT, but both ARM and ARC
391	  changes will be necessary for this.
392
393config STACK_GROWS_UP
394	bool "Stack grows towards higher memory addresses"
395	help
396	  Select this option if the architecture has upward growing thread
397	  stacks. This is not common.
398
399config NO_UNUSED_STACK_INSPECTION
400	bool
401	help
402	  Selected if the architecture will generate a fault if unused stack
403	  memory is examined, which is the region between the current stack
404	  pointer and the deepest available address in the current stack
405	  region.
406
407config MAX_THREAD_BYTES
408	int "Bytes to use when tracking object thread permissions"
409	default 2
410	depends on USERSPACE
411	help
412	  Every kernel object will have an associated bitfield to store
413	  thread permissions for that object. This controls the size of the
414	  bitfield (in bytes) and imposes a limit on how many threads can
415	  be created in the system.
416
417config DYNAMIC_OBJECTS
418	bool "Allow kernel objects to be allocated at runtime"
419	depends on USERSPACE
420	help
421	  Enabling this option allows for kernel objects to be requested from
422	  the calling thread's resource pool, at a slight cost in performance
423	  due to the supplemental run-time tables required to validate such
424	  objects.
425
426	  Objects allocated in this way can be freed with a supervisor-only
427	  API call, or when the number of references to that object drops to
428	  zero.
429
430config NOCACHE_MEMORY
431	bool "Support for uncached memory"
432	depends on ARCH_HAS_NOCACHE_MEMORY_SUPPORT
433	help
434	  Add a "nocache" read-write memory section that is configured to
435	  not be cached. This memory section can be used to perform DMA
436	  transfers when cache coherence issues are not optimal or can not
437	  be solved using cache maintenance operations.
438
439config FRAME_POINTER
440	bool "Compile the kernel with frame pointers"
441	select OVERRIDE_FRAME_POINTER_DEFAULT
442	help
443	  Select Y here to gain precise stack traces at the expense of slightly
444	  increased size and decreased speed.
445
446config ARCH_STACKWALK
447	bool "Compile the stack walking function"
448	default y
449	depends on ARCH_HAS_STACKWALK
450	help
451	  Select Y here to compile the `arch_stack_walk()` function
452
453config ARCH_STACKWALK_MAX_FRAMES
454	int "Max depth for stack walk function"
455	default 8
456	depends on ARCH_STACKWALK
457	help
458	  Depending on implementation, this can place a hard limit on the depths of the stack
459	  for the stack walk function to examine.
460
461menu "Interrupt Configuration"
462
463config TOOLCHAIN_SUPPORTS_ISR_TABLES_LOCAL_DECLARATION
464	bool
465	help
466	  Hidden option to signal that toolchain supports local declaration of
467	  interrupt tables.
468
469config ISR_TABLES_LOCAL_DECLARATION_SUPPORTED
470	bool
471	default y
472	# Userspace is currently not supported
473	depends on !USERSPACE
474	# List of currently supported architectures
475	depends on ARM || ARM64 || RISCV
476	# List of currently supported toolchains
477	depends on "$(ZEPHYR_TOOLCHAIN_VARIANT)" = "zephyr" || "$(ZEPHYR_TOOLCHAIN_VARIANT)" = "gnuarmemb" || "$(ZEPHYR_TOOLCHAIN_VARIANT)" = "llvm" || TOOLCHAIN_SUPPORTS_ISR_TABLES_LOCAL_DECLARATION
478
479config ISR_TABLES_LOCAL_DECLARATION
480	bool "ISR tables created locally and placed by linker"
481	depends on ISR_TABLES_LOCAL_DECLARATION_SUPPORTED
482	help
483	  Enable new scheme of interrupt tables generation.
484	  This is totally different generator that would create tables entries locally
485	  where the IRQ_CONNECT macro is called and then use the linker script to position it
486	  in the right place in memory.
487	  The most important advantage of such approach is that the generated interrupt tables
488	  are LTO compatible.
489	  The drawback is that the support on the architecture port is required.
490
491config DYNAMIC_INTERRUPTS
492	bool "Installation of IRQs at runtime"
493	select SRAM_SW_ISR_TABLE
494	help
495	  Enable installation of interrupts at runtime, which will move some
496	  interrupt-related data structures to RAM instead of ROM, and
497	  on some architectures increase code size.
498
499config SHARED_INTERRUPTS
500	bool "Set this to enable support for shared interrupts"
501	depends on GEN_SW_ISR_TABLE
502	select EXPERIMENTAL
503	help
504	  Set this to enable support for shared interrupts. Use this with
505	  caution as enabling this will increase the image size by a
506	  non-negligible amount.
507
508config SHARED_IRQ_MAX_NUM_CLIENTS
509	int "Maximum number of clients allowed per shared interrupt"
510	default 2
511	depends on SHARED_INTERRUPTS
512	help
513	  This option controls the maximum number of clients allowed
514	  per shared interrupt. Set this according to your needs.
515
516config GEN_ISR_TABLES
517	bool "Use generated IRQ tables"
518	help
519	  This option controls whether a platform uses the gen_isr_tables
520	  script to generate its interrupt tables. This mechanism will create
521	  an appropriate hardware vector table and/or software IRQ table.
522
523config GEN_IRQ_VECTOR_TABLE
524	bool "Generate an interrupt vector table"
525	default y
526	depends on GEN_ISR_TABLES
527	help
528	  This option controls whether a platform using gen_isr_tables
529	  needs an interrupt vector table created. Only disable this if the
530	  platform does not use a vector table at all, or requires the vector
531	  table to be in a format that is not an array of function pointers
532	  indexed by IRQ line. In the latter case, the vector table must be
533	  supplied by the application or architecture code.
534
535config ARCH_IRQ_VECTOR_TABLE_ALIGN
536	int "Alignment size of the interrupt vector table"
537	default 4
538	depends on GEN_IRQ_VECTOR_TABLE
539	help
540	  This option controls alignment size of generated
541	  _irq_vector_table.  Some architecture needs an IRQ vector table
542	  to be aligned to architecture specific size.  The default
543	  size is 0 for no alignment.
544
545config ARCH_DEVICE_STATE_ALIGN
546	int "Alignment size of device state"
547	default 4
548	help
549	  This option controls alignment size of device state.
550
551choice IRQ_VECTOR_TABLE_TYPE
552	prompt "IRQ vector table type"
553	depends on GEN_IRQ_VECTOR_TABLE
554	default IRQ_VECTOR_TABLE_JUMP_BY_CODE if (RISCV && !RISCV_HAS_CLIC)
555	default IRQ_VECTOR_TABLE_JUMP_BY_ADDRESS
556
557config IRQ_VECTOR_TABLE_JUMP_BY_ADDRESS
558	bool "Jump by address"
559	help
560	  The IRQ vector table contains the address of the interrupt handler.
561
562config IRQ_VECTOR_TABLE_JUMP_BY_CODE
563	bool "Jump by code"
564	help
565	  The IRQ vector table contains the opcode of a jump instruction to the
566	  interrupt handler address.
567
568endchoice
569
570config GEN_SW_ISR_TABLE
571	bool "Generate a software ISR table"
572	default y
573	depends on GEN_ISR_TABLES
574	help
575	  This option controls whether a platform using gen_isr_tables
576	  needs a software ISR table table created. This is an array of struct
577	  _isr_table_entry containing the interrupt service routine and supplied
578	  parameter.
579
580config ARCH_SW_ISR_TABLE_ALIGN
581	int "Alignment size of a software ISR table"
582	default 64 if RISCV_HAS_CLIC
583	default 4
584	depends on GEN_SW_ISR_TABLE
585	help
586	  This option controls alignment size of generated
587	  _sw_isr_table.  Some architecture needs a software ISR table
588	  to be aligned to architecture specific size.  The default
589	  size is 4.
590
591config GEN_IRQ_START_VECTOR
592	int
593	default 0
594	depends on GEN_ISR_TABLES
595	help
596	  On some architectures, part of the vector table may be reserved for
597	  system exceptions and is declared separately from the tables
598	  created by gen_isr_tables.py. When creating these tables, this value
599	  will be subtracted from CONFIG_NUM_IRQS to properly size them.
600	  This is a hidden option which needs to be set per architecture and
601	  left alone.
602
603config IRQ_OFFLOAD
604	bool "IRQ offload"
605	depends on TEST
606	help
607	  Enable irq_offload() API which allows functions to be synchronously
608	  run in interrupt context. Only useful for test cases that need
609	  to validate the correctness of kernel objects in IRQ context.
610
611config SRAM_VECTOR_TABLE
612	bool "Place the vector table in SRAM instead of flash"
613	depends on ARCH_HAS_VECTOR_TABLE_RELOCATION
614	depends on XIP
615	depends on !ROMSTART_RELOCATION_ROM
616	help
617	  When XiP is enabled, this option will result in the vector table being
618	  relocated from Flash to SRAM.
619
620config SRAM_SW_ISR_TABLE
621	bool "Place the software ISR table in SRAM instead of flash"
622	help
623	  The option specifies that the software interrupts vector table will be
624	  placed inside SRAM instead of the flash.
625
626config IRQ_OFFLOAD_NESTED
627	bool "irq_offload() supports nested IRQs"
628	depends on IRQ_OFFLOAD
629	default y if ARM64 || X86 || RISCV || XTENSA
630	help
631	  When set by the platform layers, indicates that
632	  irq_offload() may legally be called in interrupt context to
633	  cause a synchronous nested interrupt on the current CPU.
634	  Not all hardware is capable.
635
636config EXCEPTION_DEBUG
637	bool "Unhandled exception debugging"
638	default y
639	depends on PRINTK || LOG
640	help
641	  Install handlers for various CPU exception/trap vectors to
642	  make debugging them easier, at a small expense in code size.
643	  This prints out the specific exception vector and any associated
644	  error codes.
645
646config EXTRA_EXCEPTION_INFO
647	bool "Collect extra exception info"
648	depends on ARCH_HAS_EXTRA_EXCEPTION_INFO
649	help
650	  This option enables the collection of extra information, such as
651	  register state, when a fault occurs. This information can be useful
652	  to collect for post-mortem analysis and debug of issues.
653
654config SIMPLIFIED_EXCEPTION_CODES
655	bool "Convert arch specific exception codes to K_ERR_CPU_EXCEPTION"
656	default y if ZTEST
657	help
658	  The same piece of faulty code (NULL dereference, etc) can result in
659	  a multitude of potential exception codes at the CPU level, depending
660	  upon whether addresses exist, an MPU is configured, the particular
661	  implementation of the CPU or any number of other reasons. Enabling
662	  this option collapses all the architecture specific exception codes
663	  down to the generic K_ERR_CPU_EXCEPTION, which makes testing code
664	  much more portable.
665
666config EMPTY_IRQ_SPURIOUS
667	bool "Create empty spurious interrupt handler"
668	depends on ARCH_SUPPORTS_EMPTY_IRQ_SPURIOUS
669	help
670	  This option changes body of spurious interrupt handler. When enabled,
671	  handler contains only an infinite while loop, when disabled, handler
672	  contains the whole Zephyr fault handling procedure.
673
674endmenu # Interrupt configuration
675
676config INIT_ARCH_HW_AT_BOOT
677	bool "Initialize internal architecture state at boot"
678	depends on ARCH_SUPPORTS_ARCH_HW_INIT
679	help
680	  This option instructs Zephyr to force the initialization
681	  of the internal architectural state (for example ARCH-level
682	  HW registers and system control blocks) during boot to
683	  the reset values as specified by the corresponding
684	  architecture manual. The option is useful when the Zephyr
685	  firmware image is chain-loaded, for example, by a debugger
686	  or a bootloader, and we need to guarantee that the internal
687	  states of the architecture core blocks are restored to the
688	  reset values (as specified by the architecture).
689
690	  Note: the functionality is architecture-specific. For the
691	  implementation details refer to each architecture where
692	  this feature is supported.
693
694endmenu
695
696#
697# Architecture Capabilities
698#
699
700config ARCH_HAS_SINGLE_THREAD_SUPPORT
701	bool
702
703config ARCH_HAS_TIMING_FUNCTIONS
704	bool
705
706config ARCH_HAS_TRUSTED_EXECUTION
707	bool
708
709config ARCH_HAS_STACK_PROTECTION
710	bool
711
712config ARCH_HAS_USERSPACE
713	bool
714
715config ARCH_HAS_EXECUTABLE_PAGE_BIT
716	bool
717
718config ARCH_HAS_NOCACHE_MEMORY_SUPPORT
719	bool
720
721config ARCH_HAS_RAMFUNC_SUPPORT
722	bool
723
724config ARCH_HAS_VECTOR_TABLE_RELOCATION
725	bool
726
727config ARCH_HAS_NESTED_EXCEPTION_DETECTION
728	bool
729
730config ARCH_SUPPORTS_COREDUMP
731	bool
732
733config ARCH_SUPPORTS_COREDUMP_THREADS
734	bool
735
736config ARCH_SUPPORTS_COREDUMP_PRIV_STACKS
737	bool
738
739config ARCH_SUPPORTS_COREDUMP_STACK_PTR
740	bool
741
742config ARCH_SUPPORTS_ARCH_HW_INIT
743	bool
744
745config ARCH_SUPPORTS_ROM_START
746	bool
747
748config ARCH_SUPPORTS_EMPTY_IRQ_SPURIOUS
749	bool
750
751config ARCH_SUPPORTS_EVICTION_TRACKING
752	bool
753	help
754	  Architecture code supports page tracking for eviction algorithms
755	  when demand paging is enabled.
756
757config ARCH_HAS_EXTRA_EXCEPTION_INFO
758	bool
759
760config ARCH_HAS_GDBSTUB
761	bool
762
763config ARCH_HAS_THREAD_LOCAL_STORAGE
764	bool
765
766config ARCH_HAS_SUSPEND_TO_RAM
767	bool
768	help
769	  When selected, the architecture supports suspend-to-RAM (S2RAM).
770
771config ARCH_HAS_STACK_CANARIES_TLS
772	bool
773
774config ARCH_SUPPORTS_MEM_MAPPED_STACKS
775	bool
776	help
777	  Select when the architecture supports memory mapped stacks.
778
779config ARCH_HAS_THREAD_PRIV_STACK_SPACE_GET
780	bool
781	help
782	  Select when the architecture implements arch_thread_priv_stack_space_get().
783
784config ARCH_HAS_HW_SHADOW_STACK
785	bool
786
787#
788# Other architecture related options
789#
790
791config ARCH_HAS_THREAD_ABORT
792	bool
793
794config ARCH_HAS_CODE_DATA_RELOCATION
795	bool
796	help
797	  When selected, the architecture/SoC implements support for
798	  CODE_DATA_RELOCATION in its linker scripts.
799
800#
801# Hidden CPU family configs
802#
803
804config CPU_HAS_TEE
805	bool
806	help
807	  This option is enabled when the CPU has support for Trusted
808	  Execution Environment (e.g. when it has a security attribution
809	  unit).
810
811config CPU_HAS_DCLS
812	bool
813	help
814	  This option is enabled when the processor hardware has support for
815	  Dual-redundant Core Lock-step (DCLS) topology.
816
817config CPU_HAS_FPU
818	bool
819	help
820	  This option is enabled when the CPU has hardware floating point
821	  unit.
822
823config CPU_HAS_DSP
824	bool
825	help
826	  This option is enabled when the CPU has hardware DSP unit.
827
828config CPU_HAS_FPU_DOUBLE_PRECISION
829	bool
830	select CPU_HAS_FPU
831	help
832	  When enabled, this indicates that the CPU has a double floating point
833	  precision unit.
834
835config CPU_HAS_MPU
836	bool
837	help
838	  This option is enabled when the CPU has a Memory Protection Unit (MPU).
839
840config CPU_HAS_MMU
841	bool
842	help
843	  This hidden option is selected when the CPU has a Memory Management Unit
844	  (MMU).
845
846config ARCH_HAS_DEMAND_PAGING
847	bool
848	help
849	  This hidden configuration should be selected by the architecture if
850	  demand paging is supported.
851
852config ARCH_HAS_DEMAND_MAPPING
853	bool
854	help
855	  This hidden configuration should be selected by the architecture if
856	  demand paging is supported and arch_mem_map() supports
857	  K_MEM_MAP_UNPAGED.
858
859config ARCH_HAS_RESERVED_PAGE_FRAMES
860	bool
861	help
862	  This hidden configuration should be selected by the architecture if
863	  certain RAM page frames need to be marked as reserved and never used for
864	  memory mappings. The architecture will need to implement
865	  arch_reserved_pages_update().
866
867config ARCH_HAS_DIRECTED_IPIS
868	bool
869	help
870	  This hidden configuration should be selected by the architecture if
871	  it has an implementation for arch_sched_directed_ipi() which allows
872	  for IPIs to be directed to specific CPUs.
873
874config CPU_HAS_DCACHE
875	bool
876	help
877	  This hidden configuration should be selected when the CPU has a d-cache.
878
879config CPU_CACHE_INCOHERENT
880	bool
881	help
882	  This hidden configuration should be selected when the CPU has
883	  incoherent cache. This applies to intra-CPU multiprocessing
884	  incoherence and makes only sense when MP_MAX_NUM_CPUS > 1.
885
886config CPU_HAS_ICACHE
887	bool
888	help
889	  This hidden configuration should be selected when the CPU has an i-cache.
890
891config ARCH_MAPS_ALL_RAM
892	bool
893	help
894	  This hidden option is selected by the architecture to inform the kernel
895	  that all RAM is mapped at boot, and not just the bounds of the Zephyr image.
896	  If RAM starts at 0x0, the first page must remain un-mapped to catch NULL
897	  pointer dereferences. With this enabled, the kernel will not assume that
898	  virtual memory addresses past the kernel image are available for mappings,
899	  but instead takes into account an entire RAM mapping instead.
900
901	  This is typically set by architectures which need direct access to all memory.
902	  It is the architecture's responsibility to mark reserved memory regions
903	  as such in arch_reserved_pages_update().
904
905	  Although the kernel will not disturb this RAM mapping by re-mapping the associated
906	  virtual addresses elsewhere, this is limited to only management of the
907	  virtual address space. The kernel's page frame ontology will not consider
908	  this mapping at all; non-kernel pages will be considered free (unless marked
909	  as reserved) and K_MEM_PAGE_FRAME_MAPPED will not be set.
910
911config DCLS
912	bool "Processor is configured in DCLS mode"
913	depends on CPU_HAS_DCLS
914	default y
915	help
916	  This option is enabled when the processor hardware is configured in
917	  Dual-redundant Core Lock-step (DCLS) topology. For the processor that
918	  supports DCLS, but is configured in split-lock mode (by default or
919	  changed at flash time), this option should be disabled.
920
921menuconfig MPU
922	bool "MPU features"
923	depends on CPU_HAS_MPU
924	help
925	  This option, when enabled, indicates to the core kernel that an MPU
926	  is enabled.
927
928if MPU
929module = MPU
930module-str = mpu
931source "subsys/logging/Kconfig.template.log_config"
932
933config MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT
934	bool
935	help
936	  This option is enabled when the MPU requires a power of two alignment
937	  and size for MPU regions.
938
939config MPU_REQUIRES_NON_OVERLAPPING_REGIONS
940	bool
941	help
942	  This option is enabled when the MPU requires the active (i.e. enabled)
943	  MPU regions to be non-overlapping with each other.
944
945config MPU_GAP_FILLING
946	bool "Force MPU to be filling in background memory regions"
947	depends on MPU_REQUIRES_NON_OVERLAPPING_REGIONS
948	default y if !USERSPACE
949	help
950	  This Kconfig option instructs the MPU driver to enforce
951	  a full kernel SRAM partitioning, when it programs the
952	  dynamic MPU regions (user thread stack, PRIV stack guard
953	  and application memory domains) during context-switch. We
954	  allow this to be a configurable option, in order to be able
955	  to switch the option off and have an increased number of MPU
956	  regions available for application memory domain programming.
957
958	  Notes:
959	  An increased number of MPU regions should only be required,
960	  when building with USERSPACE support. As a result, when we
961	  build without USERSPACE support, gap filling should always
962	  be required.
963
964	  When the option is switched off, access to memory areas not
965	  covered by explicit MPU regions is restricted to privileged
966	  code on an ARCH-specific basis. Refer to ARCH-specific
967	  documentation for more information on how this option is
968	  used.
969
970endif # MPU
971
972config SRAM_REGION_PERMISSIONS
973	bool "Assign appropriate permissions to kernel areas in SRAM"
974	depends on MMU || MPU
975	default y
976	help
977	  This option indicates that memory protection hardware
978	  is present, enabled, and regions have been configured at boot for memory
979	  ranges within the kernel image.
980
981	  If this option is turned on, certain areas of the kernel image will
982	  have the following access policies applied for all threads, including
983	  supervisor threads:
984
985	  1) All program text will be have read-only, execute memory permission
986	  2) All read-only data will have read-only permission, and execution
987	     disabled if the hardware supports it.
988	  3) All other RAM addresses will have read-write permission, and
989	     execution disabled if the hardware supports it.
990
991	  Options such as USERSPACE or HW_STACK_PROTECTION may additionally
992	  impose additional policies on the memory map, which may be global
993	  or local to the current running thread.
994
995	  This option may consume additional memory to satisfy memory protection
996	  hardware alignment constraints.
997
998	  If this option is disabled, the entire kernel will have default memory
999	  access permissions set, typically read/write/execute. It may be desirable
1000	  to turn this off on MMU systems which are using the MMU for demand
1001	  paging, do not need memory protection, and would rather not use up
1002	  RAM for the alignment between regions.
1003
1004config CODE_DATA_RELOCATION
1005	bool "Support code/data section relocation"
1006	depends on ARCH_HAS_CODE_DATA_RELOCATION
1007	help
1008	  Enable support for relocating .text, data and .bss sections from specified
1009	  files and placing them in a chosen memory region. Files to relocate and
1010	  the target regions should be specified in CMakeLists.txt using
1011	  zephyr_code_relocate().
1012
1013menu "DSP Options"
1014
1015config DSP_SHARING
1016	bool "DSP register sharing"
1017	depends on CPU_HAS_DSP
1018	help
1019	  This option enables preservation of the hardware DSP registers
1020	  across context switches to allow multiple threads to perform concurrent
1021	  DSP operations.
1022endmenu
1023
1024menu "Floating Point Options"
1025
1026config FPU
1027	bool "Floating point unit (FPU)"
1028	depends on CPU_HAS_FPU
1029	help
1030	  This option enables the hardware Floating Point Unit (FPU), in order to
1031	  support using the floating point registers and instructions.
1032
1033	  When this option is enabled, by default, threads may use the floating
1034	  point registers only in an exclusive manner, and this usually means that
1035	  only one thread may perform floating point operations.
1036
1037	  If it is necessary for multiple threads to perform concurrent floating
1038	  point operations, the "FPU register sharing" option must be enabled to
1039	  preserve the floating point registers across context switches.
1040
1041	  Note that this option cannot be selected for the platforms that do not
1042	  include a hardware floating point unit; the floating point support for
1043	  those platforms is dependent on the availability of the toolchain-
1044	  provided software floating point library.
1045
1046config FPU_SHARING
1047	bool "FPU register sharing"
1048	depends on FPU && MULTITHREADING
1049	help
1050	  This option enables preservation of the hardware floating point registers
1051	  across context switches to allow multiple threads to perform concurrent
1052	  floating point operations.
1053
1054	  Note that some compiler configurations may activate a floating point
1055	  context by generating FP instructions for any thread, and that
1056	  context must be preserved when switching such threads in and out.
1057	  The developers can still disable the FP sharing mode in their
1058	  application projects, and switch to Unshared FP registers mode,
1059	  if it is guaranteed that the image code does not generate FP
1060	  instructions outside the single thread context that is allowed
1061	  to do so.
1062
1063endmenu
1064
1065menu "Cache Options"
1066
1067config DCACHE
1068	bool "Data cache (d-cache) support"
1069	depends on CPU_HAS_DCACHE
1070	default y
1071	help
1072	  This option enables the support for the data cache (d-cache).
1073
1074config ICACHE
1075	bool "Instruction cache (i-cache) support"
1076	depends on CPU_HAS_ICACHE
1077	default y
1078	help
1079	  This option enables the support for the instruction cache (i-cache).
1080
1081config CACHE_HAS_MIRRORED_MEMORY_REGIONS
1082	bool "Mirrored memory region(s) for both cached and uncached access"
1083	depends on CPU_CACHE_INCOHERENT
1084	help
1085	  Enable this if hardware has mirrored memory regions at different
1086	  addressed when accessing one would go through cache, but accessing
1087	  the other would go to memory directly. A pointer can be cheaply
1088	  converted to cached or uncached access.
1089
1090	  This applies to intra-CPU multiprocessing incoherence and makes only
1091	  sense when MP_MAX_NUM_CPUS > 1.
1092
1093config CACHE_DOUBLEMAP
1094	bool "Cache double-mapping support"
1095	select CACHE_HAS_MIRRORED_MEMORY_REGIONS
1096	select DEPRECATED
1097	help
1098	  Double-mapping behavior where a pointer can be cheaply converted to
1099	  point to the same cached/uncached memory at different locations.
1100
1101	  This applies to intra-CPU multiprocessing incoherence and makes only
1102	  sense when MP_MAX_NUM_CPUS > 1.
1103
1104config CACHE_MANAGEMENT
1105	bool "Cache management features"
1106	depends on DCACHE || ICACHE
1107	help
1108	  This option enables the cache management functions backed by arch or
1109	  driver code.
1110
1111if CACHE_MANAGEMENT
1112
1113if DCACHE
1114
1115config DCACHE_LINE_SIZE_DETECT
1116	bool "Detect d-cache line size at runtime"
1117	help
1118	  This option enables querying some architecture-specific hardware for
1119	  finding the d-cache line size at the expense of taking more memory and
1120	  code and a slightly increased boot time.
1121
1122	  If the CPU's d-cache line size is known in advance, disable this option and
1123	  manually enter the value for DCACHE_LINE_SIZE or set it in the DT
1124	  using the 'd-cache-line-size' property.
1125
1126config DCACHE_LINE_SIZE
1127	int "d-cache line size"
1128	depends on !DCACHE_LINE_SIZE_DETECT
1129	default $(dt_node_int_prop_int,/cpus/cpu@0,d-cache-line-size) \
1130		  if $(dt_node_has_prop,/cpus/cpu@0,d-cache-line-size)
1131	default 0
1132	help
1133	  Size in bytes of a CPU d-cache line.
1134
1135	  Detect automatically at runtime by selecting DCACHE_LINE_SIZE_DETECT.
1136
1137endif # DCACHE
1138
1139if ICACHE
1140
1141config ICACHE_LINE_SIZE_DETECT
1142	bool "Detect i-cache line size at runtime"
1143	help
1144	  This option enables querying some architecture-specific hardware for
1145	  finding the i-cache line size at the expense of taking more memory and
1146	  code and a slightly increased boot time.
1147
1148	  If the CPU's i-cache line size is known in advance, disable this option and
1149	  manually enter the value for ICACHE_LINE_SIZE or set it in the DT
1150	  using the 'i-cache-line-size' property.
1151
1152config ICACHE_LINE_SIZE
1153	int "i-cache line size"
1154	depends on !ICACHE_LINE_SIZE_DETECT
1155	default $(dt_node_int_prop_int,/cpus/cpu@0,i-cache-line-size) \
1156		  if $(dt_node_has_prop,/cpus/cpu@0,i-cache-line-size)
1157	default 0
1158	help
1159	  Size in bytes of a CPU i-cache line.
1160
1161	  Detect automatically at runtime by selecting ICACHE_LINE_SIZE_DETECT.
1162
1163endif # ICACHE
1164
1165choice CACHE_TYPE
1166	prompt "Cache type"
1167	default ARCH_CACHE
1168
1169config ARCH_CACHE
1170	bool "Integrated cache controller"
1171	help
1172	  Integrated on-core cache controller
1173
1174config SOC_CACHE
1175	bool "SoC specific cache controller"
1176	depends on SOC_HAS_CACHE_FUNCTIONS
1177	help
1178	  SoC specific cache controller.
1179
1180	  This requires soc_cache.h file to exist in search path.
1181
1182config EXTERNAL_CACHE
1183	bool "External cache controller"
1184	help
1185	  External cache controller
1186
1187endchoice
1188
1189config CACHE_CAN_SAY_MEM_COHERENCE
1190	bool
1191	help
1192	  sys_cache_is_mem_coherent() is defined when enabled. This function can be
1193	  used to determine if a pointer lies inside "coherence regions" and can be
1194	  safely used in multiprocessor code without explicit flush or invalidate
1195	  operations.
1196
1197endif # CACHE_MANAGEMENT
1198
1199endmenu
1200
1201config ARCH
1202	string
1203	help
1204	  System architecture string.
1205
1206config TOOLCHAIN_HAS_BUILTIN_FFS
1207	bool
1208	default y if !(64BIT && RISCV)
1209	help
1210	  Hidden option to signal that toolchain has __builtin_ffs*().
1211
1212config ARCH_HAS_CUSTOM_CPU_IDLE
1213	bool
1214	help
1215	  This options allows applications to override the default arch idle implementation with
1216	  a custom one.
1217
1218config ARCH_HAS_CUSTOM_CPU_ATOMIC_IDLE
1219	bool
1220	help
1221	  This options allows applications to override the default arch idle implementation with
1222	  a custom one.
1223
1224config ARCH_HAS_CUSTOM_SWAP_TO_MAIN
1225	bool
1226	help
1227	  It's possible that an architecture port cannot use z_swap_unlocked()
1228	  to swap to the main thread (bg_thread_main), but instead must do
1229	  something custom. It must enable this option in that case.
1230
1231config ARCH_HAS_CUSTOM_BUSY_WAIT
1232	bool
1233	help
1234	  It's possible that an architecture port cannot or does not want to use
1235	  the provided k_busy_wait(), but instead must do something custom. It must
1236	  enable this option in that case.
1237
1238config ARCH_HAS_CUSTOM_CURRENT_IMPL
1239	bool
1240	help
1241	  Select when architecture implements arch_current_thread() &
1242	  arch_current_thread_set().
1243
1244config ARCH_IPI_LAZY_COPROCESSORS_SAVE
1245	bool
1246	help
1247	  Select when the architecture has multi-CPU lazy context switching
1248	  of coprocessor registers.
1249