From patchwork Thu Aug 20 09:29:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 7042991 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 E3BAE9F344 for ; Thu, 20 Aug 2015 09:29:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 87FCF205B7 for ; Thu, 20 Aug 2015 09:29:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2B167205AA for ; Thu, 20 Aug 2015 09:29:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751245AbbHTJ3n (ORCPT ); Thu, 20 Aug 2015 05:29:43 -0400 Received: from relmlor4.renesas.com ([210.160.252.174]:32317 "EHLO relmlie3.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751023AbbHTJ3m (ORCPT ); Thu, 20 Aug 2015 05:29:42 -0400 Received: from unknown (HELO relmlir4.idc.renesas.com) ([10.200.68.154]) by relmlie3.idc.renesas.com with ESMTP; 20 Aug 2015 18:29:41 +0900 Received: from relmlac4.idc.renesas.com (relmlac4.idc.renesas.com [10.200.69.24]) by relmlir4.idc.renesas.com (Postfix) with ESMTP id D394E4522A; Thu, 20 Aug 2015 18:29:41 +0900 (JST) Received: by relmlac4.idc.renesas.com (Postfix, from userid 0) id C5E18480A4; Thu, 20 Aug 2015 18:29:41 +0900 (JST) Received: from relmlac4.idc.renesas.com (localhost [127.0.0.1]) by relmlac4.idc.renesas.com (Postfix) with ESMTP id BFE0C480A3; Thu, 20 Aug 2015 18:29:41 +0900 (JST) Received: from relmlii2.idc.renesas.com [10.200.68.66] by relmlac4.idc.renesas.com with ESMTP id UAL16897; Thu, 20 Aug 2015 18:29:41 +0900 X-IronPort-AV: E=Sophos;i="5.15,714,1432566000"; d="scan'";a="193911412" Received: from mail-hk1lp0120.outbound.protection.outlook.com (HELO APAC01-HK1-obe.outbound.protection.outlook.com) ([207.46.51.120]) by relmlii2.idc.renesas.com with ESMTP/TLS/AES256-SHA; 20 Aug 2015 18:29:41 +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.231.21; Thu, 20 Aug 2015 09:29:39 +0000 Message-ID: <871teyb9ax.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 15/17 v6][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 CC: Magnus , , YOSHIYUKI ITO , Hisao Munakata , Yusuke Goda , Yoshihiro Shimoda , TOSHIAKI KOMATSU , Gaku Inami In-Reply-To: <87oai2b9rj.wl%kuninori.morimoto.gx@renesas.com> References: <87oai2b9rj.wl%kuninori.morimoto.gx@renesas.com> Date: Thu, 20 Aug 2015 09:29:39 +0000 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: OS2PR01CA0036.jpnprd01.prod.outlook.com (25.164.161.146) To HK2PR06MB0596.apcprd06.prod.outlook.com (25.161.187.147) X-Microsoft-Exchange-Diagnostics: 1; HK2PR06MB0596; 2:72zjm7ecuqihk6NwVS57L5mLij4v1yB2nNsmfFNzrdLSedt+OWi90TI4IWjUDTHVHpngo65a53SiWm9rlzkDZoZoXXprZaCsxUXUjP6UZtH453sSdAsKUtv16Qu7vw3KCCteQCf3thlWkgn1XoK1NzAWqB7/RyOb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J/w4DcOG/FHagJdk0ZK8wRsCrqMZUrOK1rRna0aYPCxuG7i9zopyx+w0ajJeTmgnKVpWuQbK0Etf6JtOedJCTU2B0qWDSn41dAxDf4PmCEkNPq1meea1Q5vOPuoft3EoMd+paJ/sQod0kLggmRTaAOAAVbJGlq16hrDu0qgSSetPAekGzPFFeTDjpZ5OZ+HjOyj2f+lJfGfTTdTZzFLTWNMXHZEe1dLyFAffwYjp188Fp3O+GsgIy1U5iH5FxjuUkueckKIPo7YQ48EPm X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(8121501046)(5005006)(3002001); SRVR:HK2PR06MB0596; BCL:0; PCL:0; RULEID:; SRVR:HK2PR06MB0596; X-Forefront-PRVS: 0674DC6DD3 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6009001)(199003)(189002)(36756003)(106356001)(122386002)(47776003)(101416001)(86362001)(4001350100001)(105586002)(64706001)(4001540100001)(97736004)(81156007)(92566002)(40100003)(62966003)(46406003)(42186005)(5001960100002)(5001860100001)(229853001)(19580395003)(77156002)(66066001)(77096005)(107886002)(110136002)(189998001)(53416004)(68736005)(19580405001)(33646002)(5001830100001)(2950100001)(50466002)(50986999)(76176999)(46102003)(15975445007)(87976001)(54356999)(5007970100001)(83506001)(69596002)(23726002)(4001430100001); DIR:OUT; SFP:1102; SCL:1; SRVR:HK2PR06MB0596; H:morimoto-PC.renesas.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HK2PR06MB0596; 23:6oXGpKAiUGLBTfoxB5lMUIcjqewumRLPJqktdc520?= =?us-ascii?Q?CBiHAczEKS5DCWTo3dJSJnym2snxAgNpOhriAH/4sR787tJsr6Wh2tZrFZJc?= =?us-ascii?Q?ZT68+MP86x4bE0UEZTJ3t3Cdx9rYQ8yLfUvMNkr/YJc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Mqk9/78v01ylp2bKrv+IaoVT5ZNMW4n6X4VARfi?= =?us-ascii?Q?xT6PHWlM7aUoCOk5uOIVFaBfW5Fn/PGT5izKnjyvkPuFymwfPbw5RAj3rLyV?= =?us-ascii?Q?B9qL7sdjSZOrrDU7/REx8ZGJ1LUGzcGX4YPEHajrvsIKfUuAvXNYMymWo2FY?= =?us-ascii?Q?upD79lLaCxamKJJEeXzPtDyhJ/1Au+rv25AOqA2hjwMVsZlLMpU4CvguVlog?= =?us-ascii?Q?JwEpfqQmGkTxmd7A5R1JZanghaq+tjw9ELm4KphjnkOsu9WBgwZIPbUJCNZb?= =?us-ascii?B?dz09?= X-Microsoft-Exchange-Diagnostics: 1; HK2PR06MB0596; 5:1qrdX2ExcUi2+Qcb3yHqiYBtGOL4WrFnNW5JbRdjMrPOqvlk13JovuLO1NQPedT5b43LUbsJUBGtWnEZoKHzr+2Fwu+H9qX9Dj+yUTADZJWXHjm8K69kAFP6LvRCKipIRps9ILMnJyHkydWGdotCsQ==; 24:mqCc/G2QqJprBow7VlBPLWfbcsqhY557G4AcWVG21Uxqt+LSzTBYXrtbWnP13T+3kQ+8jIgilIuFtOfO/WNho7JBWtrIqCqf+mP9u/KZVTs=; 20:3soZEJra9pZaW773NoqfbSn3KkWMbqtNlCxUWux7kptFke01jZRReFKJjWEkh6FPyL4JCUDbXPZAa8+Ll70kPLVwwTcuBtT8ImENxoQaKaJLbTgVCD0DhsM570nvfpKb2tGP9pZFd/5h6lf6Qi1AinY7R6V7YpibDIopzlX/gSc= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Aug 2015 09:29:39.4910 (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.5 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 --- v5 -> v6 - 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; }