linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] tpm, tpm_vtpm_proxy: add kdoc comments for VTPM_PROXY_IOC_NEW_DEV
       [not found] <20161103235752.19256-1-jarkko.sakkinen@linux.intel.com>
@ 2016-11-03 23:57 ` Jarkko Sakkinen
  2016-11-05  3:00   ` Jarkko Sakkinen
  2016-11-03 23:57 ` [PATCH 2/3] tpm: transition tpm_vtpm_proxy documentation to the Sphinx Jarkko Sakkinen
  2016-11-03 23:57 ` [PATCH 3/3] tpm: move documentation under Documentation/security Jarkko Sakkinen
  2 siblings, 1 reply; 12+ messages in thread
From: Jarkko Sakkinen @ 2016-11-03 23:57 UTC (permalink / raw)
  To: tpmdd-devel
  Cc: Jarkko Sakkinen, Peter Huewe, Marcel Selhorst, Jason Gunthorpe,
	Stefan Berger, open list

Added kdoc comments for VTPM_PROXY_IOC_NEW_DEV so that these can be
imported to the kernel documentation written with rst markup and
generated with Sphinx.

Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
---
 drivers/char/tpm/tpm_vtpm_proxy.c | 72 +++++++++++++++++++++++++--------------
 include/uapi/linux/vtpm_proxy.h   | 23 ++++++++++---
 2 files changed, 65 insertions(+), 30 deletions(-)

diff --git a/drivers/char/tpm/tpm_vtpm_proxy.c b/drivers/char/tpm/tpm_vtpm_proxy.c
index 9a94033..3d6f6ca 100644
--- a/drivers/char/tpm/tpm_vtpm_proxy.c
+++ b/drivers/char/tpm/tpm_vtpm_proxy.c
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2015, 2016 IBM Corporation
+ * Copyright (C) 2016 Intel Corporation
  *
  * Author: Stefan Berger <stefanb@us.ibm.com>
  *
@@ -524,6 +525,50 @@ static void vtpm_proxy_delete_device(struct proxy_dev *proxy_dev)
  * Code related to the control device /dev/vtpmx
  */
 
