aboutsummaryrefslogtreecommitdiff
path: root/core/kernel
diff options
context:
space:
mode:
authorJens Wiklander <jens.wiklander@linaro.org>2021-05-12 08:11:47 +0200
committerJérôme Forissier <jerome@forissier.org>2021-06-23 10:16:17 +0200
commit76753661a7eb819a28379744a1dacce49790d18c (patch)
treee9fd76be3b6783b5d22db82a0b36cadfde363e82 /core/kernel
parent077732a0daa529ed418faaadbcb531d7f91c8bbb (diff)
core: separate user_ta_ops using a __weak attribute instead
Breaks the dependency chain for user_ta_ops using the standard method with a __weak symbol and an overriding symbol in link_dummies_paged.c. Reviewed-by: Jerome Forissier <jerome@forissier.org> Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Diffstat (limited to 'core/kernel')
-rw-r--r--core/kernel/user_ta.c24
1 files changed, 7 insertions, 17 deletions
diff --git a/core/kernel/user_ta.c b/core/kernel/user_ta.c
index 9e5f483f..14c30764 100644
--- a/core/kernel/user_ta.c
+++ b/core/kernel/user_ta.c
@@ -370,7 +370,11 @@ static uint32_t user_ta_get_instance_id(struct ts_ctx *ctx)
return to_user_ta_ctx(ctx)->uctx.vm_info.asid;
}
-static const struct ts_ops user_ta_ops __rodata_unpaged("user_ta_ops") = {
+/*
+ * Note: this variable is weak just to ease breaking its dependency chain
+ * when added to the unpaged area.
+ */
+const struct ts_ops user_ta_ops __weak __rodata_unpaged("user_ta_ops") = {
.enter_open_session = user_ta_enter_open_session,
.enter_invoke_cmd = user_ta_enter_invoke_cmd,
.enter_close_session = user_ta_enter_close_session,
@@ -386,28 +390,14 @@ static const struct ts_ops user_ta_ops __rodata_unpaged("user_ta_ops") = {
#endif
};
-/*
- * Break unpaged attribute dependency propagation to user_ta_ops structure
- * content thanks to a runtime initialization of the ops reference.
- */
-static const struct ts_ops *_user_ta_ops;
-
-static TEE_Result init_user_ta(void)
-{
- _user_ta_ops = &user_ta_ops;
-
- return TEE_SUCCESS;
-}
-service_init(init_user_ta);
-
static void set_ta_ctx_ops(struct tee_ta_ctx *ctx)
{
- ctx->ts_ctx.ops = _user_ta_ops;
+ ctx->ts_ctx.ops = &user_ta_ops;
}
bool is_user_ta_ctx(struct ts_ctx *ctx)
{
- return ctx && ctx->ops == _user_ta_ops;
+ return ctx && ctx->ops == &user_ta_ops;
}
static TEE_Result check_ta_store(void)