9ae3a8
From a573bf83cd8f541f3129a53238ee7c2e9ad61ff8 Mon Sep 17 00:00:00 2001
9ae3a8
From: Paolo Bonzini <pbonzini@redhat.com>
9ae3a8
Date: Wed, 26 Mar 2014 12:30:43 +0100
9ae3a8
Subject: [PATCH 49/49] fix machine-check propagation
9ae3a8
MIME-Version: 1.0
9ae3a8
Content-Type: text/plain; charset=UTF-8
9ae3a8
Content-Transfer-Encoding: 8bit
9ae3a8
9ae3a8
RH-Author: Paolo Bonzini <pbonzini@redhat.com>
9ae3a8
Message-id: <1395837043-17408-1-git-send-email-pbonzini@redhat.com>
9ae3a8
Patchwork-id: 58256
9ae3a8
O-Subject: [RHEL 7.0 qemu-kvm PATCH] fix machine-check propagation
9ae3a8
Bugzilla: 740107
9ae3a8
RH-Acked-by: Marcel Apfelbaum <marcel.a@redhat.com>
9ae3a8
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
9ae3a8
RH-Acked-by: Dr. David Alan Gilbert (git) <dgilbert@redhat.com>
9ae3a8
9ae3a8
From: Dean Nelson <dnelson@redhat.com>
9ae3a8
9ae3a8
Bugzilla: 740107
9ae3a8
9ae3a8
Upstream status: fixed by a big patch that should not be backported
9ae3a8
9ae3a8
Brew build: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=7257203
9ae3a8
9ae3a8
Machine-check propagation was broken by this commit
9ae3a8
9ae3a8
    commit a60f24b56b07f46453424263b276b0879c25c4e6
9ae3a8
    Author: Andreas Färber <afaerber@suse.de>
9ae3a8
    Date:   Sat Dec 1 05:35:08 2012 +0100
9ae3a8
9ae3a8
    cpu: Move kvm_state field into CPUState
9ae3a8
9ae3a8
    Adapt some functions to take CPUState / {PowerPC,S390}CPU argument.
9ae3a8
9ae3a8
    Signed-off-by: Andreas Färber <afaerber@suse.de>
9ae3a8
9ae3a8
due to a typo.  In RHEL7, first_cpu is an "env" so you need ENV_GET_CPU
9ae3a8
to convert it to a "cpu" and fish out the kvm_state.  ENV_GET_CPU is
9ae3a8
basically a "container_of" type of operation.  Instead, CPU was being used
9ae3a8
(which is just a cast).
9ae3a8
9ae3a8
Upstream, everything was fixed magically when first_cpu was changed
9ae3a8
from "env" to "cpu" in commit 182735e (cpu: Make first_cpu and next_cpu
9ae3a8
CPUState, 2013-05-29).
9ae3a8
9ae3a8
This patch fixes the bug by using the right cast.  All the work was done
9ae3a8
by Dean Nelson.
9ae3a8
9ae3a8
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9ae3a8
---
9ae3a8
 target-i386/kvm.c | 2 +-
9ae3a8
 1 file changed, 1 insertion(+), 1 deletion(-)
9ae3a8
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 target-i386/kvm.c |    2 +-
9ae3a8
 1 files changed, 1 insertions(+), 1 deletions(-)
9ae3a8
9ae3a8
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
9ae3a8
index ba2cd7f..6b250f5 100644
9ae3a8
--- a/target-i386/kvm.c
9ae3a8
+++ b/target-i386/kvm.c
9ae3a8
@@ -357,7 +357,7 @@ int kvm_arch_on_sigbus(int code, void *addr)
9ae3a8
 
9ae3a8
         /* Hope we are lucky for AO MCE */
9ae3a8
         if (qemu_ram_addr_from_host(addr, &ram_addr) ||
9ae3a8
-            !kvm_physical_memory_addr_from_host(CPU(first_cpu)->kvm_state,
9ae3a8
+            !kvm_physical_memory_addr_from_host(ENV_GET_CPU(first_cpu)->kvm_state,
9ae3a8
                                                 addr, &paddr)) {
9ae3a8
             fprintf(stderr, "Hardware memory error for memory used by "
9ae3a8
                     "QEMU itself instead of guest system!: %p\n", addr);
9ae3a8
-- 
9ae3a8
1.7.1
9ae3a8