Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751956AbdHANcL (ORCPT ); Tue, 1 Aug 2017 09:32:11 -0400 Received: from mga09.intel.com ([134.134.136.24]:38101 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751631AbdHANcJ (ORCPT ); Tue, 1 Aug 2017 09:32:09 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,306,1498546800"; d="scan'208";a="1157713513" Date: Tue, 1 Aug 2017 16:31:45 +0300 From: Jarkko Sakkinen To: Michal =?iso-8859-1?Q?Such=E1nek?= Cc: James Bottomley , Christophe Ricard , linux-kernel@vger.kernel.org, tpmdd-devel@lists.sourceforge.net, apronin@chromium.org Subject: Re: [tpmdd-devel] tpm: read burstcount from TPM_STS in one 32-bit transaction Message-ID: <20170801133145.mqfen3bskzwwabwp@linux.intel.com> References: <20170725150443.7cf8fc91@kitsune.suse.cz> <1501004171.3689.25.camel@linux.vnet.ibm.com> <20170725201758.230de968@kitsune.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20170725201758.230de968@kitsune.suse.cz> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1205 Lines: 32 On Tue, Jul 25, 2017 at 08:17:58PM +0200, Michal Such?nek wrote: > 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 Thank you for reporting this and thanks James for explaining this. I do not have access to PPC hardware with SPI-TPM. /Jarkko