From patchwork Mon Dec 22 19:08:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 42540 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 425DD25BA1 for ; Mon, 22 Dec 2014 19:11:47 +0000 (UTC) Received: by mail-la0-f69.google.com with SMTP id gd6sf3238098lab.8 for ; Mon, 22 Dec 2014 11:11:46 -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 :content-type:content-transfer-encoding:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list; bh=bOsbz4sI4+fz4D10Y6xTrOSrmNAEZ5E9t1PiT9H4Azc=; b=V+n0kZCRpQUmyGImFJqZpr13O2hA55xpzdy0tex9DGzfSz5woAgLYs1nJC2IFG5snN MD/LPjWG0rPoGfi4nmOM0JhEAY53VRVjuJiMiCzsQ5BN6YN5HQXNsDOpl7VFpPCvofB7 tQ+w0qXPjNwyBVHOX8EGFbfb76bKiL052aYXbmGJ+eX2broZSSoun4XwMX2CfAHXhvhP nwdN3FOhCaVHuNz5qAYnxC05XJ6Y2/iZd2T+Wgsi1BrGwR9xQ1Ax4molppLPT6kIFe1m m40/tRuZK6rdfjDbFGej5fvcn1ZvUmOIA94emvzv3EbxWL53H2dGyNCa0htEhDVXHWcq Qgvw== X-Gm-Message-State: ALoCoQmp6MNGQXuzeFKhSbFPeeFYOZ1JMy4V+z788iwFflknJl9VeT0A0OeHWs4ZK61pDWhV/TQT X-Received: by 10.112.42.104 with SMTP id n8mr7499lbl.19.1419275506137; Mon, 22 Dec 2014 11:11:46 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.23.98 with SMTP id l2ls654011laf.73.gmail; Mon, 22 Dec 2014 11:11:46 -0800 (PST) X-Received: by 10.112.12.65 with SMTP id w1mr23498028lbb.68.1419275505993; Mon, 22 Dec 2014 11:11:45 -0800 (PST) Received: from mail-la0-f44.google.com (mail-la0-f44.google.com. [209.85.215.44]) by mx.google.com with ESMTPS id wg10si19310700lbb.118.2014.12.22.11.11.45 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 22 Dec 2014 11:11:45 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) client-ip=209.85.215.44; Received: by mail-la0-f44.google.com with SMTP id gd6so4501940lab.31 for ; Mon, 22 Dec 2014 11:11:45 -0800 (PST) X-Received: by 10.112.84.225 with SMTP id c1mr2268939lbz.22.1419275505828; Mon, 22 Dec 2014 11:11:45 -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.142.69 with SMTP id ru5csp1118552lbb; Mon, 22 Dec 2014 11:11:45 -0800 (PST) X-Received: by 10.66.166.141 with SMTP id zg13mr38030550pab.9.1419275501180; Mon, 22 Dec 2014 11:11:41 -0800 (PST) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id fk7si11506941pab.32.2014.12.22.11.11.40 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Dec 2014 11:11:41 -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 1Y38M9-0006SK-He; Mon, 22 Dec 2014 19:09:25 +0000 Received: from mail-wi0-f173.google.com ([209.85.212.173]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Y38M4-0006Oi-HY for linux-arm-kernel@lists.infradead.org; Mon, 22 Dec 2014 19:09:21 +0000 Received: by mail-wi0-f173.google.com with SMTP id r20so8913631wiv.12 for ; Mon, 22 Dec 2014 11:08:58 -0800 (PST) X-Received: by 10.180.100.98 with SMTP id ex2mr34395787wib.58.1419275338102; Mon, 22 Dec 2014 11:08:58 -0800 (PST) Received: from ards-macbook-pro.local ([41.248.55.245]) by mx.google.com with ESMTPSA id t6sm24758726wjf.49.2014.12.22.11.08.52 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 22 Dec 2014 11:08:56 -0800 (PST) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, linux-efi@vger.kernel.org, leif.lindholm@linaro.org, roy.franz@linaro.org, mark.rutland@arm.com, catalin.marinas@arm.com, will.deacon@arm.com, matt.fleming@intel.com, bp@alien8.de, dyoung@redhat.com, msalter@redhat.com, grant.likely@linaro.org Subject: [PATCH 1/8] arm64/efi: use UEFI memory map unconditionally if available Date: Mon, 22 Dec 2014 19:08:35 +0000 Message-Id: <1419275322-29811-2-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1419275322-29811-1-git-send-email-ard.biesheuvel@linaro.org> References: <1419275322-29811-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141222_110920_762018_B9D80EFE X-CRM114-Status: GOOD ( 13.51 ) 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.173 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [209.85.212.173 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.44 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 d7d2e818c856..d2f483a7cffe 100644 --- a/arch/arm64/kernel/efi.c +++ b/arch/arm64/kernel/efi.c @@ -208,8 +208,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(); } @@ -218,15 +217,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; }