blob: f3cd0e8828cae385cadbc2f71a8cbb12c3d4a2e6 [file] [log] [blame]
Patrick Williams2194f502022-10-16 14:26:09 -05001From 96e0bd88e2fb4fcb1625240ef36bccf0383633f6 Mon Sep 17 00:00:00 2001
2From: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
3Date: Tue, 17 May 2022 16:53:56 +0100
4Subject: [PATCH 07/40] Revert "optee: use driver internal tee_context for some
5 rpc"
6
7This reverts commit 2922aff4339712ef004451715e94bdbd55fe38ed.
8Upstream-Status: Pending [Not submitted to upstream yet]
9Signed-off-by: Rupinderjit Singh <rupinderjit.singh@arm.com>
10---
11 drivers/tee/optee/core.c | 8 --------
12 drivers/tee/optee/optee_private.h | 2 --
13 drivers/tee/optee/rpc.c | 8 +++-----
14 3 files changed, 3 insertions(+), 15 deletions(-)
15
16diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c
17index 50c0d839fe75..5363ebebfc35 100644
18--- a/drivers/tee/optee/core.c
19+++ b/drivers/tee/optee/core.c
20@@ -588,7 +588,6 @@ static int optee_remove(struct platform_device *pdev)
21 /* Unregister OP-TEE specific client devices on TEE bus */
22 optee_unregister_devices();
23
24- teedev_close_context(optee->ctx);
25 /*
26 * Ask OP-TEE to free all cached shared memory objects to decrease
27 * reference counters and also avoid wild pointers in secure world
28@@ -634,7 +633,6 @@ static int optee_probe(struct platform_device *pdev)
29 struct optee *optee = NULL;
30 void *memremaped_shm = NULL;
31 struct tee_device *teedev;
32- struct tee_context *ctx;
33 u32 sec_caps;
34 int rc;
35
36@@ -721,12 +719,6 @@ static int optee_probe(struct platform_device *pdev)
37 optee_supp_init(&optee->supp);
38 optee->memremaped_shm = memremaped_shm;
39 optee->pool = pool;
40- ctx = teedev_open(optee->teedev);
41- if (IS_ERR(ctx)) {
42- rc = PTR_ERR(ctx);
43- goto err;
44- }
45- optee->ctx = ctx;
46
47 /*
48 * Ensure that there are no pre-existing shm objects before enabling
49diff --git a/drivers/tee/optee/optee_private.h b/drivers/tee/optee/optee_private.h
50index ea09533e30cd..f6bb4a763ba9 100644
51--- a/drivers/tee/optee/optee_private.h
52+++ b/drivers/tee/optee/optee_private.h
53@@ -70,7 +70,6 @@ struct optee_supp {
54 * struct optee - main service struct
55 * @supp_teedev: supplicant device
56 * @teedev: client device
57- * @ctx: driver internal TEE context
58 * @invoke_fn: function to issue smc or hvc
59 * @call_queue: queue of threads waiting to call @invoke_fn
60 * @wait_queue: queue of threads from secure world waiting for a
61@@ -88,7 +87,6 @@ struct optee {
62 struct tee_device *supp_teedev;
63 struct tee_device *teedev;
64 optee_invoke_fn *invoke_fn;
65- struct tee_context *ctx;
66 struct optee_call_queue call_queue;
67 struct optee_wait_queue wait_queue;
68 struct optee_supp supp;
69diff --git a/drivers/tee/optee/rpc.c b/drivers/tee/optee/rpc.c
70index 456833d82007..efbaff7ad7e5 100644
71--- a/drivers/tee/optee/rpc.c
72+++ b/drivers/tee/optee/rpc.c
73@@ -285,7 +285,6 @@ static struct tee_shm *cmd_alloc_suppl(struct tee_context *ctx, size_t sz)
74 }
75
76 static void handle_rpc_func_cmd_shm_alloc(struct tee_context *ctx,
77- struct optee *optee,
78 struct optee_msg_arg *arg,
79 struct optee_call_ctx *call_ctx)
80 {
81@@ -315,8 +314,7 @@ static void handle_rpc_func_cmd_shm_alloc(struct tee_context *ctx,
82 shm = cmd_alloc_suppl(ctx, sz);
83 break;
84 case OPTEE_RPC_SHM_TYPE_KERNEL:
85- shm = tee_shm_alloc(optee->ctx, sz,
86- TEE_SHM_MAPPED | TEE_SHM_PRIV);
87+ shm = tee_shm_alloc(ctx, sz, TEE_SHM_MAPPED | TEE_SHM_PRIV);
88 break;
89 default:
90 arg->ret = TEEC_ERROR_BAD_PARAMETERS;
91@@ -473,7 +471,7 @@ static void handle_rpc_func_cmd(struct tee_context *ctx, struct optee *optee,
92 break;
93 case OPTEE_RPC_CMD_SHM_ALLOC:
94 free_pages_list(call_ctx);
95- handle_rpc_func_cmd_shm_alloc(ctx, optee, arg, call_ctx);
96+ handle_rpc_func_cmd_shm_alloc(ctx, arg, call_ctx);
97 break;
98 case OPTEE_RPC_CMD_SHM_FREE:
99 handle_rpc_func_cmd_shm_free(ctx, arg);
100@@ -504,7 +502,7 @@ void optee_handle_rpc(struct tee_context *ctx, struct optee_rpc_param *param,
101
102 switch (OPTEE_SMC_RETURN_GET_RPC_FUNC(param->a0)) {
103 case OPTEE_SMC_RPC_FUNC_ALLOC:
104- shm = tee_shm_alloc(optee->ctx, param->a1,
105+ shm = tee_shm_alloc(ctx, param->a1,
106 TEE_SHM_MAPPED | TEE_SHM_PRIV);
107 if (!IS_ERR(shm) && !tee_shm_get_pa(shm, 0, &pa)) {
108 reg_pair_from_64(&param->a1, &param->a2, pa);
109--
1102.34.1
111