Re: [PATCH v3 3/6] tpm_crb: Add start_cmd parameter to tpm_crb_start wrapper

Jarkko Sakkinen <[email protected]>
Newsgroups org.kernel.vger.linux-integrity,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On Mon, May 18, 2026 at 08:47:21PM +0530, Arun Menon wrote:
> From: Arun Menon <[email protected]>
> 
> The current implementation of tpm_crb_start() is limited to triggering
> the CRB_START_INVOKE bit. To support command and response chunking, the
> driver must be able to send other control bits, like
> CRB_START_NEXT_CHUNK, using the same platform-specific paths.
> 
> This commit adds the start_cmd parameter to tpm_crb_start() so the
> caller can specify which command to send.
> 
> Signed-off-by: Arun Menon <[email protected]>
> ---
>  drivers/char/tpm/tpm_crb.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/char/tpm/tpm_crb.c b/drivers/char/tpm/tpm_crb.c
> index 9a2f512b4ae3..31f530744e90 100644
> --- a/drivers/char/tpm/tpm_crb.c
> +++ b/drivers/char/tpm/tpm_crb.c
> @@ -446,7 +446,7 @@ static int tpm_crb_smc_start(struct device *dev, unsigned long func_id)
>  }
>  #endif
>  
> -static int tpm_crb_start(struct tpm_chip *chip)
> +static int tpm_crb_start(struct tpm_chip *chip, u32 start_cmd)
>  {
>  	struct crb_priv *priv = dev_get_drvdata(&chip->dev);
>  	int rc = 0;
> @@ -457,16 +457,16 @@ static int tpm_crb_start(struct tpm_chip *chip)
>  	if (priv->sm == ACPI_TPM2_COMMAND_BUFFER ||
>  	    priv->sm == ACPI_TPM2_MEMORY_MAPPED ||
>  	    !strcmp(priv->hid, "MSFT0101"))
> -		iowrite32(CRB_START_INVOKE, &priv->regs_t->ctrl_start);
> +		iowrite32(start_cmd, &priv->regs_t->ctrl_start);
>  	if (priv->sm == ACPI_TPM2_START_METHOD ||
>  	    priv->sm == ACPI_TPM2_COMMAND_BUFFER_WITH_START_METHOD)
>  		rc = crb_do_acpi_start(chip);
>  	if (priv->sm == ACPI_TPM2_COMMAND_BUFFER_WITH_ARM_SMC) {
> -		iowrite32(CRB_START_INVOKE, &priv->regs_t->ctrl_start);
> +		iowrite32(start_cmd, &priv->regs_t->ctrl_start);
>  		rc = tpm_crb_smc_start(&chip->dev, priv->smc_func_id);
>  	}
>  	if (priv->sm == ACPI_TPM2_CRB_WITH_ARM_FFA) {
> -		iowrite32(CRB_START_INVOKE, &priv->regs_t->ctrl_start);
> +		iowrite32(start_cmd, &priv->regs_t->ctrl_start);
>  		rc = tpm_crb_ffa_start(CRB_FFA_START_TYPE_COMMAND, chip->locality);
>  	}
>  	return rc;
> @@ -497,7 +497,7 @@ static int crb_send(struct tpm_chip *chip, u8 *buf, size_t bufsiz, size_t len)
>  	/* Make sure that cmd is populated before issuing start. */
>  	wmb();
>  
> -	rc = tpm_crb_start(chip);
> +	rc = tpm_crb_start(chip, CRB_START_INVOKE);
>  	if (rc)
>  		return rc;
>  
> -- 
> 2.54.0
> 

Reviewed-by: Jarkko Sakkinen <[email protected]>

BR, Jarkko
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.