linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] kexec/crash support on mpc85xx parts
@ 2010-07-21 21:14 Matthew McClintock
  2010-07-21 21:14 ` [PATCH v2 1/2] powerpc/85xx: kexec for SMP 85xx BookE systems Matthew McClintock
  2010-07-21 21:14 ` [PATCH v2 2/2] powerpc/crashdump: Fix issues with kexec and 36bit physical addr Matthew McClintock
  0 siblings, 2 replies; 4+ messages in thread
From: Matthew McClintock @ 2010-07-21 21:14 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Matthew McClintock, kumar.gala

The patch series is meant to fix a few issues with kexec/crash working
on mpc85xx parts

v1: initial version

v2: Fix a typo when decremeting a wait condition twice leading to 
never showing when we fail waiting for extra cpus to shutdown

Moved around code so the crash and kexec shutdown code paths both
work correctly - this was exposed by the above fix

Disable modifying the PAGE_OFFSET and PHYSICAL_START when we build
a crash kernel w/ relocation enabled. We don't need to change these 
values as a default action.

Matthew McClintock (2):
  powerpc/85xx: kexec for SMP 85xx BookE systems
  powerpc/crashdump: Fix issues with kexec and 36bit physical addr

 arch/powerpc/Kconfig                |   10 +++---
 arch/powerpc/kernel/crash_dump.c    |    4 +-
 arch/powerpc/kernel/machine_kexec.c |   10 +++---
 arch/powerpc/platforms/85xx/smp.c   |   63 +++++++++++++++++++++++++++++++++++
 4 files changed, 75 insertions(+), 12 deletions(-)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 1/2] powerpc/85xx: kexec for SMP 85xx BookE systems
  2010-07-21 21:14 [PATCH v2 0/2] kexec/crash support on mpc85xx parts Matthew McClintock
