From: Vicky Subject: Re: ibmvtpm byteswapping inconsistency Date: Wed, 1 Feb 2017 23:24:59 -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: multipart/mixed; boundary="===============0704040871455890523==" 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 --===============0704040871455890523== Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=windows-1252
On Jan 26, 2017, at = 5:58 PM, Ashley Lai <ashleydlai-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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]),
=             &n= bsp;           &nbs= p;    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



Please = refer to commit = 62dfd912ab3b5405b6fe72d0135c37e9648071f1


Vicky
= --===============0704040871455890523== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot --===============0704040871455890523== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ tpmdd-devel mailing list tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org https://lists.sourceforge.net/lists/listinfo/tpmdd-devel --===============0704040871455890523==--