Commit graph

6,063 commits

Author SHA1 Message Date
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
Peter Mitsis
2f2eaf7b6f arch: xtensa: Update arch_user_string_nlen()
When calling device_get_binding(NULL) from userspace, this eventually
funnels down to a call to arch_user_string_nlen() where it tried to
verify that the kernel has access to this address (0x0).  But since
this originates from userspace, we really want to know if this is
accessible from userspace, so using arch_buffer_validate() instead
of xtensa_mem_kernel_has_access() is preferable.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2025-06-19 00:03:00 +02:00
Peter Mitsis
dde9462666 arch: tweak xtensa_mem_kernel_has_access() API
Adds 'const' to address pointer as its memory contents
do not change.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2025-06-19 00:03:00 +02:00
Anas Nashif
9dc30f8dec x86: mmu: add missing break statement in flags_to_entry function
Add missing break in switch statement.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-06-18 17:48:03 -04:00
Anas Nashif
0ca2a9ed4c arch: x86: multiboot: add a break in default switch case
Add missing break in switch statement.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-06-18 17:48:03 -04:00
urvashi sharma
9cef24bc62 Arch: Arm: SMP: Boot & Voting Refactor
Support booting from any usable core in systems with partially
fused-off CPUs. Update get_cpu_logic_id to iterate over the actual
number of enabled CPUs using DT_CHILD_NUM_STATUS_OKAY(DT_PATH(cpus))
instead of CONFIG_MP_MAX_NUM_CPUS.

Resize the voting[] array based on DT_CHILD_NUM_STATUS_OKAY to ensure
each CPU can vote correctly.

Signed-off-by: urvashi sharma <urvashis@qti.qualcomm.com>
2025-06-18 07:36:34 +02:00
Daniel Leung
917bc51d2d xtensa: gdbstub: add arch_gdb_post_memory_write()
This adds arch_gdb_post_memory_write() to deal with caching
after GDB writing to memory.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2025-06-17 16:27:27 -05:00
Daniel Leung
733305293a xtensa: gdbstub: fix backtracing and stack unwinding
This fixes GDB backtracing by forcibly spilling all registers,
and faking values for WINDOWSTART and WINDOWBASE. This is
effectively telling GDB that only A0-A3 and AR0-AR3 contain
active data and other physical registers do not. GDB then must
rely on spilled values on stack. Otherwise, GDB will try to
look at all AR* registers for previous frame(s). Since we
do not save all AR* register values, there is nothing for GDB
to look at, and thus failing to unwind stack.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2025-06-17 16:27:27 -05:00
Daniel Leung
c7841ce472 xtensa: gdbstub: fix compiler warning about discarding const
Inside copy_to_ctx(), we are typecasting the stack pointer into
a 32-bit array pointer, and there was unbalanced const between
two sides. Since we should not be modifying anything inside
that array, add const to the 32-bit array pointer too. So now
the compiler will not complain about discarding the const
qualifier.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2025-06-17 16:27:27 -05:00
Daniel Leung
d00095c4a6 xtensa: fix num_high_regs calculation when dumping stack
The calculation of number of high registers is not entirely
correct. We need to get past the pointer to BSA in the stack
frame before reaching the high registers. The location address
difference between the BSA and start of high registers then
can be used to calculate how many high registers in the stack
frame. So correct the start location of high registers in
the calculation as it was incorrect before. Though the result
would be the same as further divisions would mask this error.
However, it is better to correct this for readability.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2025-06-17 16:27:27 -05:00
Guennadi Liakhovetski
53a179ac4e llext: make unresolved symbol errors fatal
With experience it becomes clear, that failing to resolve symbols
during the linking process is likely fatal for the module loading and
a simple warning isn't enough. Fail loading instead.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2025-06-17 16:09:50 +02:00
Keith Packard
513e6ed5d2 arch/common: Mark interrupt tables const when !DYNAMIC_INTERRUPTS
When not using dynamic interrupt mapping, various interrupt tables are
configured to be stored in read-only memory in the linker script.. Mark
them const so that the linker doesn't complain.

This affects _sw_isr_table, _irq_vector_table, and z_shared_sw_isr_table in
arch/common along with _VectorTable in arch/arc.

