From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751615AbdGYSSC convert rfc822-to-8bit (ORCPT ); Tue, 25 Jul 2017 14:18:02 -0400 Received: from mx2.suse.de ([195.135.220.15]:56883 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751328AbdGYSSB (ORCPT ); Tue, 25 Jul 2017 14:18:01 -0400 Date: Tue, 25 Jul 2017 20:17:58 +0200 From: Michal =?UTF-8?B?U3VjaMOhbmVr?= To: James Bottomley Cc: Christophe Ricard , linux-kernel@vger.kernel.org, tpmdd-devel@lists.sourceforge.net, Jarkko Sakkinen , apronin@chromium.org Subject: Re: [tpmdd-devel] tpm: read burstcount from TPM_STS in one 32-bit transaction Message-ID: <20170725201758.230de968@kitsune.suse.cz> In-Reply-To: <1501004171.3689.25.camel@linux.vnet.ibm.com> References: <20170725150443.7cf8fc91@kitsune.suse.cz> <1501004171.3689.25.camel@linux.vnet.ibm.com> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.31; x86_64-suse-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 25 Jul 2017 10:36:11 -0700 James Bottomley 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