powerpc/mpic: Add ability to reset a core via MPIC
authorMatthew McClintock <msm@freescale.com>
Tue, 29 Jun 2010 09:42:26 +0000 (09:42 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Fri, 9 Jul 2010 01:28:27 +0000 (11:28 +1000)
We need the ability to reset cores for use with kexec/kdump for
SMP systems. Calling this function with the specific core you want
to reset will cause the CPU to spin in reset.

Signed-off-by: Matthew McClintock <msm@freescale.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/sysdev/mpic.c
arch/powerpc/sysdev/mpic.h

index 20b73c025a4566e599f46192fed18df2ed002fda..7c1342618a307560b187767d65ae6a6e24c4ddd0 100644 (file)
@@ -1636,6 +1636,24 @@ void __devinit smp_mpic_setup_cpu(int cpu)
 {
        mpic_setup_this_cpu();
 }
+
+void mpic_reset_core(int cpu)
+{
+       struct mpic *mpic = mpic_primary;
+       u32 pir;
+       int cpuid = get_hard_smp_processor_id(cpu);
+
+       /* Set target bit for core reset */
+       pir = mpic_read(mpic->gregs, MPIC_INFO(GREG_PROCESSOR_INIT));
+       pir |= (1 << cpuid);
+       mpic_write(mpic->gregs, MPIC_INFO(GREG_PROCESSOR_INIT), pir);
+       mpic_read(mpic->gregs, MPIC_INFO(GREG_PROCESSOR_INIT));
+
+       /* Restore target bit after reset complete */
+       pir &= ~(1 << cpuid);
+       mpic_write(mpic->gregs, MPIC_INFO(GREG_PROCESSOR_INIT), pir);
+       mpic_read(mpic->gregs, MPIC_INFO(GREG_PROCESSOR_INIT));
+}
 #endif /* CONFIG_SMP */
 
 #ifdef CONFIG_PM
index eff433c322a0c55632b7d413acfddc18ed5cbaa8..e4a6df77b8d740b3d7eb2429018179bd15cfb130 100644 (file)
@@ -37,5 +37,6 @@ static inline int mpic_pasemi_msi_init(struct mpic *mpic)
 extern int mpic_set_irq_type(unsigned int virq, unsigned int flow_type);
 extern void mpic_set_vector(unsigned int virq, unsigned int vector);
 extern int mpic_set_affinity(unsigned int irq, const struct cpumask *cpumask);
+extern void mpic_reset_core(int cpu);
 
 #endif /* _POWERPC_SYSDEV_MPIC_H */