+/**
+ * vtpmx_ioc_new_dev - handler for the %VTPM_PROXY_IOC_NEW_DEV ioctl
+ * @file:	/dev/vtpmx
+ * @ioctl:	the ioctl number
+ * @arg:	pointer to the struct vtpmx_proxy_new_dev
+ *
+ * Creates an anonymous file that is used by the process acting as a TPM to
+ * communicate with the client processes. The function will also add a new TPM
+ * device through which data is proxied to this TPM acting process. The caller
+ * will be provided with a file descriptor to communicate with the clients and
+ * major and minor numbers for the TPM device.
+ */
+static long vtpmx_ioc_new_dev(struct file *file, unsigned int ioctl,
+			      unsigned long arg)
+{
+	void __user *argp = (void __user *)arg;
+	struct vtpm_proxy_new_dev __user *vtpm_new_dev_p;
+	struct vtpm_proxy_new_dev vtpm_new_dev;
+	struct file *vtpm_file;
+
+	if (!capable(CAP_SYS_ADMIN))
+		return -EPERM;
+
+	vtpm_new_dev_p = argp;
+
+	if (copy_from_user(&vtpm_new_dev, vtpm_new_dev_p,
+			   sizeof(vtpm_new_dev)))
+		return -EFAULT;
+
+	vtpm_file = vtpm_proxy_create_device(&vtpm_new_dev);
+	if (IS_ERR(vtpm_file))
+		return PTR_ERR(vtpm_file);
+
+	if (copy_to_user(vtpm_new_dev_p, &vtpm_new_dev,
+			 sizeof(vtpm_new_dev))) {
+		put_unused_fd(vtpm_new_dev.fd);
+		fput(vtpm_file);
+		return -EFAULT;
+	}
+
+	fd_install(vtpm_new_dev.fd, vtpm_file);
+	return 0;
+}
+
 /*
  * vtpmx_fops_ioctl: ioctl on /dev/vtpmx
  *
@@ -531,34 +576,11 @@ static void vtpm_proxy_delete_device(struct proxy_dev *proxy_dev)
  *      Returns 0 on success, a negative error code otherwise.
  */
 static long vtpmx_fops_ioctl(struct file *f, unsigned int ioctl,
-				   unsigned long arg)
+			     unsigned long arg)
 {
-	void __user *argp = (void __user *)arg;
-	struct vtpm_proxy_new_dev __user *vtpm_new_dev_p;
-	struct vtpm_proxy_new_dev vtpm_new_dev;
-	struct file *file;
-
 	switch (ioctl) {
 	case VTPM_PROXY_IOC_NEW_DEV:
-		if (!capable(CAP_SYS_ADMIN))
-			return -EPERM;
-		vtpm_new_dev_p = argp;
-		if (copy_from_user(&vtpm_new_dev, vtpm_new_dev_p,
-				   sizeof(vtpm_new_dev)))
-			return -EFAULT;
-		file = vtpm_proxy_create_device(&vtpm_new_dev);
-		if (IS_ERR(file))
-			return PTR_ERR(file);
-		if (copy_to_user(vtpm_new_dev_p, &vtpm_new_dev,
-				 sizeof(vtpm_new_dev))) {
-			put_unused_fd(vtpm_new_dev.fd);
-			fput(file);
-			return -EFAULT;
-		}
-
-		fd_install(vtpm_new_dev.fd, file);
-		return 0;
-
+		return vtpmx_ioc_new_dev(f, ioctl, arg);
 	default:
 		return -ENOIOCTLCMD;
 	}
diff --git a/include/uapi/linux/vtpm_proxy.h b/include/uapi/linux/vtpm_proxy.h
index 41e8e22..a69e991 100644
--- a/include/uapi/linux/vtpm_proxy.h
+++ b/include/uapi/linux/vtpm_proxy.h
@@ -1,6 +1,7 @@
 /*
  * Definitions for the VTPM proxy driver
  * Copyright (c) 2015, 2016, IBM Corporation
+ * Copyright (C) 2016 Intel Corporation
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms and conditions of the GNU General Public License,
@@ -18,8 +19,23 @@
 #include <linux/types.h>
 #include <linux/ioctl.h>
 
-/* ioctls */
+/**
+ * enum vtpm_proxy_flags - flags for the proxy TPM
+ * @VTPM_PROXY_FLAG_TPM2:	the proxy TPM uses TPM 2.0 protocol
+ */
+enum vtpm_proxy_flags {
+	VTPM_PROXY_FLAG_TPM2	= 1,
+};
 
+/**
+ * struct vtpm_proxy_new_dev - parameter structure for the
+ *                             %VTPM_PROXY_IOC_NEW_DEV ioctl
+ * @flags:	flags for the proxy TPM
+ * @tpm_num:	index of the TPM device
+ * @fd:		the file descriptor used by the proxy TPM
+ * @major:	the major number of the TPM device
+ * @minor:	the minor number of the TPM device
+ */
 struct vtpm_proxy_new_dev {
 	__u32 flags;         /* input */
 	__u32 tpm_num;       /* output */
@@ -28,9 +44,6 @@ struct vtpm_proxy_new_dev {
 	__u32 minor;         /* output */
 };
 
-/* above flags */
-#define VTPM_PROXY_FLAG_TPM2  1  /* emulator is TPM 2 */
-
-#define VTPM_PROXY_IOC_NEW_DEV   _IOWR(0xa1, 0x00, struct vtpm_proxy_new_dev)
+#define VTPM_PROXY_IOC_NEW_DEV	_IOWR(0xa1, 0x00, struct vtpm_proxy_new_dev)
 
 #endif /* _UAPI_LINUX_VTPM_PROXY_H */
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 2/3] tpm: transition tpm_vtpm_proxy documentation to the Sphinx
       [not found] <20161103235752.19256-1-jarkko.sakkinen@linux.intel.com>
  2016-11-03 23:57 ` [PATCH 1/3] tpm, tpm_vtpm_proxy: add kdoc comments for VTPM_PROXY_IOC_NEW_DEV Jarkko Sakkinen
@ 2016-11-03 23:57 ` Jarkko Sakkinen
  2016-11-05  3:01   ` Jarkko Sakkinen
  2016-11-03 23:57 ` [PATCH 3/3] tpm: move documentation under Documentation/security Jarkko Sakkinen
  2 siblings, 1 reply; 12+ messages in thread
From: Jarkko Sakkinen @ 2016-11-03 23:57 UTC (permalink / raw)
  To: tpmdd-devel
  Cc: Jarkko Sakkinen, Jonathan Corbet, Stefan Berger,
	open list:DOCUMENTATION, open list

Transitioned the tpm_vtpm_proxy documentation to the Sphinx
infrastructure and removed parts from the documentation that are easier
to pull from the sources. Restructured vtpm_proxy.h and tpm_vtpm_proxy.c
to be compatible with this approach and wrote associated documentation
comments.

Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
---
 Documentation/index.rst                            |  1 +
 Documentation/tpm/index.rst                        |  7 +++
 .../tpm/{tpm_vtpm_proxy.txt => tpm_vtpm_proxy.rst} | 55 +++++++---------------
 3 files changed, 25 insertions(+), 38 deletions(-)
 create mode 100644 Documentation/tpm/index.rst
 rename Documentation/tpm/{tpm_vtpm_proxy.txt => tpm_vtpm_proxy.rst} (53%)

diff --git a/Documentation/index.rst b/Documentation/index.rst
index e0fc729..0058b65 100644
--- a/Documentation/index.rst
+++ b/Documentation/index.rst
@@ -19,6 +19,7 @@ Contents:
    media/dvb-drivers/index
    media/v4l-drivers/index
    gpu/index
+   tpm/index
 
 Indices and tables
 ==================
diff --git a/Documentation/tpm/index.rst b/Documentation/tpm/index.rst
new file mode 100644
index 0000000..af77a7b
--- /dev/null
+++ b/Documentation/tpm/index.rst
@@ -0,0 +1,7 @@
+=====================================
+Trusted Platform Module documentation
+=====================================
+
+.. toctree::
+
+   tpm_vtpm_proxy
diff --git a/Documentation/tpm/tpm_vtpm_proxy.txt b/Documentation/tpm/tpm_vtpm_proxy.rst
similarity index 53%
rename from Documentation/tpm/tpm_vtpm_proxy.txt
rename to Documentation/tpm/tpm_vtpm_proxy.rst
index 30d1902..ea08e76 100644
--- a/Documentation/tpm/tpm_vtpm_proxy.txt
+++ b/Documentation/tpm/tpm_vtpm_proxy.rst
@@ -1,71 +1,50 @@
+=============================================
 Virtual TPM Proxy Driver for Linux Containers
+=============================================
 
-Authors: Stefan Berger (IBM)
+| Authors:
+| Stefan Berger <stefanb@linux.vnet.ibm.com>
 
 This document describes the virtual Trusted Platform Module (vTPM)
 proxy device driver for Linux containers.
 
-INTRODUCTION
-------------
+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
-------
+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
+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
+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.
+Besides that the number of the TPM character device is returned. If for
+example ``/dev/tpm10`` was created, the number (``dev_num``) 10 is returned.
 
 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:
+UAPI
+====
 
-- 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
+.. kernel-doc:: include/uapi/linux/vtpm_proxy.h
 
-The TPM device /dev/tpmX will only appear if all of the relevant commands
-were responded to properly.
+.. kernel-doc:: drivers/char/tpm/tpm_vtpm_proxy.c
+   :functions: vtpmx_ioc_new_dev
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 3/3] tpm: move documentation under Documentation/security
       [not found] <20161103235752.19256-1-jarkko.sakkinen@linux.intel.com>
  2016-11-03 23:57 ` [PATCH 1/3] tpm, tpm_vtpm_proxy: add kdoc comments for VTPM_PROXY_IOC_NEW_DEV Jarkko Sakkinen
  2016-11-03 23:57 ` [PATCH 2/3] tpm: transition tpm_vtpm_proxy documentation to the Sphinx Jarkko Sakkinen
