Re: [Regression] Commit "tpm: Introduce function to poll for resultof self test" breaks suspend

From: Stefan Berger
Date: Mon Jan 16 2012 - 18:50:30 EST


On 01/16/2012 05:50 PM, Rafael J. Wysocki wrote:
On Monday, January 16, 2012, Stefan Berger wrote:
On 01/16/2012 05:05 PM, Rafael J. Wysocki wrote:
Yes, there are. Below is the result of grepping tpm in dmesg output (the
entire dmesg log from that box is attached).

[ 5.066807] tpm_tis 00:0a: 1.2 TPM (device-id 0xB, rev-id 16)
[ 7.167236] tpm_tis 00:0a: Adjusting TPM timeout parameters.
[ 7.893190] tpm_tis 00:0a: A TPM error (7) occurred attempting to read a pcr value
[ 7.897202] tpm_tis 00:0a: TPM self test failed
[ 7.907599] tpm_inf_pnp 00:0a: Found TPM with ID IFX0102
[ 7.909745] tpm_inf_pnp 00:0a: TPM found: config base 0x4e, data base 0x680, chip version 0x000b, vendor id 0x15d1 (Infineon), product id 0x000b (SLB 9635 TT 1.2)
[ 96.386200] tpm_inf_pnp 00:0a: saving TPM state
[ 96.407630] tpm_inf_pnp 00:0a: Timeout while clearing FIFO
[ 96.407634] tpm_inf_pnp 00:0a: error while saving TPM state

Thanks,
Rafael
If possible, I'd like the patch to stick a little longer. Can you try the following and tell me whether this solves the problem with the suspend/resume.

This patch handles the error codes reading of a PCR may cause when a TPM is disabled and/or deactivated. They would not be a reason for the tpm_do_selftest function to fail.

Signed-off-by: Stefan Berger <stefanb@xxxxxxxxxxxxxxxxxx>

---
drivers/char/tpm/tpm.c | 9 +++++++++
drivers/char/tpm/tpm.h | 3 +++
2 files changed, 12 insertions(+)

Index: linux-2.6/drivers/char/tpm/tpm.c
===================================================================
--- linux-2.6.orig/drivers/char/tpm/tpm.c
+++ linux-2.6/drivers/char/tpm/tpm.c
@@ -846,6 +846,15 @@ int tpm_do_selftest(struct tpm_chip *chi

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 during suspend/resume
+ */
+ rc = 0;
+ break;
+ }
if (rc != TPM_WARN_DOING_SELFTEST)
return rc;
msleep(delay_msec);
Index: linux-2.6/drivers/char/tpm/tpm.h
===================================================================
--- linux-2.6.orig/drivers/char/tpm/tpm.h
+++ linux-2.6/drivers/char/tpm/tpm.h
@@ -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 *);

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/