mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
x86: Optionally avoid injecting AO MCEs while others are pending
Allow to tell cpu_x86_inject_mce that it should ignore Action Optional MCE events when the target VCPU is still processing another one. This will be used by KVM soon. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> CC: Huang Ying <ying.huang@intel.com> CC: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com> CC: Jin Dongming <jin.dongming@np.css.fujitsu.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
This commit is contained in:
parent
316378e4d0
commit
747461c76b
3 changed files with 28 additions and 10 deletions
|
@ -1069,11 +1069,20 @@ static void breakpoint_handler(CPUState *env)
|
|||
|
||||
static void
|
||||
qemu_inject_x86_mce(Monitor *mon, CPUState *cenv, int bank, uint64_t status,
|
||||
uint64_t mcg_status, uint64_t addr, uint64_t misc)
|
||||
uint64_t mcg_status, uint64_t addr, uint64_t misc,
|
||||
int flags)
|
||||
{
|
||||
uint64_t mcg_cap = cenv->mcg_cap;
|
||||
uint64_t *banks = cenv->mce_banks + 4 * bank;
|
||||
|
||||
/*
|
||||
* If there is an MCE exception being processed, ignore this SRAO MCE
|
||||
* unless unconditional injection was requested.
|
||||
*/
|
||||
if (!(flags & MCE_INJECT_UNCOND_AO) && !(status & MCI_STATUS_AR)
|
||||
&& (cenv->mcg_status & MCG_STATUS_MCIP)) {
|
||||
return;
|
||||
}
|
||||
if (status & MCI_STATUS_UC) {
|
||||
/*
|
||||
* if MSR_MCG_CTL is not all 1s, the uncorrected error
|
||||
|
@ -1127,7 +1136,7 @@ qemu_inject_x86_mce(Monitor *mon, CPUState *cenv, int bank, uint64_t status,
|
|||
|
||||
void cpu_x86_inject_mce(Monitor *mon, CPUState *cenv, int bank,
|
||||
uint64_t status, uint64_t mcg_status, uint64_t addr,
|
||||
uint64_t misc, int broadcast)
|
||||
uint64_t misc, int flags)
|
||||
{
|
||||
unsigned bank_num = cenv->mcg_cap & 0xff;
|
||||
CPUState *env;
|
||||
|
@ -1145,27 +1154,30 @@ void cpu_x86_inject_mce(Monitor *mon, CPUState *cenv, int bank,
|
|||
monitor_printf(mon, "Invalid MCE status code\n");
|
||||
return;
|
||||
}
|
||||
if (broadcast && !cpu_x86_support_mca_broadcast(cenv)) {
|
||||
if ((flags & MCE_INJECT_BROADCAST)
|
||||
&& !cpu_x86_support_mca_broadcast(cenv)) {
|
||||
monitor_printf(mon, "Guest CPU does not support MCA broadcast\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (kvm_enabled()) {
|
||||
if (broadcast) {
|
||||
if (flags & MCE_INJECT_BROADCAST) {
|
||||
flag |= MCE_BROADCAST;
|
||||
}
|
||||
|
||||
kvm_inject_x86_mce(cenv, bank, status, mcg_status, addr, misc, flag);
|
||||
} else {
|
||||
qemu_inject_x86_mce(mon, cenv, bank, status, mcg_status, addr, misc);
|
||||
if (broadcast) {
|
||||
qemu_inject_x86_mce(mon, cenv, bank, status, mcg_status, addr, misc,
|
||||
flags);
|
||||
if (flags & MCE_INJECT_BROADCAST) {
|
||||
for (env = first_cpu; env != NULL; env = env->next_cpu) {
|
||||
if (cenv == env) {
|
||||
continue;
|
||||
}
|
||||
qemu_inject_x86_mce(mon, env, 1,
|
||||
MCI_STATUS_VAL | MCI_STATUS_UC,
|
||||
MCG_STATUS_MCIP | MCG_STATUS_RIPV, 0, 0);
|
||||
MCG_STATUS_MCIP | MCG_STATUS_RIPV, 0, 0,
|
||||
flags);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue