Commit c2901419 authored by Olivier Deprez's avatar Olivier Deprez Committed by Max Shvetsov
Browse files

SPMD: introduce SPMC to SPMD messages



FF-A interface to handle SPMC to SPMD direct messages requests.
Signed-off-by: default avatarOlivier Deprez <olivier.deprez@arm.com>
Signed-off-by: default avatarMax Shvetsov <maksims.svecovs@arm.com>
Change-Id: Ia707a308c55561a31dcfa86e554ea1c9e23f862a
parent a334c4e6
......@@ -138,4 +138,43 @@
*/
#define FFA_PARAM_MBZ U(0x0)
/*
* Maximum FF-A endpoint id value
*/
#define FFA_ENDPOINT_ID_MAX U(1 << 16)
/*
* Mask for source and destination endpoint id in
* a direct message request/response.
*/
#define FFA_DIRECT_MSG_ENDPOINT_ID_MASK U(0xffff)
/*
* Bit shift for destination endpoint id in a direct message request/response.
*/
#define FFA_DIRECT_MSG_DESTINATION_SHIFT U(0)
/*
* Bit shift for source endpoint id in a direct message request/response.
*/
#define FFA_DIRECT_MSG_SOURCE_SHIFT U(16)
/******************************************************************************
* ffa_endpoint_destination
*****************************************************************************/
static inline uint16_t ffa_endpoint_destination(unsigned int ep)
{
return (ep >> FFA_DIRECT_MSG_DESTINATION_SHIFT) &
FFA_DIRECT_MSG_ENDPOINT_ID_MASK;
}
/******************************************************************************
* ffa_endpoint_source
*****************************************************************************/
static inline uint16_t ffa_endpoint_source(unsigned int ep)
{
return (ep >> FFA_DIRECT_MSG_SOURCE_SHIFT) &
FFA_DIRECT_MSG_ENDPOINT_ID_MASK;
}
#endif /* FFA_SVC_H */
......@@ -322,8 +322,8 @@ static uint64_t spmd_smc_forward(uint32_t smc_fid,
uint64_t x4,
void *handle)
{
uint32_t secure_state_in = (secure_origin) ? SECURE : NON_SECURE;
uint32_t secure_state_out = (!secure_origin) ? SECURE : NON_SECURE;
unsigned int secure_state_in = (secure_origin) ? SECURE : NON_SECURE;
unsigned int secure_state_out = (!secure_origin) ? SECURE : NON_SECURE;
/* Save incoming security state */
cm_el1_sysregs_context_save(secure_state_in);
......@@ -355,6 +355,15 @@ static uint64_t spmd_ffa_error_return(void *handle, int error_code)
FFA_PARAM_MBZ, FFA_PARAM_MBZ);
}
/******************************************************************************
* spmd_is_spmc_message
*****************************************************************************/
static bool spmd_is_spmc_message(unsigned int ep)
{
return ((ffa_endpoint_destination(ep) == SPMD_DIRECT_MSG_ENDPOINT_ID)
&& (ffa_endpoint_source(ep) == spmc_attrs.spmc_id));
}
/*******************************************************************************
* This function handles all SMCs in the range reserved for FFA. Each call is
* either forwarded to the other security state or handled by the SPM dispatcher
......
......@@ -55,11 +55,14 @@ typedef struct spmd_spm_core_context {
/*
* Reserve ID for NS physical FFA Endpoint.
*/
#define FFA_NS_ENDPOINT_ID U(0)
#define FFA_NS_ENDPOINT_ID U(0)
/* Mask and shift to check valid secure FFA Endpoint ID. */
#define SPMC_SECURE_ID_MASK U(1)
#define SPMC_SECURE_ID_SHIFT U(15)
/* Mask and shift to check valid secure FF-A Endpoint ID. */
#define SPMC_SECURE_ID_MASK U(1)
#define SPMC_SECURE_ID_SHIFT U(15)
#define SPMD_DIRECT_MSG_ENDPOINT_ID U(FFA_ENDPOINT_ID_MAX - 1)
#define SPMD_DIRECT_MSG_SET_ENTRY_POINT U(1)
/* Functions used to enter/exit SPMC synchronously */
uint64_t spmd_spm_core_sync_entry(spmd_spm_core_context_t *ctx);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment