36df96f8ac
Now that we handle machine check in linux, the MCE decoding should also take place in linux host. This info is crucial to log before we go down in case we can not handle the machine check errors. This patch decodes and populates a machine check event which contain high level meaning full MCE information. We do this in real mode C code with ME bit on. The MCE information is still available on emergency stack (in pt_regs structure format). Even if we take another exception at this point the MCE early handler will allocate a new stack frame on top of current one. So when we return back here we still have our MCE information safe on current stack. We use per cpu buffer to save high level MCE information. Each per cpu buffer is an array of machine check event structure indexed by per cpu counter mce_nest_count. The mce_nest_count is incremented every time we enter machine check early handler in real mode to get the current free slot (index = mce_nest_count - 1). The mce_nest_count is decremented once the MCE info is consumed by virtual mode machine exception handler. This patch provides save_mce_event(), get_mce_event() and release_mce_event() generic routines that can be used by machine check handlers to populate and retrieve the event. The routine release_mce_event() will free the event slot so that it can be reused. Caller can invoke get_mce_event() with a release flag either to release the event slot immediately OR keep it so that it can be fetched again. The event slot can be also released anytime by invoking release_mce_event(). This patch also updates kvm code to invoke get_mce_event to retrieve generic mce event rather than paca->opal_mce_evt. The KVM code always calls get_mce_event() with release flags set to false so that event is available for linus host machine If machine check occurs while we are in guest, KVM tries to handle the error. If KVM is able to handle MC error successfully, it enters the guest and delivers the machine check to guest. If KVM is not able to handle MC error, it exists the guest and passes the control to linux host machine check handler which then logs MC event and decides how to handle it in linux host. In failure case, KVM needs to make sure that the MC event is available for linux host to consume. Hence KVM always calls get_mce_event() with release flags set to false and later it invokes release_mce_event() only if it succeeds to handle error. Signed-off-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> |
||
---|---|---|
.. | ||
44x.c | ||
44x_emulate.c | ||
44x_tlb.c | ||
44x_tlb.h | ||
book3s.c | ||
book3s.h | ||
book3s_32_mmu.c | ||
book3s_32_mmu_host.c | ||
book3s_32_sr.S | ||
book3s_64_mmu.c | ||
book3s_64_mmu_host.c | ||
book3s_64_mmu_hv.c | ||
book3s_64_slb.S | ||
book3s_64_vio.c | ||
book3s_64_vio_hv.c | ||
book3s_emulate.c | ||
book3s_exports.c | ||
book3s_hv.c | ||
book3s_hv_builtin.c | ||
book3s_hv_cma.c | ||
book3s_hv_cma.h | ||
book3s_hv_interrupts.S | ||
book3s_hv_ras.c | ||
book3s_hv_rm_mmu.c | ||
book3s_hv_rm_xics.c | ||
book3s_hv_rmhandlers.S | ||
book3s_interrupts.S | ||
book3s_mmu_hpte.c | ||
book3s_paired_singles.c | ||
book3s_pr.c | ||
book3s_pr_papr.c | ||
book3s_rmhandlers.S | ||
book3s_rtas.c | ||
book3s_segment.S | ||
book3s_xics.c | ||
book3s_xics.h | ||
booke.c | ||
booke.h | ||
booke_emulate.c | ||
booke_interrupts.S | ||
bookehv_interrupts.S | ||
e500.c | ||
e500.h | ||
e500_emulate.c | ||
e500_mmu.c | ||
e500_mmu_host.c | ||
e500_mmu_host.h | ||
e500mc.c | ||
emulate.c | ||
fpu.S | ||
irq.h | ||
Kconfig | ||
Makefile | ||
mpic.c | ||
powerpc.c | ||
timing.c | ||
timing.h | ||
trace.h | ||
trace_booke.h | ||
trace_pr.h |