All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ilias Apalodimas <ilias.apalodimas@linaro.org>
To: Simon Glass <sjg@chromium.org>
Cc: "U-Boot Mailing List" <u-boot@lists.denx.de>,
	"Dzmitry Sankouski" <dsankouski@gmail.com>,
	"Etienne Carriere" <etienne.carriere@linaro.org>,
	"Marek Behún" <kabel@kernel.org>,
	"Nikhil M Jain" <n-jain1@ti.com>,
	"Patrick Delaunay" <patrick.delaunay@foss.st.com>,
	"Ramon Fried" <rfried.dev@gmail.com>,
	"Sean Anderson" <sean.anderson@seco.com>,
	"Sughosh Ganu" <sughosh.ganu@linaro.org>
Subject: Re: [PATCH] WIP: TPM additions
Date: Mon, 20 Feb 2023 18:48:22 +0200	[thread overview]
Message-ID: <Y/OkVm5axHNeEK69@hera> (raw)
In-Reply-To: <20230220145156.1886797-1-sjg@chromium.org>

Hi Simon,

> + * @dev		TPM device
> + * Return: TPM2_RC_SUCCESS, on success, or when the TPM returns
> + * TPM_INVALID_POSTINIT; TPM_FAILEDSELFTEST, if the TPM is in failure state
> + */
> +u32 tpm1_auto_start(struct udevice *dev);
> +
>  #endif /* __TPM_V1_H */
> diff --git a/lib/tpm-v1.c b/lib/tpm-v1.c
> index d0e3ab1b21d..884b8ddbac9 100644
> --- a/lib/tpm-v1.c
> +++ b/lib/tpm-v1.c
> @@ -69,6 +69,17 @@ u32 tpm1_continue_self_test(struct udevice *dev)
>  	return tpm_sendrecv_command(dev, command, NULL, NULL);
>  }
>
> +u32 tpm1_auto_start(struct udevice *dev)
> +{
> +	u32 rc;
> +
> +	rc = tpm1_startup(dev, TPM_ST_CLEAR);
> +	if (rc == TPM_INVALID_POSTINIT)
> +		rc = 0;

I am not an expert in 1.2 devices by any means, but don't you need to start
auto tests here as well similarly to what 2.0 does?
Looking at the kernel code it does something along the lines of

rc= tpm1_self_test_full(dev);
if (rc == TPM_FAILEDSELFTEST) {
.....
}


> +
> +	return rc;
> -	  * -EBUSY return code internally.

[...]

> -	  */
>  	ut_assertok(tpm_auto_start(dev));
>
>  	ut_assert(tpm_report_state(dev, buf, sizeof(buf)));
> @@ -36,4 +123,4 @@ static int dm_test_tpm(struct unit_test_state *uts)
>
>  	return 0;
>  }
> -DM_TEST(dm_test_tpm, UT_TESTF_SCAN_FDT);
> +DM_TEST(dm_test_tpm_report_state, UT_TESTF_SCAN_FDT);
> --
> 2.39.2.637.g21b0678d19-goog
>



Other than that, this looks ok to me

Cheers
/Ilias

  reply	other threads:[~2023-02-20 16:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-20 14:51 [PATCH] WIP: TPM additions Simon Glass
2023-02-20 16:48 ` Ilias Apalodimas [this message]
2023-02-20 16:50   ` Simon Glass

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=Y/OkVm5axHNeEK69@hera \
    --to=ilias.apalodimas@linaro.org \
    --cc=dsankouski@gmail.com \
    --cc=etienne.carriere@linaro.org \
    --cc=kabel@kernel.org \
    --cc=n-jain1@ti.com \
    --cc=patrick.delaunay@foss.st.com \
    --cc=rfried.dev@gmail.com \
    --cc=sean.anderson@seco.com \
    --cc=sjg@chromium.org \
    --cc=sughosh.ganu@linaro.org \
    --cc=u-boot@lists.denx.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.