mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jarkko Sakkinen <jarkko@kernel.org>
To: Stefan Mahnke-Hartmann <stefan.mahnke-hartmann@infineon.com>
Cc: linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org,
	peterhuewe@gmx.de, jgg@ziepe.ca, jsnitsel@redhat.com,
	nayna@linux.vnet.ibm.com, alexander.steffen@infineon.com
Subject: Re: [PATCH v2 2/2] tpm: Add field upgrade mode support for Infineon TPM2 modules
Date: Mon, 16 May 2022 21:36:05 +0300	[thread overview]
Message-ID: <YoKZlTwRnEfzgApR@kernel.org> (raw)
In-Reply-To: <20220513134152.270442-2-stefan.mahnke-hartmann@infineon.com>

On Fri, May 13, 2022 at 03:41:53PM +0200, Stefan Mahnke-Hartmann wrote:
> TPM2_GetCapability with a capability that has the property type value
> of TPM_PT_TOTAL_COMMANDS returns a zero length list, when an Infineon
> TPM2 is in field upgrade mode.
> Since an Infineon TPM2.0 in field upgrade mode returns RC_SUCCESS on
> TPM2_Startup, the field upgrade mode has to be detected by
> TPM2_GetCapability.
> 
> Signed-off-by: Stefan Mahnke-Hartmann <stefan.mahnke-hartmann@infineon.com>
> ---
> Changelog:
>  * v2:
>    * Move check of -ENODATA to if condition below.
>    * Change 'field upgrade mode' to lower case.
> 
>  drivers/char/tpm/tpm2-cmd.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/char/tpm/tpm2-cmd.c b/drivers/char/tpm/tpm2-cmd.c
> index 04a3e23a4afc..c1eb5d223839 100644
> --- a/drivers/char/tpm/tpm2-cmd.c
> +++ b/drivers/char/tpm/tpm2-cmd.c
> @@ -754,7 +754,11 @@ int tpm2_auto_startup(struct tpm_chip *chip)
>  	rc = tpm2_get_cc_attrs_tbl(chip);
>  
>  out:
> -	if (rc == TPM2_RC_UPGRADE) {
> +	/*
> +	 * Infineon TPM in field upgrade mode will return no data for the number
> +	 * of supported commands.
> +	 */
> +	if (rc == TPM2_RC_UPGRADE || rc == -ENODATA) {
>  		dev_info(&chip->dev, "TPM in field upgrade mode, requires firmware upgrade\n");
>  		chip->flags |= TPM_CHIP_FLAG_FIRMWARE_UPGRADE;
>  		rc = 0;
> -- 
> 2.25.1
> 

Looks good to me.

Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>

BR, Jarkko

  reply	other threads:[~2022-05-16 18:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-13 13:41 [PATCH v2 1/2] tpm: Fix buffer access in tpm2_get_tpm_pt() Stefan Mahnke-Hartmann
2022-05-13 13:41 ` [PATCH v2 2/2] tpm: Add field upgrade mode support for Infineon TPM2 modules Stefan Mahnke-Hartmann
2022-05-16 18:36   ` Jarkko Sakkinen [this message]
2022-05-16 18:38 ` [PATCH v2 1/2] tpm: Fix buffer access in tpm2_get_tpm_pt() 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=YoKZlTwRnEfzgApR@kernel.org \
    --to=jarkko@kernel.org \
    --cc=alexander.steffen@infineon.com \
    --cc=jgg@ziepe.ca \
    --cc=jsnitsel@redhat.com \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nayna@linux.vnet.ibm.com \
    --cc=peterhuewe@gmx.de \
    --cc=stefan.mahnke-hartmann@infineon.com \
    /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®