From patchwork Tue Jul 3 23:57:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Logan Gunthorpe X-Patchwork-Id: 10505667 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 0D4E86035E for ; Tue, 3 Jul 2018 23:58:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F3337289EF for ; Tue, 3 Jul 2018 23:58:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E762B289F8; Tue, 3 Jul 2018 23:58:19 +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=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=unavailable 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 A5359289EF for ; Tue, 3 Jul 2018 23:58:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752916AbeGCX6H (ORCPT ); Tue, 3 Jul 2018 19:58:07 -0400 Received: from ale.deltatee.com ([207.54.116.67]:37892 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752387AbeGCX6G (ORCPT ); Tue, 3 Jul 2018 19:58:06 -0400 Received: from s0106602ad0811846.cg.shawcable.net ([68.147.191.165] helo=[192.168.0.18]) by ale.deltatee.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1faVBF-0003lq-MD; Tue, 03 Jul 2018 17:57:58 -0600 To: Andy Shevchenko Cc: Fabio Estevam , Andrew Morton , linux-kernel , Linux-Arch , linux-ntb@googlegroups.com, "open list:HARDWARE RANDOM NUMBER GENERATOR CORE" , Arnd Bergmann , Greg Kroah-Hartman , =?UTF-8?Q?Horia_Geant=c4=83?= , Dan Douglass , Herbert Xu , "David S. Miller" References: <20180622194752.11221-1-logang@deltatee.com> <20180622194752.11221-7-logang@deltatee.com> <13ea3f97-4a33-3a24-1b7e-b819be73d867@deltatee.com> <6e5224b9-343f-990c-19bd-fe37c6fbdc9b@deltatee.com> <7ddda181-6337-32cc-7a0d-43fc6a7ba78b@deltatee.com> From: Logan Gunthorpe Message-ID: <991b2298-bb3f-dad3-c93b-b43ee5f372de@deltatee.com> Date: Tue, 3 Jul 2018 17:57:55 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-SA-Exim-Connect-IP: 68.147.191.165 X-SA-Exim-Rcpt-To: davem@davemloft.net, herbert@gondor.apana.org.au, dan.douglass@nxp.com, horia.geanta@nxp.com, gregkh@linuxfoundation.org, arnd@arndb.de, linux-crypto@vger.kernel.org, linux-ntb@googlegroups.com, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, festevam@gmail.com, andy.shevchenko@gmail.com X-SA-Exim-Mail-From: logang@deltatee.com Subject: Re: [PATCH v18 6/7] crypto: caam: cleanup CONFIG_64BIT ifdefs when using io{read|write}64 X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) 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 On 03/07/18 04:21 PM, Andy Shevchenko wrote: > It is an explicit call to BUG(). > That's why we see wrong instruction trap. Ok, I think I see the problem... the code is rather confusing: Prior to the patch, IOs were BE depending on caam_little_end but if caam_imx was set, then it wrote two LE writes with the high one first. After the patch, it writes two BE writes with the high one first. To confirm, can you try the patch below? If this is the case, we can either revert the commit or fold in this patch depending on what others think is clearer. Thanks, Logan --- static inline u64 rd_reg64(void __iomem *reg) diff --git a/drivers/crypto/caam/regs.h b/drivers/crypto/caam/regs.h index 5826acd9194e..5f70c460da25 100644 --- a/drivers/crypto/caam/regs.h +++ b/drivers/crypto/caam/regs.h @@ -138,10 +138,14 @@ static inline void clrsetbits_32(void __iomem *reg, u32 clear, u32 set) */ static inline void wr_reg64(void __iomem *reg, u64 data) { - if (!caam_imx && caam_little_end) + if (caam_imx && caam_little_end) { + iowrite32(data >> 32, reg); + iowrite32(data, reg + sizeof(u32)); + } else if (caam_little_end) { iowrite64(data, reg); - else + } else { iowrite64be(data, reg); + } }