Skip to contentSkip to conversation

Check processor version for broadcast.

PATCH In review Jin Dongming 2 participants 3 messages Nov 30, 2010 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 3/3 Check processor version for broadcast.

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

---
 target-i386/helper.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
target-i386/helper.c +13 -0
index 7e07ebd..437290b 100644
@@ -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) */
Signature · 1 line
1.7.1.1
#1 lore raw

Hi, Dongming,

Quoted 26 lines · Jin Dongming

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

---
 target-i386/helper.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
target-i386/helper.c +6 -0
index 7e07ebd..437290b 100644
@@ -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)

target-i386/helper.c void cpu_inject_x86_mce(CPUState *cenv, int bank, uint64_t status, · line 1099

Quoted 10 lines
target-i386/helper.c +7 -0
+            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) */

Why not wrap this into a function? I think it may be used by other functions too.

Best Regards,
Huang Ying

#2 lore raw

Hi, Huang-san

Quoted 34 lines · Huang Ying

Hi, Dongming,

Quoted 31 lines · Jin Dongming

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

---
 target-i386/helper.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
target-i386/helper.c +11 -0
index 7e07ebd..437290b 100644
@@ -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;
+        }
Quoted 8 lines

target-i386/helper.c void cpu_inject_x86_mce(CPUState *cenv, int bank, uint64_t status, · line 1099

Quoted 5 lines
target-i386/helper.c +2 -0
+    }
+
     if (kvm_enabled()) {
         if (broadcast)
             flag |= 0x02; /* bit 1: 1(broadcast); 0(not broadcast) */

Why not wrap this into a function? I think it may be used by other functions too.

I have other patchset for cleanup. So I will do it in that patchset. Thank you!

Best Regards,
Jin Dongming

Quoted 11 lines

Best Regards,
Huang Ying

--
To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html