linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Igor Opaniuk <igor.opaniuk@linaro.org>
To: linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, tee-dev@lists.linaro.org
Cc: jerome.forissier@linaro.org, jens.wiklander@linaro.org,
	prime.zeng@hisilicon.com, sumit.garg@linaro.org
Subject: [PATCH 1/1] tee: add cancellation support to client interface
Date: Thu, 24 Jan 2019 15:11:41 +0200	[thread overview]
Message-ID: <1548335501-7868-1-git-send-email-igor.opaniuk@linaro.org> (raw)

Add support of cancellation request to the TEE kernel internal
client interface. Can be used by software TPM drivers, that leverage
TEE under the hood (for instance in TPM2.0 mobile profile), for requesting
cancellation of time-consuming operations (RSA key-pair generation etc.).

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>
---
 drivers/tee/tee_core.c  | 12 ++++++++++++
 include/linux/tee_drv.h | 14 ++++++++++++++
 2 files changed, 26 insertions(+)

diff --git a/drivers/tee/tee_core.c b/drivers/tee/tee_core.c
index 7b2bb4c..aba71a8 100644
--- a/drivers/tee/tee_core.c
+++ b/drivers/tee/tee_core.c
@@ -1027,6 +1027,18 @@ int tee_client_invoke_func(struct tee_context *ctx,
 }
 EXPORT_SYMBOL_GPL(tee_client_invoke_func);
 
+int tee_client_cancel_req(struct tee_context *ctx,
+			  u32 cancel_id,
+			  u32 session)
+{
+
+	if (!ctx->teedev->desc->ops->cancel_req)
+		return -EINVAL;
+	return ctx->teedev->desc->ops->cancel_req(ctx, cancel_id,
+						  session);
+}
+EXPORT_SYMBOL_GPL(tee_client_cancel_req);
+
 static int __init tee_init(void)
 {
 	int rc;
diff --git a/include/linux/tee_drv.h b/include/linux/tee_drv.h
index 6cfe058..62a0b56 100644
--- a/include/linux/tee_drv.h
+++ b/include/linux/tee_drv.h
@@ -526,6 +526,20 @@ int tee_client_invoke_func(struct tee_context *ctx,
 			   struct tee_ioctl_invoke_arg *arg,
 			   struct tee_param *param);
 
+/**
+ * tee_client_cancel_req() - Request cancellation of the previous open-session
+ * or invoke-command operations in a Trusted Application
+ * @ctx:       TEE Context
+ * @arg:       Unique cancel request id
+ * @param:     Session id
+ *
+ * Returns < 0 on error else see @arg->ret for result.
+ */
+int tee_client_cancel_req(struct tee_context *ctx,
+			  u32 cancel_id,
+			  u32 session);
+
+
 static inline bool tee_param_is_memref(struct tee_param *param)
 {
 	switch (param->attr & TEE_IOCTL_PARAM_ATTR_TYPE_MASK) {
-- 
2.7.4


             reply	other threads:[~2019-01-24 13:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-24 13:11 Igor Opaniuk [this message]
2019-01-24 16:19 ` [PATCH 1/1] tee: add cancellation support to client interface Jens Wiklander
2019-01-24 17:32   ` Igor Opaniuk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1548335501-7868-1-git-send-email-igor.opaniuk@linaro.org \
    --to=igor.opaniuk@linaro.org \
    --cc=jens.wiklander@linaro.org \
    --cc=jerome.forissier@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=prime.zeng@hisilicon.com \
    --cc=sumit.garg@linaro.org \
    --cc=tee-dev@lists.linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).