SPM: Move message list to partition

Partitions do not need to know their services. Only services need to
know the partition they belong to. Messages are put in the partition
structure.

This patch:
- Changes the message queue into message list, and moves the
  message list to partition structure.
- Remove service list in partition rumtime data structure, and
  changes related API.
- Remove 'tfm_message_queue.c' and 'tfm_message_queue.h'

Change-Id: I38acefb301f5772042d14ac79599d5ad569b90e5
Signed-off-by: Mingyang Sun <mingyang.sun@arm.com>
diff --git a/secure_fw/partitions/tfm_service_list.inc b/secure_fw/partitions/tfm_service_list.inc
index 4800ae3..d68be93 100644
--- a/secure_fw/partitions/tfm_service_list.inc
+++ b/secure_fw/partitions/tfm_service_list.inc
@@ -515,35 +515,30 @@
         .service_db = NULL,
         .partition = NULL,
         .handle_list = {0},
-        .msg_queue = {0},
         .list = {0},
     },
     {
         .service_db = NULL,
         .partition = NULL,
         .handle_list = {0},
-        .msg_queue = {0},
         .list = {0},
     },
     {
         .service_db = NULL,
         .partition = NULL,
         .handle_list = {0},
-        .msg_queue = {0},
         .list = {0},
     },
     {
         .service_db = NULL,
         .partition = NULL,
         .handle_list = {0},
-        .msg_queue = {0},
         .list = {0},
     },
     {
         .service_db = NULL,
         .partition = NULL,
         .handle_list = {0},
-        .msg_queue = {0},
         .list = {0},
     },
 #endif /* TFM_PARTITION_PROTECTED_STORAGE */
@@ -554,28 +549,24 @@
         .service_db = NULL,
         .partition = NULL,
         .handle_list = {0},
-        .msg_queue = {0},
         .list = {0},
     },
     {
         .service_db = NULL,
         .partition = NULL,
         .handle_list = {0},
-        .msg_queue = {0},
         .list = {0},
     },
     {
         .service_db = NULL,
         .partition = NULL,
         .handle_list = {0},
-        .msg_queue = {0},
         .list = {0},
     },
     {
         .service_db = NULL,
         .partition = NULL,
         .handle_list = {0},
-        .msg_queue = {0},
         .list = {0},
     },
 #endif /* TFM_PARTITION_INTERNAL_TRUSTED_STORAGE */
@@ -586,7 +577,6 @@
         .service_db = NULL,
         .partition = NULL,
         .handle_list = {0},
-        .msg_queue = {0},
         .list = {0},
     },
 #endif /* TFM_PARTITION_CRYPTO */
@@ -597,21 +587,18 @@
         .service_db = NULL,
         .partition = NULL,
         .handle_list = {0},
-        .msg_queue = {0},
         .list = {0},
     },
     {
         .service_db = NULL,
         .partition = NULL,
         .handle_list = {0},
-        .msg_queue = {0},
         .list = {0},
     },
     {
         .service_db = NULL,
         .partition = NULL,
         .handle_list = {0},
-        .msg_queue = {0},
         .list = {0},
     },
 #endif /* TFM_PARTITION_PLATFORM */
@@ -622,21 +609,18 @@
         .service_db = NULL,
         .partition = NULL,
         .handle_list = {0},
-        .msg_queue = {0},
         .list = {0},
     },
     {
         .service_db = NULL,
         .partition = NULL,
         .handle_list = {0},
-        .msg_queue = {0},
         .list = {0},
     },
     {
         .service_db = NULL,
         .partition = NULL,
         .handle_list = {0},
-        .msg_queue = {0},
         .list = {0},
     },
 #endif /* TFM_PARTITION_INITIAL_ATTESTATION */
@@ -647,70 +631,60 @@
         .service_db = NULL,
         .partition = NULL,
         .handle_list = {0},
