From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756090Ab2AQWKn (ORCPT ); Tue, 17 Jan 2012 17:10:43 -0500 Received: from ogre.sisk.pl ([217.79.144.158]:38782 "EHLO ogre.sisk.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755234Ab2AQWKm (ORCPT ); Tue, 17 Jan 2012 17:10:42 -0500 From: "Rafael J. Wysocki" To: Stefan Berger Subject: Re: [Regression] Commit "tpm: Introduce function to poll for result of self test" breaks suspend Date: Tue, 17 Jan 2012 23:13:55 +0100 User-Agent: KMail/1.13.6 (Linux/3.2.0+; KDE/4.6.0; x86_64; ; ) Cc: LKML , Linux PM list , Linus Torvalds , Rajiv Andrade References: <201201160022.07176.rjw@sisk.pl> <201201162350.02165.rjw@sisk.pl> <4F14B7AC.9090708@linux.vnet.ibm.com> In-Reply-To: <4F14B7AC.9090708@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201201172313.55950.rjw@sisk.pl> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tuesday, January 17, 2012, Stefan Berger wrote: > 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. Yes, the patch below helps. Thanks, Rafael > 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 > > --- > 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 *);