LKML Archive on
help / color / mirror / Atom feed
From: Jarkko Sakkinen <>
Cc: Chris Chiu <>, Daniel Drake <>,
	Jarkko Sakkinen <>,
	Peter Huewe <>,
	Marcel Selhorst <>,
	Jason Gunthorpe <>, (moderated list:TPM DEVICE
	DRIVER), (open list)
Subject: [PATCH 2/2] tpm: self test failure should not cause suspend to fail
Date: Thu,  3 May 2018 15:43:34 +0300	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

From: Chris Chiu <>

commit 0803d7befa15cab5717d667a97a66214d2a4c083 upstream

The Acer Acer Veriton X4110G has a TPM device detected as:
  tpm_tis 00:0b: 1.2 TPM (device-id 0xFE, rev-id 71)

After the first S3 suspend, the following error appears during resume:
  tpm tpm0: A TPM error(38) occurred continue selftest

Any following S3 suspend attempts will now fail with this error:
  tpm tpm0: Error (38) sending savestate before suspend
  PM: Device 00:0b failed to suspend: error 38

Error 38 is TPM_ERR_INVALID_POSTINIT which means the TPM is
not in the correct state. This indicates that the platform BIOS
is not sending the usual TPM_Startup command during S3 resume.
>From this point onwards, all TPM commands will fail.

The same issue was previously reported on Foxconn 6150BK8MC and
Sony Vaio TX3.

The platform behaviour seems broken here, but we should not break
suspend/resume because of this.

When the unexpected TPM state is encountered, set a flag to skip the
affected TPM_SaveState command on later suspends.

Signed-off-by: Chris Chiu <>
Signed-off-by: Daniel Drake <>
Reviewed-by: Jarkko Sakkinen <>
Signed-off-by: Jarkko Sakkinen <>
 drivers/char/tpm/tpm-interface.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c
index 247dd2b6504a..be0547115d34 100644
--- a/drivers/char/tpm/tpm-interface.c
+++ b/drivers/char/tpm/tpm-interface.c
@@ -787,6 +787,10 @@ int tpm_do_selftest(struct tpm_chip *chip)
 	loops = jiffies_to_msecs(duration) / delay_msec;
 	rc = tpm_continue_selftest(chip);
+		dev_info(&chip->dev, "TPM not ready (%d)\n", rc);
+	}
 	/* This may fail if there was no TPM driver during a suspend/resume
 	 * cycle; some may return 10 (BAD_ORDINAL), others 28 (FAILEDSELFTEST)

  parent reply	other threads:[~2018-05-03 12:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-03 12:43 [PATCH 0/2] fixes for v4.4 Jarkko Sakkinen
2018-05-03 12:43 ` [PATCH 1/2] tpm: do not suspend/resume if power stays on Jarkko Sakkinen
2018-05-03 12:43 ` Jarkko Sakkinen [this message]
2018-05-03 18:17 ` [PATCH 0/2] fixes for v4.4 Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2018-05-02 14:38 [PATCH 0/2] fixes for 4.9.96 Jarkko Sakkinen
2018-05-02 14:38 ` [PATCH 2/2] tpm: self test failure should not cause suspend to fail Jarkko Sakkinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \ \ \ \
    --subject='Re: [PATCH 2/2] tpm: self test failure should not cause suspend to fail' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).