From patchwork Sat Feb 20 01:13:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Daney X-Patchwork-Id: 62443 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp106171lbl; Fri, 19 Feb 2016 17:14:55 -0800 (PST) X-Received: by 10.67.1.129 with SMTP id bg1mr22238788pad.63.1455930895642; Fri, 19 Feb 2016 17:14:55 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id sf6si19872876pac.76.2016.02.19.17.14.55; Fri, 19 Feb 2016 17:14:55 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dkim=pass header.i=@gmail.com; dmarc=pass (p=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2993517AbcBTBOx (ORCPT + 30 others); Fri, 19 Feb 2016 20:14:53 -0500 Received: from mail-pf0-f178.google.com ([209.85.192.178]:36595 "EHLO mail-pf0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1949154AbcBTBNm (ORCPT ); Fri, 19 Feb 2016 20:13:42 -0500 Received: by mail-pf0-f178.google.com with SMTP id e127so59949428pfe.3; Fri, 19 Feb 2016 17:13:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=e0F7Y1EiRSjklt5QCPlfGZS4LZ+cSTjibBy9jSdOnGY=; b=OGTXG7m+jE8qRL86OK3T7mZaqJvCXxJqnTzyAMBUxNc1Bu3sjW/Y/Ugel9IXXbN2tD EQtFD+tLLO0RYZh6jWl78PE80ZD0otbDVT7FG79cOTE7S4RzjTFiGTPwXTcQeB+zXy8U ZGbXtGSosNztInQbbSRA3zP19ylEia+AB3YTzkka6yEDhFxtj0DhW3ETY1B1Ym9bNHvp YRGn2k7s2LPvFoXs/Bd+k760BoaZ7Dn4un519WkK6WsMo8Qu87D1l7lYxL54rJxNITy4 r7Bp0b8A0S0Kz3nzjJMSe4W7FNnSYilQ60xJwiPsfURd41qjt6QJ1Lb+lIWVJyttaDY6 xKwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=e0F7Y1EiRSjklt5QCPlfGZS4LZ+cSTjibBy9jSdOnGY=; b=ANwAHDmV+Hw49qRA/IYgYt/JoKtWDwRUUckmfe6Z1hI5+hT5VLkszavt9Iad2eKF0O BGc5oLFlOXm8p+WIciOI/UV6qLJZ4iH1GobHntKRUQmXuhPZ4TIZ1gSa+fyiaPSQ7Lit qy8PiwYJHv1PqlgUdZ9rGP08wd5XxwhbEBork9tHJSGOyCBP3mbV0evr4sflzG4VllGa A0O5CdqSPSkiburAV6pKUAJZAzDHttRrgqLH6TRnC++ZZtPfc9WXqaCwHKV+/H4W9tt4 5RE/huy/w0zCJW7gvXxivu5g1sTpCNdvnLx8io9V0Vo9IKwQHG5HU6MmPTeNB4YeLM0z s8iA== X-Gm-Message-State: AG10YOSpJi/fgY9sR29jOWHMosbJvn63SO4sTvxuLkqXDS1NP87y8kotvrRNlZ8/uNCpvA== X-Received: by 10.98.0.71 with SMTP id 68mr22314104pfa.156.1455930821967; Fri, 19 Feb 2016 17:13:41 -0800 (PST) Received: from dl.caveonetworks.com ([64.2.3.194]) by smtp.gmail.com with ESMTPSA id fn3sm20532788pab.20.2016.02.19.17.13.29 (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 19 Feb 2016 17:13:31 -0800 (PST) Received: from dl.caveonetworks.com (localhost.localdomain [127.0.0.1]) by dl.caveonetworks.com (8.14.5/8.14.5) with ESMTP id u1K1DSIa005438; Fri, 19 Feb 2016 17:13:28 -0800 Received: (from ddaney@localhost) by dl.caveonetworks.com (8.14.5/8.14.5/Submit) id u1K1DSfp005437; Fri, 19 Feb 2016 17:13:28 -0800 From: David Daney To: Will Deacon , linux-arm-kernel@lists.infradead.org, Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala , devicetree@vger.kernel.org, Ard Biesheuvel , Frank Rowand , Grant Likely , Catalin Marinas , Matt Fleming , linux-efi@vger.kernel.org, Ganapatrao Kulkarni , Robert Richter Cc: linux-kernel@vger.kernel.org, David Daney Subject: [PATCH v11 06/10] arm64/efi: ignore DT memreserve entries instead of removing them Date: Fri, 19 Feb 2016 17:13:15 -0800 Message-Id: <1455930799-5371-7-git-send-email-ddaney.cavm@gmail.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1455930799-5371-1-git-send-email-ddaney.cavm@gmail.com> References: <1455930799-5371-1-git-send-email-ddaney.cavm@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ard Biesheuvel Now that the reservation of the FDT image itself is split off from the processing of memory reservations described by the device tree, we can make the DT scanning of memreserves conditional on whether we booted via UEFI and have its memory map available. This allows us to drop deletion of these memreserves in the stub. It also fixes the issue where the /reserved-memory node (which offers another way of reserving memory ranges) was not being ignored under UEFI. Note that this reverts commit 0ceac9e094b0 ("efi/arm64: Fix fdt-related memory reservation"). Acked-by: Leif Lindholm Signed-off-by: Ard Biesheuvel Signed-off-by: Robert Richter Signed-off-by: David Daney --- arch/arm64/mm/init.c | 3 ++- drivers/firmware/efi/libstub/fdt.c | 11 +---------- 2 files changed, 3 insertions(+), 11 deletions(-) -- 1.8.3.1 diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index eda226e..ee06165 100644 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c @@ -171,7 +171,8 @@ void __init arm64_memblock_init(void) memblock_reserve(__virt_to_phys(initrd_start), initrd_end - initrd_start); #endif - early_init_fdt_scan_reserved_mem(); + if (!efi_enabled(EFI_MEMMAP)) + early_init_fdt_scan_reserved_mem(); /* 4GB maximum for 32-bit only capable devices */ if (IS_ENABLED(CONFIG_ZONE_DMA)) diff --git a/drivers/firmware/efi/libstub/fdt.c b/drivers/firmware/efi/libstub/fdt.c index 9df1560..12cb2a3 100644 --- a/drivers/firmware/efi/libstub/fdt.c +++ b/drivers/firmware/efi/libstub/fdt.c @@ -24,8 +24,7 @@ efi_status_t update_fdt(efi_system_table_t *sys_table, void *orig_fdt, unsigned long map_size, unsigned long desc_size, u32 desc_ver) { - int node, num_rsv; - int status; + int node, status; u32 fdt_val32; u64 fdt_val64; @@ -53,14 +52,6 @@ efi_status_t update_fdt(efi_system_table_t *sys_table, void *orig_fdt, if (status != 0) goto fdt_set_fail; - /* - * Delete all memory reserve map entries. When booting via UEFI, - * kernel will use the UEFI memory map to find reserved regions. - */ - num_rsv = fdt_num_mem_rsv(fdt); - while (num_rsv-- > 0) - fdt_del_mem_rsv(fdt, num_rsv); - node = fdt_subnode_offset(fdt, 0, "chosen"); if (node < 0) { node = fdt_add_subnode(fdt, 0, "chosen");