@ 2010-07-21 21:14 ` Matthew McClintock
  2010-08-02 19:37   ` Kumar Gala
  2010-07-21 21:14 ` [PATCH v2 2/2] powerpc/crashdump: Fix issues with kexec and 36bit physical addr Matthew McClintock
  1 sibling, 1 reply; 4+ messages in thread
From: Matthew McClintock @ 2010-07-21 21:14 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Matthew McClintock, kumar.gala

Adds support for kexec on 85xx machines for the BookE platform.
Including support for SMP machines

Based off work from Maxim Uvarov <muvarov@mvista.com>
Signed-off-by: Matthew McClintock <msm@freescale.com>
---
 arch/powerpc/Kconfig              |   10 +++---
 arch/powerpc/platforms/85xx/smp.c |   63 +++++++++++++++++++++++++++++++++++++
 2 files changed, 68 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 328774b..351ce4a 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -351,7 +351,7 @@ config ARCH_ENABLE_MEMORY_HOTREMOVE
 
 config KEXEC
 	bool "kexec system call (EXPERIMENTAL)"
-	depends on (PPC_BOOK3S || (FSL_BOOKE && !SMP)) && EXPERIMENTAL
+	depends on (PPC_BOOK3S || FSL_BOOKE) && 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
@@ -368,8 +368,8 @@ config KEXEC
 
 config CRASH_DUMP
 	bool "Build a kdump crash kernel"
-	depends on PPC64 || 6xx
-	select RELOCATABLE if PPC64
+	depends on PPC64 || 6xx || FSL_BOOKE
+	select RELOCATABLE if PPC64 || FSL_BOOKE
 	help
 	  Build a kernel suitable for use as a kdump capture kernel.
 	  The same kernel binary can be used as production kernel and dump
@@ -897,7 +897,7 @@ config KERNEL_START_BOOL
 config KERNEL_START
 	hex "Virtual address of kernel base" if KERNEL_START_BOOL
 	default PAGE_OFFSET if PAGE_OFFSET_BOOL
-	default "0xc2000000" if CRASH_DUMP
+	default "0xc2000000" if CRASH_DUMP && !RELOCATABLE
 	default "0xc0000000"
 
 config PHYSICAL_START_BOOL
@@ -910,7 +910,7 @@ config PHYSICAL_START_BOOL
 
 config PHYSICAL_START
 	hex "Physical address where the kernel is loaded" if PHYSICAL_START_BOOL
-	default "0x02000000" if PPC_STD_MMU && CRASH_DUMP
+	default "0x02000000" if PPC_STD_MMU && CRASH_DUMP && !RELOCATABLE
 	default "0x00000000"
 
 config PHYSICAL_ALIGN
diff --git a/arch/powerpc/platforms/85xx/smp.c b/arch/powerpc/platforms/85xx/smp.c
index a15f582..036c33c 100644
--- a/arch/powerpc/platforms/85xx/smp.c
+++ b/arch/powerpc/platforms/85xx/smp.c
@@ -15,6 +15,7 @@
 #include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/of.h>
+#include <linux/kexec.h>
 
 #include <asm/machdep.h>
 #include <asm/pgtable.h>
@@ -24,6 +25,7 @@
 #include <asm/dbell.h>
 
 #include <sysdev/fsl_soc.h>
+#include <sysdev/mpic.h>
 
 extern void __early_start(void);
 
@@ -103,8 +105,64 @@ smp_85xx_setup_cpu(int cpu_nr)
 
 struct smp_ops_t smp_85xx_ops = {
 	.kick_cpu = smp_85xx_kick_cpu,
+#ifdef CONFIG_KEXEC
+	.give_timebase	= smp_generic_give_timebase,
+	.take_timebase	= smp_generic_take_timebase,
+#endif
 };
 
+#ifdef CONFIG_KEXEC
+static int kexec_down_cpus = 0;
+
+void mpc85xx_smp_kexec_cpu_down(int crash_shutdown, int secondary)
+{
+	mpic_teardown_this_cpu(1);
+
+	/* When crashing, this gets called on all CPU's we only
+	 * take down the non-boot cpus */
+	if (smp_processor_id() != boot_cpuid)
+	{
+		local_irq_disable();
+		kexec_down_cpus++;
+
+		while (1);
+	}
+}
+
+static void mpc85xx_smp_kexec_down(void *arg)
+{
+	if (ppc_md.kexec_cpu_down)
+		ppc_md.kexec_cpu_down(0,1);
+}
+
+static void mpc85xx_smp_machine_kexec(struct kimage *image)
+{
+	int timeout = 2000;
+	int i;
+
+	set_cpus_allowed(current, cpumask_of_cpu(boot_cpuid));
+
+	smp_call_function(mpc85xx_smp_kexec_down, NULL, 0);
+
+	while ( (kexec_down_cpus != (num_online_cpus() - 1)) &&
+		( timeout > 0 ) )
+	{
+		timeout--;
+	}
+
+	if ( !timeout )
+		printk(KERN_ERR "Unable to bring down secondary cpu(s)");
+
+	for (i = 0; i < num_present_cpus(); i++)
+	{
+		if ( i == smp_processor_id() ) continue;
+		mpic_reset_core(i);
+	}
+
+	default_machine_kexec(image);
+}
+#endif /* CONFIG_KEXEC */
+
 void __init mpc85xx_smp_init(void)
 {
 	struct device_node *np;
@@ -122,4 +180,9 @@ void __init mpc85xx_smp_init(void)
 	BUG_ON(!smp_85xx_ops.message_pass);
 
 	smp_ops = &smp_85xx_ops;
+
+#ifdef CONFIG_KEXEC
+	ppc_md.kexec_cpu_down = mpc85xx_smp_kexec_cpu_down;
+	ppc_md.machine_kexec = mpc85xx_smp_machine_kexec;
+#endif
 }
-- 
1.6.6.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2 2/2] powerpc/crashdump: Fix issues with kexec and 36bit physical addr
  2010-07-21 21:14 [PATCH v2 0/2] kexec/crash support on mpc85xx parts Matthew McClintock
  2010-07-21 21:14 ` [PATCH v2 1/2] powerpc/85xx: kexec for SMP 85xx BookE systems Matthew McClintock
