Linux Integrity Measurement development
 help / color / mirror / Atom feed
From: Jarkko Sakkinen <jarkko@kernel.org>
To: Siddharth Chintamaneni <sidchintamaneni@gmail.com>
Cc: Peter Huewe <peterhuewe@gmx.de>, Jason Gunthorpe <jgg@ziepe.ca>,
	Sudeep Holla <sudeep.holla@kernel.org>,
	Yeoreum Yun <yeoreum.yun@arm.com>,
	Stuart Yoder <stuart.yoder@arm.com>,
	apais@microsoft.com, rlmenge@gmail.com,
	hargar@linux.microsoft.com, linux-integrity@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 4/4] tpm: tpm_crb: Use cached tpm2_acpi_start_method
Date: Sat, 14 Nov 2026 23:11:28 +0200	[thread overview]
Message-ID: <avjOgDySmUiklnN1@kernel.org> (raw)
In-Reply-To: <20261114193434.117714-5-sidchintamaneni@gmail.com>

On Sat, Nov 14, 2026 at 07:34:34PM +0000, Siddharth Chintamaneni wrote:
> Check the cached tpm2_acpi_start_method value at the start of
> crb_acpi_probe() before mapping the ACPI TPM2 table for CRB-specific
> parameters. This avoids mapping the table when it is absent or when the
> device uses ACPI_TPM2_MEMORY_MAPPED and belongs to tpm_tis.
> 
> Signed-off-by: Siddharth Chintamaneni <sidchintamaneni@gmail.com>
> ---
>  drivers/char/tpm/tpm_crb.c | 19 ++++++++++++-------
>  1 file changed, 12 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/char/tpm/tpm_crb.c b/drivers/char/tpm/tpm_crb.c
> index 4749a9183726..c1c2b72459a2 100644
> --- a/drivers/char/tpm/tpm_crb.c
> +++ b/drivers/char/tpm/tpm_crb.c
> @@ -945,18 +945,23 @@ static int crb_acpi_probe(struct platform_device *pdev)
>  	if (!device)
>  		return -ENODEV;
>  
> -	status = acpi_get_table(ACPI_SIG_TPM2, 1,
> -				(struct acpi_table_header **) &buf);
> -	if (ACPI_FAILURE(status) || buf->header.length < sizeof(*buf)) {
> +	sm = tpm2_acpi_start_method;

sm and also priv->sm should be removed

The global should be accessed across the board when querying start
method. It should be the single source for it post-tpm_init.

> +	if (sm == ACPI_TPM2_NOT_ALLOWED) {
>  		dev_err(dev, FW_BUG "failed to get TPM2 ACPI table\n");

Drop this message.

>  		return -EINVAL;

-ENODEV


>  	}
>  
>  	/* Should the FIFO driver handle this? */
> -	sm = buf->start_method;
> -	if (sm == ACPI_TPM2_MEMORY_MAPPED) {
> -		rc = -ENODEV;
> -		goto out;
> +	if (sm == ACPI_TPM2_MEMORY_MAPPED)
> +		return -ENODEV;
> +
> +	status = acpi_get_table(ACPI_SIG_TPM2, 1,
> +				(struct acpi_table_header **)&buf);
> +	if (ACPI_FAILURE(status) || buf->header.length < sizeof(*buf)) {
> +		dev_err(dev, FW_BUG "failed to get TPM2 ACPI table\n");

Drop this message.

> +		if (ACPI_SUCCESS(status))
> +			acpi_put_table((struct acpi_table_header *)buf);
> +		return -EINVAL;

-ENODEV

>  	}
>  
>  	priv = devm_kzalloc_obj(dev, struct crb_priv);
> -- 
> 2.45.4
> 

Br, Jarkko

      reply	other threads:[~2026-11-14 21:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-14 19:34 [PATCH v2 0/4] tpm: Cache ACPI TPM2 start method and gate tpm_crb_ffa probe Siddharth Chintamaneni
2026-11-14 19:34 ` [PATCH v2 1/4] tpm: Cache TPM2 start method Siddharth Chintamaneni
2026-11-14 20:54   ` Jarkko Sakkinen
2026-11-14 21:00   ` Jarkko Sakkinen
2026-11-14 19:34 ` [PATCH v2 2/4] tpm: tpm_crb_ffa: Only probe when ACPI TPM2 uses FF-A Siddharth Chintamaneni
2026-11-14 19:34 ` [PATCH v2 3/4] tpm: tpm_tis: Use cached tpm2_acpi_start_method Siddharth Chintamaneni
2026-11-14 21:14   ` Jarkko Sakkinen
2026-11-14 19:34 ` [PATCH v2 4/4] tpm: tpm_crb: " Siddharth Chintamaneni
2026-11-14 21:11   ` Jarkko Sakkinen [this message]

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=avjOgDySmUiklnN1@kernel.org \
    --to=jarkko@kernel.org \
    --cc=apais@microsoft.com \
    --cc=hargar@linux.microsoft.com \
    --cc=jgg@ziepe.ca \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterhuewe@gmx.de \
    --cc=rlmenge@gmail.com \
    --cc=sidchintamaneni@gmail.com \
    --cc=stuart.yoder@arm.com \
    --cc=sudeep.holla@kernel.org \
    --cc=yeoreum.yun@arm.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