From patchwork Fri Aug 7 03:19:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 6964841 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 AE5749F38B for ; Fri, 7 Aug 2015 03:19:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CD9B4206D5 for ; Fri, 7 Aug 2015 03:19:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D7D01206B2 for ; Fri, 7 Aug 2015 03:19:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752118AbbHGDTJ (ORCPT ); Thu, 6 Aug 2015 23:19:09 -0400 Received: from relmlor3.renesas.com ([210.160.252.173]:30513 "EHLO relmlie2.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751003AbbHGDTI (ORCPT ); Thu, 6 Aug 2015 23:19:08 -0400 Received: from unknown (HELO relmlir3.idc.renesas.com) ([10.200.68.153]) by relmlie2.idc.renesas.com with ESMTP; 07 Aug 2015 12:19:07 +0900 Received: from relmlac3.idc.renesas.com (relmlac3.idc.renesas.com [10.200.69.23]) by relmlir3.idc.renesas.com (Postfix) with ESMTP id 536A84BFDC; Fri, 7 Aug 2015 12:19:07 +0900 (JST) Received: by relmlac3.idc.renesas.com (Postfix, from userid 0) id 417861806F; Fri, 7 Aug 2015 12:19:06 +0900 (JST) Received: from relmlac3.idc.renesas.com (localhost [127.0.0.1]) by relmlac3.idc.renesas.com (Postfix) with ESMTP id F337F1800A; Fri, 7 Aug 2015 12:19:06 +0900 (JST) Received: from relmlii1.idc.renesas.com [10.200.68.65] by relmlac3.idc.renesas.com with ESMTP id NAN30911; Fri, 7 Aug 2015 12:19:06 +0900 X-IronPort-AV: E=Sophos;i="5.15,626,1432566000"; d="scan'";a="191978600" Received: from mail-hk2apc01lp0207.outbound.protection.outlook.com (HELO APC01-HK2-obe.outbound.protection.outlook.com) ([65.55.88.207]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA; 07 Aug 2015 12:19:06 +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 HK2PR06MB0595.apcprd06.prod.outlook.com (10.161.187.146) with Microsoft SMTP Server (TLS) id 15.1.225.19; Fri, 7 Aug 2015 03:19:03 +0000 Message-ID: <87pp2zdc0z.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 13/16 v5][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 Date: Fri, 7 Aug 2015 03:19:03 +0000 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: OS1PR01CA0043.jpnprd01.prod.outlook.com (25.164.162.27) To HK2PR06MB0595.apcprd06.prod.outlook.com (25.161.187.146) X-Microsoft-Exchange-Diagnostics: 1; HK2PR06MB0595; 2:ZG0+CRVTLqcCe/6ewMsiemgcRJ7rraa6lLrr+UjCscoUuX5zCT5V8xZKtHtbegi6pPotpFuONT0DGow2u/a1m0LblNMCWJef/pQ8uPuYTya5kcRqfWhooLsb6rpEgIFXoRaAsAhqBAc4lQO6N/JHpAwz4KA6ShYQqi+Ls6uL7DI=; 3:ClL4PYrzq+YYK0d+RSz6F22DUQPEFIfS2LRbkHeK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BDgxuXmMKGtZXLj5W3USdQY6ZpUOab0b+SA9fdXNz30WbTushdITVl7wEt5XYZr48s6BUMOstNR9HiNTyGn5eUpx9lg6Yye/nCQkOtjLhuz9ZE2/2wN5SWG97o1U2JR7mc0LyFghFNjYqtbPvBmZHd2pHsK84rH6mxrnaHU27UQkRFIOTIRpQHM8yuoJMuvuG84g= 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:HK2PR06MB0595; BCL:0; PCL:0; RULEID:; SRVR:HK2PR06MB0595; X-Forefront-PRVS: 066153096A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6009001)(199003)(189002)(4001540100001)(81156007)(40100003)(106356001)(97736004)(5001860100001)(4001350100001)(5001830100001)(5001770100001)(105586002)(86362001)(77156002)(122386002)(62966003)(36756003)(46406003)(68736005)(92566002)(15975445007)(77096005)(19580395003)(19580405001)(42186005)(69596002)(50466002)(189998001)(5001960100002)(229853001)(50986999)(107886002)(87976001)(46102003)(53416004)(66066001)(54356999)(64706001)(47776003)(33646002)(23726002)(101416001)(83506001)(4001430100001); DIR:OUT; SFP:1102; SCL:1; SRVR:HK2PR06MB0595; H:morimoto-PC.renesas.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HK2PR06MB0595; 23:B6IztaGo/vzceJ47s7wwlaO8FdeeRX8jEWN0EmB+8?= =?us-ascii?Q?M5vCtMtZpLvnAQ2McnwtGCDtVoSgNbsFBdoLYH/ZQgx3RxsUdDRtuKZK1Fua?= =?us-ascii?Q?a4Fl1Auzhop8BmosWG/XVIcnLTAR67BIVpggEtEE1Yb+cn2biSkEWm9FAEM3?= =?us-ascii?Q?6aHCUA1pt4fF8kYb4UCumQKye1ebFKA/lkB51RPIYBwoVPJMydSGlDyj1Z1a?= =?us-ascii?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GPBng5G7?= =?us-ascii?Q?KT272xIsrwN+9tppP/J/0MqCAiU6WvBBWKxe1dssW4nNSaY13EkrlsZwCcnj?= =?us-ascii?Q?VMM/66dJX8K7en9XkHi9eliuo+SdQIrKoIC?= X-Microsoft-Exchange-Diagnostics: 1; HK2PR06MB0595; 5:kfgrnYhXMgQnHvAsXfDN6IQ++5Gk0DXts1/d/aZkZliAuU+6q/V+2qIvY04WqNWrl/QVtlbkNRVarw6tZ58dphzCEpznsYmsniIe9dMVa1dNPFmY/LVyeY1Kcg5la5HM6btjT3siIgXEQEvFjgzRGg==; 24:CkpVhCnZs7uRypAUiEtXhLOQB8DjXdG7wubvI7ZlCNbeXwO9cV8IL9N+NDmNVSpunXqD5Ci0VyaJK7InLmx6fENCD/mdorZ1pgeWnbXzYNY=; 20:Thks/jrEkk8X+1Uo0bQqZEEm94HIZxuOna8GUJXFk7pOgSYn17WMc+9/U5siFrctElZziftyLYZ3z/yeZev+JwAJTYpzMpS67sAEDy7h6112Ir8jLR6jYgKXmNLEoiJQBDfIBUmYShaRd322Er/f85UdDPg8pV0tH5edtIgaKWw= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2015 03:19:03.3008 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HK2PR06MB0595 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 --- v4 -> v5 - no change 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; }