@ 2010-07-21 21:14 ` Matthew McClintock
  1 sibling, 0 replies; 4+ messages in thread
From: Matthew McClintock @ 2010-07-21 21:14 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Matthew McClintock, kumar.gala

Fix sizes of variables so correct values are exported via /proc.
Cast variable in comparison to avoid compiler error.

Signed-off-by: Matthew McClintock <msm@freescale.com>
---
 arch/powerpc/kernel/crash_dump.c    |    4 ++--
 arch/powerpc/kernel/machine_kexec.c |   10 +++++-----
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/powerpc/kernel/crash_dump.c b/arch/powerpc/kernel/crash_dump.c
index 5fb667a..d254132 100644
--- a/arch/powerpc/kernel/crash_dump.c
+++ b/arch/powerpc/kernel/crash_dump.c
@@ -128,9 +128,9 @@ ssize_t copy_oldmem_page(unsigned long pfn, char *buf,
 	if (!csize)
 		return 0;
 
-	csize = min(csize, PAGE_SIZE);
+	csize = min_t(size_t, csize, PAGE_SIZE);
 
-	if (pfn < max_pfn) {
+	if ((min_low_pfn < pfn) && (pfn < max_pfn)) {
 		vaddr = __va(pfn << PAGE_SHIFT);
 		csize = copy_oldmem_vaddr(vaddr, buf, csize, offset, userbuf);
 	} else {
diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c
index bb3d893..6ff15f0 100644
--- a/arch/powerpc/kernel/machine_kexec.c
+++ b/arch/powerpc/kernel/machine_kexec.c
@@ -144,24 +144,24 @@ int overlaps_crashkernel(unsigned long start, unsigned long size)
 }
 
 /* Values we need to export to the second kernel via the device tree. */
-static unsigned long kernel_end;
-static unsigned long crashk_size;
+static phys_addr_t kernel_end;
+static phys_addr_t crashk_size;
 
 static struct property kernel_end_prop = {
 	.name = "linux,kernel-end",
-	.length = sizeof(unsigned long),
+	.length = sizeof(phys_addr_t),
 	.value = &kernel_end,
 };
 
 static struct property crashk_base_prop = {
 	.name = "linux,crashkernel-base",
-	.length = sizeof(unsigned long),
+	.length = sizeof(phys_addr_t),
 	.value = &crashk_res.start,
 };
 
 static struct property crashk_size_prop = {
 	.name = "linux,crashkernel-size",
-	.length = sizeof(unsigned long),
+	.length = sizeof(phys_addr_t),
 	.value = &crashk_size,
 };
 
-- 
1.6.6.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/2] powerpc/85xx: kexec for SMP 85xx BookE systems
  2010-07-21 21:14 ` [PATCH v2 1/2] powerpc/85xx: kexec for SMP 85xx BookE systems Matthew McClintock
@ 2010-08-02 19:37   ` Kumar Gala
  0 siblings, 0 replies; 4+ messages in thread
From: Kumar Gala @ 2010-08-02 19:37 UTC (permalink / raw)
  To: Matthew McClintock; +Cc: linuxppc-dev


On Jul 21, 2010, at 4:14 PM, Matthew McClintock wrote:

> Adds support for kexec on 85xx machines for the BookE platform.
> Including support for SMP machines
>=20
> Based off work from Maxim Uvarov <muvarov@mvista.com>
> Signed-off-by: Matthew McClintock <msm@freescale.com>
> ---
> arch/powerpc/Kconfig              |   10 +++---
> arch/powerpc/platforms/85xx/smp.c |   63 =
+++++++++++++++++++++++++++++++++++++
> 2 files changed, 68 insertions(+), 5 deletions(-)

applied to next

- k=

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-08-02 19:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-21 21:14 [PATCH v2 0/2] kexec/crash support on mpc85xx parts Matthew McClintock
2010-07-21 21:14 ` [PATCH v2 1/2] powerpc/85xx: kexec for SMP 85xx BookE systems Matthew McClintock
2010-08-02 19:37   ` Kumar Gala
2010-07-21 21:14 ` [PATCH v2 2/2] powerpc/crashdump: Fix issues with kexec and 36bit physical addr Matthew McClintock

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).