|
@@ -46,61 +46,6 @@ int crashing_cpu = -1;
|
|
static cpumask_t cpus_in_crash = CPU_MASK_NONE;
|
|
static cpumask_t cpus_in_crash = CPU_MASK_NONE;
|
|
cpumask_t cpus_in_sr = CPU_MASK_NONE;
|
|
cpumask_t cpus_in_sr = CPU_MASK_NONE;
|
|
|
|
|
|
-static u32 *append_elf_note(u32 *buf, char *name, unsigned type, void *data,
|
|
|
|
- size_t data_len)
|
|
|
|
-{
|
|
|
|
- struct elf_note note;
|
|
|
|
-
|
|
|
|
- note.n_namesz = strlen(name) + 1;
|
|
|
|
- note.n_descsz = data_len;
|
|
|
|
- note.n_type = type;
|
|
|
|
- memcpy(buf, ¬e, sizeof(note));
|
|
|
|
- buf += (sizeof(note) +3)/4;
|
|
|
|
- memcpy(buf, name, note.n_namesz);
|
|
|
|
- buf += (note.n_namesz + 3)/4;
|
|
|
|
- memcpy(buf, data, note.n_descsz);
|
|
|
|
- buf += (note.n_descsz + 3)/4;
|
|
|
|
-
|
|
|
|
- return buf;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-static void final_note(u32 *buf)
|
|
|
|
-{
|
|
|
|
- struct elf_note note;
|
|
|
|
-
|
|
|
|
- note.n_namesz = 0;
|
|
|
|
- note.n_descsz = 0;
|
|
|
|
- note.n_type = 0;
|
|
|
|
- memcpy(buf, ¬e, sizeof(note));
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-static void crash_save_this_cpu(struct pt_regs *regs, int cpu)
|
|
|
|
-{
|
|
|
|
- struct elf_prstatus prstatus;
|
|
|
|
- u32 *buf;
|
|
|
|
-
|
|
|
|
- if ((cpu < 0) || (cpu >= NR_CPUS))
|
|
|
|
- return;
|
|
|
|
-
|
|
|
|
- /* Using ELF notes here is opportunistic.
|
|
|
|
- * I need a well defined structure format
|
|
|
|
- * for the data I pass, and I need tags
|
|
|
|
- * on the data to indicate what information I have
|
|
|
|
- * squirrelled away. ELF notes happen to provide
|
|
|
|
- * all of that that no need to invent something new.
|
|
|
|
- */
|
|
|
|
- buf = (u32*)per_cpu_ptr(crash_notes, cpu);
|
|
|
|
- if (!buf)
|
|
|
|
- return;
|
|
|
|
-
|
|
|
|
- memset(&prstatus, 0, sizeof(prstatus));
|
|
|
|
- prstatus.pr_pid = current->pid;
|
|
|
|
- elf_core_copy_regs(&prstatus.pr_reg, regs);
|
|
|
|
- buf = append_elf_note(buf, "CORE", NT_PRSTATUS, &prstatus,
|
|
|
|
- sizeof(prstatus));
|
|
|
|
- final_note(buf);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
#ifdef CONFIG_SMP
|
|
#ifdef CONFIG_SMP
|
|
static atomic_t enter_on_soft_reset = ATOMIC_INIT(0);
|
|
static atomic_t enter_on_soft_reset = ATOMIC_INIT(0);
|
|
|
|
|
|
@@ -113,7 +58,7 @@ void crash_ipi_callback(struct pt_regs *regs)
|
|
|
|
|
|
hard_irq_disable();
|
|
hard_irq_disable();
|
|
if (!cpu_isset(cpu, cpus_in_crash))
|
|
if (!cpu_isset(cpu, cpus_in_crash))
|
|
- crash_save_this_cpu(regs, cpu);
|
|
|
|
|
|
+ crash_save_cpu(regs, cpu);
|
|
cpu_set(cpu, cpus_in_crash);
|
|
cpu_set(cpu, cpus_in_crash);
|
|
|
|
|
|
/*
|
|
/*
|
|
@@ -306,7 +251,7 @@ void default_machine_crash_shutdown(struct pt_regs *regs)
|
|
* such that another IPI will not be sent.
|
|
* such that another IPI will not be sent.
|
|
*/
|
|
*/
|
|
crashing_cpu = smp_processor_id();
|
|
crashing_cpu = smp_processor_id();
|
|
- crash_save_this_cpu(regs, crashing_cpu);
|
|
|
|
|
|
+ crash_save_cpu(regs, crashing_cpu);
|
|
crash_kexec_prepare_cpus(crashing_cpu);
|
|
crash_kexec_prepare_cpus(crashing_cpu);
|
|
cpu_set(crashing_cpu, cpus_in_crash);
|
|
cpu_set(crashing_cpu, cpus_in_crash);
|
|
if (ppc_md.kexec_cpu_down)
|
|
if (ppc_md.kexec_cpu_down)
|