Skip to content

[nrf fromlist] drivers: cache: Add barriers to nrf driver #2754

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2,932 commits into
base: main
Choose a base branch
from

Conversation

karstenkoenig
Copy link
Contributor

On Cortex-M33 the access to peripheral registers doesn't act as a data synchronization barrier for memory accesses to normal memory. So before triggering any TASKS for cache operations we need to make sure the core doesn't have any pending memory transactions.

Upstream PR #: 88492

axelnxp and others added 30 commits March 24, 2025 07:38
When allocation fails in `hci_rx_cb`, we should return immediately
instead of continuing the execution of the function.

Also, we need to free the allocated buffer from the heap when sending
to the message queue fails to avoid memory leak.

Signed-off-by: Axel Le Bourhis <[email protected]>
(cherry picked from commit 0034e12)
…mplete event

As the previous version of the MCXW71 BLE Controller wasn't sending a
command complete event after setting the BD address, we used a
workaround to directly send the HCI command without using zephyr's API.
Now, on the latest version of MCXW72 and MCXW71, this issue is fixed,
so we need to use `bt_hci_cmd_send_sync` to properly expect the
command complete event.

Signed-off-by: Axel Le Bourhis <[email protected]>
(cherry picked from commit e5a1c0b)
…when bt disable

remove the power off BLE controller function since the hci_reset cmd
is enough, also for wifi-ble coex scenario, need to maintain BLE controller
for some info in SMU region

Signed-off-by: Ying Zhang <[email protected]>
(cherry picked from commit 6b16d10)
- added HCI command to send hci-reset in bt_disable() func, and
  remove its call from the driver close() call.
- remove rsp buf pass to 'hci_reset_complete()' func as status is
  already checked under 'bt_hci_cmd_send_sync()'.

Signed-off-by: Nirav Agrawal <[email protected]>
(cherry picked from commit 438701f)
Clarifying `bt_gatt_attr` docs.

Signed-off-by: Kyra Lengfeld <[email protected]>
(cherry picked from commit c31b962)
This commit adds more detailed description to the "Bluetooth APIs" and
"GAP" group within the bluetooth header.

Signed-off-by: Kyra Lengfeld <[email protected]>
(cherry picked from commit 3570783)
This commit changes log level for already registered callback from
warning to debug as this is cause unnecessary noise and doesn't indicate
actual issue. Caller gets a certain error code for this case which can
be handled properly.

Signed-off-by: Pavel Vasilyev <[email protected]>
(cherry picked from commit 886faba)
The api has not changed since its introduction some time ago,
mark it as stable.

Signed-off-by: Herman Berget <[email protected]>
(cherry picked from commit 8b909b4)
…ection Subrating

The API has not changed since it was introduced so should no longer be
considered experimental.

Signed-off-by: Timothy Keys <[email protected]>
(cherry picked from commit 7ef8116)
Fix the following warning
att.c:734:3: warning: label followed by a declaration is a C23 extension
[-Wc23-extensions]
  734 |                 k_tid_t current_thread = k_current_get();
      |                 ^
By wrapping that code as a compound statement

Signed-off-by: Alberto Escolar Piedras <[email protected]>
(cherry picked from commit 1dab77b)
…_amend()

Extend `zephyr_library_amend()` to support an optional directory
argument.
The current `zephyr_library_amend()` works well when used inside a
Zephyr module with same structure, but fails when the macro is called
from Zephyr module integration code is located in a Zephyr
`MODULE_EXT_ROOT` because in this case the CMake code being executed
is not present in the Zephyr module itself, in which case the dir name
creation based on relative to module dir give wrong result.

For this use-case then support a base directory.
This also allows for use-cases in Zephyr modules where the directory
structure matching Zephyr's own structure is placed in a sub-folder.

Upstream PR #: 87274

Signed-off-by: Torsten Rasmussen <[email protected]>
noup since this option does not exist upstream.

The Oberon PSA core has an option to manually set
the buffer size of the PSA key slots in bytes.

This option here:
MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE

This option has a default value of 16 since it
directly affects the memory usage.

The crypto tests use a secp256r1 key and thus since
the public key for this key is 65 bytes long we need
to set the option in the sample.

Signed-off-by: Georgios Vasilakis <[email protected]>
…and MODE_QUAD_1_4_4"

This reverts commit dd02c86.

Signed-off-by: Marcin Szymczyk <[email protected]>
…_QUAD_1_4_4

Extend driver to support single lane and 1-4-4 IO modes.

Upstream PR #: 85520

