From patchwork Mon Jun 15 23:52:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Victoria Milhoan X-Patchwork-Id: 6612591 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Original-To: patchwork-linux-crypto@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4A1B1C0020 for ; Tue, 16 Jun 2015 00:26:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6A487207C9 for ; Tue, 16 Jun 2015 00:26:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 82927207B1 for ; Tue, 16 Jun 2015 00:26:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751062AbbFPA0f (ORCPT ); Mon, 15 Jun 2015 20:26:35 -0400 Received: from mail-bl2on0101.outbound.protection.outlook.com ([65.55.169.101]:22978 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750730AbbFPA0e (ORCPT ); Mon, 15 Jun 2015 20:26:34 -0400 Received: from BN3PR0301CA0002.namprd03.prod.outlook.com (10.160.180.140) by BLUPR03MB392.namprd03.prod.outlook.com (10.141.78.28) with Microsoft SMTP Server (TLS) id 15.1.195.6; Mon, 15 Jun 2015 23:53:10 +0000 Received: from BL2FFO11FD013.protection.gbl (2a01:111:f400:7c09::171) by BN3PR0301CA0002.outlook.office365.com (2a01:111:e400:4000::12) with Microsoft SMTP Server (TLS) id 15.1.190.14 via Frontend Transport; Mon, 15 Jun 2015 23:53:10 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=freescale.com; freescale.mail.onmicrosoft.com; dkim=none (message not signed) header.d=none; Received-SPF: Fail (protection.outlook.com: domain of freescale.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BL2FFO11FD013.mail.protection.outlook.com (10.173.160.221) with Microsoft SMTP Server (TLS) id 15.1.190.9 via Frontend Transport; Mon, 15 Jun 2015 23:53:09 +0000 Received: from stc-hedley.am.freescale.net (stc-hedley.am.freescale.net [10.67.70.12]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id t5FNr7p0003741; Mon, 15 Jun 2015 16:53:09 -0700 From: Victoria Milhoan To: CC: , , Subject: [PATCH RFC 05/11] crypto: caam - Add cache coherency support to Freescale CAAM scatterlist implementation Date: Mon, 15 Jun 2015 16:52:53 -0700 Message-ID: <1434412379-11623-6-git-send-email-vicki.milhoan@freescale.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1434412379-11623-1-git-send-email-vicki.milhoan@freescale.com> References: <1434412379-11623-1-git-send-email-vicki.milhoan@freescale.com> X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD013; 1:mUoQyLRvz/XKCS55yEh4YZtAXqzQlIynzNAwJNqsG4831BRd3g6nTX/BpEKCXy6DdSWlUDyhvtM02RqH7a6y7t12i5iIeWFAvUw+bNBFykrHsq2i4E/O5mvTrHh1kgzfMjqcUQs+l9DfGXgpscWctoAp3/kjhaEJWngzoJSCiB9fQy13Gg1jB90x8kBuiI+mtLM1WgTshTduwS4E6cdjTKYpznNos/MC9KUjTQCRcLFfSKdKJxmbra25VOG6mrCsNkFUnolwUFp1HsTXOPYlfOnCOS/Y48JCr1eqLxECJ0qxF+1QyISxkODbCkfMTHO0DJCjRJGFLmPdOnCJGHUPfH4AwIYf6MExaBZaD69z9TM= X-Forefront-Antispam-Report: CIP:192.88.168.50; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(339900001)(189002)(199003)(76176999)(104016003)(19580405001)(50986999)(106466001)(86362001)(2351001)(87936001)(33646002)(229853001)(6806004)(47776003)(62966003)(77156002)(50226001)(19580395003)(2950100001)(36756003)(46102003)(107886002)(85426001)(77096005)(5001960100002)(92566002)(50466002)(105606002)(48376002)(189998001)(110136002)(217873001)(4001430100001); DIR:OUT; SFP:1102; SCL:1; SRVR:BLUPR03MB392; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; MLV:sfv; MX:1; A:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Exchange-Diagnostics: 1; BLUPR03MB392; 2:K2CktEUW/GF9IRCabM0KT7B7/AB5/f1OhCd2kiztp4ludR7erecmaMuPaNZVQ4kB; 3:YniX0luE/3gOaLU0grcKbHdPL3g134NBDV7AZuqjLHUA4Y/H33Bw76OJhoSmK5d6bB9ClmwcLJlS9KtRtCnvXgQ73+T77HsLJ45EjqEMDVIi1t0RqNeSwkMLjNqjo7l6D0kzBGQtwu4Y7uB4sOXH92EUcXWs2g0+mMpLpSp7fKtch1rtbsRN0vf+mFTJ/zbvNBGLzgqJ18IGOb33nvMZNycAq9KeyRyr72YQZghocuA=; 20:F9ftfSCRiWGV7n6nrAjZXfRX5oroiJC7Dix+Dq5fkrA8kQ7RVkPOLfpBTJW/Hv/DEQTyZ/OpQlYBfLPDL0wqGB5ELxkCe+51KZbg5n4Z6Pqj9TBhNe6hiuT2LHMir5Yz1rrWZu89fcxkkmwAKNbI3jb69heUl9+AL5xaFe5lFDCGC0L6weIphGbmL73twNvOwp2vyen/Mdf/lwZfSuBhM0HTKATVKrQIsvsUGKIDdJTYi3h/3oYzcf2Ek/AeMvcnaF2ILKEATpmiSxzf901vdVpKER32ZSHHvVyAVJv/yR0MdmyLodfHUMcLJtHgMvMAsOmc5KWkNxNAS3BHJyMnN9JRM7uor0iCVY0O4svmi6w=; 4:UtyiAvdjTjU3CrUONuJgS73kw+tkmqi57FWWhyWhPTHkvbk1BTs+GWfut2Egtfc8OhWEBWSgpbzeTWnPI6sBHgG1bixIgfKqinLyIQe4cpPmtBakJzaA3XffPKSQlU/ZHflSkgeu9yjkLRgXWxJGO2+jvOECdQ7YMsd7Ype08ZnMFyuFBj0no6fAASpIjVsECf+suQWhh12tVnCHq7DZssKCZ3PWNNwdEpdEU2B5dorgHUHRLBHP+dRttXrADhVmbUk2+Qbak eL+EejYxLld9X54gBeLey6QOJ6qRr73rcc= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR03MB392; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5005006)(3002001); SRVR:BLUPR03MB392; BCL:0; PCL:0; RULEID:; SRVR:BLUPR03MB392; X-Forefront-PRVS: 0608DEDB67 X-Microsoft-Exchange-Diagnostics: 1; BLUPR03MB392; 23:aNkuBldeRSa8WgRzVx/mFcEqcR5GNRNrp4Hb6WlotjVsNtrqcNaCqK/NRQDaA72Ssqfrq0TuF3KXU1kxHtxOT9Id7UqewKvFTsYMmI6zk6+SuQ1TNGNjQ5V2C3Wo5rBgbAPbuQRZcreK3DU8RGda925NCAJwXmv3JiyJQcbpJ1pprqXYIyG5TkFfCEk50pKceNM7MXZj0w3oc/b75IIta2WWsxgYTx0xxaVv3KBw0wLzK4w1tU0HggzNxp+v6dFotW5YuS6R3yukcTD0xah0R2H3xbbFYilJI37Tsxrucfj2xZN9s9dtttKa+JmP2+LhpCfBqkC3vdjc+oQUM5umFCCAim1axfNTSz/63/cj3vDP2EtMbwyCm2rZBZ30V4bH801aWu/zL5CZYo1drMy2NQCEMg5vvkz8+1JdE+ZctE8pwoBcdht7iBbZeNOAuobiXCR7fKGMcvDhn45wRA0SPxPZO2q5CfYwYrZ7lw0sGJwh9AcdZdEtLfOHFUSjUBsuBNYJT/UG97I4Kxg/MldB0OjvGezv4qntA4X5RduiF+EvcNATykBR/HRxmkQl6o7e3nOelmKHf9skS417vumJfFG+DOqEgZFoYNbSaGVHNS7D4BxNfeouoS0zby5F9YiP4mF1r9eJ4hkL7akp6rpyGgbBF9ukEdxYTDfnRf3aJNhyUo0C/QQObCX9WK1jyhPDif4UZGLf8v7w3erqGDFJ1SEf7GqqWHX0fZlUBIirsnATub4N8tjg4qDGX/FsTTjhoET67G7DFeAqkUfSrf2l0RqXpLWGGkp+SmLgSeHPvHPjs5evSaoSgTAA3z7fuXbbzqisRTqNZys0OZxD5GvreOWEAo8PBAA2NuGeZJ8w9xSgIqvS+iYVmiwvk9n9NPck6E3Rh1xctnP4diZnZCIRTWwsb+kCC05B/VZ2P1qKTw w= X-Microsoft-Exchange-Diagnostics: 1; BLUPR03MB392; 5:T0dRTc9ePBNRklqjKZqDaZsuBD0wkoV/B5hG7LuL5c6WEv4ErLu1hW2ywT9YQVAmlIH0K4U/pc+8baRigOcXKZTsASmjKwkvvgjVdAwswXnIYkM18dSGZ6hMohKhippcoD38W9hGtnxDs+Gy1wxO8w==; 24:VMUyRChu1yI6nhZ6w9gUUJDYx+CUK+HCkFpglg2DTTxgi+R3sD1vi/NtIJbyZMHo1ZPwxYa9cg3ReQYNwXTScH1GZwx8donfJMVyiUKxSBQ=; 20:6IH0SBuM3qHbrKR4tZhk6MxocPMwyU8UNyGBeH87tkPhPhsxrkwL2vevJioT1n+BwiLpzYdAnGzbhUHVIyxqSw== X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2015 23:53:09.7872 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR03MB392 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add cache coherency support to the CAAM scatterlist implementation. Signed-off-by: Victoria Milhoan --- drivers/crypto/caam/sg_sw_sec4.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/caam/sg_sw_sec4.h b/drivers/crypto/caam/sg_sw_sec4.h index 6365585..6730b01 100644 --- a/drivers/crypto/caam/sg_sw_sec4.h +++ b/drivers/crypto/caam/sg_sw_sec4.h @@ -91,9 +91,14 @@ static int dma_map_sg_chained(struct device *dev, struct scatterlist *sg, { if (unlikely(chained)) { int i; + struct scatterlist *tsg = sg; + + /* We use a local copy of the sg pointer to avoid moving the + * head of the list pointed to by sg as we wall the list. + */ for (i = 0; i < nents; i++) { - dma_map_sg(dev, sg, 1, dir); - sg = sg_next(sg); + dma_map_sg(dev, tsg, 1, dir); + tsg = scatterwalk_sg_next(tsg); } } else { dma_map_sg(dev, sg, nents, dir); @@ -106,6 +111,9 @@ static int dma_unmap_sg_chained(struct device *dev, struct scatterlist *sg, unsigned int nents, enum dma_data_direction dir, bool chained) { + if ((dir == DMA_FROM_DEVICE) || (dir == DMA_BIDIRECTIONAL)) + dma_sync_sg_for_cpu(dev, sg, nents, dir); + if (unlikely(chained)) { int i; for (i = 0; i < nents; i++) {