From c040621dba5f4c097441e67c9fd99b9df174ba4e Mon Sep 17 00:00:00 2001 From: Marc Bonnici Date: Tue, 15 Nov 2022 11:20:59 +0000 Subject: [PATCH] fix(el3-spm): fix LSP direct message response Ensure that the example LSP correctly sets the sender/receiver field in a direct response. Signed-off-by: Marc Bonnici Change-Id: I482c08d4657617adb00b0f3cf3c8ddc84f1bf7c8 --- plat/arm/board/fvp/fvp_el3_spmc_logical_sp.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/plat/arm/board/fvp/fvp_el3_spmc_logical_sp.c b/plat/arm/board/fvp/fvp_el3_spmc_logical_sp.c index b9e4f864c..72dfa30f0 100644 --- a/plat/arm/board/fvp/fvp_el3_spmc_logical_sp.c +++ b/plat/arm/board/fvp/fvp_el3_spmc_logical_sp.c @@ -27,6 +27,7 @@ static uint64_t handle_ffa_direct_request(uint32_t smc_fid, bool secure_origin, void *handle, uint64_t flags) { uint64_t ret; + uint32_t src_dst; /* Determine if we have a 64 or 32 direct request. */ if (smc_fid == FFA_MSG_SEND_DIRECT_REQ_SMC32) { @@ -36,18 +37,22 @@ static uint64_t handle_ffa_direct_request(uint32_t smc_fid, bool secure_origin, } else { panic(); /* Unknown SMC. */ } + /* * Handle the incoming request. For testing purposes we echo the * incoming message. */ - INFO("Logical Partition: Received Direct Request from %s world!\n", - secure_origin ? "Secure" : "Normal"); + INFO("LSP: Received Direct Request from %s world (0x%x)\n", + secure_origin ? "Secure" : "Normal", ffa_endpoint_source(x1)); + /* Populate the source and destination IDs. */ + src_dst = (uint32_t) LP_PARTITION_ID << FFA_DIRECT_MSG_SOURCE_SHIFT | + ffa_endpoint_source(x1) << FFA_DIRECT_MSG_DESTINATION_SHIFT; /* * Logical SP's must always send a direct response so we can populate * our response directly. */ - SMC_RET8(handle, ret, 0, 0, x4, 0, 0, 0, 0); + SMC_RET8(handle, ret, src_dst, 0, x4, 0, 0, 0, 0); } /* Register logical partition */