linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
To: Stefan Berger <stefanb@linux.vnet.ibm.com>
Cc: tpmdd-devel@lists.sourceforge.net,
	jgunthorpe@obsidianresearch.com,
	linux-security-module@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-api@vger.kernel.org
Subject: Re: [PATCH v11 4/4] tpm: Add documentation for the tpm_vtpm_proxy device driver
Date: Fri, 22 Apr 2016 19:47:57 +0300	[thread overview]
Message-ID: <20160422164757.GC22741@intel.com> (raw)
In-Reply-To: <1461000376-2888-5-git-send-email-stefanb@linux.vnet.ibm.com>

On Mon, Apr 18, 2016 at 01:26:16PM -0400, Stefan Berger wrote:
> Add documentation for the tpm_vtpm device driver that implements
> support for providing TPM functionality to Linux containers.
> 
> Parts of this documentation were recycled from the Xen vTPM
> device driver documentation.
> 
> Update the documentation for the ioctl numbers.
> 
> Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
> Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>

Tested-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>

> CC: linux-kernel@vger.kernel.org
> CC: linux-doc@vger.kernel.org
> CC: linux-api@vger.kernel.org
> ---
>  Documentation/ioctl/ioctl-number.txt |  1 +
>  Documentation/tpm/tpm_vtpm_proxy.txt | 71 ++++++++++++++++++++++++++++++++++++
>  2 files changed, 72 insertions(+)
>  create mode 100644 Documentation/tpm/tpm_vtpm_proxy.txt
> 
> diff --git a/Documentation/ioctl/ioctl-number.txt b/Documentation/ioctl/ioctl-number.txt
> index 91261a3..7dbec90 100644
> --- a/Documentation/ioctl/ioctl-number.txt
> +++ b/Documentation/ioctl/ioctl-number.txt
> @@ -303,6 +303,7 @@ Code  Seq#(hex)	Include File		Comments
>  					<mailto:buk@buks.ipn.de>
>  0xA0	all	linux/sdp/sdp.h		Industrial Device Project
>  					<mailto:kenji@bitgate.com>
> +0xA1	0	linux/vtpm_proxy.h	TPM Emulator Proxy Driver
>  0xA2	00-0F	arch/tile/include/asm/hardwall.h
>  0xA3	80-8F	Port ACL		in development:
>  					<mailto:tlewis@mindspring.com>
> diff --git a/Documentation/tpm/tpm_vtpm_proxy.txt b/Documentation/tpm/tpm_vtpm_proxy.txt
> new file mode 100644
> index 0000000..30d1902
> --- /dev/null
> +++ b/Documentation/tpm/tpm_vtpm_proxy.txt
> @@ -0,0 +1,71 @@
> +Virtual TPM Proxy Driver for Linux Containers
> +
> +Authors: Stefan Berger (IBM)
> +
> +This document describes the virtual Trusted Platform Module (vTPM)
> +proxy device driver for Linux containers.
> +
> +INTRODUCTION
> +------------
> +
> +The goal of this work is to provide TPM functionality to each Linux
> +container. This allows programs to interact with a TPM in a container
> +the same way they interact with a TPM on the physical system. Each
> +container gets its own unique, emulated, software TPM.
> +
> +
> +DESIGN
> +------
> +
> +To make an emulated software TPM available to each container, the container
> +management stack needs to create a device pair consisting of a client TPM
> +character device /dev/tpmX (with X=0,1,2...) and a 'server side' file
> +descriptor. The former is moved into the container by creating a character
> +device with the appropriate major and minor numbers while the file descriptor
> +is passed to the TPM emulator. Software inside the container can then send
> +TPM commands using the character device and the emulator will receive the
> +commands via the file descriptor and use it for sending back responses.
> +
> +To support this, the virtual TPM proxy driver provides a device /dev/vtpmx
> +that is used to create device pairs using an ioctl. The ioctl takes as
> +an input flags for configuring the device. The flags  for example indicate
> +whether TPM 1.2 or TPM 2 functionality is supported by the TPM emulator.
> +The result of the ioctl are the file descriptor for the 'server side'
> +as well as the major and minor numbers of the character device that was created.
> +Besides that the number of the TPM character device is return. If for
> +example /dev/tpm10 was created, the number (dev_num) 10 is returned.
> +
> +The following is the data structure of the TPM_PROXY_IOC_NEW_DEV ioctl:
> +
> +struct vtpm_proxy_new_dev {
> +	__u32 flags;         /* input */
> +	__u32 tpm_num;       /* output */
> +	__u32 fd;            /* output */
> +	__u32 major;         /* output */
> +	__u32 minor;         /* output */
> +};
> +
> +Note that if unsupported flags are passed to the device driver, the ioctl will
> +fail and errno will be set to EOPNOTSUPP. Similarly, if an unsupported ioctl is
> +called on the device driver, the ioctl will fail and errno will be set to
> +ENOTTY.
> +
> +See /usr/include/linux/vtpm_proxy.h for definitions related to the public interface
> +of this vTPM device driver.
> +
> +Once the device has been created, the driver will immediately try to talk
> +to the TPM. All commands from the driver can be read from the file descriptor
> +returned by the ioctl. The commands should be responded to immediately.
> +
> +Depending on the version of TPM the following commands will be sent by the
> +driver:
> +
> +- TPM 1.2:
> +  - the driver will send a TPM_Startup command to the TPM emulator
> +  - the driver will send commands to read the command durations and
> +    interface timeouts from the TPM emulator
> +- TPM 2:
> +  - the driver will send a TPM2_Startup command to the TPM emulator
> +
> +The TPM device /dev/tpmX will only appear if all of the relevant commands
> +were responded to properly.
> -- 
> 2.4.3
> 

  reply	other threads:[~2016-04-22 16:48 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-18 17:26 [PATCH v11 0/4] Multi-instance vTPM proxy driver Stefan Berger
2016-04-18 17:26 ` [PATCH v11 1/4] tpm: Remove all uses of drvdata from the TPM Core Stefan Berger
2016-04-19 10:12   ` Jarkko Sakkinen
2016-04-19 10:36     ` Stefan Berger
2016-04-19 17:06       ` Jason Gunthorpe
2016-04-20  5:33         ` Jarkko Sakkinen
2016-04-19 17:21       ` Jarkko Sakkinen
2016-04-22 15:06   ` Jarkko Sakkinen
2016-04-25 19:13     ` Stefan Berger
2016-05-10 13:55   ` [BUG, bisect] " Jeremiah Mahler
2016-05-10 14:38     ` Jarkko Sakkinen
     [not found]     ` <201605101505.u4AF5nHd032349@d03av04.boulder.ibm.com>
2016-05-11  1:26       ` [tpmdd-devel] " Jeremiah Mahler
     [not found]         ` <201605111027.u4BARtQ4021061@d01av01.pok.ibm.com>
2016-05-11 14:29           ` Jeremiah Mahler
2016-05-11 15:20             ` Stefan Berger
2016-04-18 17:26 ` [PATCH v11 2/4] tpm: Introduce TPM_CHIP_FLAG_VIRTUAL Stefan Berger
2016-04-22 16:46   ` Jarkko Sakkinen
2016-04-18 17:26 ` [PATCH v11 3/4] tpm: Proxy driver for supporting multiple emulated TPMs Stefan Berger
2016-04-22 16:47   ` Jarkko Sakkinen
2016-04-18 17:26 ` [PATCH v11 4/4] tpm: Add documentation for the tpm_vtpm_proxy device driver Stefan Berger
2016-04-22 16:47   ` Jarkko Sakkinen [this message]
2016-04-22 16:54 ` [PATCH v11 0/4] Multi-instance vTPM proxy driver Jarkko Sakkinen
2016-04-26  9:28   ` [tpmdd-devel] " Jarkko Sakkinen
2016-04-26 11:30     ` Stefan Berger
2016-04-27 12:56       ` Jarkko Sakkinen
2016-04-27 16:27         ` Stefan Berger

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=20160422164757.GC22741@intel.com \
    --to=jarkko.sakkinen@linux.intel.com \
    --cc=jgunthorpe@obsidianresearch.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=stefanb@linux.vnet.ibm.com \
    --cc=tpmdd-devel@lists.sourceforge.net \
    /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).