@ 2016-11-03 23:57 ` Jarkko Sakkinen
  2016-11-04 12:06   ` Jani Nikula
  2016-11-07 22:37   ` Jonathan Corbet
  2 siblings, 2 replies; 12+ messages in thread
From: Jarkko Sakkinen @ 2016-11-03 23:57 UTC (permalink / raw)
  To: tpmdd-devel
  Cc: Jarkko Sakkinen, Jonathan Corbet, open list:DOCUMENTATION, open list

In order too make Documentation root directory cleaner move the tpm
directory under Documentation/security.

Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
---
 Documentation/index.rst                             | 2 +-
 Documentation/security/index.rst                    | 7 +++++++
 Documentation/{ => security}/tpm/index.rst          | 0
 Documentation/{ => security}/tpm/tpm_vtpm_proxy.rst | 0
 Documentation/{ => security}/tpm/xen-tpmfront.txt   | 0
 5 files changed, 8 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/security/index.rst
 rename Documentation/{ => security}/tpm/index.rst (100%)
 rename Documentation/{ => security}/tpm/tpm_vtpm_proxy.rst (100%)
 rename Documentation/{ => security}/tpm/xen-tpmfront.txt (100%)

diff --git a/Documentation/index.rst b/Documentation/index.rst
index 0058b65..b4c3034 100644
--- a/Documentation/index.rst
+++ b/Documentation/index.rst
@@ -19,7 +19,7 @@ Contents:
    media/dvb-drivers/index
    media/v4l-drivers/index
    gpu/index
-   tpm/index
+   security/index
 
 Indices and tables
 ==================
diff --git a/Documentation/security/index.rst b/Documentation/security/index.rst
new file mode 100644
index 0000000..9bae6bb
--- /dev/null
+++ b/Documentation/security/index.rst
@@ -0,0 +1,7 @@
+======================
+Security documentation
+======================
+
+.. toctree::
+
+   tpm/index
diff --git a/Documentation/tpm/index.rst b/Documentation/security/tpm/index.rst
similarity index 100%
rename from Documentation/tpm/index.rst
rename to Documentation/security/tpm/index.rst
diff --git a/Documentation/tpm/tpm_vtpm_proxy.rst b/Documentation/security/tpm/tpm_vtpm_proxy.rst
similarity index 100%
rename from Documentation/tpm/tpm_vtpm_proxy.rst
rename to Documentation/security/tpm/tpm_vtpm_proxy.rst
diff --git a/Documentation/tpm/xen-tpmfront.txt b/Documentation/security/tpm/xen-tpmfront.txt
similarity index 100%
rename from Documentation/tpm/xen-tpmfront.txt
rename to Documentation/security/tpm/xen-tpmfront.txt
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH 3/3] tpm: move documentation under Documentation/security
  2016-11-03 23:57 ` [PATCH 3/3] tpm: move documentation under Documentation/security Jarkko Sakkinen
@ 2016-11-04 12:06   ` Jani Nikula
  2016-11-04 13:01     ` Jarkko Sakkinen
  2016-11-07 22:37   ` Jonathan Corbet
  1 sibling, 1 reply; 12+ messages in thread
From: Jani Nikula @ 2016-11-04 12:06 UTC (permalink / raw)
  To: Jarkko Sakkinen, tpmdd-devel
  Cc: Jarkko Sakkinen, Jonathan Corbet, open list:DOCUMENTATION, open list

On Fri, 04 Nov 2016, Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> wrote:
> In order too make Documentation root directory cleaner move the tpm
> directory under Documentation/security.

FWIW I like this.

BR,
Jani.


>
> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
> ---
>  Documentation/index.rst                             | 2 +-
>  Documentation/security/index.rst                    | 7 +++++++
>  Documentation/{ => security}/tpm/index.rst          | 0
>  Documentation/{ => security}/tpm/tpm_vtpm_proxy.rst | 0
>  Documentation/{ => security}/tpm/xen-tpmfront.txt   | 0
>  5 files changed, 8 insertions(+), 1 deletion(-)
>  create mode 100644 Documentation/security/index.rst
>  rename Documentation/{ => security}/tpm/index.rst (100%)
>  rename Documentation/{ => security}/tpm/tpm_vtpm_proxy.rst (100%)
>  rename Documentation/{ => security}/tpm/xen-tpmfront.txt (100%)
>
> diff --git a/Documentation/index.rst b/Documentation/index.rst
> index 0058b65..b4c3034 100644
> --- a/Documentation/index.rst
> +++ b/Documentation/index.rst
> @@ -19,7 +19,7 @@ Contents:
>     media/dvb-drivers/index
>     media/v4l-drivers/index
>     gpu/index
> -   tpm/index
> +   security/index
>  
>  Indices and tables
>  ==================
> diff --git a/Documentation/security/index.rst b/Documentation/security/index.rst
> new file mode 100644
> index 0000000..9bae6bb
> --- /dev/null
> +++ b/Documentation/security/index.rst
> @@ -0,0 +1,7 @@
> +======================
> +Security documentation
> +======================
> +
> +.. toctree::
> +
> +   tpm/index
> diff --git a/Documentation/tpm/index.rst b/Documentation/security/tpm/index.rst
> similarity index 100%
> rename from Documentation/tpm/index.rst
> rename to Documentation/security/tpm/index.rst
> diff --git a/Documentation/tpm/tpm_vtpm_proxy.rst b/Documentation/security/tpm/tpm_vtpm_proxy.rst
> similarity index 100%
> rename from Documentation/tpm/tpm_vtpm_proxy.rst
> rename to Documentation/security/tpm/tpm_vtpm_proxy.rst
> diff --git a/Documentation/tpm/xen-tpmfront.txt b/Documentation/security/tpm/xen-tpmfront.txt
> similarity index 100%
> rename from Documentation/tpm/xen-tpmfront.txt
> rename to Documentation/security/tpm/xen-tpmfront.txt

-- 
Jani Nikula, Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 3/3] tpm: move documentation under Documentation/security
  2016-11-04 12:06   ` Jani Nikula
@ 2016-11-04 13:01     ` Jarkko Sakkinen
  2016-11-04 16:34       ` James Morris
  0 siblings, 1 reply; 12+ messages in thread
From: Jarkko Sakkinen @ 2016-11-04 13:01 UTC (permalink / raw)
  To: Jani Nikula
  Cc: tpmdd-devel, Jonathan Corbet, open list:DOCUMENTATION, open list,
	linux-security-module, James Morris

On Fri, Nov 04, 2016 at 02:06:00PM +0200, Jani Nikula wrote:
> On Fri, 04 Nov 2016, Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> wrote:
> > In order too make Documentation root directory cleaner move the tpm
> > directory under Documentation/security.
> 
> FWIW I like this.

Thx. I just realized that I should have CC'd to linux-security-module
to get say from James as this makes path for the whole security tree.

James, sorry about that. Can you share your opinion?

> BR,
> Jani.

/Jarkko

