mirror of
https://github.com/torvalds/linux.git
synced 2026-06-07 22:14:04 +02:00
OP-TEE: keep compitable with new version driver
1.Rename some functions to fix multiple definition compile error. 2.Build optee_linuxdriver when TEE_SUPPORT is enabled. 3.Rename "optee" obj name to "optee_v1" to fix module name conflict error: [ 0.211629] sysfs: cannot create duplicate filename '/module/optee/version' [ 0.211670] ------------[ cut here ]------------ [ 0.211684] WARNING: at fs/sysfs/dir.c:31 [ 0.211697] Modules linked in: [ 0.211713] [ 0.211726] CPU: 4 PID: 1 Comm: swapper/0 Not tainted 4.4.93 #42 [ 0.211738] Hardware name: Rockchip RK3399 Excavator Board edp (Android) (DT) [ 0.211752] task: ffffffc0f2160000 task.stack: ffffffc0f2168000 [ 0.211772] PC is at sysfs_warn_dup+0x60/0x7c [ 0.211785] LR is at sysfs_warn_dup+0x60/0x7c Change-Id: I9cc98307a32d9b186f7aac86027da231b486c487 Signed-off-by: Zhang Zhijie <zhangzj@rock-chips.com>
This commit is contained in:
parent
60b3b75a43
commit
0aea51cd79
|
|
@ -1,2 +1,2 @@
|
|||
obj-y += core/
|
||||
obj-y += armtz/
|
||||
obj-$(CONFIG_TEE_SUPPORT) += core/
|
||||
obj-$(CONFIG_TEE_SUPPORT) += armtz/
|
||||
|
|
|
|||
|
|
@ -529,7 +529,7 @@ unsigned long tee_shm_pool_alloc(struct device *dev,
|
|||
* the memory region managed by the pool.
|
||||
*
|
||||
*/
|
||||
int tee_shm_pool_free(struct device *dev, struct shm_pool *pool,
|
||||
int rk_tee_shm_pool_free(struct device *dev, struct shm_pool *pool,
|
||||
unsigned long paddr, size_t *size)
|
||||
{
|
||||
struct mem_chunk *chunk;
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ unsigned long tee_shm_pool_alloc(struct device *dev,
|
|||
struct shm_pool *pool,
|
||||
size_t size, size_t alignment);
|
||||
|
||||
int tee_shm_pool_free(struct device *dev, struct shm_pool *pool,
|
||||
int rk_tee_shm_pool_free(struct device *dev, struct shm_pool *pool,
|
||||
unsigned long paddr, size_t *size);
|
||||
|
||||
bool tee_shm_pool_incref(struct device *dev, struct shm_pool *pool,
|
||||
|
|
|
|||
|
|
@ -392,7 +392,7 @@ static u32 handle_rpc(struct tee_tz *ptee, struct smc_param *param)
|
|||
param->a2 = 0;
|
||||
break;
|
||||
case TEESMC_RPC_FUNC_FREE_ARG:
|
||||
tee_shm_pool_free(DEV, ptee->shm_pool, param->a1, 0);
|
||||
rk_tee_shm_pool_free(DEV, ptee->shm_pool, param->a1, 0);
|
||||
break;
|
||||
case TEESMC_RPC_FUNC_FREE_PAYLOAD:
|
||||
/* Can't support payload shared memory with this interface */
|
||||
|
|
@ -536,7 +536,7 @@ static void free_tee_arg(struct tee_tz *ptee, unsigned long p)
|
|||
BUG_ON(!CAPABLE(ptee->tee));
|
||||
|
||||
if (p)
|
||||
tee_shm_pool_free(DEV, ptee->shm_pool, p, 0);
|
||||
rk_tee_shm_pool_free(DEV, ptee->shm_pool, p, 0);
|
||||
|
||||
dev_dbg(DEV, "<\n");
|
||||
}
|
||||
|
|
@ -916,7 +916,7 @@ static struct tee_shm *tz_alloc(struct tee *tee, size_t size, uint32_t flags)
|
|||
if (!shm->kaddr) {
|
||||
dev_err(tee->dev, "%s: p2v(%pad)=0\n", __func__,
|
||||
&shm->paddr);
|
||||
tee_shm_pool_free(tee->dev, ptee->shm_pool, shm->paddr, NULL);
|
||||
rk_tee_shm_pool_free(tee->dev, ptee->shm_pool, shm->paddr, NULL);
|
||||
devm_kfree(tee->dev, shm);
|
||||
return ERR_PTR(-EFAULT);
|
||||
}
|
||||
|
|
@ -945,7 +945,7 @@ static void tz_free(struct tee_shm *shm)
|
|||
|
||||
dev_dbg(tee->dev, "%s: shm=%p\n", __func__, shm);
|
||||
|
||||
ret = tee_shm_pool_free(tee->dev, ptee->shm_pool, shm->paddr, &size);
|
||||
ret = rk_tee_shm_pool_free(tee->dev, ptee->shm_pool, shm->paddr, &size);
|
||||
if (!ret) {
|
||||
devm_kfree(tee->dev, shm);
|
||||
shm = NULL;
|
||||
|
|
|
|||
|
|
@ -18,9 +18,9 @@ ccflags-y+=-DCFG_TEE_DRV_DEBUGFS=${CFG_TEE_DRV_DEBUGFS}
|
|||
ccflags-y+=-DCFG_TEE_CORE_LOG_LEVEL=${CFG_TEE_CORE_LOG_LEVEL}
|
||||
ccflags-y+=-DCFG_TEE_TA_LOG_LEVEL=${CFG_TEE_TA_LOG_LEVEL}
|
||||
|
||||
obj-y += optee.o
|
||||
obj-y += optee_v1.o
|
||||
|
||||
optee-objs:= \
|
||||
optee_v1-objs:= \
|
||||
tee_core.o \
|
||||
tee_context.o \
|
||||
tee_session.o \
|
||||
|
|
|
|||
|
|
@ -268,7 +268,7 @@ struct tee_shm *tee_context_alloc_shm_tmp(struct tee_context *ctx,
|
|||
|
||||
type &= (TEEC_MEM_INPUT | TEEC_MEM_OUTPUT);
|
||||
|
||||
shm = tee_shm_alloc(ctx->tee, size,
|
||||
shm = rk_tee_shm_alloc(ctx->tee, size,
|
||||
TEE_SHM_MAPPED | TEE_SHM_TEMP | type);
|
||||
if (IS_ERR_OR_NULL(shm)) {
|
||||
dev_err(_DEV(ctx->tee), "%s: buffer allocation failed (%ld)\n",
|
||||
|
|
@ -283,7 +283,7 @@ struct tee_shm *tee_context_alloc_shm_tmp(struct tee_context *ctx,
|
|||
dev_err(_DEV(ctx->tee),
|
||||
"%s: tee_context_copy_from_client failed\n",
|
||||
__func__);
|
||||
tee_shm_free(shm);
|
||||
rk_tee_shm_free(shm);
|
||||
shm = NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -816,7 +816,7 @@ static void _release_tee_cmd(struct tee_session *sess, struct tee_cmd *cmd)
|
|||
|
||||
dev_dbg(_DEV_TEE, "%s: > free the temporary objects...\n", __func__);
|
||||
|
||||
tee_shm_free(cmd->uuid);
|
||||
rk_tee_shm_free(cmd->uuid);
|
||||
|
||||
if (cmd->param.type_original == TEEC_PARAM_TYPES(TEEC_NONE,
|
||||
TEEC_NONE, TEEC_NONE, TEEC_NONE))
|
||||
|
|
@ -844,9 +844,9 @@ static void _release_tee_cmd(struct tee_session *sess, struct tee_cmd *cmd)
|
|||
shm = cmd->param.params[idx].shm;
|
||||
|
||||
if (is_mapped_temp(shm->flags))
|
||||
tee_shm_free(shm);
|
||||
rk_tee_shm_free(shm);
|
||||
else
|
||||
tee_shm_put(ctx, shm);
|
||||
rk_tee_shm_put(ctx, shm);
|
||||
break;
|
||||
default:
|
||||
BUG_ON(1);
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ struct tee_shm *tee_shm_alloc_from_rpc(struct tee *tee, size_t size)
|
|||
INMSG();
|
||||
|
||||
mutex_lock(&tee->lock);
|
||||
shm = tee_shm_alloc(tee, size, TEE_SHM_TEMP | TEE_SHM_FROM_RPC);
|
||||
shm = rk_tee_shm_alloc(tee, size, TEE_SHM_TEMP | TEE_SHM_FROM_RPC);
|
||||
if (IS_ERR_OR_NULL(shm)) {
|
||||
dev_err(_DEV(tee), "%s: buffer allocation failed (%ld)\n",
|
||||
__func__, PTR_ERR(shm));
|
||||
|
|
@ -75,11 +75,11 @@ void tee_shm_free_from_rpc(struct tee_shm *shm)
|
|||
list_del(&shm->entry);
|
||||
}
|
||||
|
||||
tee_shm_free(shm);
|
||||
rk_tee_shm_free(shm);
|
||||
mutex_unlock(&tee->lock);
|
||||
}
|
||||
|
||||
struct tee_shm *tee_shm_alloc(struct tee *tee, size_t size, uint32_t flags)
|
||||
struct tee_shm *rk_tee_shm_alloc(struct tee *tee, size_t size, uint32_t flags)
|
||||
{
|
||||
struct tee_shm *shm;
|
||||
unsigned long pfn;
|
||||
|
|
@ -128,7 +128,7 @@ struct tee_shm *tee_shm_alloc(struct tee *tee, size_t size, uint32_t flags)
|
|||
return shm;
|
||||
}
|
||||
|
||||
void tee_shm_free(struct tee_shm *shm)
|
||||
void rk_tee_shm_free(struct tee_shm *shm)
|
||||
{
|
||||
struct tee *tee;
|
||||
|
||||
|
|
@ -402,7 +402,7 @@ int tee_shm_alloc_io(struct tee_context *ctx, struct tee_shm_io *shm_io)
|
|||
shm_io->fd_shm = 0;
|
||||
|
||||
mutex_lock(&tee->lock);
|
||||
shm = tee_shm_alloc(tee, shm_io->size, shm_io->flags);
|
||||
shm = rk_tee_shm_alloc(tee, shm_io->size, shm_io->flags);
|
||||
if (IS_ERR_OR_NULL(shm)) {
|
||||
dev_err(_DEV(tee), "%s: buffer allocation failed (%ld)\n",
|
||||
__func__, PTR_ERR(shm));
|
||||
|
|
@ -413,7 +413,7 @@ int tee_shm_alloc_io(struct tee_context *ctx, struct tee_shm_io *shm_io)
|
|||
if (ctx->usr_client) {
|
||||
ret = export_buf(tee, shm, &shm_io->fd_shm);
|
||||
if (ret) {
|
||||
tee_shm_free(shm);
|
||||
rk_tee_shm_free(shm);
|
||||
ret = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
|
|
@ -445,7 +445,7 @@ void tee_shm_free_io(struct tee_shm *shm)
|
|||
tee_dec_stats(&tee->stats[TEE_STATS_SHM_IDX]);
|
||||
list_del(&shm->entry);
|
||||
|
||||
tee_shm_free(shm);
|
||||
rk_tee_shm_free(shm);
|
||||
tee_put(ctx->tee);
|
||||
tee_context_put(ctx);
|
||||
if (dev)
|
||||
|
|
@ -787,7 +787,7 @@ struct tee_shm *tee_shm_get(struct tee_context *ctx, TEEC_SharedMemory *c_shm,
|
|||
return ERR_PTR(ret);
|
||||
}
|
||||
|
||||
void tee_shm_put(struct tee_context *ctx, struct tee_shm *shm)
|
||||
void rk_tee_shm_put(struct tee_context *ctx, struct tee_shm *shm)
|
||||
{
|
||||
struct tee *tee = ctx->tee;
|
||||
|
||||
|
|
|
|||
|
|
@ -24,11 +24,11 @@ void tee_shm_free_io(struct tee_shm *shm);
|
|||
|
||||
int tee_shm_fd_for_rpc(struct tee_context *ctx, struct tee_shm_io *shm_io);
|
||||
|
||||
struct tee_shm *tee_shm_alloc(struct tee *tee, size_t size, uint32_t flags);
|
||||
void tee_shm_free(struct tee_shm *shm);
|
||||
struct tee_shm *rk_tee_shm_alloc(struct tee *tee, size_t size, uint32_t flags);
|
||||
void rk_tee_shm_free(struct tee_shm *shm);
|
||||
|
||||
struct tee_shm *tee_shm_get(struct tee_context *ctx, TEEC_SharedMemory *c_shm,
|
||||
size_t size, int offset);
|
||||
void tee_shm_put(struct tee_context *ctx, struct tee_shm *shm);
|
||||
void rk_tee_shm_put(struct tee_context *ctx, struct tee_shm *shm);
|
||||
|
||||
#endif /* __TEE_SHM_H__ */
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user