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: 8365481 Return-Path: X-Original-To: patchwork-linux-arm@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 87F8E9F2F0 for ; Sat, 20 Feb 2016 01:18:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A664F2057F for ; Sat, 20 Feb 2016 01:18:16 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D0CBE20571 for ; Sat, 20 Feb 2016 01:18:15 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aWw9k-0004pr-OB; Sat, 20 Feb 2016 01:16:20 +0000 Received: from mail-pf0-x234.google.com ([2607:f8b0:400e:c00::234]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aWw7W-0001zE-OS for linux-arm-kernel@lists.infradead.org; Sat, 20 Feb 2016 01:14:06 +0000 Received: by mail-pf0-x234.google.com with SMTP id x65so59899245pfb.1 for ; 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=eVa+mWlwkuoA30S0kOqHRib6B+KHexgpysh5xOQdSa8MmvdxcVfIdyzjDDDr90BpJ9 ayQs3RcHUUcbWFnoZm3WWKAjG3rshfcK2xxdksCpSdOyYk6XpUQ6Pjlscd/YXHfBIGwf pqKjTuBmOkwxzlTNoeax7HP/wvwd+E2TIFJ+mRJ4vwKPKCNBGOney8+WjmALmv4Pzh5t mKh8PcLHygfTxIvEpw+ZwKQJH6fgb1yf/l9Iwe/NjitKq8E9CONF9415tZT1Z4JdImDs ZL2U+lz2NWzhgU2qqel8aLNbSuQ5UVQ8LWscssQqvzWNh/5yNCcN3+U3V/CzkVl6cA/S wlzw== X-Gm-Message-State: AG10YORzGeRW7bagceyx/2X6OukRT9s8jaROw8LRjE4I7FzUqehlZp7k2L6gU4l5Ly/rZQ== 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160219_171403_157197_8DE27797 X-CRM114-Status: GOOD ( 14.78 ) X-Spam-Score: -2.7 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, David Daney MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable 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: 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(-) 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");