Commit Graph

5943 Commits

Author SHA1 Message Date
Peter Mitsis
e50851d476 arch: xtensa: Add support for lazy HiFi ctx switching
When lazy HiFi context switching is enabled, the system starts with
the HiFi coprocessor disabled. Should the thread use that coprocessor,
it will generate an exception which in turn will enable the coprocessor
and save/restore the HiFi registers as appropriate. When switching
to a new thread, the HiFi coprocessor is again disabled.

For simplicity, there are no restrictions as to which thread is allowed
to use the coprocessor.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2025-07-20 12:25:17 -04:00
Peter Mitsis
d397a91c62 kernel: Add arch_coprocessors_disable()
The intent of arch_coprocessors_disable() is to replace
arch_float_disable() in halt_thread() for the FPU will not
always be the only coprocessor that will need to be disabled.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2025-07-20 12:25:17 -04:00
Peter Mitsis
6505cf2e54 arch: xtensa: Carve space for saved HiFi regs
As the BSA can not be used when lazy HiFi context switching is
used, a more permanent and predictable location in which to store
the registers is required. To this end ...
  1. reserve some space in the arch-specific portion of the k_thread
     structure for those registers.
  2. clear that region when the thread is created.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2025-07-20 12:25:17 -04:00
Peter Mitsis
cd351208d5 arch: xtensa: Refine HiFi sharing Kconfigs
Splits HiFi sharing into two different models.
 1. XTENSA_EAGER_HIFI_SHARING - unconditional save/restore
    of the HiFi registers when context switching
 2. XTENSA_LAZY_HIFI_SHARING - on demand save/restore of
    of the HiFi registers. If a thread does not use the
    HiFi registers, they are neither saved nor restored.

To maintain backwards compatibility, the eager model is the
default model when XTENSA_HIFI_SHARING is enabled.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2025-07-20 12:25:17 -04:00
Anas Nashif
0a4e27c45f xtensa: use EXCEPTION_DUMP macro for fatal messages
instead of depending on logging for exceptions and fatal messages, use
macro and dump exceptions if printk is enable with no logging.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-07-19 15:49:28 -04:00
Anas Nashif
2b93450b59 sparc: use EXCEPTION_DUMP macro for fatal messages
instead of depending on logging for exceptions and fatal messages, use
macro and dump exceptions if printk is enable with no logging.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-07-19 15:49:28 -04:00
Anas Nashif
9a7b28bc23 rx: use EXCEPTION_DUMP macro for fatal messages
instead of depending on logging for exceptions and fatal messages, use
macro and dump exceptions if printk is enable with no logging.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-07-19 15:49:28 -04:00
Anas Nashif
effa4bb217 riscv: use EXCEPTION_DUMP macro for fatal messages
instead of depending on logging for exceptions and fatal messages, use
macro and dump exceptions if printk is enable with no logging.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-07-19 15:49:28 -04:00
Anas Nashif
450f0bba7a mips: use EXCEPTION_DUMP macro for fatal messages
instead of depending on logging for exceptions and fatal messages, use
macro and dump exceptions if printk is enable with no logging.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-07-19 15:49:28 -04:00
Anas Nashif
fbb701371d x86: use EXCEPTION_DUMP macro for fatal messages
instead of depending on logging for exceptions and fatal messages, use
macro and dump exceptions if printk is enable with no logging.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-07-19 15:49:28 -04:00
Anas Nashif
2463996105 arm64: use EXCEPTION_DUMP macro for fatal messages
instead of depending on logging for exceptions and fatal messages, use
macro and dump exceptions if printk is enable with no logging.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-07-19 15:49:28 -04:00
Anas Nashif
9867c0979c arm: use EXCEPTION_DUMP macro for fatal messages
instead of depending on logging for exceptions and fatal messages, use
macro and dump exceptions if printk is enable with no logging.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-07-19 15:49:28 -04:00
Anas Nashif
89261db819 arch: arc: use common exception printing macros
ARC was using this method already in a custom way and was different from
all other architectures, lets make this generic.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-07-19 15:49:28 -04:00
Anas Nashif
81fe171ce7 arch: unify how we include exception.h
Just include <zephyr/arch/exception.h> in architecture code. The file
redirects to the correct implementation.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-07-19 15:49:28 -04:00
Stephanos Ioannidis
dc3c9f3560 arch: riscv: Introduce code model options
This commit introduces a new Kconfig choice for configuring the code model
used for compilation.

