Commit graph

126,787 commits

Author SHA1 Message Date
cyliang tw
f33104e014 dts: arm: nuvoton: add support for m5531h2l
Add m5531h2l.dtsi to support chip m5531h2l of m55m1x SoC series.

Signed-off-by: cyliang tw <cyliang@nuvoton.com>
2025-09-02 12:33:43 +02:00
Emil Gydesen
600010cf5f Bluetooth: BAP: Switch to new USB stack for BAP shell
Modify the BAP shell to use the new USB stack, as the current
one used is now deprecated.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-09-02 12:33:11 +02:00
Qiankun Li
287d3a142c samples: net: wifi: Add apsta_mode configurations for rw612.
Add more apsta_mode configurations for frdm_rw612
and rd_rw612_bga.

Add overlay file to set apsta_mode configurations.

Signed-off-by: Qiankun Li <qiankun.li@nxp.com>
2025-09-02 12:33:01 +02:00
Qiankun Li
433adcff3d samples: net: wifi: Enable apsta_mode macros in *.conf file.
Update *.conf to enable apsta_mode macros
without impacting origin boards support.

Signed-off-by: Qiankun Li <qiankun.li@nxp.com>
2025-09-02 12:33:01 +02:00
Qiankun Li
a4000c60a9 samples: net: wifi: Add new Kconfig for apsta_mode
Introduce a dedicated Kconfig option for apsta_mode example to
allow more flexible configuration in the application layer.
This change helps make apsta_mode more generic and easier to
integrate across different vendor platforms.

Add compile-time assertions for the following macros:
CONFIG_WIFI_SAMPLE_AP_SSID
CONFIG_WIFI_SAMPLE_SSID
CONFIG_WIFI_SAMPLE_AP_IP_ADDRESS
CONFIG_WIFI_SAMPLE_AP_NETMASK

Default to empty string ("") if the following
two macros are not defined:
CONFIG_WIFI_SAMPLE_AP_PSK
CONFIG_WIFI_SAMPLE_PSK

Signed-off-by: Qiankun Li <qiankun.li@nxp.com>
2025-09-02 12:33:01 +02:00
Qiankun Li
e045e397e1 drivers: wifi: nxp: Set default bandwidth for softap
When params->bandwidth is 0, set it
as a default value(WIFI_FREQ_BANDWIDTH_20MHZ).

Signed-off-by: Qiankun Li <qiankun.li@nxp.com>
2025-09-02 12:33:01 +02:00
Qiankun Li
e0b65d2908 samples: net: wifi: Add apsta_mode support for rw612 boards.
Add conf files for frm_rw612 and rd_rw612_bga
to support apsta_mode example.

Signed-off-by: Qiankun Li <qiankun.li@nxp.com>
2025-09-02 12:33:01 +02:00
Aksel Skauge Mellbye
aec461634f drivers: gpio: silabs: Support EM4 wakeup interrupts
EM4 wakeup interrupts are dedicated interrupts tied to specific
pins that enable wakeup from EM4 through reset. Add support
for using these interrupts instead of the regular interrupts when
the GPIO_INT_TRIG_WAKE flag is set.

Since it's not possible to tell what pin is associated with what
EM4WU interrupt at runtime, the driver must store a mapping table
sourced from device tree.

Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
2025-09-02 11:10:33 +02:00
Aksel Skauge Mellbye
962bdefd86 dts: arm: silabs: Add EM4 wakeup pins and power state
Add EM4 wakeup capable pin mapping to GPIO port node. Pins
capable of EM4 wakeup have dedicated interrupt flags.

