Commit 70c121a2 authored by Daniel Boulby's avatar Daniel Boulby
Browse files

feat(spmd): add support for FFA_SPM_ID_GET



Handle calls to the FFA_SPM_ID_GET interface. If FFA_SPM_ID_GET is
invoked from the non-secure physical FF-A instance, return the SPMC id
(defined in the SPMC manifest). If FFA_SPM_ID_GET is invoked from
the secure physical FF-A instance (e.g. the SPMC), return the SPMD id.

Change-Id: Id6d4e96b1da2510386d344e09c4553dba01227ec
Signed-off-by: default avatarDaniel Boulby <daniel.boulby@arm.com>
parent 57dde212
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
/* The macros below are used to identify FFA calls from the SMC function ID */ /* The macros below are used to identify FFA calls from the SMC function ID */
#define FFA_FNUM_MIN_VALUE U(0x60) #define FFA_FNUM_MIN_VALUE U(0x60)
#define FFA_FNUM_MAX_VALUE U(0x84) #define FFA_FNUM_MAX_VALUE U(0x85)
#define is_ffa_fid(fid) __extension__ ({ \ #define is_ffa_fid(fid) __extension__ ({ \
__typeof__(fid) _fid = (fid); \ __typeof__(fid) _fid = (fid); \
((GET_SMC_NUM(_fid) >= FFA_FNUM_MIN_VALUE) && \ ((GET_SMC_NUM(_fid) >= FFA_FNUM_MIN_VALUE) && \
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
#define FFA_FNUM_RXTX_MAP U(0x66) #define FFA_FNUM_RXTX_MAP U(0x66)
#define FFA_FNUM_RXTX_UNMAP U(0x67) #define FFA_FNUM_RXTX_UNMAP U(0x67)
#define FFA_FNUM_PARTITION_INFO_GET U(0x68) #define FFA_FNUM_PARTITION_INFO_GET U(0x68)
#define FFA_FNUM_ID_GET U(0x69) #define FFA_FNUM_ID_GET U(0x69)
#define FFA_FNUM_MSG_POLL U(0x6A) #define FFA_FNUM_MSG_POLL U(0x6A)
#define FFA_FNUM_MSG_WAIT U(0x6B) #define FFA_FNUM_MSG_WAIT U(0x6B)
#define FFA_FNUM_MSG_YIELD U(0x6C) #define FFA_FNUM_MSG_YIELD U(0x6C)
...@@ -86,6 +86,7 @@ ...@@ -86,6 +86,7 @@
#define FFA_FNUM_MEM_RELINQUISH U(0x76) #define FFA_FNUM_MEM_RELINQUISH U(0x76)
#define FFA_FNUM_MEM_RECLAIM U(0x77) #define FFA_FNUM_MEM_RECLAIM U(0x77)
#define FFA_FNUM_SECONDARY_EP_REGISTER U(0x84) #define FFA_FNUM_SECONDARY_EP_REGISTER U(0x84)
#define FFA_FNUM_SPM_ID_GET U(0x85)
/* FFA SMC32 FIDs */ /* FFA SMC32 FIDs */
#define FFA_ERROR FFA_FID(SMC_32, FFA_FNUM_ERROR) #define FFA_ERROR FFA_FID(SMC_32, FFA_FNUM_ERROR)
...@@ -115,6 +116,7 @@ ...@@ -115,6 +116,7 @@
#define FFA_MEM_RETRIEVE_RESP FFA_FID(SMC_32, FFA_FNUM_MEM_RETRIEVE_RESP) #define FFA_MEM_RETRIEVE_RESP FFA_FID(SMC_32, FFA_FNUM_MEM_RETRIEVE_RESP)
#define FFA_MEM_RELINQUISH FFA_FID(SMC_32, FFA_FNUM_MEM_RELINQUISH) #define FFA_MEM_RELINQUISH FFA_FID(SMC_32, FFA_FNUM_MEM_RELINQUISH)
#define FFA_MEM_RECLAIM FFA_FID(SMC_32, FFA_FNUM_MEM_RECLAIM) #define FFA_MEM_RECLAIM FFA_FID(SMC_32, FFA_FNUM_MEM_RECLAIM)
#define FFA_SPM_ID_GET FFA_FID(SMC_32, FFA_FNUM_SPM_ID_GET)
/* FFA SMC64 FIDs */ /* FFA SMC64 FIDs */
#define FFA_ERROR_SMC64 FFA_FID(SMC_64, FFA_FNUM_ERROR) #define FFA_ERROR_SMC64 FFA_FID(SMC_64, FFA_FNUM_ERROR)
......
...@@ -552,6 +552,30 @@ uint64_t spmd_smc_handler(uint32_t smc_fid, ...@@ -552,6 +552,30 @@ uint64_t spmd_smc_handler(uint32_t smc_fid,
return spmd_ffa_error_return(handle, FFA_ERROR_NOT_SUPPORTED); return spmd_ffa_error_return(handle, FFA_ERROR_NOT_SUPPORTED);
break; /* Not reached */ break; /* Not reached */
case FFA_SPM_ID_GET:
if (MAKE_FFA_VERSION(1, 1) > FFA_VERSION_COMPILED) {
return spmd_ffa_error_return(handle,
FFA_ERROR_NOT_SUPPORTED);
}
/*
* Returns the ID of the SPMC or SPMD depending on the FF-A
* instance where this function is invoked
*/
if (!secure_origin) {
SMC_RET8(handle, FFA_SUCCESS_SMC32,
FFA_TARGET_INFO_MBZ, spmc_attrs.spmc_id,
FFA_PARAM_MBZ, FFA_PARAM_MBZ,
FFA_PARAM_MBZ, FFA_PARAM_MBZ,
FFA_PARAM_MBZ);
}
SMC_RET8(handle, FFA_SUCCESS_SMC32,
FFA_TARGET_INFO_MBZ, SPMD_DIRECT_MSG_ENDPOINT_ID,
FFA_PARAM_MBZ, FFA_PARAM_MBZ,
FFA_PARAM_MBZ, FFA_PARAM_MBZ,
FFA_PARAM_MBZ);
break; /* not reached */
case FFA_MSG_SEND_DIRECT_REQ_SMC32: case FFA_MSG_SEND_DIRECT_REQ_SMC32:
if (secure_origin && spmd_is_spmc_message(x1)) { if (secure_origin && spmd_is_spmc_message(x1)) {
ret = spmd_handle_spmc_message(x3, x4, ret = spmd_handle_spmc_message(x3, x4,
......
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