All three code models specified by the RISC-V ELF psABI specification are
supported: medlow, medany and large.

For RV32, the `medlow` code model is always selected.
For RV64, the `large` code model is selected if the SRAM or kernel VM base
address is greater than or equal to 4 GiB; otherwise, the `medany` code
model is selected.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2025-07-19 15:43:09 -04:00
Stephanos Ioannidis
f5000936a8 arch: riscv: Add Zicntr extension support
This commit introduces the support for the standard Zicntr extension, which
provides hardware counters.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2025-07-19 15:42:57 -04:00
Stephanos Ioannidis
58a6a696a0 arch: riscv: Add Zc* compressed instruction extension support
This commit adds the support for the following new Zc* series compressed
instruction extensions:

  Zca  - Subset of the C extension without FP loads and stores
  Zcb  - "Simple" instructions
  Zcd  - Double-precision floating-point instructions
  Zcf  - Single-precision floating-point instructions
  Zcmp - "Complex" instructions for embedded CPUs
  Zcmt - Table jump instructions for embedded CPUs

With the introduction of the Zc* extensions, the C extension now implies
the following Zc* extensions:

  * Zca, always
  * Zcf if F is specified (RV32 only)
  * Zcd if D is specified

The Zc* extensions that are implied by the C extension are not specified in
the GCC `-march` flag because they are redundant and can interfere with the
resolution of the correct multi-lib for the selected architecture unless
the the alternate mappings for the redundant forms are manually specified.

All the implementation details in this commit are based on the Zc* v1.0.0
specification, which is the ratified version.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2025-07-19 15:32:35 -04:00
Daniel DeGrasse
7b4d2759bf arch: arc: support CONFIG_ROM_START_OFFSET
Add support for CONFIG_ROM_START_OFFSET on ARC processors. Note that the
arc ISA requires vector table offset to be at a 1024 KiB boundary, so
the default ROM_START_OFFSET when using MCUBoot must be increased.

Signed-off-by: Daniel DeGrasse <ddegrasse@tenstorrent.com>
2025-07-19 15:32:03 -04:00
Daniel DeGrasse
e22166f50b arch: common: add CONFIG_ARCH_SUPPORTS_ROM_OFFSET
Add CONFIG_ARCH_SUPPORTS_ROM_OFFSET, a convenience Kconfig to indicate
that CONFIG_ROM_START_OFFSET is supported on this architecture

Signed-off-by: Daniel DeGrasse <ddegrasse@tenstorrent.com>
2025-07-19 15:32:03 -04:00
Michele Sardo
5981dc8ee1 arch: arm: cortex_m: Modifed FPU save and restore helpers
z_arm_save_fp_context and z_arm_restore_fp_context
save and restore fpu context regardless of the
CONFIG_FPU_SHARING setting.

This modification is required to support suspend to ram use cases
where save and restore of FPU state is needed to ensure proper bahaviour
after wakeup.

Signed-off-by: Michele Sardo <michele.sardo@st.com>
2025-07-19 13:45:07 -04:00
Yanir Levin
6df14b432e arc: cache: Support region operations, SLC, and entire cache operations
Added configurable support for L1 cache region operations,
which offers improved performance over line operations.
Added configurable support for SLC (system level cache).
Added support for entire cache operations: flush_all,
invd_all, flush_and_invd_all.

Reviewed-by: Aaron Komisar <aaron.komisar@tandemg.com>
Signed-off-by: Yanir Levin <ylevin@gsitechnology.com>
2025-07-19 09:42:20 +02:00
Alberto Escolar Piedras
e150ffb92c arch/posix: Remove support for CONFIG_NATIVE_APPLICATION
CONFIG_NATIVE_APPLICATION, which represents the way in which
native_posix and its kin were built, was deprecated in 4.1 after the
introduction of native_sim and CONFIG_NATIVE_LIBRARY.

