[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] x86: add CMCI software injection interface



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1272972145 -3600
# Node ID a8eb546e3cb07e0f2477dea92affa14821a04108
# Parent  9a12204ac0e454746ae609cbd559ffd48fb2cdb0
x86: add CMCI software injection interface

This small patch now add CMCI software injection interface.
So that CMCI error could be triggered by software on CPUs
which support CMCI.

Signed-off-by: Yunhong Jiang<yunhong.jiang@xxxxxxxxx>
Signed-off-by: Liping Ke <liping.ke@xxxxxxxxx>
---
 xen/arch/x86/cpu/mcheck/mce.c         |   24 ++++++++++++++++++------
 xen/include/public/arch-x86/xen-mca.h |    5 ++++-
 2 files changed, 22 insertions(+), 7 deletions(-)

diff -r 9a12204ac0e4 -r a8eb546e3cb0 xen/arch/x86/cpu/mcheck/mce.c
--- a/xen/arch/x86/cpu/mcheck/mce.c     Tue May 04 12:19:50 2010 +0100
+++ b/xen/arch/x86/cpu/mcheck/mce.c     Tue May 04 12:22:25 2010 +0100
@@ -1274,6 +1274,7 @@ long do_mca(XEN_GUEST_HANDLE(xen_mc_t) u
        unsigned int target;
        struct xen_mc_msrinject *mc_msrinject;
        struct xen_mc_mceinject *mc_mceinject;
+       cpumask_t target_map;
 
        if (!IS_PRIV(v->domain) )
                return x86_mcerr(NULL, -EPERM);
@@ -1411,6 +1412,7 @@ long do_mca(XEN_GUEST_HANDLE(xen_mc_t) u
 
                mc_mceinject = &op->u.mc_mceinject;
                target = mc_mceinject->mceinj_cpunr;
+               flags = mc_mceinject->mceinj_flag;
 
                if (target >= NR_CPUS)
                        return x86_mcerr("do_mca #MC: bad target", -EINVAL);
@@ -1419,12 +1421,22 @@ long do_mca(XEN_GUEST_HANDLE(xen_mc_t) u
                        return x86_mcerr("do_mca #MC: target offline", -EINVAL);
 
                add_taint(TAINT_ERROR_INJECT);
-
-        if ( mce_broadcast )
-            on_each_cpu(x86_mc_mceinject, mc_mceinject, 0);
-        else
-            on_selected_cpus(cpumask_of(target), x86_mc_mceinject,
-                  mc_mceinject, 1);
+               if (flags == XEN_MC_UC) {
+                       if ( mce_broadcast )
+                               on_each_cpu(x86_mc_mceinject, mc_mceinject, 0);
+                       else
+                               on_selected_cpus(cpumask_of(target), 
x86_mc_mceinject,
+                                       mc_mceinject, 1);
+               }
+               else if (flags == XEN_MC_CE) {
+                       if (mce_broadcast)
+                               send_IPI_mask(&cpu_online_map, 
CMCI_APIC_VECTOR);
+                       else {
+                               cpus_clear(target_map);
+                               cpu_set(target, target_map);
+                               send_IPI_mask(&target_map, CMCI_APIC_VECTOR);
+                       }
+               }
                break;
 
        default:
diff -r 9a12204ac0e4 -r a8eb546e3cb0 xen/include/public/arch-x86/xen-mca.h
--- a/xen/include/public/arch-x86/xen-mca.h     Tue May 04 12:19:50 2010 +0100
+++ b/xen/include/public/arch-x86/xen-mca.h     Tue May 04 12:22:25 2010 +0100
@@ -400,8 +400,11 @@ struct xen_mc_msrinject {
 #define MC_MSRINJ_F_INTERPOSE   0x1
 
 #define XEN_MC_mceinject    5
+#define XEN_MC_UC           0
+#define XEN_MC_CE           1
 struct xen_mc_mceinject {
-       unsigned int mceinj_cpunr;      /* target processor id */
+       uint32_t mceinj_cpunr;      /* target processor id */
+       uint32_t mceinj_flag;       /* UC error or CE error flag */
 };
 
 struct xen_mc {

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.