SPM: Remove "spm request" function
Remove the unused "spm request" function.
Move the library-model-only header to its folder.
Change-Id: Iff1daddaa15841903dce51494735c86992b850f0
Signed-off-by: Mingyang Sun <mingyang.sun@arm.com>
diff --git a/secure_fw/include/tfm/tfm_spm_services.h b/secure_fw/include/tfm/tfm_spm_services.h
deleted file mode 100644
index c1f4238..0000000
--- a/secure_fw/include/tfm/tfm_spm_services.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-#ifndef __TFM_SPM_SERVICES_H__
-#define __TFM_SPM_SERVICES_H__
-
-#include "psa/service.h"
-
-enum tfm_spm_request_type_t {
- TFM_SPM_REQUEST_RESET_VOTE,
-};
-
-/**
- * \brief Request a vote from SPM on a system reset
- *
- * \return Returns 0 if request is accepted, any other value means reject
- */
-int32_t tfm_spm_request_reset_vote(void);
-
-#ifndef TFM_PSA_API
-void tfm_enable_irq(psa_signal_t irq_signal);
-void tfm_disable_irq(psa_signal_t irq_signal);
-#endif
-
-#endif /* __TFM_SPM_SERVICES_H__ */
diff --git a/secure_fw/partitions/platform/platform_sp.c b/secure_fw/partitions/platform/platform_sp.c
index 70fbf1a..8f4702f 100644
--- a/secure_fw/partitions/platform/platform_sp.c
+++ b/secure_fw/partitions/platform/platform_sp.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
*
@@ -9,7 +9,6 @@
#include "tfm_platform_system.h"
#include "tfm_plat_nv_counters.h"
-#include "tfm/tfm_spm_services.h"
#include "tfm_secure_api.h"
#include "psa_manifest/pid.h"
@@ -67,12 +66,6 @@
enum tfm_platform_err_t platform_sp_system_reset(void)
{
- /* Check if SPM allows the system reset */
-
- if (tfm_spm_request_reset_vote() != 0) {
- return TFM_PLATFORM_ERR_SYSTEM_ERROR;
- }
-
/* FIXME: The system reset functionality is only supported in isolation
* level 1.
*/
diff --git a/secure_fw/spm/cmsis_func/arch.c b/secure_fw/spm/cmsis_func/arch.c
index bf637da..39446c0 100644
--- a/secure_fw/spm/cmsis_func/arch.c
+++ b/secure_fw/spm/cmsis_func/arch.c
@@ -9,7 +9,6 @@
#include "compiler_ext_defs.h"
#include "exception_info.h"
#include "tfm_secure_api.h"
-#include "tfm/tfm_spm_services.h"
#if defined(__ICCARM__)
uint32_t tfm_core_svc_handler(uint32_t *msp, uint32_t *psp, uint32_t exc_return);
@@ -27,20 +26,6 @@
}
__attribute__((naked))
-static int32_t tfm_spm_request(int32_t request_type)
-{
- __ASM volatile(
- "SVC %0\n"
- "BX lr\n"
- : : "I" (TFM_SVC_SPM_REQUEST));
-}
-
-int32_t tfm_spm_request_reset_vote(void)
-{
- return tfm_spm_request((int32_t)TFM_SPM_REQUEST_RESET_VOTE);
-}
-
-__attribute__((naked))
void tfm_enable_irq(psa_signal_t irq_signal)
{
__ASM("SVC %0\n"
diff --git a/secure_fw/spm/cmsis_func/include/spm_func.h b/secure_fw/spm/cmsis_func/include/spm_func.h
index 568b456..72fa860 100644
--- a/secure_fw/spm/cmsis_func/include/spm_func.h
+++ b/secure_fw/spm/cmsis_func/include/spm_func.h
@@ -374,12 +374,6 @@
uint32_t tfm_spm_partition_get_privileged_mode(uint32_t partition_flags);
/**
- * \brief Handle an SPM request by a secure service
- * \param[in] svc_ctx The stacked SVC context
- */
-void tfm_spm_request_handler(const struct tfm_state_context_t *svc_ctx);
-
-/**
* \brief Function to seal the PSP stacks for Function mode.
*/
void tfm_spm_seal_psp_stacks(void);
diff --git a/secure_fw/spm/include/spm_partition_defs.h b/secure_fw/spm/cmsis_func/include/spm_partition_defs.h
similarity index 100%
rename from secure_fw/spm/include/spm_partition_defs.h
rename to secure_fw/spm/cmsis_func/include/spm_partition_defs.h
diff --git a/secure_fw/spm/cmsis_func/include/tfm_core_svc.h b/secure_fw/spm/cmsis_func/include/tfm_core_svc.h
index ce4eed8..d732de7 100644
--- a/secure_fw/spm/cmsis_func/include/tfm_core_svc.h
+++ b/secure_fw/spm/cmsis_func/include/tfm_core_svc.h
@@ -16,14 +16,13 @@
#define TFM_SVC_SFN_REQUEST (0x2)
#define TFM_SVC_SFN_RETURN (0x3)
#define TFM_SVC_SFN_COMPLETION (0x4)
-#define TFM_SVC_SPM_REQUEST (0x5)
-#define TFM_SVC_GET_BOOT_DATA (0x6)
-#define TFM_SVC_DEPRIV_REQ (0x7)
-#define TFM_SVC_DEPRIV_RET (0x8)
-#define TFM_SVC_ENABLE_IRQ (0x9)
-#define TFM_SVC_DISABLE_IRQ (0xA)
+#define TFM_SVC_GET_BOOT_DATA (0x5)
+#define TFM_SVC_DEPRIV_REQ (0x6)
+#define TFM_SVC_DEPRIV_RET (0x7)
+#define TFM_SVC_ENABLE_IRQ (0x8)
+#define TFM_SVC_DISABLE_IRQ (0x9)
#if (TFM_SPM_LOG_LEVEL > TFM_SPM_LOG_LEVEL_SILENCE)
-#define TFM_SVC_OUTPUT_UNPRIV_STRING (0xB)
+#define TFM_SVC_OUTPUT_UNPRIV_STRING (0xA)
#endif
#endif /* __TFM_CORE_SVC_H__ */
diff --git a/secure_fw/spm/cmsis_func/include/tfm_spm_services.h b/secure_fw/spm/cmsis_func/include/tfm_spm_services.h
new file mode 100644
index 0000000..a556573
--- /dev/null
+++ b/secure_fw/spm/cmsis_func/include/tfm_spm_services.h
@@ -0,0 +1,18 @@
+/*
+ * Copyright (c) 2018-2021, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#ifndef __TFM_SPM_SERVICES_H__
+#define __TFM_SPM_SERVICES_H__
+
+#include <stdint.h>
+
+typedef uint32_t psa_signal_t;
+
+void tfm_enable_irq(psa_signal_t irq_signal);
+void tfm_disable_irq(psa_signal_t irq_signal);
+
+#endif /* __TFM_SPM_SERVICES_H__ */
diff --git a/secure_fw/spm/cmsis_func/spm_func.c b/secure_fw/spm/cmsis_func/spm_func.c
index 252716e..882f517 100644
--- a/secure_fw/spm/cmsis_func/spm_func.c
+++ b/secure_fw/spm/cmsis_func/spm_func.c
@@ -26,7 +26,7 @@
#include "region.h"
#include "spm_partition_defs.h"
#include "psa_manifest/pid.h"
-#include "tfm/tfm_spm_services.h"
+#include "tfm_spm_services.h"
#include "tfm_spm_db_func.inc"
/* Structure to temporarily save iovec parameters from PSA client */
@@ -1372,39 +1372,6 @@
partition->runtime_data.orig_outvec = 0;
}
-void tfm_spm_request_handler(const struct tfm_state_context_t *svc_ctx)
-{
- uint32_t *res_ptr = (uint32_t *)&svc_ctx->r0;
- uint32_t running_partition_flags = 0;
- uint32_t running_partition_idx;
-
- /* Check permissions on request type basis */
-
- switch (svc_ctx->r0) {
- case TFM_SPM_REQUEST_RESET_VOTE:
- running_partition_idx =
- tfm_spm_partition_get_running_partition_idx();
- running_partition_flags = tfm_spm_partition_get_flags(
- running_partition_idx);
-
- /* Currently only PSA Root of Trust services are allowed to make Reset
- * vote request
- */
- if ((running_partition_flags & SPM_PART_FLAG_PSA_ROT) == 0) {
- *res_ptr = (uint32_t)TFM_ERROR_GENERIC;
- }
-
- /* FixMe: this is a placeholder for checks to be performed before
- * allowing execution of reset
- */
- *res_ptr = (uint32_t)TFM_SUCCESS;
-
- break;
- default:
- *res_ptr = (uint32_t)TFM_ERROR_INVALID_PARAMETER;
- }
-}
-
enum spm_err_t tfm_spm_db_init(void)
{
uint32_t i;
diff --git a/secure_fw/spm/cmsis_func/tfm_core_svcalls_func.c b/secure_fw/spm/cmsis_func/tfm_core_svcalls_func.c
index e6412a5..ef37f1b 100644
--- a/secure_fw/spm/cmsis_func/tfm_core_svcalls_func.c
+++ b/secure_fw/spm/cmsis_func/tfm_core_svcalls_func.c
@@ -68,9 +68,6 @@
case TFM_SVC_SFN_COMPLETION:
tfm_spm_partition_completion_handler(svc_args[0], svc_args[1], msp);
break;
- case TFM_SVC_SPM_REQUEST:
- tfm_spm_request_handler((struct tfm_state_context_t *)svc_args);
- break;
case TFM_SVC_DEPRIV_REQ:
retval = tfm_spm_depriv_req_handler(svc_args, exc_return);
break;
diff --git a/secure_fw/spm/cmsis_psa/arch/tfm_arch.c b/secure_fw/spm/cmsis_psa/arch/tfm_arch.c
index 34b347d..3d9f076 100644
--- a/secure_fw/spm/cmsis_psa/arch/tfm_arch.c
+++ b/secure_fw/spm/cmsis_psa/arch/tfm_arch.c
@@ -8,21 +8,7 @@
#include "svc_num.h"
#include "tfm_arch.h"
#include "tfm_core_utils.h"
-#include "tfm/tfm_spm_services.h"
-__attribute__((naked))
-static int32_t tfm_spm_request(int32_t request_type)
-{
- __ASM volatile(
- "SVC %0\n"
- "BX lr\n"
- : : "I" (TFM_SVC_SPM_REQUEST));
-}
-
-int32_t tfm_spm_request_reset_vote(void)
-{
- return tfm_spm_request((int32_t)TFM_SPM_REQUEST_RESET_VOTE);
-}
static void tfm_arch_init_state_ctx(struct tfm_state_context_t *p_stat_ctx,
void *param, uintptr_t pfn)
diff --git a/secure_fw/spm/cmsis_psa/spm_ipc.c b/secure_fw/spm/cmsis_psa/spm_ipc.c
index 75661b2..71a4afd 100644
--- a/secure_fw/spm/cmsis_psa/spm_ipc.c
+++ b/secure_fw/spm/cmsis_psa/spm_ipc.c
@@ -29,7 +29,6 @@
#include "tfm_pools.h"
#include "region.h"
#include "psa_manifest/pid.h"
-#include "tfm/tfm_spm_services.h"
#include "load/partition_defs.h"
#include "load/service_defs.h"
#include "load/asset_defs.h"
@@ -1052,37 +1051,3 @@
}
}
#endif
-
-void tfm_spm_request_handler(const struct tfm_state_context_t *svc_ctx)
-{
- uint32_t *res_ptr = (uint32_t *)&svc_ctx->r0;
- uint32_t running_partition_flags = 0;
- const struct partition_t *partition = NULL;
-
- /* Check permissions on request type basis */
-
- switch (svc_ctx->r0) {
- case TFM_SPM_REQUEST_RESET_VOTE:
- partition = tfm_spm_get_running_partition();
- if (!partition) {
- tfm_core_panic();
- }
- running_partition_flags = partition->p_ldinf->flags;
-
- /* Currently only PSA Root of Trust services are allowed to make Reset
- * vote request
- */
- if ((running_partition_flags & SPM_PART_FLAG_PSA_ROT) == 0) {
- *res_ptr = (uint32_t)TFM_ERROR_GENERIC;
- }
-
- /* FixMe: this is a placeholder for checks to be performed before
- * allowing execution of reset
- */
- *res_ptr = (uint32_t)TFM_SUCCESS;
-
- break;
- default:
- *res_ptr = (uint32_t)TFM_ERROR_INVALID_PARAMETER;
- }
-}
diff --git a/secure_fw/spm/cmsis_psa/spm_ipc.h b/secure_fw/spm/cmsis_psa/spm_ipc.h
index 9dad8b1..e3c7a2f 100644
--- a/secure_fw/spm/cmsis_psa/spm_ipc.h
+++ b/secure_fw/spm/cmsis_psa/spm_ipc.h
@@ -142,12 +142,6 @@
uint32_t tfm_spm_partition_get_privileged_mode(uint32_t partition_flags);
/**
- * \brief Handle an SPM request by a secure service
- * \param[in] svc_ctx The stacked SVC context
- */
-void tfm_spm_request_handler(const struct tfm_state_context_t *svc_ctx);
-
-/**
* \brief Get the running partition ID.
*
* \return Returns the partition ID
diff --git a/secure_fw/spm/cmsis_psa/tfm_core_svcalls_ipc.c b/secure_fw/spm/cmsis_psa/tfm_core_svcalls_ipc.c
index 7e41f84..9819416 100644
--- a/secure_fw/spm/cmsis_psa/tfm_core_svcalls_ipc.c
+++ b/secure_fw/spm/cmsis_psa/tfm_core_svcalls_ipc.c
@@ -88,9 +88,6 @@
case TFM_SVC_PSA_PANIC:
tfm_spm_partition_psa_panic();
break;
- case TFM_SVC_SPM_REQUEST:
- tfm_spm_request_handler((const struct tfm_state_context_t *)ctx);
- break;
case TFM_SVC_PSA_LIFECYCLE:
return tfm_spm_get_lifecycle_state();
#if (TFM_SPM_LOG_LEVEL > TFM_SPM_LOG_LEVEL_SILENCE)
diff --git a/secure_fw/spm/include/interface/svc_num.h b/secure_fw/spm/include/interface/svc_num.h
index 7a3c3c5..2b88e16 100644
--- a/secure_fw/spm/include/interface/svc_num.h
+++ b/secure_fw/spm/include/interface/svc_num.h
@@ -39,10 +39,9 @@
#define TFM_SVC_PSA_IRQ_DISABLE (0x12)
#define TFM_SVC_PSA_RESET_SIGNAL (0x13)
/* TF-M specific, starts from 0x40 */
-#define TFM_SVC_SPM_REQUEST (0x40)
-#define TFM_SVC_GET_BOOT_DATA (0x41)
-#define TFM_SVC_SPM_INIT (0x42)
-#define TFM_SVC_FLIH_FUNC_RETURN (0x43)
+#define TFM_SVC_GET_BOOT_DATA (0x40)
+#define TFM_SVC_SPM_INIT (0x41)
+#define TFM_SVC_FLIH_FUNC_RETURN (0x42)
#define TFM_SVC_THREAD_NUMBER_END (0x7F)
#if (TFM_SPM_LOG_LEVEL > TFM_SPM_LOG_LEVEL_SILENCE)
#define TFM_SVC_OUTPUT_UNPRIV_STRING (TFM_SVC_THREAD_NUMBER_END)