Skip to content

Commit

Permalink
core/init: enable machine check on secondaries
Browse files Browse the repository at this point in the history
Secondary CPUs currently run with MSR[ME]=0 during boot, whih means
if they take a machine check, the system will checkstop.

Enable ME where possible and allow them to print registers.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
  • Loading branch information
npiggin authored and stewartsmith committed Feb 13, 2019
1 parent d25287a commit ebb814a
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
2 changes: 2 additions & 0 deletions core/fast-reboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,8 @@ void __noreturn fast_reboot_entry(void)
}
sync();
cleanup_cpu_state();
enable_machine_check();

__secondary_cpu_entry();
}

Expand Down
38 changes: 38 additions & 0 deletions core/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,39 @@ static void load_initramfs(void)
}
}

static void cpu_disable_ME_one(void *param __unused)
{
disable_machine_check();
}

static int64_t cpu_disable_ME_all(void)
{
struct cpu_thread *cpu;
struct cpu_job **jobs;

jobs = zalloc(sizeof(struct cpu_job *) * (cpu_max_pir + 1));
assert(jobs);

for_each_available_cpu(cpu) {
if (cpu == this_cpu())
continue;
jobs[cpu->pir] = cpu_queue_job(cpu, "cpu_disable_ME",
cpu_disable_ME_one, NULL);
}

/* this cpu */
cpu_disable_ME_one(NULL);

for_each_available_cpu(cpu) {
if (jobs[cpu->pir])
cpu_wait_job(jobs[cpu->pir], true);
}

free(jobs);

return OPAL_SUCCESS;
}

void *fdt;

void __noreturn load_and_boot_kernel(bool is_reboot)
Expand Down Expand Up @@ -586,6 +619,9 @@ void __noreturn load_and_boot_kernel(bool is_reboot)
printf("INIT: Starting kernel at 0x%llx, fdt at %p %u bytes\n",
kernel_entry, fdt, fdt_totalsize(fdt));

/* Disable machine checks on all */
cpu_disable_ME_all();

debug_descriptor.state_flags |= OPAL_BOOT_COMPLETE;

cpu_give_self_os();
Expand Down Expand Up @@ -1234,6 +1270,8 @@ void __noreturn __secondary_cpu_entry(void)
/* Secondary CPU called in */
cpu_callin(cpu);

enable_machine_check();

/* Some XIVE setup */
xive_cpu_callin(cpu);

Expand Down

0 comments on commit ebb814a

Please sign in to comment.