aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tee/tee_core.c
diff options
context:
space:
mode:
authorSumit Garg <sumit.garg@linaro.org>2019-01-29 11:19:36 +0530
committerJens Wiklander <jens.wiklander@linaro.org>2019-02-01 15:12:46 +0100
commit42bf4152d8a79f89f5456dee63a1f364fbce2dd6 (patch)
tree4f89fc2690e28b92610cfc5f7a9a31beb481c2e6 /drivers/tee/tee_core.c
parentLinux 5.0-rc3 (diff)
downloadlinux-dev-42bf4152d8a79f89f5456dee63a1f364fbce2dd6.tar.xz
linux-dev-42bf4152d8a79f89f5456dee63a1f364fbce2dd6.zip
tee: add supp_nowait flag in tee_context struct
This flag indicates that requests in this context should not wait for tee-supplicant daemon to be started if not present and just return with an error code. It is needed for requests which should be non-blocking in nature like ones arising from TEE based kernel drivers or any in kernel api that uses TEE internal client interface. Signed-off-by: Sumit Garg <sumit.garg@linaro.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Diffstat (limited to 'drivers/tee/tee_core.c')
-rw-r--r--drivers/tee/tee_core.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/tee/tee_core.c b/drivers/tee/tee_core.c
index 7b2bb4c50058..adf2588282fc 100644
--- a/drivers/tee/tee_core.c
+++ b/drivers/tee/tee_core.c
@@ -106,6 +106,11 @@ static int tee_open(struct inode *inode, struct file *filp)
if (IS_ERR(ctx))
return PTR_ERR(ctx);
+ /*
+ * Default user-space behaviour is to wait for tee-supplicant
+ * if not present for any requests in this context.
+ */
+ ctx->supp_nowait = false;
filp->private_data = ctx;
return 0;
}
@@ -982,6 +987,14 @@ tee_client_open_context(struct tee_context *start,
} while (IS_ERR(ctx) && PTR_ERR(ctx) != -ENOMEM);
put_device(put_dev);
+ /*
+ * Default behaviour for in kernel client is to not wait for
+ * tee-supplicant if not present for any requests in this context.
+ * Also this flag could be configured again before call to
+ * tee_client_open_session() if any in kernel client requires
+ * different behaviour.
+ */
+ ctx->supp_nowait = true;
return ctx;
}
EXPORT_SYMBOL_GPL(tee_client_open_context);