-        .msg_queue = {0},
         .list = {0},
     },
     {
         .service_db = NULL,
         .partition = NULL,
         .handle_list = {0},
-        .msg_queue = {0},
         .list = {0},
     },
     {
         .service_db = NULL,
         .partition = NULL,
         .handle_list = {0},
-        .msg_queue = {0},
         .list = {0},
     },
     {
         .service_db = NULL,
         .partition = NULL,
         .handle_list = {0},
-        .msg_queue = {0},
         .list = {0},
     },
     {
         .service_db = NULL,
         .partition = NULL,
         .handle_list = {0},
-        .msg_queue = {0},
         .list = {0},
     },
     {
         .service_db = NULL,
         .partition = NULL,
         .handle_list = {0},
-        .msg_queue = {0},
         .list = {0},
     },
     {
         .service_db = NULL,
         .partition = NULL,
         .handle_list = {0},
-        .msg_queue = {0},
         .list = {0},
     },
     {
         .service_db = NULL,
         .partition = NULL,
         .handle_list = {0},
-        .msg_queue = {0},
         .list = {0},
     },
     {
         .service_db = NULL,
         .partition = NULL,
         .handle_list = {0},
-        .msg_queue = {0},
         .list = {0},
     },
     {
         .service_db = NULL,
         .partition = NULL,
         .handle_list = {0},
-        .msg_queue = {0},
         .list = {0},
     },
 #endif /* TFM_PARTITION_TEST_CORE */
@@ -721,42 +695,36 @@
         .service_db = NULL,
         .partition = NULL,
         .handle_list = {0},
-        .msg_queue = {0},
         .list = {0},
     },
     {
         .service_db = NULL,
         .partition = NULL,
         .handle_list = {0},
-        .msg_queue = {0},
         .list = {0},
     },
     {
         .service_db = NULL,
         .partition = NULL,
         .handle_list = {0},
-        .msg_queue = {0},
         .list = {0},
     },
     {
         .service_db = NULL,
         .partition = NULL,
         .handle_list = {0},
-        .msg_queue = {0},
         .list = {0},
     },
     {
         .service_db = NULL,
         .partition = NULL,
         .handle_list = {0},
-        .msg_queue = {0},
         .list = {0},
     },
     {
         .service_db = NULL,
         .partition = NULL,
         .handle_list = {0},
-        .msg_queue = {0},
         .list = {0},
     },
 #endif /* TFM_PARTITION_TEST_CORE */
@@ -767,7 +735,6 @@
         .service_db = NULL,
         .partition = NULL,
         .handle_list = {0},
-        .msg_queue = {0},
         .list = {0},
     },
 #endif /* TFM_PARTITION_TEST_SECURE_SERVICES */
@@ -778,35 +745,30 @@
         .service_db = NULL,
         .partition = NULL,
         .handle_list = {0},
-        .msg_queue = {0},
         .list = {0},
     },
     {
         .service_db = NULL,
         .partition = NULL,
         .handle_list = {0},
-        .msg_queue = {0},
         .list = {0},
     },
     {
         .service_db = NULL,
         .partition = NULL,
         .handle_list = {0},
-        .msg_queue = {0},
         .list = {0},
     },
     {
         .service_db = NULL,
         .partition = NULL,
         .handle_list = {0},
-        .msg_queue = {0},
         .list = {0},
     },
     {
         .service_db = NULL,
         .partition = NULL,
         .handle_list = {0},
-        .msg_queue = {0},
         .list = {0},
     },
 #endif /* TFM_PARTITION_TEST_CORE_IPC */
@@ -817,35 +779,30 @@
         .service_db = NULL,
         .partition = NULL,
         .handle_list = {0},
-        .msg_queue = {0},
         .list = {0},
     },
     {
         .service_db = NULL,
         .partition = NULL,
         .handle_list = {0},
-        .msg_queue = {0},
         .list = {0},
     },
     {
         .service_db = NULL,
         .partition = NULL,
         .handle_list = {0},
-        .msg_queue = {0},
         .list = {0},
     },
     {
         .service_db = NULL,
         .partition = NULL,
         .handle_list = {0},
-        .msg_queue = {0},
         .list = {0},
     },
     {
         .service_db = NULL,
         .partition = NULL,
         .handle_list = {0},
-        .msg_queue = {0},
         .list = {0},
     },
 #endif /* TFM_PARTITION_TEST_CORE_IPC */
@@ -856,14 +813,12 @@
         .service_db = NULL,
         .partition = NULL,
         .handle_list = {0},
-        .msg_queue = {0},
         .list = {0},
     },
     {
         .service_db = NULL,
         .partition = NULL,
         .handle_list = {0},
-        .msg_queue = {0},
         .list = {0},
     },
 #endif /* TFM_ENABLE_IRQ_TEST */
