diff options
author | Jin Dongming <jin.dongming@np.css.fujitsu.com> | 2010-12-10 17:21:14 +0900 |
---|---|---|
committer | Marcelo Tosatti <mtosatti@redhat.com> | 2011-01-21 14:05:22 -0200 |
commit | 2bd3e04c3b3c76d573435a299a4d85bad0021a90 (patch) | |
tree | 20abbcbb6ccfec64688d1e859d4cfa679d9bf570 /target-i386/helper.c | |
parent | 31ce5e0c49821d92fb30cce2f3055ef33613b287 (diff) |
Add function for checking mca broadcast of CPU
Add function for checking whether current CPU support mca broadcast.
Signed-off-by: Jin Dongming <jin.dongming@np.css.fujitsu.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'target-i386/helper.c')
-rw-r--r-- | target-i386/helper.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/target-i386/helper.c b/target-i386/helper.c index 2cfb4a42a7..6dfa27d51b 100644 --- a/target-i386/helper.c +++ b/target-i386/helper.c @@ -110,6 +110,32 @@ void cpu_x86_close(CPUX86State *env) qemu_free(env); } +static void cpu_x86_version(CPUState *env, int *family, int *model) +{ + int cpuver = env->cpuid_version; + + if (family == NULL || model == NULL) { + return; + } + + *family = (cpuver >> 8) & 0x0f; + *model = ((cpuver >> 12) & 0xf0) + ((cpuver >> 4) & 0x0f); +} + +/* Broadcast MCA signal for processor version 06H_EH and above */ +int cpu_x86_support_mca_broadcast(CPUState *env) +{ + int family = 0; + int model = 0; + + cpu_x86_version(env, &family, &model); + if ((family == 6 && model >= 14) || family > 6) { + return 1; + } + + return 0; +} + /***********************************************************/ /* x86 debug */ @@ -1080,6 +1106,13 @@ void cpu_inject_x86_mce(CPUState *cenv, int bank, uint64_t status, return; } + if (broadcast) { + if (!cpu_x86_support_mca_broadcast(cenv)) { + fprintf(stderr, "Current CPU does not support broadcast\n"); + return; + } + } + if (kvm_enabled()) { if (broadcast) { flag |= MCE_BROADCAST; |