From patchwork Thu Jan 24 13:11:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Opaniuk X-Patchwork-Id: 156477 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1934793jaa; Thu, 24 Jan 2019 05:11:49 -0800 (PST) X-Google-Smtp-Source: ALg8bN5jN6enPmt39Naf5tn0bhl5hEUzE3kLB5rU0bT15+/JBQuMX8M5TGsitNRYFR3R5s33WIay X-Received: by 2002:a62:3541:: with SMTP id c62mr6378397pfa.19.1548335509794; Thu, 24 Jan 2019 05:11:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548335509; cv=none; d=google.com; s=arc-20160816; b=qnU2OmVf27BLSb7KeF9rRf5eec5oWSkWDK9Yy3ScbLxK5nXya5+yUPForLKRmwponw Ybt0xf/L6IPB59BYFjjYzyq0nUpQLA7lp7gfnnxaSzKjB3GngVvza7GNnk4aLIwLltZh 6FGz/ov1IYof0+RJpH9tPygw6PM41UEq8aC61Yo1wvktXax/isgaK36wxAkMZ7XBtigz UWCeTjud+9a74aDBrow8epWOehlljErYhm++2jfTixeQexsuOuX2ImIeOpsV59TX4nQp A25n9rhzVssfU/qPSkS8aTRfwEkWB5oJYw2sE+7WBiGvZgZ8xyI2vFvljwqAue3g4jQI cDlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=M5kM16zyd/EiORNWuO/i8/IoR4fv7qnZKxV0scf9zO0=; b=vPbh+8JyFk+0HN7ZVIiDnOpkspY+uE1UmUMzVhYiHqfbVU63pp5zS3iCWxkfN3j6YA UT3gRARDBeEZCb5BQibcIqkFcgnW8Kf4T6VbMxXr0vEMF4735HiA3SD7otQGNm5TCH2Y SH4SBvaK8UVkzBWmYQIjdRdu0YG8/fiiWNPhjKMx07xzWIHqRlUUxGioU1ZfoiVEJ9vE FqP4PIgzPRmFWYpF5UIDpUNXWNlQ1DQtkXfqjwYmePbZHrsFjkPwEkkTe9QHpTSMtgZK gkXDgH29u9aVFVtHZ5y1/O62NxvmNzsj8sgeFMXLa32z+cPQroSIFLOnxl8DY6qv7df7 ze2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="VrW4JPf/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d13si13638386pgh.196.2019.01.24.05.11.49; Thu, 24 Jan 2019 05:11:49 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="VrW4JPf/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728043AbfAXNLr (ORCPT + 31 others); Thu, 24 Jan 2019 08:11:47 -0500 Received: from mail-lj1-f196.google.com ([209.85.208.196]:38319 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726105AbfAXNLr (ORCPT ); Thu, 24 Jan 2019 08:11:47 -0500 Received: by mail-lj1-f196.google.com with SMTP id c19-v6so5177604lja.5 for ; Thu, 24 Jan 2019 05:11:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=M5kM16zyd/EiORNWuO/i8/IoR4fv7qnZKxV0scf9zO0=; b=VrW4JPf/trBoEUxZFLak6MnFQ8yOzjvXFGiMb9sx4ubbFBi75cuglw5eeLfxqPelMv YDQn+65yjQci49S3NHEXhk0euqnRBJOmnh4MkX8rwNcftqwRL6HMR8JioMqEn77rhbdB Usa/rr9JJXzLGo+AIYKstriVHWDkesqk60pIM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=M5kM16zyd/EiORNWuO/i8/IoR4fv7qnZKxV0scf9zO0=; b=XJJZYbQ+w5S/tA5yg1cKYBeKhPwxgcRxAZlG9o1qkfCHMWZMhKrWvCn2buIgCWyDOo ouQkIPkpQt1h8SAEUAg6kdsz90PIzrfywMk32+6k/ARfRY2MGKFx9xT6BMOxk+1BCXuC BNZZupFbpU9oHpcnJPPcEjIrwRxKdjSqwqwEt7uMdxkASSdEhoARQMLIqR+miM0u6hht 3bad/R0aYyVQFtfvdtllmogz5uQVweTvnR2Zo6obOa4AmVOn+JLiZOeITqlBSY7vTTwQ hdrFc+wy7NRgDcwAWIhBZJI70yiu139HOcTdaJM5zfwbR+8N3SERDTloCq19ZUgTkUUr jmYA== X-Gm-Message-State: AJcUukcEg/BNWdK2EJ0F4RE4pwE8gRw97oFfdYgLFVT9vvI2VWVYcOwT etdJuiAJrA1Xif7Zo5ueWm9LLr1987I= X-Received: by 2002:a2e:a0d5:: with SMTP id f21-v6mr5576293ljm.98.1548335503991; Thu, 24 Jan 2019 05:11:43 -0800 (PST) Received: from localhost ([195.238.92.223]) by smtp.gmail.com with ESMTPSA id 18-v6sm982144ljg.83.2019.01.24.05.11.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 Jan 2019 05:11:42 -0800 (PST) From: Igor Opaniuk 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 Message-Id: <1548335501-7868-1-git-send-email-igor.opaniuk@linaro.org> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/tee/tee_core.c | 12 ++++++++++++ include/linux/tee_drv.h | 14 ++++++++++++++ 2 files changed, 26 insertions(+) -- 2.7.4 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) {