@@ -874,7 +829,6 @@
         .service_db = NULL,
         .partition = NULL,
         .handle_list = {0},
-        .msg_queue = {0},
         .list = {0},
     },
 #endif /* TFM_PARTITION_TEST_PS */
@@ -885,7 +839,6 @@
         .service_db = NULL,
         .partition = NULL,
         .handle_list = {0},
-        .msg_queue = {0},
         .list = {0},
     },
 #endif /* TFM_PARTITION_TEST_SECURE_SERVICES */
diff --git a/secure_fw/partitions/tfm_service_list.inc.template b/secure_fw/partitions/tfm_service_list.inc.template
index fdbbb3d..e784b66 100644
--- a/secure_fw/partitions/tfm_service_list.inc.template
+++ b/secure_fw/partitions/tfm_service_list.inc.template
@@ -72,7 +72,6 @@
         .service_db = NULL,
         .partition = NULL,
         .handle_list = {0},
-        .msg_queue = {0},
         .list = {0},
     {{'}'}},
             {% endfor %}
diff --git a/secure_fw/spm/cmsis_psa/CMakeLists.inc b/secure_fw/spm/cmsis_psa/CMakeLists.inc
index ee99991..fbd83cc 100644
--- a/secure_fw/spm/cmsis_psa/CMakeLists.inc
+++ b/secure_fw/spm/cmsis_psa/CMakeLists.inc
@@ -40,7 +40,6 @@
 		"${SFW_IPC_SPM_DIR}/spm_ipc.c"
 		"${SFW_IPC_SPM_DIR}/spm_psa_client_call.c"
 		"${SFW_IPC_SPM_DIR}/tfm_core_svcalls_ipc.c"
-		"${SFW_IPC_SPM_DIR}/tfm_message_queue.c"
 		"${SFW_SPM_RUNTIME_DIR}/utilities.c"
 		"${SFW_SPM_RUNTIME_DIR}/tfm_core_utils.c"
 		"${SFW_IPC_SPM_DIR}/tfm_pools.c"
diff --git a/secure_fw/spm/cmsis_psa/include/spm_ipc.h b/secure_fw/spm/cmsis_psa/include/spm_ipc.h
index c283560..607156d 100644
--- a/secure_fw/spm/cmsis_psa/include/spm_ipc.h
+++ b/secure_fw/spm/cmsis_psa/include/spm_ipc.h
@@ -13,7 +13,6 @@
 #include "tfm_arch.h"
 #include "tfm_list.h"
 #include "tfm_wait.h"
-#include "tfm_message_queue.h"
 #include "tfm_secure_api.h"
 #include "tfm_thread.h"
 #include "psa/service.h"
@@ -45,6 +44,8 @@
 #define TFM_PRIORITY_LOW                THRD_PRIOR_LOWEST
 #define TFM_PRIORITY(LEVEL)             TFM_PRIORITY_##LEVEL
 
+#define TFM_MSG_MAGIC                   0x15154343
+
 enum spm_err_t {
     SPM_ERR_OK = 0,
     SPM_ERR_PARTITION_DB_NOT_INIT,
@@ -54,19 +55,41 @@
     SPM_ERR_INVALID_CONFIG,
 };
 
+/* Message struct to collect parameter from client */
+struct tfm_msg_body_t {
+    int32_t magic;
+    struct tfm_spm_service_t *service; /* RoT service pointer            */
+    struct tfm_event_t ack_evnt;       /* Event for ack reponse          */
+    psa_msg_t msg;                     /* PSA message body               */
+    psa_invec invec[PSA_MAX_IOVEC];    /* Put in/out vectors in msg body */
+    psa_outvec outvec[PSA_MAX_IOVEC];
+    psa_outvec *caller_outvec;         /*
+                                        * Save caller outvec pointer for
+                                        * write length update
+                                        */
+#ifdef TFM_MULTI_CORE_TOPOLOGY
+    const void *caller_data;           /*
+                                        * Pointer to the private data of the
+                                        * caller. It identifies the NSPE PSA
+                                        * client calls in multi-core topology
+                                        */
+#endif
+    struct tfm_list_node_t msg_node;   /* For list operators             */
+};
+
 /**
  * \brief Runtime context information of a partition
  */
 struct spm_partition_runtime_data_t {
     uint32_t signals;                   /* Service signals had been triggered*/
     struct tfm_event_t signal_evnt;     /* Event signal                      */
-    struct tfm_list_node_t service_list;/* Service list                      */
     struct tfm_core_thread_t sp_thrd;   /* Thread object                     */
     uint32_t assigned_signals;          /* All assigned signals              */
     uint32_t signal_mask;               /*
                                          * Service signal mask passed by
                                          * psa_wait()
                                          */
+    struct tfm_list_node_t msg_list;    /* Message list                      */
 };
 
 /**
@@ -128,7 +151,6 @@
                                               * data
                                               */
     struct tfm_list_node_t handle_list;      /* Service handle list          */
