All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Steffen <Alexander.Steffen@infineon.com>
To: <pmenzel@molgen.mpg.de>, <jgg@ziepe.ca>,
	<jarkko.sakkinen@linux.intel.com>,
	<linux-integrity@vger.kernel.org>
Cc: Alexander Steffen <Alexander.Steffen@infineon.com>
Subject: [PATCH] tpm2-cmd: try full selftest once if continue selftest failed
Date: Fri, 22 Dec 2017 14:56:10 +0100	[thread overview]
Message-ID: <20171222135610.7056-1-Alexander.Steffen@infineon.com> (raw)

If the usual approach of triggering only the missing selftests failed, give
the TPM another chance by requesting all selftests once.

With the current implementation, this will only help for TPMs that then
choose to run the selftests synchronously and return the selftest result.
There is no retry loop that again polls a TPM returning TPM_RC_TESTING in
this case.

Signed-off-by: Alexander Steffen <Alexander.Steffen@infineon.com>
---
Patch depends on https://patchwork.kernel.org/patch/10105483/

 drivers/char/tpm/tpm2-cmd.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/char/tpm/tpm2-cmd.c b/drivers/char/tpm/tpm2-cmd.c
index c17e753..b5c34d8 100644
--- a/drivers/char/tpm/tpm2-cmd.c
+++ b/drivers/char/tpm/tpm2-cmd.c
@@ -871,6 +871,14 @@ static int tpm2_do_selftest(struct tpm_chip *chip)
 		tpm_msleep(delay_msec);
 	}
 
+	if (rc != TPM2_RC_SUCCESS) {
+		cmd.header.in = tpm2_selftest_header;
+		cmd.params.selftest_in.full_test = 1;
+
+		rc = tpm_transmit_cmd(chip, NULL, &cmd, TPM2_SELF_TEST_IN_SIZE,
+				      0, 0, "full selftest");
+	}
+
 	return rc;
 }
 
-- 
2.7.4

             reply	other threads:[~2017-12-22 13:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-22 13:56 Alexander Steffen [this message]
2018-01-18 18:46 ` [PATCH] tpm2-cmd: try full selftest once if continue selftest failed 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:
  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=20171222135610.7056-1-Alexander.Steffen@infineon.com \
    --to=alexander.steffen@infineon.com \
    --cc=jarkko.sakkinen@linux.intel.com \
    --cc=jgg@ziepe.ca \
    --cc=linux-integrity@vger.kernel.org \
    --cc=pmenzel@molgen.mpg.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.