<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/drivers/char/tpm, branch v3.9.7</title>
<subtitle>Linux kernel for Apalis and Colibri modules</subtitle>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/'/>
<entry>
<title>TPM: Retry SaveState command in suspend path</title>
<updated>2013-05-08T03:33:09+00:00</updated>
<author>
<name>Duncan Laurie</name>
<email>dlaurie@chromium.org</email>
</author>
<published>2013-03-17T21:56:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=9bcb757351e7e4d448a53cf939ff362a83c09433'/>
<id>9bcb757351e7e4d448a53cf939ff362a83c09433</id>
<content type='text'>
commit 32d33b29ba077d6b45de35f2181e0a7411b162f4 upstream.

If the TPM has already been sent a SaveState command before the driver
is loaded it may have problems sending that same command again later.

This issue is seen with the Chromebook Pixel due to a firmware bug in
the legacy mode boot path which is sending the SaveState command
before booting the kernel.  More information is available at
http://crbug.com/203524

This change introduces a retry of the SaveState command in the suspend
path in order to work around this issue.  A future firmware update
should fix this but this is also a trivial workaround in the driver
that has no effect on systems that do not show this problem.

When this does happen the TPM responds with a non-fatal TPM_RETRY code
that is defined in the specification:

  The TPM is too busy to respond to the command immediately, but the
  command could be resubmitted at a later time.  The TPM MAY return
  TPM_RETRY for any command at any time.

It can take several seconds before the TPM will respond again.  I
measured a typical time between 3 and 4 seconds and the timeout is set
at a safe 5 seconds.

It is also possible to reproduce this with commands via /dev/tpm0.
The bug linked above has a python script attached which can be used to
test for this problem.  I tested a variety of TPMs from Infineon,
Nuvoton, Atmel, and STMicro but was only able to reproduce this with
LPC and I2C TPMs from Infineon.

The TPM specification only loosely defines this behavior:

  TPM Main Level 2 Part 3 v1.2 r116, section 3.3. TPM_SaveState:
  The TPM MAY declare all preserved values invalid in response to any
  command other than TPM_Init.

  TCG PC Client BIOS Spec 1.21 section 8.3.1.
  After issuing a TPM_SaveState command, the OS SHOULD NOT issue TPM
  commands before transitioning to S3 without issuing another
  TPM_SaveState command.

  TCG PC Client TIS 1.21, section 4. Power Management:
  The TPM_SaveState command allows a Static OS to indicate to the TPM
  that the platform may enter a low power state where the TPM will be
  required to enter into the D3 power state.  The use of the term "may"
  is significant in that there is no requirement for the platform to
  actually enter the low power state after sending the TPM_SaveState
  command.  The software may, in fact, send subsequent commands after
  sending the TPM_SaveState command.

Change-Id: I52b41e826412688e5b6c8ddd3bb16409939704e9
Signed-off-by: Duncan Laurie &lt;dlaurie@chromium.org&gt;
Signed-off-by: Kent Yoder &lt;key@linux.vnet.ibm.com&gt;
Cc: Dirk Hohndel &lt;dirk@hohndel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 32d33b29ba077d6b45de35f2181e0a7411b162f4 upstream.

If the TPM has already been sent a SaveState command before the driver
is loaded it may have problems sending that same command again later.

This issue is seen with the Chromebook Pixel due to a firmware bug in
the legacy mode boot path which is sending the SaveState command
before booting the kernel.  More information is available at
http://crbug.com/203524

This change introduces a retry of the SaveState command in the suspend
path in order to work around this issue.  A future firmware update
should fix this but this is also a trivial workaround in the driver
that has no effect on systems that do not show this problem.

When this does happen the TPM responds with a non-fatal TPM_RETRY code
that is defined in the specification:

  The TPM is too busy to respond to the command immediately, but the
  command could be resubmitted at a later time.  The TPM MAY return
  TPM_RETRY for any command at any time.

It can take several seconds before the TPM will respond again.  I
measured a typical time between 3 and 4 seconds and the timeout is set
at a safe 5 seconds.

It is also possible to reproduce this with commands via /dev/tpm0.
The bug linked above has a python script attached which can be used to
test for this problem.  I tested a variety of TPMs from Infineon,
Nuvoton, Atmel, and STMicro but was only able to reproduce this with
LPC and I2C TPMs from Infineon.

The TPM specification only loosely defines this behavior:

  TPM Main Level 2 Part 3 v1.2 r116, section 3.3. TPM_SaveState:
  The TPM MAY declare all preserved values invalid in response to any
  command other than TPM_Init.

  TCG PC Client BIOS Spec 1.21 section 8.3.1.
  After issuing a TPM_SaveState command, the OS SHOULD NOT issue TPM
  commands before transitioning to S3 without issuing another
  TPM_SaveState command.

  TCG PC Client TIS 1.21, section 4. Power Management:
  The TPM_SaveState command allows a Static OS to indicate to the TPM
  that the platform may enter a low power state where the TPM will be
  required to enter into the D3 power state.  The use of the term "may"
  is significant in that there is no requirement for the platform to
  actually enter the low power state after sending the TPM_SaveState
  command.  The software may, in fact, send subsequent commands after
  sending the TPM_SaveState command.

