patch-5.15.79-rt54.patch
[platform/kernel/linux-rpi.git] / arch / powerpc / kernel / smp.c
index 605bab4..308765f 100644 (file)
@@ -61,6 +61,7 @@
 #include <asm/cpu_has_feature.h>
 #include <asm/ftrace.h>
 #include <asm/kup.h>
+#include <asm/fadump.h>
 
 #ifdef DEBUG
 #include <asm/udbg.h>
@@ -589,6 +590,11 @@ static void debugger_ipi_callback(struct pt_regs *regs)
        debugger_ipi(regs);
 }
 
+void smp_send_debugger_break_cpu(unsigned int cpu)
+{
+       smp_send_nmi_ipi(cpu, debugger_ipi_callback, 1000000);
+}
+
 void smp_send_debugger_break(void)
 {
        smp_send_nmi_ipi(NMI_IPI_ALL_OTHERS, debugger_ipi_callback, 1000000);
@@ -621,6 +627,45 @@ void crash_send_ipi(void (*crash_ipi_callback)(struct pt_regs *))
 #endif
 
 #ifdef CONFIG_NMI_IPI
+static void crash_stop_this_cpu(struct pt_regs *regs)
+#else
+static void crash_stop_this_cpu(void *dummy)
+#endif
+{
+       /*
+        * Just busy wait here and avoid marking CPU as offline to ensure
+        * register data is captured appropriately.
+        */
+       while (1)
+               cpu_relax();
+}
+
+void crash_smp_send_stop(void)
+{
+       static bool stopped = false;
+
+       /*
+        * In case of fadump, register data for all CPUs is captured by f/w
+        * on ibm,os-term rtas call. Skip IPI callbacks to other CPUs before
+        * this rtas call to avoid tricky post processing of those CPUs'
+        * backtraces.
+        */
+       if (should_fadump_crash())
+               return;
+
+       if (stopped)
+               return;
+
+       stopped = true;
+
+#ifdef CONFIG_NMI_IPI
+       smp_send_nmi_ipi(NMI_IPI_ALL_OTHERS, crash_stop_this_cpu, 1000000);
+#else
+       smp_call_function(crash_stop_this_cpu, NULL, 0);
+#endif /* CONFIG_NMI_IPI */
+}
+
+#ifdef CONFIG_NMI_IPI
 static void nmi_stop_this_cpu(struct pt_regs *regs)
 {
        /*
@@ -1640,10 +1685,12 @@ void start_secondary(void *unused)
        BUG();
 }
 
+#ifdef CONFIG_PROFILING
 int setup_profiling_timer(unsigned int multiplier)
 {
        return 0;
 }
+#endif
 
 static void fixup_topology(void)
 {