From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751551AbdF1Qvg (ORCPT ); Wed, 28 Jun 2017 12:51:36 -0400 Received: from ale.deltatee.com ([207.54.116.67]:46906 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751579AbdF1QvZ (ORCPT ); Wed, 28 Jun 2017 12:51:25 -0400 To: Arnd Bergmann References: <20170627230204.16410-1-logang@deltatee.com> <20170627230204.16410-4-logang@deltatee.com> From: Logan Gunthorpe Cc: Linux Kernel Mailing List , linux-arch , linux-ntb@googlegroups.com, linux-crypto@vger.kernel.org, Greg Kroah-Hartman , Jyri Sarha , Stephen Bates , =?UTF-8?Q?Horia_Geant=c4=83?= , Dan Douglass , Herbert Xu , "David S. Miller" Message-ID: Date: Wed, 28 Jun 2017 10:51:15 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 172.16.1.111 X-SA-Exim-Rcpt-To: davem@davemloft.net, herbert@gondor.apana.org.au, dan.douglass@nxp.com, horia.geanta@nxp.com, sbates@raithlin.com, jsarha@ti.com, gregkh@linuxfoundation.org, linux-crypto@vger.kernel.org, linux-ntb@googlegroups.com, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, arnd@arndb.de X-SA-Exim-Mail-From: logang@deltatee.com Subject: Re: [PATCH v2 3/3] crypto: caam: cleanup CONFIG_64BIT ifdefs when using io{read|write}64 X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 28/06/17 04:20 AM, Arnd Bergmann wrote: > On Wed, Jun 28, 2017 at 1:02 AM, Logan Gunthorpe wrote: >> #include >> #include >> -#include >> +#include > > Here you include the hi-lo variant unconditionally. > >> -#else /* CONFIG_64BIT */ >> -static inline void wr_reg64(void __iomem *reg, u64 data) >> -{ >> -#ifndef CONFIG_CRYPTO_DEV_FSL_CAAM_IMX >> - if (caam_little_end) { >> - wr_reg32((u32 __iomem *)(reg) + 1, data >> 32); >> - wr_reg32((u32 __iomem *)(reg), data); >> - } else >> #endif >> - { >> - wr_reg32((u32 __iomem *)(reg), data >> 32); >> - wr_reg32((u32 __iomem *)(reg) + 1, data); >> - } >> + iowrite64be(data, reg); >> } > > However, the #else path here uses lo-hi instead. I guess we have > to decide how to define iowrite64be_lo_hi() first: it could > either byteswap the 64-bit value first, then write the two halves, > or it could write the two halves, doing a 32-bit byte swap on > each. Ok, I studied this a bit more: The lo_hi/hi_lo functions seem to always refer to the data being written or read not to the address operated on. So, in the v3 version of this set, which I'm working on, I've defined: static inline void iowrite64_hi_lo(u64 val, void __iomem *addr) { iowrite32(val >> 32, addr + sizeof(u32)); iowrite32(val, addr); } static inline void iowrite64be_hi_lo(u64 val, void __iomem *addr) { iowrite32be(val >> 32, addr); iowrite32be(val, addr + sizeof(u32)); } So the two hi_lo functions match both paths of the #if and thus, I believe, the patch will be correct in v3 without changes. Thanks, Logan