Skip to content

[Backport v4.0.99-ncs1-branch] [nrf noup] mgmt: mcumgr: Fix nRF5340 network core hook #2747

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,914 commits into
base: v4.0.99-ncs1-branch
Choose a base branch
from

Conversation

NordicBuilder
Copy link
Contributor

Backport 8dbca43 from #2728.

ozersa and others added 30 commits March 24, 2025 07:32
…ofile

TF-M small profile does not support secure storage (know as Protected
storage), this commit add filter for tfm test case to pass it
incase of small profile been set, see tf-m profiles in below link

https://tf-m-user-guide.trustedfirmware.org/configuration/profiles/index.html

Signed-off-by: Sadik Ozer <[email protected]>
(cherry picked from commit 6932885)
Signed-off-by: Tomi Fontanilles <[email protected]>
…nabled scenarios

Explicitly set the TF-M profile to not rely on the build system defaults
which might differ.

Signed-off-by: Tomi Fontanilles <[email protected]>
(cherry picked from commit 62fe34d)
Signed-off-by: Tomi Fontanilles <[email protected]>
The psa_key_attributes_t type is implementation-defined according to
the PSA Crypto spec.
Compare its fields individually instead of doing a memcmp() over the
entire struct.

Signed-off-by: Tomi Fontanilles <[email protected]>
(cherry picked from commit 744e9f7)
Signed-off-by: Tomi Fontanilles <[email protected]>
…ples/tests

Explicitly enable CONFIG_ENTROPY_GENERATOR instead of relying on the
build system's defaults.

This:
- Makes sure the filtering works properly between entropy_driver and
entropy_not_secure test scenarios for the samples.
- Helps with TF-M builds in certain scenarios where key generation (via
`psa_generate_key()`) would fail due to the RNG functionality being
disabled.

Signed-off-by: Tomi Fontanilles <[email protected]>
(cherry picked from commit 25ad578)
Signed-off-by: Tomi Fontanilles <[email protected]>
Use dynamic allocation for key material for
better compatibility as a fully static key store is a new
feature that not all PSA Crypto implementations support.

Explicitly enable CONFIG_MBEDTLS_ENABLE_HEAP to ensure that Mbed TLS uses
heap for the PSA keys' data (instead of failing at runtime).
This will turn off CONFIG_MBEDTLS_PSA_STATIC_KEY_SLOTS, making the
implementation default to dynamic key slots.

Signed-off-by: Tomi Fontanilles <[email protected]>
(cherry picked from commit eb1ed12)
Signed-off-by: Tomi Fontanilles <[email protected]>
…YPTO_STORAGE_C

Add a Kconfig option to match the Mbed TLS define
instead of defining it based on CONFIG_SECURE_STORAGE.

This gives more flexibility regarding the potential re-definition of the
CONFIG_MBEDTLS_PSA_CRYPTO_STORAGE_C Kconfig option.

Signed-off-by: Tomi Fontanilles <[email protected]>
(cherry picked from commit 8627250)
Signed-off-by: Tomi Fontanilles <[email protected]>
Some implementations require more stack than others.
Increase the Ztest and main stack sizes to accommodate them.

Signed-off-by: Tomi Fontanilles <[email protected]>
(cherry picked from commit f50c3d9)
Signed-off-by: Tomi Fontanilles <[email protected]>
On top of enabling and allowing test entropy sources, enable
CONFIG_ENTROPY_GENERATOR so that a real driver and entropy source gets
used if available.
This is needed for some PSA Crypto implementations that have random number
generation conditionally compiled in.

Signed-off-by: Tomi Fontanilles <[email protected]>
(cherry picked from commit b920686)
Signed-off-by: Tomi Fontanilles <[email protected]>
…eration fails

When `bt_le_oob_get_local` or `bt_le_ext_adv_oob_get_local` is called
and SMP is enabled, `bt_smp_le_oob_generate_sc_data` is called to
generate a Random Number and a Confirmation Value needed for OOB data.
These values are based on the device's public key.

The public key is generated only once when `bt_smp_init` is called.
If public key generation fails, the callback passed to `bt_pub_key_get`
is called with `pkey` set to NULL. The `bt_smp_pkey_ready` callback
gets called, but it doesn't release the `sc_local_pkey_ready` semaphore
thus leaving `bt_smp_le_oob_generate_sc_data` wait for semaphore with
`K_FOREVER`.

