Re: tpm_tis TPM2.0 not detected on cold boot

From: Jarkko Sakkinen
Date: Thu Jan 10 2019 - 12:28:15 EST


On Fri, Jan 04, 2019 at 04:28:24PM +0100, Michael Niewöhner wrote:
> root@debian:~# tpm2_pcrlist
> ERROR:tcti:src/util/io.c:102:write_all() failed to write to fd 3: Operation not
> permitted
> ERROR:tcti:src/tss2-tcti/tcti-device.c:86:tcti_device_transmit() wrong number of
> bytes written. Expected 22, wrote 0.
> ERROR: GetCapability: Get PCR allocation status Error. TPM Error:0xa000a......
> ERROR: Unable to run tpm2_pcrlist
> root@debian:~# tpm2_pcrlist; tpm2_pcrlist
> sha1 :
> 0 : 1ebb2be3b7103a09b5caeeb5827c1242cd6632ec
> 1 : 425e833da73cb511150d6ffcf6fac64e9a6feb58
> 2 : b2a83b0ebf2f8374299a5b2bdfc31ea955ad7236
> 3 : b2a83b0ebf2f8374299a5b2bdfc31ea955ad7236
> 4 : d13c141b174afbb568773adf1f39940a2df47c7d
> 5 : 756a3647403ab141ec2c1ac7325854f4a93f6efd
> ......

So the sympton is that it from time to time works and time to time
fails.

Can't recall whether you had interrupts enabled or disabled for the
TPM chip (depending on whether you use IRQs or polling you'd have
to tweak the code from a different place), but you could tweak
directly the TPM2_DURATION_* constants in drivers/char/tpm/tpm.h:

enum tpm2_timeouts {
TPM2_TIMEOUT_A = 750,
TPM2_TIMEOUT_B = 2000,
TPM2_TIMEOUT_C = 200,
TPM2_TIMEOUT_D = 30,
TPM2_DURATION_SHORT = 20,
TPM2_DURATION_MEDIUM = 750,
TPM2_DURATION_LONG = 2000,
TPM2_DURATION_LONG_LONG = 300000,
TPM2_DURATION_DEFAULT = 120000,
};

Set SHORT, LONG and MEDIUM to lets say 3000 and lets see if that
makes a difference or not.

/Jarkko