> 
> 
> >
> > Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
> > ---
> >  Documentation/index.rst                             | 2 +-
> >  Documentation/security/index.rst                    | 7 +++++++
> >  Documentation/{ => security}/tpm/index.rst          | 0
> >  Documentation/{ => security}/tpm/tpm_vtpm_proxy.rst | 0
> >  Documentation/{ => security}/tpm/xen-tpmfront.txt   | 0
> >  5 files changed, 8 insertions(+), 1 deletion(-)
> >  create mode 100644 Documentation/security/index.rst
> >  rename Documentation/{ => security}/tpm/index.rst (100%)
> >  rename Documentation/{ => security}/tpm/tpm_vtpm_proxy.rst (100%)
> >  rename Documentation/{ => security}/tpm/xen-tpmfront.txt (100%)
> >
> > diff --git a/Documentation/index.rst b/Documentation/index.rst
> > index 0058b65..b4c3034 100644
> > --- a/Documentation/index.rst
> > +++ b/Documentation/index.rst
> > @@ -19,7 +19,7 @@ Contents:
> >     media/dvb-drivers/index
> >     media/v4l-drivers/index
> >     gpu/index
> > -   tpm/index
> > +   security/index
> >  
> >  Indices and tables
> >  ==================
> > diff --git a/Documentation/security/index.rst b/Documentation/security/index.rst
> > new file mode 100644
> > index 0000000..9bae6bb
> > --- /dev/null
> > +++ b/Documentation/security/index.rst
> > @@ -0,0 +1,7 @@
> > +======================
> > +Security documentation
> > +======================
> > +
> > +.. toctree::
> > +
> > +   tpm/index
> > diff --git a/Documentation/tpm/index.rst b/Documentation/security/tpm/index.rst
> > similarity index 100%
> > rename from Documentation/tpm/index.rst
> > rename to Documentation/security/tpm/index.rst
> > diff --git a/Documentation/tpm/tpm_vtpm_proxy.rst b/Documentation/security/tpm/tpm_vtpm_proxy.rst
> > similarity index 100%
> > rename from Documentation/tpm/tpm_vtpm_proxy.rst
> > rename to Documentation/security/tpm/tpm_vtpm_proxy.rst
> > diff --git a/Documentation/tpm/xen-tpmfront.txt b/Documentation/security/tpm/xen-tpmfront.txt
> > similarity index 100%
> > rename from Documentation/tpm/xen-tpmfront.txt
> > rename to Documentation/security/tpm/xen-tpmfront.txt
> 
> -- 
> Jani Nikula, Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 3/3] tpm: move documentation under Documentation/security
  2016-11-04 13:01     ` Jarkko Sakkinen
@ 2016-11-04 16:34       ` James Morris
  0 siblings, 0 replies; 12+ messages in thread
From: James Morris @ 2016-11-04 16:34 UTC (permalink / raw)
  To: Jarkko Sakkinen
  Cc: Jani Nikula, tpmdd-devel, Jonathan Corbet,
	open list:DOCUMENTATION, open list, linux-security-module

On Fri, 4 Nov 2016, Jarkko Sakkinen wrote:

> On Fri, Nov 04, 2016 at 02:06:00PM +0200, Jani Nikula wrote:
> > On Fri, 04 Nov 2016, Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> wrote:
> > > In order too make Documentation root directory cleaner move the tpm
> > > directory under Documentation/security.
> > 
> > FWIW I like this.
> 
> Thx. I just realized that I should have CC'd to linux-security-module
> to get say from James as this makes path for the whole security tree.
> 
> James, sorry about that. Can you share your opinion?

Looks like a good idea to me.


