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: 42769 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f200.google.com (mail-lb0-f200.google.com [209.85.217.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 62C4C2055F for ; Tue, 6 Jan 2015 13:43:52 +0000 (UTC) Received: by mail-lb0-f200.google.com with SMTP id u14sf607829lbd.11 for ; Tue, 06 Jan 2015 05:43: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: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=7r2Q7ViNVV2nNCgZ5TQsQZrvP9beiY+kvOo59+kVET0=; b=M0AWbAzB6lj0+dxvcZgBbtCDg/JsnSIIWwjPtozRZtvKRst46gKIeF/XiadVppn4Xk 16d1BL1bJQ/26fe7JlkX/ts2T40KnWMbSExkfRIkXMVO3gUA2EAf+FfMDUJQpd+KIuj4 0TNiTBCWHa5aLE5223qeltLCWJG3UosfHCCTLdgmvXEGA8gCffDXMPWdaUOSQzRclJ2/ hmYMm//7yepZ1g5M+X/iKEILuxbGLr7yI2ZmClxC9J0acCf+W2cjjTvvIlTxHvw6JBoK LldQ0gOH2r60YcyTlnABcZPtzdL1EUn6VgV1Il4PwbqhsyHXaGSSVKxb3ANjMxMwH5WT jTuA== X-Gm-Message-State: ALoCoQnWFQntCYU4FguPP6U1zXUjhVD8kuOv56/NW71sP37n5eKGrvIFMH14BOQ1d7ELngUZJaFz X-Received: by 10.113.5.170 with SMTP id cn10mr5817lbd.21.1420551830928; Tue, 06 Jan 2015 05:43:50 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.206.37 with SMTP id ll5ls39414lac.53.gmail; Tue, 06 Jan 2015 05:43:50 -0800 (PST) X-Received: by 10.112.51.44 with SMTP id h12mr100316576lbo.5.1420551830712; Tue, 06 Jan 2015 05:43:50 -0800 (PST) Received: from mail-lb0-f170.google.com (mail-lb0-f170.google.com. [209.85.217.170]) by mx.google.com with ESMTPS id l8si66030346lag.2.2015.01.06.05.43.50 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 06 Jan 2015 05:43:50 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.170 as permitted sender) client-ip=209.85.217.170; Received: by mail-lb0-f170.google.com with SMTP id 10so19622709lbg.15 for ; Tue, 06 Jan 2015 05:43:50 -0800 (PST) X-Received: by 10.152.45.4 with SMTP id i4mr15133018lam.74.1420551830258; Tue, 06 Jan 2015 05:43:50 -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.9.200 with SMTP id c8csp1178719lbb; Tue, 6 Jan 2015 05:43:49 -0800 (PST) X-Received: by 10.70.129.106 with SMTP id nv10mr153691913pdb.7.1420551828234; Tue, 06 Jan 2015 05:43:48 -0800 (PST) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id qt4si89012120pbb.75.2015.01.06.05.43.47 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Jan 2015 05:43:48 -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 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-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 (/) 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 [74.125.82.50 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [74.125.82.50 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders 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+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: leif.lindholm@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.170 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 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();