From patchwork Tue Nov 18 12:57:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 41023 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1ECBB241C9 for ; Tue, 18 Nov 2014 13:01:57 +0000 (UTC) Received: by mail-wi0-f198.google.com with SMTP id r20sf2213159wiv.9 for ; Tue, 18 Nov 2014 05:01:56 -0800 (PST) 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:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:content-type:content-transfer-encoding; bh=zTj2VM5ppLGbOeaVIuQQu/2WKQ7LCH1e1uCAEqlTxRQ=; b=IE1bOi9AdT0V6eWkCyZOIiV420Za0DqHrpHLMlKypjXlpSrniK37aO9JSMj8yRkt7I Wd3TCXXLbDasDARvH7nNKejj0nRVWfFjVpfuiqMBU1Bt04BK6Klhjtk+Ex8oPBY5PtZo qoxuHJalne07W3/MvVLQUW4u7q9YzDFma/pLoVpuWFZAxIeVzjcS/BUWsuiV06kOm3u7 JGQhANR5Tde/fnD6xPSADPSJ8F4Wag7gWlu2PFzxgydP5aqASwXoNBe3stsRjaHDTwQ3 zTbD7vlW0e5KCbrN5qdHhYwYt51Jih/TyU6WtKYCycqrzDHYVY/3rsKRyvlRjPvhviRi QYKQ== X-Gm-Message-State: ALoCoQmriqZYmRdbGNHzjraTYzvF3qEs2UCchD1Viys3tGX/asIbkmMEOtva8uMyitKb6NH51JLt X-Received: by 10.112.147.131 with SMTP id tk3mr8917373lbb.2.1416315716287; Tue, 18 Nov 2014 05:01:56 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.7.193 with SMTP id l1ls1426545laa.79.gmail; Tue, 18 Nov 2014 05:01:56 -0800 (PST) X-Received: by 10.152.6.228 with SMTP id e4mr19012777laa.71.1416315716148; Tue, 18 Nov 2014 05:01:56 -0800 (PST) Received: from mail-la0-f53.google.com (mail-la0-f53.google.com. [209.85.215.53]) by mx.google.com with ESMTPS id c1si39379516lae.46.2014.11.18.05.01.56 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 18 Nov 2014 05:01:56 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.53 as permitted sender) client-ip=209.85.215.53; Received: by mail-la0-f53.google.com with SMTP id pn19so3094799lab.26 for ; Tue, 18 Nov 2014 05:01:56 -0800 (PST) X-Received: by 10.112.189.10 with SMTP id ge10mr35729027lbc.23.1416315716051; Tue, 18 Nov 2014 05:01:56 -0800 (PST) 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.184.201 with SMTP id ew9csp1323211lbc; Tue, 18 Nov 2014 05:01:55 -0800 (PST) X-Received: by 10.68.215.100 with SMTP id oh4mr37081061pbc.11.1416315714191; Tue, 18 Nov 2014 05:01:54 -0800 (PST) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id mt1si16375465pbb.128.2014.11.18.05.01.53 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Nov 2014 05:01:54 -0800 (PST) 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 1XqiOB-000445-Ge; Tue, 18 Nov 2014 13:00:11 +0000 Received: from mail-wi0-f176.google.com ([209.85.212.176]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XqiLz-0002VG-0G for linux-arm-kernel@lists.infradead.org; Tue, 18 Nov 2014 12:57:55 +0000 Received: by mail-wi0-f176.google.com with SMTP id ex7so1699199wid.15 for ; Tue, 18 Nov 2014 04:57:33 -0800 (PST) X-Received: by 10.194.62.163 with SMTP id z3mr1829620wjr.74.1416315453127; Tue, 18 Nov 2014 04:57:33 -0800 (PST) Received: from ards-macbook-pro.local (cag06-7-83-153-85-71.fbx.proxad.net. [83.153.85.71]) by mx.google.com with ESMTPSA id cz3sm55726799wjb.23.2014.11.18.04.57.31 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 18 Nov 2014 04:57:32 -0800 (PST) From: Ard Biesheuvel To: leif.lindholm@linaro.org, roy.franz@linaro.org, linux-arm-kernel@lists.infradead.org, mark.rutland@arm.com, msalter@redhat.com, dyoung@redhat.com, linux-efi@vger.kernel.org, matt.fleming@intel.com, will.deacon@arm.com, catalin.marinas@arm.com, grant.likely@linaro.org, geoff.levand@linaro.org Subject: [PATCH v3 10/13] arm64/efi: use UEFI memory map unconditionally if available Date: Tue, 18 Nov 2014 13:57:09 +0100 Message-Id: <1416315432-8534-11-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1416315432-8534-1-git-send-email-ard.biesheuvel@linaro.org> References: <1416315432-8534-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141118_045755_226289_5BD10B66 X-CRM114-Status: GOOD ( 13.87 ) 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.176 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [209.85.212.176 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders Cc: 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.215.53 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 On systems that boot via UEFI, all memory nodes are deleted from the device tree, and instead, the size and location of system RAM is derived from the UEFI memory map. This is handled by reserve_regions, which not only reserves parts of memory that UEFI declares as reserved, but also installs the memblocks that cover the remaining usable memory. Currently, reserve_regions() is only called if uefi_init() succeeds. However, it does not actually depend on anything that uefi_init() does, and not calling reserve_regions() results in a broken boot, so it is better to just call it unconditionally. Signed-off-by: Ard Biesheuvel --- arch/arm64/kernel/efi.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c index a48a2f9ab669..3009c22e2620 100644 --- a/arch/arm64/kernel/efi.c +++ b/arch/arm64/kernel/efi.c @@ -180,8 +180,7 @@ void __init efi_init(void) memmap.desc_size = params.desc_size; memmap.desc_version = params.desc_ver; - if (uefi_init() < 0) - return; + WARN_ON(uefi_init() < 0); reserve_regions(); } @@ -190,15 +189,13 @@ static int __init arm64_enter_virtual_mode(void) { u64 mapsize; - if (!efi_enabled(EFI_BOOT)) { - pr_info("EFI services will not be available.\n"); - return -1; - } + if (!efi_enabled(EFI_MEMMAP)) + return 0; mapsize = memmap.map_end - memmap.map; early_memunmap(memmap.map, mapsize); - if (efi_runtime_disabled()) { + if (!efi_enabled(EFI_BOOT) || efi_runtime_disabled()) { pr_info("EFI runtime services will be disabled.\n"); return -1; }