Re: git: bfe4be85a935 - main - tpm_crb: wait for idle and locality release after each command
- Reply: Michael Tuexen : "Re: git: bfe4be85a935 - main - tpm_crb: wait for idle and locality release after each command"
- In reply to: Ed Maste : "Re: git: bfe4be85a935 - main - tpm_crb: wait for idle and locality release after each command"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 09 Nov 2026 23:51:49 UTC
On Mon, Nov 9, 2026 at 4:14 PM Ed Maste <emaste@freebsd.org> wrote:
>
> On Thu, 5 Nov 2026 at 14:57, Olivier Cochard <olivier@freebsd.org> wrote:
> >
> > The branch main has been updated by olivier:
> >
> > URL: https://cgit.FreeBSD.org/src/commit/?id=bfe4be85a9354b92135e105028f2e1b3e0307ada
> >
> > commit bfe4be85a9354b92135e105028f2e1b3e0307ada
> > Author: Olivier Cochard <olivier@FreeBSD.org>
> > AuthorDate: 2026-11-04 21:05:22 +0000
> > Commit: Olivier Cochard <olivier@FreeBSD.org>
> > CommitDate: 2026-11-05 19:51:20 +0000
> >
> > tpm_crb: wait for idle and locality release after each command
> > ...
> > + device_printf(crb_sc->base.dev, "Failed to relinquish locality\n");
>
> On a Framework 13" AMD Ryzen 7840U I'm now seeing this message emitted
> every 10s.
Can you try the following to help dump what is going on?
--- a/sys/dev/tpm/tpm_crb.c
+++ b/sys/dev/tpm/tpm_crb.c
@@ -553,7 +553,7 @@
tpmcrb_relinquish_locality(struct tpmcrb_sc *crb_sc)
{
struct resource *res = crb_sc->base.mem_res;
- uint32_t mask;
+ uint32_t before, mask, state;
int timeout;
if (!crb_sc->has_locality)
@@ -562,6 +562,7 @@
/* PTP 1.07, Table 37: the other fields mean something only if valid. */
mask = TPM_LOC_STATE_VALID | TPM_LOC_STATE_ASSIGNED;
+ before = bus_read_4(res, TPM_LOC_STATE);
bus_write_4(res, TPM_LOC_CTRL, TPM_LOC_CTRL_RELINQUISH);
/*
@@ -571,14 +572,19 @@
* pause so a release during it is not reported as a failure.
*/
for (timeout = TPM_TIMEOUT_C;; timeout -= tick) {
- if ((bus_read_4(res, TPM_LOC_STATE) & mask) ==
- TPM_LOC_STATE_VALID)
+ state = bus_read_4(res, TPM_LOC_STATE);
+ if ((state & mask) == TPM_LOC_STATE_VALID)
return;
if (timeout <= 0)
break;
pause("TPM locality", 1);
}
- device_printf(crb_sc->base.dev, "Failed to relinquish locality\n");
+ device_printf(crb_sc->base.dev,
+ "Failed to relinquish locality: LOC_STATE before=%#x last=%#x "
+ "LOC_STS=%#x CTRL_REQ=%#x CTRL_STS=%#x\n",
+ before, state, bus_read_4(res, TPM_LOC_STS),
+ tpmcrb_ctrl_read_4(crb_sc, TPM_CRB_CTRL_REQ),
+ tpmcrb_ctrl_read_4(crb_sc, TPM_CRB_CTRL_STS));
}
static bool