Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1673301
| Path | csiph.com!news.redatomik.org!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Horia Geantă <horia.geanta@nxp.com> |
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 7/7] crypto: caam: cleanup CONFIG_64BIT ifdefs when using io{read|write}64 |
| Date | Fri, 23 Jun 2017 09:00:01 +0200 |
| Message-ID | <tVqJr-7bI-3@gated-at.bofh.it> (permalink) |
| References | <tVdsS-7hT-17@gated-at.bofh.it> <tVdCA-7lD-63@gated-at.bofh.it> |
| Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=vWU3Fk2SPQ9PG+RH5A3DCcAYxgRiJfhbR+HHWBicRW8=; b=JxmV/lsw3OM2oj+Anu9lz3csVqSQPfqBmnDqNUkfqJ/QVIOXtW7FnRSgiyQ9wirX/+KIXEqbqOP418+MUI0mNiUBBm+vR3GoSQWCDJOGyqby7OpEakZHX1mUfmnf8wJHkfNBJAPPkygo0HqAncw962rEr428SLR5TMeOD+VtIsU= |
| Thread-Topic | [PATCH 7/7] crypto: caam: cleanup CONFIG_64BIT ifdefs when using io{read|write}64 |
| Thread-Index | AQHS63eF16pIcrQoy0KDlfKD8blWDQ== |
| Accept-Language | en-US |
| Content-Language | en-US |
| 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 | |
| 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 | <VI1PR0401MB2623CABBF1D09697AF924E4298D80@VI1PR0401MB2623.eurprd04.prod.outlook.com> |
| 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" |
| Content-Transfer-Encoding | quoted-printable |
| 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 | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 142 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | Arnd Bergmann <arnd@arndb.de>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Stephen Bates <sbates@raithlin.com>, "Dan Douglass" <dan.douglass@nxp.com>, Herbert Xu <herbert@gondor.apana.org.au>, "David S. Miller" <davem@davemloft.net>, Radu Solea <radu.solea@nxp.com>, Steve Cornelius <steve.cornelius@nxp.com> |
| X-Original-Date | Fri, 23 Jun 2017 06:51:14 +0000 |
| X-Original-Message-ID | <VI1PR0401MB259182B9B11B72B4B53B2C1498D80@VI1PR0401MB2591.eurprd04.prod.outlook.com> |
| X-Original-References | <20170622164817.25515-1-logang@deltatee.com> <20170622164817.25515-8-logang@deltatee.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1673301 |
Show key headers only | View raw
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 <logang@deltatee.com>
> Cc: "Horia Geantă" <horia.geanta@nxp.com>
> Cc: Dan Douglass <dan.douglass@nxp.com>
> Cc: Herbert Xu <herbert@gondor.apana.org.au>
> Cc: "David S. Miller" <davem@davemloft.net>
> ---
> 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) \
>
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 7/7] crypto: caam: cleanup CONFIG_64BIT ifdefs when using io{read|write}64 Logan Gunthorpe <logang@deltatee.com> - 2017-06-22 19:00 +0200
Re: [PATCH 7/7] crypto: caam: cleanup CONFIG_64BIT ifdefs when using io{read|write}64 Horia Geantă <horia.geanta@nxp.com> - 2017-06-23 09:00 +0200
Re: [PATCH 7/7] crypto: caam: cleanup CONFIG_64BIT ifdefs when using io{read|write}64 Logan Gunthorpe <logang@deltatee.com> - 2017-06-23 20:00 +0200
csiph-web