From patchwork Tue Jan 6 13:41:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leif Lindholm X-Patchwork-Id: 5573721 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0EB4A9F2ED for ; Tue, 6 Jan 2015 13:44:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2646A201EC for ; Tue, 6 Jan 2015 13:44:38 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3294F20121 for ; Tue, 6 Jan 2015 13:44:37 +0000 (UTC) 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 1Y8UOP-0005Em-QM; Tue, 06 Jan 2015 13:41:53 +0000 Received: from mail-wg0-f50.google.com ([74.125.82.50]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Y8UNl-0004aa-Rr for linux-arm-kernel@lists.infradead.org; Tue, 06 Jan 2015 13:41:15 +0000 Received: by mail-wg0-f50.google.com with SMTP id a1so29404119wgh.37 for ; Tue, 06 Jan 2015 05:40:51 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=BalmmoiPskJX1xOiipn1MMPB4Nd/Tx3rP16BktxzkV8=; b=PwY9zgyzpbMA/KgpD44MqdZh3iV1MxGb46rYOo5bTfRIThSfDsUkv41SLJWrAWq1Dr kuE8+po1dEKQHoqNXEwDHHWRwknotk9EqGW6sDs+aZEuacJq7FdGQg1DZsu37wM70FPT Bvk2c8EixYLmv0qV3CxkHNz08ifdcJ8O3nU9TXoiTLNNI/7yRSpxZ4pXTGJMQCx4nAbf 1nvf5YgmlvFMsJsfpWF1Py1S24MnG0dgzl+1X1TiqQIKtxAWi5HyB/Ebixtk0POySeyR DAJUsTp6EegB/rWvG2HFz/UKIeMH7+/YZGDXF5VpAneKnTqK4EmZ6gncruFWfXXrRhft iZlw== X-Gm-Message-State: ALoCoQne4amjHxBbowel5MmOV+7UtA2oJAEVZBfFpOFwbkOfB71JbMUiQaJCEZfYiFF5X2pY2UuE X-Received: by 10.180.206.79 with SMTP id lm15mr37125033wic.67.1420551651732; Tue, 06 Jan 2015 05:40:51 -0800 (PST) Received: from mohikan.mushroom.smurfnet.nu (cpc4-cmbg17-2-0-cust71.5-4.cable.virginm.net. [86.14.224.72]) by mx.google.com with ESMTPSA id f1sm68239903wjw.30.2015.01.06.05.40.50 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 06 Jan 2015 05:40:50 -0800 (PST) From: Leif Lindholm To: msalter@redhat.com, linux-arm-kernel@lists.infradead.org, linux-efi@vger.kernel.org, will.deacon@arm.com Subject: [PATCH v2 1/2] arm64: don't make early_*map() calls post paging_init() Date: Tue, 6 Jan 2015 13:41:12 +0000 Message-Id: <1420551673-31416-2-git-send-email-leif.lindholm@linaro.org> X-Mailer: git-send-email 2.1.3 In-Reply-To: <1420551673-31416-1-git-send-email-leif.lindholm@linaro.org> References: <1420551673-31416-1-git-send-email-leif.lindholm@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150106_054114_088496_FF82BC05 X-CRM114-Status: GOOD ( 14.15 ) X-Spam-Score: -0.7 (/) Cc: catalin.marinas@arm.com, ard.biesheuvel@linaro.org 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+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP arm64 early_ioremap/iounmap/memremap/memunmap are not supported beyond the call to paging_init(), but arm64_enter_virtual_mode() (an early initcall) makes one call to unmap the UEFI memory map. Rearrange the code to unmap this region before paging_init(), and then pull back the remapping of the EFI memory map to the second part of UEFI initialisation - efi_idmap_init() - renaming that function as efi_memmap_init(), which better describes what it now does. Signed-off-by: Leif Lindholm Fixes: f84d02755f5a ("arm64: add EFI runtime services") --- arch/arm64/include/asm/efi.h | 4 ++-- arch/arm64/kernel/efi.c | 27 ++++++++++++++------------- arch/arm64/kernel/setup.c | 2 +- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/arch/arm64/include/asm/efi.h b/arch/arm64/include/asm/efi.h index a34fd3b..92f4d44 100644 --- a/arch/arm64/include/asm/efi.h +++ b/arch/arm64/include/asm/efi.h @@ -6,10 +6,10 @@ #ifdef CONFIG_EFI extern void efi_init(void); -extern void efi_idmap_init(void); +extern void efi_memmap_init(void); #else #define efi_init() -#define efi_idmap_init() +#define efi_memmap_init() #endif #define efi_call_virt(f, ...) \ diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c index 6fac253..e311066 100644 --- a/arch/arm64/kernel/efi.c +++ b/arch/arm64/kernel/efi.c @@ -313,17 +313,26 @@ void __init efi_init(void) memmap.desc_size = params.desc_size; memmap.desc_version = params.desc_ver; - if (uefi_init() < 0) - return; + if (uefi_init() >= 0) + reserve_regions(); - reserve_regions(); + early_memunmap(memmap.map, params.mmap_size); } -void __init efi_idmap_init(void) +void __init efi_memmap_init(void) { + u64 mapsize; + if (!efi_enabled(EFI_BOOT)) return; + /* replace early memmap mapping with permanent mapping */ + mapsize = memmap.map_end - memmap.map; + memmap.map = (__force void *)ioremap_cache((phys_addr_t)memmap.phys_map, + mapsize); + memmap.map_end = memmap.map + mapsize; + efi.memmap = &memmap; + /* boot time idmap_pg_dir is incomplete, so fill in missing parts */ efi_setup_idmap(); } @@ -379,23 +388,15 @@ static int __init arm64_enter_virtual_mode(void) return -1; } - mapsize = memmap.map_end - memmap.map; - early_memunmap(memmap.map, mapsize); - if (efi_runtime_disabled()) { pr_info("EFI runtime services will be disabled.\n"); return -1; } pr_info("Remapping and enabling EFI services.\n"); - /* replace early memmap mapping with permanent mapping */ - memmap.map = (__force void *)ioremap_cache((phys_addr_t)memmap.phys_map, - mapsize); - memmap.map_end = memmap.map + mapsize; - - efi.memmap = &memmap; /* Map the runtime regions */ + mapsize = memmap.map_end - memmap.map; virtmap = kmalloc(mapsize, GFP_KERNEL); if (!virtmap) { pr_err("Failed to allocate EFI virtual memmap\n"); diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c index b809911..ebf7820 100644 --- a/arch/arm64/kernel/setup.c +++ b/arch/arm64/kernel/setup.c @@ -401,7 +401,7 @@ void __init setup_arch(char **cmdline_p) paging_init(); request_standard_resources(); - efi_idmap_init(); + efi_memmap_init(); unflatten_device_tree();