From: Vicky Subject: Re: ibmvtpm byteswapping inconsistency Date: Wed, 1 Feb 2017 23:40:33 -0500 Message-ID: References: <20170126212248.3f3e9103@kitsune.suse.cz> <20170126220536.GB31937@obsidianresearch.com> <024dadba-a75c-ab59-9d12-a9bea81f9bda@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <024dadba-a75c-ab59-9d12-a9bea81f9bda-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: tpmdd-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org To: Ashley Lai Cc: Benjamin Herrenschmidt , linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org, Paul Mackerras , Michael Ellerman , Michal Such??nek , linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org List-Id: tpmdd-devel@lists.sourceforge.net > 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 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 patch? >> memset is overkill... >> = >>> However, in tpm_ibmvtpm_send the structure is initialized as >>> = >>> struct ibmvtpm_crq crq; >>> __be64 *word =3D (__be64 *)&crq; >>> ... >>> crq.valid =3D (u8)IBMVTPM_VALID_CMD; >>> crq.msg =3D (u8)VTPM_TPM_COMMAND; >>> crq.len =3D cpu_to_be16(count); >>> crq.data =3D cpu_to_be32(ibmvtpm->rtce_dma_handle); >>> = >>> and submitted with >>> = >>> rc =3D ibmvtpm_send_crq(ibmvtpm->vdev, be64_to_cpu(word[0]), >>> be64_to_cpu(word[1])); >>> meaning it is swapped twice. >> No idea, Nayna may know. >> = >> My guess is that '__be64 *word' should be 'u64 *word'... >> = >> Jason > = I don=92t think we want =91word' to be changed back to be of type =91u64=92= . Please see commit 62dfd912ab3b5405b6fe72d0135c37e9648071f1 Vicky ---------------------------------------------------------------------------= --- Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot