summaryrefslogtreecommitdiff
path: root/target/i386/kvm.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2017-02-09 10:04:34 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2017-03-03 16:40:02 +0100
commit4d39892cca86a9162beaa3944057d118ef42edcd (patch)
tree4848f257f09d798d7ab35b3a3ced3e089ca2417a /target/i386/kvm.c
parenta16fc07ebd58da51d5e1c2928069879c40a26f59 (diff)
downloadqemu-4d39892cca86a9162beaa3944057d118ef42edcd.tar.gz
KVM: remove kvm_arch_on_sigbus
Build it on kvm_arch_on_sigbus_vcpu instead. They do the same for "action optional" SIGBUSes, and the main thread should never get "action required" SIGBUSes because it blocks the signal. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'target/i386/kvm.c')
-rw-r--r--target/i386/kvm.c40
1 files changed, 5 insertions, 35 deletions
diff --git a/target/i386/kvm.c b/target/i386/kvm.c
index f49a786c98..2adf992c84 100644
--- a/target/i386/kvm.c
+++ b/target/i386/kvm.c
@@ -462,14 +462,13 @@ int kvm_arch_on_sigbus_vcpu(CPUState *c, int code, void *addr)
ram_addr_t ram_addr;
hwaddr paddr;
+ /* If we get an action required MCE, it has been injected by KVM
+ * while the VM was running. An action optional MCE instead should
+ * be coming from the main thread, which qemu_init_sigbus identifies
+ * as the "early kill" thread.
+ */
assert(code == BUS_MCEERR_AR || code == BUS_MCEERR_AO);
- /* Because the MCE happened while running the VCPU, KVM could have
- * injected action required MCEs too. Action optional MCEs should
- * be delivered to the main thread, which qemu_init_sigbus identifies
- * as the "early kill" thread, but if we get one for whatever reason
- * we just handle it just like the main thread would.
- */
if ((env->mcg_cap & MCG_SER_P) && addr) {
ram_addr = qemu_ram_addr_from_host(addr);
if (ram_addr != RAM_ADDR_INVALID &&
@@ -491,35 +490,6 @@ int kvm_arch_on_sigbus_vcpu(CPUState *c, int code, void *addr)
return 0;
}
-int kvm_arch_on_sigbus(int code, void *addr)
-{
- X86CPU *cpu = X86_CPU(first_cpu);
-
- assert(code == BUS_MCEERR_AR || code == BUS_MCEERR_AO);
-
- if (code == BUS_MCEERR_AR) {
- hardware_memory_error();
- }
-
- /* Hope we are lucky for AO MCE */
- if ((cpu->env.mcg_cap & MCG_SER_P) && addr) {
- ram_addr_t ram_addr;
- hwaddr paddr;
-
- ram_addr = qemu_ram_addr_from_host(addr);
- if (ram_addr != RAM_ADDR_INVALID &&
- kvm_physical_memory_addr_from_host(first_cpu->kvm_state,
- addr, &paddr)) {
- kvm_hwpoison_page_add(ram_addr);
- kvm_mce_inject(X86_CPU(first_cpu), paddr, code);
- }
-
- fprintf(stderr, "Hardware memory error for memory used by "
- "QEMU itself instead of guest system!: %p\n", addr);
- }
- return 0;
-}
-
static int kvm_inject_mce_oldstyle(X86CPU *cpu)
{
CPUX86State *env = &cpu->env;