lkml.org 
[lkml]   [2021]   [Nov]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v18 1/6] tpm_tis: Fix expected bit handling and send all bytes in one shot without last byte in exception
From
Date
On Tue, 2021-11-02 at 17:20 +0200, amirmizi6@gmail.com wrote:
> From: Amir Mizinski <amirmizi6@gmail.com>
>
> Currently, the driver polls the TPM_STS.stsValid field until TRUE; then it
> reads TPM_STS register again to verify only that TPM_STS.expect field is
> FALSE (i.e., it ignores TPM_STS.stsValid).
> Since TPM_STS.stsValid represents the TPM_STS.expect validity, a check of
> only one of these fields is wrong. Fix this condition so that both fields
> are checked in the same TPM_STS register read.
>
> Modify the signature of wait_for_tpm_stat() to tpm_tis_wait_for_stat(),
> adding an additional "expected" parameter to its call.
> tpm_tis_wait_for_stat() is now polling the TPM_STS with a mask and waits
> for the value in "expected". This modification adds the ability to check if
> certain TPM_STS bits have been cleared.
> For example, use the new parameter to check in status that TPM_STS_VALID
> is set and also that TPM_STS_EXPECT is zeroed. This prevents a racy
> check.
>
> Suggested-by: Benoit Houyere <benoit.houyere@st.com>
> Signed-off-by: Amir Mizinski <amirmizi6@gmail.com>

Thank you, this looks legit now!

Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>

/Jarkko

\
 
 \ /
  Last update: 2021-11-02 21:24    [W:0.053 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site