From patchwork Mon Jun 15 23:52:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Victoria Milhoan X-Patchwork-Id: 6612511 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 E8CD1C0020 for ; Mon, 15 Jun 2015 23:53:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 05FAF203B5 for ; Mon, 15 Jun 2015 23:53:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1A545203C0 for ; Mon, 15 Jun 2015 23:53:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751397AbbFOXxS (ORCPT ); Mon, 15 Jun 2015 19:53:18 -0400 Received: from mail-bn1bon0140.outbound.protection.outlook.com ([157.56.111.140]:12000 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750897AbbFOXxO (ORCPT ); Mon, 15 Jun 2015 19:53:14 -0400 Received: from CH1PR03CA005.namprd03.prod.outlook.com (10.255.156.150) by BLUPR03MB390.namprd03.prod.outlook.com (10.141.78.19) with Microsoft SMTP Server (TLS) id 15.1.195.6; Mon, 15 Jun 2015 23:53:12 +0000 Received: from BY2FFO11OLC012.protection.gbl (10.255.156.132) by CH1PR03CA005.outlook.office365.com (10.255.156.150) with Microsoft SMTP Server (TLS) id 15.1.172.22 via Frontend Transport; Mon, 15 Jun 2015 23:53:12 +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 BY2FFO11OLC012.mail.protection.outlook.com (10.1.15.23) with Microsoft SMTP Server (TLS) id 15.1.190.9 via Frontend Transport; Mon, 15 Jun 2015 23:53:12 +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 t5FNr7p6003741; Mon, 15 Jun 2015 16:53:10 -0700 From: Victoria Milhoan To: CC: , , Subject: [PATCH RFC 11/11] crypto: caam - fix RNG buffer cache alignment Date: Mon, 15 Jun 2015 16:52:59 -0700 Message-ID: <1434412379-11623-12-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; BY2FFO11OLC012; 1:o8dslc+6EhnRJCflpm+7+tzNWB2nA2ovDcTvbjfQAw1jrVt9e7TL1Y+Ls0N5ztZ7aIIYn44BRSqvQ4sTrOHNfxp9UMRZK+moDd9HF1QXqs7PWu+bpYWkJeztS2VeAcm/W7cSXAJqn3ec0JoNEVqm662r/HWEIv9ErEIqzrMB2nTNGx1Jh4P2Sdb6qDq3twX+6q4q//SpSxyy5Y6amAmsR8kEivT3BXvHzSnm0Y+k1Wemv2M4+2JuQ9gDw6B68GU3YkVvVlgDL/gQrY6YVvMbwmQriliDogIrtc8nZtYbrU9AgqIDWCD7GZHzT659oLu+xNXLqcx5+7dVvr0oEkJUrPhb5U2ralgFh+6F5UPGGcI= X-Forefront-Antispam-Report: CIP:192.88.168.50; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(339900001)(199003)(189002)(6806004)(50986999)(77156002)(33646002)(2351001)(77096005)(105606002)(48376002)(50466002)(87936001)(19580395003)(76176999)(86362001)(19580405001)(106466001)(62966003)(2950100001)(92566002)(85426001)(5001920100001)(5001960100002)(110136002)(107886002)(189998001)(50226001)(46102003)(229853001)(47776003)(104016003)(36756003)(4001430100001)(217873001); DIR:OUT; SFP:1102; SCL:1; SRVR:BLUPR03MB390; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; MLV:sfv; A:1; MX:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Exchange-Diagnostics: 1; BLUPR03MB390; 2:Tq74GLgzWrUt3zuqA19Je7P9VI0Vwb+GFtaXLO0H2mUpiC2d349w8/yrqZUwVGCk; 3:YA6mbDtYLpT03+XX7UC9yke/uuN2IlMWy74teIHv+OeOq9vmui7s+tz6K/PidOJ4tsygsWCJGM5I/rPiwQesUgQ3Lte7TwJ0TjcnxebWhGeES4cIjg/JYEvpMy6oS0F9buLuly0Xcosor/TvUQgqgJttQd5APmRkhob+f+/mW+grtANsehx82A1qHB+mSk5cBIQWHV/HxqmZlbKCJ7jzdxVkEEK7v3r0uIhQu10lmeQ=; 20:n8FIA8awaKZ9tgARg/ZJIG5cHw67aidGqiO8/6qAptr5s8kC+543NcO/MtNLbt5umtGNtBkaAQva4MFT2aHB/xsYso4szJBCbvq50xvvzDyYvws/KbUWcVx4f3WrsxuZ2U4OFjfnnw/uVsHFN5nGYgUeZ1KWklYaNZoB/GrPb81PTleBJXDMUDYt60pyQA4sidQWustUnn5bnhZDS3rc3uxQqh5l3AypksXHOd2mgAbCAD2ytFyR9jJJQANePXIrxjwQmA1hMbnV0J9PFOg1SyWTRmBXWpFKULz8MLW1M4SUunidl2kwWpPt+dzmbJ0NS07q6qMjBam4dn1ZuzQmGyjOQT6TJmvP4oE6XNIW0aA=; 4:DP2Tz62vj5wDpqkVjEEb4oKVS4CPNikYgp7M9x56sU+G9/dzB73oC0BYyiqXGwbqPZpgHvDBhoIXRvmv1zWWa/fB7ftk1Y/o0rmVhjix9yNSm2ULuLFJGh7Zi3SaqxfDaRq518xoRu72H9lt9V+aabPK77XhteFADbDiVydhO4kCv+k0vh99egYykMCm1IiuiHhJgILhz1W+ASCuQoezjWGXC2zGktZ8ZZsV5+nLSxlyfSfkSQmQpehgaq31d3Tag2wV2s2IT WymNjibzGZ6AS7N/UkgGsyA66JoVaqM61I= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR03MB390; 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:BLUPR03MB390; BCL:0; PCL:0; RULEID:; SRVR:BLUPR03MB390; X-Forefront-PRVS: 0608DEDB67 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR03MB390; 23:z2mep1aizjoDGjwz5C1qMwoD3XQOkN1WG+cIISzAc1?= =?us-ascii?Q?Q84rYlhu4OZs/6tJa91kW9L5yExhFJRRrYgUdD7z37FiHtWiOqokL10Ptcce?= =?us-ascii?Q?AO8Z5X6v8HGSTfh6F0QN9YyNTpX4iOWlZ8lGY8WEclkya4qSwezYDHzlQEqs?= =?us-ascii?Q?myev5n6XRx/OgVwXiROzaop87XerKVauEYtFwttm0SjogmLSsDi4pPDib9/9?= =?us-ascii?Q?cxWGy0rcPW1JT4t1Evx7v/pnHXylvALjH2JQlm8h7OPyNkq7qXTIC++iWPwN?= =?us-ascii?Q?eiUokW8Q21DZXuQwLxUZ5yJjZe02WXSuSR5Sy1K+PTjoV7BgEAXAeibPZ6bW?= =?us-ascii?Q?SV9iPCwYxSXQuMEa0UWavdx/BJaEDGKptpG3BWFoJoHFHcYQkep38nEaCula?= =?us-ascii?Q?XOfX4zthkmhB0poKgRaYLbuZHHVPTKOAED27TrSQrqNuPVr/O5rT4E4Yy6pu?= =?us-ascii?Q?KJah48/YeBJuT5zt4PdTDFwYl9KHWd2adcaMas3/IezPHe8aKn33SB6p7WEy?= =?us-ascii?Q?Tg8DOzPygk991ruOpH+/LIA8aRNdxcR38O0/z1SDH6Bkp9EgjLrq6AAlOghX?= =?us-ascii?Q?/GLUyBwO01Wbq3pKMRnG94xHp8h8V5GAhfMKOxZlWWKZ34H5FYzCfw7ND9qb?= =?us-ascii?Q?N+mXAQ+PwxcIyfaiDXe9QN5ocgbiuwS4BSGHdcuJuxpDMa+C3sFOnYhP42Qi?= =?us-ascii?Q?OWBH08lTFFRqQq18q+4AdXhMtS8oQ7rZit2qAH1oTovZtwI1s2c1s4UMESjI?= =?us-ascii?Q?a640O1AojM2wUkauRVy8+taH7Ta/UO9OHUp1B9Ma9o3Ca3xS4LBA4Bcj1rMe?= =?us-ascii?Q?zsw6s80DRZsCuHjwGSk8/3VisYXbTIHNPD9cnSgwIGvNJrJ1GjTjujvDgqaO?= =?us-ascii?Q?fGofbUoSuQofAfPPfD1oCe/YyjPhYK7Do19I5J0/6LtI7ZqSU7+rZJdgzzOM?= =?us-ascii?Q?wLepTv32XiIaX0ClNRF1kZsicSu8dR/hs8RHQbKw=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; BLUPR03MB390; 5:awSEDw3rLCqzJraCOWGY3u7D6buIKKcdvTC2A+nvK4EnZECa9z3z+6wCCIlBTzKQCV4CVhQmPjPpmYix3sJD2tdpZUqBFrX2mUWvE1vB39TdscN6PeR2zN4CGbMViaKQiCt1unp7pUPS3HIP5Be9Gw==; 24:9spwdZzmAb/WOB57ss0mk+kvtJQLmtpe+P5UZW61YnNJJxW2PL4uUNL/8qnoHnTzlv7Qu0zIgh+cbDPQnsNwlboFm0p3C5dOB38bzMygCCM=; 20:A7Kn6wfoxlZec+HhLypX+P5DhgzmhkxbuI7TOokegfp1hQhzOLLlO7fuQh8E/nTsZguLmDx59ia2r8fCn5Hq9g== X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2015 23:53:12.0126 (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: BLUPR03MB390 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 From: Steve Cornelius The hwrng output buffers (2) are cast inside of a a struct (caam_rng_ctx) allocated in one DMA-tagged region. While the kernel's heap allocator should place the overall struct on a cacheline aligned boundary, the 2 buffers contained within may not necessarily align. Consenquently, the ends of unaligned buffers may not fully flush, and if so, stale data will be left behind, resulting in small repeating patterns. This fix aligns the buffers inside the struct. Note that not all of the data inside caam_rng_ctx necessarily needs to be DMA-tagged, only the buffers themselves require this. However, a fix would incur the expense of error-handling bloat in the case of allocation failure. Signed-off-by: Steve Cornelius Signed-off-by: Victoria Milhoan --- drivers/crypto/caam/caamrng.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/caam/caamrng.c b/drivers/crypto/caam/caamrng.c index a8c4af9..dbec737 100644 --- a/drivers/crypto/caam/caamrng.c +++ b/drivers/crypto/caam/caamrng.c @@ -56,7 +56,7 @@ /* Buffer, its dma address and lock */ struct buf_data { - u8 buf[RN_BUF_SIZE]; + u8 buf[RN_BUF_SIZE] ____cacheline_aligned; dma_addr_t addr; struct completion filled; u32 hw_desc[DESC_JOB_O_LEN];