From patchwork Wed Jul 4 16:23:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 10507333 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D752F60325 for ; Wed, 4 Jul 2018 16:22:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CA6E028BE1 for ; Wed, 4 Jul 2018 16:22:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BBB0F28D85; Wed, 4 Jul 2018 16:22:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 426DD28BE1 for ; Wed, 4 Jul 2018 16:22:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752173AbeGDQWe (ORCPT ); Wed, 4 Jul 2018 12:22:34 -0400 Received: from mail-vk0-f65.google.com ([209.85.213.65]:45853 "EHLO mail-vk0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752165AbeGDQWd (ORCPT ); Wed, 4 Jul 2018 12:22:33 -0400 Received: by mail-vk0-f65.google.com with SMTP id l64-v6so3369395vkl.12 for ; Wed, 04 Jul 2018 09:22:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=L4tiO6F2PChbFSqpd9q+tESvXhWpCs4A0+aBywvENpo=; b=mBSqBdtTQvJ0ADtdylRDaCW1sFtrBQkKZQiSx0bvRmryjPDPvZ/JGsg+iFuXK/U3nh 1wH21hXoJ/LGVC9ldb4ZVRHQzDQhcLhXWR3cyYa65IYrf66qEOnLeK30lj5nX9793ps+ ej8BPmu5ey1Qf52Efv3LioRuVwbrwi/Azi1fay43LZEqBPHEeRL8TMfHqpkzMwwKAY6u 1AKzSm7b+n8W7Er2OYQhANL9Hq8FkARJlKTLNfGgagV9jGCyrXkcpkiREBOlIBMKwR2S GzHGfFsPB4n/Jqk8aX2M1Vkmq/fpyvMB/mNI9MJav0EseNCCfQecn3e0htpci3t8abik v+tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=L4tiO6F2PChbFSqpd9q+tESvXhWpCs4A0+aBywvENpo=; b=BA4a+I1w57T5zSa9A1Vb9lVWRectKb6I+f4ght8n1eQj+j43+DTY0twqvlDUOx8k4g bAWIQg6tzVamCx2dLuMOsh7fyIgC4qkTHmP3qo7EVKyGGXTppa4dxec3NjwhBk95UFIZ +Kfb7ROErBJyI7ggYZ9pVYo+IpXo2N0H034XQDY9/v7IxZey99JvoWxVKI1X95yZDp9f 0+i0FYhGW9+8hlI00EUv/B5rtpFFGUAac58oHFOKzQoL0d1tAC+Biqg+lPWy9CeMusCV muhFU6LvaC3nD4q1bLd7H8drls2cVdYDVKB0qMJ6CpPoJAflTz8sTHXpJvu/jSNGLBB5 p+dQ== X-Gm-Message-State: APt69E3pnA8MSxrYDT8WBqBkhwNTHX52Y/sZzbl+XCMbH4ILZ3/wambh f+2BmiWzodJEbE3i6sAd2+8= X-Google-Smtp-Source: AAOMgpeu/xEdOv2bEt4tTanArdiik4LXTG276hMOx4S3Xcm8RTtotZeW3VwwoBUAB+yirvAertiygw== X-Received: by 2002:a1f:2606:: with SMTP id m6-v6mr1455248vkm.59.1530721352996; Wed, 04 Jul 2018 09:22:32 -0700 (PDT) Received: from localhost.localdomain ([2804:14c:482:8e7:21ea:4bef:6aab:71bd]) by smtp.gmail.com with ESMTPSA id d198-v6sm973370vkf.36.2018.07.04.09.22.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 04 Jul 2018 09:22:32 -0700 (PDT) From: Fabio Estevam To: akpm@linux-foundation.org Cc: sfr@canb.auug.org.au, horia.geanta@nxp.com, andy.shevchenko@gmail.com, logang@deltatee.com, aymen.sghaier@nxp.com, herbert@gondor.apana.org.au, linux-crypto@vger.kernel.org, Fabio Estevam Subject: [PATCH] Revert "crypto: caam: cleanup CONFIG_64BIT ifdefs when using io{read|write}64" Date: Wed, 4 Jul 2018 13:23:02 -0300 Message-Id: <1530721382-29028-1-git-send-email-festevam@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Fabio Estevam This reverts commit 46e4bf08f6388ba748597275012d715d5e1861e6. Commit 46e4bf08f6388 ("crypto: caam: cleanup CONFIG_64BIT ifdefs when using io{read|write}64") causes kernel crash on imx6 systems: [ 2.041187] caam_jr 2101000.jr0: job ring error: irqstate: 00000103 [ 2.049878] Internal error: Oops - undefined instruction: 0 [#1] SMP ARM [ 2.056591] Modules linked in: [ 2.059671] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.18.0-rc3-next-20180703 #484 [ 2.067338] Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree) [ 2.073892] PC is at caam_jr_interrupt+0x120/0x12c [ 2.078702] LR is at vprintk_emit+0x228/0x43c [ 2.083069] pc : [] lr : [] psr: 60000193 [ 2.089344] sp : c1001d80 ip : c1001be0 fp : c1001da4 [ 2.094576] r10: c107ffe7 r9 : ec749e00 r8 : 0000012d [ 2.099810] r7 : c1001de0 r6 : c17ecc10 r5 : ec7a6010 r4 : 00000103 [ 2.106346] r3 : ba36048e r2 : ba36048e r1 : 00000001 r0 : 00000037 [ 2.112884] Flags: nZCv IRQs off FIQs on Mode SVC_32 ISA ARM Segment none Revert it for now. Signed-off-by: Fabio Estevam Acked-by: Logan Gunthorpe --- drivers/crypto/caam/regs.h | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/drivers/crypto/caam/regs.h b/drivers/crypto/caam/regs.h index 5826acd..4fb91ba 100644 --- a/drivers/crypto/caam/regs.h +++ b/drivers/crypto/caam/regs.h @@ -10,7 +10,7 @@ #include #include -#include +#include /* * Architecture-specific register access methods @@ -136,9 +136,10 @@ 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_imx && caam_little_end) + if (caam_little_end) iowrite64(data, reg); else iowrite64be(data, reg); @@ -146,12 +147,35 @@ static inline void wr_reg64(void __iomem *reg, u64 data) static inline u64 rd_reg64(void __iomem *reg) { - if (!caam_imx && caam_little_end) + if (caam_little_end) return ioread64(reg); else return ioread64be(reg); } +#else /* CONFIG_64BIT */ +static inline void wr_reg64(void __iomem *reg, u64 data) +{ + if (!caam_imx && caam_little_end) { + wr_reg32((u32 __iomem *)(reg) + 1, data >> 32); + wr_reg32((u32 __iomem *)(reg), data); + } else { + wr_reg32((u32 __iomem *)(reg), data >> 32); + wr_reg32((u32 __iomem *)(reg) + 1, data); + } +} + +static inline u64 rd_reg64(void __iomem *reg) +{ + if (!caam_imx && caam_little_end) + return ((u64)rd_reg32((u32 __iomem *)(reg) + 1) << 32 | + (u64)rd_reg32((u32 __iomem *)(reg))); + + return ((u64)rd_reg32((u32 __iomem *)(reg)) << 32 | + (u64)rd_reg32((u32 __iomem *)(reg) + 1)); +} +#endif /* CONFIG_64BIT */ + static inline u64 cpu_to_caam_dma64(dma_addr_t value) { if (caam_imx)