diff options
author | Zhang Zhijie <zhangzj@rock-chips.com> | 2017-11-29 15:02:02 +0800 |
---|---|---|
committer | Tao Huang <huangtao@rock-chips.com> | 2017-11-30 11:21:37 +0800 |
commit | 0aea51cd79105845ac1a94aaeeaed21b65fda212 (patch) | |
tree | 66f3366e851a340ed1972eead4a4366c5cdbe9da /security | |
parent | 60b3b75a43b61489d7504de2c791f6cc8c34354f (diff) |
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>
Diffstat (limited to 'security')
-rw-r--r-- | security/optee_linuxdriver/Makefile | 4 | ||||
-rw-r--r-- | security/optee_linuxdriver/armtz/tee_mem.c | 2 | ||||
-rw-r--r-- | security/optee_linuxdriver/armtz/tee_mem.h | 2 | ||||
-rw-r--r-- | security/optee_linuxdriver/armtz/tee_tz_drv.c | 8 | ||||
-rw-r--r-- | security/optee_linuxdriver/core/Makefile | 4 | ||||
-rw-r--r-- | security/optee_linuxdriver/core/tee_context.c | 4 | ||||
-rw-r--r-- | security/optee_linuxdriver/core/tee_session.c | 6 | ||||
-rw-r--r-- | security/optee_linuxdriver/core/tee_shm.c | 16 | ||||
-rw-r--r-- | security/optee_linuxdriver/core/tee_shm.h | 6 |
9 files changed, 26 insertions, 26 deletions
diff --git a/security/optee_linuxdriver/Makefile b/security/optee_linuxdriver/Makefile index 02a32aa23925..493734fc6814 100644 --- a/security/optee_linuxdriver/Makefile +++ b/security/optee_linuxdriver/Makefile @@ -1,2 +1,2 @@ -obj-y += core/ -obj-y += armtz/ +obj-$(CONFIG_TEE_SUPPORT) += core/ +obj-$(CONFIG_TEE_SUPPORT) += armtz/ diff --git a/security/optee_linuxdriver/armtz/tee_mem.c b/security/optee_linuxdriver/armtz/tee_mem.c index bbad023912a2..fe5a43d57342 100644 --- a/security/optee_linuxdriver/armtz/tee_mem.c +++ b/security/optee_linuxdriver/armtz/tee_mem.c @@ -529,7 +529,7 @@ failed_out: * 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; diff --git a/security/optee_linuxdriver/armtz/tee_mem.h b/security/optee_linuxdriver/armtz/tee_mem.h index 01d08a8bd9d7..a66a8f5a5550 100644 --- a/security/optee_linuxdriver/armtz/tee_mem.h +++ b/security/optee_linuxdriver/armtz/tee_mem.h @@ -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, diff --git a/security/optee_linuxdriver/armtz/tee_tz_drv.c b/security/optee_linuxdriver/armtz/tee_tz_drv.c index 846c249a1196..073355af293b 100644 --- a/security/optee_linuxdriver/armtz/tee_tz_drv.c +++ b/security/optee_linuxdriver/armtz/tee_tz_drv.c @@ -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; diff --git a/security/optee_linuxdriver/core/Makefile b/security/optee_linuxdriver/core/Makefile index 8219201852b7..d216823554ae 100644 --- a/security/optee_linuxdriver/core/Makefile +++ b/security/optee_linuxdriver/core/Makefile @@ -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 \ diff --git a/security/optee_linuxdriver/core/tee_context.c b/security/optee_linuxdriver/core/tee_context.c index 9c3bce65e470..79a5afd3b3a5 100644 --- a/security/optee_linuxdriver/core/tee_context.c +++ b/security/optee_linuxdriver/core/tee_context.c @@ -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; } } diff --git a/security/optee_linuxdriver/core/tee_session.c b/security/optee_linuxdriver/core/tee_session.c index e49362a9de74..501e89f5c276 100644 --- a/security/optee_linuxdriver/core/tee_session.c +++ b/security/optee_linuxdriver/core/tee_session.c @@ -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); diff --git a/security/optee_linuxdriver/core/tee_shm.c b/security/optee_linuxdriver/core/tee_shm.c index 6a50a8f7f676..8c0d11d9b9be 100644 --- a/security/optee_linuxdriver/core/tee_shm.c +++ b/security/optee_linuxdriver/core/tee_shm.c @@ -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 @@ exit: 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 @@ err: 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; diff --git a/security/optee_linuxdriver/core/tee_shm.h b/security/optee_linuxdriver/core/tee_shm.h index 8f76ed388a8e..7593081235a7 100644 --- a/security/optee_linuxdriver/core/tee_shm.h +++ b/security/optee_linuxdriver/core/tee_shm.h @@ -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__ */ |