Add EM4 as a soft-off power state that is disabled by default.
Marking it as disabled allows users to enter it with
`pm_state_force()`, while preventing the power management
subsystem from selecting the state automatically.

Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
2025-09-02 11:10:33 +02:00
Emil Gydesen
83ac15c95b doc: releases: Add entry for bt_cap_initiator_broadcast_foreach_stream
Add entry for the new function bt_cap_initiator_broadcast_foreach_stream.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-09-02 11:10:22 +02:00
Emil Gydesen
4059d5b6a7 Bluetooth: CAP: Implement bt_cap_initiator_broadcast_foreach_stream
Implement the function bt_cap_initiator_broadcast_foreach_stream that
allows users to iterate on all BAP streams in a BAP broadcast source.
This can be used to easily get references to other broadcast streams in
the same group.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-09-02 11:10:22 +02:00
Pavel Vasilyev
427cf0da6a bluetooth: mesh: pb_adv: check SegN in Transaction Continuation PDU
Check that SegN is not 0. SegN = 0 is invalid as the first segment is
sent in Transaction Start PDU.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2025-09-02 11:09:59 +02:00
Muzaffar Ahmed
d94b2fd4e4 drivers: wifi: siwx91x: Add support for definitive MFP config
Replaced the MFP config logic with dedicated getter and setter APIs

Signed-off-by: Muzaffar Ahmed <muzaffar.ahmed@silabs.com>
2025-09-02 11:09:39 +02:00
Francois Ramu
e5620e07c9 drivers: flash: stm32 xspi flash read with memcopy when executing
When the application is executed in external flash, the read operation
cannot be in indirect mode but with memcopy.
Note that writing or erasing the external flash being executed
is not possible during the execution.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2025-09-02 11:09:29 +02:00
Anas Nashif
232db11f0d twister: tests: fix test output parsing
Fix test output parsing and update to what twister produces.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-09-02 10:00:24 +02:00
Anas Nashif
8d0a6b59c6 twister: do not use twister internals for reason field
Do not use twister internals for reason field.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-09-02 10:00:24 +02:00
Anas Nashif
a6277ddaef twister: remove stray debug message
Remove leftover debug message.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-09-02 10:00:24 +02:00
Marcin Niestroj
8f25922b6c boards: other: convert to ARDUINO_HEADER_R3_* macro
Use ARDUINO_HEADER_R3_* macros, as those are much more readable and less
error prone.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2025-09-02 10:00:13 +02:00
Marcin Niestroj
9333d7a118 boards: panasonic: convert to ARDUINO_HEADER_R3_* macro
Use ARDUINO_HEADER_R3_* macros, as those are much more readable and less
error prone.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2025-09-02 10:00:13 +02:00
Marcin Niestroj
68d76cea7b boards: nordic: convert to ARDUINO_HEADER_R3_* macro
Use ARDUINO_HEADER_R3_* macros, as those are much more readable and less
error prone.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2025-09-02 10:00:13 +02:00
Marcin Niestroj
7161062f99 boards: nxp: convert to ARDUINO_HEADER_R3_* macro
Use ARDUINO_HEADER_R3_* macros, as those are much more readable and less
error prone.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2025-09-02 10:00:13 +02:00
Marcin Niestroj
0b3d003795 boards: u-blox: convert to ARDUINO_HEADER_R3_* macro
Use ARDUINO_HEADER_R3_* macros, as those are much more readable and less
error prone.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2025-09-02 10:00:13 +02:00
Marcin Niestroj
f464d29843 boards: st: convert to ARDUINO_HEADER_R3_* macro
Use ARDUINO_HEADER_R3_* macros, as those are much more readable and less
error prone.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2025-09-02 10:00:13 +02:00
Tomasz Bursztyka
9663b17dba drivers: clock_control: Fix setting hfxt oscillator in mspm0 clock
Trival fix, as there is no mspm0_hfclk_cfg (yet anyway?).

Signed-off-by: Tomasz Bursztyka <tobu@bang-olufsen.dk>
2025-09-02 10:00:05 +02:00
Tomasz Bursztyka
8454ff70f2 drivers: counter: Fix mspm0 alarm cancellation
Cancelling the alarm needs to reset the callback to NULL, else setting
an alarm subsequently will never work.

