Deprecate old implementation on NS client identification
New implementation on NS client identification has already
been added to TF-M test, which is named as nsid_manager.
The old implementation on NSID needs to be deprecated.
Signed-off-by: Xinyu Zhang <xinyu.zhang@arm.com>
Change-Id: Icf66eadd7f9eaf382e2ee5d6edbd968067977a49
diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt
index 03b0d05..ace6184 100755
--- a/app/CMakeLists.txt
+++ b/app/CMakeLists.txt
@@ -47,7 +47,6 @@
target_include_directories(tfm_ns_interface
INTERFACE
${NS_INTERFACE_DIR}
- ${NS_INTERFACE_DIR}/ns_client_id
)
# PSA interface files are generated from a template
@@ -77,12 +76,6 @@
add_library(tfm_api_ns STATIC)
-target_sources(tfm_api_ns
- PRIVATE
- $<$<BOOL:${TFM_NS_CLIENT_IDENTIFICATION}>:${NS_INTERFACE_DIR}/ns_client_id/tfm_nspm_svc_handler.c>
- $<$<BOOL:${TFM_NS_CLIENT_IDENTIFICATION}>:${NS_INTERFACE_DIR}/ns_client_id/tfm_nspm_api.c>
-)
-
if (${TFM_PSA_API})
target_sources(tfm_api_ns PRIVATE
$<$<OR:$<BOOL:${FORWARD_PROT_MSG}>,$<BOOL:${TFM_PARTITION_PLATFORM}>>:${INTERFACE_SRC_DIR}/tfm_platform_ipc_api.c>
@@ -139,9 +132,6 @@
PRIVATE
$<$<NOT:$<BOOL:${TFM_MULTI_CORE_TOPOLOGY}>>:tfm_s_veneers>
platform_ns
- # CMSIS is currently only required to provide the NS client IDs. In
- # future, this should probably be made more OS agnostic
- $<$<BOOL:${TFM_NS_CLIENT_IDENTIFICATION}>:CMSIS_5_tfm_ns>
)
############################# PSA test integration #############################
diff --git a/app/main_ns.c b/app/main_ns.c
index f4fe3dd..2df4ffd 100644
--- a/app/main_ns.c
+++ b/app/main_ns.c
@@ -7,7 +7,7 @@
#include "tfm_api.h"
#include "cmsis_os2.h"
-#include "tfm_ns_svc.h"
+#include "cmsis_compiler.h"
#include "tfm_ns_interface.h"
#if defined(TEST_FRAMEWORK_NS) || defined(TEST_FRAMEWORK_S)
#include "tfm_integ_test.h"
@@ -45,25 +45,6 @@
#endif
#endif
-extern void * const osRtxUserSVC[1+USER_SVC_COUNT];
- void * const osRtxUserSVC[1+USER_SVC_COUNT] = {
- (void *)USER_SVC_COUNT,
-
-#define X(SVC_ENUM, SVC_HANDLER) (void*)SVC_HANDLER,
-
- /* SVC API for Services */
-#ifdef TFM_NS_CLIENT_IDENTIFICATION
- LIST_SVC_NSPM
-#endif
-
-#undef X
-
-/*
- * (void *)user_function1,
- * ...
- */
-};
-
/**
* \brief List of RTOS thread attributes
*/
diff --git a/app/psa_api_test.c b/app/psa_api_test.c
index 54f47b9..8f9624b 100644
--- a/app/psa_api_test.c
+++ b/app/psa_api_test.c
@@ -1,14 +1,11 @@
/*
- * Copyright (c) 2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2021, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
#include "psa_api_test.h"
-#ifdef TFM_NS_CLIENT_IDENTIFICATION
-#include "tfm_nspm_api.h"
-#endif /* TFM_NS_CLIENT_IDENTIFICATION */
#include "tfm_integ_test.h"
/**
@@ -22,10 +19,6 @@
{
UNUSED_VARIABLE(arg);
-#ifdef TFM_NS_CLIENT_IDENTIFICATION
- tfm_nspm_register_client_id();
-#endif /* TFM_NS_CLIENT_IDENTIFICATION */
-
val_entry();
for (;;) {
diff --git a/ns_interface/ns_client_id/README.rst b/ns_interface/ns_client_id/README.rst
deleted file mode 100644
index c854f77..0000000
--- a/ns_interface/ns_client_id/README.rst
+++ /dev/null
@@ -1,51 +0,0 @@
-##################################
-TF-M test NS Client Identification
-##################################
-
-TF-M test implements NS client identification to support multiple NS clients
-test, such as in Protected Storage (PS) service test.
-This implementation is based on the design of non-secure client management [1]_.
-
-NS test cases calls the ``tfm_nspm_register_client_id()`` to register the client
-ID of the currently running NS client.
-
-.. code-block:: c
-
- uint32_t tfm_nspm_register_client_id(void);
-
-``tfm_nspm_register_client_id()`` fetches the client ID and eventually invokes
-``tfm_register_client_id()`` to register the ID from an SVC handler.
-
-.. code-block:: c
-
- enum tfm_status_e tfm_register_client_id(int32_t ns_client_id);
-
-See ``tfm_api.h`` [2]_ for the details of ``tfm_register_client_id()``.
-``tfm_api.h`` will be exported by TF-M during TF-M secure firmware build.
-
-The SVC handler which calls ``tfm_register_client_id()`` is implemented via the
-following macro
-
-.. code-block:: c
-
- SVC(SVC_TFM_NSPM_REGISTER_CLIENT_ID);
-
-The SVC call handler of the above SVC maps the name of the current thread to a
-hard-coded client ID, and sends it to the TF-M core via the earlier discussed
-API.
-The mapping is implemented in ``ns_interface/ns_client_id/tfm_nspm_api.c``.
-
-The system integrators **may** implement the non-secure ID mapping based on
-their application/threat model.
-
-*********
-Reference
-*********
-
-.. [1] `Non-secure Client Management <https://git.trustedfirmware.org/TF-M/trusted-firmware-m.git/tree/docs/design_documents/tfm_non_secure_client_management.rst>`_
-
-.. [2] `tfm_api.h <https://git.trustedfirmware.org/TF-M/trusted-firmware-m.git/tree/interface/include/tfm_api.h>`_
-
---------------------
-
-*Copyright (c) 2018-2021, Arm Limited. All rights reserved.*
diff --git a/ns_interface/ns_client_id/tfm_ns_svc.h b/ns_interface/ns_client_id/tfm_ns_svc.h
deleted file mode 100644
index def0c2f..0000000
--- a/ns_interface/ns_client_id/tfm_ns_svc.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2017-2019, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-#include <stdio.h>
-#include "cmsis_compiler.h"
-
-#ifndef __TFM_NS_SVC_H__
-#define __TFM_NS_SVC_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \brief Include all the SVC handler headers
- */
-#include "tfm_nspm_svc_handler.h"
-
-/**
- * \brief Macro to encode an svc instruction
- *
- */
-#define SVC(code) __ASM volatile("svc %0" : : "I" (code))
-
-/**
- * \def LIST_SVC_NSPM
- *
- * \brief This is an X macro which lists
- * the SVC interface exposed by TF-M
- * for the NS OS.
- *
- */
-#define LIST_SVC_NSPM \
- X(SVC_TFM_NSPM_REGISTER_CLIENT_ID, tfm_nspm_svc_register_client_id) \
-
-/**
- * \brief Numbers associated to each SVC available
- *
- * \details Start from 1 as 0 is reserved by RTX
- */
-enum tfm_svc_num {
- SVC_INVALID = 0,
-
-#define X(SVC_ENUM, SVC_HANDLER) SVC_ENUM,
-
- /* SVC API for Services */
-#ifdef TFM_NS_CLIENT_IDENTIFICATION
- LIST_SVC_NSPM
-#endif
-
-#undef X
-
- /* add all the new entries above this line */
- SVC_TFM_MAX,
-};
-
-/* number of user SVC functions */
-#define USER_SVC_COUNT ((uint32_t)SVC_TFM_MAX - 1)
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __TFM_NS_SVC_H__ */
diff --git a/ns_interface/ns_client_id/tfm_nspm_api.c b/ns_interface/ns_client_id/tfm_nspm_api.c
deleted file mode 100644
index a540e8c..0000000
--- a/ns_interface/ns_client_id/tfm_nspm_api.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 2018-2019, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-#include "tfm_nspm_api.h"
-
-#include <string.h>
-#include <stdint.h>
-
-#include "cmsis_os2.h"
-#include "tfm_ns_svc.h"
-
-/* Translation table pair between OS threads and client IDs */
-struct thread_test_clientid_pair {
- const char* t_name; /*!< Task/Thread name */
- int32_t client_id; /*!< Client ID used in assets definition */
-};
-
-static struct thread_test_clientid_pair test_ns_policy_table[] =
-{
- {"Thread_A", -1},
- {"Thread_B", -2},
- {"Thread_C", -3},
- {"Thread_D", -4},
- {"seq_task", -5},
- {"mid_task", -6},
- {"pri_task", -7},
-#ifdef PSA_API_TEST_NS
- {"psa_api_test", -8}
-#endif
-};
-
-/**
- * \brief Gets the client ID based on the thread name
- *
- * \return If the thread name is in the test_ns_policy_table, it returns the
- * client ID. Otherwise, it returns 0 as an error code.
- */
-static uint32_t get_client_id(void)
-{
- uint32_t i;
- static uint32_t test_table_size = (sizeof(test_ns_policy_table) /
- sizeof(test_ns_policy_table[0]));
- const char* p_thread_name;
- osThreadId_t thread_id;
-
- /* Get thread name */
- thread_id = osThreadGetId();
- p_thread_name = osThreadGetName(thread_id);
-
- for (i = 0; i < test_table_size; i++) {
- if (strcmp(test_ns_policy_table[i].t_name, p_thread_name) == 0) {
- return test_ns_policy_table[i].client_id;
- }
- }
-
- return 0;
-}
-
-__attribute__ ((naked))
-static uint32_t tfm_nspm_svc_register_client(uint32_t client_id)
-{
- SVC(SVC_TFM_NSPM_REGISTER_CLIENT_ID);
- __ASM volatile("BX LR");
-}
-
-uint32_t tfm_nspm_register_client_id(void)
-{
- uint32_t client_id;
-
- client_id = get_client_id();
- if (client_id == 0) {
- return 0;
- }
-
- return tfm_nspm_svc_register_client(client_id);
-}
-
-
diff --git a/ns_interface/ns_client_id/tfm_nspm_api.h b/ns_interface/ns_client_id/tfm_nspm_api.h
deleted file mode 100644
index 5f03845..0000000
--- a/ns_interface/ns_client_id/tfm_nspm_api.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-#ifndef __TFM_NSPM_API_H__
-#define __TFM_NSPM_API_H__
-
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \brief Reports the client ID of this task to TF-M
- *
- * \return Returns 1 if the client ID was successfully reported 0 otherwise
- */
-uint32_t tfm_nspm_register_client_id(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __TFM_NSPM_API_H__ */
diff --git a/ns_interface/ns_client_id/tfm_nspm_svc_handler.c b/ns_interface/ns_client_id/tfm_nspm_svc_handler.c
deleted file mode 100644
index 3ec2cb0..0000000
--- a/ns_interface/ns_client_id/tfm_nspm_svc_handler.c
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-#include "tfm_nspm_svc_handler.h"
-#include "tfm_api.h"
-#include "tfm_ns_svc.h"
-
-/* SVC function implementations */
-uint32_t tfm_nspm_svc_register_client_id(uint32_t client_id)
-{
- if (tfm_register_client_id(client_id) == TFM_SUCCESS) {
- return 1;
- }
-
- return 0;
-}
diff --git a/ns_interface/ns_client_id/tfm_nspm_svc_handler.h b/ns_interface/ns_client_id/tfm_nspm_svc_handler.h
deleted file mode 100644
index 73f75a9..0000000
--- a/ns_interface/ns_client_id/tfm_nspm_svc_handler.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-#ifndef __TFM_NSPM_SVC_HANDLER_H__
-#define __TFM_NSPM_SVC_HANDLER_H__
-
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \brief Reports the client ID of this task to TF-M (SVC function)
- *
- * \param [in] client_id Client ID to register.
- *
- * \return Returns 1 if the client ID was successfully reported 0 otherwise
- */
-uint32_t tfm_nspm_svc_register_client_id(uint32_t client_id);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __TFM_NSPM_SVC_HANDLER_H__ */
diff --git a/test/suites/ps/non_secure/ns_test_helpers.c b/test/suites/ps/non_secure/ns_test_helpers.c
index 149b767..98066c3 100644
--- a/test/suites/ps/non_secure/ns_test_helpers.c
+++ b/test/suites/ps/non_secure/ns_test_helpers.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2021, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -10,8 +10,6 @@
#include "os_wrapper/thread.h"
#include "os_wrapper/semaphore.h"
-#include "tfm_nspm_api.h"
-
#define PS_TEST_TASK_STACK_SIZE (768)
struct test_task_t {
@@ -31,10 +29,6 @@
{
struct test_task_t *test = arg;
-#ifdef TFM_NS_CLIENT_IDENTIFICATION
- tfm_nspm_register_client_id();
-#endif /* TFM_NS_CLIENT_IDENTIFICATION */
-
/* Call the test function */
test->func(test->ret);