Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1442617

[PATCH v9 1/5] tpm_tis: Improve reporting of IO errors

From Ed Swierk <eswierk@skyportsystems.com>
Newsgroups linux.kernel
Subject [PATCH v9 1/5] tpm_tis: Improve reporting of IO errors
Date 2016-07-13 18:30 +0200
Message-ID <rUvcR-5vg-13@gated-at.bofh.it> (permalink)
References <rMEZI-54t-5@gated-at.bofh.it> <rUvcR-5vg-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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>
---
 drivers/char/tpm/tpm_tis_core.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
index 8110b52..e62fdeb 100644
--- a/drivers/char/tpm/tpm_tis_core.c
+++ b/drivers/char/tpm/tpm_tis_core.c
@@ -217,6 +217,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->dev, "Response too long (wanted %zd, got %d)\n",
+			count, expected);
 		size = -EIO;
 		goto out;
 	}
@@ -283,6 +285,8 @@ static int tpm_tis_send_data(struct tpm_chip *chip, u8 *buf, size_t len)
 				  &priv->int_queue, false);
 		status = tpm_tis_status(chip);
 		if (!itpm && (status & TPM_STS_DATA_EXPECT) == 0) {
+			dev_err(&chip->dev, "Chip not accepting %zd bytes\n",
+				len - count);
 			rc = -EIO;
 			goto out_err;
 		}
@@ -297,6 +301,7 @@ static int tpm_tis_send_data(struct tpm_chip *chip, u8 *buf, size_t len)
 			  &priv->int_queue, false);
 	status = tpm_tis_status(chip);
 	if (!itpm && (status & TPM_STS_DATA_EXPECT) != 0) {
+		dev_err(&chip->dev, "Chip not accepting last byte\n");
 		rc = -EIO;
 		goto out_err;
 	}
@@ -707,8 +712,9 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
 	if (rc < 0)
 		goto out_err;
 
-	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",
+		 priv->manufacturer_id,
 		 vendor >> 16, rid);
 
 	if (!(priv->flags & TPM_TIS_ITPM_POSSIBLE)) {
-- 
1.9.1

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v9 0/5] tpm: Command duration logging and chip-specific override Ed Swierk <eswierk@skyportsystems.com> - 2016-07-13 18:30 +0200
  [PATCH v9 3/5] tpm: Clean up reading of timeout and duration capabilities Ed Swierk <eswierk@skyportsystems.com> - 2016-07-13 18:30 +0200
    Re: [PATCH v9 3/5] tpm: Clean up reading of timeout and duration  capabilities Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-07-18 20:20 +0200
    Re: [PATCH v9 3/5] tpm: Clean up reading of timeout and duration  capabilities Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-07-18 20:30 +0200
      Re: [PATCH v9 3/5] tpm: Clean up reading of timeout and duration  capabilities Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-07-18 20:30 +0200
  [PATCH v9 1/5] tpm_tis: Improve reporting of IO errors Ed Swierk <eswierk@skyportsystems.com> - 2016-07-13 18:30 +0200
  [PATCH v9 2/5] tpm: Add optional logging of TPM command durations Ed Swierk <eswierk@skyportsystems.com> - 2016-07-13 18:30 +0200
  [PATCH v9 4/5] tpm: Allow TPM chip drivers to override reported command durations Ed Swierk <eswierk@skyportsystems.com> - 2016-07-13 18:30 +0200
    Re: [PATCH v9 4/5] tpm: Allow TPM chip drivers to override reported  command durations kbuild test robot <lkp@intel.com> - 2016-07-13 19:10 +0200
    Re: [PATCH v9 4/5] tpm: Allow TPM chip drivers to override reported  command durations Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-07-18 20:50 +0200
  Re: [PATCH v9 0/5] tpm: Command duration logging and chip-specific override Ed Swierk <eswierk@skyportsystems.com> - 2016-07-13 18:50 +0200
    Re: [PATCH v9 0/5] tpm: Command duration logging and chip-specific  override Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2016-07-13 19:40 +0200
      Re: [PATCH v9 0/5] tpm: Command duration logging and chip-specific override Ed Swierk <eswierk@skyportsystems.com> - 2016-07-13 22:10 +0200
        Re: [PATCH v9 0/5] tpm: Command duration logging and chip-specific  override Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2016-07-13 23:00 +0200
        Re: [PATCH v9 0/5] tpm: Command duration logging and chip-specific override ebiederm@xmission.com (Eric W. Biederman) - 2016-07-13 23:20 +0200
  Re: [PATCH v9 0/5] tpm: Command duration logging and chip-specific  override Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-07-18 20:10 +0200

csiph-web