All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jin Dongming <jin.dongming@np.css.fujitsu.com>
To: Avi Kivity <avi@redhat.com>, Marcelo Tosatti <mtosatti@redhat.com>
Cc: Andi Kleen <andi@firstfloor.org>,
	Huang Ying <ying.huang@intel.com>,
	Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>,
	Dean Nelson <dnelson@redhat.com>, KVM list <kvm@vger.kernel.org>
Subject: [PATCH 3/3] Check processor version for broadcast.
Date: Tue, 30 Nov 2010 17:15:24 +0900	[thread overview]
Message-ID: <4CF4B29C.5000907@np.css.fujitsu.com> (raw)

Broadcast MCA signal is not supported by the CPUs whose version is
below 06H_EH.

Signed-off-by: Jin Dongming <jin.dongming@np.css.fujitsu.com>
---
 target-i386/helper.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/target-i386/helper.c b/target-i386/helper.c
index 7e07ebd..437290b 100644
--- a/target-i386/helper.c
+++ b/target-i386/helper.c
@@ -1077,10 +1077,23 @@ void cpu_inject_x86_mce(CPUState *cenv, int bank, uint64_t status,
     unsigned bank_num = cenv->mcg_cap & 0xff;
     CPUState *env;
     int flag = 0;
+    int family, model, cpuver = first_cpu->cpuid_version;
 
     if (bank >= bank_num || !(status & MCI_STATUS_VAL))
         return;
 
+    if (broadcast) {
+        family = (cpuver >> 8) & 0x0f;
+        model = ((cpuver >> 12) & 0xf0) + ((cpuver >> 4) & 0x0f);
+
+        if ((family == 6 && model >= 14) || family > 6)
+            broadcast = 1;
+        else {
+            fprintf(stderr, "Current CPU does not support broadcast\n");
+            return;
+        }
+    }
+
     if (kvm_enabled()) {
         if (broadcast)
             flag |= 0x02; /* bit 1: 1(broadcast); 0(not broadcast) */
-- 
1.7.1.1



             reply	other threads:[~2010-11-30  8:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-30  8:15 Jin Dongming [this message]
2010-11-30  8:22 ` [PATCH 3/3] Check processor version for broadcast Huang Ying
2010-11-30  8:40   ` Jin Dongming

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4CF4B29C.5000907@np.css.fujitsu.com \
    --to=jin.dongming@np.css.fujitsu.com \
    --cc=andi@firstfloor.org \
    --cc=avi@redhat.com \
    --cc=dnelson@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=seto.hidetoshi@jp.fujitsu.com \
    --cc=ying.huang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.