From patchwork Sat Jan 11 13:05:20 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leif Lindholm X-Patchwork-Id: 23128 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f198.google.com (mail-pd0-f198.google.com [209.85.192.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C0DBA218BC for ; Sat, 11 Jan 2014 13:05:58 +0000 (UTC) Received: by mail-pd0-f198.google.com with SMTP id z10sf868584pdj.5 for ; Sat, 11 Jan 2014 05:05:58 -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:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=vci4uVf2AZThrNfJ3h7r0FOc2XxFM1Rkx/eCTHBwNXw=; b=IlX2OguOzaosMlcPIC9Dg4wk970nL7X0GdqbnQ6HwRGXOVrU5MorOrO/j5bi3hla2G 5ddjgwaUdUHlgtnFYrINQsV408HmjLPOHwgpnDqQq8bOt/tttysWsMsCccs4PvT2ypwI ocCjOXVYSB3SmjQ+2bFyyxsdKgxMFXu/dpzYEDlY+QVdLes59HMTd72aKeK7UtvliDRx NP6LMo5pqQEWUGDllzR1ssRTKixScwlX0GY8eNx2BK2aOEQM/EMlR8XM/rV/+HvW5hpR GimPD+FAogobph/f3JrcPufTcipATgxI127U3k3tv6zhGxjU5OemcWgZee7jm7dHjHT4 GLsg== X-Gm-Message-State: ALoCoQnxOuP7grhdQYEBgP47ivemxYs4wi4hikMfczSGdDWgBvXEcTL6hslKysirGmePOnSeI0Mx X-Received: by 10.68.197.73 with SMTP id is9mr721730pbc.0.1389445558036; Sat, 11 Jan 2014 05:05:58 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.40.194 with SMTP id z2ls2025221qek.23.gmail; Sat, 11 Jan 2014 05:05:57 -0800 (PST) X-Received: by 10.58.85.133 with SMTP id h5mr12412428vez.4.1389445557923; Sat, 11 Jan 2014 05:05:57 -0800 (PST) Received: from mail-vb0-f42.google.com (mail-vb0-f42.google.com [209.85.212.42]) by mx.google.com with ESMTPS id sc7si7117084vdc.43.2014.01.11.05.05.57 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 11 Jan 2014 05:05:57 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.42 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.42; Received: by mail-vb0-f42.google.com with SMTP id i11so900782vbh.15 for ; Sat, 11 Jan 2014 05:05:57 -0800 (PST) X-Received: by 10.52.170.241 with SMTP id ap17mr10299140vdc.13.1389445557636; Sat, 11 Jan 2014 05:05:57 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.59.13.131 with SMTP id ey3csp22095ved; Sat, 11 Jan 2014 05:05:57 -0800 (PST) X-Received: by 10.180.149.175 with SMTP id ub15mr7501255wib.10.1389445556604; Sat, 11 Jan 2014 05:05:56 -0800 (PST) Received: from mail-wg0-f43.google.com (mail-wg0-f43.google.com [74.125.82.43]) by mx.google.com with ESMTPS id c2si5712764wjx.84.2014.01.11.05.05.56 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 11 Jan 2014 05:05:56 -0800 (PST) Received-SPF: neutral (google.com: 74.125.82.43 is neither permitted nor denied by best guess record for domain of leif.lindholm@linaro.org) client-ip=74.125.82.43; Received: by mail-wg0-f43.google.com with SMTP id k14so5093683wgh.22 for ; Sat, 11 Jan 2014 05:05:56 -0800 (PST) X-Received: by 10.180.87.232 with SMTP id bb8mr7339710wib.48.1389445556153; Sat, 11 Jan 2014 05:05:56 -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 f7sm6549731wjb.7.2014.01.11.05.05.52 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 11 Jan 2014 05:05:53 -0800 (PST) From: Leif Lindholm To: linux-kernel@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-efi@vger.kernel.org, matt.fleming@intel.com, roy.franz@linaro.org, msalter@redhat.com, linux@arm.linux.org.uk, grant.likely@secretlab.ca, patches@linaro.org, Leif Lindholm Subject: [PATCH v4 1/5] arm: break part of __soft_restart out into separate function Date: Sat, 11 Jan 2014 13:05:20 +0000 Message-Id: <1389445524-30623-2-git-send-email-leif.lindholm@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1389445524-30623-1-git-send-email-leif.lindholm@linaro.org> References: <1389445524-30623-1-git-send-email-leif.lindholm@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: leif.lindholm@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.42 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Certain operations can be considered mandatory for any piece of code preparing to switch off the MMU. Break this out into separate function dmap_prepare(). Signed-off-by: Leif Lindholm Suggested-by: Will Deacon --- arch/arm/include/asm/idmap.h | 1 + arch/arm/kernel/process.c | 12 +----------- arch/arm/mm/idmap.c | 15 +++++++++++++++ 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/arch/arm/include/asm/idmap.h b/arch/arm/include/asm/idmap.h index bf863ed..2e914a8 100644 --- a/arch/arm/include/asm/idmap.h +++ b/arch/arm/include/asm/idmap.h @@ -10,5 +10,6 @@ extern pgd_t *idmap_pgd; void setup_mm_for_reboot(void); +void idmap_prepare(void); #endif /* __ASM_IDMAP_H */ diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c index 92f7b15..91b4cec 100644 --- a/arch/arm/kernel/process.c +++ b/arch/arm/kernel/process.c @@ -75,17 +75,7 @@ static void __soft_restart(void *addr) { phys_reset_t phys_reset; - /* Take out a flat memory mapping. */ - setup_mm_for_reboot(); - - /* Clean and invalidate caches */ - flush_cache_all(); - - /* Turn off caching */ - cpu_proc_fin(); - - /* Push out any further dirty data, and ensure cache is empty */ - flush_cache_all(); + idmap_prepare(); /* Switch to the identity mapping. */ phys_reset = (phys_reset_t)(unsigned long)virt_to_phys(cpu_reset); diff --git a/arch/arm/mm/idmap.c b/arch/arm/mm/idmap.c index 8e0e52e..5c85779 100644 --- a/arch/arm/mm/idmap.c +++ b/arch/arm/mm/idmap.c @@ -122,3 +122,18 @@ void setup_mm_for_reboot(void) local_flush_tlb_all(); #endif } + +void idmap_prepare(void) +{ + /* Take out a flat memory mapping. */ + setup_mm_for_reboot(); + + /* Clean and invalidate caches */ + flush_cache_all(); + + /* Turn off caching */ + cpu_proc_fin(); + + /* Push out any further dirty data, and ensure cache is empty */ + flush_cache_all(); +}