Re: [PATCH] tpm: Start the tpm2 before running a self test.
From: Angga
Date: Sun Nov 26 2023 - 16:16:55 EST
On 22/11/2023 8:10 pm, Paul Menzel wrote:
>
> Dear Hermin,
>
>
> Thank you for your patch.
>
> It’d be great if you removed the dot/period from the end of the commit
> message summary/title.
>
> Am 22.11.23 um 07:55 schrieb Hermin Anggawijaya:
>> 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".
>
> Please document on what platform this happens.
>
>> Signed-off-by: Hermin Anggawijaya
>> <hermin.anggawijaya@xxxxxxxxxxxxxxxxxxx>
>> ---
>> 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;
>> +
>> 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;
>
>
> Kind regards,
>
> Paul
Hello Paul
Thank you for your comments.
>Please document on what platform this happens.
The error log message is observed on a custom hardware design (a router)
with an Infineon SLM 9670 TPM2.0.
The patch is useful for us, as the firmware (boot loader) of the router
does not support TPM yet, thus the kernel
needs to start the TPM before starting the self test.
I will reply to Jarkko's and Stefan's comments separately, and if in
principle, the patch is accepted, I will send the
second version of the patch with your comments addressed.
Kind regards
Hermin