From patchwork Thu Oct 31 10:37:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Martinez Canillas X-Patchwork-Id: 178152 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp2632044ill; Thu, 31 Oct 2019 03:38:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqwcy2q/aXNUyjxPrg9OgksfVS/MdDvMw2fFmKrJDhq1CJhUH0sf717MC4JoXiHthb/3ku0y X-Received: by 2002:a05:6402:12d5:: with SMTP id k21mr5236979edx.56.1572518332295; Thu, 31 Oct 2019 03:38:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572518332; cv=none; d=google.com; s=arc-20160816; b=mj4+EytPEZ2+uxIi/3BmG4WkcZlZozrAOQyDv2b48LZCkETvT80CiWtZqM+53IvXI2 PTAe/I3kzSdAPGEmKLoCPktP/zPwAxW4EFkGre/9sOfLNSNAExrNJIv2I7qHCPlc3rEi 7OFoIbxQ29KqshzD0SUN3oEyCvJMJTNOrHZxWS+YKbKbC7uR0tfGtw82AoysfwanmK5E ArZW5kB8geogquy0UHeV3xyZPXDKSIyrIAS835wqmv/ez4seXvEexguVJiS75WkpDiVx BTBDBeGVe9X8Gb4D+biFbw17A3XZzKRTG2q7DeRgOEUb5OZW8fltgkAUZr8tZMt5iFrj agew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:message-id:date:subject:cc:to:from; bh=srm/h2tslcH7UBW0NO3tfugX9Ky/nWGFCRLaw3/MqcQ=; b=y4Y/lPojxMeB0I20M/MXUZTy65T1DhxFuH6JBUllAd0VAACnz7XixQJTQEhWZun3FN vQm535p7eCPBD6xfivCOtvU6bcrMPTMwYsaLlV3l5tCAs9lG8dWoDkZO/JpZ/SNn6//b o01N6y63xBjUomWJPVL89YTWQEKN94EJQu3QTHZQ5eeoiIbIP5AXvypaA1uzcbNlvt++ Nq6+03kGIG2L27yD+0H4afwoWJX/Jxjb7pvPCiJ1x7+9RQyk+oGM6HidUt6x3Vkcx39G 16mOcpNAI2vz6Z1N9SxJNMB3A+RvB3QMTQhkxpsatlI6dA6GFDjRFBWVM3J1RlIMha3a S1AA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of grub-devel-bounces+patch=linaro.org@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="grub-devel-bounces+patch=linaro.org@gnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id b14si1300017edv.216.2019.10.31.03.38.52 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 31 Oct 2019 03:38:52 -0700 (PDT) Received-SPF: pass (google.com: domain of grub-devel-bounces+patch=linaro.org@gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of grub-devel-bounces+patch=linaro.org@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="grub-devel-bounces+patch=linaro.org@gnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1]:48282 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iQ7qs-0004DU-U5 for patch@linaro.org; Thu, 31 Oct 2019 06:38:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42698) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iQ7pt-0000r3-I6 for grub-devel@gnu.org; Thu, 31 Oct 2019 06:37:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iQ7pr-0003YS-Q4 for grub-devel@gnu.org; Thu, 31 Oct 2019 06:37:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38056) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iQ7pr-0003T5-Hw for grub-devel@gnu.org; Thu, 31 Oct 2019 06:37:47 -0400 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1903383F3B for ; Thu, 31 Oct 2019 10:37:46 +0000 (UTC) Received: by mail-wm1-f69.google.com with SMTP id t203so2230381wmt.7 for ; Thu, 31 Oct 2019 03:37:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=UDbb5OFNxJLvPPw/pvraEYehasBI0NFpaCSnOt+PLjA=; b=LbEG+Fis49NAxQ90HphOu32uqCESHm5YeAvyeQLwc8S2dK/ChgbHt9X0wjYSBx0z5b CWkP57LaPySRp5QIHuOla1OLoYUYGAmCq09mkYLk79MrZxpz49KKuaepSXbAJgxn3Vn+ bl2XQSWgll4EINUE788/1uh4eQCTyJFg+io7A3/hunsJtc0ZeMIoYsmEOlHmfABNndXy NGL2FMCIBLHZ/kwpg+NZw2adPp2dOQOgiYdAp1RSG8uvQEJog2gt5oGnSgwcQJk6Dm5W W1KMF7CmhwvkOrBzgq5MSyQxMeuJAzCQ6tBArkRyfoA7PaymgErmxf9Q4liE9ETZ2HX5 ADZw== X-Gm-Message-State: APjAAAXoYZDjJBr+jNMJwPYYiLJkdypvrNDNar7bn6JGzonEF++6vX/E qtSKkKgfcjN5o38vmh5LHi50PVjdqGwYXudSR0WvGhRRLYw72Yj2SEMiowbyIFGUiTdHq8vnm5b bFDb5hVnYpuA= X-Received: by 2002:a5d:6b0e:: with SMTP id v14mr4773798wrw.280.1572518264545; Thu, 31 Oct 2019 03:37:44 -0700 (PDT) X-Received: by 2002:a5d:6b0e:: with SMTP id v14mr4773782wrw.280.1572518264363; Thu, 31 Oct 2019 03:37:44 -0700 (PDT) Received: from minerva.redhat.com ([90.168.169.92]) by smtp.gmail.com with ESMTPSA id d11sm390727wrn.28.2019.10.31.03.37.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Oct 2019 03:37:43 -0700 (PDT) From: Javier Martinez Canillas To: grub-devel@gnu.org Cc: Mark Salter , Javier Martinez Canillas Subject: [PATCH] arm64: make sure fdt has #address-cells and #size-cells properties Date: Thu, 31 Oct 2019 11:37:40 +0100 Message-Id: <20191031103740.5400-1-javierm@redhat.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: The development of GNU GRUB Errors-To: grub-devel-bounces+patch=linaro.org@gnu.org Sender: "Grub-devel" From: Mark Salter Recent upstream changes to kexec-tools relies on #address-cells and #size-cells properties in the FDT. If grub2 needs to create a chosen node, it is likely because firmware did not provide one. In that case, set #address-cells and #size-cells properties to make sure they exist. Signed-off-by: Mark Salter Signed-off-by: Javier Martinez Canillas Signed-off-by: Mark Salter <msalter@redhat.com>
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
--- grub-core/loader/arm64/linux.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git grub-core/loader/arm64/linux.c grub-core/loader/arm64/linux.c index ef3e9f9444c..24d73732d89 100644 --- grub-core/loader/arm64/linux.c +++ grub-core/loader/arm64/linux.c @@ -78,7 +78,21 @@ finalize_params_linux (void) node = grub_fdt_find_subnode (fdt, 0, "chosen"); if (node < 0) - node = grub_fdt_add_subnode (fdt, 0, "chosen"); + { + /* + * If we have to create a chosen node, Make sure we + * have #address-cells and #size-cells properties. + */ + retval = grub_fdt_set_prop32(fdt, 0, "#address-cells", 2); + if (retval) + goto failure; + + retval = grub_fdt_set_prop32(fdt, 0, "#size-cells", 2); + if (retval) + goto failure; + + node = grub_fdt_add_subnode (fdt, 0, "chosen"); + } if (node < 1) goto failure;