lkml.org 
[lkml]   [2020]   [Jun]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v11 2/8] tpm: tpm_tis: Fix expected bit handling and send all bytes in one shot without last byte in exception
On Thu, Jun 18, 2020 at 04:43:37PM +0300, amirmizi6@gmail.com wrote:
> From: Amir Mizinski <amirmizi6@gmail.com>
>
> Detected the following incorrect implementation of the send command:
> polling on the TPM_STS.stsValid field followed by checking the
> TPM_STS.expect field only once. Since TPM_STS.stsValid represents the
> TPM_STS.expect validity, both fields should be polled at the same time.
>
> This fix modifies the signature of wait_for_tpm_stat(), adding an
> additional "mask_result" parameter to its call. wait_for_tpm_stat() is now
> polling the TPM_STS with a mask and waits for the value in mask_result.
> The fix adds the ability to check if certain TPM_STS bits have been
> cleared.
>
> This change is also aligned to verifying the CRC on I2C TPM. The CRC
> verification should be done after the TPM_STS.expect field is cleared
> (TPM received all expected command bytes and set the calculated CRC value
> in the register).
>
> In addition, the send command was changed to comply with
> TCG_DesignPrinciples_TPM2p0Driver_vp24_pubrev.pdf as follows:
> - send all command bytes in one loop
> - remove special handling of the last byte
>
> Suggested-by: Benoit Houyere <benoit.houyere@st.com>
> Signed-off-by: Amir Mizinski <amirmizi6@gmail.com>

Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>

If this patch set needs a further update, you could rename the function
as 'tpm_tis_wait_for_stat()' (can be part of this patch). It's better
aligned with other naming and gives better picture of the scope of this
function.

/Jarkko

\
 
 \ /
  Last update: 2020-06-22 23:55    [W:0.064 / U:0.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site