From patchwork Mon Oct 19 23:38:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geoff Levand X-Patchwork-Id: 7440561 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B0AA2BEEA4 for ; Mon, 19 Oct 2015 23:41:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BEA70207D0 for ; Mon, 19 Oct 2015 23:41:17 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4F1FF206BC for ; Mon, 19 Oct 2015 23:41:16 +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 1ZoK1k-0003iM-8L; Mon, 19 Oct 2015 23:39:40 +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 1ZoK12-0002eV-Ce; Mon, 19 Oct 2015 23:38:56 +0000 Received: from geoff by merlin.infradead.org with local (Exim 4.85 #2 (Red Hat Linux)) id 1ZoK0z-0000wO-OC; Mon, 19 Oct 2015 23:38:53 +0000 Message-Id: In-Reply-To: References: From: Geoff Levand Patch-Date: Tue, 22 Sep 2015 15:36:29 -0700 Subject: [PATCH 05/16] arm64: Add back cpu_reset routines To: Catalin Marinas , Will Deacon Date: Mon, 19 Oct 2015 23:38:53 +0000 X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , AKASHI@infradead.org, marc.zyngier@arm.com, kexec@lists.infradead.org, Takahiro , linux-arm-kernel@lists.infradead.org, christoffer.dall@linaro.org 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.2 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 Commit 68234df4ea7939f98431aa81113fbdce10c4a84b (arm64: kill flush_cache_all()) removed the global arm64 routines cpu_reset() and cpu_soft_restart() needed by the arm64 kexec and kdump support. Add those two routines back with some minor simplifications in the new files cpu_reset.S, and cpu_reset.h. Signed-off-by: Geoff Levand --- arch/arm64/kernel/cpu-reset.S | 60 +++++++++++++++++++++++++++++++++++++++++++ arch/arm64/kernel/cpu-reset.h | 18 +++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 arch/arm64/kernel/cpu-reset.S create mode 100644 arch/arm64/kernel/cpu-reset.h diff --git a/arch/arm64/kernel/cpu-reset.S b/arch/arm64/kernel/cpu-reset.S new file mode 100644 index 0000000..64d9d7c --- /dev/null +++ b/arch/arm64/kernel/cpu-reset.S @@ -0,0 +1,60 @@ +/* + * cpu reset routines + * + * Copyright (C) 2001 Deep Blue Solutions Ltd. + * Copyright (C) 2012 ARM Ltd. + * Copyright (C) 2015 Huawei Futurewei Technologies. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include +#include +#include +#include +#include +#include + +.text +.pushsection .idmap.text, "ax" + +.align 5 + +/* + * cpu_reset(addr) - Helper for cpu_soft_restart. + * + * @addr: Location to jump to for soft reset. + */ + +ENTRY(cpu_reset) + mrs x2, sctlr_el1 + bic x2, x2, #1 + msr sctlr_el1, x2 // disable the MMU + isb + ret x0 +ENDPROC(cpu_reset) + +/* + * cpu_soft_restart(cpu_reset, addr) - Perform a cpu soft reset. + * + * @cpu_reset: Physical address of the cpu_reset routine. + * @addr: Location to jump to for soft reset, passed to cpu_reset. + */ + +ENTRY(cpu_soft_restart) + mov x19, x0 // cpu_reset + mov x20, x1 // addr + + /* Turn D-cache off */ + mrs x0, sctlr_el1 + bic x0, x0, #1 << 2 // clear SCTLR.C + msr sctlr_el1, x0 + isb + + mov x0, x20 + ret x19 +ENDPROC(cpu_soft_restart) + +.popsection diff --git a/arch/arm64/kernel/cpu-reset.h b/arch/arm64/kernel/cpu-reset.h new file mode 100644 index 0000000..4e16dfe --- /dev/null +++ b/arch/arm64/kernel/cpu-reset.h @@ -0,0 +1,18 @@ +/* + * cpu reset routines + * + * Copyright (C) 2015 Huawei Futurewei Technologies. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#if !defined(_ARM64_CPU_RESET_H) +#define _ARM64_CPU_RESET_H + +void __attribute__((noreturn)) cpu_reset(unsigned long addr); +void __attribute__((noreturn)) cpu_soft_restart(phys_addr_t cpu_reset, + unsigned long addr); + +#endif