Change-Id: I52b41e826412688e5b6c8ddd3bb16409939704e9
Signed-off-by: Duncan Laurie &lt;dlaurie@chromium.org&gt;
Signed-off-by: Kent Yoder &lt;key@linux.vnet.ibm.com&gt;
Cc: Dirk Hohndel &lt;dirk@hohndel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>tpm/ibmvtpm: build only when IBM pseries is configured</title>
<updated>2013-02-14T15:36:50+00:00</updated>
<author>
<name>Kent Yoder</name>
<email>key@linux.vnet.ibm.com</email>
</author>
<published>2013-02-11T19:36:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=5b2660326039a32b28766cb4c1a8b1bdcfadc375'/>
<id>5b2660326039a32b28766cb4c1a8b1bdcfadc375</id>
<content type='text'>
Signed-off-by: Kent Yoder &lt;key@linux.vnet.ibm.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Kent Yoder &lt;key@linux.vnet.ibm.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>tpm_tis: check pnp_acpi_device return code</title>
<updated>2013-02-05T15:38:26+00:00</updated>
<author>
<name>Kent Yoder</name>
<email>key@linux.vnet.ibm.com</email>
</author>
<published>2013-01-31T15:39:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=6e38bfaad6c83bdd07eb659f9bfd50f8d71a5a46'/>
<id>6e38bfaad6c83bdd07eb659f9bfd50f8d71a5a46</id>
<content type='text'>
Reported-by: Peter Hüwe &lt;peterhuewe@gmx.de&gt;
Reviewed-by: Peter Huewe &lt;peterhuewe@gmx.de&gt;
Signed-off-by: Kent Yoder &lt;key@linux.vnet.ibm.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Reported-by: Peter Hüwe &lt;peterhuewe@gmx.de&gt;
Reviewed-by: Peter Huewe &lt;peterhuewe@gmx.de&gt;
Signed-off-by: Kent Yoder &lt;key@linux.vnet.ibm.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>char/tpm/tpm_i2c_stm_st33: drop temporary variable for return value</title>
<updated>2013-02-05T15:38:26+00:00</updated>
<author>
<name>Peter Huewe</name>
<email>peterhuewe@gmx.de</email>
</author>
<published>2013-01-29T21:02:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=7333549bf4f345d338825dcd5b85400600e4cae7'/>
<id>7333549bf4f345d338825dcd5b85400600e4cae7</id>
<content type='text'>
We don't need a temporary variable just to store the return value which
gets return in the next statement.

Signed-off-by: Peter Huewe &lt;peterhuewe@gmx.de&gt;
Signed-off-by: Kent Yoder &lt;key@linux.vnet.ibm.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We don't need a temporary variable just to store the return value which
gets return in the next statement.

Signed-off-by: Peter Huewe &lt;peterhuewe@gmx.de&gt;
Signed-off-by: Kent Yoder &lt;key@linux.vnet.ibm.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>char/tpm/tpm_i2c_stm_st33: remove dead assignment in tpm_st33_i2c_probe</title>
<updated>2013-02-05T15:38:25+00:00</updated>
<author>
<name>Peter Huewe</name>
<email>peterhuewe@gmx.de</email>
</author>
<published>2013-01-29T21:02:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=07d721688b8464662393f3b3136defbbad52be75'/>
<id>07d721688b8464662393f3b3136defbbad52be75</id>
<content type='text'>
Err is never read before it is assigned again -&gt; remove the dead
assigment.
Found with clang static analyzer

Signed-off-by: Peter Huewe &lt;peterhuewe@gmx.de&gt;
Signed-off-by: Kent Yoder &lt;key@linux.vnet.ibm.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Err is never read before it is assigned again -&gt; remove the dead
assigment.
Found with clang static analyzer

Signed-off-by: Peter Huewe &lt;peterhuewe@gmx.de&gt;
Signed-off-by: Kent Yoder &lt;key@linux.vnet.ibm.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>char/tpm/tpm_i2c_stm_st33: Remove __devexit attribute</title>
<updated>2013-02-05T15:38:25+00:00</updated>
<author>
<name>Peter Huewe</name>
<email>peterhuewe@gmx.de</email>
</author>
<published>2013-01-29T21:02:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=e02983cffc5e65069edee9892672e0aef9d9e2cd'/>
<id>e02983cffc5e65069edee9892672e0aef9d9e2cd</id>
<content type='text'>
With the HOTPLUG changes 3.8 this attribute is going away.

Signed-off-by: Peter Huewe &lt;peterhuewe@gmx.de&gt;
Signed-off-by: Kent Yoder &lt;key@linux.vnet.ibm.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
With the HOTPLUG changes 3.8 this attribute is going away.

