Skip to content

Commit 0aea51c

Browse files
ElonZhang0328rkhuangtao
authored andcommitted
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>
1 parent 60b3b75 commit 0aea51c

9 files changed

Lines changed: 26 additions & 26 deletions

File tree

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
obj-y += core/
2-
obj-y += armtz/
1+
obj-$(CONFIG_TEE_SUPPORT) += core/
2+
obj-$(CONFIG_TEE_SUPPORT) += armtz/

security/optee_linuxdriver/armtz/tee_mem.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ unsigned long tee_shm_pool_alloc(struct device *dev,
529529
* the memory region managed by the pool.
530530
*
531531
*/
532-
int tee_shm_pool_free(struct device *dev, struct shm_pool *pool,
532+
int rk_tee_shm_pool_free(struct device *dev, struct shm_pool *pool,
533533
unsigned long paddr, size_t *size)
534534
{
535535
struct mem_chunk *chunk;

security/optee_linuxdriver/armtz/tee_mem.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ unsigned long tee_shm_pool_alloc(struct device *dev,
3333
struct shm_pool *pool,
3434
size_t size, size_t alignment);
3535

36-
int tee_shm_pool_free(struct device *dev, struct shm_pool *pool,
36+
int rk_tee_shm_pool_free(struct device *dev, struct shm_pool *pool,
3737
unsigned long paddr, size_t *size);
3838

3939
bool tee_shm_pool_incref(struct device *dev, struct shm_pool *pool,

security/optee_linuxdriver/armtz/tee_tz_drv.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ static u32 handle_rpc(struct tee_tz *ptee, struct smc_param *param)
392392
param->a2 = 0;
393393
break;
394394
case TEESMC_RPC_FUNC_FREE_ARG:
395-
tee_shm_pool_free(DEV, ptee->shm_pool, param->a1, 0);
395+
rk_tee_shm_pool_free(DEV, ptee->shm_pool, param->a1, 0);
396396
break;
397397
case TEESMC_RPC_FUNC_FREE_PAYLOAD:
398398
/* 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)
536536
BUG_ON(!CAPABLE(ptee->tee));
537537

538538
if (p)
539-
tee_shm_pool_free(DEV, ptee->shm_pool, p, 0);
539+
rk_tee_shm_pool_free(DEV, ptee->shm_pool, p, 0);
540540

541541
dev_dbg(DEV, "<\n");
542542
}
@@ -916,7 +916,7 @@ static struct tee_shm *tz_alloc(struct tee *tee, size_t size, uint32_t flags)
916916
if (!shm->kaddr) {
917917
dev_err(tee->dev, "%s: p2v(%pad)=0\n", __func__,
918918
&shm->paddr);
919-
tee_shm_pool_free(tee->dev, ptee->shm_pool, shm->paddr, NULL);
919+
rk_tee_shm_pool_free(tee->dev, ptee->shm_pool, shm->paddr, NULL);
920920
devm_kfree(tee->dev, shm);
921921
return ERR_PTR(-EFAULT);
922922
}
@@ -945,7 +945,7 @@ static void tz_free(struct tee_shm *shm)
945945

946946
dev_dbg(tee->dev, "%s: shm=%p\n", __func__, shm);
947947

948-
ret = tee_shm_pool_free(tee->dev, ptee->shm_pool, shm->paddr, &size);
948+
ret = rk_tee_shm_pool_free(tee->dev, ptee->shm_pool, shm->paddr, &size);
949949
if (!ret) {
950950
devm_kfree(tee->dev, shm);
951951
shm = NULL;

security/optee_linuxdriver/core/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ ccflags-y+=-DCFG_TEE_DRV_DEBUGFS=${CFG_TEE_DRV_DEBUGFS}
1818
ccflags-y+=-DCFG_TEE_CORE_LOG_LEVEL=${CFG_TEE_CORE_LOG_LEVEL}
1919
ccflags-y+=-DCFG_TEE_TA_LOG_LEVEL=${CFG_TEE_TA_LOG_LEVEL}
2020

21-
obj-y += optee.o
21+
obj-y += optee_v1.o
2222

23-
optee-objs:= \
23+
optee_v1-objs:= \
2424
tee_core.o \
2525
tee_context.o \
2626
tee_session.o \

security/optee_linuxdriver/core/tee_context.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ struct tee_shm *tee_context_alloc_shm_tmp(struct tee_context *ctx,
268268

269269
type &= (TEEC_MEM_INPUT | TEEC_MEM_OUTPUT);
270270

271-
shm = tee_shm_alloc(ctx->tee, size,
271+
shm = rk_tee_shm_alloc(ctx->tee, size,
272272
TEE_SHM_MAPPED | TEE_SHM_TEMP | type);
273273
if (IS_ERR_OR_NULL(shm)) {
274274
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,
283283
dev_err(_DEV(ctx->tee),
284284
"%s: tee_context_copy_from_client failed\n",
285285
__func__);
286-
tee_shm_free(shm);
286+
rk_tee_shm_free(shm);
287287
shm = NULL;
288288
}
289289
}

security/optee_linuxdriver/core/tee_session.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -816,7 +816,7 @@ static void _release_tee_cmd(struct tee_session *sess, struct tee_cmd *cmd)
816816

817817
dev_dbg(_DEV_TEE, "%s: > free the temporary objects...\n", __func__);
818818

819-
tee_shm_free(cmd->uuid);
819+
rk_tee_shm_free(cmd->uuid);
820820

821821
if (cmd->param.type_original == TEEC_PARAM_TYPES(TEEC_NONE,
822822
TEEC_NONE, TEEC_NONE, TEEC_NONE))
@@ -844,9 +844,9 @@ static void _release_tee_cmd(struct tee_session *sess, struct tee_cmd *cmd)
844844
shm = cmd->param.params[idx].shm;
845845

846846
if (is_mapped_temp(shm->flags))
847-
tee_shm_free(shm);
847+
rk_tee_shm_free(shm);
848848
else
849-
tee_shm_put(ctx, shm);
849+
rk_tee_shm_put(ctx, shm);
850850
break;
851851
default:
852852
BUG_ON(1);

security/optee_linuxdriver/core/tee_shm.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ struct tee_shm *tee_shm_alloc_from_rpc(struct tee *tee, size_t size)
4444
INMSG();
4545

4646
mutex_lock(&tee->lock);
47-
shm = tee_shm_alloc(tee, size, TEE_SHM_TEMP | TEE_SHM_FROM_RPC);
47+
shm = rk_tee_shm_alloc(tee, size, TEE_SHM_TEMP | TEE_SHM_FROM_RPC);
4848
if (IS_ERR_OR_NULL(shm)) {
4949
dev_err(_DEV(tee), "%s: buffer allocation failed (%ld)\n",
5050
__func__, PTR_ERR(shm));
@@ -75,11 +75,11 @@ void tee_shm_free_from_rpc(struct tee_shm *shm)
7575
list_del(&shm->entry);
7676
}
7777

78-
tee_shm_free(shm);
78+
rk_tee_shm_free(shm);
7979
mutex_unlock(&tee->lock);
8080
}
8181

82-
struct tee_shm *tee_shm_alloc(struct tee *tee, size_t size, uint32_t flags)
82+
struct tee_shm *rk_tee_shm_alloc(struct tee *tee, size_t size, uint32_t flags)
8383
{
8484
struct tee_shm *shm;
8585
unsigned long pfn;
@@ -128,7 +128,7 @@ struct tee_shm *tee_shm_alloc(struct tee *tee, size_t size, uint32_t flags)
128128
return shm;
129129
}
130130

131-
void tee_shm_free(struct tee_shm *shm)
131+
void rk_tee_shm_free(struct tee_shm *shm)
132132
{
133133
struct tee *tee;
134134

@@ -402,7 +402,7 @@ int tee_shm_alloc_io(struct tee_context *ctx, struct tee_shm_io *shm_io)
402402
shm_io->fd_shm = 0;
403403

404404
mutex_lock(&tee->lock);
405-
shm = tee_shm_alloc(tee, shm_io->size, shm_io->flags);
405+
shm = rk_tee_shm_alloc(tee, shm_io->size, shm_io->flags);
406406
if (IS_ERR_OR_NULL(shm)) {
407407
dev_err(_DEV(tee), "%s: buffer allocation failed (%ld)\n",
408408
__func__, PTR_ERR(shm));
@@ -413,7 +413,7 @@ int tee_shm_alloc_io(struct tee_context *ctx, struct tee_shm_io *shm_io)
413413
if (ctx->usr_client) {
414414
ret = export_buf(tee, shm, &shm_io->fd_shm);
415415
if (ret) {
416-
tee_shm_free(shm);
416+
rk_tee_shm_free(shm);
417417
ret = -ENOMEM;
418418
goto out;
419419
}
@@ -445,7 +445,7 @@ void tee_shm_free_io(struct tee_shm *shm)
445445
tee_dec_stats(&tee->stats[TEE_STATS_SHM_IDX]);
446446
list_del(&shm->entry);
447447

448-
tee_shm_free(shm);
448+
rk_tee_shm_free(shm);
449449
tee_put(ctx->tee);
450450
tee_context_put(ctx);
451451
if (dev)
@@ -787,7 +787,7 @@ struct tee_shm *tee_shm_get(struct tee_context *ctx, TEEC_SharedMemory *c_shm,
787787
return ERR_PTR(ret);
788788
}
789789

790-
void tee_shm_put(struct tee_context *ctx, struct tee_shm *shm)
790+
void rk_tee_shm_put(struct tee_context *ctx, struct tee_shm *shm)
791791
{
792792
struct tee *tee = ctx->tee;
793793

security/optee_linuxdriver/core/tee_shm.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ void tee_shm_free_io(struct tee_shm *shm);
2424

2525
int tee_shm_fd_for_rpc(struct tee_context *ctx, struct tee_shm_io *shm_io);
2626

27-
struct tee_shm *tee_shm_alloc(struct tee *tee, size_t size, uint32_t flags);
28-
void tee_shm_free(struct tee_shm *shm);
27+
struct tee_shm *rk_tee_shm_alloc(struct tee *tee, size_t size, uint32_t flags);
28+
void rk_tee_shm_free(struct tee_shm *shm);
2929

3030
struct tee_shm *tee_shm_get(struct tee_context *ctx, TEEC_SharedMemory *c_shm,
3131
size_t size, int offset);
32-
void tee_shm_put(struct tee_context *ctx, struct tee_shm *shm);
32+
void rk_tee_shm_put(struct tee_context *ctx, struct tee_shm *shm);
3333

3434
#endif /* __TEE_SHM_H__ */

0 commit comments

Comments
 (0)