tpmdd-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
From: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
To: Ed Swierk <eswierk@skyportsystems.com>
Cc: tpmdd-devel@lists.sourceforge.net,
	linux-security-module@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [tpmdd-devel] [PATCH v3 1/4] tpm_tis: Improve reporting of IO errors
Date: Tue, 7 Jun 2016 16:56:38 +0300	[thread overview]
Message-ID: <20160607135638.GE3855@intel.com> (raw)
In-Reply-To: <1465270649-22498-2-git-send-email-eswierk@skyportsystems.com>

On Mon, Jun 06, 2016 at 08:37:26PM -0700, Ed Swierk wrote:
> Mysterious TPM behavior can be difficult to track down through all the
> layers of software. Add error messages for conditions that should
> never happen. Also include the manufacturer ID along with other chip
> data printed during init.
> 
> Signed-off-by: Ed Swierk <eswierk@skyportsystems.com>

Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>

PS. Please include at minimum also linux-kernel@vger.kernel.org and
linux-security-module@vger.kernel.org for these patches. Thanks.

> ---
>  drivers/char/tpm/tpm_tis.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
> index 65f7eec..088fa86 100644
> --- a/drivers/char/tpm/tpm_tis.c
> +++ b/drivers/char/tpm/tpm_tis.c
> @@ -299,6 +299,8 @@ static int tpm_tis_recv(struct tpm_chip *chip, u8 *buf, size_t count)
>  
>  	expected = be32_to_cpu(*(__be32 *) (buf + 2));
>  	if (expected > count) {
> +		dev_err(chip->pdev, "Response too long (wanted %zd, got %d)\n",
> +			count, expected);
>  		size = -EIO;
>  		goto out;
>  	}
> @@ -366,6 +368,8 @@ static int tpm_tis_send_data(struct tpm_chip *chip, u8 *buf, size_t len)
>  				  &chip->vendor.int_queue, false);
>  		status = tpm_tis_status(chip);
>  		if (!itpm && (status & TPM_STS_DATA_EXPECT) == 0) {
> +			dev_err(chip->pdev, "Chip not accepting %zd bytes\n",
> +				len - count);
>  			rc = -EIO;
>  			goto out_err;
>  		}
> @@ -378,6 +382,7 @@ static int tpm_tis_send_data(struct tpm_chip *chip, u8 *buf, size_t len)
>  			  &chip->vendor.int_queue, false);
>  	status = tpm_tis_status(chip);
>  	if ((status & TPM_STS_DATA_EXPECT) != 0) {
> +		dev_err(chip->pdev, "Chip not accepting last byte\n");
>  		rc = -EIO;
>  		goto out_err;
>  	}
> @@ -689,8 +694,9 @@ static int tpm_tis_init(struct device *dev, struct tpm_info *tpm_info,
>  	vendor = ioread32(chip->vendor.iobase + TPM_DID_VID(0));
>  	chip->vendor.manufacturer_id = vendor;
>  
> -	dev_info(dev, "%s TPM (device-id 0x%X, rev-id %d)\n",
> +	dev_info(dev, "%s TPM (manufacturer-id 0x%X, device-id 0x%X, rev-id %d)\n",
>  		 (chip->flags & TPM_CHIP_FLAG_TPM2) ? "2.0" : "1.2",
> +		 chip->vendor.manufacturer_id,
>  		 vendor >> 16, ioread8(chip->vendor.iobase + TPM_RID(0)));
>  
>  	if (!itpm) {
> -- 
> 1.9.1

/Jarko

  reply	other threads:[~2016-06-07 13:56 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-07  3:37 [PATCH v3 0/4] tpm: Command duration logging and chip-specific override Ed Swierk
     [not found] ` <1465270649-22498-1-git-send-email-eswierk-FilZDy9cOaHkQYj/0HfcvtBPR1lH4CV8@public.gmane.org>
2016-06-07  3:37   ` [PATCH v3 1/4] tpm_tis: Improve reporting of IO errors Ed Swierk
2016-06-07 13:56     ` Jarkko Sakkinen [this message]
2016-06-07  3:37   ` [PATCH v3 2/4] tpm: Add optional logging of TPM command durations Ed Swierk
2016-06-07 14:01     ` [tpmdd-devel] " Jarkko Sakkinen
2016-06-07  3:37   ` [PATCH v3 3/4] tpm: Allow TPM chip drivers to override reported " Ed Swierk
     [not found]     ` <1465270649-22498-4-git-send-email-eswierk-FilZDy9cOaHkQYj/0HfcvtBPR1lH4CV8@public.gmane.org>
2016-06-07 14:15       ` Jarkko Sakkinen
     [not found]         ` <20160607141526.GG3855-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-06-07 14:25           ` Ed Swierk
     [not found]             ` <CAO_EM_k5pqxqZ2fFzDBhPK_WoZ_nj3qE18EKROUKvp3KxnK__Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-06-07 17:32               ` Jason Gunthorpe
     [not found]                 ` <20160607173235.GA4486-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-06-10  8:25                   ` Jarkko Sakkinen
2016-06-07  3:37   ` [PATCH v3 4/4] tpm_tis: Increase ST19NP18 TPM command duration to avoid chip lockup Ed Swierk

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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=20160607135638.GE3855@intel.com \
    --to=jarkko.sakkinen@linux.intel.com \
    --cc=eswierk@skyportsystems.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=tpmdd-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).