Migrate TPM documentation to rst/Sphinx scheme
Subsystems (2)
cover Migrate TPM documentation to rst/Sphinx scheme
Moved TPM documentation under rst/Sphinx scheme except xen-tpmfront.txt because it contains ASCII diagrams that I do not know how to handle.
Jarkko Sakkinen (3):
tpm, tpm_vtpm_proxy: add kdoc comments for VTPM_PROXY_IOC_NEW_DEV
tpm: transition tpm_vtpm_proxy documentation to the Sphinx
tpm: move documentation under Documentation/security
Documentation/index.rst | 1 +
Documentation/security/index.rst | 7 +++
Documentation/security/tpm/index.rst | 7 +++
.../tpm/tpm_vtpm_proxy.rst} | 55 +++++------------
Documentation/{ => security}/tpm/xen-tpmfront.txt | 0
drivers/char/tpm/tpm_vtpm_proxy.c | 72 ++++++++++++++--------
include/uapi/linux/vtpm_proxy.h | 23 +++++--
7 files changed, 97 insertions(+), 68 deletions(-)
create mode 100644 Documentation/security/index.rst
create mode 100644 Documentation/security/tpm/index.rst
rename Documentation/{tpm/tpm_vtpm_proxy.txt => security/tpm/tpm_vtpm_proxy.rst} (53%)
rename Documentation/{ => security}/tpm/xen-tpmfront.txt (100%)Signature · 9 lines
2.9.3 ------------------------------------------------------------------------------ Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE. Training and support from Colfax. Order your platform today. http://sdm.link/xeonphi
PATCH 1/3 tpm, tpm_vtpm_proxy: add kdoc comments for VTPM_PROXY_IOC_NEW_DEV
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.
--- drivers/char/tpm/tpm_vtpm_proxy.c | 72 +++++++++++++++++++++++++-------------- include/uapi/linux/vtpm_proxy.h | 23 ++++++++++--- 2 files changed, 65 insertions(+), 30 deletions(-)
drivers/char/tpm/tpm_vtpm_proxy.c +47 -25
@@ -1,5 +1,6 @@/* * Copyright (C) 2015, 2016 IBM Corporation +* Copyright (C) 2016 Intel Corporation * * Author: Stefan Berger <stefanb-r/[email protected]> *
@@ -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 ; }
include/uapi/linux/vtpm_proxy.h +18 -5
@@ -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 */
Signature · 9 lines
2.9.3 ------------------------------------------------------------------------------ Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE. Training and support from Colfax. Order your platform today. http://sdm.link/xeonphi
Re: [PATCH 1/3] tpm, tpm_vtpm_proxy: add kdoc comments for VTPM_PROXY_IOC_NEW_DEV
Quoted 5 lines · Jarkko Sakkinen
Added kdoc comments for
VTPM_PROXY_IOC_NEW_DEVso that these can be imported to the kernel documentation written with rst markup and generated with Sphinx.Signed-off-by Jarkko Sakkinen <[email protected]>
Stefan, is this OK? Are you willing to give Reviewed-by?
/Jarkko
Quoted 155 lines
--- drivers/char/tpm/tpm_vtpm_proxy.c | 72 +++++++++++++++++++++++++-------------- include/uapi/linux/vtpm_proxy.h | 23 ++++++++++--- 2 files changed, 65 insertions(+), 30 deletions(-)drivers/char/tpm/tpm_vtpm_proxy.c +47
-25@@ -1,5 +1,6 @@/* * Copyright (C) 2015, 2016 IBM Corporation +* Copyright (C) 2016 Intel Corporation * * Author: Stefan Berger <[email protected]> * @@ -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 ; }include/uapi/linux/vtpm_proxy.h +18
-5@@ -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 */ Signature · 1 line
2.9.3
Stefan Berger
Reviewed-byRe: [PATCH 1/3] tpm, tpm_vtpm_proxy: add kdoc comments for VTPM_PROXY_IOC_NEW_DEV
Quoted 7 lines · Jarkko Sakkinen
Quoted 5 lines · Jarkko Sakkinen
Added kdoc comments for
VTPM_PROXY_IOC_NEW_DEVso that these can be imported to the kernel documentation written with rst markup and generated with Sphinx.Stefan, is this OK? Are you willing to give Reviewed-by?
Stefan
Quoted 154 lines
/Jarkko
Quoted 151 lines
--- drivers/char/tpm/tpm_vtpm_proxy.c | 72 +++++++++++++++++++++++++-------------- include/uapi/linux/vtpm_proxy.h | 23 ++++++++++--- 2 files changed, 65 insertions(+), 30 deletions(-)drivers/char/tpm/tpm_vtpm_proxy.c +47
-25@@ -1,5 +1,6 @@/* * Copyright (C) 2015, 2016 IBM Corporation +* Copyright (C) 2016 Intel Corporation * * Author: Stefan Berger <stefanb-r/[email protected]> * @@ -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 ; }include/uapi/linux/vtpm_proxy.h +18
-5@@ -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)
Quoted 4 lines
Quoted 4 lines
include/uapi/linux/vtpm_proxy.h +0
-0#endif /* _UAPI_LINUX_VTPM_PROXY_H */ Signature · 1 line
2.9.3
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
PATCH 2/3 tpm: transition tpm_vtpm_proxy documentation to the Sphinx
In reply to Jarkko SakkinenTransitioned 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.
---
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%)Documentation/index.rst +1 -0
@@ -19,6 +19,7 @@ Contents: media/dvb-drivers/index media/v4l-drivers/index gpu/index + tpm/index Indices and tables ==================
Documentation/tpm/index.rst new file +7 -0
@@ -0,0 +1,7 @@ +===================================== +Trusted Platform Module documentation +===================================== + +.. toctree:: + + tpm_vtpm_proxy
Documentation/tpm/tpm_vtpm_proxy.rst renamed from Documentation/tpm/tpm_vtpm_proxy.txt +17 -38
88 lines not on this page · raw message
Signature · 1 line
2.9.3
Re: [PATCH 2/3] tpm: transition tpm_vtpm_proxy documentation to the Sphinx
Quoted 7 lines · Jarkko Sakkinen
Transitioned the
tpm_vtpm_proxydocumentation to the Sphinx infrastructure and removed parts from the documentation that are easier to pull from the sources. Restructuredvtpm_proxy.handtpm_vtpm_proxy.cto be compatible with this approach and wrote associated documentation comments.Signed-off-by Jarkko Sakkinen <[email protected]>
Stefan?
/Jarkko
Quoted 132 lines
--- 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%)Documentation/index.rst +1
-0@@ -19,6 +19,7 @@ Contents: media/dvb-drivers/index media/v4l-drivers/index gpu/index + tpm/index Indices and tables ==================Documentation/tpm/index.rst new file +7
-0@@ -0,0 +1,7 @@ +===================================== +Trusted Platform Module documentation +===================================== + +.. toctree:: + + tpm_vtpm_proxyDocumentation/tpm/tpm_vtpm_proxy.rst renamed from Documentation/tpm/tpm_vtpm_proxy.txt +17
-38@@ -1,71 +1,50 @@ +============================================= Virtual TPM Proxy Driver for Linux Containers +============================================= -Authors: Stefan Berger (IBM) +| Authors: +| Stefan Berger <[email protected]> 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_devSignature · 1 line
2.9.3
Stefan Berger
Reviewed-byRe: [PATCH 2/3] tpm: transition tpm_vtpm_proxy documentation to the Sphinx
Quoted 9 lines · Jarkko Sakkinen
Quoted 7 lines · Jarkko Sakkinen
Transitioned the
tpm_vtpm_proxydocumentation to the Sphinx infrastructure and removed parts from the documentation that are easier to pull from the sources. Restructuredvtpm_proxy.handtpm_vtpm_proxy.cto be compatible with this approach and wrote associated documentation comments.Signed-off-by Jarkko Sakkinen <[email protected]>Stefan?
Quoted 135 lines
/Jarkko
Quoted 132 lines
--- 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
renameDocumentation/tpm/{tpm_vtpm_proxy.txt=>tpm_vtpm_proxy.rst} (53%)Documentation/index.rst +1
-0@@ -19,6 +19,7 @@ Contents: media/dvb-drivers/index media/v4l-drivers/index gpu/index + tpm/index Indices and tables ==================Documentation/tpm/index.rst new file +7
-0@@ -0,0 +1,7 @@ +===================================== +Trusted Platform Module documentation +===================================== + +.. toctree:: + + tpm_vtpm_proxyDocumentation/tpm/tpm_vtpm_proxy.rst renamed from Documentation/tpm/tpm_vtpm_proxy.txt +17
-38@@ -1,71 +1,50 @@ +============================================= Virtual TPM Proxy Driver for Linux Containers +============================================= -Authors: Stefan Berger (IBM) +| Authors: +| Stefan Berger <[email protected]> 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_devSignature · 1 line
2.9.3
PATCH 3/3 tpm: move documentation under Documentation/security
In reply to Jarkko SakkinenIn order too make Documentation root directory cleaner move the tpm directory under Documentation/security.
---
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%)Documentation/index.rst +1 -1
@@ -19,7 +19,7 @@ Contents: media/dvb-drivers/index media/v4l-drivers/index gpu/index - tpm/index + security/index Indices and tables ==================
Documentation/security/index.rst new file +7 -0
@@ -0,0 +1,7 @@ +====================== +Security documentation +====================== + +.. toctree:: + + tpm/index
Documentation/security/tpm/index.rst renamed from Documentation/tpm/index.rst +0 -0
Documentation/security/tpm/tpm_vtpm_proxy.rst renamed from Documentation/tpm/tpm_vtpm_proxy.rst +0 -0
Documentation/security/tpm/xen-tpmfront.txt renamed from Documentation/tpm/xen-tpmfront.txt +0 -0
Signature · 9 lines
2.9.3 ------------------------------------------------------------------------------ Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE. Training and support from Colfax. Order your platform today. http://sdm.link/xeonphi
Re: [PATCH 3/3] tpm: move documentation under Documentation/security
Quoted 2 lines · Jarkko Sakkinen
In order too make Documentation root directory cleaner move the tpm directory under
Documentation/security.
FWIW I like this.
BR,
Jani.
Quoted 52 lines
--- 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%)Documentation/index.rst +1
-1@@ -19,7 +19,7 @@ Contents: media/dvb-drivers/index media/v4l-drivers/index gpu/index - tpm/index + security/index Indices and tables ==================Documentation/security/index.rst new file +7
-0@@ -0,0 +1,7 @@ +====================== +Security documentation +====================== + +.. toctree:: + + tpm/indexDocumentation/security/tpm/index.rst renamed from Documentation/tpm/index.rst +0
-0Documentation/security/tpm/tpm_vtpm_proxy.rst renamed from Documentation/tpm/tpm_vtpm_proxy.rst +0
-0Documentation/security/tpm/xen-tpmfront.txt renamed from Documentation/tpm/xen-tpmfront.txt +0
-0
Signature · 8 lines
Jani Nikula, Intel Open Source Technology Center ------------------------------------------------------------------------------ Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE. Training and support from Colfax. Order your platform today. http://sdm.link/xeonphi
Re: [PATCH 3/3] tpm: move documentation under Documentation/security
Quoted 5 lines · Jani Nikula
Quoted 2 lines · Jarkko Sakkinen
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?
Quoted 2 lines
BR,
Jani.
/Jarkko
Quoted 57 lines
Quoted 54 lines
Signed-off-by Jarkko Sakkinen <[email protected]>--- 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%)Documentation/index.rst +1
-1@@ -19,7 +19,7 @@ Contents: media/dvb-drivers/index media/v4l-drivers/index gpu/index - tpm/index + security/index Indices and tables ==================Documentation/security/index.rst new file +7
-0@@ -0,0 +1,7 @@ +====================== +Security documentation +====================== + +.. toctree:: + + tpm/indexDocumentation/security/tpm/index.rst renamed from Documentation/tpm/index.rst +0
-0Documentation/security/tpm/tpm_vtpm_proxy.rst renamed from Documentation/tpm/tpm_vtpm_proxy.rst +0
-0Documentation/security/tpm/xen-tpmfront.txt renamed from Documentation/tpm/xen-tpmfront.txt +0
-0Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
Re: [PATCH 3/3] tpm: move documentation under Documentation/security
Quoted 11 lines · Jarkko Sakkinen
Quoted 5 lines · Jani Nikula
Quoted 2 lines · Jarkko Sakkinen
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.
Signature · 2 lines
James Morris <[email protected]>
Jonathan Corbet
maintainerRe: [PATCH 3/3] tpm: move documentation under Documentation/security
In reply to Jarkko SakkinenQuoted 2 lines · On Thu, 3 Nov 2016 17:57:52 -0600 Jarkko Sakkinen…
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
Re: [PATCH 3/3] tpm: move documentation under Documentation/security
Quoted 6 lines · Jonathan Corbet
Quoted 2 lines · On Thu, 3 Nov 2016 17:57:52 -0600 Jarkko Sakkinen…
In order too make Documentation root directory cleaner move the tpm directory under
Documentation/security.
Quoted 7 lines
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