NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

port-amd64/59730: tpm entropy source disabled on Lenovo x200



>Number:         59730
>Category:       port-amd64
>Synopsis:       tpm entropy source disabled on Lenovo x200
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    port-amd64-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Oct 27 10:50:00 +0000 2025
>Originator:     he%NetBSD.org@localhost
>Release:        NetBSD 11.99.3
>Organization:
I Try...
>Environment:
System: NetBSD 11.99.3 (GENERIC) #5: Sun Oct 26 10:13:39 CET 2025
Architecture: x86_64
Machine: amd64
>Description:
	Installing NetBSD on a "left-over" Lenovo x200 leaves
	the following messages in the kernel message log:

[     1.034955] tpm0 at acpi0 (TPM, INTC0102-1): mem 0xfed40000-0xfed44fff
[     1.034955] tpm0: device 0x10208086 rev 0x6

	and a little later:

[     1.034955] tpm0: write failed, error=5
[     1.034955] tpm0: deactivating entropy source

	On advice from riastradh@, I tried to collect the
	output from 'acpidump -dt', identifying the TPM module,
	and the part which mentions TPM is rather longish, but
	starts out with:

                Device (TPM)
                {
                    Method (_HID, 0, NotSerialized)  // _HID: Hardware ID
                    {
                        TPHY (0x00)
                        If ((TPMV == 0x01))
                        {
                            Return (0x0201D824)
                        }

                        If ((TPMV == 0x02))
                        {
                            Return (0x0435CF4D)
                        }

                        If ((TPMV == 0x03))
                        {
                            Return (0x02016D08)
                        }

                        If ((TPMV == 0x04))
                        {
                            Return (0x01016D08)
                        }

                        If (((TPMV == 0x05) || (TPMV == 0x06)))
                        {
                            Return (0x0010A35C)
                        }

                        If ((TPMV == 0x08))
                        {
                            Return (0x00128D06)
                        }

                        If ((TPMV == 0x09))
                        {
                            Return ("INTC0102")
                        }

                        Return (0x310CD041)
                    }

                    Name (_CID, EisaId ("PNP0C31"))  // _CID: Compatible ID
                    Name (_UID, 0x01)  // _UID: Unique ID

	The full 540KB of that file can be made available.

	(While running the 10.1 kernel, the 'acpidump -dt' output
	was truncated and an error message about "could not read
	acpi table" was produced.  With the 11.99.3 kernel that
	error is gone, and the output appears to be complete.)

	Also looking at where the "write failed" error might come
	from, Taylor pointed at sys/dev/ic/tpm.c, and based on
	suggestions I built a kernel with this diff:

Index: sys/dev/ic/tpm.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/tpm.c,v
retrieving revision 1.29
diff -u -r1.29 tpm.c
--- sys/dev/ic/tpm.c    14 May 2024 13:41:15 -0000      1.29
+++ sys/dev/ic/tpm.c    27 Oct 2025 10:45:13 -0000
@@ -919,8 +919,10 @@
 
        if (len == 0)
                return 0;
-       if ((rv = tpm12_request_locality(sc, 0)) != 0)
+       if ((rv = tpm12_request_locality(sc, 0)) != 0) {
+               printf("tpm12_request_locality failed\n");
                return rv;
+       }
 
        cnt = 0;
        while (cnt < len - 1) {
@@ -929,10 +931,12 @@
                        cnt++;
                }
                if ((rv = tpm_waitfor(sc, TPM_STS_VALID, TPM_READ_TMO, sc))) {
+                       printf("tpm_tis12_write / tpm_waitfor failed\n");
                        return rv;
                }
                sc->sc_status = tpm_status(sc);
                if (!(sc->sc_status & TPM_STS_DATA_EXPECT)) {
+                       printf("tpm_tis12_write / no TPM_STS_DATA_EXPECT\n");
                        return EIO;
                }
        }
@@ -941,9 +945,11 @@
        cnt++;
 
        if ((rv = tpm_waitfor(sc, TPM_STS_VALID, TPM_READ_TMO, sc))) {
+               printf("tpm_tis12_write / tpm_waitfor(2) failed\n");
                return rv;
        }
        if ((sc->sc_status & TPM_STS_DATA_EXPECT) != 0) {
+               printf("tpm_tis12_write / no TPM_STS_DATA_EXPECT(2)\n");
                return EIO;
        }
 

	And booting with this kernel reveals a bit more:

[     1.035529] tpm0 at acpi0 (TPM, INTC0102-1): mem 0xfed40000-0xfed44fff
[     1.035529] tpm0: device 0x10208086 rev 0x6

	followed later by

[     1.035529] tpm_tis12_write / no TPM_STS_DATA_EXPECT
[     1.035529] tpm0: write failed, error=5
[     1.035529] tpm0: deactivating entropy source

>How-To-Repeat:
	Try to install either 10.1 or 11.99.3 kernel on
	a Lenovo x200.

>Fix:
	Would be nice...



Home | Main Index | Thread Index | Old Index