This commit replaces the semaphore with a conditional variable and
requests a public key again if the key is NULL thus solving 2 issues:
- handling the case where the callback was triggered notifying about the
  completion of the public key request, but the key was not generated,
- handling the case where multiple threads trying to acquire the same
  sempahore.

The timeout is used instead of K_FOREVER to avoid cases when callback
has never been triggered.

Signed-off-by: Pavel Vasilyev <[email protected]>
(cherry picked from commit 9757ffa)
…_WHITELIST macro

Macro has been deprecated since 2.7 LTS(!) and is using non-inclusive
terminology. Drop it.

Signed-off-by: Benjamin Cabé <[email protected]>
(cherry picked from commit 110c49f)
When scanning is started on bt_bap_broadcast_assistant_scan_start then
BAP_BA_FLAG_SCANNING flag for the broadcast assistant instance should
not be cleared.

Fixes #85937

Signed-off-by: Jens Rehhoff Thomsen <[email protected]>
(cherry picked from commit c443343)
…nd buffer

Remove nested allocation of HCI command buffer so that one
less HCI command buffer is needed starting extended
advertising with privacy enabled.

Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
(cherry picked from commit cc1b534)
The gatt docs are very sparce, this commit adds imrpovements for the
GATT server API part. Others will follow.

Signed-off-by: Kyra Lengfeld <[email protected]>
(cherry picked from commit 775cc35)
… BT RX thread

This commit alignes the timeout value for allocating buffers within att
on the BT RX thread, making it consistent within att.c, see
bt_att_req_alloc.

We are inferring in many bt_gatt_* functions that if called from a BT RX
thread (which is inherently the case if called from a callback when
running a Bluetooth application), we don't block and instead return
-ENOMEM when the ATT request queue is full, avoiding a deadlock.
This promise is fulfilled within bt_att_req_alloc, where the timeout for
allocation of the request slab is set to K_NO_WAIT if we are on the BT
RX thread. Unfortunately, we break this promise in
bt_att_chan_create_pdu, where the timeout for allocation of the att pool
is still K_FOREVER and deadlocks can (and do) occur when too many
requests are sent yet the pool is depleted.

Note: Both req_slab and att_pool sizes are defined by
CONFIG_BT_ATT_TX_COUNT. If applications start getting -ENOMEM with this
change, they were at risk of such a deadlock, and may increase
CONFIG_BT_ATT_TX_COUNT to allocate the att pool for their requests.

Note: This possible deadlock has been flying under the radar, as
att_pools are freed when the HCI driver has sent it to the controller
(instead of when receiving the response, as it happens with req_slabs)
and due to the att_pool and the req_slab being both sized by
CONFIG_BT_ATT_TX_COUNT, and req_slab being allocated before and
returning -ENOMEM already if there is no space, it takes a more specific
situation to deplete the att_pool but not the req_slab pool at this
point.

Note: Ideally, we don't want functions to behave differently depending
on which thread they are running, and while this commit makes it more
consistent, it should be considered a workaround solution.

Signed-off-by: Kyra Lengfeld <[email protected]>
(cherry picked from commit 6464ffa)
…_uuid

bt_gatt_find_by_uuid used bt_gatt_attr_value_handle but that
function only works to get the value handle of a characteristic
declaration, i.e. if the UUID is not BT_UUID_GATT_CHRC then it
would always return handle = 0. This meant that
bt_gatt_find_by_uuid would always use handle = 0 as the starting
handle for non-BT_UUID_GATT_CHRC attributes, instead of the handle
of the provided attr.

This was not an issue for any UUIDs that may only exist once on a
GATT server, which is most UUIDs, but for UUIDs like the
BT_UUID_TBS_* UUIDs that may be multiple instances of, it would
always return the first attribute rather than the one starting
from the provided start attr.

This commit also ensures that we do not overflow the `end_handle`
when adding 2 uint16_t values.

Signed-off-by: Emil Gydesen <[email protected]>
(cherry picked from commit e4c5bb9)
Adds improvement to the GATT API documentation by providing examples of
where (and how) certain structs are used, and adds specification
references to the fields of bt_gatt_cpf to clarify their purpose.

Signed-off-by: Håvard Reierstad <[email protected]>
(cherry picked from commit c7a19da)
This commit adds improvements for the
GATT client API part.

Signed-off-by: Kyra Lengfeld <[email protected]>
(cherry picked from commit b136f6d)
…tures

The function supports reading multiple controller-based values.
It is effectively a copy of struct bt_dev_le but in a more
application-oriented definition.

It was chosen to keep the features as an array rather than a
64-bit value, as the comparison macros work on arrays and that
there already exists new bits > 64 in the core spec which is not
yet supported by Zephyr.

It is being smoke tested in a generic GATT client test,
as the individual values may depend on several Kconfig options.

Signed-off-by: Emil Gydesen <[email protected]>
(cherry picked from commit 44c5c1d)
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]>
muraliThokala and others added 27 commits April 7, 2025 13:16
Support to configure swctrl1 as input or output for coexistence.

Signed-off-by: Murali Thokala <[email protected]>
(cherry picked from commit 03c5f5f)
…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]>
(cherry picked from commit b2e0b7a)
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)
(cherry picked from commit 511cd38)
… 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]>
(cherry picked from commit 7a28ef1)
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]>
(cherry picked from commit 06c6605)
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]>
(cherry picked from commit eacfed3)
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]>
(cherry picked from commit 6150da7)
Upstream PR #: 88359

clear_pending_events() was not used anywhere.

Signed-off-by: Robert Lubos <[email protected]>
(cherry picked from commit 8e6457e)
…and MODE_QUAD_1_4_4"

This reverts commit 999e700.

Signed-off-by: Marcin Szymczyk <[email protected]>
(cherry picked from commit 599c345)
…nable bit"

This reverts commit a7e820a.

Signed-off-by: Marcin Szymczyk <[email protected]>
(cherry picked from commit 6978eb3)
Separate compatible is required for Flash MSPI quirks.

Upstream PR #: 85520

Signed-off-by: Marcin Szymczyk <[email protected]>
(cherry picked from commit 491bf44)
…_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]>
(cherry picked from commit 80ef797)
This reverts commit 9ec6585.

Signed-off-by: Jamie McCrae <[email protected]>
(cherry picked from commit 1bef56e)
…fig"

This reverts commit 988e2e7.

Signed-off-by: Jamie McCrae <[email protected]>
(cherry picked from commit 9d0bbbc)
…fig"

This reverts commit bf353ee.

Signed-off-by: Jamie McCrae <[email protected]>
(cherry picked from commit 64182b0)
Adds a configuration file which is used with nrfutil to allow
programming QSPI on the device

Upstream PR #: 86985

Signed-off-by: Jamie McCrae <[email protected]>
(cherry picked from commit 7345e51)
Adds a configuration file which is used with nrfutil to allow
programming the SPI flash on the device

Upstream PR #: 86985

Signed-off-by: Jamie McCrae <[email protected]>
(cherry picked from commit cd38823)
Adds a configuration file which is used with nrfutil to allow
programming QSPI on the device

Upstream PR #: 86985

Signed-off-by: Jamie McCrae <[email protected]>
(cherry picked from commit c8171c0)
Adds a configuration file which is used with nrfutil to allow
programming QSPI on the device

Upstream PR #: 86985

Signed-off-by: Jamie McCrae <[email protected]>
(cherry picked from commit 85f6fcd)
Non-secure variants for nRF7002 DK were removed from upstream
in commit 10d4973. Revert these
changes downstream, so that the NS variants are still available.

Signed-off-by: Andrzej Głąbek <[email protected]>
(cherry picked from commit c30f4cd)
…lue."

This reverts commit 1e69738.

Ref: NCSDK-32650

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

This reverts commit 1e69738
(cherry picked from commit 062e6e1)
This reverts commit a53cb73.

Ref: NCSDK-32650

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

This reverts commit a53cb73.
(cherry picked from commit db34319)
nrf54h20 device requires device runtime PM to be enabled when
device PM is in use.

Signed-off-by: Krzysztof Chruściński <[email protected]>
(cherry picked from commit 4b16915)
Explicitly disable device runtime PM since this test is expecting
it to be disabled and there are SoC now that turns on it by default.

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

Private Node Identity advertisement on a subnet should stop as soon as
the network is removed.

Upstream PR #: 87891

Signed-off-by: alperen sener <[email protected]>
… test case

Private node identity advertisements must stop immediately when
ordered by PTS. To do so; adding enabled parameter to
btp_priv_node_id_get_cmd.

Upstream PR #: 87891

Signed-off-by: alperen sener <[email protected]>
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]>
(cherry picked from commit 8dbca43)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.