]> git.baikalelectronics.ru Git - arm-tf.git/commitdiff
feat(fvp): copy the Event Log to TZC secured DRAM area
authorManish V Badarkhe <Manish.Badarkhe@arm.com>
Sat, 18 Feb 2023 20:04:43 +0000 (20:04 +0000)
committerManish V Badarkhe <Manish.Badarkhe@arm.com>
Wed, 8 Mar 2023 20:17:24 +0000 (20:17 +0000)
Copied the Event Log from internal SRAM to the TZC secured DRAM
reserved area. Also passed this Trusted DRAM address to OPTEE via
NT FW configuration, and to SPMC via TOS FW configuration,
which is eventually used to extend PCR via fTPM application running
on top of OPTEE/SPMC.

Furthermore, this patch makes it easier to access Event Log in RME
enabled systems where Secure World firmware does not have access to
internal(Root) SRAM.

Change-Id: I005e9da1e6075511f412bdf4d8b541fa543df9ab
Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
plat/arm/board/fvp/fvp_bl2_measured_boot.c

index 29b66197d361774e2d70e26223c385accc99f069..7b0673a14a6acff5ef98eee1e62cec8963291529 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021-2022, Arm Limited. All rights reserved.
+ * Copyright (c) 2021-2023, Arm Limited. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
 #include <plat/arm/common/plat_arm.h>
 #include <plat/common/common_def.h>
 
+#if defined(SPD_tspd) || defined(SPD_opteed) || defined(SPD_spmd)
+CASSERT(ARM_EVENT_LOG_DRAM1_SIZE >= PLAT_ARM_EVENT_LOG_MAX_SIZE, \
+       assert_res_eventlog_mem_insufficient);
+#endif /* defined(SPD_tspd) || defined(SPD_opteed) || defined(SPD_spmd) */
+
 /* Event Log data */
 static uint64_t event_log_base;
 
@@ -195,9 +200,19 @@ void bl2_plat_mboot_finish(void)
 
        event_log_cur_size = event_log_get_cur_size((uint8_t *)event_log_base);
 
+#if defined(SPD_tspd) || defined(SPD_opteed) || defined(SPD_spmd)
+       /* Copy Event Log to TZC secured DRAM memory */
+       (void)memcpy((void *)ARM_EVENT_LOG_DRAM1_BASE,
+                    (const void *)event_log_base,
+                    event_log_cur_size);
+
+       /* Ensure that the Event Log is visible in TZC secured DRAM memory */
+       flush_dcache_range(ARM_EVENT_LOG_DRAM1_BASE, event_log_cur_size);
+#endif /* defined(SPD_tspd) || defined(SPD_opteed) || defined(SPD_spmd) */
+
        rc = arm_set_nt_fw_info(
 #ifdef SPD_opteed
-                           (uintptr_t)event_log_base,
+                           (uintptr_t)ARM_EVENT_LOG_DRAM1_BASE,
 #endif
                            event_log_cur_size, &ns_log_addr);
        if (rc != 0) {
@@ -222,7 +237,7 @@ void bl2_plat_mboot_finish(void)
 
 #if defined(SPD_tspd) || defined(SPD_spmd)
        /* Set Event Log data in TOS_FW_CONFIG */
-       rc = arm_set_tos_fw_info((uintptr_t)event_log_base,
+       rc = arm_set_tos_fw_info((uintptr_t)ARM_EVENT_LOG_DRAM1_BASE,
                                 event_log_cur_size);
        if (rc != 0) {
                ERROR("%s(): Unable to update %s_FW_CONFIG\n",