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: 3469281 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 35F2AC02DC for ; Sat, 11 Jan 2014 13:12:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 490F72015D for ; Sat, 11 Jan 2014 13:12:43 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (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 523962015B for ; Sat, 11 Jan 2014 13:12:42 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W1yMf-0003YA-TL; Sat, 11 Jan 2014 13:12:38 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1W1yMd-0004VA-Bo; Sat, 11 Jan 2014 13:12:35 +0000 Received: from mail-we0-f178.google.com ([74.125.82.178]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W1yMa-0004Ua-If for linux-arm-kernel@lists.infradead.org; Sat, 11 Jan 2014 13:12:33 +0000 Received: by mail-we0-f178.google.com with SMTP id t60so5105298wes.9 for ; Sat, 11 Jan 2014 05:12:10 -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=vci4uVf2AZThrNfJ3h7r0FOc2XxFM1Rkx/eCTHBwNXw=; b=LhA8ZP5xR08VULDGs1/zQq1BbOOIiF0Hvtup4lchXhxwt6O5mDJfqW7v/4vkvtFJBI y0QybmkXdqmX7QgbWaGdWlAW1IbBeQk0CbvRaz95pC8hUL+QNLlA6haj5pLGx24Ws0UP x1N1R24T0avDhGIg5PyFkk6DE7cxQFOAT0S2cEUy+2xe72J4hzWdjHs9xTuY9xo5CFEG bckQj8qOinJyDaqAjKNz3DwqHG++EbzzAPyxvr1M1vW+frvwYLCJ/s+i79Nbks3Fphhl kZ/TipyPcsQsk1wjRADGY2VhMwP1VNi0VDWrBVZAwcbH0/94AB/6VvhIg7N6v7zbmIgp 34/g== X-Gm-Message-State: ALoCoQlMFtobO5NzojW1Piqrj2iNq9RFLSDYKGbNz6ZTuHdP5xpzFkRZ08FFdm9048lzhqhjORwB 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 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140111_081232_725311_E4C0B9C4 X-CRM114-Status: GOOD ( 11.85 ) X-Spam-Score: -2.6 (--) Cc: grant.likely@secretlab.ca, linux-efi@vger.kernel.org, linux@arm.linux.org.uk, patches@linaro.org, Leif Lindholm , roy.franz@linaro.org, matt.fleming@intel.com, msalter@redhat.com, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 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.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 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(); +}