From patchwork Tue Aug 12 06:10:20 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Young X-Patchwork-Id: 379195 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-qg0-x237.google.com (mail-qg0-x237.google.com [IPv6:2607:f8b0:400d:c04::237]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id E35BA140088 for ; Tue, 12 Aug 2014 16:11:02 +1000 (EST) Received: by mail-qg0-f55.google.com with SMTP id j107sf1962855qga.20 for ; Mon, 11 Aug 2014 23:11:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20120806; h=mime-version:from:to:cc:subject:date:message-id:in-reply-to :references:x-original-sender:x-original-authentication-results :reply-to:precedence:mailing-list:list-id:list-post:list-help :list-archive:sender:list-subscribe:list-unsubscribe:content-type; bh=mzReaxARacoiut3PbBJMyU7APeKY3mIENEFQVF8uAxk=; b=cCHJG7CCqHv1TElgB2zwhiUouMuAdRzYNbij0vkq1+NfNDDcIRIPPtkt8TtZ1p+Egv PW9sZWFgsyXo9Z2OCj+Xd5R6iHlYv5iRC9ONl3cCUhysGRnG5Eve+xbFUMMdZIsnziHX d/86sG9STW+5UAl45FtAb0L2fWzr5EUffrZKVRzUZZXUlQcp+hPzw0Mj/u6gSluqMPJm pbhYOnjMZ9+BPfK2AnoDoPKvhT0pcjjht/7wsdwU4+sud6N+Xnc4QR6bkLfydtOQboyc Vpm2f+/dJXw0ZJA9voD8kVi0YeutIZuzj8zrYe2ZiF5+2bi0KE+YBNgDbe2D5NWWtBcQ tjeQ== X-Received: by 10.50.138.69 with SMTP id qo5mr620524igb.7.1407823860485; Mon, 11 Aug 2014 23:11:00 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: rtc-linux@googlegroups.com Received: by 10.50.55.100 with SMTP id r4ls187134igp.32.gmail; Mon, 11 Aug 2014 23:11:00 -0700 (PDT) X-Received: by 10.66.160.164 with SMTP id xl4mr73645pab.48.1407823860242; Mon, 11 Aug 2014 23:11:00 -0700 (PDT) Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by gmr-mx.google.com with ESMTPS id cj6si2060804qcb.1.2014.08.11.23.10.59 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Aug 2014 23:11:00 -0700 (PDT) Received-SPF: pass (google.com: domain of dyoung@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s7C6AsBq029571 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 12 Aug 2014 02:10:54 -0400 Received: from dhcp-16-198.nay.redhat.com (dhcp-16-104.nay.redhat.com [10.66.16.104]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s7C6AO6a002703; Tue, 12 Aug 2014 02:10:45 -0400 From: Dave Young To: Matt Fleming Cc: Catalin Marinas , Will Deacon , Thomas Gleixner , Ingo Molnar , hpa@zytor.com, Alessandro Zummo , Leif Lindholm , Ard Biesheuvel , Mark Salter , Randy Dunlap , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-efi@vger.kernel.org, rtc-linux@googlegroups.com Subject: [rtc-linux] [PATCH 3/5] efi arm64: do not enter virtual mode in case booting with efi=noruntime or noefi Date: Tue, 12 Aug 2014 14:10:20 +0800 Message-Id: <1407823822-23829-3-git-send-email-dyoung@redhat.com> In-Reply-To: <1407823822-23829-1-git-send-email-dyoung@redhat.com> References: <1407823822-23829-1-git-send-email-dyoung@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Original-Sender: dyoung@redhat.com X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of dyoung@redhat.com designates 209.132.183.28 as permitted sender) smtp.mail=dyoung@redhat.com Reply-To: rtc-linux@googlegroups.com Precedence: list Mailing-list: list rtc-linux@googlegroups.com; contact rtc-linux+owners@googlegroups.com List-ID: X-Google-Group-Id: 712029733259 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , In case efi runtime disabled via noefi kernel cmdline arm64_enter_virtual_mode should error out. At the same time move early_memunmap(memmap.map, mapsize) to the beginning of the function or it will leak early mem. Signed-off-by: Dave Young --- arch/arm64/kernel/efi.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c index e72f310..324cdd1 100644 --- a/arch/arm64/kernel/efi.c +++ b/arch/arm64/kernel/efi.c @@ -386,7 +386,10 @@ static int __init arm64_enter_virtual_mode(void) int count = 0; unsigned long flags; - if (!efi_enabled(EFI_BOOT)) { + mapsize = memmap.map_end - memmap.map; + early_memunmap(memmap.map, mapsize); + + if (!efi_enabled(EFI_BOOT) || efi_runtime_disabled()) { pr_info("EFI services will not be available.\n"); return -1; } @@ -394,8 +397,6 @@ static int __init arm64_enter_virtual_mode(void) pr_info("Remapping and enabling EFI services.\n"); /* replace early memmap mapping with permanent mapping */ - mapsize = memmap.map_end - memmap.map; - early_memunmap(memmap.map, mapsize); memmap.map = (__force void *)ioremap_cache((phys_addr_t)memmap.phys_map, mapsize); memmap.map_end = memmap.map + mapsize;