Signed-off-by: Keith Packard <keithp@keithp.com>
2025-06-10 22:13:09 +02:00
Tom Hughes
6f433a93ab arch: riscv: core: Add support for CONFIG_ISR_TABLES_LOCAL_DECLARATION
Adjust the linker scripts to use the same setup as ARM for
CONFIG_ISR_TABLES_LOCAL_DECLARATION.

Signed-off-by: Tom Hughes <tomhughes@chromium.org>
2025-06-10 08:47:51 +02:00
Al Semjonovs
452fe47765 arch: Add config for downstream toolchains to support local ISR tables
Add config for local toolchains to indicate support for local
declaration of ISR tables.

Signed-off-by: Al Semjonovs <asemjonovs@google.com>
2025-06-09 15:04:25 -07:00
Julien Racki
31460e667a arch: arm: clear r7 to match aarch64 smp implementation
move mov r7, #0 to use it on both branches as aarch64
implementation uses wzr which returns 0 on read
but r7 might have an undefined value after a reset.

Signed-off-by: Julien Racki <julien.racki@st.com>
2025-06-09 14:28:50 -07:00
Carles Cufi
dc006e6b5f arch: arm: cortex-m: Reduce ZLI latency by not disabling them in wrapper
The difference between __irq_disable() and irq_lock() is that the former
essentially translates to `cpsid i`, whereas `irq_lock()` translates to
setting BASEPRI (on cores with BASEPRI). This means that using
irq_lock() does not disable zero-latency interrupts (ZLIs), which
reduces the potential execution latency of ZLIs.

In both isr_wrapper and _arch_isr_direct_pm() (which is just
really an implementation of ISR_DIRECT_PM()), we were using
__irq_disable() to disable all interrups, including ZLIs. But the code
executed with interrupts disabled handles waking up from idle, and so
must only be protected against regular interrupts being executed, not
ZLIs, which should have no effect on the correct execution of the code.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2025-06-06 20:11:18 +01:00
Benjamin Cabé
a89c79275f scripts: hwm_v2: add full_name property for archs
Allow to specify a human readable full name for archs that can then be
leveraged e.g. in the documentation.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-06 10:29:44 +02:00
Tom Hughes
d66f081f06 arch: riscv: core: Fix type
riscv_cpu_wake_flag and riscv_cpu_sp are variables, not functions, so
they should use the GDATA macro instead of the GTEXT macro. Otherwise,
the linker will warn when LTO is enabled:

ld.bfd: warning: type of symbol `riscv_cpu_wake_flag' changed from 2 to
1 in /tmp/cc39w5oK.ltrans0.ltrans.o
ld.bfd: warning: type of symbol `riscv_cpu_sp' changed from 2 to 1 in
/tmp/cc39w5oK.ltrans0.ltrans.o

Signed-off-by: Tom Hughes <tomhughes@chromium.org>
2025-06-05 12:33:47 +02:00
Jiafei Pan
d1b9b06b54 arm64: reset: flush D-Cache before it is disabled
In the commit 573a712bed patch "arm64:
reset: disable cache and MMU for safety", it disables D-Cache and MMU
for safety, but in some cases, for example the code is loaded into memory
by hardware debugger, we need to flush D-Cache before disable it in
order to make sure the data is coherent in the system, otherwise it
will report "Synchronous Abort" when D-Cache is disabled.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
2025-06-04 16:59:43 +02:00
Jiafei Pan
ad0dfc5df8 Revert "arm64: reset: disable cache and MMU for safety"
This reverts commit 573a712bed.

The original patch disable cache and MMU, but in some cases, for example
the code is loaded into memory by hardware debugger, we need to flush
D-Cache before disable it in order to make sure the data is coherent
in the system, otherwise it will report "Synchronous Abort" when D-Cache
is disabled.

This patch revert the old one and the following patch will flush
the cache before disable it.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
2025-06-04 16:59:43 +02:00
Jiafei Pan
abcdb18568 arch: arm64: cache: optionally enable APIs for operation all dcache
Added new configuration item to optionally enable APIs for operation
all data cache, by default these APIs are disabled.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
2025-06-04 16:59:43 +02:00
Tom Hughes
60045b5ee0 arch: Add LLVM toolchain to ISR_TABLES_LOCAL_DECLARATION_SUPPORTED
The LLVM toolchain can also compile this code.

