This patch fixes an (ACPI S3) suspend regression introduced in commit 68d6e6713fcb ("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.
Unified · Split
| @@ -846,6 +846,15 @@ int tpm_do_selftest(struct tpm_chip *chip) · 845 unmodified lines | |||
| 846 | 846 | ||
| 847 | do { | 847 | do { |
| 848 | rc = __tpm_pcr_read(chip, 0, digest); | 848 | rc = __tpm_pcr_read(chip, 0, digest); |
| 849 | if (rc == TPM_ERR_DISABLED || rc == TPM_ERR_DEACTIVATED) { | ||
| 850 | dev_info(chip->dev, | ||
| 851 | "TPM is disabled/deactivated (0x%X)\n", rc); | ||
| 852 | /* TPM is disabled and/or deactivated; driver can | ||
| 853 | * proceed and TPM does handle commands for | ||
| 854 | * suspend/resume correctly | ||
| 855 | */ | ||
| 856 | return 0; | ||
| 857 | } | ||
| 849 | if (rc != TPM_WARN_DOING_SELFTEST) | 858 | if (rc != TPM_WARN_DOING_SELFTEST) |
| 850 | return rc; | 859 | return rc; |
| 851 | msleep(delay_msec); | 860 | msleep(delay_msec); |
| @@ -39,6 +39,9 @@ enum tpm_addr { · 38 unmodified lines | |||
| 39 | }; | 39 | }; |
| 40 | 40 | ||
| 41 | #define TPM_WARN_DOING_SELFTEST 0x802 | 41 | #define TPM_WARN_DOING_SELFTEST 0x802 |
| 42 | #define TPM_ERR_DEACTIVATED 0x6 | ||
| 43 | #define TPM_ERR_DISABLED 0x7 | ||
| 44 | |||
| 42 | #define TPM_HEADER_SIZE 10 | 45 | #define TPM_HEADER_SIZE 10 |
| 43 | extern ssize_t tpm_show_pubek(struct device *, struct device_attribute *attr, | 46 | extern ssize_t tpm_show_pubek(struct device *, struct device_attribute *attr, |
| 44 | char *); | 47 | char *); |