From eac8077a374c18089936da1c6d48d3314228998d Mon Sep 17 00:00:00 2001 From: Olivier Deprez Date: Fri, 7 Jun 2024 10:22:50 +0200 Subject: [PATCH] refactor(spmd): move plat_my_core_pos calls By tracing instruction execution, it is observed: Placing plat_my_core_pos at top of functions translate by the compiler into calling those functions even if the result is not consumed when not printed. plat_my_core_pos is used to retrieve the core id for the currently running core, but effectively call sites are only consuming it for verbosity purposes. Move plat_my_core_pos calls into the print functions that require it. Signed-off-by: Olivier Deprez Change-Id: Ia3549453b5e4de7c575a8887a4d19e318658d03e --- services/std_svc/spmd/spmd_main.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/services/std_svc/spmd/spmd_main.c b/services/std_svc/spmd/spmd_main.c index fd84d9f67..e3d7fbd8b 100644 --- a/services/std_svc/spmd/spmd_main.c +++ b/services/std_svc/spmd/spmd_main.c @@ -202,7 +202,6 @@ static uint64_t spmd_secure_interrupt_handler(uint32_t id, { spmd_spm_core_context_t *ctx = spmd_get_context(); gp_regs_t *gpregs = get_gpregs_ctx(&ctx->cpu_ctx); - unsigned int linear_id = plat_my_core_pos(); int64_t rc; /* Sanity check the security state when the exception was generated */ @@ -233,7 +232,7 @@ static uint64_t spmd_secure_interrupt_handler(uint32_t id, rc = spmd_spm_core_sync_entry(ctx); if (rc != 0ULL) { - ERROR("%s failed (%" PRId64 ") on CPU%u\n", __func__, rc, linear_id); + ERROR("%s failed (%" PRId64 ") on CPU%u\n", __func__, rc, plat_my_core_pos()); } ctx->secure_interrupt_ongoing = false; @@ -839,7 +838,6 @@ uint64_t spmd_smc_handler(uint32_t smc_fid, void *handle, uint64_t flags) { - unsigned int linear_id = plat_my_core_pos(); spmd_spm_core_context_t *ctx = spmd_get_context(); bool secure_origin; int ret; @@ -850,7 +848,7 @@ uint64_t spmd_smc_handler(uint32_t smc_fid, VERBOSE("SPM(%u): 0x%x 0x%" PRIx64 " 0x%" PRIx64 " 0x%" PRIx64 " 0x%" PRIx64 " 0x%" PRIx64 " 0x%" PRIx64 " 0x%" PRIx64 "\n", - linear_id, smc_fid, x1, x2, x3, x4, + plat_my_core_pos(), smc_fid, x1, x2, x3, x4, SMC_GET_GP(handle, CTX_GPREG_X5), SMC_GET_GP(handle, CTX_GPREG_X6), SMC_GET_GP(handle, CTX_GPREG_X7));