From patchwork Thu Jan 8 09:54:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 42869 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E69CE2055F for ; Thu, 8 Jan 2015 09:55:48 +0000 (UTC) Received: by mail-lb0-f198.google.com with SMTP id p9sf1229553lbv.1 for ; Thu, 08 Jan 2015 01:55:47 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=qB4E9AFtqeTSq7mnrDbUHttGUSl9kX086bctcDkuz4Y=; b=MiltGBwiTF2++rOM9NN5ti544ojSGUmWgjjyKOZfowaIQGmMCXFsawIh5BF5DMM6/K AMawZw84zu7qL932Wec7Bn1qYEJuu0lK6AbWNNQL8wJPMqmYNoksN1h9IZbtXbQuStgW hoX4Mzm+GzWIGacAkVSLVSihf8E0FFiCPl1g9BFWBic/naSfIA085qum935WD3pizGkS 1fS6Bjg+nD20DbymhPEswEh2O8y/8McFGcL1qpMk/5tbmjczCXTFFvcnOhndAMGf7m+8 /XfIgbpKhXfFry8yzKrjeRRFGu6D/EN50Hla0UCS34DUNENHSEjPsHE3uulGLS4UIUw5 iRGA== X-Gm-Message-State: ALoCoQmEZTnjq4hhEVT5+JLgNKgBZWd3FUzsuPsMDw5TtmdFukFooIFyirgEvHcVxDe3oyI6FTjy X-Received: by 10.194.71.48 with SMTP id r16mr1987wju.7.1420710947662; Thu, 08 Jan 2015 01:55:47 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.202.198 with SMTP id kk6ls257320lac.103.gmail; Thu, 08 Jan 2015 01:55:47 -0800 (PST) X-Received: by 10.112.172.194 with SMTP id be2mr11856380lbc.53.1420710947499; Thu, 08 Jan 2015 01:55:47 -0800 (PST) Received: from mail-la0-f42.google.com (mail-la0-f42.google.com. [209.85.215.42]) by mx.google.com with ESMTPS id la9si7032950lab.65.2015.01.08.01.55.47 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 08 Jan 2015 01:55:47 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) client-ip=209.85.215.42; Received: by mail-la0-f42.google.com with SMTP id gd6so8248944lab.1 for ; Thu, 08 Jan 2015 01:55:47 -0800 (PST) X-Received: by 10.112.52.229 with SMTP id w5mr11736124lbo.52.1420710947313; Thu, 08 Jan 2015 01:55:47 -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 c8csp216812lbb; Thu, 8 Jan 2015 01:55:46 -0800 (PST) X-Received: by 10.70.91.176 with SMTP id cf16mr13384737pdb.100.1420710945471; Thu, 08 Jan 2015 01:55:45 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id aw3si7729177pbc.87.2015.01.08.01.55.44; Thu, 08 Jan 2015 01:55:45 -0800 (PST) Received-SPF: none (google.com: stable-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753876AbbAHJzn (ORCPT + 1 other); Thu, 8 Jan 2015 04:55:43 -0500 Received: from mail-wg0-f52.google.com ([74.125.82.52]:41186 "EHLO mail-wg0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756092AbbAHJzR (ORCPT ); Thu, 8 Jan 2015 04:55:17 -0500 Received: by mail-wg0-f52.google.com with SMTP id x12so1633297wgg.11 for ; Thu, 08 Jan 2015 01:55:16 -0800 (PST) X-Received: by 10.194.188.39 with SMTP id fx7mr16548439wjc.113.1420710916753; Thu, 08 Jan 2015 01:55:16 -0800 (PST) Received: from ards-macbook-pro.local ([197.130.72.162]) by mx.google.com with ESMTPSA id j10sm5443285wjn.23.2015.01.08.01.55.14 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 08 Jan 2015 01:55:15 -0800 (PST) From: Ard Biesheuvel To: will.deacon@arm.com, catalin.marinas@arm.com, linux-arm-kernel@lists.infradead.org, leif.lindholm@linaro.org, msalter@redhat.com Cc: Ard Biesheuvel , Subject: [PATCH] arm64/efi: add missing call to early_ioremap_reset() Date: Thu, 8 Jan 2015 09:54:58 +0000 Message-Id: <1420710898-32298-1-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 Sender: stable-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: stable@vger.kernel.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.215.42 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 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The early ioremap support introduced by patch bf4b558eba92 ("arm64: add early_ioremap support") failed to add a call to early_ioremap_reset() at an appropriate time. Without this call, invocations of early_ioremap etc. that are done too late will go unnoticed and may cause corruption. This is exactly what happened when the first user of this feature was added in patch f84d02755f5a ("arm64: add EFI runtime services"). The early mapping of the EFI memory map is unmapped during an early initcall, at which time the early ioremap support is long gone. Fix by adding the missing call to early_ioremap_reset() to setup_arch(), and move the offending early_memunmap() to right after the point where the early mapping of the EFI memory map is last used. Fixes: f84d02755f5a ("arm64: add EFI runtime services") Cc: Signed-off-by: Leif Lindholm Signed-off-by: Ard Biesheuvel --- After discussing off-list between Mark Salter, Leif and myself, this is the bare minimum to fix the early ioremap issue in kernels up to 3.19, combined into a single patch. Considering that the early_ioremap support was added in 3.15 (eol), but not used until EFI runtime services support was added in 3.16, there is no reason to split this up. Also, we have work underway to drastically change the way runtime services etc are mapped during early boot [which we hope will make it into 3.20] so it makes sense to do the bare minimum here and handle any fallout in terms of style etc later. arch/arm64/kernel/efi.c | 2 +- arch/arm64/kernel/setup.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c index 6fac253bc783..2bb4347d0edf 100644 --- a/arch/arm64/kernel/efi.c +++ b/arch/arm64/kernel/efi.c @@ -326,6 +326,7 @@ void __init efi_idmap_init(void) /* boot time idmap_pg_dir is incomplete, so fill in missing parts */ efi_setup_idmap(); + early_memunmap(memmap.map, memmap.map_end - memmap.map); } static int __init remap_region(efi_memory_desc_t *md, void **new) @@ -380,7 +381,6 @@ static int __init arm64_enter_virtual_mode(void) } mapsize = memmap.map_end - memmap.map; - early_memunmap(memmap.map, mapsize); if (efi_runtime_disabled()) { pr_info("EFI runtime services will be disabled.\n"); diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c index b80991166754..20fe2932ad0c 100644 --- a/arch/arm64/kernel/setup.c +++ b/arch/arm64/kernel/setup.c @@ -402,6 +402,7 @@ void __init setup_arch(char **cmdline_p) request_standard_resources(); efi_idmap_init(); + early_ioremap_reset(); unflatten_device_tree();