mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 11:26:02 +09:00
tee: add api tee_protect_mem_by_type [1/1]
PD#SWPL-16829 Problem: need API to protect mem for gpu and so on Solution: add api tee_protect_mem_by_type Verify: Android Q + TL1 Test: manual wq Signed-off-by: Pengguang Zhu <pengguang.zhu@amlogic.com> Change-Id: Ibf420e1d4845c1020ae2ff91629f6e31a32a7bc3 Signed-off-by: changqing.gao <changqing.gao@amlogic.com>
This commit is contained in:
@@ -63,6 +63,15 @@ static int disable_flag;
|
||||
#define TEE_SMC_FUNCID_UNPROTECT_TVP_MEM 0xE021
|
||||
#define TEE_SMC_UNPROTECT_TVP_MEM \
|
||||
TEE_SMC_FAST_CALL_VAL(TEE_SMC_FUNCID_UNPROTECT_TVP_MEM)
|
||||
|
||||
#define TEE_SMC_FUNCID_PROTECT_MEM_BY_TYPE 0xE023
|
||||
#define TEE_SMC_PROTECT_MEM_BY_TYPE \
|
||||
TEE_SMC_FAST_CALL_VAL(TEE_SMC_FUNCID_PROTECT_MEM_BY_TYPE)
|
||||
|
||||
#define TEE_SMC_FUNCID_UNPROTECT_MEM_BY_TYPE 0xE024
|
||||
#define TEE_SMC_UNPROTECT_MEM_BY_TYPE \
|
||||
TEE_SMC_FAST_CALL_VAL(TEE_SMC_FUNCID_UNPROTECT_MEM_BY_TYPE)
|
||||
|
||||
static struct class *tee_sys_class;
|
||||
|
||||
struct tee_smc_calls_revision_result {
|
||||
@@ -204,6 +213,24 @@ void tee_unprotect_tvp_mem(uint32_t handle)
|
||||
}
|
||||
EXPORT_SYMBOL(tee_unprotect_tvp_mem);
|
||||
|
||||
uint32_t tee_protect_mem_by_type(uint32_t type,
|
||||
uint32_t start, uint32_t size,
|
||||
uint32_t *handle)
|
||||
{
|
||||
struct arm_smccc_res res;
|
||||
|
||||
if (!handle)
|
||||
return 0xFFFF0006;
|
||||
|
||||
arm_smccc_smc(TEE_SMC_PROTECT_MEM_BY_TYPE,
|
||||
type, start, size, 0, 0, 0, 0, &res);
|
||||
|
||||
*handle = res.a1;
|
||||
|
||||
return res.a0;
|
||||
}
|
||||
EXPORT_SYMBOL(tee_protect_mem_by_type);
|
||||
|
||||
int tee_create_sysfs(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@@ -18,6 +18,12 @@
|
||||
#ifndef __TEE_H__
|
||||
#define __TEE_H__
|
||||
|
||||
#define TEE_MEM_TYPE_GPU 0x6
|
||||
#define TEE_MEM_TYPE_VDIN 0x7
|
||||
#define TEE_MEM_TYPE_ENCODER 0x8
|
||||
#define TEE_MEM_TYPE_GE2D 0x9
|
||||
#define TEE_MEM_TYPE_DEMUX 0xa
|
||||
|
||||
extern bool tee_enabled(void);
|
||||
extern int is_secload_get(void);
|
||||
extern int tee_load_video_fw(uint32_t index, uint32_t vdec);
|
||||
@@ -25,5 +31,8 @@ extern int tee_load_video_fw_swap(uint32_t index, uint32_t vdec, bool is_swap);
|
||||
extern uint32_t tee_protect_tvp_mem(uint32_t start, uint32_t size,
|
||||
uint32_t *handle);
|
||||
extern void tee_unprotect_tvp_mem(uint32_t handle);
|
||||
extern uint32_t tee_protect_mem_by_type(uint32_t type,
|
||||
uint32_t start, uint32_t size,
|
||||
uint32_t *handle);
|
||||
#endif /* __TEE_H__ */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user