From patchwork Thu Nov 6 14:13:24 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 40292 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 324C824237 for ; Thu, 6 Nov 2014 14:17:19 +0000 (UTC) Received: by mail-lb0-f199.google.com with SMTP id n15sf710829lbi.6 for ; Thu, 06 Nov 2014 06:17:18 -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=bd6Bi0E9oHomdPclmVa/79WBtxotZWo9i8rBViTLpZU9I8MGkqI7ydmCCeuSVAboTV nneiEXT6QlWKN8/HI/3Tvm+Bs8A7FY7gV2lCYp3QgDv9rHEvL0MPUaA6siJ9DU7U1d5y Sag6cEYB22UuTZ7twu99JnEE1WnAn6RIoXM6EViaTQNgekt4Peq+UKOQCLQk+sAaNoAO OVGcjPtVun7BsYd+fEzDfdw1r9PpKt57QBIo5W7AYL/0/zdJxFgyJMPxZHQwB85BeyBj 27dBpduzOtTMjluSobDym2k+EonPT/JDSOhlkwADdcAWoZRq2O8k+15zBzHxTPDEodI0 mfJA== X-Gm-Message-State: ALoCoQkGvvnVZyLHyHye/sXjsFlnycP8GnN0W3xlx2tcvuVYQs9luGkHtOIrmFxKIBTKZIXVeD2E X-Received: by 10.180.90.115 with SMTP id bv19mr6571890wib.1.1415283437757; Thu, 06 Nov 2014 06:17:17 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.21.6 with SMTP id r6ls92508lae.5.gmail; Thu, 06 Nov 2014 06:17:17 -0800 (PST) X-Received: by 10.112.151.70 with SMTP id uo6mr5370168lbb.2.1415283437600; Thu, 06 Nov 2014 06:17:17 -0800 (PST) Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com. [209.85.217.179]) by mx.google.com with ESMTPS id od3si11572935lbb.84.2014.11.06.06.17.17 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 06 Nov 2014 06:17:17 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) client-ip=209.85.217.179; Received: by mail-lb0-f179.google.com with SMTP id l4so981557lbv.10 for ; Thu, 06 Nov 2014 06:17:17 -0800 (PST) X-Received: by 10.152.5.38 with SMTP id p6mr5307859lap.44.1415283437369; Thu, 06 Nov 2014 06:17:17 -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 ew9csp50027lbc; Thu, 6 Nov 2014 06:17:16 -0800 (PST) X-Received: by 10.70.130.47 with SMTP id ob15mr4745053pdb.112.1415283435499; Thu, 06 Nov 2014 06:17:15 -0800 (PST) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id r2si4875212pdc.49.2014.11.06.06.17.14 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Nov 2014 06:17:15 -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 1XmNqd-0006xS-A2; Thu, 06 Nov 2014 14:15:39 +0000 Received: from mail-wg0-f44.google.com ([74.125.82.44]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XmNpX-0005Bs-3y for linux-arm-kernel@lists.infradead.org; Thu, 06 Nov 2014 14:14:31 +0000 Received: by mail-wg0-f44.google.com with SMTP id x12so1290948wgg.17 for ; Thu, 06 Nov 2014 06:14:09 -0800 (PST) X-Received: by 10.180.84.132 with SMTP id z4mr30207263wiy.55.1415283249083; Thu, 06 Nov 2014 06:14:09 -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 mw7sm8450413wib.14.2014.11.06.06.14.07 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 06 Nov 2014 06:14:08 -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 Subject: [PATCH v2 08/10] arm64/efi: use UEFI memory map unconditionally if available Date: Thu, 6 Nov 2014 15:13:24 +0100 Message-Id: <1415283206-14713-9-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1415283206-14713-1-git-send-email-ard.biesheuvel@linaro.org> References: <1415283206-14713-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141106_061431_337752_1B6D8178 X-CRM114-Status: GOOD ( 14.00 ) 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.0 SPF_PASS SPF: sender matches SPF record -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [74.125.82.44 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [74.125.82.44 listed in wl.mailspike.net] -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.217.179 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; }