Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4697929imm; Mon, 11 Jun 2018 17:40:21 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKHNeXc4GpqCW9XC/9rDuwbIIhkRfuS6ZURiRUDUOEyOtLrN7dkbBnQ7hYkKM4LlBAuLY0L X-Received: by 2002:a62:e117:: with SMTP id q23-v6mr1383133pfh.75.1528764021905; Mon, 11 Jun 2018 17:40:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528764021; cv=none; d=google.com; s=arc-20160816; b=z7QQf0QwyYIX9AqRv/x1OF8TkZGqmm922DkJnkjVg2b4cOx1RVUb7vW/pQmvzZrapM cjVkgiO5yoxsyE6xyRSMJfJEBJ/BfGT/5GAdudalyUtw2MbyQg6H2ouvFDnIOoA4ywAQ 3J53RvbF8NqUNEfIfjKlXmOh2yNjwi1fYoPsnl8b2VOSPSNr7ONJdtVWCfRF69Ziky2o WBdKN0w5QETGsrNDAb4B6PfJzqy9BjJNS3vKjW4U7qbKrs0Cwg9pdi2YedkVBP/AuFHK rBxxplL9ek9DrpI8L2RNeZ9gRZUXFeeGb1dJa2opPUQndayXjTR4q4PxLdeTARrwE44n wZ6Q== 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:references:in-reply-to:message-id:date:cc:to:from :subject:arc-authentication-results; bh=E9wYDq9GnM774VPhgqiP2QmEe99o6IE3zLAMds82FIA=; b=RvAyGg5hv7eZD45BURNVWuTW1E30KKz9mVxS+YD9CS3zEqoC1CVvvKCO/PBChU7BYZ Lf8a0lOQ7XP1GzgTrjkrvLswogPVAxDTCBo0ZeF32HBAOy2UG0pK4ZbsIIIgmR12FR4B Kcfx2zlewBFsSN00HQKrUpmHpFfdQXQAxDgq6LGJYaIF0RYA8cIiq6j3dTEj7jiWowJc BVYxa9Kyb5w6p2C6dnneKRCaiLlVDHNRlOyr9Y74drKduTqWPWcPEBX7bRhXVvza9aRU z/dqF68W90nWMm2X98qkXg4Fsndxxu56Fe9ZS9Wxm3aQLboCK/AF0aEp0AudGpNtA6P5 xrYg== 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 74-v6si29197376pfp.161.2018.06.11.17.40.06; Mon, 11 Jun 2018 17:40:21 -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 S934315AbeFLAUQ (ORCPT + 99 others); Mon, 11 Jun 2018 20:20:16 -0400 Received: from mga02.intel.com ([134.134.136.20]:33758 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933891AbeFLAUO (ORCPT ); Mon, 11 Jun 2018 20:20:14 -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 orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Jun 2018 17:20:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,212,1526367600"; d="scan'208";a="63747700" Received: from tstruk-mobl1.jf.intel.com ([10.7.196.162]) by orsmga001.jf.intel.com with ESMTP; 11 Jun 2018 17:20:14 -0700 Subject: [PATCH v2 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: Mon, 11 Jun 2018 17:20:14 -0700 Message-ID: <152876281395.19591.3681365717212126222.stgit@tstruk-mobl1.jf.intel.com> In-Reply-To: <20180601171731.GF1408@ziepe.ca> References: <20180601171731.GF1408@ziepe.ca> 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 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 | 152 ++++++++++++++++++++++++++++--------- drivers/char/tpm/tpm-dev.c | 22 +++-- drivers/char/tpm/tpm-dev.h | 19 +++-- drivers/char/tpm/tpmrm-dev.c | 31 ++++---- 4 files changed, 152 insertions(+), 72 deletions(-) -- TS