chan_id parameter being unused, using ARG_UNUSED() relevantly then.

Signed-off-by: Tomasz Bursztyka <tobu@bang-olufsen.dk>
2025-09-02 09:59:58 +02:00
Tomasz Bursztyka
3d9fd26286 dts: mspm0g: Add timg 8/9/14 counter nodes for x51x series
TIMG8/9/14 added.

Signed-off-by: Tomasz Bursztyka <tobu@bang-olufsen.dk>
2025-09-02 09:59:49 +02:00
Tomasz Bursztyka
5ca7ed3893 dts: mspm0g: Add timg 6/7/12 counter nodes
TIMG12 having a 32bits resolution

Signed-off-by: Dimitris Karnikis <dika@bang-olufsen.dk>
Signed-off-by: Tomasz Bursztyka <tobu@bang-olufsen.dk>
2025-09-02 09:59:49 +02:00
Tomasz Bursztyka
b81741519d dts: bindings: Fixing description of ti,msmpm0-pwm binding
Small typo.

Signed-off-by: Tomasz Bursztyka <tobu@bang-olufsen.dk>
2025-09-02 09:59:49 +02:00
Tomasz Bursztyka
5e3f1611e1 dts: mspm0: Fix timer/counter/pwm names to enforce uniqueness
There are 14 TIMG and 2 TIMA, all which can be either a counter or a pwm,
so let's fix the names to avoid ambiguity and enforce uniqueness.

Rule applied here being:

tim<g/a><n>: tim<g/a><n>@<address> {
        ...

        counter<g/a><n>: counter<g/a><n> {
                ...
        };

        pwm<g/a><n>: pwm<g/a><n> {
                ...
        };
};

It will be much easier then once get the 16 timer nodes included.

