From patchwork Thu Aug 6 08:08:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 6957101 X-Patchwork-Delegate: horms@verge.net.au Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 259049F38B for ; Thu, 6 Aug 2015 08:08:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 32F8E20692 for ; Thu, 6 Aug 2015 08:08:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 04A452068E for ; Thu, 6 Aug 2015 08:08:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754790AbbHFIIo (ORCPT ); Thu, 6 Aug 2015 04:08:44 -0400 Received: from relmlor2.renesas.com ([210.160.252.172]:45275 "EHLO relmlie1.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754677AbbHFIIl (ORCPT ); Thu, 6 Aug 2015 04:08:41 -0400 Received: from unknown (HELO relmlir2.idc.renesas.com) ([10.200.68.152]) by relmlie1.idc.renesas.com with ESMTP; 06 Aug 2015 17:08:40 +0900 Received: from relmlac3.idc.renesas.com (relmlac3.idc.renesas.com [10.200.69.23]) by relmlir2.idc.renesas.com (Postfix) with ESMTP id B4BD947A40; Thu, 6 Aug 2015 17:08:40 +0900 (JST) Received: by relmlac3.idc.renesas.com (Postfix, from userid 0) id B4A451806F; Thu, 6 Aug 2015 17:08:40 +0900 (JST) Received: from relmlac3.idc.renesas.com (localhost [127.0.0.1]) by relmlac3.idc.renesas.com (Postfix) with ESMTP id A7F541800A; Thu, 6 Aug 2015 17:08:40 +0900 (JST) Received: from relmlii2.idc.renesas.com [10.200.68.66] by relmlac3.idc.renesas.com with ESMTP id TAF19573; Thu, 6 Aug 2015 17:08:40 +0900 X-IronPort-AV: E=Sophos;i="5.15,622,1432566000"; d="scan'";a="193108640" Received: from mail-hk2apc01lp0211.outbound.protection.outlook.com (HELO APC01-HK2-obe.outbound.protection.outlook.com) ([65.55.88.211]) by relmlii2.idc.renesas.com with ESMTP/TLS/AES256-SHA; 06 Aug 2015 17:08:40 +0900 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=kuninori.morimoto.gx@renesas.com; Received: from morimoto-PC.renesas.com (211.11.155.144) by HK2PR06MB0596.apcprd06.prod.outlook.com (10.161.187.147) with Microsoft SMTP Server (TLS) id 15.1.225.19; Thu, 6 Aug 2015 08:08:38 +0000 Message-ID: <87io8syh8j.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 10/13 v4][RFC] Local Hack: of: Limit FDT size for CRC check on arm64 User-Agent: Wanderlust/2.15.9 Emacs/24.3 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") To: Simon , Geert Uytterhoeven CC: YOSHIYUKI ITO , Magnus , Linux-SH , Gaku Inami , shimoda , munakata , komatsu , goda In-Reply-To: <87wpx8yhhm.wl%kuninori.morimoto.gx@renesas.com> References: <87wpx8yhhm.wl%kuninori.morimoto.gx@renesas.com> Date: Thu, 6 Aug 2015 08:08:38 +0000 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: OS1PR01CA0032.jpnprd01.prod.outlook.com (25.164.162.16) To HK2PR06MB0596.apcprd06.prod.outlook.com (25.161.187.147) X-Microsoft-Exchange-Diagnostics: 1; HK2PR06MB0596; 2:R5JGCbY4aYSvbggycVqUQayeaiBxVQH7COX3koe2/Cun8NKGBcp7+TZ9GHRL8gjoHgOC361TClVMSr1SiIJSygppeLly+4tsFMTdOvNl33XPaT65H6lXl1URvGOK4bIjfzra8VCuO+QPhcOXkPybFLQkb63b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zNDTNhr3aep0Yu41te1xVXwCb4+7VkIGzc42VV8FRagTVZxWW4stksHgKEBkPWrcJ2XFYRxFCJf62PE5GuShgdKBPX5fZrktuvlOlRWGs/kLDpc1FZimDmlokvvA8ZKzucwFCvd8kEtrck9bcgxToywdSMD5YWT0WP2Ui5Sa6ZkFvp43fqCREuTJRLcyU8kIFA8h21bjQ9qNfDodoow5HAq2+UUcVfS0OU77mHz6iKglJ1g0JNohUayMyVV9LETGGGuI3pWPB2PcKvOrOjDIgU= 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:HK2PR06MB0596; BCL:0; PCL:0; RULEID:; SRVR:HK2PR06MB0596; X-Forefront-PRVS: 06607E485E X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6009001)(189002)(199003)(50466002)(5001960100002)(77156002)(4001350100001)(5001860100001)(107886002)(81156007)(229853001)(97736004)(62966003)(54356999)(50986999)(46102003)(76176999)(5001830100001)(36756003)(4001540100001)(122386002)(33646002)(23726002)(5001770100001)(42186005)(189998001)(40100003)(53416004)(66066001)(64706001)(101416001)(87976001)(19580405001)(92566002)(106356001)(77096005)(2950100001)(105586002)(68736005)(47776003)(69596002)(15975445007)(83506001)(19580395003)(46406003)(86362001)(4001430100001); DIR:OUT; SFP:1102; SCL:1; SRVR:HK2PR06MB0596; H:morimoto-PC.renesas.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HK2PR06MB0596; 23:8cp+uCaNDpsKDnnsKBZkk8pc0ojJhtVDit3iSM+Yb?= =?us-ascii?Q?PSgJRCPa9WA1OO7DM8yTI6qvf/swzxuvPFS4R6j7zczRFzUEr3+V52ojCj3A?= =?us-ascii?Q?487KF8zicOMU6PVnH2Q/2sLiVuj14L0fIAsBVRyZ2UZcfxk2RLJeR61K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NkfeTaJrLEFA4qbaR9NKo33to9QdR?= =?us-ascii?Q?TpoVN/n2n2s6IUE/3kQF0WWfZexGK+ufQKJMVQQi5JALJDODTAfMLqHE84vs?= =?us-ascii?Q?JlVO3CdwBHbLWr+diqH2K4/GN9xE7kgtfNFdIBOQebULQ3r5yOXbgDagn++K?= =?us-ascii?Q?ANbRNq4QASYwoSDS+yYCSZg2mnbQO3bpjnysMKMNg+hrgLPNG5OZlJ79UJyS?= =?us-ascii?Q?+poMPQrVp00tcUIY5w=3D?= X-Microsoft-Exchange-Diagnostics: 1; HK2PR06MB0596; 5:ztFCVOLTF3lHYJfEBxnbBlT0SVHfS6jikwdZESmThHmUcd0Z6MppWBeN8h6oLrUve/4xBsLedOvyME494mrjJhnKcNIHWnFHtpen0nz6PhBoaxq32s9MmkYMJnlqnVDWibgrPqNrh3TlUVQZLyT9gQ==; 24:xE40EvgeqkshFVMwz2HRyLGR9LF1hhvMhthmqNjxPt1Sr6sJjnJUXdX8OLn315lve9gbNJKqcboKBnJ1K6hIvZ1qOr9oX1K5f2gPEhc01CY=; 20:fpeUhjWcvCwp1KhWCWPKW8+WbxIJupSnowNcDZYAfRWo0NWSqnfRPQZUlsnhvmWS2514T/XXV8ox4Nn5ii5yeD0F8FGITfM16HvvOX43vmJ+u94sHMl9dj9H1L1c0UG1ZNpaeHyL9XK7/dHTofeBAHVqAJ5/rBxN8ttdzTtsclQ= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Aug 2015 08:08:38.6178 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HK2PR06MB0596 Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-7.0 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: Jon Medhurst There is a bug in the UEFI implementation used on Juno and 64-bit FVPs which corrupts the reported size of the FDT. Work around this by limiting the size for CRC checks to 2MB. See http://lists.infradead.org/pipermail/linux-arm-kernel/2014-December/310106.html Signed-off-by: Jon Medhurst Signed-off-by: Takeshi Kihara --- v3 -> v4 - new patch drivers/of/fdt.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index 07496560..53f8c82 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -28,6 +28,12 @@ #include /* for COMMAND_LINE_SIZE */ #include +#ifdef CONFIG_ARM64 +#define fdt_crc_size_hack(_s) min(fdt_totalsize(_s),(unsigned)0x200000) +#else +#define fdt_crc_size_hack(_s) fdt_totalsize(_s) +#endif + /* * of_fdt_limit_memory - limit the number of regions in the /memory node * @limit: maximum entries @@ -1059,7 +1065,7 @@ bool __init early_init_dt_verify(void *params) /* Setup flat device-tree pointer */ initial_boot_params = params; of_fdt_crc32 = crc32_be(~0, initial_boot_params, - fdt_totalsize(initial_boot_params)); + fdt_crc_size_hack(initial_boot_params)); return true; } @@ -1155,7 +1161,7 @@ static int __init of_fdt_raw_init(void) return 0; if (of_fdt_crc32 != crc32_be(~0, initial_boot_params, - fdt_totalsize(initial_boot_params))) { + fdt_crc_size_hack(initial_boot_params))) { pr_warn("fdt: not creating '/sys/firmware/fdt': CRC check failed\n"); return 0; }