Skip to content

Commit

Permalink
powerpc/pseries/mce: restore msr before returning from handler
Browse files Browse the repository at this point in the history
The pseries real-mode machine check handler can enable the MMU, and
return from the handler with the MMU still enabled.

This works, but real-mode handler wrapper exit handlers want to rely
on the MMU being in real-mode. So change the pseries handler to
restore the MSR after it has finished virtual mode tasks.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/1612702361.lm7fqo56re.astroid@bobo.none
  • Loading branch information
npiggin authored and mpe committed Feb 8, 2021
1 parent 56acfdd commit 74c3354
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions arch/powerpc/platforms/pseries/ras.c
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,7 @@ static int mce_handle_error(struct pt_regs *regs, struct rtas_error_log *errp)
struct pseries_errorlog *pseries_log;
struct pseries_mc_errorlog *mce_log = NULL;
int disposition = rtas_error_disposition(errp);
unsigned long msr;
u8 error_type;

if (!rtas_error_extended(errp))
Expand All @@ -742,9 +743,21 @@ static int mce_handle_error(struct pt_regs *regs, struct rtas_error_log *errp)
* SLB multihit is done by now.
*/
out:
mtmsr(mfmsr() | MSR_IR | MSR_DR);
msr = mfmsr();
mtmsr(msr | MSR_IR | MSR_DR);

disposition = mce_handle_err_virtmode(regs, errp, mce_log,
disposition);

/*
* Queue irq work to log this rtas event later.
* irq_work_queue uses per-cpu variables, so do this in virt
* mode as well.
*/
irq_work_queue(&mce_errlog_process_work);

mtmsr(msr);

return disposition;
}

Expand Down Expand Up @@ -860,10 +873,8 @@ long pseries_machine_check_realmode(struct pt_regs *regs)
* virtual mode.
*/
disposition = mce_handle_error(regs, errp);
fwnmi_release_errinfo();

/* Queue irq work to log this rtas event later. */
irq_work_queue(&mce_errlog_process_work);
fwnmi_release_errinfo();

if (disposition == RTAS_DISP_FULLY_RECOVERED)
return 1;
Expand Down

0 comments on commit 74c3354

Please sign in to comment.