Signed-off-by: Tomasz Bursztyka <tobu@bang-olufsen.dk>
2025-09-02 09:59:49 +02:00
Emil Gydesen
27b2d17ad1 samples: Bluetooth: BAP: Unicast Server: Refactor TX
Refactors the TX of the unicast server. This commit effectively
copies the TX approach of the unicast client sample, to make
the sample more similar.
This changes the TX to be based on the number of complete
packets event (which results in free'ing the buffer), instead of
a timer. This completely ensures that we do not skip any sequence
numbers which may be rejected by the controller.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-09-02 09:59:41 +02:00
Elmo Lan
79d7ce61d2 driver: crypto: fix timing discrepancies
Use a temporary variable to store and compare the reference time
instead of calling the time function multiple times,
which may lead to slight mismatches in comparison due to timing drift.

Signed-off-by: Elmo Lan <elmo_lan@realtek.com>
2025-09-02 07:56:56 +02:00
Ederson de Souza
f2512a1da0 doc/releases: Notes about Intel CET and Hardware Shadow Stack
Notes about new public macros and Kconfigs related to Intel CET and
Hardware shadow stack.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2025-09-02 07:56:48 +02:00
Ederson de Souza
b6a54ea3d4 doc/security: Mention control-flow integrity mechanisms
A simple explanation of control-flow integrity on Zephyr and Intel CET.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2025-09-02 07:56:48 +02:00
Ederson de Souza
d115489910 kernel/thread_stack: Document hardware shadow stack macros
While these are not expected to be used by applications in normal
scenarios, they are still public and document them can be helpful in
non-normal scenarios.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2025-09-02 07:56:48 +02:00
Ederson de Souza
eb6da2ec20 tests/arch/x86: Add tests for shadow stack
Ensure they behave as expected.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2025-09-02 07:56:48 +02:00
Ederson de Souza
948c884054 tests/kernel/lifo/lifo_api: Don't reuse name for different thread stacks
A limitation on current HW shadow stack implementation for x86 is that
more than one thread stack can't share the same variable name, even if
they are static. To avoid skipping useful tests, for now, while this
limitation holds, change the name of the stack variable.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2025-09-02 07:56:48 +02:00
Ederson de Souza
53c7e9a3f8 tests/kernel/fifo/fifo_api: Don't reuse name for different thread stacks
A limitation on current HW shadow stack implementation for x86 is that
more than one thread stack can't share the same variable name, even if
they are static. To avoid skipping useful tests, for now, while this
limitation holds, change the name of the stack variable.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2025-09-02 07:56:48 +02:00
Ederson de Souza
2d94c5d7aa arch/x86: Support for automatic shadow stacks
- No more need for special IRQ shadow stacks - just reuse the one
   created for z_interrupt_stacks;
   - Add the linker sections for the pairs of stack/shadow stack;
   - Support shadow stack arrays.

Last item was a bit challenging: shadow stacks need to be initialised
before use, and this is done statically for normal shadow stacks. To
initialise the shadow stacks in the array, one needs how many entries it
has. While a simple approach would use `LISTIFY` to them do the
initialization on all entries, that is not possible as many stack arrays
are created using expressions instead of literals, such as
`CONFIG_MP_MAX_NUM_CPUS - 1`, which won't work with `LISTIFY`.

Instead, this patch uses a script, `gen_static_shstk_array.py` that
gathers all needed information and patches the ELF to initialize the
stack arrays. Note that this needs to be done before any other operation
on the ELF file that creates new representations, such as the .bin
output.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2025-09-02 07:56:48 +02:00
Ederson de Souza
cdaca274a5 kernel: Automatically set up HW shadow stack for thread stacks
This patch modifies thread stack macros (such as K_KERNEL_STACK_DECLARE
or K_KERNEL_STACK_ARRAY_DECLARE) to also create a HW shadow stack (when
CONFIG_HW_SHADOW_STACK=y), as well as define a pairing between the
thread stack (or thread stack array) and the shadow stack (or shadow
stack array).

This pairing, which currently is simply an array of pairs (stack,
shadow_stack) is searched during thread setup to find the corresponding
shadow stack and attach it to the thread. If linear search on this array
proves to be a performance issue, the actual structure can be revisited.

To define the size of the shadow stack for a given stack, the stack size
is used. A new Kconfig, CONFIG_HW_SHADOW_STACK_PERCENTAGE_SIZE is used
to define how big the shadow stack is compared to the stack. Note that
this size is in *addition* to the stack size. To avoid some shadow
stacks becoming too small, CONFIG_HW_SHADOW_STACK_MIN_SIZE is used to
define a minimum size. Note that after this size is defined, platform
restrictions on the size of the shadow stack are still applied.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2025-09-02 07:56:48 +02:00
Ederson de Souza
08ec5e89fc cmake: New list for post build commands that should run early
New cmake list, `post_build_patch_elf_commands`, will be prepended to
`post_build_commands` one, effectively making these commands to run just
after the ELF is created. It's particularly useful for operations that
patch the ELF generated, before other representations of it (such as
.bin) are created.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2025-09-02 07:56:48 +02:00
Ederson de Souza
d3d82a1159 tests/kernel/fatal/exception: Skip stack sentinel test with shadow stack
Test could trip shadow stack protections instead of normal stack
sentinel, thus requiring special handling for this case. Just avoid this
test instead, if CONFIG_HW_SHADOW_STACK=y.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2025-09-02 07:56:48 +02:00
Ederson de Souza
10d6ef0ea5 kernel: Option to allow shadow stack to be reused
It seems that, at least on tests, it's common to call k_thread_create()
on a thread multiple times. This trips a check for the CET shadow stack
- namely, set a shadow stack on a thread which already has a shadow
stack.

This patch adds a Kconfig option to allow that, iff the base address and
size of the new shadow stack are the same as before. This will trigger a
reset of the shadow stack, so it can be reused.

It may be the case that this behaviour (reusing threads) is more common
than only for tests, in which case it could make sense to change the
default - in this patch, is only true if ZTEST.

Even if being enabled by default becomes the reality, it would still
make sense to keep this option - more conscious apps could avoid the
need for the shadow stack reset code altogether.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2025-09-02 07:56:48 +02:00
Ederson de Souza
6a76424177 arch/x86: Use Zephyr HW shadow stack arch interface
So that kernel created threads can use shadow stacks. Note that
CONFIG_X86_CET_SHADOW_STACK is abandoned in favour of
CONFIG_HW_SHADOW_STACK.

This means change some types, functions and macro throughout shadow
stack code.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2025-09-02 07:56:48 +02:00
Ederson de Souza
016eaf2959 kernel: Add interface for hardware shadow stack usage
In order to allow kernel created threads (such as main and idle threads)
to make use of hardware shadow stack implementation, add an interface
for them.

This patch basically provides an infra that architectures need to
implement to provide hardware shadow stack.

Also, main and idle threads are updated to make use of this interface
(if hardware shadow stacks are enabled).

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2025-09-02 07:56:48 +02:00
Ederson de Souza
5df48fd5d9 arch/x86: Allow SoC to run preparatory steps on shadow stack
Some SoCs may need to do some preparatory work before changing the
current shadow stack pointer (and thus, currently used shadow stack).
This patch adds a way for that, shielded by a Kconfig
(CONFIG_X86_CET_SOC_PREPARE_SHADOW_STACK_SWITCH).

As currently only 32 bit SoC may use this, support is only added to the
32 bit code.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2025-09-02 07:56:48 +02:00
Ederson de Souza
ad93c6a1ac arch/x86: Support shadow stack on IRQ on ia32
An IRQ shadow stack is created to be used by IRQ.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2025-09-02 07:56:48 +02:00
Ederson de Souza
82de622d23 arch/x86: Support shadow stack on ia32
Most notable difference on base support is the need to keep the shadow
stack tokens, which are 8 bytes, 8 bytes aligned. Some helper macros are
used for that.

Also, an `ssp` entry is added to the task state segment (TSS).

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2025-09-02 07:56:48 +02:00
Ederson de Souza
86b401075a arch/x86: Verify shadow stack pointers
Currently, it's permitted to have threads that don't have a shadow
stack. When those are run, shadow stack is disabled on the CPU. To
identify those, the thread `shstk_addr` member is checked.

This patch adds an optional check, behind
CONFIG_X86_CET_VERIFY_KERNEL_SHADOW_STACK, that checks if an outgoing
thread has this pointer NULL with shadow stack currently enabled on
the CPU, meaning a 1) bug or 2) some attempt to tamper with the pointer.

If the check fails, k_panic() is called. Note that this verification is
not enough to guarantee `shstk_addr` can't be tampered with. For
instance, it only works on a running thread. Ideally, all threads should
be shadow stack capable, so a missing `shstk_addr` would simply be a
hard fault, but that is still to come.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2025-09-02 07:56:48 +02:00
Ederson de Souza
3c9bb1d1ce arch/x86: Support shadow stack on exception handling
Main peculiarity is that if an exception results in current thread being
aborted, we need to clear the busy bit on the shadow stack on the swap
to the new thread, otherwise future exceptions will fail when trying to
use a busy shadow stack.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2025-09-02 07:56:48 +02:00
Ederson de Souza
01d6b0cf48 arch/x86: Support shadow stack on nested IRQs
Nested interrupts are supported, on the normal stack, by creating a
stack whose size is a multiple of CONFIG_ISR_DEPTH, and updating the
pointer used by Interrupt Stack Table (IST) to point to a new base,
inside the "oversized" stack.

The same approach is used for the shadow stack: shadow stack size is
multiplied by CONFIG_ISR_DEPTH, and the pointer to the stack on the
shadow stack pointer table is update to point to the next base.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2025-09-02 07:56:48 +02:00