Skip to content

Commit

Permalink
tpm: fix (ACPI S3) suspend regression
Browse files Browse the repository at this point in the history
This patch fixes an (ACPI S3) suspend regression introduced in commit
68d6e67 ("tpm: Introduce function to poll for result of self test")
and occurring with an Infineon TPM and tpm_tis and tpm_infineon drivers
active.

The suspend problem occurred if the TPM was disabled and/or deactivated
and therefore the TPM_PCRRead checking the result of the (asynchronous)
self test returned an error code which then caused the tpm_tis driver to
become inactive and this then seemed to have negatively influenced the
suspend support by the tpm_infineon driver...  Besides that the tpm_tis
drive may stay active even if the TPM is disabled and/or deactivated.

Signed-off-by: Stefan Berger <[email protected]>
Tested-by: Rafael J. Wysocki <[email protected]>
Acked-by: Rajiv Andrade <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
stefanberger authored and torvalds committed Jan 18, 2012
1 parent 93c3d65 commit be40541
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions drivers/char/tpm/tpm.c
Original file line number Diff line number Diff line change
Expand Up @@ -846,6 +846,15 @@ int tpm_do_selftest(struct tpm_chip *chip)

do {
rc = __tpm_pcr_read(chip, 0, digest);
if (rc == TPM_ERR_DISABLED || rc == TPM_ERR_DEACTIVATED) {
dev_info(chip->dev,
"TPM is disabled/deactivated (0x%X)\n", rc);
/* TPM is disabled and/or deactivated; driver can
* proceed and TPM does handle commands for
* suspend/resume correctly
*/
return 0;
}
if (rc != TPM_WARN_DOING_SELFTEST)
return rc;
msleep(delay_msec);
Expand Down
3 changes: 3 additions & 0 deletions drivers/char/tpm/tpm.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ enum tpm_addr {
};

#define TPM_WARN_DOING_SELFTEST 0x802
#define TPM_ERR_DEACTIVATED 0x6
#define TPM_ERR_DISABLED 0x7

#define TPM_HEADER_SIZE 10
extern ssize_t tpm_show_pubek(struct device *, struct device_attribute *attr,
char *);
Expand Down

0 comments on commit be40541

Please sign in to comment.