From patchwork Wed Aug 26 08:06:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 52710 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f200.google.com (mail-lb0-f200.google.com [209.85.217.200]) by patches.linaro.org (Postfix) with ESMTPS id 399E722E8B for ; Wed, 26 Aug 2015 08:08:56 +0000 (UTC) Received: by lbbpd10 with SMTP id pd10sf59501718lbb.3 for ; Wed, 26 Aug 2015 01:08:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:cc:mime-version :content-type:content-transfer-encoding:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list; bh=YzVE4jbgiifrPooRroDtMis/c/VbnygrNysb8HQP5tE=; b=Akr/x5P1l9McfoFgBfz2tH7wyfM0+CK5c1qPnpIiPR5o489XToKxCcIlhD1wBaQFS0 ZUYAJY/qnITovzmYTS5WDa3EKkw2UuOV1tir2f1hECFAd+NLo/FvGNSMYwM56t6n4o5q 9rSWJTHC8bzw5QtEeIbQyESeytf1fqeRcjjdj/DQDCMZrDxRFMXvt+pyHVG08W7LY55V DKzhmaRodZYULPG/xM1p322LRfhcswDbEXsq2zL6orRzr6ZgBq1XLdrunQ+FprtvYYVa QHa668mEYstCfouYq36wFRN8JOYKmurj+5I8WymImWJIevvzaqg3IUNfd9OokwGJ7bxh /c6Q== X-Gm-Message-State: ALoCoQlwsLsy3kPJDMmZY49S216/QA15CT86yuFLJGjSW+pwTaqY09tKRD9jSNVv1mA+WyYWE5LQ X-Received: by 10.180.96.226 with SMTP id dv2mr510927wib.2.1440576535188; Wed, 26 Aug 2015 01:08:55 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.120.198 with SMTP id le6ls705884lab.56.gmail; Wed, 26 Aug 2015 01:08:55 -0700 (PDT) X-Received: by 10.112.125.34 with SMTP id mn2mr26764418lbb.76.1440576535006; Wed, 26 Aug 2015 01:08:55 -0700 (PDT) Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com. [209.85.217.169]) by mx.google.com with ESMTPS id ea10si18191993lbc.34.2015.08.26.01.08.54 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Aug 2015 01:08:54 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) client-ip=209.85.217.169; Received: by lbbsx3 with SMTP id sx3so115054300lbb.0 for ; Wed, 26 Aug 2015 01:08:54 -0700 (PDT) X-Received: by 10.112.125.34 with SMTP id mn2mr26764410lbb.76.1440576534813; Wed, 26 Aug 2015 01:08:54 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.162.200 with SMTP id yc8csp3739858lbb; Wed, 26 Aug 2015 01:08:53 -0700 (PDT) X-Received: by 10.140.147.85 with SMTP id 82mr79045097qht.90.1440576533041; Wed, 26 Aug 2015 01:08:53 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id e143si37393757qhc.120.2015.08.26.01.08.52 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Aug 2015 01:08:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; 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 1ZUVkE-000875-Dt; Wed, 26 Aug 2015 08:07:42 +0000 Received: from mail-wi0-f172.google.com ([209.85.212.172]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZUVji-0007iH-WB for linux-arm-kernel@lists.infradead.org; Wed, 26 Aug 2015 08:07:11 +0000 Received: by widdq5 with SMTP id dq5so38108907wid.1 for ; Wed, 26 Aug 2015 01:06:50 -0700 (PDT) X-Received: by 10.194.78.164 with SMTP id c4mr54231314wjx.65.1440576410657; Wed, 26 Aug 2015 01:06:50 -0700 (PDT) Received: from localhost.localdomain (cag06-7-83-153-85-71.fbx.proxad.net. [83.153.85.71]) by smtp.gmail.com with ESMTPSA id gm20sm2569597wjc.17.2015.08.26.01.06.48 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 26 Aug 2015 01:06:49 -0700 (PDT) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, linux-efi@vger.kernel.org, leif.lindholm@linaro.org, catalin.marinas@arm.com, will.deacon@arm.com, mark.rutland@arm.com, msalter@redhat.com Subject: [PATCH v2 5/5] arm64/efi: ignore DT memreserve entries instead of removing them Date: Wed, 26 Aug 2015 10:06:31 +0200 Message-Id: <1440576391-25725-6-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1440576391-25725-1-git-send-email-ard.biesheuvel@linaro.org> References: <1440576391-25725-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150826_010711_188980_0E764E18 X-CRM114-Status: GOOD ( 14.24 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.212.172 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [209.85.212.172 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders 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: Ard Biesheuvel , haojian.zhuang@linaro.org, Ganapatrao.Kulkarni@caviumnetworks.com, leo.yan@linaro.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ard.biesheuvel@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Now that the reservation of the FDT image itself is split off, 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. Signed-off-by: Ard Biesheuvel Acked-by: Leif Lindholm --- 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 ecbc051bc66b..0c33670ed1b6 100644 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c @@ -170,7 +170,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 343e7992bd8f..a7e87cd582f2 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");