Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Jun 2023 19:09:41 +0100
From:      Johannes Totz <jo@bruelltuete.com>
To:        FreeBSD Hackers <freebsd-hackers@FreeBSD.org>
Subject:   tpm for AMD Ryzen
Message-ID:  <f328bc12-b889-2871-e509-0c8664d1c9b3@bruelltuete.com>

next in thread | raw e-mail | index | archive | help
Hi everyone,

I'm trying to get the (f)TPM that comes with AMD's Zen2 to work.
BIOS config screen says it's doing CRB mode.

So I start poking in tpm_crb.c 
https://github.com/freebsd/freebsd-src/blob/main/sys/dev/tpm/tpm_crb.c

Out of the box, it does not attach. The TPM2 ACPI table says its start 
method is 2 (aka ACPI). That's easy to hack around, just mess with the 
if-condition at 
https://github.com/freebsd/freebsd-src/blob/main/sys/dev/tpm/tpm_crb.c#L115

With that adjusted, tpmcrb now probes successfully but does not attach.

As far as I can tell the register values it tries to read from the 
ACPI-provided memory window are just bogus.

That makes me suspect that the BIOS has misconfigured it. The TPM2 table 
has a different address than what's reported at runtime.
The table says 0xfd210510 is the (physical) address, but acpi says it's 
0xbd13f000.

Fiddling about with hint.tpmcrb.0.maddr and friends does not yield 
anything fruitful: anything I try to override with hints is just ignored.
Hacking in a
bus_set_resource(dev, SYS_RES_MEMORY, ... 0xfd210510 ...);
ends up giving me that override but still no dice re actual tpm 
functionality.

Has anyone gotten the tpm to work on (consumer) Ryzen?


thanks,

Johannes



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?f328bc12-b889-2871-e509-0c8664d1c9b3>