diff mbox

[v2,1/2] Documentation: tpm: add the IBM Virtual TPM device tree binding documentation

Message ID 1475051441-23008-1-git-send-email-nayna@linux.vnet.ibm.com (mailing list archive)
State New, archived
Headers show

Commit Message

Nayna Sept. 28, 2016, 8:30 a.m. UTC
Virtual TPM, which is being used on IBM POWER7+ and POWER8 systems running
POWERVM, is currently supported by tpm device driver but lacks the
documentation. This patch adds the missing documentation for the existing
support.

Suggested-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Signed-off-by: Nayna Jain <nayna@linux.vnet.ibm.com>
---
Changelog v2:

- New Patch

 .../devicetree/bindings/security/tpm/ibmvtpm.txt   | 41 ++++++++++++++++++++++
 1 file changed, 41 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/security/tpm/ibmvtpm.txt

Comments

Jarkko Sakkinen Sept. 29, 2016, 11:04 a.m. UTC | #1
On Wed, Sep 28, 2016 at 04:30:40AM -0400, Nayna Jain wrote:
> Virtual TPM, which is being used on IBM POWER7+ and POWER8 systems running
> POWERVM, is currently supported by tpm device driver but lacks the
> documentation. This patch adds the missing documentation for the existing
> support.
> 
> Suggested-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
> Signed-off-by: Nayna Jain <nayna@linux.vnet.ibm.com>
> ---
> Changelog v2:
> 
> - New Patch
> 
>  .../devicetree/bindings/security/tpm/ibmvtpm.txt   | 41 ++++++++++++++++++++++
>  1 file changed, 41 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/security/tpm/ibmvtpm.txt
> 
> diff --git a/Documentation/devicetree/bindings/security/tpm/ibmvtpm.txt b/Documentation/devicetree/bindings/security/tpm/ibmvtpm.txt
> new file mode 100644
> index 0000000..d89f999
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/security/tpm/ibmvtpm.txt
> @@ -0,0 +1,41 @@
> +* Device Tree Bindings for IBM Virtual Trusted Platform Module(vtpm)
> +
> +Required properties:
> +
> +- compatible            : property name that conveys the platform architecture
> +                          identifiers, as 'IBM,vtpm'
> +- device_type           : specifies type of virtual device

A generic device tree question. What is the difference between
these fields? Why the I2C one does have 'device_type'?

/Jarkko

------------------------------------------------------------------------------
Nayna Oct. 5, 2016, 8:14 p.m. UTC | #2
On 09/29/2016 04:34 PM, Jarkko Sakkinen wrote:
> On Wed, Sep 28, 2016 at 04:30:40AM -0400, Nayna Jain wrote:
>> Virtual TPM, which is being used on IBM POWER7+ and POWER8 systems running
>> POWERVM, is currently supported by tpm device driver but lacks the
>> documentation. This patch adds the missing documentation for the existing
>> support.
>>
>> Suggested-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
>> Signed-off-by: Nayna Jain <nayna@linux.vnet.ibm.com>
>> ---
>> Changelog v2:
>>
>> - New Patch
>>
>>   .../devicetree/bindings/security/tpm/ibmvtpm.txt   | 41 ++++++++++++++++++++++
>>   1 file changed, 41 insertions(+)
>>   create mode 100644 Documentation/devicetree/bindings/security/tpm/ibmvtpm.txt
>>
>> diff --git a/Documentation/devicetree/bindings/security/tpm/ibmvtpm.txt b/Documentation/devicetree/bindings/security/tpm/ibmvtpm.txt
>> new file mode 100644
>> index 0000000..d89f999
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/security/tpm/ibmvtpm.txt
>> @@ -0,0 +1,41 @@
>> +* Device Tree Bindings for IBM Virtual Trusted Platform Module(vtpm)
>> +
>> +Required properties:
>> +
>> +- compatible            : property name that conveys the platform architecture
>> +                          identifiers, as 'IBM,vtpm'
>> +- device_type           : specifies type of virtual device
>
> A generic device tree question. What is the difference between
> these fields? Why the I2C one does have 'device_type'?

Please find the details as below:

compatible - Standard property name as per IEEE 1275, specifying the 
interface compatible with this device. This property is consumed by 
linux kernel for selection of device driver.

device_type - Standard property name as per IEEE 1275, specifying the 
device type. This property MAY be used by linux kernel for device driver 
selection. It is used in the case of IBM virtual TPM driver.

