Interface: Provide implementation of tfm_ns_interface_dispatch()
This patch provides implementation of tfm_ns_interface_dispatch for
bare metal and RTOS use cases. This is needed to simplify TF-M
integration with NS application.
For more details refer to
"Default implementation of tfm_ns_interface_dispatch()" mailing thread:
https://lists.trustedfirmware.org/archives/list/tf-m@lists.trustedfirmware.org/message/ZCBRUODVTBK26JGAZKKIJEQ62D3XIMSO/
and TF-M tech forum presentation
"Default implemeation of tsm_ns_interface_dispatch":
https://www.trustedfirmware.org/meetings/tf-m-technical-forum/
Following things are done:
* tfm_ns_interface.c was moved from test repo to TF-M repo
tfm_ns_interface_rtos.c file
* tfm_ns_interface_bare_metal.c is added.
* required NS OS wrapper header files are moved from test to TFM repo
* tfm_ns_interface.c.example is removed as no longer needed
are provided.
* documentation is updated
Signed-off-by: Bohdan Hunko <Bohdan.Hunko@infineon.com>
Signed-off-by: Chris Brand <chris.brand@cypress.com>
Change-Id: I3e7fd80946bd674cb562ddac8fbc8c7053e30478
diff --git a/docs/integration_guide/index.rst b/docs/integration_guide/index.rst
index 75fbbac..e96445c 100644
--- a/docs/integration_guide/index.rst
+++ b/docs/integration_guide/index.rst
@@ -64,14 +64,21 @@
TF-M also exports a reference implementation of PSA APIs for NS clients in the
``<install_dir>/interface/src``.
-On Armv8-M TrustZone based platforms, NS OS shall implement interface API
-``tfm_ns_interface_dispatch()`` to integrate with TF-M implementation of PSA
-APIs. See ``interface/include/tfm_ns_interface.h`` for the detailed declaration
-of ``tfm_ns_interface_dispatch()``.
-TF-M provides an example of ``tfm_ns_interface_dispatch()`` implementation on
-Armv8-M TrustZone based platforms. In this example, NS OS calls mutex in
-``tfm_ns_interface_dispatch()`` to synchronize multiple NS client calls to TF-M.
-See ``interface/src/tfm_ns_interface.c.example`` for more details.
+On Armv8-M TrustZone based platforms, NS OS uses ``tfm_ns_interface_dispatch()``
+to integrate with TF-M implementation of PSA APIs. TF-M provides a reference
+implementation of this function for RTOS and bare metal use cases.
+RTOS implementation of ``tfm_ns_interface_dispatch()`` (provided in
+``interface\src\os_wrapper\tfm_ns_interface_rtos.c``) uses mutex to provide
+multithread safety. Mutex wrapper functions defined in
+``interface/include/os_wrapper/mutex.h`` are expected to be provided by NS RTOS.
+When reference RTOS implementation of dispatch function is used NS application
+should call ``tfm_ns_interface_init()`` function before first PSA API call.
+Bare metal implementation ``tfm_ns_interface_dispatch()`` (provided in
+``interface\src\os_wrapper\tfm_ns_interface_bare_metal.c``) does not
+provide multithread safety and does not require implementation of mutex
+interface.
+If needed, instead of using reference implementation, NS application may provide
+its own implementation of ``tfm_ns_interface_dispatch()`` function.
TF-M provides a reference implementation of NS mailbox on multi-core platforms,
under folder ``interface/src/multi_core``.
@@ -137,3 +144,5 @@
--------------
*Copyright (c) 2017-2022, Arm Limited. All rights reserved.*
+*Copyright (c) 2023 Cypress Semiconductor Corporation (an Infineon company)
+or an affiliate of Cypress Semiconductor Corporation. All rights reserved.*