-- 
James Morris
<jmorris@namei.org>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/3] tpm, tpm_vtpm_proxy: add kdoc comments for VTPM_PROXY_IOC_NEW_DEV
  2016-11-03 23:57 ` [PATCH 1/3] tpm, tpm_vtpm_proxy: add kdoc comments for VTPM_PROXY_IOC_NEW_DEV Jarkko Sakkinen
@ 2016-11-05  3:00   ` Jarkko Sakkinen
  2016-11-07  0:46     ` Stefan Berger
  0 siblings, 1 reply; 12+ messages in thread
From: Jarkko Sakkinen @ 2016-11-05  3:00 UTC (permalink / raw)
  To: tpmdd-devel
  Cc: Peter Huewe, Marcel Selhorst, Jason Gunthorpe, Stefan Berger, open list

On Thu, Nov 03, 2016 at 05:57:50PM -0600, Jarkko Sakkinen wrote:
> Added kdoc comments for VTPM_PROXY_IOC_NEW_DEV so that these can be
> imported to the kernel documentation written with rst markup and
> generated with Sphinx.
> 
> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>

Stefan, is this OK? Are you willing to give Reviewed-by?

/Jarkko

> ---
>  drivers/char/tpm/tpm_vtpm_proxy.c | 72 +++++++++++++++++++++++++--------------
>  include/uapi/linux/vtpm_proxy.h   | 23 ++++++++++---
>  2 files changed, 65 insertions(+), 30 deletions(-)
> 
> diff --git a/drivers/char/tpm/tpm_vtpm_proxy.c b/drivers/char/tpm/tpm_vtpm_proxy.c
> index 9a94033..3d6f6ca 100644
> --- a/drivers/char/tpm/tpm_vtpm_proxy.c
> +++ b/drivers/char/tpm/tpm_vtpm_proxy.c
> @@ -1,5 +1,6 @@
>  /*
>   * Copyright (C) 2015, 2016 IBM Corporation
> + * Copyright (C) 2016 Intel Corporation
>   *
>   * Author: Stefan Berger <stefanb@us.ibm.com>
>   *
> @@ -524,6 +525,50 @@ static void vtpm_proxy_delete_device(struct proxy_dev *proxy_dev)
>   * Code related to the control device /dev/vtpmx
>   */
>  
> +/**
> + * vtpmx_ioc_new_dev - handler for the %VTPM_PROXY_IOC_NEW_DEV ioctl
> + * @file:	/dev/vtpmx
> + * @ioctl:	the ioctl number
> + * @arg:	pointer to the struct vtpmx_proxy_new_dev
> + *
> + * Creates an anonymous file that is used by the process acting as a TPM to
> + * communicate with the client processes. The function will also add a new TPM
> + * device through which data is proxied to this TPM acting process. The caller
> + * will be provided with a file descriptor to communicate with the clients and
> + * major and minor numbers for the TPM device.
> + */
> +static long vtpmx_ioc_new_dev(struct file *file, unsigned int ioctl,
> +			      unsigned long arg)
> +{
> +	void __user *argp = (void __user *)arg;
> +	struct vtpm_proxy_new_dev __user *vtpm_new_dev_p;
> +	struct vtpm_proxy_new_dev vtpm_new_dev;
> +	struct file *vtpm_file;
> +
> +	if (!capable(CAP_SYS_ADMIN))
> +		return -EPERM;
> +
> +	vtpm_new_dev_p = argp;
> +
> +	if (copy_from_user(&vtpm_new_dev, vtpm_new_dev_p,
> +			   sizeof(vtpm_new_dev)))
> +		return -EFAULT;
> +
> +	vtpm_file = vtpm_proxy_create_device(&vtpm_new_dev);
> +	if (IS_ERR(vtpm_file))
> +		return PTR_ERR(vtpm_file);
> +
> +	if (copy_to_user(vtpm_new_dev_p, &vtpm_new_dev,
> +			 sizeof(vtpm_new_dev))) {
> +		put_unused_fd(vtpm_new_dev.fd);
> +		fput(vtpm_file);
> +		return -EFAULT;
> +	}
> +
> +	fd_install(vtpm_new_dev.fd, vtpm_file);
> +	return 0;
> +}
> +
>  /*
>   * vtpmx_fops_ioctl: ioctl on /dev/vtpmx
>   *
> @@ -531,34 +576,11 @@ static void vtpm_proxy_delete_device(struct proxy_dev *proxy_dev)
>   *      Returns 0 on success, a negative error code otherwise.
>   */
>  static long vtpmx_fops_ioctl(struct file *f, unsigned int ioctl,
> -				   unsigned long arg)
> +			     unsigned long arg)
>  {
> -	void __user *argp = (void __user *)arg;
> -	struct vtpm_proxy_new_dev __user *vtpm_new_dev_p;
> -	struct vtpm_proxy_new_dev vtpm_new_dev;
> -	struct file *file;
> -
>  	switch (ioctl) {
>  	case VTPM_PROXY_IOC_NEW_DEV:
> -		if (!capable(CAP_SYS_ADMIN))
> -			return -EPERM;
> -		vtpm_new_dev_p = argp;
> -		if (copy_from_user(&vtpm_new_dev, vtpm_new_dev_p,
> -				   sizeof(vtpm_new_dev)))
> -			return -EFAULT;
> -		file = vtpm_proxy_create_device(&vtpm_new_dev);
> -		if (IS_ERR(file))
> -			return PTR_ERR(file);
> -		if (copy_to_user(vtpm_new_dev_p, &vtpm_new_dev,
> -				 sizeof(vtpm_new_dev))) {
> -			put_unused_fd(vtpm_new_dev.fd);
> -			fput(file);
> -			return -EFAULT;
> -		}
> -
> -		fd_install(vtpm_new_dev.fd, file);
> -		return 0;
> -
> +		return vtpmx_ioc_new_dev(f, ioctl, arg);
>  	default:
>  		return -ENOIOCTLCMD;
>  	}
> diff --git a/include/uapi/linux/vtpm_proxy.h b/include/uapi/linux/vtpm_proxy.h
> index 41e8e22..a69e991 100644
> --- a/include/uapi/linux/vtpm_proxy.h
> +++ b/include/uapi/linux/vtpm_proxy.h
> @@ -1,6 +1,7 @@
>  /*
>   * Definitions for the VTPM proxy driver
>   * Copyright (c) 2015, 2016, IBM Corporation
> + * Copyright (C) 2016 Intel Corporation
>   *
>   * This program is free software; you can redistribute it and/or modify it
>   * under the terms and conditions of the GNU General Public License,
> @@ -18,8 +19,23 @@
>  #include <linux/types.h>
>  #include <linux/ioctl.h>
>  
> -/* ioctls */
> +/**
> + * enum vtpm_proxy_flags - flags for the proxy TPM
> + * @VTPM_PROXY_FLAG_TPM2:	the proxy TPM uses TPM 2.0 protocol
> + */
> +enum vtpm_proxy_flags {
> +	VTPM_PROXY_FLAG_TPM2	= 1,
> +};
>  
> +/**
> + * struct vtpm_proxy_new_dev - parameter structure for the
> + *                             %VTPM_PROXY_IOC_NEW_DEV ioctl
> + * @flags:	flags for the proxy TPM
> + * @tpm_num:	index of the TPM device
> + * @fd:		the file descriptor used by the proxy TPM
> + * @major:	the major number of the TPM device
> + * @minor:	the minor number of the TPM device
> + */
>  struct vtpm_proxy_new_dev {
>  	__u32 flags;         /* input */
>  	__u32 tpm_num;       /* output */
> @@ -28,9 +44,6 @@ struct vtpm_proxy_new_dev {
>  	__u32 minor;         /* output */
>  };
>  
> -/* above flags */
> -#define VTPM_PROXY_FLAG_TPM2  1  /* emulator is TPM 2 */
> -
> -#define VTPM_PROXY_IOC_NEW_DEV   _IOWR(0xa1, 0x00, struct vtpm_proxy_new_dev)
> +#define VTPM_PROXY_IOC_NEW_DEV	_IOWR(0xa1, 0x00, struct vtpm_proxy_new_dev)
>  
>  #endif /* _UAPI_LINUX_VTPM_PROXY_H */
> -- 
> 2.9.3
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/3] tpm: transition tpm_vtpm_proxy documentation to the Sphinx
  2016-11-03 23:57 ` [PATCH 2/3] tpm: transition tpm_vtpm_proxy documentation to the Sphinx Jarkko Sakkinen
@ 2016-11-05  3:01   ` Jarkko Sakkinen
  2016-11-07  0:47     ` Stefan Berger
  0 siblings, 1 reply; 12+ messages in thread
From: Jarkko Sakkinen @ 2016-11-05  3:01 UTC (permalink / raw)
  To: tpmdd-devel
  Cc: Jonathan Corbet, Stefan Berger, open list:DOCUMENTATION, open list

On Thu, Nov 03, 2016 at 05:57:51PM -0600, Jarkko Sakkinen wrote:
> Transitioned the tpm_vtpm_proxy documentation to the Sphinx
> infrastructure and removed parts from the documentation that are easier
> to pull from the sources. Restructured vtpm_proxy.h and tpm_vtpm_proxy.c
> to be compatible with this approach and wrote associated documentation
> comments.
> 
> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>