We remove support for it now for 4.3.

Let's remove the architecture layer adaptation code and cmake support.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-07-19 09:38:15 +02:00
Gaetan Perrot
3962dab707 arch: arm64: core: fpu: mark unused function argument
Use ARG_UNUSED() to mark unused function argument.

Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
2025-07-11 08:18:43 -10:00
Gaetan Perrot
92826ff312 arch: arm64: core: fatal: mark unused function argument
Use ARG_UNUSED() to mark unused function argument.

Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
2025-07-11 08:18:29 -10:00
Gaetan Perrot
503011d0a2 arch: arm: core: cortex_a_r: mark unused function argument
Use ARG_UNUSED() to mark unused function argument.

Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
2025-07-09 00:26:17 -05:00
Gaetan Perrot
3aa477ba2e arch: arm: core: cortex_a_r: mark unused function argument
Use ARG_UNUSED() to mark unused function argument.

Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
2025-07-09 00:25:52 -05:00
Gaetan Perrot
3e9eea2cc1 arch: arm: core: cortex_m: mark unused function argument
Use ARG_UNUSED() to mark unused function argument.

Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
2025-07-08 18:35:14 -05:00
Gaetan Perrot
eb7fe02aac arch: arm: core: elf: mark unused function argument
Use ARG_UNUSED() to mark unused function argument.

Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
2025-07-08 18:35:00 -05:00
Gaetan Perrot
a4fc6723ac arch: arm: core: cortex_m: mark unused function argument
Use ARG_UNUSED() to mark unused function argument.

Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
2025-07-08 18:34:49 -05:00
Anas Nashif
7f282f7928 xtensa: tracing: instrument thread switching
Add missing call to thread_switched_in for the purpose of tracing.

Fixes zephyrproject-rtos/zephyr#76057

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-07-08 18:34:11 -05:00
Stephanos Ioannidis
d7d3ae5c3b arch: arm: cortex_m: Force literal pool placement in inline asm block
When LTO is enabled, linker may relocate literal pools out of Thumb LDR
instruction's reach causing "offset out of range" errors while linking.

This commit adds `.ltorg` directive in the inline asm blocks where absolute
addresses are loaded using the `ldr` instructions, in order to ensure that
the literal pool containing the absolute addresses are placed near the
`ldr` instructions.

Note that the `.ltorg` directive is recognised by all toolchains supported
by Zephyr and no toolchain abstraction is provided for now.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2025-07-07 10:13:06 -05:00
Pisit Sawangvonganan
a163f9db61 kconfig: fix typo in (arch, boards, kernel, modules, samples, share)
Utilize a code spell-checking tool to scan for and correct spelling errors
in `Kconfig` files within the `arch`, `boards`, `kernel`, `modules`,
`samples`, and `share` directory.
Additionally, incorporates a fix recommended by the reviewer.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2025-07-01 10:58:54 -10:00
Stephanos Ioannidis
d0bded3c8c arch: riscv: Fix incorrect Zalrsc extension name
`Zlrsc` is not a thing and the correct name for it is `Zalrsc`.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2025-07-01 10:18:19 -05:00
Gaetan Perrot
239007632c arch: common: update RISC-V semihosting spec link
Replace dead link in arch/common/Kconfig.

Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
2025-07-01 10:15:32 -05:00
Daniel Leung
a9574c17ae xtensa: gdbstub: fix code stepping
The ICOUNTLEVEL register needs to be manipulated carefully
according to where we want to stop.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2025-06-30 15:19:59 -05:00
Fin Maaß
514258aa23 riscv: select ATOMIC_OPERATIONS based on RISCV_ISA_EXT_A
use RISCV_ISA_EXT_A to select ATOMIC_OPERATIONS_BUILTIN or
ATOMIC_OPERATIONS_C.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-06-30 15:17:47 -05:00
William Tambe
abeccfec28 xtensa: support for more than 32 interrupts
This change add support for using more than 32 interrupts.