-    struct tfm_msg_queue_t msg_queue;        /* Message queue                */
     struct tfm_list_node_t list;             /* For list operation           */
 };
 
diff --git a/secure_fw/spm/cmsis_psa/include/tfm_message_queue.h b/secure_fw/spm/cmsis_psa/include/tfm_message_queue.h
deleted file mode 100644
index a4e0e1b..0000000
--- a/secure_fw/spm/cmsis_psa/include/tfm_message_queue.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-#ifndef __TFM_MESSAGE_QUEUE_H__
-#define __TFM_MESSAGE_QUEUE_H__
-
-#include "psa/service.h"
-#include "tfm_wait.h"
-
-#define TFM_MSG_MAGIC               0x15154343
-/* Message struct to collect parameter from client */
-struct tfm_msg_body_t {
-    int32_t magic;
-    struct tfm_spm_service_t *service; /* RoT service pointer            */
-    struct tfm_event_t ack_evnt;       /* Event for ack reponse          */
-    psa_msg_t msg;                     /* PSA message body               */
-    psa_invec invec[PSA_MAX_IOVEC];    /* Put in/out vectors in msg body */
-    psa_outvec outvec[PSA_MAX_IOVEC];
-    psa_outvec *caller_outvec;         /*
-                                        * Save caller outvec pointer for
-                                        * write length update
-                                        */
-#ifdef TFM_MULTI_CORE_TOPOLOGY
-    const void *caller_data;           /*
-                                        * Pointer to the private data of the
-                                        * caller. It identifies the NSPE PSA
-                                        * client calls in multi-core topology
-                                        */
-#endif
-    struct tfm_msg_body_t *next;       /* List operators                 */
-};
-
-struct tfm_msg_queue_t {
-    struct tfm_msg_body_t *head;    /* Queue head                       */
-    struct tfm_msg_body_t *tail;    /* Queue tail                       */
-    uint32_t size;                  /* Number of the queue member       */
-};
-
-/**
- * \brief Enqueue a message into message queue.
- *
- * \param[in] queue             Message queue, it will be initialized
- *                              if has not been initialized.
- * \param[in] node              Message queue node want to be enqueue.
- *
- * \retval IPC_SUCCESS          Success.
- * \retval IPC_ERROR_BAD_PARAMETERS Parameters error.
- */
-int32_t tfm_msg_enqueue(struct tfm_msg_queue_t *queue,
-                        struct tfm_msg_body_t *node);
-
-/**
- * \brief Dequeue a message from message queue.
- *
- * \param[in] queue             Message queue.
- *
- * \retval node pointer         Success.
- * \retval NULL                 Queue is NULL or size is zero.
- */
-struct tfm_msg_body_t *tfm_msg_dequeue(struct tfm_msg_queue_t *queue);
-
-/**
- * \brief Check if a message queue is empty.
- *
- * \param[in] queue             Message queue.
- *
- * \returns                     Returns 1 for empty, or 0 for not.
- */
-int32_t tfm_msg_queue_is_empty(struct tfm_msg_queue_t *queue);
-
-#endif
diff --git a/secure_fw/spm/cmsis_psa/include/tfm_rpc.h b/secure_fw/spm/cmsis_psa/include/tfm_rpc.h
index cf573f8..c07ac82 100644
--- a/secure_fw/spm/cmsis_psa/include/tfm_rpc.h
+++ b/secure_fw/spm/cmsis_psa/include/tfm_rpc.h
@@ -22,7 +22,7 @@
 #include "psa/service.h"
 #include "tfm_thread.h"
 #include "tfm_wait.h"
-#include "tfm_message_queue.h"
+#include "spm_ipc.h"
 
 #define TFM_RPC_SUCCESS             (0)
 #define TFM_RPC_INVAL_PARAM         (INT32_MIN + 1)
diff --git a/secure_fw/spm/cmsis_psa/spm_ipc.c b/secure_fw/spm/cmsis_psa/spm_ipc.c
index 6537c88..824cd04 100644
--- a/secure_fw/spm/cmsis_psa/spm_ipc.c
+++ b/secure_fw/spm/cmsis_psa/spm_ipc.c
@@ -14,7 +14,6 @@
 #include "tfm_wait.h"
 #include "utilities.h"
 #include "tfm_internal_defines.h"
-#include "tfm_message_queue.h"
 #include "tfm_spm_hal.h"
 #include "tfm_irq_list.h"
 #include "tfm_api.h"
@@ -257,7 +256,7 @@
 /* Partition management functions */
 
 /**
- * \brief                   Get the service context by signal.
+ * \brief                   Get the msg context by signal.
  *
  * \param[in] partition     Partition context pointer
  *                          \ref partition_t structures
@@ -266,29 +265,40 @@
  *
  * \retval NULL             Failed
  * \retval "Not NULL"       Target service context pointer,
- *                          \ref tfm_spm_service_t structures
+ *                          \ref tfm_msg_body_t structures
  */
-static struct tfm_spm_service_t *
-    tfm_spm_get_service_by_signal(struct partition_t *partition,
-                                  psa_signal_t signal)
+static struct tfm_msg_body_t *
+    tfm_spm_get_msg_by_signal(struct partition_t *partition,
+                              psa_signal_t signal)
 {
     struct tfm_list_node_t *node, *head;
-    struct tfm_spm_service_t *service;
+    struct tfm_msg_body_t *tmp_msg, *msg = NULL;
 
     TFM_CORE_ASSERT(partition);
 
-    if (tfm_list_is_empty(&partition->runtime_data.service_list)) {
-        tfm_core_panic();
+    head = &partition->runtime_data.msg_list;
+
+    if (tfm_list_is_empty(head)) {
+        return NULL;
     }
 
-    head = &partition->runtime_data.service_list;
+    /*
+     * There may be multiple messages for this RoT Service signal, do not clear
+     * partition mask until no remaining message. Search may be optimized.
+     */
     TFM_LIST_FOR_EACH(node, head) {
-        service = TFM_GET_CONTAINER_PTR(node, struct tfm_spm_service_t, list);
-        if (service->service_db->signal == signal) {
-            return service;
+        tmp_msg = TFM_GET_CONTAINER_PTR(node, struct tfm_msg_body_t, msg_node);
+        if (tmp_msg->service->service_db->signal == signal && msg) {
+            return msg;
+        } else if (tmp_msg->service->service_db->signal == signal) {
+            msg = tmp_msg;
+            tfm_list_del_node(node);
         }
     }
-    return NULL;
+
+    partition->runtime_data.signals &= ~signal;
+
+    return msg;
 }
 
 /**
@@ -609,10 +619,8 @@
     TFM_CORE_ASSERT(service);
     TFM_CORE_ASSERT(msg);
 
-    /* Enqueue message to service message queue */
-    if (tfm_msg_enqueue(&service->msg_queue, msg) != IPC_SUCCESS) {
-        return IPC_ERROR_GENERIC;
-    }
+    /* Add message to partition message list tail */
+    tfm_list_add_tail(&p_runtime_data->msg_list, &msg->msg_node);
 
     /* Messages put. Update signals */
     p_runtime_data->signals |= service->service_db->signal;
@@ -733,7 +741,7 @@
         }
 
         tfm_event_init(&partition->runtime_data.signal_evnt);
-        tfm_list_init(&partition->runtime_data.service_list);
+        tfm_list_init(&partition->runtime_data.msg_list);
 
         pth = &partition->runtime_data.sp_thrd;
         if (!pth) {
@@ -773,8 +781,6 @@
         partition->runtime_data.assigned_signals |= service[i].service_db->signal;
 
         tfm_list_init(&service[i].handle_list);
-        tfm_list_add_tail(&partition->runtime_data.service_list,
-                          &service[i].list);
     }
 
     /*
@@ -984,7 +990,6 @@
 {
     psa_signal_t signal;
     psa_msg_t *msg = NULL;
-    struct tfm_spm_service_t *service = NULL;
     struct tfm_msg_body_t *tmp_msg = NULL;
     struct partition_t *partition = NULL;
     uint32_t privileged;
@@ -1034,15 +1039,10 @@
     }
 
     /*
-     * Get RoT service by signal from partition. It is a fatal error if getting
+     * Get message by signal from partition. It is a fatal error if getting
      * failed, which means the input signal is not correspond to an RoT service.
      */
-    service = tfm_spm_get_service_by_signal(partition, signal);
-    if (!service) {
-        tfm_core_panic();
-    }
-
-    tmp_msg = tfm_msg_dequeue(&service->msg_queue);
+    tmp_msg = tfm_spm_get_msg_by_signal(partition, signal);
     if (!tmp_msg) {
         return PSA_ERROR_DOES_NOT_EXIST;
     }
@@ -1053,14 +1053,6 @@
 
     spm_memcpy(msg, &tmp_msg->msg, sizeof(psa_msg_t));
 
-    /*
-     * There may be multiple messages for this RoT Service signal, do not clear
-     * its mask until no remaining message.
-     */
-    if (tfm_msg_queue_is_empty(&service->msg_queue)) {
-        partition->runtime_data.signals &= ~signal;
-    }
-
     return PSA_SUCCESS;
 }
 