Signed-off-by: Peter Huewe &lt;peterhuewe@gmx.de&gt;
Signed-off-by: Kent Yoder &lt;key@linux.vnet.ibm.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>char/tpm/tpm_i2c_stm_st33: Don't use memcpy for one byte assignment</title>
<updated>2013-02-05T15:38:25+00:00</updated>
<author>
<name>Peter Huewe</name>
<email>peterhuewe@gmx.de</email>
</author>
<published>2013-01-29T21:01:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=64298919ad034aa07a6ec85b82e5c8861e364ae5'/>
<id>64298919ad034aa07a6ec85b82e5c8861e364ae5</id>
<content type='text'>
We don't need to call memcpy for one byte, but assign it directly.
And to make the offset clearer we use the array syntax on the subsequent
call to memset to make the relationship clearer.

Signed-off-by: Peter Huewe &lt;peterhuewe@gmx.de&gt;
Signed-off-by: Kent Yoder &lt;key@linux.vnet.ibm.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We don't need to call memcpy for one byte, but assign it directly.
And to make the offset clearer we use the array syntax on the subsequent
call to memset to make the relationship clearer.

Signed-off-by: Peter Huewe &lt;peterhuewe@gmx.de&gt;
Signed-off-by: Kent Yoder &lt;key@linux.vnet.ibm.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>tpm_i2c_stm_st33: removed unused variables/code</title>
<updated>2013-02-05T15:38:25+00:00</updated>
<author>
<name>Kent Yoder</name>
<email>key@linux.vnet.ibm.com</email>
</author>
<published>2013-01-29T15:43:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=d479042c82941772cb1c003b46707d55185a49f6'/>
<id>d479042c82941772cb1c003b46707d55185a49f6</id>
<content type='text'>
Reported-by: Peter Hüwe &lt;PeterHuewe@gmx.de&gt;
Signed-off-by: Peter Hüwe &lt;PeterHuewe@gmx.de&gt;
Signed-off-by: Kent Yoder &lt;key@linux.vnet.ibm.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Reported-by: Peter Hüwe &lt;PeterHuewe@gmx.de&gt;
Signed-off-by: Peter Hüwe &lt;PeterHuewe@gmx.de&gt;
Signed-off-by: Kent Yoder &lt;key@linux.vnet.ibm.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>TPM: Wait for TPM_ACCESS tpmRegValidSts to go high at startup</title>
<updated>2013-02-05T15:38:25+00:00</updated>
<author>
<name>Jason Gunthorpe</name>
<email>jgunthorpe@obsidianresearch.com</email>
</author>
<published>2012-12-06T22:44:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=7240b98320a28f1d41b9361dc1cc8244dfda0272'/>
<id>7240b98320a28f1d41b9361dc1cc8244dfda0272</id>
<content type='text'>
The TIS specification (pg 47) says the valid bit must be set, but
the TPM will not set it until it has completed its internal startup.

The driver checks that the valid bit is set during request_locality,
but it issues a TPM_ACCESS_REQUEST_USE without validating the
valid bit is set.

Some TPMs will ignore the TPM_ACCESS_REQUEST_USE, until valid is
set which causes the request_locality to timeout, which breaks the
driver attach.

Wait one timeout unit for valid to assert. If valid does not assert
then assume -ENODEV.

Seen on embedded with a:
1.2 TPM (device-id 0x3204, rev-id 64)

Signed-off-by: Jason Gunthorpe &lt;jgunthorpe@obsidianresearch.com&gt;
Signed-off-by: Kent Yoder &lt;key@linux.vnet.ibm.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The TIS specification (pg 47) says the valid bit must be set, but
the TPM will not set it until it has completed its internal startup.

The driver checks that the valid bit is set during request_locality,
but it issues a TPM_ACCESS_REQUEST_USE without validating the
valid bit is set.

Some TPMs will ignore the TPM_ACCESS_REQUEST_USE, until valid is
set which causes the request_locality to timeout, which breaks the
driver attach.

Wait one timeout unit for valid to assert. If valid does not assert
then assume -ENODEV.

Seen on embedded with a:
1.2 TPM (device-id 0x3204, rev-id 64)

Signed-off-by: Jason Gunthorpe &lt;jgunthorpe@obsidianresearch.com&gt;
Signed-off-by: Kent Yoder &lt;key@linux.vnet.ibm.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>tpm: Fix cancellation of TPM commands (interrupt mode)</title>
<updated>2013-02-05T15:38:24+00:00</updated>
<author>
<name>Stefan Berger</name>
<email>stefanb@linux.vnet.ibm.com</email>
</author>
<published>2013-01-22T19:57:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=78f09cc248731716633c0ef219613e762a9c4f2e'/>
<id>78f09cc248731716633c0ef219613e762a9c4f2e</id>
<content type='text'>
Support cancellation of TPM commands when driver is used in interrupt
mode.

Signed-off-by: Stefan Berger &lt;stefanb@linux.vnet.ibm.com&gt;
Signed-off-by: Kent Yoder &lt;key@linux.vnet.ibm.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Support cancellation of TPM commands when driver is used in interrupt
mode.

Signed-off-by: Stefan Berger &lt;stefanb@linux.vnet.ibm.com&gt;
Signed-off-by: Kent Yoder &lt;key@linux.vnet.ibm.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