Stefan?

/Jarkko

> ---
>  Documentation/index.rst                            |  1 +
>  Documentation/tpm/index.rst                        |  7 +++
>  .../tpm/{tpm_vtpm_proxy.txt => tpm_vtpm_proxy.rst} | 55 +++++++---------------
>  3 files changed, 25 insertions(+), 38 deletions(-)
>  create mode 100644 Documentation/tpm/index.rst
>  rename Documentation/tpm/{tpm_vtpm_proxy.txt => tpm_vtpm_proxy.rst} (53%)
> 
> diff --git a/Documentation/index.rst b/Documentation/index.rst
> index e0fc729..0058b65 100644
> --- a/Documentation/index.rst
> +++ b/Documentation/index.rst
> @@ -19,6 +19,7 @@ Contents:
>     media/dvb-drivers/index
>     media/v4l-drivers/index
>     gpu/index
> +   tpm/index
>  
>  Indices and tables
>  ==================
> diff --git a/Documentation/tpm/index.rst b/Documentation/tpm/index.rst
> new file mode 100644
> index 0000000..af77a7b
> --- /dev/null
> +++ b/Documentation/tpm/index.rst
> @@ -0,0 +1,7 @@
> +=====================================
> +Trusted Platform Module documentation
> +=====================================
> +
> +.. toctree::
> +
> +   tpm_vtpm_proxy
> diff --git a/Documentation/tpm/tpm_vtpm_proxy.txt b/Documentation/tpm/tpm_vtpm_proxy.rst
> similarity index 53%
> rename from Documentation/tpm/tpm_vtpm_proxy.txt
> rename to Documentation/tpm/tpm_vtpm_proxy.rst
> index 30d1902..ea08e76 100644
> --- a/Documentation/tpm/tpm_vtpm_proxy.txt
> +++ b/Documentation/tpm/tpm_vtpm_proxy.rst
> @@ -1,71 +1,50 @@
> +=============================================
>  Virtual TPM Proxy Driver for Linux Containers
> +=============================================
>  
> -Authors: Stefan Berger (IBM)
> +| Authors:
> +| Stefan Berger <stefanb@linux.vnet.ibm.com>
>  
>  This document describes the virtual Trusted Platform Module (vTPM)
>  proxy device driver for Linux containers.
>  
> -INTRODUCTION
> -------------
> +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
> -------
> +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
> +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
> +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.
> +Besides that the number of the TPM character device is returned. If for
> +example ``/dev/tpm10`` was created, the number (``dev_num``) 10 is returned.
>  
>  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:
> +UAPI
> +====
>  
> -- 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
> +.. kernel-doc:: include/uapi/linux/vtpm_proxy.h
>  
> -The TPM device /dev/tpmX will only appear if all of the relevant commands
> -were responded to properly.
> +.. kernel-doc:: drivers/char/tpm/tpm_vtpm_proxy.c
> +   :functions: vtpmx_ioc_new_dev
> -- 
> 2.9.3
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/3] tpm, tpm_vtpm_proxy: add kdoc comments for VTPM_PROXY_IOC_NEW_DEV
  2016-11-05  3:00   ` Jarkko Sakkinen
@ 2016-11-07  0:46     ` Stefan Berger
  0 siblings, 0 replies; 12+ messages in thread
From: Stefan Berger @ 2016-11-07  0:46 UTC (permalink / raw)
  To: Jarkko Sakkinen, tpmdd-devel
  Cc: Peter Huewe, Marcel Selhorst, Jason Gunthorpe, open list

On 11/04/2016 11:00 PM, Jarkko Sakkinen wrote:
> On Thu, Nov 03, 2016 at 05:57:50PM -0600, Jarkko Sakkinen wrote:
>> Added kdoc comments for VTPM_PROXY_IOC_NEW_DEV so that these can be
>> imported to the kernel documentation written with rst markup and
>> generated with Sphinx.
>>
>> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
> Stefan, is this OK? Are you willing to give Reviewed-by?

Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com>

    Stefan

