Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754577AbdFWGvW (ORCPT ); Fri, 23 Jun 2017 02:51:22 -0400 Received: from mail-eopbgr00088.outbound.protection.outlook.com ([40.107.0.88]:1488 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754334AbdFWGvU (ORCPT ); Fri, 23 Jun 2017 02:51:20 -0400 From: =?iso-8859-2?Q?Horia_Geant=E3?= To: Logan Gunthorpe , "linux-kernel@vger.kernel.org" , "linux-arch@vger.kernel.org" , "linux-ntb@googlegroups.com" , "linux-alpha@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "linux-crypto@vger.kernel.org" , "dri-devel@lists.freedesktop.org" CC: Arnd Bergmann , Greg Kroah-Hartman , Stephen Bates , "Dan Douglass" , Herbert Xu , "David S. Miller" , Radu Solea , Steve Cornelius Subject: Re: [PATCH 7/7] crypto: caam: cleanup CONFIG_64BIT ifdefs when using io{read|write}64 Thread-Topic: [PATCH 7/7] crypto: caam: cleanup CONFIG_64BIT ifdefs when using io{read|write}64 Thread-Index: AQHS63eF16pIcrQoy0KDlfKD8blWDQ== Date: Fri, 23 Jun 2017 06:51:14 +0000 Message-ID: References: <20170622164817.25515-1-logang@deltatee.com> <20170622164817.25515-8-logang@deltatee.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: deltatee.com; dkim=none (message not signed) header.d=none;deltatee.com; dmarc=none action=none header.from=nxp.com; x-originating-ip: [192.88.146.1] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;VI1PR0401MB2623;7:n+QgPqk0dOri0XWOHzQSaYZsibJnCrAOsDb83EMe+lN79teAoZCiBeuGCcoHaKTWCSguw2Gr0zDOiYsEcfACcPc6IW4qH+0gv7ldZdzQ0a8CS3qW3DdC39jUGBlRC8HnMetb+1EvRAW1PGSEzd/QIk/fj9jM2q+7KTY6hOBFxLXLrUm4EMaHYDM3OeTxVuBKSC6ydfueNi/FMCzGug7+L0NKEqsYahdB1ami7V6ocVIl61uVj/MrH1kLKDQ217bKz7l94ceO8yIejpF+6NNrSjA7OCzRVNqV2ex6Ih2ksgU9DVbKhpfUdnyptaSpORfOyrwvahbDIsmN8FMlveZD2oH4i7n2YKQIZ5VQ9VKNWf7diNpimlFYoMWcdRS8NMrDt6KhRX+iegkAbYVXNq7ov0aybIUztuz/l+ju9qZNpJ8yutpCqH4Rj4w0YBshGFIWrDx9UpWhX9n0/YBzIpkX/qFpC5py3pYQYp0UiK5VNqxXIRLMA54mb61hEEboDaW9gAme//uSoL5itFg7nh403AYIPQsMO+YvE031yxwiIa7OTPufa2e3W6osxtOaNr+oJOkNQGsPGh3MPUEAH9li+a45BZ9tk7D4EB6cmv/2IB4TvNVVre67HqdvdG7LTf10SEdt9oHx7poSVpLTV9m+SFRDL+xwnmhRlYG+/3TM+AzZlu79jHDnSxts83xnJjq5xMBKHahojSDma336C239FXeO1TMcHbLZQrvyOGzhEsAtRsqR3w8EKfUNehoXQXR4TgDnn90uqFmnAVXnbbS9KpsXaJJPAZSx9+Ikh8KHmrU= x-forefront-antispam-report: SFV:SKI;SCL:-1SFV:NSPM;SFS:(10009020)(6009001)(39840400002)(39860400002)(39450400003)(39850400002)(39400400002)(39410400002)(24454002)(377454003)(33656002)(102836003)(3846002)(6116002)(8676002)(8936002)(2501003)(25786009)(53546010)(81166006)(478600001)(14454004)(74316002)(5250100002)(305945005)(7736002)(229853002)(4326008)(9686003)(38730400002)(6246003)(53936002)(7416002)(7696004)(99286003)(189998001)(6436002)(2900100001)(5660300001)(6506006)(3280700002)(3660700001)(76176999)(54906002)(575784001)(2201001)(86362001)(66066001)(54356999)(50986999)(55016002);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR0401MB2623;H:VI1PR0401MB2591.eurprd04.prod.outlook.com;FPR:;SPF:None;MLV:sfv;LANG:en; x-ms-office365-filtering-correlation-id: a8cfa69e-a527-4c2c-9bb7-08d4ba043dad x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(2017030254075)(48565401081)(201703131423075)(201703031133081);SRVR:VI1PR0401MB2623; x-ms-traffictypediagnostic: VI1PR0401MB2623: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(185117386973197); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(5005006)(8121501046)(3002001)(93006095)(93001095)(100000703101)(100105400095)(10201501046)(6055026)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123558100)(20161123555025)(20161123560025)(20161123564025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:VI1PR0401MB2623;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:VI1PR0401MB2623; x-forefront-prvs: 0347410860 spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-2" MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Jun 2017 06:51:14.1787 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0401MB2623 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 quoted-printable to 8bit by mail.home.local id v5N6pcY3004932 Content-Length: 4465 Lines: 141 On 6/22/2017 7:49 PM, Logan Gunthorpe wrote: > Now that ioread64 and iowrite64 are always available we don't > need the ugly ifdefs to change their implementation when they > are not. > Thanks Logan. Note however this is not equivalent - it changes the behaviour, since CAAM engine on i.MX6S/SL/D/Q platforms is broken in terms of 64-bit register endianness - see CONFIG_CRYPTO_DEV_FSL_CAAM_IMX usage in code you are removing. [Yes, current code has its problems, as it does not differentiate b/w i.MX platforms with and without the (unofficial) erratum, but this should be fixed separately.] Below is the change that would keep current logic - still forcing i.MX to write CAAM 64-bit registers in BE even if the engine is LE (yes, diff is doing a poor job). Horia diff --git a/drivers/crypto/caam/regs.h b/drivers/crypto/caam/regs.h index 84d2f838a063..b893ebb24e65 100644 --- a/drivers/crypto/caam/regs.h +++ b/drivers/crypto/caam/regs.h @@ -134,50 +134,25 @@ static inline void clrsetbits_32(void __iomem *reg, u32 clear, u32 set) * base + 0x0000 : least-significant 32 bits * base + 0x0004 : most-significant 32 bits */ -#ifdef CONFIG_64BIT static inline void wr_reg64(void __iomem *reg, u64 data) { +#ifndef CONFIG_CRYPTO_DEV_FSL_CAAM_IMX if (caam_little_end) iowrite64(data, reg); else - iowrite64be(data, reg); -} - -static inline u64 rd_reg64(void __iomem *reg) -{ - if (caam_little_end) - return ioread64(reg); - else - return ioread64be(reg); -} - -#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); } static inline u64 rd_reg64(void __iomem *reg) { #ifndef CONFIG_CRYPTO_DEV_FSL_CAAM_IMX if (caam_little_end) - return ((u64)rd_reg32((u32 __iomem *)(reg) + 1) << 32 | - (u64)rd_reg32((u32 __iomem *)(reg))); + return ioread64(reg); else #endif - return ((u64)rd_reg32((u32 __iomem *)(reg)) << 32 | - (u64)rd_reg32((u32 __iomem *)(reg) + 1)); + return ioread64be(reg); } -#endif /* CONFIG_64BIT */ #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT #ifdef CONFIG_SOC_IMX7D > Signed-off-by: Logan Gunthorpe > Cc: "Horia Geant?" > Cc: Dan Douglass > Cc: Herbert Xu > Cc: "David S. Miller" > --- > drivers/crypto/caam/regs.h | 29 ----------------------------- > 1 file changed, 29 deletions(-) > > diff --git a/drivers/crypto/caam/regs.h b/drivers/crypto/caam/regs.h > index 84d2f838a063..26fc19dd0c39 100644 > --- a/drivers/crypto/caam/regs.h > +++ b/drivers/crypto/caam/regs.h > @@ -134,7 +134,6 @@ static inline void clrsetbits_32(void __iomem *reg, u32 clear, u32 set) > * base + 0x0000 : least-significant 32 bits > * base + 0x0004 : most-significant 32 bits > */ > -#ifdef CONFIG_64BIT > static inline void wr_reg64(void __iomem *reg, u64 data) > { > if (caam_little_end) > @@ -151,34 +150,6 @@ static inline u64 rd_reg64(void __iomem *reg) > return ioread64be(reg); > } > > -#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); > - } > -} > - > -static inline u64 rd_reg64(void __iomem *reg) > -{ > -#ifndef CONFIG_CRYPTO_DEV_FSL_CAAM_IMX > - if (caam_little_end) > - return ((u64)rd_reg32((u32 __iomem *)(reg) + 1) << 32 | > - (u64)rd_reg32((u32 __iomem *)(reg))); > - else > -#endif > - return ((u64)rd_reg32((u32 __iomem *)(reg)) << 32 | > - (u64)rd_reg32((u32 __iomem *)(reg) + 1)); > -} > -#endif /* CONFIG_64BIT */ > - > #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT > #ifdef CONFIG_SOC_IMX7D > #define cpu_to_caam_dma(value) \ >