[PATCH] Fix SRAO/SRAR MCE injecting on guest without MCG_SER_P

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On real machine, if MCG_SER_P in MSR_MCG_CAP is not set, SRAO/SRAR MCE
should not be raised by hardware. This patch makes QEMU-KVM to follow
the same rule.

Reported-by: Hidetoshi Seto <seto.hidetoshi@xxxxxxxxxxxxxx>
Signed-off-by: Huang Ying <ying.huang@xxxxxxxxx>
---
 qemu-kvm.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/qemu-kvm.c
+++ b/qemu-kvm.c
@@ -1134,7 +1134,7 @@ static void sigbus_handler(int n, struct
                            void *ctx)
 {
 #if defined(KVM_CAP_MCE) && defined(TARGET_I386)
-    if (first_cpu->mcg_cap && siginfo->ssi_addr
+    if ((first_cpu->mcg_cap & MCG_SER_P) && siginfo->ssi_addr
         && siginfo->ssi_code == BUS_MCEERR_AO) {
         uint64_t status;
         void *vaddr;
@@ -1324,7 +1324,7 @@ static void kvm_on_sigbus(CPUState *env,
     unsigned long paddr;
     int r;
 
-    if (env->mcg_cap && siginfo->si_addr
+    if ((env->mcg_cap & MCG_SER_P) && siginfo->si_addr
         && (siginfo->si_code == BUS_MCEERR_AR
             || siginfo->si_code == BUS_MCEERR_AO)) {
         if (siginfo->si_code == BUS_MCEERR_AR) {
@@ -1356,7 +1356,7 @@ static void kvm_on_sigbus(CPUState *env,
         if (do_qemu_ram_addr_from_host(vaddr, &ram_addr) ||
             !kvm_physical_memory_addr_from_ram(kvm_state, ram_addr, (target_phys_addr_t *)&paddr)) {
             fprintf(stderr, "Hardware memory error for memory used by "
-                    "QEMU itself instaed of guest system!\n");
+                    "QEMU itself instead of guest system!\n");
             /* Hope we are lucky for AO MCE */
             if (siginfo->si_code == BUS_MCEERR_AO) {
                 return;


--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux