Re: [RFC][PATCH 4/9] tpm_tis_core: send all data in single operation

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

 



On Fri, Dec 08, 2017 at 07:46:53PM +0100, Alexander Steffen wrote:
> tpm_tis_send_data splits all commands sent to the TPM into at least two
> transfers, even if the commands are small enough to fit into a single
> transfer. The intention seems to be to make extra sure that the TPM has
> received all data correctly by observing the Expect flag flipping from 1 to
> 0 when writing the last byte.
> 
> Unfortunately, this does not work as intended, because the Expect flag will
> change not when the last byte is written to the FIFO, but when the TPM
> processes the last byte from the FIFO. With a large FIFO and long commands
> it might well be that there are still many bytes left in the FIFO when the
> Expect flag is checked. Obviously, the flag will be 1 then, even if the
> FIFO contains more bytes than expected. Since there is no indication
> whether the FIFO is already empty or not, there is no way to implement this
> check reliably.
> 
> But then again, this check is not necessary at all. The driver already
> ensures that not more data is sent to the TPM than is announced in the
> header. In addition, the TPM is required to throw away all extraneous bytes
> anyway. So if the Expect flag is 0 after all bytes have been sent to the
> TPM, the TPM has received the command correctly and is ready to execute it.
> 
> Therefore, remove this intermediary check and send all data in a single
> operation. This simplifies the code and improves the performance,
> especially for short commands.
> 
> Signed-off-by: Alexander Steffen <Alexander.Steffen@xxxxxxxxxxxx>

LGTM

Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@xxxxxxxxxxxxxxx>

/Jarkko



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux Kernel]     [Linux Kernel Hardening]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux