mirror of
https://github.com/hardkernel/kernel_common_drivers.git
synced 2026-06-25 12:03:48 +09:00
TEE: compatible dynamic SHM for different platform [1/2]
PD#SWPL-100275 Problem: Dynamic SHM will be enabled after TDK3.18, but some platform not support TDK3.18, so compatible different platform. Solution: Compatible Dynamic SHM for different platform Verify: AndroidU + S7 Change-Id: I57a7f6a557ecf11e085027e0c6338767b0ee5ce0 Signed-off-by: Wentao.Sun <wentao.sun@amlogic.com>
This commit is contained in:
@@ -587,6 +587,22 @@ struct optee_smc_disable_shm_cache_result {
|
||||
#define OPTEE_SMC_GET_LOGGER_CONFIG \
|
||||
OPTEE_SMC_FAST_CALL_VAL(OPTEE_SMC_FUNCID_GET_LOGGER_CONFIG)
|
||||
|
||||
/*
|
||||
* Get Dynamic SHM Status
|
||||
*
|
||||
* Call register usage:
|
||||
* a0 SMC Function ID, OPTEE_SMC_GET_DYN_SHM_STATS
|
||||
* a1-7 Not used
|
||||
*
|
||||
* Normal return register usage:
|
||||
* a0 Get result
|
||||
* a1 Dynamic SHM Status
|
||||
* a2-7 Preserved
|
||||
*/
|
||||
#define OPTEE_SMC_FUNCID_GET_DYN_SHM_STATS 0xE005
|
||||
#define OPTEE_SMC_GET_DYN_SHM_STATS \
|
||||
OPTEE_SMC_FAST_CALL_VAL(OPTEE_SMC_FUNCID_GET_DYN_SHM_STATS)
|
||||
|
||||
/* Returned in a0 */
|
||||
#define OPTEE_SMC_RETURN_UNKNOWN_FUNCTION 0xFFFFFFFF
|
||||
|
||||
|
||||
@@ -1185,6 +1185,17 @@ static bool optee_msg_api_revision_is_compatible(optee_invoke_fn *invoke_fn)
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool optee_get_dynamic_shm_stats(optee_invoke_fn *invoke_fn)
|
||||
{
|
||||
struct arm_smccc_res res;
|
||||
|
||||
invoke_fn(OPTEE_SMC_GET_DYN_SHM_STATS, 0, 0, 0, 0, 0, 0, 0, &res);
|
||||
if (res.a0 == OPTEE_SMC_RETURN_OK && res.a1 == 1)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool optee_msg_exchange_capabilities(optee_invoke_fn *invoke_fn,
|
||||
u32 *sec_caps, u32 *max_notif_value,
|
||||
unsigned int *rpc_param_count)
|
||||
@@ -1410,8 +1421,11 @@ static int optee_probe(struct platform_device *pdev)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
// disable dynamic share memory
|
||||
sec_caps &= ~(OPTEE_SMC_SEC_CAP_DYNAMIC_SHM);
|
||||
/*
|
||||
* If stats is false, Dynamic Shared Memory will be disabled
|
||||
*/
|
||||
if (!optee_get_dynamic_shm_stats(invoke_fn))
|
||||
sec_caps &= ~(OPTEE_SMC_SEC_CAP_DYNAMIC_SHM);
|
||||
|
||||
/*
|
||||
* Try to use dynamic shared memory if possible
|
||||
|
||||
Reference in New Issue
Block a user