From: Siddharth Chintamaneni <sidchintamaneni@gmail.com>
To: Peter Huewe <peterhuewe@gmx.de>, Jarkko Sakkinen <jarkko@kernel.org>
Cc: 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, rachelmenge@linux.microsoft.com,
hargar@linux.microsoft.com, linux-integrity@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org,
Siddharth Chintamaneni <sidchintamaneni@gmail.com>
Subject: [PATCH v3 3/4] tpm: tpm_tis: Use cached tpm2_acpi_start_method
Date: Sun, 15 Nov 2026 01:34:55 +0000 [thread overview]
Message-ID: <20261115013456.212141-4-sidchintamaneni@gmail.com> (raw)
In-Reply-To: <20261115013456.212141-1-sidchintamaneni@gmail.com>
Use the cached tpm2_acpi_start_method value instead of mapping and
unmapping the ACPI TPM2 table again during probe. Remove
check_acpi_tpm2() and open-code the start method check directly in
tpm_tis_init(), returning -ENODEV when the device does not use
ACPI_TPM2_MEMORY_MAPPED.
Signed-off-by: Siddharth Chintamaneni <sidchintamaneni@gmail.com>
---
drivers/char/tpm/tpm_tis.c | 45 +++++---------------------------------
1 file changed, 6 insertions(+), 39 deletions(-)
diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
index 6f8344894ea5..df2d8c1c2be0 100644
--- a/drivers/char/tpm/tpm_tis.c
+++ b/drivers/char/tpm/tpm_tis.c
@@ -127,45 +127,11 @@ static inline int is_itpm(struct acpi_device *dev)
#endif
#if defined(CONFIG_ACPI)
-#define DEVICE_IS_TPM2 1
-
static const struct acpi_device_id tpm_acpi_tbl[] = {
- {"MSFT0101", DEVICE_IS_TPM2},
+ {"MSFT0101"},
{},
};
MODULE_DEVICE_TABLE(acpi, tpm_acpi_tbl);
-
-static int check_acpi_tpm2(struct device *dev)
-{
- const struct acpi_device_id *aid = acpi_match_device(tpm_acpi_tbl, dev);
- struct acpi_table_tpm2 *tbl;
- acpi_status st;
- int ret = 0;
-
- if (!aid || aid->driver_data != DEVICE_IS_TPM2)
- return 0;
-
- /* If the ACPI TPM2 signature is matched then a global ACPI_SIG_TPM2
- * table is mandatory
- */
- st = acpi_get_table(ACPI_SIG_TPM2, 1, (struct acpi_table_header **)&tbl);
- if (ACPI_FAILURE(st) || tbl->header.length < sizeof(*tbl)) {
- dev_err(dev, FW_BUG "failed to get TPM2 ACPI table\n");
- return -EINVAL;
- }
-
- /* The tpm2_crb driver handles this device */
- if (tbl->start_method != ACPI_TPM2_MEMORY_MAPPED)
- ret = -ENODEV;
-
- acpi_put_table((struct acpi_table_header *)tbl);
- return ret;
-}
-#else
-static int check_acpi_tpm2(struct device *dev)
-{
- return 0;
-}
#endif
static int tpm_tcg_read_bytes(struct tpm_tis_data *data, u32 addr, u16 len,
@@ -222,11 +188,12 @@ static int tpm_tis_init(struct device *dev, struct tpm_info *tpm_info)
{
struct tpm_tis_tcg_phy *phy;
int irq = -1;
- int rc;
- rc = check_acpi_tpm2(dev);
- if (rc)
- return rc;
+#ifdef CONFIG_ACPI
+ if (acpi_match_device(tpm_acpi_tbl, dev) &&
+ tpm2_acpi_start_method != ACPI_TPM2_MEMORY_MAPPED)
+ return -ENODEV;
+#endif
phy = devm_kzalloc_obj(dev, struct tpm_tis_tcg_phy);
if (phy == NULL)
--
2.45.4
next prev parent reply other threads:[~2026-11-15 1:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-15 1:34 [PATCH v3 0/4] tpm: Cache ACPI TPM2 start method and gate tpm_crb_ffa probe Siddharth Chintamaneni
2026-11-15 1:34 ` [PATCH v3 1/4] tpm: Cache TPM2 start method Siddharth Chintamaneni
2026-11-15 1:34 ` [PATCH v3 2/4] tpm: tpm_crb_ffa: Only probe when ACPI TPM2 uses FF-A Siddharth Chintamaneni
2026-11-15 1:34 ` Siddharth Chintamaneni [this message]
2026-11-15 1:34 ` [PATCH v3 4/4] tpm: tpm_crb: Use cached tpm2_acpi_start_method Siddharth Chintamaneni
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=20261115013456.212141-4-sidchintamaneni@gmail.com \
--to=sidchintamaneni@gmail.com \
--cc=apais@microsoft.com \
--cc=hargar@linux.microsoft.com \
--cc=jarkko@kernel.org \
--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=rachelmenge@linux.microsoft.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
all inboxes | Powered by JetHome®