/**
  * vio_register_device_node: - Register a new vio device.
  * @of_node:    The OF node for this device.
  *
  * Creates and initializes a vio_dev structure from the data in
  * of_node and adds it to the list of virtual devices.
  * Returns a pointer to the created vio_dev or NULL if node has
  * NULL device_type or compatible fields.
  */
struct vio_dev *vio_register_device_node(struct device_node *of_node)

and vtpm device table being defined as below:

static struct vio_device_id tpm_ibmvtpm_device_table[] = {
         { "IBM,vtpm", "IBM,vtpm"}, 
-----------------------------------> type,compat
         { "", "" }
};

So, vio (virtual) devices uses both device_type and compatible property 
for device registration and driver selection.
In case of physical TPM, it is only compatible property being used for 
device driver selection

Also, please note that device_type property is now deprecated in latest 
Device Tree specs.

Thanks & Regards,
    - Nayna


>
> /Jarkko
>


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
Rob Herring (Arm) Oct. 8, 2016, 9:01 p.m. UTC | #3
On Thu, Oct 06, 2016 at 01:44:32AM +0530, Nayna wrote:
> 
> 
> On 09/29/2016 04:34 PM, Jarkko Sakkinen wrote:
> >On Wed, Sep 28, 2016 at 04:30:40AM -0400, Nayna Jain wrote:
> >>Virtual TPM, which is being used on IBM POWER7+ and POWER8 systems running
> >>POWERVM, is currently supported by tpm device driver but lacks the
> >>documentation. This patch adds the missing documentation for the existing
> >>support.
> >>
> >>Suggested-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
> >>Signed-off-by: Nayna Jain <nayna@linux.vnet.ibm.com>
> >>---
> >>Changelog v2:
> >>
> >>- New Patch
> >>
> >>  .../devicetree/bindings/security/tpm/ibmvtpm.txt   | 41 ++++++++++++++++++++++
> >>  1 file changed, 41 insertions(+)
> >>  create mode 100644 Documentation/devicetree/bindings/security/tpm/ibmvtpm.txt
> >>
> >>diff --git a/Documentation/devicetree/bindings/security/tpm/ibmvtpm.txt b/Documentation/devicetree/bindings/security/tpm/ibmvtpm.txt
> >>new file mode 100644
> >>index 0000000..d89f999
> >>--- /dev/null
> >>+++ b/Documentation/devicetree/bindings/security/tpm/ibmvtpm.txt
> >>@@ -0,0 +1,41 @@
> >>+* Device Tree Bindings for IBM Virtual Trusted Platform Module(vtpm)
> >>+
> >>+Required properties:
> >>+
> >>+- compatible            : property name that conveys the platform architecture
> >>+                          identifiers, as 'IBM,vtpm'
> >>+- device_type           : specifies type of virtual device
> >
> >A generic device tree question. What is the difference between
> >these fields? Why the I2C one does have 'device_type'?
> 
> Please find the details as below:
> 
> compatible - Standard property name as per IEEE 1275, specifying the
> interface compatible with this device. This property is consumed by linux
> kernel for selection of device driver.
> 
> device_type - Standard property name as per IEEE 1275, specifying the device
> type. This property MAY be used by linux kernel for device driver selection.
> It is used in the case of IBM virtual TPM driver.

AIUI, this should be a standard value such as serial, pci, etc. I don't 
think your use here is correct, but I could be wrong. I'm not certain 
what you do with devices that don't have a standard type.

> 
> /**
>  * vio_register_device_node: - Register a new vio device.
>  * @of_node:    The OF node for this device.
>  *
>  * Creates and initializes a vio_dev structure from the data in
>  * of_node and adds it to the list of virtual devices.
>  * Returns a pointer to the created vio_dev or NULL if node has
>  * NULL device_type or compatible fields.
>  */
> struct vio_dev *vio_register_device_node(struct device_node *of_node)
> 
> and vtpm device table being defined as below:
> 
> static struct vio_device_id tpm_ibmvtpm_device_table[] = {
>         { "IBM,vtpm", "IBM,vtpm"}, ----------------------------------->
> type,compat
>         { "", "" }
> };
> 
> So, vio (virtual) devices uses both device_type and compatible property for
> device registration and driver selection.
> In case of physical TPM, it is only compatible property being used for
> device driver selection
> 
> Also, please note that device_type property is now deprecated in latest
> Device Tree specs.

Deprecated for Flattened DT only. OpenFirmware implementations 
can/should still use this.

