From patchwork Mon May 11 06:41:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 48207 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 ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A350A2121F for ; Mon, 11 May 2015 06:48:09 +0000 (UTC) Received: by lbos2 with SMTP id s2sf36044624lbo.2 for ; Sun, 10 May 2015 23:48:08 -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:cc:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version :content-type:content-transfer-encoding:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list; bh=gGn91jv1WIFS4+u9h56r3HjFRPXu6tYIVhb55iCYFf8=; b=lGdezbYOdhvlSqpu0y1ZtZgHdKLs8lTmLBqAROJeKtaaT642VOiEi5/hh55XHsQtf3 x/0U67zUmST8udTas3JIhNksf3TniMdw306V43AUfvKu5q4dzBOypS2nAAANdFirBmVg eS09noga/5gB55R+XktD6olCr7ehyGyeqUKu1Ojcchaz1o97vKhw0lUhKvnhzCAl5six QpOuNPMDvFOUd7XzI9BMSkjIMrX/FLw8latj9VaT8XrrSc6YNdueIY1UhBPQ0W7Ux12H XOo4CdJfQAgjtxhTKjlQ/ozC+5y36a7gUcAn8ChEL8AA2BX+q0rNAkPWpbbtAi1Be1rl VbVA== X-Gm-Message-State: ALoCoQlmylMAKRgURDVpjatKxpmoNkgIi3Uj4wjGSKxTOOwDmbRZ4U9Z0xRtp+q0ZpLe6qlFc6CK X-Received: by 10.152.203.233 with SMTP id kt9mr6614943lac.7.1431326888553; Sun, 10 May 2015 23:48:08 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.21.98 with SMTP id u2ls562568lae.84.gmail; Sun, 10 May 2015 23:48:08 -0700 (PDT) X-Received: by 10.112.204.104 with SMTP id kx8mr6863951lbc.72.1431326888415; Sun, 10 May 2015 23:48:08 -0700 (PDT) Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com. [209.85.217.181]) by mx.google.com with ESMTPS id h5si7830501laa.48.2015.05.10.23.48.08 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 10 May 2015 23:48:08 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.181 as permitted sender) client-ip=209.85.217.181; Received: by lbbqq2 with SMTP id qq2so87127838lbb.3 for ; Sun, 10 May 2015 23:48:08 -0700 (PDT) X-Received: by 10.112.222.133 with SMTP id qm5mr6992206lbc.86.1431326888299; Sun, 10 May 2015 23:48:08 -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.108.230 with SMTP id hn6csp1335669lbb; Sun, 10 May 2015 23:48:06 -0700 (PDT) X-Received: by 10.68.136.134 with SMTP id qa6mr17047669pbb.66.1431326885303; Sun, 10 May 2015 23:48:05 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id w16si717329pdl.249.2015.05.10.23.48.04 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 10 May 2015 23:48:05 -0700 (PDT) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) 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 1YrhSL-0008RO-4S; Mon, 11 May 2015 06:44:49 +0000 Received: from mail-wi0-f175.google.com ([209.85.212.175]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YrhQJ-0007Gl-PH for linux-arm-kernel@lists.infradead.org; Mon, 11 May 2015 06:42:44 +0000 Received: by widdi4 with SMTP id di4so92643246wid.0 for ; Sun, 10 May 2015 23:42:21 -0700 (PDT) X-Received: by 10.194.216.196 with SMTP id os4mr17602077wjc.117.1431326541856; Sun, 10 May 2015 23:42:21 -0700 (PDT) Received: from localhost.localdomain (cag06-7-83-153-85-71.fbx.proxad.net. [83.153.85.71]) by mx.google.com with ESMTPSA id wr2sm21173009wjb.45.2015.05.10.23.42.20 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 10 May 2015 23:42:21 -0700 (PDT) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, linux-efi@vger.kernel.org, grant.likely@linaro.org, leif.lindholm@linaro.org, roy.franz@linaro.org, catalin.marinas@arm.com, mark.rutland@arm.com, matt.fleming@intel.com Subject: [PATCH 7/8] arm64/efi: ignore DT memreserve entries instead of removing them Date: Mon, 11 May 2015 08:41:59 +0200 Message-Id: <1431326520-17331-8-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1431326520-17331-1-git-send-email-ard.biesheuvel@linaro.org> References: <1431326520-17331-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150510_234244_000269_AE256D85 X-CRM114-Status: GOOD ( 11.17 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.212.175 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [209.85.212.175 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders Cc: Ganapatrao.Kulkarni@caviumnetworks.com, Ard Biesheuvel X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , 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.181 as permitted sender) smtp.mail=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 --- 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 95c239f43384..a3469a436a73 100644 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c @@ -179,7 +179,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");