From patchwork Fri Oct 8 08:25:14 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Huang, Ying" X-Patchwork-Id: 240841 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o988PWQs024374 for ; Fri, 8 Oct 2010 08:25:33 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756136Ab0JHIZV (ORCPT ); Fri, 8 Oct 2010 04:25:21 -0400 Received: from mga02.intel.com ([134.134.136.20]:14752 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756041Ab0JHIZR (ORCPT ); Fri, 8 Oct 2010 04:25:17 -0400 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 08 Oct 2010 01:25:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.57,302,1283756400"; d="scan'208";a="561872519" Received: from yhuang-dev.sh.intel.com (HELO [10.239.13.2]) ([10.239.13.2]) by orsmga002.jf.intel.com with ESMTP; 08 Oct 2010 01:25:15 -0700 Subject: [PATCH] Fix SRAO/SRAR MCE injecting on guest without MCG_SER_P From: Huang Ying To: Avi Kivity , Marcelo Tosatti Cc: Hidetoshi Seto , "kvm@vger.kernel.org" , Andi Kleen , Dean Nelson Date: Fri, 08 Oct 2010 16:25:14 +0800 Message-ID: <1286526314.7768.97.camel@yhuang-dev> Mime-Version: 1.0 X-Mailer: Evolution 2.30.2 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Fri, 08 Oct 2010 08:25:33 +0000 (UTC) --- 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;