summaryrefslogtreecommitdiff
path: root/bl32
diff options
context:
space:
mode:
authorDaniel Boulby <daniel.boulby@arm.com>2021-10-22 11:37:34 +0100
committerDaniel Boulby <daniel.boulby@arm.com>2022-02-03 11:33:55 +0000
commit4d4821569d15c3411a6fe5dcfc791d6b28c6d6a9 (patch)
tree31680f82bf1cff9f355ac12c86d0e60fd1293147 /bl32
parent7d33ffe4c116506ed63e820d5b6edad81680cd11 (diff)
test(el3-runtime): dit is retained on world switch
Add tsp service to check the value of the PSTATE DIT bit is as expected and toggle it's value. This is used to ensure that the DIT bit is maintained during a switch from the Normal to Secure worlds and back. Change-Id: I4e8bdfa6530e5e75925c0079d4fa2795133c5105 Signed-off-by: Daniel Boulby <daniel.boulby@arm.com>
Diffstat (limited to 'bl32')
-rw-r--r--bl32/tsp/tsp_main.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/bl32/tsp/tsp_main.c b/bl32/tsp/tsp_main.c
index 55e153212..522c1b403 100644
--- a/bl32/tsp/tsp_main.c
+++ b/bl32/tsp/tsp_main.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2020, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2013-2022, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -370,6 +370,7 @@ tsp_args_t *tsp_smc_handler(uint64_t func,
uint64_t service_arg1;
uint64_t results[2];
uint32_t linear_id = plat_my_core_pos();
+ u_register_t dit;
/* Update this cpu's statistics */
tsp_stats[linear_id].smc_count++;
@@ -424,6 +425,23 @@ tsp_args_t *tsp_smc_handler(uint64_t func,
results[0] /= service_arg0 ? service_arg0 : 1;
results[1] /= service_arg1 ? service_arg1 : 1;
break;
+ case TSP_CHECK_DIT:
+ if (!is_armv8_4_dit_present()) {
+#if LOG_LEVEL >= LOG_LEVEL_ERROR
+ spin_lock(&console_lock);
+ ERROR("DIT not supported\n");
+ spin_unlock(&console_lock);
+#endif
+ results[0] = 0;
+ results[1] = 0xffff;
+ break;
+ }
+ dit = read_dit();
+ results[0] = dit == service_arg0;
+ results[1] = dit;
+ /* Toggle the dit bit */
+ write_dit(service_arg0 != 0U ? 0 : DIT_BIT);
+ break;
default:
break;
}