From patchwork Tue Sep 22 00:21:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 53993 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by patches.linaro.org (Postfix) with ESMTPS id 8AE3022B1E for ; Tue, 22 Sep 2015 00:24:19 +0000 (UTC) Received: by wicmn1 with SMTP id mn1sf394643wic.1 for ; Mon, 21 Sep 2015 17:24:18 -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=WRL/ilsdmxtyPYsfZdQhD7I5KRZohzUq7Qt7kpuOwr8=; b=I0HEv9VT6CRsvGNCH1j8nWb2F3AFT7Ac+Yy1ArmyvWIqq/wZ4iSpsFQsPc2s3OJHNF ZJu4oAwWtuBa+JGiZLsijbm/aTvtVS89hX+51Kry7u9seQFCjQVSNWgqcwCVbFcI7Pun g73qs6JvtEJFkQl5eMcm9e7gC6ocxgMY1f+1iWR/IkFo3tvg2xI8/x6q/n7NmA0guhx/ 6oiWxS14+ZMjJGID0sroxIHu8LQHz6TYbbxuIaQ4BeJmt/YyX7Z9QxV1FApv11T5LJop Cc/8Y8no+aIQfc3ay7/M6iYFbJdUdaNZxX7tKV6nLBJARNK/+7tPV7FQxXP1XUJxeFu9 hWvg== X-Gm-Message-State: ALoCoQmgkRJVi9uv3kqpufjVkGXXGLReF5KRajpKZ95pioWZtugo6A2pbU9xwPhOLjHVy4mMW5P/ X-Received: by 10.180.105.98 with SMTP id gl2mr2562235wib.0.1442881458898; Mon, 21 Sep 2015 17:24:18 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.20.38 with SMTP id k6ls542388lae.39.gmail; Mon, 21 Sep 2015 17:24:18 -0700 (PDT) X-Received: by 10.112.50.129 with SMTP id c1mr4683138lbo.49.1442881458619; Mon, 21 Sep 2015 17:24:18 -0700 (PDT) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com. [209.85.215.54]) by mx.google.com with ESMTPS id y9si17635248lbr.34.2015.09.21.17.24.18 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Sep 2015 17:24:18 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) client-ip=209.85.215.54; Received: by lanb10 with SMTP id b10so78078879lan.3 for ; Mon, 21 Sep 2015 17:24:18 -0700 (PDT) X-Received: by 10.152.5.170 with SMTP id t10mr8535858lat.112.1442881458502; Mon, 21 Sep 2015 17:24:18 -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.59.35 with SMTP id w3csp178986lbq; Mon, 21 Sep 2015 17:24:17 -0700 (PDT) X-Received: by 10.194.7.232 with SMTP id m8mr14476949wja.56.1442881457842; Mon, 21 Sep 2015 17:24:17 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id pu2si17661517wjc.109.2015.09.21.17.24.17 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Sep 2015 17:24:17 -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 1ZeBMF-0001Z2-A6; Tue, 22 Sep 2015 00:22:55 +0000 Received: from mail-pa0-f43.google.com ([209.85.220.43]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZeBLk-0001Dz-53 for linux-arm-kernel@lists.infradead.org; Tue, 22 Sep 2015 00:22:25 +0000 Received: by padhy16 with SMTP id hy16so130607177pad.1 for ; Mon, 21 Sep 2015 17:22:08 -0700 (PDT) X-Received: by 10.66.141.74 with SMTP id rm10mr6921024pab.64.1442881328238; Mon, 21 Sep 2015 17:22:08 -0700 (PDT) Received: from localhost.localdomain ([70.35.39.2]) by smtp.gmail.com with ESMTPSA id xv12sm26924984pac.38.2015.09.21.17.22.04 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 21 Sep 2015 17:22:07 -0700 (PDT) From: Ard Biesheuvel To: linux-efi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, leif.lindholm@linaro.org, mark.rutland@arm.com, catalin.marinas@arm.com, will.deacon@arm.com, msalter@redhat.com Subject: [PATCH v3 6/6] arm64/efi: ignore DT memreserve entries instead of removing them Date: Mon, 21 Sep 2015 17:21:28 -0700 Message-Id: <1442881288-13962-7-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1442881288-13962-1-git-send-email-ard.biesheuvel@linaro.org> References: <1442881288-13962-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150921_172224_382032_909B535D X-CRM114-Status: GOOD ( 15.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.220.43 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.220.43 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] 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 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.215.54 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 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 0ceac9e094b0 ("efi/arm64: Fix fdt-related memory reservation"). Acked-by: Leif Lindholm Signed-off-by: Ard Biesheuvel --- 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 d8ce7f51dba1..c74ff920540a 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");