Rob

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
Rob Herring (Arm) Oct. 8, 2016, 9:11 p.m. UTC | #4
On Wed, Sep 28, 2016 at 04:30:40AM -0400, Nayna Jain wrote:
> Virtual TPM, which is being used on IBM POWER7+ and POWER8 systems running
> POWERVM, is currently supported by tpm device driver but lacks the
> documentation. This patch adds the missing documentation for the existing
> support.
> 
> Suggested-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
> Signed-off-by: Nayna Jain <nayna@linux.vnet.ibm.com>
> ---
> Changelog v2:
> 
> - New Patch
> 
>  .../devicetree/bindings/security/tpm/ibmvtpm.txt   | 41 ++++++++++++++++++++++
>  1 file changed, 41 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/security/tpm/ibmvtpm.txt
> 
> diff --git a/Documentation/devicetree/bindings/security/tpm/ibmvtpm.txt b/Documentation/devicetree/bindings/security/tpm/ibmvtpm.txt
> new file mode 100644
> index 0000000..d89f999
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/security/tpm/ibmvtpm.txt
> @@ -0,0 +1,41 @@
> +* Device Tree Bindings for IBM Virtual Trusted Platform Module(vtpm)
> +
> +Required properties:
> +
> +- compatible            : property name that conveys the platform architecture
> +                          identifiers, as 'IBM,vtpm'

You use IBM here, but...

> +- device_type           : specifies type of virtual device
> +- interrupts            : property specifying the interrupt source number and
> +                          sense code associated with this virtual I/O Adapters
> +- ibm,my-drc-index      : integer index for the connector between the device

use ibm here. These should be the same unless there's some history I'm 
not aware of.

> +                          and its parent - present only if Dynamic
> +                          Reconfiguration(DR) Connector is enabled
> +- ibm,#dma-address-cells: specifies the number of cells that are used to
> +                          encode the physical address field of dma-window
> +                          properties
> +- ibm,#dma-size-cells   : specifies the number of cells that are used to
> +                          encode the size field of dma-window properties
> +- ibm,my-dma-window     : specifies DMA window associated with this virtual
> +                          IOA

Are these "standard" IBM properties? Does dma-ranges not work for you?

> +- ibm,loc-code          : specifies the unique and persistent location code
> +                          associated with this virtual I/O Adapters
> +- linux,sml-base        : 64-bit base address of the reserved memory allocated
> +                          for the firmware event log
> +- linux,sml-size        : size of the memory allocated for the firmware event log
> +
> +Example (IBM Virtual Trusted Platform Module)
> +---------------------------------------------
> +
> +                vtpm@30000003 {
> +                        ibm,#dma-size-cells = <0x2>;
> +                        compatible = "IBM,vtpm";
> +                        device_type = "IBM,vtpm";
> +                        ibm,my-drc-index = <0x30000003>;
> +                        ibm,#dma-address-cells = <0x2>;
> +                        linux,sml-base = <0xc60e 0x0>;
> +                        interrupts = <0xa0003 0x0>;
> +                        ibm,my-dma-window = <0x10000003 0x0 0x0 0x0 0x10000000>;
> +                        ibm,loc-code = "U8286.41A.10082DV-V3-C3";
> +                        reg = <0x30000003>;
> +                        linux,sml-size = <0xbce10200>;
> +                };
> -- 
> 2.5.0
> 

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
Nayna Oct. 17, 2016, 2:08 a.m. UTC | #5
On 10/09/2016 02:31 AM, Rob Herring wrote:
> On Thu, Oct 06, 2016 at 01:44:32AM +0530, Nayna wrote:
>>
>>
>> On 09/29/2016 04:34 PM, Jarkko Sakkinen wrote:
>>> On Wed, Sep 28, 2016 at 04:30:40AM -0400, Nayna Jain wrote:
>>>> Virtual TPM, which is being used on IBM POWER7+ and POWER8 systems running
>>>> POWERVM, is currently supported by tpm device driver but lacks the
>>>> documentation. This patch adds the missing documentation for the existing
>>>> support.
>>>>
>>>> Suggested-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
>>>> Signed-off-by: Nayna Jain <nayna@linux.vnet.ibm.com>
>>>> ---
>>>> Changelog v2:
>>>>
>>>> - New Patch
>>>>
>>>>   .../devicetree/bindings/security/tpm/ibmvtpm.txt   | 41 ++++++++++++++++++++++
>>>>   1 file changed, 41 insertions(+)
>>>>   create mode 100644 Documentation/devicetree/bindings/security/tpm/ibmvtpm.txt
>>>>
>>>> diff --git a/Documentation/devicetree/bindings/security/tpm/ibmvtpm.txt b/Documentation/devicetree/bindings/security/tpm/ibmvtpm.txt
>>>> new file mode 100644
>>>> index 0000000..d89f999
>>>> --- /dev/null
>>>> +++ b/Documentation/devicetree/bindings/security/tpm/ibmvtpm.txt
>>>> @@ -0,0 +1,41 @@
>>>> +* Device Tree Bindings for IBM Virtual Trusted Platform Module(vtpm)
>>>> +
>>>> +Required properties:
>>>> +
>>>> +- compatible            : property name that conveys the platform architecture
>>>> +                          identifiers, as 'IBM,vtpm'
>>>> +- device_type           : specifies type of virtual device
>>>
>>> A generic device tree question. What is the difference between
>>> these fields? Why the I2C one does have 'device_type'?
>>
>> Please find the details as below:
>>
>> compatible - Standard property name as per IEEE 1275, specifying the
>> interface compatible with this device. This property is consumed by linux
>> kernel for selection of device driver.
>>
>> device_type - Standard property name as per IEEE 1275, specifying the device
>> type. This property MAY be used by linux kernel for device driver selection.
>> It is used in the case of IBM virtual TPM driver.
>
> AIUI, this should be a standard value such as serial, pci, etc. I don't
> think your use here is correct, but I could be wrong. I'm not certain
> what you do with devices that don't have a standard type.

