LGTM.

Reviewed-by: Yeoreum Yun <[email protected]>

On Sun, Nov 15, 2026 at 01:34:53AM +0000, Siddharth Chintamaneni wrote:
> From: Jarkko Sakkinen <[email protected]>
> 
> Both tpm_tis and tpm_crb retrieve the start method from the ACPI TPM2
> table during device probe, and tpm_crb_ffa also needs it before chip
> allocation.
> 
> Cache the start method in tpm2_acpi_start_method during tpm_init(), log
> it when a TPM2 ACPI table is present, and export it for the leaf
> drivers, defaulting to ACPI_TPM2_NOT_ALLOWED when the table is absent or
> invalid.
> 
> Signed-off-by: Jarkko Sakkinen <[email protected]>
> Co-developed-by: Siddharth Chintamaneni <[email protected]>
> Signed-off-by: Siddharth Chintamaneni <[email protected]>
> ---
>  drivers/char/tpm/tpm-interface.c | 21 +++++++++++++++++++++
>  drivers/char/tpm/tpm.h           |  1 +
>  2 files changed, 22 insertions(+)
> 
> diff --git a/drivers/char/tpm/tpm-interface.c 
> b/drivers/char/tpm/tpm-interface.c
> index e0385b16616b..c18b060d7da2 100644
> --- a/drivers/char/tpm/tpm-interface.c
> +++ b/drivers/char/tpm/tpm-interface.c
> @@ -534,8 +534,17 @@ int tpm_get_random(struct tpm_chip *chip, u8 *out, 
> size_t max)
>  }
>  EXPORT_SYMBOL_GPL(tpm_get_random);
>  
> +#ifdef CONFIG_ACPI
> +u32 tpm2_acpi_start_method = ACPI_TPM2_NOT_ALLOWED;
> +EXPORT_SYMBOL_GPL(tpm2_acpi_start_method);
> +#endif
> +
>  static int __init tpm_init(void)
>  {
> +#ifdef CONFIG_ACPI
> +     struct acpi_table_tpm2 *tbl;
> +     acpi_status status;
> +#endif
>       int rc;
>  
>       rc = class_register(&tpm_class);
> @@ -562,6 +571,18 @@ static int __init tpm_init(void)
>               goto out_unreg_chrdev;
>       }
>  
> +#ifdef CONFIG_ACPI
> +     if (!acpi_disabled) {
> +             status = acpi_get_table(ACPI_SIG_TPM2, 1, (typeof(tbl->header) 
> **)&tbl);
> +             if (ACPI_SUCCESS(status)) {
> +                     if (tbl->header.length >= sizeof(*tbl))
> +                             tpm2_acpi_start_method = tbl->start_method;
> +                     acpi_put_table((struct acpi_table_header *)tbl);
> +                     pr_info("tpm: TPM2 ACPI start method: 0x%02x\n", 
> tpm2_acpi_start_method);
> +             }
> +     }
> +#endif
> +
>       return 0;
>  
>  out_unreg_chrdev:
> diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h
> index fa554c5ad80b..212ca2410c93 100644
> --- a/drivers/char/tpm/tpm.h
> +++ b/drivers/char/tpm/tpm.h
> @@ -100,6 +100,7 @@ void tpm_sysfs_add_device(struct tpm_chip *chip);
>  
>  
>  #ifdef CONFIG_ACPI
> +extern u32 tpm2_acpi_start_method;
>  extern void tpm_add_ppi(struct tpm_chip *chip);
>  #else
>  static inline void tpm_add_ppi(struct tpm_chip *chip)
> 
> base-commit: 7e52fc165aa50e70e8df3c879d04fc0ff1673d4a
> -- 
> 2.45.4
> 

-- 
Sincerely,
Yeoreum Yun

Reply via email to