From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751941AbdBBPRa (ORCPT ); Thu, 2 Feb 2017 10:17:30 -0500 Received: from smtp-out6.electric.net ([192.162.217.183]:59367 "EHLO smtp-out6.electric.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750876AbdBBPR2 (ORCPT ); Thu, 2 Feb 2017 10:17:28 -0500 From: David Laight To: =?utf-8?B?J01pY2hhbCBTdWNow6FuZWsn?= , Vicky CC: Nayna Jain , Marcel Selhorst , "linux-kernel@vger.kernel.org" , Jarkko Sakkinen , Jason Gunthorpe , "tpmdd-devel@lists.sourceforge.net" , Paul Mackerras , Ashley Lai , Peter Huewe , "linuxppc-dev@lists.ozlabs.org" Subject: RE: ibmvtpm byteswapping inconsistency Thread-Topic: ibmvtpm byteswapping inconsistency Thread-Index: AQHSfUel8lHqrdS2Gkm+aOCXywnIf6FV1AMQ Date: Thu, 2 Feb 2017 15:17:19 +0000 Message-ID: <063D6719AE5E284EB5DD2968C1650D6DB0278B33@AcuExch.aculab.com> References: <20170126212248.3f3e9103@kitsune.suse.cz> <20170126220536.GB31937@obsidianresearch.com> <024dadba-a75c-ab59-9d12-a9bea81f9bda@gmail.com> <20170202122942.7fd9988d@kitsune.suse.cz> In-Reply-To: <20170202122942.7fd9988d@kitsune.suse.cz> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.202.99.200] Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 X-Outbound-IP: 213.249.233.130 X-Env-From: David.Laight@ACULAB.COM X-Proto: esmtps X-Revdns: X-HELO: AcuExch.aculab.com X-TLS: TLSv1:AES128-SHA:128 X-Authenticated_ID: X-PolicySMART: 3396946, 3397078 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id v12FHX7H005458 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 | ((u64)VTPM_TPM_COMMAND << 48) | ((u64)count << 32) | > ibmvtpm->rtce_dma_handle in a register it works equally well > without any __be and swaps involved. And that version will almost certainly generate much better code. David