On 03/12/2018 01:38 PM, Stephen Douthit wrote:
I'd like to add a poll for tpmRegValidSts to crb_probe() similar to
what's in tis_probe() to avoid potential races on real hardware.
The QEMU CRB currently does not set this bit until access is requested
by writing bit 0 to TPM_LOC_CTRL_x.
The spec is a bit ambiguous about this bit and says 'The TPM SHALL NOT
set TPM_LOC_STATE_x.tpmRegValidSts to 1 unless all other fields are
valid' (description near Table 24 of TCG PC Client Platform TPM Profile
(PTP) Specification). What makes all the other fields valid? Do you know
whether your hardware has this bit set to '1' at this point ? I can add
an initialization to QEMU that sets this bit to '1' as well, but if your
hardware doesn't have it to '1' I'd rather not do it but do the
- request access by writing '1' to TPM_LOC_CTRL
- checking whether this bit is now '1'
The code may be a bit confusing and driven by our QEMU implementation.