Actually, the vtpm node is a unique device and did not have a standard 
type that could be used.  That is why the definition in the PAPR gave it 
the a new value.  The intention was to provide a reasonable type value. 
  The "IBM," portion of the property value is intended to identify it as 
a specific IBM implementation.

Thanks & Regards,
    - Nayna

>
>>
>> /**
>>   * vio_register_device_node: - Register a new vio device.
>>   * @of_node:    The OF node for this device.
>>   *
>>   * Creates and initializes a vio_dev structure from the data in
>>   * of_node and adds it to the list of virtual devices.
>>   * Returns a pointer to the created vio_dev or NULL if node has
>>   * NULL device_type or compatible fields.
>>   */
>> struct vio_dev *vio_register_device_node(struct device_node *of_node)
>>
>> and vtpm device table being defined as below:
>>
>> static struct vio_device_id tpm_ibmvtpm_device_table[] = {
>>          { "IBM,vtpm", "IBM,vtpm"}, ----------------------------------->
>> type,compat
>>          { "", "" }
>> };
>>
>> So, vio (virtual) devices uses both device_type and compatible property for
>> device registration and driver selection.
>> In case of physical TPM, it is only compatible property being used for
>> device driver selection
>>
>> Also, please note that device_type property is now deprecated in latest
>> Device Tree specs.
>
> Deprecated for Flattened DT only. OpenFirmware implementations
> can/should still use this.
>
> Rob
>


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
Nayna Oct. 17, 2016, 2:11 a.m. UTC | #6
On 10/09/2016 02:41 AM, Rob Herring wrote:
> On Wed, Sep 28, 2016 at 04:30:40AM -0400, Nayna Jain wrote:
>> Virtual TPM, which is being used on IBM POWER7+ and POWER8 systems running
>> POWERVM, is currently supported by tpm device driver but lacks the
>> documentation. This patch adds the missing documentation for the existing
>> support.
>>
>> Suggested-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
>> Signed-off-by: Nayna Jain <nayna@linux.vnet.ibm.com>
>> ---
>> Changelog v2:
>>
>> - New Patch
>>
>>   .../devicetree/bindings/security/tpm/ibmvtpm.txt   | 41 ++++++++++++++++++++++
>>   1 file changed, 41 insertions(+)
>>   create mode 100644 Documentation/devicetree/bindings/security/tpm/ibmvtpm.txt
>>
>> diff --git a/Documentation/devicetree/bindings/security/tpm/ibmvtpm.txt b/Documentation/devicetree/bindings/security/tpm/ibmvtpm.txt
>> new file mode 100644
>> index 0000000..d89f999
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/security/tpm/ibmvtpm.txt
>> @@ -0,0 +1,41 @@
>> +* Device Tree Bindings for IBM Virtual Trusted Platform Module(vtpm)
>> +
>> +Required properties:
>> +
>> +- compatible            : property name that conveys the platform architecture
>> +                          identifiers, as 'IBM,vtpm'
>
> You use IBM here, but...
>
>> +- device_type           : specifies type of virtual device
>> +- interrupts            : property specifying the interrupt source number and
>> +                          sense code associated with this virtual I/O Adapters
>> +- ibm,my-drc-index      : integer index for the connector between the device
>
> use ibm here. These should be the same unless there's some history I'm
> not aware of.

