From patchwork Thu Jan 6 17:56:09 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 459911 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 p06I41RD003331 for ; Thu, 6 Jan 2011 18:04:03 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752187Ab1AFSDc (ORCPT ); Thu, 6 Jan 2011 13:03:32 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59425 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752060Ab1AFSDb (ORCPT ); Thu, 6 Jan 2011 13:03:31 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id p06I3Ii6005108 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 6 Jan 2011 13:03:18 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p06I3HMu018024; Thu, 6 Jan 2011 13:03:17 -0500 Received: from amt.cnet (vpn1-4-164.ams2.redhat.com [10.36.4.164]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id p06I3FVP019145; Thu, 6 Jan 2011 13:03:16 -0500 Received: from amt.cnet (localhost.localdomain [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id E561468A1F0; Thu, 6 Jan 2011 15:57:21 -0200 (BRST) Received: (from marcelo@localhost) by amt.cnet (8.14.4/8.14.4/Submit) id p06HvGou011348; Thu, 6 Jan 2011 15:57:16 -0200 From: Marcelo Tosatti To: Anthony Liguori Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org, Jin Dongming , Marcelo Tosatti Subject: [PATCH 03/35] Clean up cpu_inject_x86_mce() Date: Thu, 6 Jan 2011 15:56:09 -0200 Message-Id: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 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.6 (demeter1.kernel.org [140.211.167.41]); Thu, 06 Jan 2011 18:04:03 +0000 (UTC) diff --git a/target-i386/helper.c b/target-i386/helper.c index 25a3e36..2c94130 100644 --- a/target-i386/helper.c +++ b/target-i386/helper.c @@ -1021,21 +1021,12 @@ static void breakpoint_handler(CPUState *env) /* This should come from sysemu.h - if we could include it here... */ void qemu_system_reset_request(void); -void cpu_inject_x86_mce(CPUState *cenv, int bank, uint64_t status, +static void qemu_inject_x86_mce(CPUState *cenv, int bank, uint64_t status, uint64_t mcg_status, uint64_t addr, uint64_t misc) { uint64_t mcg_cap = cenv->mcg_cap; - unsigned bank_num = mcg_cap & 0xff; uint64_t *banks = cenv->mce_banks; - if (bank >= bank_num || !(status & MCI_STATUS_VAL)) - return; - - if (kvm_enabled()) { - kvm_inject_x86_mce(cenv, bank, status, mcg_status, addr, misc, 0); - return; - } - /* * if MSR_MCG_CTL is not all 1s, the uncorrected error * reporting is disabled @@ -1076,6 +1067,22 @@ void cpu_inject_x86_mce(CPUState *cenv, int bank, uint64_t status, } else banks[1] |= MCI_STATUS_OVER; } + +void cpu_inject_x86_mce(CPUState *cenv, int bank, uint64_t status, + uint64_t mcg_status, uint64_t addr, uint64_t misc) +{ + unsigned bank_num = cenv->mcg_cap & 0xff; + + if (bank >= bank_num || !(status & MCI_STATUS_VAL)) { + return; + } + + if (kvm_enabled()) { + kvm_inject_x86_mce(cenv, bank, status, mcg_status, addr, misc, 0); + } else { + qemu_inject_x86_mce(cenv, bank, status, mcg_status, addr, misc); + } +} #endif /* !CONFIG_USER_ONLY */ static void mce_init(CPUX86State *cenv)