>
> /Jarkko
>
>> ---
>>   drivers/char/tpm/tpm_vtpm_proxy.c | 72 +++++++++++++++++++++++++--------------
>>   include/uapi/linux/vtpm_proxy.h   | 23 ++++++++++---
>>   2 files changed, 65 insertions(+), 30 deletions(-)
>>
>> diff --git a/drivers/char/tpm/tpm_vtpm_proxy.c b/drivers/char/tpm/tpm_vtpm_proxy.c
>> index 9a94033..3d6f6ca 100644
>> --- a/drivers/char/tpm/tpm_vtpm_proxy.c
>> +++ b/drivers/char/tpm/tpm_vtpm_proxy.c
>> @@ -1,5 +1,6 @@
>>   /*
>>    * Copyright (C) 2015, 2016 IBM Corporation
>> + * Copyright (C) 2016 Intel Corporation
>>    *
>>    * Author: Stefan Berger <stefanb@us.ibm.com>
>>    *
>> @@ -524,6 +525,50 @@ static void vtpm_proxy_delete_device(struct proxy_dev *proxy_dev)
>>    * Code related to the control device /dev/vtpmx
>>    */
>>   
>> +/**
>> + * vtpmx_ioc_new_dev - handler for the %VTPM_PROXY_IOC_NEW_DEV ioctl
>> + * @file:	/dev/vtpmx
>> + * @ioctl:	the ioctl number
>> + * @arg:	pointer to the struct vtpmx_proxy_new_dev
>> + *
>> + * Creates an anonymous file that is used by the process acting as a TPM to
>> + * communicate with the client processes. The function will also add a new TPM
>> + * device through which data is proxied to this TPM acting process. The caller
>> + * will be provided with a file descriptor to communicate with the clients and
>> + * major and minor numbers for the TPM device.
>> + */
>> +static long vtpmx_ioc_new_dev(struct file *file, unsigned int ioctl,
>> +			      unsigned long arg)
>> +{
>> +	void __user *argp = (void __user *)arg;
>> +	struct vtpm_proxy_new_dev __user *vtpm_new_dev_p;
>> +	struct vtpm_proxy_new_dev vtpm_new_dev;
>> +	struct file *vtpm_file;
>> +
>> +	if (!capable(CAP_SYS_ADMIN))
>> +		return -EPERM;
>> +
>> +	vtpm_new_dev_p = argp;
>> +
>> +	if (copy_from_user(&vtpm_new_dev, vtpm_new_dev_p,
>> +			   sizeof(vtpm_new_dev)))
>> +		return -EFAULT;
>> +
>> +	vtpm_file = vtpm_proxy_create_device(&vtpm_new_dev);
>> +	if (IS_ERR(vtpm_file))
>> +		return PTR_ERR(vtpm_file);
>> +
>> +	if (copy_to_user(vtpm_new_dev_p, &vtpm_new_dev,
>> +			 sizeof(vtpm_new_dev))) {
>> +		put_unused_fd(vtpm_new_dev.fd);
>> +		fput(vtpm_file);
>> +		return -EFAULT;
>> +	}
>> +
>> +	fd_install(vtpm_new_dev.fd, vtpm_file);
>> +	return 0;
>> +}
>> +
>>   /*
>>    * vtpmx_fops_ioctl: ioctl on /dev/vtpmx
>>    *
>> @@ -531,34 +576,11 @@ static void vtpm_proxy_delete_device(struct proxy_dev *proxy_dev)
>>    *      Returns 0 on success, a negative error code otherwise.
>>    */
>>   static long vtpmx_fops_ioctl(struct file *f, unsigned int ioctl,
>> -				   unsigned long arg)
>> +			     unsigned long arg)
>>   {
>> -	void __user *argp = (void __user *)arg;
>> -	struct vtpm_proxy_new_dev __user *vtpm_new_dev_p;
>> -	struct vtpm_proxy_new_dev vtpm_new_dev;
>> -	struct file *file;
>> -
>>   	switch (ioctl) {
>>   	case VTPM_PROXY_IOC_NEW_DEV:
>> -		if (!capable(CAP_SYS_ADMIN))
>> -			return -EPERM;
>> -		vtpm_new_dev_p = argp;
>> -		if (copy_from_user(&vtpm_new_dev, vtpm_new_dev_p,
>> -				   sizeof(vtpm_new_dev)))
>> -			return -EFAULT;
>> -		file = vtpm_proxy_create_device(&vtpm_new_dev);
>> -		if (IS_ERR(file))
>> -			return PTR_ERR(file);
>> -		if (copy_to_user(vtpm_new_dev_p, &vtpm_new_dev,
>> -				 sizeof(vtpm_new_dev))) {
>> -			put_unused_fd(vtpm_new_dev.fd);
>> -			fput(file);
>> -			return -EFAULT;
>> -		}
>> -
>> -		fd_install(vtpm_new_dev.fd, file);
>> -		return 0;
>> -
>> +		return vtpmx_ioc_new_dev(f, ioctl, arg);
>>   	default:
>>   		return -ENOIOCTLCMD;
>>   	}
>> diff --git a/include/uapi/linux/vtpm_proxy.h b/include/uapi/linux/vtpm_proxy.h
>> index 41e8e22..a69e991 100644
>> --- a/include/uapi/linux/vtpm_proxy.h
>> +++ b/include/uapi/linux/vtpm_proxy.h
>> @@ -1,6 +1,7 @@
>>   /*
>>    * Definitions for the VTPM proxy driver
>>    * Copyright (c) 2015, 2016, IBM Corporation
>> + * Copyright (C) 2016 Intel Corporation
>>    *
>>    * This program is free software; you can redistribute it and/or modify it
>>    * under the terms and conditions of the GNU General Public License,
>> @@ -18,8 +19,23 @@
>>   #include <linux/types.h>
>>   #include <linux/ioctl.h>
>>   
>> -/* ioctls */
>> +/**
>> + * enum vtpm_proxy_flags - flags for the proxy TPM
>> + * @VTPM_PROXY_FLAG_TPM2:	the proxy TPM uses TPM 2.0 protocol
>> + */
>> +enum vtpm_proxy_flags {
>> +	VTPM_PROXY_FLAG_TPM2	= 1,
>> +};
>>   
>> +/**
>> + * struct vtpm_proxy_new_dev - parameter structure for the
>> + *                             %VTPM_PROXY_IOC_NEW_DEV ioctl
>> + * @flags:	flags for the proxy TPM
>> + * @tpm_num:	index of the TPM device
>> + * @fd:		the file descriptor used by the proxy TPM
>> + * @major:	the major number of the TPM device
>> + * @minor:	the minor number of the TPM device
>> + */
>>   struct vtpm_proxy_new_dev {
>>   	__u32 flags;         /* input */
>>   	__u32 tpm_num;       /* output */
>> @@ -28,9 +44,6 @@ struct vtpm_proxy_new_dev {
>>   	__u32 minor;         /* output */
>>   };
>>   
>> -/* above flags */
>> -#define VTPM_PROXY_FLAG_TPM2  1  /* emulator is TPM 2 */
>> -
>> -#define VTPM_PROXY_IOC_NEW_DEV   _IOWR(0xa1, 0x00, struct vtpm_proxy_new_dev)
>> +#define VTPM_PROXY_IOC_NEW_DEV	_IOWR(0xa1, 0x00, struct vtpm_proxy_new_dev)
>>   
>>   #endif /* _UAPI_LINUX_VTPM_PROXY_H */
>> -- 
>> 2.9.3
>>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/3] tpm: transition tpm_vtpm_proxy documentation to the Sphinx
  2016-11-05  3:01   ` Jarkko Sakkinen
@ 2016-11-07  0:47     ` Stefan Berger
  0 siblings, 0 replies; 12+ messages in thread
From: Stefan Berger @ 2016-11-07  0:47 UTC (permalink / raw)
  To: Jarkko Sakkinen, tpmdd-devel
  Cc: Jonathan Corbet, open list:DOCUMENTATION, open list

On 11/04/2016 11:01 PM, Jarkko Sakkinen wrote:
> On Thu, Nov 03, 2016 at 05:57:51PM -0600, Jarkko Sakkinen wrote:
>> Transitioned the tpm_vtpm_proxy documentation to the Sphinx
>> infrastructure and removed parts from the documentation that are easier
>> to pull from the sources. Restructured vtpm_proxy.h and tpm_vtpm_proxy.c
>> to be compatible with this approach and wrote associated documentation
>> comments.
>>
>> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
> Stefan?

Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com>


>
> /Jarkko
>
>> ---
>>   Documentation/index.rst                            |  1 +
>>   Documentation/tpm/index.rst                        |  7 +++
>>   .../tpm/{tpm_vtpm_proxy.txt => tpm_vtpm_proxy.rst} | 55 +++++++---------------
>>   3 files changed, 25 insertions(+), 38 deletions(-)
>>   create mode 100644 Documentation/tpm/index.rst
>>   rename Documentation/tpm/{tpm_vtpm_proxy.txt => tpm_vtpm_proxy.rst} (53%)
>>
>> diff --git a/Documentation/index.rst b/Documentation/index.rst
>> index e0fc729..0058b65 100644
>> --- a/Documentation/index.rst
>> +++ b/Documentation/index.rst
>> @@ -19,6 +19,7 @@ Contents:
>>      media/dvb-drivers/index
>>      media/v4l-drivers/index
>>      gpu/index
>> +   tpm/index
>>   
>>   Indices and tables
>>   ==================
>> diff --git a/Documentation/tpm/index.rst b/Documentation/tpm/index.rst
>> new file mode 100644
>> index 0000000..af77a7b
>> --- /dev/null
>> +++ b/Documentation/tpm/index.rst
>> @@ -0,0 +1,7 @@
>> +=====================================
>> +Trusted Platform Module documentation
>> +=====================================
>> +
>> +.. toctree::
>> +
>> +   tpm_vtpm_proxy
>> diff --git a/Documentation/tpm/tpm_vtpm_proxy.txt b/Documentation/tpm/tpm_vtpm_proxy.rst
>> similarity index 53%
>> rename from Documentation/tpm/tpm_vtpm_proxy.txt
>> rename to Documentation/tpm/tpm_vtpm_proxy.rst
>> index 30d1902..ea08e76 100644
>> --- a/Documentation/tpm/tpm_vtpm_proxy.txt
>> +++ b/Documentation/tpm/tpm_vtpm_proxy.rst
>> @@ -1,71 +1,50 @@
>> +=============================================
>>   Virtual TPM Proxy Driver for Linux Containers
>> +=============================================
>>   
>> -Authors: Stefan Berger (IBM)
>> +| Authors:
>> +| Stefan Berger <stefanb@linux.vnet.ibm.com>
>>   
>>   This document describes the virtual Trusted Platform Module (vTPM)
>>   proxy device driver for Linux containers.
>>   
>> -INTRODUCTION
>> -------------
>> +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
>> -------
>> +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
>> +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
>> +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.
>> +Besides that the number of the TPM character device is returned. If for
>> +example ``/dev/tpm10`` was created, the number (``dev_num``) 10 is returned.
>>   
>>   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:
>> +UAPI
>> +====
>>   
>> -- 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
>> +.. kernel-doc:: include/uapi/linux/vtpm_proxy.h
>>   
>> -The TPM device /dev/tpmX will only appear if all of the relevant commands
>> -were responded to properly.
>> +.. kernel-doc:: drivers/char/tpm/tpm_vtpm_proxy.c
>> +   :functions: vtpmx_ioc_new_dev
>> -- 
>> 2.9.3
>>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 3/3] tpm: move documentation under Documentation/security
  2016-11-03 23:57 ` [PATCH 3/3] tpm: move documentation under Documentation/security Jarkko Sakkinen
  2016-11-04 12:06   ` Jani Nikula
