mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
xen/arm: ffa: add FF-A v1.2 function IDs
Bring the FF-A headers up to the v1.2 baseline and fix the function-number range used for ABI discovery: - update FFA_FNUM_MAX_VALUE so the FF-A function-number window covers the full v1.2 range, and derive the ABI bitmap bounds from FFA_FNUM_MIN_VALUE/FFA_FNUM_MAX_VALUE instead of hard-coding FFA_ERROR/FFA_MSG_SEND2 - define the new v1.2 function IDs; CONSOLE_LOG_32/64 and PARTITION_INFO_GET_REGS are added for ABI discovery even though they are not implemented yet - extend the firmware ABI table to probe RUN and MSG_SEND_DIRECT_REQ2/RESP2 - while there, fix an off-by-one in ffa_fw_supports_fid(): the computed bit index must be strictly smaller than FFA_ABI_BITMAP_SIZE, so use >= in the bounds check - Also fix comment as call IDs reserved for FF-A are from 0x60 to 0xEF Keep FFA_MY_VERSION at 1.1 for now; we only advertise v1.2 once the implementation is fully compliant. Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
This commit is contained in:
1 parent
5a733e438f
commit
a9eb6c6269
3 files changed
+19
-9
No files matched your search
@@ -15,8 +15,9 @@
|
||||
#include <asm/smccc.h>
|
||||
#include <asm/types.h>
|
||||
|
||||
/* FF-A Function ID range (AArch32 function number field) as of FF-A v1.2 */
|
||||
#define FFA_FNUM_MIN_VALUE _AC(0x60,U)
|
||||
#define FFA_FNUM_MAX_VALUE _AC(0x86,U)
|
||||
#define FFA_FNUM_MAX_VALUE _AC(0x8E,U)
|
||||
|
||||
static inline bool is_ffa_fid(uint32_t fid)
|
||||
{
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
* https://developer.arm.com/documentation/den0077/a
|
||||
* FF-A-1.1-REL0: FF-A specification version 1.1 available at
|
||||
* https://developer.arm.com/documentation/den0077/e
|
||||
* FF-A-1.2-REL0: FF-A specification version 1.2 available at
|
||||
* https://developer.arm.com/documentation/den0077/j
|
||||
* TEEC-1.0C: TEE Client API Specification version 1.0c available at
|
||||
* https://globalplatform.org/specs-library/tee-client-api-specification/
|
||||
*
|
||||
@@ -102,6 +104,8 @@ static const struct ffa_fw_abi ffa_fw_abi_needed[] = {
|
||||
FW_ABI(FFA_MSG_SEND_DIRECT_REQ_32),
|
||||
FW_ABI(FFA_MSG_SEND_DIRECT_REQ_64),
|
||||
FW_ABI(FFA_MSG_SEND2),
|
||||
FW_ABI(FFA_MSG_SEND_DIRECT_REQ2),
|
||||
FW_ABI(FFA_RUN),
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <xen/spinlock.h>
|
||||
#include <xen/time.h>
|
||||
#include <xen/types.h>
|
||||
#include <asm/tee/ffa.h>
|
||||
|
||||
/* Error codes */
|
||||
#define FFA_RET_OK 0
|
||||
@@ -42,6 +43,7 @@
|
||||
|
||||
#define FFA_VERSION_1_0 MAKE_FFA_VERSION(1, 0)
|
||||
#define FFA_VERSION_1_1 MAKE_FFA_VERSION(1, 1)
|
||||
#define FFA_VERSION_1_2 MAKE_FFA_VERSION(1, 2)
|
||||
/* The minimal FF-A version of the SPMC that can be supported */
|
||||
#define FFA_MIN_SPMC_VERSION FFA_VERSION_1_1
|
||||
|
||||
@@ -270,21 +272,24 @@
|
||||
#define FFA_RX_ACQUIRE 0x84000084U
|
||||
#define FFA_SPM_ID_GET 0x84000085U
|
||||
#define FFA_MSG_SEND2 0x84000086U
|
||||
#define FFA_CONSOLE_LOG_32 0x8400008AU
|
||||
#define FFA_CONSOLE_LOG_64 0xC400008AU
|
||||
#define FFA_PARTITION_INFO_GET_REGS 0x8400008BU
|
||||
#define FFA_MSG_SEND_DIRECT_REQ2 0xC400008DU
|
||||
#define FFA_MSG_SEND_DIRECT_RESP2 0xC400008EU
|
||||
|
||||
/**
|
||||
* Encoding of features supported or not by the fw in a bitmap:
|
||||
* - Function IDs are going from 0x60 to 0xFF
|
||||
* - Function IDs are going from 0x60 to 0xEF in SMCCC standard
|
||||
* - A function can be supported in 32 and/or 64bit
|
||||
* The bitmap has one bit for each function in 32 and 64 bit.
|
||||
*/
|
||||
#define FFA_ABI_ID(id) ((id) & ARM_SMCCC_FUNC_MASK)
|
||||
#define FFA_ABI_CONV(id) (((id) >> ARM_SMCCC_CONV_SHIFT) & BIT(0,U))
|
||||
|
||||
#define FFA_ABI_MIN FFA_ABI_ID(FFA_ERROR)
|
||||
#define FFA_ABI_MAX FFA_ABI_ID(FFA_MSG_SEND2)
|
||||
|
||||
#define FFA_ABI_BITMAP_SIZE (2 * (FFA_ABI_MAX - FFA_ABI_MIN + 1))
|
||||
#define FFA_ABI_BITNUM(id) ((FFA_ABI_ID(id) - FFA_ABI_MIN) << 1 | \
|
||||
#define FFA_ABI_BITMAP_SIZE (2 * (FFA_FNUM_MAX_VALUE - FFA_FNUM_MIN_VALUE \
|
||||
+ 1))
|
||||
#define FFA_ABI_BITNUM(id) ((FFA_ABI_ID(id) - FFA_FNUM_MIN_VALUE) << 1 | \
|
||||
FFA_ABI_CONV(id))
|
||||
|
||||
/* Constituent memory region descriptor */
|
||||
@@ -549,9 +554,9 @@ static inline int32_t ffa_hyp_rx_release(void)
|
||||
|
||||
static inline bool ffa_fw_supports_fid(uint32_t fid)
|
||||
{
|
||||
BUILD_BUG_ON(FFA_ABI_MIN > FFA_ABI_MAX);
|
||||
BUILD_BUG_ON(FFA_FNUM_MIN_VALUE > FFA_FNUM_MAX_VALUE);
|
||||
|
||||
if ( FFA_ABI_BITNUM(fid) > FFA_ABI_BITMAP_SIZE)
|
||||
if ( FFA_ABI_BITNUM(fid) >= FFA_ABI_BITMAP_SIZE)
|
||||
return false;
|
||||
return test_bit(FFA_ABI_BITNUM(fid), ffa_fw_abi_supported);
|
||||
}
|
||||
|
||||