Skip to content

Commit 0fe5d82

Browse files
doki-nordicrlubos
authored andcommitted
[nrf fromtree] boards: nordic: ipc: added dcache alignement
The nRF54 and nRF92 chips has data cache, which means the ICMsg and ICBMsg must be configured to follow required cache alignment of the shared memory. The `dcache-alignement` needs to be defined for that. Signed-off-by: Dominik Kilian <[email protected]> (cherry picked from commit cbaafe2) (cherry picked from commit 6c435d6)
1 parent d8c7e30 commit 0fe5d82

File tree

10 files changed

+29
-3
lines changed

10 files changed

+29
-3
lines changed

boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-ipc_conf.dtsi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
cpuapp_cpurad_ipc: ipc-2-3 {
2424
compatible = "zephyr,ipc-icbmsg";
25+
dcache-alignment = <32>;
2526
status = "disabled";
2627
mboxes = <&cpuapp_bellboard 18>,
2728
<&cpurad_bellboard 12>;

boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280-ipc_conf.dtsi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
cpuapp_cpurad_ipc: ipc-2-3 {
2424
compatible = "zephyr,ipc-icbmsg";
25+
dcache-alignment = <32>;
2526
status = "disabled";
2627
mboxes = <&cpuapp_bellboard 18>,
2728
<&cpurad_bellboard 12>;

doc/services/ipc/ipc_service/backends/ipc_service_icbmsg.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,21 @@ Configuration
4040
The backend is configured using Kconfig and devicetree.
4141
When configuring the backend, do the following:
4242

43+
* If at least one of the cores uses data cache on shared memory, set the ``dcache-alignment`` value.
44+
This must be the largest value of the invalidation or the write-back size for both sides of the communication.
45+
You can skip it if none of the communication sides is using data cache on shared memory.
4346
* Define two memory regions and assign them to ``tx-region`` and ``rx-region`` of an instance.
4447
Ensure that the memory regions used for data exchange are unique (not overlapping any other region) and accessible by both domains (or CPUs).
4548
* Define the number of allocable blocks for each region with ``tx-blocks`` and ``rx-blocks``.
4649
* Define MBOX devices for sending a signal that informs the other domain (or CPU) of the written data.
4750
Ensure that the other domain (or CPU) can receive the signal.
4851

52+
.. caution::
53+
54+
Make sure that you set correct value of the ``dcache-alignment``.
55+
At first, wrong value may not show any signs, which may give a false impression that everything works.
56+
Unstable behavior will appear sooner or later.
57+
4958
See the following configuration example for one of the instances:
5059

5160
.. code-block:: devicetree
@@ -63,6 +72,7 @@ See the following configuration example for one of the instances:
6372
ipc {
6473
ipc0: ipc0 {
6574
compatible = "zephyr,ipc-icbmsg";
75+
dcache-alignment = <32>;
6676
tx-region = <&tx>;
6777
rx-region = <&rx>;
6878
tx-blocks = <16>;

doc/services/ipc/ipc_service/backends/ipc_service_icmsg.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ Configuration
2424
The backend is configured via Kconfig and devicetree.
2525
When configuring the backend, do the following:
2626

27+
* If at least one of the cores uses data cache on shared memory, set the ``dcache-alignment`` value.
28+
This must be the largest value of the invalidation or the write-back size for both sides of the communication.
29+
You can skip it if none of the communication sides is using data cache on shared memory.
2730
* Define two memory regions and assign them to ``tx-region`` and ``rx-region``
2831
of an instance. Ensure that the memory regions used for data exchange are
2932
unique (not overlapping any other region) and accessible by both domains
@@ -32,6 +35,12 @@ When configuring the backend, do the following:
3235
domain (or CPU) that data has been written. Ensure that the other domain
3336
(or CPU) is able to receive the signal.
3437

38+
.. caution::
39+
40+
Make sure that you set correct value of the ``dcache-alignment``.
41+
At first, wrong value may not show any signs, which may give a false impression that everything works.
42+
Unstable behavior will appear sooner or later.
43+
3544
See the following configuration example for one of the instances:
3645

3746
.. code-block:: devicetree
@@ -49,6 +58,7 @@ See the following configuration example for one of the instances:
4958
ipc {
5059
ipc0: ipc0 {
5160
compatible = "zephyr,ipc-icmsg";
61+
dcache-alignment = <32>;
5262
tx-region = <&tx>;
5363
rx-region = <&rx>;
5464
mboxes = <&mbox 0>, <&mbox 1>;

dts/bindings/ipc/zephyr,ipc-icmsg.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ properties:
3232
For example:
3333
Side A: no data cache
3434
Side B: 32 Bytes write-back size, 16 Bytes invalidation size
35-
dcache-alignment = 32; for both
35+
dcache-alignment = <32>; for both
3636
3737
mboxes:
3838
description: phandle to the MBOX controller (TX and RX are required)

samples/subsys/ipc/ipc_service/icmsg/boards/nrf54l15dk_nrf54l15_cpuapp.overlay

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
ipc {
2424
ipc0: ipc0 {
2525
compatible = "zephyr,ipc-icmsg";
26+
dcache-alignment = <32>;
2627
tx-region = <&sram_tx>;
2728
rx-region = <&sram_rx>;
2829
mboxes = <&cpuapp_vevif_rx 20>, <&cpuapp_vevif_tx 21>;

samples/subsys/ipc/ipc_service/icmsg/boards/nrf54l15dk_nrf54l15_cpuapp_icbmsg.overlay

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
ipc {
2424
ipc0: ipc0 {
2525
compatible = "zephyr,ipc-icbmsg";
26+
dcache-alignment = <32>;
2627
tx-region = <&sram_tx>;
2728
rx-region = <&sram_rx>;
2829
tx-blocks = <16>;

samples/subsys/ipc/ipc_service/icmsg/remote/boards/nrf54l15dk_nrf54l15_cpuflpr.overlay

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
ipc {
2424
ipc0: ipc0 {
2525
compatible = "zephyr,ipc-icmsg";
26+
dcache-alignment = <32>;
2627
tx-region = <&sram_tx>;
2728
rx-region = <&sram_rx>;
2829
mboxes = <&cpuflpr_vevif_rx 21>, <&cpuflpr_vevif_tx 20>;

samples/subsys/ipc/ipc_service/icmsg/remote/boards/nrf54l15dk_nrf54l15_cpuflpr_icbmsg.overlay

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
ipc {
2424
ipc0: ipc0 {
2525
compatible = "zephyr,ipc-icbmsg";
26+
dcache-alignment = <32>;
2627
tx-region = <&sram_tx>;
2728
rx-region = <&sram_rx>;
2829
tx-blocks = <18>;

subsys/ipc/ipc_service/backends/ipc_icbmsg.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1434,11 +1434,11 @@ const static struct ipc_service_backend backend_ops = {
14341434
}; \
14351435
BUILD_ASSERT(IS_POWER_OF_TWO(GET_CACHE_ALIGNMENT(i)), \
14361436
"This module supports only power of two cache alignment"); \
1437-
BUILD_ASSERT((GET_BLOCK_SIZE_INST(i, tx, rx) > GET_CACHE_ALIGNMENT(i)) && \
1437+
BUILD_ASSERT((GET_BLOCK_SIZE_INST(i, tx, rx) >= GET_CACHE_ALIGNMENT(i)) && \
14381438
(GET_BLOCK_SIZE_INST(i, tx, rx) < \
14391439
GET_MEM_SIZE_INST(i, tx)), \
14401440
"TX region is too small for provided number of blocks"); \
1441-
BUILD_ASSERT((GET_BLOCK_SIZE_INST(i, rx, tx) > GET_CACHE_ALIGNMENT(i)) && \
1441+
BUILD_ASSERT((GET_BLOCK_SIZE_INST(i, rx, tx) >= GET_CACHE_ALIGNMENT(i)) && \
14421442
(GET_BLOCK_SIZE_INST(i, rx, tx) < \
14431443
GET_MEM_SIZE_INST(i, rx)), \
14441444
"RX region is too small for provided number of blocks"); \

0 commit comments

Comments
 (0)