@ 2016-11-07 22:37   ` Jonathan Corbet
  2016-11-08  0:22     ` Jarkko Sakkinen
  1 sibling, 1 reply; 12+ messages in thread
From: Jonathan Corbet @ 2016-11-07 22:37 UTC (permalink / raw)
  To: Jarkko Sakkinen; +Cc: tpmdd-devel, open list:DOCUMENTATION, open list

On Thu,  3 Nov 2016 17:57:52 -0600
Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> wrote:

> In order too make Documentation root directory cleaner move the tpm
> directory under Documentation/security.

So I'll happily apply these to the docs tree, but...

1) It won't apply to current docs-next.  I guess I can manage the merge
   there easily enough, but also,

2) Part 1 of the series (which wasn't sent to me anyway) is not something I
   an apply, so somebody else should pick that one up.

Thanks,

jon

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 3/3] tpm: move documentation under Documentation/security
  2016-11-07 22:37   ` Jonathan Corbet
@ 2016-11-08  0:22     ` Jarkko Sakkinen
  0 siblings, 0 replies; 12+ messages in thread
From: Jarkko Sakkinen @ 2016-11-08  0:22 UTC (permalink / raw)
  To: Jonathan Corbet; +Cc: tpmdd-devel, open list:DOCUMENTATION, open list

On Mon, Nov 07, 2016 at 03:37:52PM -0700, Jonathan Corbet wrote:
> On Thu,  3 Nov 2016 17:57:52 -0600
> Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> wrote:
> 
> > In order too make Documentation root directory cleaner move the tpm
> > directory under Documentation/security.
> 
> So I'll happily apply these to the docs tree, but...
> 
> 1) It won't apply to current docs-next.  I guess I can manage the merge
>    there easily enough, but also,
> 
> 2) Part 1 of the series (which wasn't sent to me anyway) is not something I
>    an apply, so somebody else should pick that one up.

I'll apply the first patch to my (tpmdd) tree.

Thank you!

/Jarkko

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2016-11-08  0:22 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20161103235752.19256-1-jarkko.sakkinen@linux.intel.com>
2016-11-03 23:57 ` [PATCH 1/3] tpm, tpm_vtpm_proxy: add kdoc comments for VTPM_PROXY_IOC_NEW_DEV Jarkko Sakkinen
2016-11-05  3:00   ` Jarkko Sakkinen
2016-11-07  0:46     ` Stefan Berger
2016-11-03 23:57 ` [PATCH 2/3] tpm: transition tpm_vtpm_proxy documentation to the Sphinx Jarkko Sakkinen
2016-11-05  3:01   ` Jarkko Sakkinen
2016-11-07  0:47     ` Stefan Berger
2016-11-03 23:57 ` [PATCH 3/3] tpm: move documentation under Documentation/security Jarkko Sakkinen
2016-11-04 12:06   ` Jani Nikula
2016-11-04 13:01     ` Jarkko Sakkinen
2016-11-04 16:34       ` James Morris
2016-11-07 22:37   ` Jonathan Corbet
2016-11-08  0:22     ` Jarkko Sakkinen

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).