[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 05/31] Add function for checking mca broadcast of CP
From: |
Marcelo Tosatti |
Subject: |
[Qemu-devel] [PATCH 05/31] Add function for checking mca broadcast of CPU |
Date: |
Mon, 24 Jan 2011 07:02:14 -0200 |
From: Jin Dongming <address@hidden>
Add function for checking whether current CPU support mca broadcast.
Signed-off-by: Jin Dongming <address@hidden>
Signed-off-by: Marcelo Tosatti <address@hidden>
---
target-i386/cpu.h | 1 +
target-i386/helper.c | 33 +++++++++++++++++++++++++++++++++
target-i386/kvm.c | 6 +-----
3 files changed, 35 insertions(+), 5 deletions(-)
diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index f0c07cd..dddcd74 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -760,6 +760,7 @@ int cpu_x86_exec(CPUX86State *s);
void cpu_x86_close(CPUX86State *s);
void x86_cpu_list (FILE *f, fprintf_function cpu_fprintf, const char *optarg);
void x86_cpudef_setup(void);
+int cpu_x86_support_mca_broadcast(CPUState *env);
int cpu_get_pic_interrupt(CPUX86State *s);
/* MSDOS compatibility mode FPU exception support */
diff --git a/target-i386/helper.c b/target-i386/helper.c
index 2cfb4a4..6dfa27d 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;
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index 8b868ad..2115a58 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -1711,13 +1711,9 @@ static void hardware_memory_error(void)
static void kvm_mce_broadcast_rest(CPUState *env)
{
CPUState *cenv;
- int family, model, cpuver = env->cpuid_version;
-
- family = (cpuver >> 8) & 0xf;
- model = ((cpuver >> 12) & 0xf0) + ((cpuver >> 4) & 0xf);
/* Broadcast MCA signal for processor version 06H_EH and above */
- if ((family == 6 && model >= 14) || family > 6) {
+ if (cpu_x86_support_mca_broadcast(env)) {
for (cenv = first_cpu; cenv != NULL; cenv = cenv->next_cpu) {
if (cenv == env) {
continue;
--
1.7.2.3
- [Qemu-devel] [PATCH 22/31] kvm: x86: Refactor msr_star/hsave_pa setup and checks, (continued)
- [Qemu-devel] [PATCH 22/31] kvm: x86: Refactor msr_star/hsave_pa setup and checks, Marcelo Tosatti, 2011/01/24
- [Qemu-devel] [PATCH 24/31] kvm: x86: Fix !CONFIG_KVM_PARA build, Marcelo Tosatti, 2011/01/24
- [Qemu-devel] [PATCH 11/31] kvm: x86: Prevent sign extension of DR7 in guest debugging mode, Marcelo Tosatti, 2011/01/24
- [Qemu-devel] [PATCH 30/31] kvm: x86: Implicitly clear nmi_injected/pending on reset, Marcelo Tosatti, 2011/01/24
- [Qemu-devel] [PATCH 31/31] kvm: x86: Only read/write MSR_KVM_ASYNC_PF_EN if supported, Marcelo Tosatti, 2011/01/24
- [Qemu-devel] [PATCH 03/31] Clean up cpu_inject_x86_mce(), Marcelo Tosatti, 2011/01/24
- [Qemu-devel] [PATCH 15/31] kvm: Stop on all fatal exit reasons, Marcelo Tosatti, 2011/01/24
- [Qemu-devel] [PATCH 17/31] x86: Optionally dump code bytes on cpu_dump_state, Marcelo Tosatti, 2011/01/24
- [Qemu-devel] [PATCH 02/31] kvm: convert kvm_ioctl(KVM_CHECK_EXTENSION) to kvm_check_extension(), Marcelo Tosatti, 2011/01/24
- [Qemu-devel] [PATCH 28/31] kvm: Flush coalesced mmio buffer on IO window exits, Marcelo Tosatti, 2011/01/24
- [Qemu-devel] [PATCH 05/31] Add function for checking mca broadcast of CPU,
Marcelo Tosatti <=
- [Qemu-devel] [PATCH 04/31] Add "broadcast" option for mce command, Marcelo Tosatti, 2011/01/24
- [Qemu-devel] [PATCH 01/31] kvm: Enable user space NMI injection for kvm guest, Marcelo Tosatti, 2011/01/24
- [Qemu-devel] [PATCH 07/31] kvm: kvm_mce_inj_* subroutines for templated error injections, Marcelo Tosatti, 2011/01/24
- [Qemu-devel] [PATCH 13/31] kvm: Fix coding style violations, Marcelo Tosatti, 2011/01/24
- [Qemu-devel] [PATCH 08/31] kvm: introduce kvm_inject_x86_mce_on, Marcelo Tosatti, 2011/01/24
- [Qemu-devel] [PATCH 14/31] kvm: x86: Swallow KVM_EXIT_SET_TPR, Marcelo Tosatti, 2011/01/24
- [Qemu-devel] [PATCH 09/31] kvm: x86: Fix DPL write back of segment registers, Marcelo Tosatti, 2011/01/24
- [Qemu-devel] [PATCH 29/31] kvm: Do not use qemu_fair_mutex, Marcelo Tosatti, 2011/01/24
- [Qemu-devel] [PATCH 18/31] kvm: x86: Align kvm_arch_put_registers code with comment, Marcelo Tosatti, 2011/01/24
- [Qemu-devel] [PATCH 10/31] kvm: x86: Remove obsolete SS.RPL/DPL aligment, Marcelo Tosatti, 2011/01/24