From patchwork Fri May 9 00:48:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geoff Levand X-Patchwork-Id: 4139771 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.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B21BE9F23C for ; Fri, 9 May 2014 00:51:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EBD95202EA for ; Fri, 9 May 2014 00:50:59 +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 175FA202EC for ; Fri, 9 May 2014 00:50:59 +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 1WiYzb-0004Qd-HM; Fri, 09 May 2014 00:48:51 +0000 Received: from merlin.infradead.org ([2001:4978:20e::2]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WiYz5-0004G1-Uy; Fri, 09 May 2014 00:48:20 +0000 Received: from geoff by merlin.infradead.org with local (Exim 4.80.1 #2 (Red Hat Linux)) id 1WiYz3-0007iv-OV; Fri, 09 May 2014 00:48:17 +0000 Message-Id: <4f77128335984c2678eda4e9db39d8bedfc77fab.1399594544.git.geoff@infradead.org> In-Reply-To: References: From: Geoff Levand Patch-Date: Wed, 7 May 2014 13:00:32 -0700 Subject: [PATCH 5/8] arm64: Split soft_restart into two stages To: Catalin Marinas , Will Deacon Date: Fri, 09 May 2014 00:48:17 +0000 Cc: Deepak Saxena , kexec@lists.infradead.org, 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=-2.5 required=5.0 tests=BAYES_00,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 Remove the call to setup_restart() from within soft_restart(), change setup_restart() from local to global scope by removing its static attribute, and add a function prototype for setup_restart() in system_misc.h. Splitting setup_restart() and soft_restart() into two different operations allows for the calling routine to call setup_restart(), then perform some operation with the identity map in enabled, and then call soft_restart() to disable the MMU and perform the soft reset. It is expected that the calling routine will call setup_restart(), then shortly thereafter call soft_restart(). To properly manage the shutdown of spin-table secondary CPUs it is necessary to transition those CPUs into a state compatible with booting.txt. The existing implementation of soft_restart() did not allow for the transition to an identity mapped spin loop. Signed-off-by: Geoff Levand --- arch/arm64/include/asm/system_misc.h | 1 + arch/arm64/kernel/process.c | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/arm64/include/asm/system_misc.h b/arch/arm64/include/asm/system_misc.h index 7a18fab..15bc824 100644 --- a/arch/arm64/include/asm/system_misc.h +++ b/arch/arm64/include/asm/system_misc.h @@ -41,6 +41,7 @@ struct mm_struct; extern void show_pte(struct mm_struct *mm, unsigned long addr); extern void __show_regs(struct pt_regs *); +void setup_restart(void); void soft_restart(unsigned long); extern void (*arm_pm_restart)(enum reboot_mode reboot_mode, const char *cmd); diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c index 6391485..d52c660 100644 --- a/arch/arm64/kernel/process.c +++ b/arch/arm64/kernel/process.c @@ -50,7 +50,7 @@ #include #include -static void setup_restart(void) +void setup_restart(void) { /* * Tell the mm system that we are going to reboot - @@ -74,8 +74,6 @@ void soft_restart(unsigned long addr) typedef void (*phys_reset_t)(unsigned long); phys_reset_t phys_reset; - setup_restart(); - /* Switch to the identity mapping */ phys_reset = (phys_reset_t)virt_to_phys(cpu_reset); phys_reset(addr);