From: Dan Holmes-Mitra <dholmesm@google.com>
To: u-boot@lists.u-boot-project.org
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>,
Tom Rini <trini@konsulko.com>
Subject: [PATCH 2/2] tpm: tpm2_tis_core: Reject 0xff TPM_ACCESS and invalid DID/VID
Date: Thu, 03 Dec 2026 02:20:40 GMT [thread overview]
Message-ID: <20261203022028.01-02-dholmesm@google.com> (raw)
In-Reply-To: <20261203022028.01-00-dholmesm@google.com>
When an MMIO TIS TPM is absent, unpopulated reads return 0xff, which has
bit 7 (TPM_ACCESS_VALID) set and caused tpm_tis_wait_init() to falsely
report success. Requiring status != 0xff in tpm_tis_wait_init() avoids
false positives on floating MMIO buses while still polling cold-boot SPI
TPMs until ready.
Also reject all-ones or all-zeroes TPM_DID_VID readings in
tpm_tis_init() with -ENODEV after releasing the locality.
Signed-off-by: Dan Holmes-Mitra <dholmesm@google.com>
---
drivers/tpm/tpm2_tis_core.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/tpm/tpm2_tis_core.c b/drivers/tpm/tpm2_tis_core.c
index 1fdf8cfa31..f37ed0cdee 100644
--- a/drivers/tpm/tpm2_tis_core.c
+++ b/drivers/tpm/tpm2_tis_core.c
@@ -434,7 +434,7 @@ static int tpm_tis_wait_init(struct udevice *dev, int loc)
if (ret)
break;
- if (status & TPM_ACCESS_VALID)
+ if (status != 0xff && (status & TPM_ACCESS_VALID))
return 0;
} while (get_timer(start) < stop);
@@ -477,6 +477,10 @@ int tpm_tis_init(struct udevice *dev)
phy_ops->read_bytes(dev, TPM_RID(chip->locality), 1, &chip->rid);
phy_ops->read32(dev, TPM_DID_VID(chip->locality), &chip->vend_dev);
+ if (chip->vend_dev == 0xffffffffU || chip->vend_dev == 0x00000000U) {
+ tpm_tis_release_locality(dev, chip->locality);
+ return -ENODEV;
+ }
return tpm_tis_release_locality(dev, chip->locality);
}
--
2.56.1.911.g883d8bcb20-goog
prev parent reply other threads:[~2026-12-03 5:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 2:20 [PATCH 0/2] tpm: Fix MMIO TIS reg size parsing and absent-device detection Dan Holmes-Mitra
2026-12-03 2:20 ` [PATCH 1/2] tpm: tpm2_tis_mmio: Read reg size via dev_read_addr_size_index() Dan Holmes-Mitra
2026-12-03 2:20 ` Dan Holmes-Mitra [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=20261203022028.01-02-dholmesm@google.com \
--to=dholmesm@google.com \
--cc=ilias.apalodimas@linaro.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.u-boot-project.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.