Re: [tpmdd-devel] ibmvtpm byteswapping inconsistency

2017-02-16 Thread Michal Suchánek
On Wed, 1 Feb 2017 23:40:33 -0500 Vicky wrote: > > On Jan 26, 2017, at 5:58 PM, Ashley Lai > > wrote: > > > > Adding Vicky from IBM. > > > > > > On 01/26/2017 04:05 PM, Jason Gunthorpe wrote: > >> On Thu, Jan 26, 2017 at 09:22:48PM +0100,

Re: [tpmdd-devel] ibmvtpm byteswapping inconsistency

2017-02-16 Thread Michael Ellerman
Tyrel Datwyler writes: > On 01/29/2017 08:32 PM, Michael Ellerman wrote: >> Tyrel Datwyler writes: >>> >>> Byte | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 >>>

Re: [tpmdd-devel] ibmvtpm byteswapping inconsistency

2017-02-16 Thread David Laight
From: Michal Suchánek > Sent: 02 February 2017 11:30 ... > The word is marked correctly as __be64 in that patch because count and > handle are swapped to BE when saved to it and the whole word is then > swapped again when loaded. If you just load ((u64)IBMVTPM_VALID_CMD << > 56 |

Re: [tpmdd-devel] ibmvtpm byteswapping inconsistency

2017-02-01 Thread Vicky
> On Jan 26, 2017, at 5:58 PM, Ashley Lai wrote: > > Adding Vicky from IBM. > > > On 01/26/2017 04:05 PM, Jason Gunthorpe wrote: >> On Thu, Jan 26, 2017 at 09:22:48PM +0100, Michal Such??nek wrote: >> >>> This is repeated a few times in the driver so I added memset to

Re: [tpmdd-devel] ibmvtpm byteswapping inconsistency

2017-02-01 Thread Vicky
On Jan 26, 2017, at 5:58 PM, Ashley Lai wrote:Adding Vicky from IBM.On 01/26/2017 04:05 PM, Jason Gunthorpe wrote:On Thu, Jan 26, 2017 at 09:22:48PM +0100, Michal Such??nek wrote:This is repeated a few times in the driver so I added memset to quietgcc and make behavior

Re: [tpmdd-devel] ibmvtpm byteswapping inconsistency

2017-01-30 Thread Tyrel Datwyler
On 01/26/2017 12:22 PM, Michal Suchánek wrote: > Hello, > > building ibmvtpm I noticed gcc warning complaining that second word of > struct ibmvtpm_crq in tpm_ibmvtpm_suspend is uninitialized. > > The structure is defined as > > struct ibmvtpm_crq { > u8 valid; > u8 msg; >

Re: [tpmdd-devel] ibmvtpm byteswapping inconsistency

2017-01-30 Thread Michal Suchanek
On 27 January 2017 at 02:50, Benjamin Herrenschmidt wrote: > On Thu, 2017-01-26 at 17:42 -0800, Tyrel Datwyler wrote: >> On 01/26/2017 12:22 PM, Michal Suchánek wrote: >> > Hello, >> > >> > building ibmvtpm I noticed gcc warning complaining that second word >> > of >> >

Re: [tpmdd-devel] ibmvtpm byteswapping inconsistency

2017-01-30 Thread Michal Suchanek
On 26 January 2017 at 23:05, Jason Gunthorpe wrote: > On Thu, Jan 26, 2017 at 09:22:48PM +0100, Michal Such??nek wrote: > >> This is repeated a few times in the driver so I added memset to quiet >> gcc and make behavior deterministic in case the unused fields get

Re: [tpmdd-devel] ibmvtpm byteswapping inconsistency

2017-01-30 Thread David Laight
From: Tyrel Datwyler > Sent: 27 January 2017 18:03 > On 01/26/2017 05:50 PM, Benjamin Herrenschmidt wrote: > > On Thu, 2017-01-26 at 17:42 -0800, Tyrel Datwyler wrote: > >> On 01/26/2017 12:22 PM, Michal Suchnek wrote: > >>> Hello, > >>> > >>> building ibmvtpm I noticed gcc warning complaining

Re: [tpmdd-devel] ibmvtpm byteswapping inconsistency

2017-01-30 Thread msuchanek
Hello, On 2017-01-27 21:32, Tyrel Datwyler wrote: > On 01/27/2017 11:58 AM, Benjamin Herrenschmidt wrote: >> On Fri, 2017-01-27 at 10:02 -0800, Tyrel Datwyler wrote: The problem is that we are packing an in-memory structure into 2 registers and it's expected that this structure is laid

Re: [tpmdd-devel] ibmvtpm byteswapping inconsistency

2017-01-30 Thread Tyrel Datwyler
On 01/27/2017 01:03 AM, Michal Suchanek wrote: > On 27 January 2017 at 02:50, Benjamin Herrenschmidt > wrote: >> On Thu, 2017-01-26 at 17:42 -0800, Tyrel Datwyler wrote: >>> On 01/26/2017 12:22 PM, Michal Suchánek wrote: Hello, building ibmvtpm I noticed

Re: [tpmdd-devel] ibmvtpm byteswapping inconsistency

2017-01-30 Thread David Laight
From: Michal Suchánek > building ibmvtpm I noticed gcc warning complaining that second word of > struct ibmvtpm_crq in tpm_ibmvtpm_suspend is uninitialized. > > The structure is defined as > > struct ibmvtpm_crq { > u8 valid; > u8 msg; > __be16 len; > __be32 data;

Re: [tpmdd-devel] ibmvtpm byteswapping inconsistency

2017-01-30 Thread Tyrel Datwyler
On 01/26/2017 05:50 PM, Benjamin Herrenschmidt wrote: > On Thu, 2017-01-26 at 17:42 -0800, Tyrel Datwyler wrote: >> On 01/26/2017 12:22 PM, Michal Suchánek wrote: >>> Hello, >>> >>> building ibmvtpm I noticed gcc warning complaining that second word >>> of >>> struct ibmvtpm_crq in

Re: [tpmdd-devel] ibmvtpm byteswapping inconsistency

2017-01-30 Thread Tyrel Datwyler
On 01/29/2017 08:32 PM, Michael Ellerman wrote: > Tyrel Datwyler writes: > >> On 01/27/2017 01:03 AM, Michal Suchanek wrote: >>> On 27 January 2017 at 02:50, Benjamin Herrenschmidt >>> wrote: On Thu, 2017-01-26 at 17:42 -0800, Tyrel

Re: [tpmdd-devel] ibmvtpm byteswapping inconsistency

2017-01-30 Thread Tyrel Datwyler
On 01/27/2017 11:58 AM, Benjamin Herrenschmidt wrote: > On Fri, 2017-01-27 at 10:02 -0800, Tyrel Datwyler wrote: >>> The problem is that we are packing an in-memory structure into 2 >>> registers and it's expected that this structure is laid out in the >>> registers as if it had been loaded by a

Re: [tpmdd-devel] ibmvtpm byteswapping inconsistency

2017-01-27 Thread Benjamin Herrenschmidt
On Fri, 2017-01-27 at 12:32 -0800, Tyrel Datwyler wrote: > Its possible being the end of the week I'm just a little dense, but > wouldn't be64_to_cpu() imply that we are byte-swapping something that is > already, or supposedly already, in BE format to cpu endianness? Which on > a BE cpu I would

Re: [tpmdd-devel] ibmvtpm byteswapping inconsistency

2017-01-27 Thread Benjamin Herrenschmidt
On Fri, 2017-01-27 at 10:02 -0800, Tyrel Datwyler wrote: > > The problem is that we are packing an in-memory structure into 2 > > registers and it's expected that this structure is laid out in the > > registers as if it had been loaded by a BE CPU. > > This is only the case if the cpu is BE. If

Re: [tpmdd-devel] ibmvtpm byteswapping inconsistency

2017-01-26 Thread Benjamin Herrenschmidt
On Thu, 2017-01-26 at 17:42 -0800, Tyrel Datwyler wrote: > On 01/26/2017 12:22 PM, Michal Suchánek wrote: > > Hello, > > > > building ibmvtpm I noticed gcc warning complaining that second word > > of > > struct ibmvtpm_crq in tpm_ibmvtpm_suspend is uninitialized. > > > > The structure is defined

Re: [tpmdd-devel] ibmvtpm byteswapping inconsistency

2017-01-26 Thread Jason Gunthorpe
On Thu, Jan 26, 2017 at 09:22:48PM +0100, Michal Such??nek wrote: > This is repeated a few times in the driver so I added memset to quiet > gcc and make behavior deterministic in case the unused fields get some > meaning in the future. Yep, reserved certainly needs to be zeroed.. Can you send a