Signed-off-by: Tom Hughes <tomhughes@chromium.org>
2025-06-04 08:46:35 +02:00
Dawid Niedzwiecki
968dcc9fda arch: riscv: guard some funcions
Guard some functions with ifdefs to avoid unused function
compilation errors.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2025-06-02 13:29:30 +02:00
Mathieu Choplain
c8c0c294b1 arch: arm: cortex_a_r: use correct name for TLB Conflict Abort
Commit 87719828ac introduced FSR definitions
for ARMv7-A/R; however, the value 16 which is documented in the ARM[1] as
a "TLB Conflict Abort", was introduced as "TLB Conflict Fault" instead and
described as a "Table Conflict Fault".

Update all affected files to use the ARM's naming for this error instead.

[1] Architecture Reference Manual (Document ID: ARM DDI 0406C.d)
    "ARM Architecture Reference Manual for ARMv7-A and ARMv7-R Edition"

Signed-off-by: Mathieu Choplain <mathieu.choplain@st.com>
2025-05-31 07:01:36 -04:00
Sudan Landge
35b5fb3bd6 arch: arm: cortex_m: Add support for PACBTI flags
Introduce a Kconfig choice to select Pointer Authentication and Branch
Target Identification (PACBTI) features on Armv8.1-M Mainline CPUs.
The available options map to supported `-mbranch-protection` levels
(`standard`, `pac-ret`, `bti`, and combinations) documented at
https://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html
These options enable hardware-assisted control-flow integrity mechanisms on
targets like Cortex-M85, and require a toolchain with PACBTI support, such
as GCC 14.2 or newer.

Signed-off-by: Sudan Landge <sudan.landge@arm.com>
2025-05-31 06:55:18 -04:00
Manuel Argüelles
63ebf4d23f Revert "arch: arm: mpu: fix erratum 1013783-B"
This reverts commit 983b1d088c.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2025-05-31 05:57:18 -04:00
Ederson de Souza
923fedb429 arch/x86/core: Use CONFIG_QEMU_TARGET for QEMU specific code
Instead of both checking CONFIG_BOARD_QEMU_X86 and
CONFIG_BOARD_QEMU_X86_64, simply check for CONFIG_QEMU_TARGET.

This also helps qemu_x86_tiny, qemu_x86_lakemont and any
future/downstream QEMU targets to keep things simple.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2025-05-31 05:55:41 -04:00
Hake Huang
8e2c053cd1 linker: device_state : add alignment setting
the device_state need realocate when boot as second core.
as the relocation does not know the alignment, this could
be a case that the next data is mis-place after relocation.

fix this by add a alignment in device_state section.

still need revert aec0355380
reported in #86871

fixes: #82841

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2025-05-29 20:22:57 -04:00
Manuel Argüelles
983b1d088c arch: arm: mpu: fix erratum 1013783-B
Due to erratum 1013783-B, speculative accesses might be performed
to normal memory unmapped in the MPU. This can be avoided by using
MPU region 0 to cover all unmapped memory and make this region
execute-never and inaccessible.

Note that this applies when CPU Cortex-M7 implements MPU and D-cache.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2025-05-29 20:17:14 +02:00
Daniel Leung
d31ee53b60 xtensa: allow flushing auto-refill DTLBs on page table swap
This adds a new kconfig and corresponding code to allow flushing
auto-refill data TLBs when page tables are swapped (e.g. during
context switching). This is mainly used to avoid multi-hit TLB
exception raised by certain memory access pattern. If memory is
only marked for user mode access but not inside a memory domain,
accessing that page in kernel mode would result in a TLB being
filled with kernel ASID. When going back into user mode, access
to the memory would result in another TLB being filled with
the user mode ASID. Now there are two entries on the same memory
page, and the multi-hit TLB exception will be raised if that
memory page is accessed. This type of access is better served
using memory partition and memory domain to share data. However,
this type of access is not prohibited but highly discouraged.
Wrapping the code in kconfig is simply because of the execution
penalty as there will be unnecessary TLB refilling being done.
So only enable this if necessary.

Fixes #88772

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2025-05-28 20:01:58 +02:00
Anas Nashif
dd56691227 arc: prep_c: remove dead code
Remove commented code enclosed in if(0) {}.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-05-28 11:09:21 +02:00