SPM: Refine the get_irq_line_for_signal function
This patch moves the signal bit check from calller to
get_irq_line_for_signal().
The check should have been included in the function.
Change-Id: Ic2b850ecc02ed3ce6477781cfcf213b5aa202db7
Signed-off-by: Kevin Peng <kevin.peng@arm.com>
diff --git a/secure_fw/spm/cmsis_psa/spm_ipc.c b/secure_fw/spm/cmsis_psa/spm_ipc.c
index 188c75f..b64cd1d 100644
--- a/secure_fw/spm/cmsis_psa/spm_ipc.c
+++ b/secure_fw/spm/cmsis_psa/spm_ipc.c
@@ -25,7 +25,6 @@
#include "tfm_rpc.h"
#include "tfm_core_trustzone.h"
#include "tfm_list.h"
-#include "tfm_hal_isolation.h"
#include "tfm_pools.h"
#include "region.h"
#include "region_defs.h"
@@ -878,6 +877,10 @@
{
size_t i;
+ if (!tfm_is_one_bit_set(signal)) {
+ return -1;
+ }
+
for (i = 0; i < tfm_core_irq_signals_count; ++i) {
if (tfm_core_irq_signals[i].partition_id == partition_id &&
tfm_core_irq_signals[i].signal_value == signal) {
@@ -895,11 +898,6 @@
int32_t irq_line = 0;
struct partition_t *partition = NULL;
- /* It is a fatal error if passed signal indicates more than one signals. */
- if (!tfm_is_one_bit_set(irq_signal)) {
- tfm_core_panic();
- }
-
partition = tfm_spm_get_running_partition();
if (!partition) {
tfm_core_panic();
@@ -921,11 +919,6 @@
int32_t irq_line = 0;
struct partition_t *partition = NULL;
- /* It is a fatal error if passed signal indicates more than one signals. */
- if (!tfm_is_one_bit_set(irq_signal)) {
- tfm_core_panic();
- }
-
partition = tfm_spm_get_running_partition();
if (!partition) {
tfm_core_panic();
diff --git a/secure_fw/spm/cmsis_psa/spm_ipc.h b/secure_fw/spm/cmsis_psa/spm_ipc.h
index 3328a30..786ae65 100644
--- a/secure_fw/spm/cmsis_psa/spm_ipc.h
+++ b/secure_fw/spm/cmsis_psa/spm_ipc.h
@@ -506,11 +506,13 @@
*
* \param[in] partition_id The ID of the partition in which we look for
* the signal.
- * \param[in] signal The signal we do the query for.
+ * \param[in] signal The signal to query for.
*
* \retval None-negative value The irq line associated with signal
- * \retval Negative value There was an error finding the IRQ line for the
- * signal. irq_line is unchanged.
+ * \retval Negative value if one of more the following are true:
+ * - the \ref signal indicates more than one signal
+ * - the \ref signal does not belong to the
+ * partition.
*/
int32_t get_irq_line_for_signal(int32_t partition_id, psa_signal_t signal);