Signed-off-by: William Tambe <williamt@cadence.com>
2025-06-27 08:59:56 -10:00
Simon Maurer
fc3cdb8a67 soc: xlnx: zynq7000: remove FPU FMAC support
Floating-Point System ID register (FPSID)        = 0x41033094
AArch32 Media and VFP Feature Register 0 (MVFR0) = 0x10110222
AArch32 Media and VFP Feature Register 0 (MVFR1) =  0x1111111

MVFR1 SIMDFMAC, bits [31:28] = 0; FMAC is not supported

Signed-off-by: Simon Maurer <mail@maurer.systems>
2025-06-27 09:50:43 -05:00
Simon Maurer
cb982d16ef soc: xlnx: zynq7000: add FPU support
According to its datasheet the Zynq 7000 has a VFPv3 FPU

Signed-off-by: Simon Maurer <mail@maurer.systems>
2025-06-27 09:50:43 -05:00
Duy Nguyen
d18f879566 include: arch: rx: Change data symbol name
The RX linker is using the name "data" for .data region start
which caused the application cannot use "data" for variable
naming globally.
This commit change the name to "__data_region_start" as expected
in the linker_defs.h file

Signed-off-by: Duy Nguyen <duy.nguyen.xa@renesas.com>
2025-06-26 14:07:03 +02:00
Duy Nguyen
8f93f8cd1e arch: rx: Add simple sys_arch_reboot for RX architecture
Add simple sys_arch_reboot for RX architecture to conduct CI

Signed-off-by: Duy Nguyen <duy.nguyen.xa@renesas.com>
2025-06-26 14:07:03 +02:00
Duy Nguyen
2a332517c1 arch: rx: Add ARCH_EXCEPT for RX architect
Adding ARCH_EXCEPT for RX architect by using unconditional
trap interrupt no 3.

Signed-off-by: Duy Nguyen <duy.nguyen.xa@renesas.com>
2025-06-26 14:07:03 +02:00
Guennadi Liakhovetski
b8a2eef2ef xtensa: gdbstub: update comments
Update a comment about GDB use of register index and "regno"
parameters. Only some GDB versions use "idx" instead of "regno."

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2025-06-23 12:32:44 -07:00
Noah Klayman
28e2b50aff xtensa: gdbstub: fix unavailable register reporting
To report unavailable registers to the GDB client, the GDB stub has
to return a string like "xx" in the value string.

Signed-off-by: Noah Klayman <noah.klayman@intel.com>
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2025-06-23 12:32:44 -07:00
Guennadi Liakhovetski
1df49e9691 xtensa: gdbstub: (cosmetic) simplify a conditional
Move an assignment performed on both "if" branches as the last
operation to after the "if."

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2025-06-23 12:32:44 -07:00
Benjamin Cabé
fff5b49581 arch: arc: replace "master"/"slave" terminology with inclusive language
As per Zephyr guidelines regarding the use of inclusive language, apply
the following replacements:

- s/master/primary/g
- s/slave/secondary/g

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-23 13:43:36 +02:00
Benjamin Cabé
8b919042f5 arch: arm64: replace "master" terminology with "primary"
Use inclusive language for referring to primary core

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-23 13:43:08 +02:00
Anas Nashif
bd8597c9d7 x86: rename DEBUG_INFO to X86_DEBUG_INFO
This is an X86 specific option and should not appear as generic debug
option.

Fixes zephyrproject-rtos/zephyr#52929

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-06-20 14:43:42 -05:00
Tahsin Mutlugun
784b3d6ea0 arch: xtensa: Add semihosting support
Add semihosting support for Xtensa architecture.

Existing semihosting instructions are based on ARM, so they are
converted to Xtensa codes before the semihosting call is invoked.

Return codes of read, write and seek calls had to be converted to match
semihosting API definitions.

Signed-off-by: Tahsin Mutlugun <Tahsin.Mutlugun@analog.com>
2025-06-19 09:36:42 +02:00
Tahsin Mutlugun
38d0300035 arch: common: semihost: Move semihost structs into a separate header
Move semihost_x_args structs to include/semihost_types.h so that
semihost implementations can access their elements if needed.

Signed-off-by: Tahsin Mutlugun <Tahsin.Mutlugun@analog.com>
2025-06-19 09:36:42 +02:00