Re: [tpmdd-devel] tpm: read burstcount from TPM_STS in one 32-bit transaction
From: Michal SuchÃnek
Date: Tue Jul 25 2017 - 14:18:06 EST
On Tue, 25 Jul 2017 10:36:11 -0700
James Bottomley <jejb@xxxxxxxxxxxxxxxxxx> wrote:
> On Tue, 2017-07-25 at 15:04 +0200, Michal SuchÃnek wrote:
> > Hello,
> >
> > in commit 9754d45e9970 ("tpm: read burstcount from TPM_STS in one
> > 32-bit transaction") you change reading of two 8-bit values to one
> > 32bit read. This is obviously wrong wrt endianess unless the
> > underlying tpm_tis_read32 does endian conversion.Â
>
> Some of the bus read primitives do do endianness conversions. ÂThe
> problem is with the SPI attachment, which has unclear endianness. ÂA
> standard PCI bus attachment uses ioread32() which automatically
> transforms from a little endian bus to the cpu endianness, however SPI
> is forced to transfer the bytes one at a time over the serial bus and
> then transform. ÂThe assumption seems to be that the TIS TPM is
> replying in little endian format when SPI connected.
>
Yes, that makes sense.
Thanks for clarification.
Michal