From patchwork Mon Aug 24 02:32:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 7059941 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 34B759F344 for ; Mon, 24 Aug 2015 02:32:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D8432201F4 for ; Mon, 24 Aug 2015 02:32:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CECA0206A1 for ; Mon, 24 Aug 2015 02:32:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753813AbbHXCcy (ORCPT ); Sun, 23 Aug 2015 22:32:54 -0400 Received: from relmlor3.renesas.com ([210.160.252.173]:31214 "EHLO relmlie2.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753622AbbHXCcx (ORCPT ); Sun, 23 Aug 2015 22:32:53 -0400 Received: from unknown (HELO relmlir3.idc.renesas.com) ([10.200.68.153]) by relmlie2.idc.renesas.com with ESMTP; 24 Aug 2015 11:32:52 +0900 Received: from relmlac1.idc.renesas.com (relmlac1.idc.renesas.com [10.200.69.21]) by relmlir3.idc.renesas.com (Postfix) with ESMTP id 81FCB46371; Mon, 24 Aug 2015 11:32:52 +0900 (JST) Received: by relmlac1.idc.renesas.com (Postfix, from userid 0) id 5933A8002E; Mon, 24 Aug 2015 11:32:52 +0900 (JST) Received: from relmlac1.idc.renesas.com (localhost [127.0.0.1]) by relmlac1.idc.renesas.com (Postfix) with ESMTP id 51A128002D; Mon, 24 Aug 2015 11:32:52 +0900 (JST) Received: from relmlii1.idc.renesas.com [10.200.68.65] by relmlac1.idc.renesas.com with ESMTP id MAF07625; Mon, 24 Aug 2015 11:32:52 +0900 X-IronPort-AV: E=Sophos;i="5.15,735,1432566000"; d="scan'";a="192933273" Received: from mail-sg2apc01lp0247.outbound.protection.outlook.com (HELO APC01-SG2-obe.outbound.protection.outlook.com) ([65.55.88.247]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA; 24 Aug 2015 11:32:51 +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 HKXPR06MB0597.apcprd06.prod.outlook.com (10.161.181.146) with Microsoft SMTP Server (TLS) id 15.1.243.23; Mon, 24 Aug 2015 02:32:49 +0000 Message-ID: <87twrp5si9.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 24/25 v7][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: <87si7977g4.wl%kuninori.morimoto.gx@renesas.com> References: <87si7977g4.wl%kuninori.morimoto.gx@renesas.com> Date: Mon, 24 Aug 2015 02:32:49 +0000 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: OS1PR01CA0038.jpnprd01.prod.outlook.com (25.164.162.22) To HKXPR06MB0597.apcprd06.prod.outlook.com (25.161.181.146) X-Microsoft-Exchange-Diagnostics: 1; HKXPR06MB0597; 2:wdGmH6b4vAfwTPisy+snhgnlzyiGuXVNX9LS5anZi+nplG61xOBZWdnnZkX0q2jRhPH/HUQEwV61g9XVam/OaFhqnQ6m7sXiRFuRU7MLR/5t4SWst04mKaNnug65kJ/vPwDhy/HUuQtx+1DkRDHGdHJOs9D/66/ExQe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Q3vFZdVwWVk4y9nIWmbDFlySE6HQFEvPgha67Yth95V2QDCZZDC6mVYsdbx6je15qmCgh3CfhZKjo67rmXTaJcGDaaHR0H7B2PTWpMFHqufJ9bfTHrymsQH7Pi9T+lCd9vAx0Jgvi+TTDPiHxkKm4WcvPz1UxHP3BibChANUU8PrTgJFtQ0Zuyg6VskP/vM7UOme2ZQkytGbAN+bvWigwqclgHEPcQIrPgln6JGl9Y6dVzppU4Xvo/YUW5ig9eBb+eyJHNT2to/XG9slxlAYZI82GhVx3e X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5005006)(8121501046)(3002001); SRVR:HKXPR06MB0597; BCL:0; PCL:0; RULEID:; SRVR:HKXPR06MB0597; X-Forefront-PRVS: 06780E24F8 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6009001)(189002)(199003)(106356001)(105586002)(83506001)(189998001)(97736004)(229853001)(107886002)(5001830100001)(19580405001)(5004730100002)(53416004)(19580395003)(5007970100001)(54356999)(76176999)(50466002)(42186005)(86362001)(87976001)(46406003)(110136002)(50986999)(69596002)(46102003)(5001860100001)(5001960100002)(101416001)(81156007)(4001540100001)(77096005)(40100003)(66066001)(23726002)(77156002)(33646002)(47776003)(36756003)(92566002)(64706001)(2950100001)(4001350100001)(68736005)(62966003)(122386002)(15975445007)(4001430100001); DIR:OUT; SFP:1102; SCL:1; SRVR:HKXPR06MB0597; H:morimoto-PC.renesas.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HKXPR06MB0597; 23:8IdTl5QT5tUQQyROLx1WhZpAflH5FuZpDzG5+7ZPn?= =?us-ascii?Q?mKggf4CReG5hdK0yPadZ98QL66DJciPsackLOX+CW+Zfff18Rl7mkNANDZO2?= =?us-ascii?Q?G1EvQ1fj/7uzLsIQ8DWwi7kjK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ascii?Q?x5Y7BCpJ2Etj0upICdBwRnK0s77FQeFxrELX2iP2E9wAOdxs3//fLpXYbbgL?= =?us-ascii?Q?gYWWuUJawPhqrlnh9XDqgfLSrjf+eZ3gE0/RBkgRC2aOvSe5arHpuv/36bSf?= =?us-ascii?Q?1MNE1OxNiSjlcFHz0ILj5DvUXATAYAitr+qXmd6vZn2Jq1a3utfx9Zcr3nju?= =?us-ascii?Q?DiAQURM864Es+YNVFLtFnqvdZbXn/3ATYQp4TQclNc9LbIyz02/AC3D/Bqx0?= =?us-ascii?Q?S6i2TiWjb096pcVg2O+8R1f7zD9zRvinJKgGDduM0eKLBi/h3o5bCxrQSvx4?= =?us-ascii?Q?EsC+bZU/dqOKuaLOVrUo/s=3D?= X-Microsoft-Exchange-Diagnostics: 1; HKXPR06MB0597; 5:/0lMTPus1oDrWkb8gS/5C0I/9iPko/5D9fH3RC5+sUbUwRVW9F4tXlAWdbP7DcFWMSdxuuYyS1vSIy8BXsgNKWqhkwLPABl/6U1MM+UDQ/RQZ0Hs/7NCElpD+WxtxQcffQjdAF2ha8hGnK23dqj+cg==; 24:9yQRH42BAkz7hgcnmEzccRPLw9m6g0jkyrkaalweTjrx6MVRyIhEZ86CXSPpybpZuLjOPC/c0WSR6oE33enhzzdp5Vkn/HgJ5tfTe5KvMc0=; 20:J5jJ3uaIXDrkq0liGb74mm2T2ea4oaql8Js+ws+V/wneBEsP6i8B0z382TSh41HKYTiZOFvkyduhHL0+3bKOgTsyFXSkemgo2+Wia8Eu96z2ZS/J2EiVUzYYbMDG2YPgy76jMa/2conrAY/P9Puch64/dxTKYq9glbfqJEAMJnk= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Aug 2015 02:32:49.3523 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HKXPR06MB0597 Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-8.1 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 -> v7 - 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; }