diff --git a/secure_fw/spm/cmsis_psa/spm_psa_client_call.c b/secure_fw/spm/cmsis_psa/spm_psa_client_call.c
index a45232a..4f93746 100644
--- a/secure_fw/spm/cmsis_psa/spm_psa_client_call.c
+++ b/secure_fw/spm/cmsis_psa/spm_psa_client_call.c
@@ -10,7 +10,6 @@
 #include "tfm_core_utils.h"
 #include "tfm_internal_defines.h"
 #include "tfm_memory_utils.h"
-#include "tfm_message_queue.h"
 #include "spm_psa_client_call.h"
 #include "utilities.h"
 #include "tfm_wait.h"
diff --git a/secure_fw/spm/cmsis_psa/tfm_message_queue.c b/secure_fw/spm/cmsis_psa/tfm_message_queue.c
deleted file mode 100644
index 1a7790e..0000000
--- a/secure_fw/spm/cmsis_psa/tfm_message_queue.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2018-2019, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-#include "tfm_internal_defines.h"
-#include "tfm_message_queue.h"
-
-/* Message queue process */
-int32_t tfm_msg_enqueue(struct tfm_msg_queue_t *queue,
-                        struct tfm_msg_body_t *node)
-{
-    if (!queue || !node) {
-        return IPC_ERROR_BAD_PARAMETERS;
-    }
-
-    if (queue->size == 0) {
-        queue->head = node;
-        queue->tail = node;
-    } else {
-        queue->tail->next = node;
-        queue->tail = node;
-    }
-    queue->size++;
-    return IPC_SUCCESS;
-}
-
-struct tfm_msg_body_t *tfm_msg_dequeue(struct tfm_msg_queue_t *queue)
-{
-    struct tfm_msg_body_t *pop_node;
-
-    if (!queue) {
-        return NULL;
-    }
-
-    if (queue->size == 0) {
-        return NULL;
-    }
-
-    pop_node = queue->head;
-    queue->head = queue->head->next;
-    queue->size--;
-    return pop_node;
-}
-
-int32_t tfm_msg_queue_is_empty(struct tfm_msg_queue_t *queue)
-{
-    return queue->size == 0 ? 1 : 0;
-}
diff --git a/secure_fw/spm/common/init/tfm_boot_data.c b/secure_fw/spm/common/init/tfm_boot_data.c
index 660382d..c4b1a29 100644
--- a/secure_fw/spm/common/init/tfm_boot_data.c
+++ b/secure_fw/spm/common/init/tfm_boot_data.c
@@ -19,7 +19,6 @@
 #include "psa/service.h"
 #include "tfm_thread.h"
 #include "tfm_wait.h"
-#include "tfm_message_queue.h"
 #include "tfm_spm_hal.h"
 #include "spm_ipc.h"
 #else