This is how the property was defined when the change was submitted to 
the PAPR. It was most likely an oversight that the IBM was not changed 
to ibm to be consistent with other property definitions.

>
>> +                          and its parent - present only if Dynamic
>> +                          Reconfiguration(DR) Connector is enabled
>> +- ibm,#dma-address-cells: specifies the number of cells that are used to
>> +                          encode the physical address field of dma-window
>> +                          properties
>> +- ibm,#dma-size-cells   : specifies the number of cells that are used to
>> +                          encode the size field of dma-window properties
>> +- ibm,my-dma-window     : specifies DMA window associated with this virtual
>> +                          IOA
>
> Are these "standard" IBM properties? Does dma-ranges not work for you?


Yes, these are the standard properties as defined in the PAPR.  Again 
the "ibm" prefix indicates that they are specific to IBM system 
implementation. They have been in existence for many years.


Thanks & Regards,
    - Nayna

>
>> +- ibm,loc-code          : specifies the unique and persistent location code
>> +                          associated with this virtual I/O Adapters
>> +- linux,sml-base        : 64-bit base address of the reserved memory allocated
>> +                          for the firmware event log
>> +- linux,sml-size        : size of the memory allocated for the firmware event log
>> +
>> +Example (IBM Virtual Trusted Platform Module)
>> +---------------------------------------------
>> +
>> +                vtpm@30000003 {
>> +                        ibm,#dma-size-cells = <0x2>;
>> +                        compatible = "IBM,vtpm";
>> +                        device_type = "IBM,vtpm";
>> +                        ibm,my-drc-index = <0x30000003>;
>> +                        ibm,#dma-address-cells = <0x2>;
>> +                        linux,sml-base = <0xc60e 0x0>;
>> +                        interrupts = <0xa0003 0x0>;
>> +                        ibm,my-dma-window = <0x10000003 0x0 0x0 0x0 0x10000000>;
>> +                        ibm,loc-code = "U8286.41A.10082DV-V3-C3";
>> +                        reg = <0x30000003>;
>> +                        linux,sml-size = <0xbce10200>;
>> +                };
>> --
>> 2.5.0
>>
>


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
diff mbox

Patch

diff --git a/Documentation/devicetree/bindings/security/tpm/ibmvtpm.txt b/Documentation/devicetree/bindings/security/tpm/ibmvtpm.txt
new file mode 100644
index 0000000..d89f999
--- /dev/null
+++ b/Documentation/devicetree/bindings/security/tpm/ibmvtpm.txt
@@ -0,0 +1,41 @@ 
+* Device Tree Bindings for IBM Virtual Trusted Platform Module(vtpm)
+
+Required properties:
+
+- compatible            : property name that conveys the platform architecture
+                          identifiers, as 'IBM,vtpm'
+- device_type           : specifies type of virtual device
+- interrupts            : property specifying the interrupt source number and
+                          sense code associated with this virtual I/O Adapters
+- ibm,my-drc-index      : integer index for the connector between the device
+                          and its parent - present only if Dynamic
+                          Reconfiguration(DR) Connector is enabled
+- ibm,#dma-address-cells: specifies the number of cells that are used to
+                          encode the physical address field of dma-window
+                          properties
+- ibm,#dma-size-cells   : specifies the number of cells that are used to
+                          encode the size field of dma-window properties
+- ibm,my-dma-window     : specifies DMA window associated with this virtual
+                          IOA
+- ibm,loc-code          : specifies the unique and persistent location code
+                          associated with this virtual I/O Adapters
+- linux,sml-base        : 64-bit base address of the reserved memory allocated
+                          for the firmware event log
+- linux,sml-size        : size of the memory allocated for the firmware event log
+
+Example (IBM Virtual Trusted Platform Module)
+---------------------------------------------
+
+                vtpm@30000003 {
+                        ibm,#dma-size-cells = <0x2>;
+                        compatible = "IBM,vtpm";
+                        device_type = "IBM,vtpm";
+                        ibm,my-drc-index = <0x30000003>;
+                        ibm,#dma-address-cells = <0x2>;
+                        linux,sml-base = <0xc60e 0x0>;
+                        interrupts = <0xa0003 0x0>;
+                        ibm,my-dma-window = <0x10000003 0x0 0x0 0x0 0x10000000>;
+                        ibm,loc-code = "U8286.41A.10082DV-V3-C3";
+                        reg = <0x30000003>;
+                        linux,sml-size = <0xbce10200>;
+                };