New issue
Advanced search Search tips

Issue 703722 link

Starred by 1 user

Issue metadata

Status: Started
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 2
Type: Bug



Sign in to add a comment

tpm2: driver should retry sending Shutdown(STATE) and block suspending if it fails

Project Member Reported by apronin@chromium.org, Mar 21 2017

Issue description

In tpm 2.0 case, sending Shutdown(STATE) from tpm_pm_suspend() during S0->S3 transition may fail. For example, due to a transient communication error on a bus. In this case, the state won't be saved and the restored on resume, and Startup(STATE) on S3->S0 would also fail.

As it is already done in tpm 1.2 case in tpm_pm_suspend(), the driver should retry sending Shutdown(STATE) several times, and return an error from tpm_pm_suspend() to allow blocking the OS suspend process.
 
Components: OS>Systems
Status: Started (was: Assigned)
1) Looks like the best place to retry sending a command is the vendor/chip-specific part in cr50_i2c, not the common tpm_pm_suspend(). At least, that's where it is done for Infineon chips - sending a command is retried up to 3 times in iic_tpm_write_generic() and iic_tpm_read(), in case there are i2c NAKs: https://github.com/torvalds/linux/blob/master/drivers/char/tpm/tpm_i2c_infineon.c#L33
2) Still, if sending a shutdown fails even after that, it may make sense to abort the suspend process. And that's done in tpm_pm_suspend().
Components: -OS>Systems OS>Kernel
Project Member

Comment 3 by bugdroid1@chromium.org, Mar 25 2017

Labels: merge-merged-chromeos-4.4
The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/e0472db680800ededc676660724be636cf413786

commit e0472db680800ededc676660724be636cf413786
Author: Andrey Pronin <apronin@chromium.org>
Date: Sat Mar 25 00:36:18 2017

CHROMIUM: tpm: cr50_i2c: retry in case of bus errors

Transient bus errors may lead to a failure to transmit a tpm
command or receive a response. Retry several times, if the i2c
bus driver returns an error for an operation.

BUG=chromium:703722
BUG=b:36462358
BUG=b:35648537
TEST=Build, deploy, go through S3 suspend-resumes.

Change-Id: If2cd3ba3fb9c6f7376f759ceb2cc10df6b316ed1
Signed-off-by: Andrey Pronin <apronin@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/457786
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Duncan Laurie <dlaurie@google.com>

[modify] https://crrev.com/e0472db680800ededc676660724be636cf413786/drivers/char/tpm/cr50_i2c.c

Project Member

Comment 4 by bugdroid1@chromium.org, Mar 28 2017

Labels: merge-merged-factory-reef-8811.B-chromeos-4.4
The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/d0e2f79d755a55befed1e744f93cfa70392c1025

commit d0e2f79d755a55befed1e744f93cfa70392c1025
Author: Andrey Pronin <apronin@chromium.org>
Date: Tue Mar 28 01:21:42 2017

CHROMIUM: tpm: cr50_i2c: retry in case of bus errors

Transient bus errors may lead to a failure to transmit a tpm
command or receive a response. Retry several times, if the i2c
bus driver returns an error for an operation.

BUG=chromium:703722
BUG=b:36462358
BUG=b:35648537
TEST=Build, deploy, go through S3 suspend-resumes.

Change-Id: If2cd3ba3fb9c6f7376f759ceb2cc10df6b316ed1
Signed-off-by: Andrey Pronin <apronin@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/457786
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Duncan Laurie <dlaurie@google.com>
(cherry picked from commit e0472db680800ededc676660724be636cf413786)
Reviewed-on: https://chromium-review.googlesource.com/459757
Reviewed-by: YH Lin <yueherngl@chromium.org>
Commit-Queue: Keith Tzeng <keith.tzeng@quantatw.com>
Tested-by: Keith Tzeng <keith.tzeng@quantatw.com>

[modify] https://crrev.com/d0e2f79d755a55befed1e744f93cfa70392c1025/drivers/char/tpm/cr50_i2c.c

Project Member

Comment 5 by bugdroid1@chromium.org, Mar 28 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/a2d102bb236dd09ef7f4919a0ca4a42da1ec4d4a

commit a2d102bb236dd09ef7f4919a0ca4a42da1ec4d4a
Author: Andrey Pronin <apronin@chromium.org>
Date: Tue Mar 28 07:10:56 2017

CHERRY-PICK: CHROMIUM: tpm: cr50_i2c: retry in case of bus errors

Transient bus errors may lead to a failure to transmit a tpm
command or receive a response. Retry several times, if the i2c
bus driver returns an error for an operation.

BUG=chromium:703722
BUG=b:36462358
BUG=b:35648537
TEST=Build, deploy, go through S3 suspend-resumes.

Change-Id: I2dd6e1f6c8999e263366908499203879b2348824
Reviewed-on: https://chromium-review.googlesource.com/461757
Reviewed-by: Ting Shen <phoenixshen@chromium.org>
Commit-Queue: Ting Shen <phoenixshen@chromium.org>
Tested-by: Ting Shen <phoenixshen@chromium.org>

[modify] https://crrev.com/a2d102bb236dd09ef7f4919a0ca4a42da1ec4d4a/drivers/char/tpm/cr50_i2c.c

Project Member

Comment 6 by bugdroid1@chromium.org, Mar 28 2017

Labels: merge-merged-release-R58-9334.B-chromeos-4.4
The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/d3ff5b0ccadb9209f367dd985b4e847348d62ff0

commit d3ff5b0ccadb9209f367dd985b4e847348d62ff0
Author: Andrey Pronin <apronin@chromium.org>
Date: Tue Mar 28 21:50:38 2017

CHROMIUM: tpm: cr50_i2c: retry in case of bus errors

Transient bus errors may lead to a failure to transmit a tpm
command or receive a response. Retry several times, if the i2c
bus driver returns an error for an operation.

BUG=chromium:703722
BUG=b:36462358
BUG=b:35648537
TEST=Build, deploy, go through S3 suspend-resumes.

Change-Id: If2cd3ba3fb9c6f7376f759ceb2cc10df6b316ed1
Signed-off-by: Andrey Pronin <apronin@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/457786
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Duncan Laurie <dlaurie@google.com>
(cherry picked from commit e0472db680800ededc676660724be636cf413786)
Reviewed-on: https://chromium-review.googlesource.com/462023

[modify] https://crrev.com/d3ff5b0ccadb9209f367dd985b4e847348d62ff0/drivers/char/tpm/cr50_i2c.c

Labels: -Pri-1 Pri-2
The retry part is fixed. The 'block suspending' part is not done, but it is never observed in practice, so reducing Pri.
Components: OS>Kernel>TPM

Sign in to add a comment