Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp5648386imm; Tue, 12 Jun 2018 10:59:06 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJxtOFFrHvUOLuq75cyq/QdFTdRex1MjtK0cdgGTmMGK6JURdA7/zNHEK6tzPok7rT5cXSU X-Received: by 2002:a17:902:7c16:: with SMTP id x22-v6mr1477321pll.77.1528826346735; Tue, 12 Jun 2018 10:59:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528826346; cv=none; d=google.com; s=arc-20160816; b=lXS3GIcLgRsfexFLs7fH7f39EPKHNDhBf577/0/a8Amg+c0zMlHvHuiRCOCcYLA+yh cGQU8W5D/+uTHzTxRlt6w+duDuiPQLG/aKsSBuULDtNKgch+L2pSHZhRsGp8Px6xl+Tg rrAEeKECOV3eV3A6vMwgJnuPdm1DIXa+eACTdBypQdhBp3JPrMB6hVR3xxNA5poePgtV JAoXbMMLYkW6SuTj3urdgkO7IjWpWu5cFNjcwle1DsnStbJasr9G+5n+wS0k78e/MaCR lZtzmhETCSteBT+uK99nkj7ImvFsAxwMd4Me/maq3HxmQzGdzYbG4LLZo3958/878kMW 1P1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:message-id:date:cc:to:from:subject :arc-authentication-results; bh=aw9tKKq3wkAYT97NkWYQ/ThL1gLeaeK8D3m1eqiNqOk=; b=0G3FAwrgHxn9iHOpCHDh6uYSemjSqWVkNqynFlgfoToBkat49O1sfN5TXxSjTsymOt J/I5NDx2j+wJNHlvYM+sHkOzVrCn4eVwlxe8K8oKFJzt/zIJxenC62aATtpKmfczzO6p e4sRlDrnyCViyPl25zR6AeusJAJ2Lkp9lZaYu+BRukxc+Lh+gJSNmNct+QXDGbsIyPTu vZ48cii4FUExgW4NR0aRyugCqpAWaxgud3X6L1VMru1FqGopqiMjhCO/E4EJHz+0UAvQ LNeRq6vWVYcpR2nzwbobEPKReEutVLGhsETm01OMctSQWFQtFERAamY2O5KFxhhHdlz6 lJOQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w23-v6si672959pfj.144.2018.06.12.10.58.51; Tue, 12 Jun 2018 10:59:06 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933856AbeFLR62 (ORCPT + 99 others); Tue, 12 Jun 2018 13:58:28 -0400 Received: from mga11.intel.com ([192.55.52.93]:30990 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933378AbeFLR61 (ORCPT ); Tue, 12 Jun 2018 13:58:27 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Jun 2018 10:58:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,215,1526367600"; d="scan'208";a="63978330" Received: from tstruk-mobl1.jf.intel.com ([10.7.196.162]) by orsmga001.jf.intel.com with ESMTP; 12 Jun 2018 10:58:26 -0700 Subject: [PATCH v3 0/2] tpm: add support for nonblocking operation From: Tadeusz Struk To: jarkko.sakkinen@linux.intel.com Cc: jgg@ziepe.ca, linux-integrity@vger.kernel.org, tadeusz.struk@intel.com, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org Date: Tue, 12 Jun 2018 10:58:26 -0700 Message-ID: <152882630662.30206.8805136953394285180.stgit@tstruk-mobl1.jf.intel.com> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The TCG SAPI specification [1] defines a set of functions, which allows applications to use the TPM device in either blocking or non-blocking fashion. Each command defined by the specification has a corresponding Tss2_Sys__Prepare() and Tss2_Sys__Complete() call, which together with Tss2_Sys_ExecuteAsync() is designed to allow asynchronous mode of operation. Currently the TPM driver supports only blocking calls, which doesn't allow asynchronous IO operations. This patch changes it and adds support for nonblocking write and a new poll function to enable applications, which want to take advantage of this feature. The new functionality can be tested using standard TPM tools implemented in [2], together with modified TCTI from [3]. [1] https://trustedcomputinggroup.org/wp-content/uploads/TSS_SAPI_Version-1.1_Revision-22_review_030918.pdf [2] https://github.com/tpm2-software/tpm2-tools [3] https://github.com/tstruk/tpm2-tss/tree/async --- Changes in v3: - Fixed problem reported by 0-dey kbuild test robot around __exitcall. It complained because there is a module_exit() in another file already. Changes in v2: - Split the change into two separate patches. First patch adds a pointer to the space to the struct file_priv to have access to it from the async job. This is to avoid memory allocations on every write call. Now everything what's needed is in the file_priv struct. - Renamed the 'work' member of the timer to avoid confusion. Now there are 'timeout_work' and 'async_work'. - Removed the global wait queue and moved it to file_priv. - Only creating the work queue when the first file is opened. Tadeusz Struk (2): tpm: add ptr to the tpm_space struct to file_priv tpm: add support for nonblocking operation drivers/char/tpm/tpm-dev-common.c | 150 +++++++++++++++++++++++++++---------- drivers/char/tpm/tpm-dev.c | 22 +++-- drivers/char/tpm/tpm-dev.h | 19 +++-- drivers/char/tpm/tpm-interface.c | 1 drivers/char/tpm/tpm.h | 1 drivers/char/tpm/tpmrm-dev.c | 31 ++++---- 6 files changed, 152 insertions(+), 72 deletions(-) -- TS