blob: 9faccfb243cccd245d7021f4f6bffd0c19a466e6 [file] [log] [blame]
Gyorgy Szingdb9783c2019-04-17 21:08:48 +02001###########################
2Non-Secure Identity Manager
3###########################
Edison Ai1c266ae2019-03-20 11:21:21 +08004The ID of the current application/thread is known by TF-M, and the SST service
5queries the ID of the currently running client via a dedicated API.
6
7The identity of secure clients can be tracked by TF-M core, because it also
8manages the contexts of the partitions. However to differentiate NS clients, it
9relies on the services provided by the NS OS.
10
11Tracking of context changes are possible by relying on the NS OS calling the
12Thread Context Management for Armv8-M TrustZone APIs, as described
Gyorgy Szingdb9783c2019-04-17 21:08:48 +020013`here <https://www.keil.com/pack/doc/CMSIS/Core/html/group__context__trustzone__functions.html>`__
Edison Ai1c266ae2019-03-20 11:21:21 +080014
15However TF-M needs an extra API, to assign a client ID to the TZ context created
16as a result of the
Gyorgy Szingdb9783c2019-04-17 21:08:48 +020017``TZ_MemoryId_t TZ_AllocModuleContext_S (TZ_ModuleId_t module)`` call.
Edison Ai1c266ae2019-03-20 11:21:21 +080018
19To do this, the
Gyorgy Szingdb9783c2019-04-17 21:08:48 +020020``enum tfm_status_e tfm_register_client_id (int32_t ns_client_id)`` have to be
Edison Ai1c266ae2019-03-20 11:21:21 +080021called from an SVC handler, with the client ID of the currently running client.
22
23In the current implementation of TF-M, an SVC call is provided for the NS
24clients to be called at the beginning of their main function.
25
Gyorgy Szingdb9783c2019-04-17 21:08:48 +020026``SVC(SVC_TFM_NSPM_REGISTER_CLIENT_ID);``
Edison Ai1c266ae2019-03-20 11:21:21 +080027
28The SVC call handler of the above SVC maps the name of the current thread to a
29hardcoded client id, and sends it to the TF-M core via the earlier discussed
30API.
31
Gyorgy Szingdb9783c2019-04-17 21:08:48 +020032The mapping is implemented in ``interface/src/tfm_nspm_svc_handler.c``.
Edison Ai1c266ae2019-03-20 11:21:21 +080033
34The system integrators **may** implement the non-secure ID mapping based on
35their application/threat model.
36
Gyorgy Szingdb9783c2019-04-17 21:08:48 +020037In case the NS OS doesn't use the Thread Context Management for Armv8-M
38TrustZone APIs, then TF-M considers the NS SW as a single client, and assigns a
39client ID to it automatically.
Edison Ai1c266ae2019-03-20 11:21:21 +080040
41--------------
42
Gyorgy Szingdb9783c2019-04-17 21:08:48 +020043*Copyright (c) 2018-2019, Arm Limited. All rights reserved.*