Patchwork [qom-next,44/59] target-i386: Pass X86CPU to kvm_mce_inject()

login
register
mail settings
Submitter Andreas Färber
Date May 23, 2012, 3:08 a.m.
Message ID <1337742502-28565-45-git-send-email-afaerber@suse.de>
Download mbox | patch
Permalink /patch/160827/
State New
Headers show

Comments

Andreas Färber - May 23, 2012, 3:08 a.m.
Needed for cpu_x86_inject_mce().

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 target-i386/kvm.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

Patch

diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index 92ad338..758bf8f 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -221,8 +221,9 @@  static int kvm_get_mce_cap_supported(KVMState *s, uint64_t *mce_cap,
     return -ENOSYS;
 }
 
-static void kvm_mce_inject(CPUX86State *env, target_phys_addr_t paddr, int code)
+static void kvm_mce_inject(X86CPU *cpu, target_phys_addr_t paddr, int code)
 {
+    CPUX86State *env = &cpu->env;
     uint64_t status = MCI_STATUS_VAL | MCI_STATUS_UC | MCI_STATUS_EN |
                       MCI_STATUS_MISCV | MCI_STATUS_ADDRV | MCI_STATUS_S;
     uint64_t mcg_status = MCG_STATUS_MCIP;
@@ -248,6 +249,7 @@  static void hardware_memory_error(void)
 
 int kvm_arch_on_sigbus_vcpu(CPUX86State *env, int code, void *addr)
 {
+    X86CPU *cpu = x86_env_get_cpu(env);
     ram_addr_t ram_addr;
     target_phys_addr_t paddr;
 
@@ -265,7 +267,7 @@  int kvm_arch_on_sigbus_vcpu(CPUX86State *env, int code, void *addr)
             }
         }
         kvm_hwpoison_page_add(ram_addr);
-        kvm_mce_inject(env, paddr, code);
+        kvm_mce_inject(cpu, paddr, code);
     } else {
         if (code == BUS_MCEERR_AO) {
             return 0;
@@ -293,7 +295,7 @@  int kvm_arch_on_sigbus(int code, void *addr)
             return 0;
         }
         kvm_hwpoison_page_add(ram_addr);
-        kvm_mce_inject(first_cpu, paddr, code);
+        kvm_mce_inject(x86_env_get_cpu(first_cpu), paddr, code);
     } else {
         if (code == BUS_MCEERR_AO) {
             return 0;