From patchwork Tue Feb 26 09:19:37 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tiejun Chen X-Patchwork-Id: 223150 X-Patchwork-Delegate: benh@kernel.crashing.org Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [IPv6:::1]) by ozlabs.org (Postfix) with ESMTP id DB2412C05F1 for ; Tue, 26 Feb 2013 20:21:49 +1100 (EST) Received: from mail1.windriver.com (mail1.windriver.com [147.11.146.13]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mail1.windriver.com", Issuer "Intel External Basic Issuing CA 3A" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 6DEAE2C02FC for ; Tue, 26 Feb 2013 20:19:56 +1100 (EST) Received: from ALA-HCA.corp.ad.wrs.com (ala-hca.corp.ad.wrs.com [147.11.189.40]) by mail1.windriver.com (8.14.5/8.14.3) with ESMTP id r1Q9JnFx007834 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL); Tue, 26 Feb 2013 01:19:49 -0800 (PST) Received: from Linux.corp.ad.wrs.com (128.224.162.178) by ALA-HCA.corp.ad.wrs.com (147.11.189.50) with Microsoft SMTP Server id 14.2.328.9; Tue, 26 Feb 2013 01:19:49 -0800 From: Tiejun Chen To: , Subject: [v1][PATCH 2/7] book3e/kexec/kdump: enable kexec for kernel Date: Tue, 26 Feb 2013 17:19:37 +0800 Message-ID: <1361870382-743-3-git-send-email-tiejun.chen@windriver.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1361870382-743-1-git-send-email-tiejun.chen@windriver.com> References: <1361870382-743-1-git-send-email-tiejun.chen@windriver.com> MIME-Version: 1.0 Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" We need to active KEXEC for book3e and bypass or convert non-book3e stuff in kexec coverage. Signed-off-by: Tiejun Chen --- arch/powerpc/Kconfig | 2 +- arch/powerpc/kernel/machine_kexec_64.c | 6 ++++++ arch/powerpc/kernel/misc_64.S | 6 ++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 85ff3a0..d6d1a02 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -370,7 +370,7 @@ config ARCH_ENABLE_MEMORY_HOTREMOVE config KEXEC bool "kexec system call (EXPERIMENTAL)" - depends on (PPC_BOOK3S || FSL_BOOKE || (44x && !SMP)) && EXPERIMENTAL + depends on (PPC_BOOK3S || FSL_BOOKE || PPC_BOOK3E || (44x && !SMP)) && EXPERIMENTAL help kexec is a system call that implements the ability to shutdown your current kernel, and to start another kernel. It is like a reboot diff --git a/arch/powerpc/kernel/machine_kexec_64.c b/arch/powerpc/kernel/machine_kexec_64.c index 466a290..a1222c8 100644 --- a/arch/powerpc/kernel/machine_kexec_64.c +++ b/arch/powerpc/kernel/machine_kexec_64.c @@ -32,6 +32,7 @@ int default_machine_kexec_prepare(struct kimage *image) { int i; +#ifndef CONFIG_PPC_BOOK3E unsigned long begin, end; /* limits of segment */ unsigned long low, high; /* limits of blocked memory range */ struct device_node *node; @@ -40,6 +41,7 @@ int default_machine_kexec_prepare(struct kimage *image) if (!ppc_md.hpte_clear_all) return -ENOENT; +#endif /* * Since we use the kernel fault handlers and paging code to @@ -50,6 +52,7 @@ int default_machine_kexec_prepare(struct kimage *image) if (image->segment[i].mem < __pa(_end)) return -ETXTBSY; +#ifndef CONFIG_PPC_BOOK3E /* * For non-LPAR, we absolutely can not overwrite the mmu hash * table, since we are still using the bolted entries in it to @@ -91,6 +94,7 @@ int default_machine_kexec_prepare(struct kimage *image) return -ETXTBSY; } } +#endif return 0; } @@ -363,6 +367,7 @@ void default_machine_kexec(struct kimage *image) /* NOTREACHED */ } +#ifndef CONFIG_PPC_BOOK3E /* Values we need to export to the second kernel via the device tree. */ static unsigned long htab_base; @@ -407,3 +412,4 @@ static int __init export_htab_values(void) return 0; } late_initcall(export_htab_values); +#endif diff --git a/arch/powerpc/kernel/misc_64.S b/arch/powerpc/kernel/misc_64.S index 5cfa800..c2acf8c 100644 --- a/arch/powerpc/kernel/misc_64.S +++ b/arch/powerpc/kernel/misc_64.S @@ -532,9 +532,13 @@ _GLOBAL(kexec_sequence) lhz r25,PACAHWCPUID(r13) /* get our phys cpu from paca */ /* disable interrupts, we are overwriting kernel data next */ +#ifndef CONFIG_PPC_BOOK3E mfmsr r3 rlwinm r3,r3,0,17,15 mtmsrd r3,1 +#else + wrteei 0 +#endif /* copy dest pages, flush whole dest image */ mr r3,r29 @@ -556,10 +560,12 @@ _GLOBAL(kexec_sequence) li r6,1 stw r6,kexec_flag-1b(5) +#ifndef CONFIG_PPC_BOOK3E /* clear out hardware hash page table and tlb */ ld r5,0(r27) /* deref function descriptor */ mtctr r5 bctrl /* ppc_md.hpte_clear_all(void); */ +#endif /* * kexec image calling is: