From patchwork Thu Sep 29 14:17:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 9356771 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 AFFA16077A for ; Thu, 29 Sep 2016 16:50:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9FD1429B02 for ; Thu, 29 Sep 2016 16:50:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 90CE129BC9; Thu, 29 Sep 2016 16:50:11 +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=-6.9 required=2.0 tests=BAYES_00,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 61EEF29BB9 for ; Thu, 29 Sep 2016 16:50:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933765AbcI2QuI (ORCPT ); Thu, 29 Sep 2016 12:50:08 -0400 Received: from mail-cys01nam02on0060.outbound.protection.outlook.com ([104.47.37.60]:34112 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933968AbcI2QuH (ORCPT ); Thu, 29 Sep 2016 12:50:07 -0400 X-Greylist: delayed 9126 seconds by postgrey-1.27 at vger.kernel.org; Thu, 29 Sep 2016 12:50:07 EDT Received: from BN6PR03CA0055.namprd03.prod.outlook.com (10.173.137.17) by DM5PR03MB2444.namprd03.prod.outlook.com (10.168.233.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.639.5; Thu, 29 Sep 2016 14:17:35 +0000 Received: from BL2FFO11FD039.protection.gbl (2a01:111:f400:7c09::197) by BN6PR03CA0055.outlook.office365.com (2603:10b6:404:4c::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.639.5 via Frontend Transport; Thu, 29 Sep 2016 14:17:35 +0000 Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none; nxp.com; dmarc=fail action=none header.from=nxp.com; nxp.com; dkim=none (message not signed) header.d=none; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Received: from az84smr01.freescale.net (192.88.158.2) by BL2FFO11FD039.mail.protection.outlook.com (10.173.161.135) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.629.5 via Frontend Transport; Thu, 29 Sep 2016 14:17:33 +0000 Received: from enigma.ea.freescale.net (enigma.ea.freescale.net [10.171.77.120]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id u8TEHU6k013797; Thu, 29 Sep 2016 07:17:30 -0700 From: Tudor Ambarus To: , CC: , , Tudor Ambarus Subject: [PATCH] crypto: caam - treat SGT address pointer as u64 Date: Thu, 29 Sep 2016 17:17:27 +0300 Message-ID: <1475158647-16094-1-git-send-email-tudor-dan.ambarus@nxp.com> X-Mailer: git-send-email 1.8.3.1 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131196322554834399; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.158.2; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(36756003)(97736004)(105606002)(106466001)(86362001)(5660300001)(5001770100001)(626004)(104016004)(50226002)(5003940100001)(6666003)(189998001)(11100500001)(356003)(8936002)(50466002)(48376002)(305945005)(92566002)(229853001)(8666005)(68736007)(77096005)(33646002)(7846002)(8676002)(81156014)(81166006)(87936001)(19580395003)(85426001)(47776003)(69596002)(19580405001)(50986999)(2906002)(4326007)(586003)(7059030)(2101003)(4720700001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR03MB2444; H:az84smr01.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD039; 1:KaCC+J1ujSC0rAYEEKJmGSIdBIsLQU7zo+y79SMGpwKknP+m+BOitiieWB+ceXahNhiHQ3TJTwS9pa6t7BJH6VkIB1a2mUQzAeSQF1AC6n5zgN38pf5WQJ1vgKbnwyDxPfLrc3EmRXj0JlT8//dctP+0g8Pd2POuCryZ6Cyez5oBaghbfzCCNFbrNCLTG5tj3HKbHLom4rO5QGxCos55VjAEVdkcwUFubtqaySPeGNjxbPfzYeLZ2NzUYrr0jYeNAZL/cW4fYMOrv2RbcvPe3Ei0JCuj6rLYYgD0mhGPr+DeYLWMgpJBraIzPzKVLoTBhEOQsnOMQXIHXdgoZeVgFIpJEhSuaNchrDofmlBpbHLFGcJ/W7rWVxzEC290IiJeN1aLmcIk4mBpZEKp2EiajosUB3WjHjTMTsirqk9LglX31AshBpu4nZLNy7NCgYmavxZVsLhYNCDqUn4YnrctWP1FdeowJZDUHDtl8kvpsi35Og5UUYsskFbW6Ag9ReI2s2JDOVILFzFy0KYPIiBeF3f+HM9d5fUsKvtNBaxGgl0CtJK1ORHKeXn1Jm+YUUtVEmRDkMDuzkpsY1XuP96baqMqBF1A1josmAMc6Hl5aYH0IHgvJNzTGxfajGA46a1ccRUWoGrZSBuA1O6yHu6N013LWWBNn3gbFR1CruqlW5tnmHETC2PyiAcMk5ZdDaPv MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 2083eee0-ca4d-47b0-8c80-08d3e8735c2c X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2444; 2:rapIrX97uYwzYiHosncbg1qRyebdzpP84ZBnqYiM+7OqWTNVHrJwh5kPxHN5YZ1TZ0s8gOVQ9JgUsDB77M+Na83wWGOyAqb0fdBhnMNudxMenxkkXfXDaSAgABCUgpJob0GTP+RfGOCRRLRbU/Ik6Kuem1bpbPH6QdPjs6rOJFbi54L1a7wMsCyQTPB9HhRW; 3:0KW2FKN1mVpdjSl2MGcf8FV4xY735q7TwedVVe3LlJk1XjcCNrP8Y6dtvRAbz2aBjnS52VlGIHnESQvZLtB/MoPmegQW2fadsTsoULWVEHzitDjJ48ysDJekTDYb82ybPKt6fJMFv7MEQ8Zws50daQ7xZCE0Omov4hl7Pw3RI+FRYVBiyWHFil81rCvaML5q5OBV2qiaJxZ3tML4ohXLIryjCNUQd8vj1yqW02xJIVE= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DM5PR03MB2444; X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2444; 25:tx9T81/D8XVdDrUfxzAbkJrdO//Bzw57RLkUEl0Nq0WsjWnItv+c2UMbTHlDUJ2RXKfP0zfAatFoAVdcOhmgwhr0IVJvQtPuGLpWY35LOWcv5RPFU47ePaQXNlxzncSNTbpUleEhg1ceufMr//RpdRZ6SsG6udSvkqOpF6GKFEUskQ6WOSam90IGEUJtExo4TeaY8KnyPd4UpdQPFNwEvGghf61ZplA1pxonlWfUMrS3PhlcY0ShAuNgSEEOBqUBkv5Rzoyj5Wv099Jj37UHXAmvq6/4JWJtX4wPOCbMDEcmyHKFW5ksm7+/KlGKMGipW3N0jfKRNIHk6rE/VjJ2eziLdErqgdt+QHZp7JLIYFYJA0nWQvNq6pNvzxw0tg0nb4LaXP2a6xTlc2psXlAxbUwxAkDFqNP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ZMcDF2QlV+qkmp2W3vBg+l3YEYniG3SJA7qlihwYTDpwRY8tectk/YdeaiSsM377sYcGQnjbwayK8O5hfuvImosZunqL2Q6bqA= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(5005006)(13023025)(13015025)(13017025)(13024025)(13018025)(8121501046)(3002001)(10201501046)(6055026); SRVR:DM5PR03MB2444; BCL:0; PCL:0; RULEID:(400006); SRVR:DM5PR03MB2444; X-Forefront-PRVS: 00808B16F3 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR03MB2444; 23:c3Fb011HMmFrR3UuNNmI+kslLMf1a+b7nCQkn1Par?= =?us-ascii?Q?QrOiA/fQNVdOZ2xuol2jfZlDxLc3Vr6TNHCaeu+zpAm/g6iUg0mr94ciT0CD?= =?us-ascii?Q?A4NpWA2un6u/02bHTkVR21SvxvDHfAdyjH92r1hic81EfJ8ln6gtnB2nGyWN?= =?us-ascii?Q?WErUZh/Oh7776d0VmbIKYrH+Dz4/H4GYU5t8qTBc90qrwMwFA2leYxWXX3ZY?= =?us-ascii?Q?HJcDR35w8pWgao+NEBuQLWSqBzwIDYZ68//HzwFAN4wFS8j09sEKEN89e5oh?= =?us-ascii?Q?mxE9Gh+MINe6EQqM4lLig1w/FdBvj2X5dEJ3SQsRaxIGz5+SJiFPTRHOry4N?= =?us-ascii?Q?bDEThEHyWDPY4jDk1HkRLnLMwNAK3cGGowrYWAcECXbJ5+8KSKLh7pHOU9Vf?= =?us-ascii?Q?dJ70OZ5nweaNQvQFpYKQyJZKG4gRegRIDYZUhBASz9iWJUqIDkhMvZfA+JMe?= =?us-ascii?Q?sLWcTsfFr3I8+xUANymg0NyqguJhrFkWIZFu1HSFnMolB2DaLVGF/CCrdqk7?= =?us-ascii?Q?Ds5LN/4v9Jbeec7veCD9YZYkqLWbhtabN6NN+iJ82yVgWtab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rVwdMzdw7wyfdUPO/r2qmuOfwaC/S0mp8c45gLQIbkUcAUWyKurfjYncjTreqz5WNQF4KwvUV68=; 5:M7EL41RPFA6EvI2vsrT0RnsniCP0ey+HSzVfirLYwoJL7Ud3961ALD8EVtjPk7+m/cKKi3ZFt+HoALWBrxfjrR0LS/dDjZlBxEV6syzfa4s2NDaVIlX1Qf+lK1YJjbULEvZr3xHAhIkqxWSTvKt4ELU9nRqKSYLZ4+ZihSWXR+o=; 24:n2FnV7p4jGCiuvm9dGkBTYU9wMmkwx6TF33+LP63OxBUz4c0eMLtmH4bOIykUSLXr9NjsCgh14VFIRFBM16rhkKzmGnK2XJMJJhzMWs3PaQ=; 7:I+EstVGHwoORJXDnTn7beMrdo7YRMnutliXwHDJPkfN8C9rCIXkx+95sEqUispefitmSs34f74Prj0udgzCULzsTIN82yKNuq/Ut7qr/6vADCSgJ6Bg1mDCjeufYUtLx9jXuDkF3b/n2Z/BINkFR4i14zg93LB0eFU2rpTSTkoKHfrFVdA5GJFVIG7nq5Pw0qMaPEMHKUf1uILkEm1CR5/cnkOJ0GzjzKYSOVTon5Vc3dk/7b5sQrLgC07EfrA4VsabanvW+H2Bblwj3prDHMHkTnkNirJZHdIcBWTU2xIEPJV/yb2V2K2rwmrtQfwmJ SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Sep 2016 14:17:33.5022 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.158.2]; Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR03MB2444 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 Even for i.MX, CAAM is able to use address pointers greater than 32 bits, the address pointer field being interpreted as a double word. Enforce u64 address pointer in the sec4_sg_entry struct. This patch fixes the SGT address pointer endianness issue for 32bit platforms where core endianness != caam endianness. Signed-off-by: Tudor Ambarus --- drivers/crypto/caam/desc.h | 6 ------ drivers/crypto/caam/regs.h | 8 ++++++++ drivers/crypto/caam/sg_sw_sec4.h | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/crypto/caam/desc.h b/drivers/crypto/caam/desc.h index 26427c1..513b664 100644 --- a/drivers/crypto/caam/desc.h +++ b/drivers/crypto/caam/desc.h @@ -23,13 +23,7 @@ #define SEC4_SG_OFFSET_MASK 0x00001fff struct sec4_sg_entry { -#if !defined(CONFIG_ARCH_DMA_ADDR_T_64BIT) && \ - defined(CONFIG_CRYPTO_DEV_FSL_CAAM_IMX) - u32 rsvd1; - dma_addr_t ptr; -#else u64 ptr; -#endif /* CONFIG_CRYPTO_DEV_FSL_CAAM_IMX */ u32 len; u32 bpid_offset; }; diff --git a/drivers/crypto/caam/regs.h b/drivers/crypto/caam/regs.h index b3c5016..effbdd8 100644 --- a/drivers/crypto/caam/regs.h +++ b/drivers/crypto/caam/regs.h @@ -196,6 +196,14 @@ static inline u64 rd_reg64(void __iomem *reg) #define caam_dma_to_cpu(value) caam32_to_cpu(value) #endif /* CONFIG_ARCH_DMA_ADDR_T_64BIT */ +#ifdef CONFIG_SOC_IMX7D +#define cpu_to_caam_dma64(value) \ + (((u64)cpu_to_caam32(lower_32_bits(value)) << 32) | \ + (u64)cpu_to_caam32(upper_32_bits(value))) +#else +#define cpu_to_caam_dma64(value) cpu_to_caam64(value) +#endif + /* * jr_outentry * Represents each entry in a JobR output ring diff --git a/drivers/crypto/caam/sg_sw_sec4.h b/drivers/crypto/caam/sg_sw_sec4.h index 19dc64f..41cd5a3 100644 --- a/drivers/crypto/caam/sg_sw_sec4.h +++ b/drivers/crypto/caam/sg_sw_sec4.h @@ -15,7 +15,7 @@ struct sec4_sg_entry; static inline void dma_to_sec4_sg_one(struct sec4_sg_entry *sec4_sg_ptr, dma_addr_t dma, u32 len, u16 offset) { - sec4_sg_ptr->ptr = cpu_to_caam_dma(dma); + sec4_sg_ptr->ptr = cpu_to_caam_dma64(dma); sec4_sg_ptr->len = cpu_to_caam32(len); sec4_sg_ptr->bpid_offset = cpu_to_caam32(offset & SEC4_SG_OFFSET_MASK); #ifdef DEBUG