From patchwork Tue Sep 9 22:49:05 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geoff Levand X-Patchwork-Id: 4873211 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 036ECC0338 for ; Tue, 9 Sep 2014 22:52:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 42CE42018B for ; Tue, 9 Sep 2014 22:52:45 +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 8378B2017E for ; Tue, 9 Sep 2014 22:52:44 +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 1XRUEZ-0005Cv-Vf; Tue, 09 Sep 2014 22:49:59 +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 1XRUDi-0004c5-3J; Tue, 09 Sep 2014 22:49:06 +0000 Received: from geoff by merlin.infradead.org with local (Exim 4.80.1 #2 (Red Hat Linux)) id 1XRUDh-0007S8-0L; Tue, 09 Sep 2014 22:49:05 +0000 Message-Id: <36ad9302497338a34cc7174a72a2ac99ceb16fdb.1410302383.git.geoff@infradead.org> In-Reply-To: References: From: Geoff Levand Patch-Date: Tue, 9 Sep 2014 12:35:13 -0700 Subject: [PATCH 08/13] arm64: Use cpu_ops for smp_stop To: Catalin Marinas , Will Deacon Date: Tue, 09 Sep 2014 22:49:05 +0000 Cc: marc.zyngier@arm.com, kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org, christoffer.dall@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+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, 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 The current implementation of ipi_cpu_stop() is just a tight infinite loop around cpu_relax(). This infinite loop implementation is OK if the machine will soon do a poweroff, but it doesn't have any mechanism to allow a CPU to be brought back on-line, nor is it compatible with kexec re-boot. Add a check for a valid cpu_die method of the appropriate cpu_ops structure, and if a valid method is found, transfer control to that method. It is expected that the cpu_die method puts the CPU into a state such that they can be brought back on-line or progress through a kexec re-boot. Signed-off-by: Geoff Levand --- arch/arm64/kernel/smp.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c index 4743397..002aa8a 100644 --- a/arch/arm64/kernel/smp.c +++ b/arch/arm64/kernel/smp.c @@ -555,6 +555,15 @@ static void ipi_cpu_stop(unsigned int cpu) local_irq_disable(); + /* If we have the cpu ops use them. */ + + if (cpu_ops[cpu]->cpu_disable && + cpu_ops[cpu]->cpu_die && + !cpu_ops[cpu]->cpu_disable(cpu)) + cpu_ops[cpu]->cpu_die(cpu); + + /* Otherwise spin here. */ + while (1) cpu_relax(); }