From: Stefan Berger <stefanb@linux.ibm.com>
To: Hermin Anggawijaya <hermin.anggawijaya@alliedtelesis.co.nz>,
peterhuewe@gmx.de, jarkko@kernel.org, jgg@ziepe.ca
Cc: linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] tpm: Start the tpm2 before running a self test.
Date: Wed, 22 Nov 2023 07:34:33 -0500 [thread overview]
Message-ID: <85154bfe-6bd5-440a-acc1-f01497d59af5@linux.ibm.com> (raw)
In-Reply-To: <20231122065528.1049819-1-hermin.anggawijaya@alliedtelesis.co.nz>
On 11/22/23 01:55, Hermin Anggawijaya wrote:
> Before sending a command to attempt the self test, the TPM
> may need to be started, otherwise the self test returns
> TPM2_RC_INITIALIZE value causing a log as follows:
> "tpm tpm0: A TPM error (256) occurred attempting the self test".
>
> Signed-off-by: Hermin Anggawijaya <hermin.anggawijaya@alliedtelesis.co.nz>
> ---
> drivers/char/tpm/tpm2-cmd.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/char/tpm/tpm2-cmd.c b/drivers/char/tpm/tpm2-cmd.c
> index 93545be190a5..0530f3b5f86a 100644
> --- a/drivers/char/tpm/tpm2-cmd.c
> +++ b/drivers/char/tpm/tpm2-cmd.c
> @@ -737,15 +737,15 @@ int tpm2_auto_startup(struct tpm_chip *chip)
> if (rc)
> goto out;
>
> + rc = tpm2_startup(chip);
> + if (rc && rc != TPM2_RC_INITIALIZE)
> + goto out;
> +
Most platforms should have firmware initialize the TPM 2 these days.
Therefore, a selftest should work and in case it doesn't work you fall
back to the tpm2_startup below and if you get an error message in the
log you at least know that you firmware is not up-to-date.
> rc = tpm2_do_selftest(chip);
> if (rc && rc != TPM2_RC_INITIALIZE)
> goto out;
>
> if (rc == TPM2_RC_INITIALIZE) {
> - rc = tpm2_startup(chip);
> - if (rc)
> - goto out;
> -
> rc = tpm2_do_selftest(chip);
> if (rc)
> goto out;
next prev parent reply other threads:[~2023-11-22 12:34 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-22 6:55 Hermin Anggawijaya
2023-11-22 7:10 ` Paul Menzel
2023-11-26 21:16 ` Angga
2023-11-22 12:34 ` Stefan Berger [this message]
2023-11-27 2:02 ` Angga
2023-12-04 2:36 ` Jarkko Sakkinen
2023-11-24 1:42 ` Jarkko Sakkinen
2023-11-27 2:07 ` Angga
2024-07-15 17:39 ` Francesco Dolcini
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=85154bfe-6bd5-440a-acc1-f01497d59af5@linux.ibm.com \
--to=stefanb@linux.ibm.com \
--cc=hermin.anggawijaya@alliedtelesis.co.nz \
--cc=jarkko@kernel.org \
--cc=jgg@ziepe.ca \
--cc=linux-integrity@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peterhuewe@gmx.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®