From patchwork Thu Jan 24 17:32:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Opaniuk X-Patchwork-Id: 156503 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp2228053jaa; Thu, 24 Jan 2019 09:32:38 -0800 (PST) X-Google-Smtp-Source: ALg8bN6vsP9OJX1iOFIZdKCnfgYuScP+O7QsGBLB3NKfJdZuwY3PovI8wODQKr7LxDm/yiwevaTT X-Received: by 2002:a17:902:43e4:: with SMTP id j91mr7263320pld.147.1548351158586; Thu, 24 Jan 2019 09:32:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548351158; cv=none; d=google.com; s=arc-20160816; b=vqNwc0te9x0JK+Y7xL/fc+DClOt4aqrpXNMk+cpkWZjb39hNE+eaVl1HAzLh6G/dJJ qrOKnAfD9FUDK6hU3hUDMMlbqL+FkHhHOHypWpuDlU21kbQhka8cgXYRonbKc6Zrdk0g 8xn/zzIXbW4n+MAMRht5sjzbwGfPuALtSI+azYIUK+w9SMHwtcxZr6XgGLHvb8wJmzfJ usJ7CJnh9Hf0ygaeCh/mKJKhifF9CCRoya3WytAgYHTZdK1UzMWIlM5Diyx/Xx3RRol+ wf2ug0CB4K8mneRs7jRRf4J8X20n3/p1EidtXPmI2pY2nI39maC/kE+QGU5C12oaPiqo DlIw== 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=KWJ7bHoK/sF4rrqF5MiZ+1DYYfCAJZqlGq6hSezEKP8=; b=UDr77VapNE9SAxZlmriDFIrjMl4+1EX4hrU0fJidWCAkLIzfB2DAR9O9npFCXUMGxZ xw1ZfJAGJecgLii/dm2qLfJ62xs3mDJr8RfXNMHNdzUIZ5BPBIDaKQVbtwd0q50j+j4y GX4JJ+sSISZKnqcyHRTRjqR5V+r4IQb0x94uCdY/06UpsRUg86FO+b1+dxd+nMs79x25 pi33Z3Uzs8Why9BBjvjoKj6/fw2ZyhNVY6rlSIUf6kdL4SRrZi1cbiMNpcLDezYHL/Vx SdRaDn4QQnqyiSJ4j+d6g8/AWWwZBsyf2cY71ji2FM8aIZBSBuw4+3Am9lCwiuskIijI wRdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eZIPSiqL; 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 j10si22845283plg.123.2019.01.24.09.32.38; Thu, 24 Jan 2019 09:32:38 -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=eZIPSiqL; 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 S1729078AbfAXRcg (ORCPT + 31 others); Thu, 24 Jan 2019 12:32:36 -0500 Received: from mail-lj1-f196.google.com ([209.85.208.196]:44799 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727998AbfAXRcg (ORCPT ); Thu, 24 Jan 2019 12:32:36 -0500 Received: by mail-lj1-f196.google.com with SMTP id k19-v6so5952304lji.11 for ; Thu, 24 Jan 2019 09:32:34 -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=KWJ7bHoK/sF4rrqF5MiZ+1DYYfCAJZqlGq6hSezEKP8=; b=eZIPSiqL34TBnH/ER0RA6ai9bEeY4M1ZpoObjCS9/M6AfopBGmh7yIayEA9iLDS9IJ gz0lnDpwKMSMa7WyBcOp0p3LoK/vPqOtk0dJ8gnq+ganaUw1Xzaljvb8cAScLLDi0Yy/ 850NdW40fcIYwxElFfZdR9FozwKjYocgDNFWA= 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=KWJ7bHoK/sF4rrqF5MiZ+1DYYfCAJZqlGq6hSezEKP8=; b=HOIdVgzK5lci+DPxq8etoT1vsOQrOs2sCOkHsaHB77Vm3AKHZEtHo9DOD5tWTJrYOk ZnjQY1o2I3f8pkyfdbHZ2Fztyxn38C3I0Qn1/9Gk+0TsGJJzEqB4p/tJ6UmjBOnjSE9Q L65TNjfgo3J1XdbMGLeSMx+IfvJBguYxTThMOvHKBy89PZBP4KsiVMen2w0Lsnz8sB+E R7dwg44m4PvKgonlkgTA5gRAgAgcv1MG71VkXUvespJlcVvC8I5rH9fIoMRFOqwtWshi mMTATMJsrDYeiBZXTRiZSRI+nrzdpcpqXOVy6yVKnDtj1yShPqhy+ZrIPN7wz49wwV+l OOFw== X-Gm-Message-State: AJcUukekSJD2sJOdBT/XSYaxIxeKp932BvDRi2Suj9v71i+yvknCBijY q/PHfTs/SHyC7fPOn7wO7CLDza/jkHE= X-Received: by 2002:a2e:1bc5:: with SMTP id c66-v6mr6600436ljf.96.1548351153486; Thu, 24 Jan 2019 09:32:33 -0800 (PST) Received: from localhost ([195.238.92.223]) by smtp.gmail.com with ESMTPSA id y81-v6sm1113700lje.30.2019.01.24.09.32.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 Jan 2019 09:32:32 -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 v2 1/1] tee: add cancellation support to client interface Date: Thu, 24 Jan 2019 19:32:31 +0200 Message-Id: <1548351151-3722-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 TPM2.0 mobile profile), for requesting cancellation of time-consuming operations (RSA key-pair generation etc.). Signed-off-by: Igor Opaniuk --- v2: - use tee_ioctl_cancel_arg to provide session and cancel_id - fix tee_client_cancel_req function description header drivers/tee/tee_core.c | 10 ++++++++++ include/linux/tee_drv.h | 12 ++++++++++++ 2 files changed, 22 insertions(+) -- 2.7.4 diff --git a/drivers/tee/tee_core.c b/drivers/tee/tee_core.c index 7b2bb4c..1148175 100644 --- a/drivers/tee/tee_core.c +++ b/drivers/tee/tee_core.c @@ -1027,6 +1027,16 @@ 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, + struct tee_ioctl_cancel_arg *arg) +{ + if (!ctx->teedev->desc->ops->cancel_req) + return -EINVAL; + return ctx->teedev->desc->ops->cancel_req(ctx, arg->cancel_id, + arg->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..177016e 100644 --- a/include/linux/tee_drv.h +++ b/include/linux/tee_drv.h @@ -526,6 +526,18 @@ 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: Cancellation arguments, see description of + * struct tee_ioctl_cancel_arg + * + * Returns < 0 on error else 0 if the cancellation was successfully requested. + */ +int tee_client_cancel_req(struct tee_context *ctx, + struct tee_ioctl_cancel_arg *arg); + static inline bool tee_param_is_memref(struct tee_param *param) { switch (param->attr & TEE_IOCTL_PARAM_ATTR_TYPE_MASK) {