Signed-off-by: Marcin Szymczyk <[email protected]>
Allow configuring MTU for CMUX.
Some AT manual and specification define this as a
frame size. Linux ldattach default to 127 bytes,
3GPP TS 27.010 defaults to 31.

We should limit our CMUX frames to a size that
remote end is capable of handling.
Linux silently drops oversized frames.

Also, remove MODEM_CELLULAR_CMUX_MAX_FRAME_SIZE as
this was only limiting a buffer sizes, and resulted
CMUX frames to be capped to same value.
Use MODEM_CMUX_WORK_BUFFER_SIZE and MODEM_CMUX_MTU instead.

Also rename CONFIG_MODEM_CELLULAR_CHAT_BUFFER_SIZES to
CONFIG_MODEM_CELLULAR_CHAT_BUFFER_SIZE as it is now
only used as a Chat module. DLCI pipes use
CONFIG_MODEM_CMUX_WORK_BUFFER_SIZE.

Signed-off-by: Seppo Takalo <[email protected]>
(cherry picked from commit c78081e)
If we end up writing zero bytes to cmux output, we can return
zero instead of -ENOMEM as it would break various modules when
using small buffers. For example modem_chat.c does not tolerate
-ENOMEM but handles zero OK.

Signed-off-by: Seppo Takalo <[email protected]>
(cherry picked from commit 15b0f90)
…` folder

Relocated `bt_shell_private.c` to the `common` folder to enable
independent use between `BT_SHELL` and `BT_MESH_SHELL`.

Signed-off-by: Pisit Sawangvonganan <[email protected]>
(cherry picked from commit eeda631)
This change aims to eliminate the dependency on `ctx_shell` in
the Bluetooth `audio/shell/*`, making the code more maintainable.
Replaced `shell_*` functions that depended on `ctx_shell` with
the appropriate `bt_shell_*` functions.

Signed-off-by: Pisit Sawangvonganan <[email protected]>
(cherry picked from commit f1516c9)
…ests

Instead of using rs=1,2,3 and 4 we make it 10, 20, 30, 40 as the
other values could cause some connection issues.

Signed-off-by: Emil Gydesen <[email protected]>
(cherry picked from commit 7d24771)
…BAP broadcast sink

Workaround by using `-start_offset` to ensure that the ACL
established does not overlap the sink being established.

The behavior between nrf52_bsim and nrf54l15bsim is
different where in the two device are starting to
advertising at the same time in nrf54l15bsim where as
there is an offset already in nrf52_bsim test.

Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
(cherry picked from commit 490da9e)
…te for the BA

The broadcast assistant will now validate the content of the
received receive states.

Some modifications were done to the tests to properly
pass these new validations.

Signed-off-by: Emil Gydesen <[email protected]>
(cherry picked from commit b361c95)
…le adv

Most specs require the use of extended advertising, and most
tests used legacy advertising.

Implement a common function to create and start an extended
advertising set to reduce code duplication.

Signed-off-by: Emil Gydesen <[email protected]>
(cherry picked from commit 0e9a3e0)
…e with BAP

Add a selection of interval values that are suitable for BAP,
which will allow better coexistence between ISO and ACL,
for both broadcast and unicast. Some of these are defined
by the BAP spec, and some are defined by Zephyr, since they
do have a suggested value from BAP.

Samples and tests have been updated to use these new values.
Peripheral samples have also been updated with
CONFIG_BT_GAP_AUTO_UPDATE_CONN_PARAMS so that the connection
parameters from the centrals aren't updated to something else
shortly after.

The shell has also been updated to use the LE Audio (BAP) values
if audio is enabled, and the audio.conf file has disabled automatic
updating of the connection parameters as the peripheral, as we rarely
(if ever) want to do that.

Due to the connection interval change, CI hit an issue
with test_bass_broadcast_code in test_main_client_sync, where
the reading of the long receive state did not finish before we
attempted to do another procedure, so the function was updated to have
a retry.

Signed-off-by: Emil Gydesen <[email protected]>
(cherry picked from commit 9d4cc4b)
Renamed BT_CSIP_SET_MEMBER_NOTIFIABLE to
BT_CSIP_SET_MEMBER_SIRK_NOTIFIABLE to be more specific.

Signed-off-by: Emil Gydesen <[email protected]>
(cherry picked from commit 501b95f)
…et size

The set size can now be dynamically set and notified.
The rank is added as a argument in the case that changing
the set size, also affects the device's rank, as ranks
in a coordinated set needs to be continuous.

The set coordinator implementation has been updated
to support receiving the new set size, and providing
this information to the upper layers.

This commit adds a babblesim test for the new API,
as well as a shell command.

Signed-off-by: Emil Gydesen <[email protected]>
(cherry picked from commit d19abff)
The commit exports control of MBEDTLS_ASN1_PARSE_C, in mbedTLS
module, via Kconfig.
This allows applications to use ASN1 parser independently from
other functions.

Signed-off-by: Dominik Ermel <[email protected]>
(cherry picked from commit e8589d2)
…IONS

The commit adds Kconfig options that allows users to select
 - MBEDTLS_PLATFORM_NO_STD_FUNCTIONS
 - MBEDTLS_PLATFORM_SNPRINTF_ALT
allowing Mbed TLS to use alternative definitions of STD functions.

Upstream PR #: 87135

Signed-off-by: Dominik Ermel <[email protected]>
`CI-zigbee-test` not to be triggered anymore.

nrf-squash! [nrf noup] ci: add .github/test-spec.yml

Signed-off-by: Eduardo Montoya <[email protected]>
…config to int pin

Add possibility to configure open drain and pull up on nPM2100's
interrupt output through DTS flags.

Signed-off-by: Sergei Ovchinnikov <[email protected]>
(cherry picked from commit 32b79cf)
This fixes out of scope IRQ lock key by using SEGGER_RTT_Write
version that locks the IRQ by itself.

Signed-off-by: Mariusz Skamra <[email protected]>
(cherry picked from commit 27c18ad)
tomchy and others added 27 commits April 7, 2025 10:58
This reverts commit a53cb73.

Upstream PR #: 88121

Ref: NCSDK-32650

Signed-off-by: Tomasz Chyrowicz <[email protected]>

This reverts commit a53cb73.
UDC API passes struct udc_ep_config to all functions. Some UDC functions
were using endpoint config structure while some were using device and
endpoint number. This API inconsistency led to completely unnecessary
endpoint structure lookups. Remove unnecessary lookups by using endpoint
config structure pointer where it makes sense.

Signed-off-by: Tomasz Moń <[email protected]>
(cherry picked from commit 1cccf28)
… hibernated

When endpoint is disabled while hibernated, the UDC endpoint state has
to be reset. Set the busy to false to keep UDC endpoint state in sync
with peripheral register state.

Upstream PR #: 88236

Fixes: 2be960a ("drivers: udc_dwc2: Disable endpoint while
hibernated")

Signed-off-by: Tomasz Moń <[email protected]>
…aly 30.

Applied fix for nRF54L anomaly 30, which requires a periodic
calibration of high-frequency clock.

Upstream PR #: 88112

Signed-off-by: Michał Stasiak <[email protected]>
…and MODE_QUAD_1_4_4"

This reverts commit 999e700.

Signed-off-by: Marcin Szymczyk <[email protected]>
…nable bit"

This reverts commit a7e820a.

Signed-off-by: Marcin Szymczyk <[email protected]>
Separate compatible is required for Flash MSPI quirks.

Upstream PR #: 85520

Signed-off-by: Marcin Szymczyk <[email protected]>
…_QUAD_1_4_4

Extend driver to support single lane and 1-4-4 IO modes.
Move flash chip quirks to a separate file.

Upstream PR #: 85520

Signed-off-by: Marcin Szymczyk <[email protected]>
Upstream PR #: 88166

Some OpenThread functions were called without verifying the return
value, which not only is not the best practice, but also could lead to
build warnings with llvm. This commit fixes it.

Signed-off-by: Robert Lubos <[email protected]>
Commit fixes bug when corresponding group ID was never
incremented for independent corresponding relationships.

Signed-off-by: Aleksandr Khromykh <[email protected]>
(cherry picked from commit 69c5c6f)
Signed-off-by: alperen sener <[email protected]>
…using launcher

Add possibility to use pinctrl to configure pins that should be assigned
to nRF VPR coprocessors and also provide a way of preventing activation
of the nordic_vpr_launcher driver for an enabled VPR so that it can be
supplied with the code to execute and launched in a custom way.

Signed-off-by: Andrzej Głąbek <[email protected]>
(cherry picked from commit 54d8c80)
…ion in nRF54H/nRF92

Add an entry for the RAM region assigned to soft peripherals that will
disable caching for that region. Without this, communication with the
FLPR coprocessor cannot be performed correctly.

Signed-off-by: Andrzej Głąbek <[email protected]>
(cherry picked from commit 4dded19)
nrf-squash! [nrf noup] drivers: pinctrl: Add SDP MSPI pin configuration

Make it possible to use SDP_MSPI_* functions also in pinctrl nodes
assigned to VPR cores and also for nRF54H SoCs.

Signed-off-by: Andrzej Głąbek <[email protected]>
Upstream PR #: 88359

Do not ignore return values of OT functions registering IPv6 addresses.
As this is called from the net_mgmt callback context, which returns
void, there's not much that can be done, other than logging the error.

To simplify the logging code and avoid the need to use extra buffer,
use net_sprint_ipv6_addr() networking utility function within the log
message to convert binary address to string.

Signed-off-by: Robert Lubos <[email protected]>
Upstream PR #: 88359

clear_pending_events() was not used anywhere.

Signed-off-by: Robert Lubos <[email protected]>
Declaration of variables after a label inside a switch statement is a
c23 extension, not c99.

This results in the following warning when compiling with clang:
> .../subsys/net/lib/zperf/zperf_shell.c:912:4: warning: label followed
>                by a declaration is a C23 extension [-Wc23-extensions]
>   912 |                      int seconds = parse_arg(&i, argc, argv);
>       |                         ^
> .../subsys/net/lib/zperf/zperf_shell.c:1145:4: warning: label followed
>                by a declaration is a C23 extension [-Wc23-extensions]
>  1145 |                      int seconds = parse_arg(&i, argc, argv);
>       |                         ^
> 2 warnings generated.

There are no practical reasons why the variable should be declared
inside the switch statement, therefore move the declaration and place it
together with declaration of other variables.

Upstream PR #: 88403

Signed-off-by: Torsten Rasmussen <[email protected]>
Support IPC between SEC and APP. This is needed for PSA Crypto
support.

Upstream PR #: 88285

Ref: NCSDK-NONE

Signed-off-by: Sebastian Bøe <[email protected]>
This reverts commit c9b6b6a.

Reverting this noup now that we have the 54L15 NS board target upstream.

Signed-off-by: Tomi Fontanilles <[email protected]>
Add binding for the Nordic Memory
Privilege Controller (MPC).

Signed-off-by: Georgios Vasilakis <[email protected]>
(cherry picked from commit b184272)
Add the Nordic Memory Privilege Controller (MPC)
in the dtsi of nrf54l15/10/05.

This sets the number of override regions and the
granularity of the regions.

Signed-off-by: Georgios Vasilakis <[email protected]>
(cherry picked from commit 320505e)
This adds the nrf54l15dk/nrf54l15/cpuapp/ns board variant to
Zephyr. It allows to build applications for this target.

This is an initial support for the non secure target which allows
building and running tfm_ipc and config_build.

This is NOT full support of the non secure target in upstream
Zephyr.

There are important limitations, such as:
- The hardware Crypto accelerator is not supported and thus the non
  secur target is NOT secure for production applicatiions in upstream
  Zephyr.
- The BL2 is not supported, so no DFU is supported with this support

Most of the code chagnes here are taken from nRF Connect SDK
in order to avoid having noups there.

Signed-off-by: Georgios Vasilakis <[email protected]>
(cherry picked from commit 47c71e3)
Add nRF54L15 non secure target for the config_build and
the tfm_ipc samples.

Signed-off-by: Georgios Vasilakis <[email protected]>
(cherry picked from commit 85f2810)
…ossible

Add nrf_cache_power_up and nrf_cache_power_down functions. In case of
s2ram power up cache as early as possible, before restoring ARM core
registers. It improves restore time from 180 us to 33 us.

As a minor optimization nrf_memconf_ramblock_control_mask_enable_set is
used which allows to control ram blocks for icache and dcache in a
single register write.

Signed-off-by: Krzysztof Chruściński <[email protected]>
(cherry picked from commit a36b154)
…timing

Update exit-latency-us with newly measured values. Measurement is
taking into account additional timing compared to wakeup from
WFI.

Signed-off-by: Krzysztof Chruściński <[email protected]>
(cherry picked from commit a4a6130)
Fixes an issue whereby just enabling hooks would enable the nrf5340
network core hook despite lacking other requirements

Signed-off-by: Jamie McCrae <[email protected]>
Adding support for handling XOTUNE event in clock_control.
Right now XOTUNE event reflects situation when HFCLK is stable and tuned.

Upstream PR #: 86354

Signed-off-by: Karol Lasończyk <[email protected]>
On Cortex-M33 the access to peripheral registers doesn't act as a data
synchronization barrier for memory accesses to normal memory. So before
triggering any TASKS for cache operations we need to make sure the core
doesn't have any pending memory transactions.

Upstream PR #: 88492
Signed-off-by: Karsten Koenig <[email protected]>
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
D Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.