From patchwork Wed Oct 22 14:21:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 39314 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f70.google.com (mail-la0-f70.google.com [209.85.215.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 028FC202DB for ; Wed, 22 Oct 2014 14:25:34 +0000 (UTC) Received: by mail-la0-f70.google.com with SMTP id ge10sf2121436lab.9 for ; Wed, 22 Oct 2014 07:25:33 -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:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:content-type:content-transfer-encoding; bh=rQ4uBDJWzKeHup/o7WCw3yS4/Yu9uG/nsDrndE1U0hw=; b=fuGuK/mOAIhQ9p3WjKm8VQkkpUwI25yOA/+rOBKpBs8I+OcV2vmSJniHAj6j6Gg4ok OAnFv7/rgoMZKy194PVUoYbrpr34/gx6VWVLeFuCOTi2O/Vr0SlIUWXn9SMfuc1UF7Jb DbWf3kpQOyhQjUbJvsSXG0pGxk+p6BnoOL77V1abnzt5uuDgSZ5ljARbhDm1NOU27es5 vtCIlaCAy3CYCuZ9+E7SmlICHv/O9y4Y45wTveFqMO0HCAjYIFrBYTpVtCc9PMCyuKhX +7odM3onRsuqxtYpzXtOLu5+Ccgk/CvVOTOFHWp8fANxwYmvRE9DK7lrx7SmogFU3E69 2cKw== X-Gm-Message-State: ALoCoQlaNMN3UzXWFfT2giSkPS4eejP8C5K71X1IPNtPMpq8tBIMlIIPszvaQ++n/YSBOrtMGKxg X-Received: by 10.180.75.83 with SMTP id a19mr4945539wiw.2.1413987933776; Wed, 22 Oct 2014 07:25:33 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.9.130 with SMTP id z2ls208812laa.61.gmail; Wed, 22 Oct 2014 07:25:33 -0700 (PDT) X-Received: by 10.152.205.103 with SMTP id lf7mr42092248lac.2.1413987933618; Wed, 22 Oct 2014 07:25:33 -0700 (PDT) Received: from mail-lb0-f171.google.com (mail-lb0-f171.google.com. [209.85.217.171]) by mx.google.com with ESMTPS id ei3si23518965lad.84.2014.10.22.07.25.33 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 22 Oct 2014 07:25:33 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.171 as permitted sender) client-ip=209.85.217.171; Received: by mail-lb0-f171.google.com with SMTP id z12so2947934lbi.30 for ; Wed, 22 Oct 2014 07:25:33 -0700 (PDT) X-Received: by 10.112.77.74 with SMTP id q10mr33442372lbw.66.1413987933522; Wed, 22 Oct 2014 07:25:33 -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.84.229 with SMTP id c5csp82370lbz; Wed, 22 Oct 2014 07:25:32 -0700 (PDT) X-Received: by 10.66.228.106 with SMTP id sh10mr23303034pac.108.1413987932065; Wed, 22 Oct 2014 07:25:32 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id dv2si12265882pdb.15.2014.10.22.07.25.31 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Oct 2014 07:25:32 -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 1XgwpX-0000tj-N7; Wed, 22 Oct 2014 14:24:03 +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 1XgwoI-00008P-EC for linux-arm-kernel@lists.infradead.org; Wed, 22 Oct 2014 14:22:47 +0000 Received: by mail-wi0-f173.google.com with SMTP id fb4so1529015wid.12 for ; Wed, 22 Oct 2014 07:22:24 -0700 (PDT) X-Received: by 10.180.13.11 with SMTP id d11mr16932911wic.19.1413987744074; Wed, 22 Oct 2014 07:22:24 -0700 (PDT) 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 10sm19063250wjs.21.2014.10.22.07.22.22 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 22 Oct 2014 07:22:23 -0700 (PDT) From: Ard Biesheuvel To: leif.lindholm@linaro.org, roy.franz@linaro.org, msalter@redhat.com, mark.rutland@arm.com, will.deacon@arm.com, catalin.marinas@arm.com, matt.fleming@intel.com, linux-efi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, dyoung@redhat.com, yi.li@linaro.org Subject: [PATCH 06/10] arm64/efi: use UEFI memory map unconditionally if available Date: Wed, 22 Oct 2014 16:21:49 +0200 Message-Id: <1413987713-30528-7-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1413987713-30528-1-git-send-email-ard.biesheuvel@linaro.org> References: <1413987713-30528-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141022_072246_634280_DFA0A304 X-CRM114-Status: GOOD ( 14.48 ) 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 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [209.85.212.173 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.171 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 51522ab0c6da..4cec21b1ecdd 100644 --- a/arch/arm64/kernel/efi.c +++ b/arch/arm64/kernel/efi.c @@ -313,8 +313,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(); } @@ -374,15 +373,13 @@ static int __init arm64_enter_virtual_mode(void) int count = 0; unsigned long flags; - 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; }