WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

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

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] x86: add CMCI software injection interface
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 09 Jun 2010 00:01:24 -0700
Delivery-date: Wed, 09 Jun 2010 00:03:32 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1276066291 -3600
# Node ID 05bfc5a472b6c607c7a28ca963541751f0dd3618
# Parent  b04b812480782034b34d759401ab11e95a86cf71
x86: add CMCI software injection interface

A new command is added. User can set the target CPU map, since the
CMCI can be triggered on some specific CPUs.  Please be noticed that
the xenctl_cpumap structure is moved from domctl.h to xen.h.

Signed-off-by: Jiang, Yunhong <yunhong.jiang@xxxxxxxxx>
---
 xen/arch/x86/cpu/mcheck/mce.c         |   53 ++++++++++++++++++++++++++++++++++
 xen/include/public/arch-x86/xen-mca.h |   17 ++++++++++
 xen/include/public/domctl.h           |    5 ---
 xen/include/public/xen.h              |   11 ++++++-
 xen/include/xlat.lst                  |    1 
 5 files changed, 81 insertions(+), 6 deletions(-)

diff -r b04b81248078 -r 05bfc5a472b6 xen/arch/x86/cpu/mcheck/mce.c
--- a/xen/arch/x86/cpu/mcheck/mce.c     Wed Jun 09 07:42:19 2010 +0100
+++ b/xen/arch/x86/cpu/mcheck/mce.c     Wed Jun 09 07:51:31 2010 +0100
@@ -1206,6 +1206,12 @@ static void x86_mc_mceinject(void *data)
        __asm__ __volatile__("int $0x12");
 }
 
+static void x86_cmci_inject(void *data)
+{
+       printk("Simulating CMCI on cpu %d\n", smp_processor_id());
+       __asm__ __volatile__("int $0xf7");
+}
+
 #if BITS_PER_LONG == 64
 
 #define        ID2COOKIE(id)   ((mctelem_cookie_t)(id))
@@ -1244,6 +1250,7 @@ CHECK_FIELD_(struct, mc_physcpuinfo, ncp
 CHECK_FIELD_(struct, mc_physcpuinfo, ncpus);
 # define CHECK_compat_mc_physcpuinfo struct mc_physcpuinfo
 
+#define CHECK_compat_mc_inject_v2   struct mc_inject_v2
 CHECK_mc;
 # undef CHECK_compat_mc_fetch
 # undef CHECK_compat_mc_physcpuinfo
@@ -1449,6 +1456,52 @@ long do_mca(XEN_GUEST_HANDLE(xen_mc_t) u
                   mc_mceinject, 1);
                break;
 
+       case XEN_MC_inject_v2:
+       {
+               cpumask_t cpumap;
+
+               if (nr_mce_banks == 0)
+                       return x86_mcerr("do_mca #MC", -ENODEV);
+
+               if ( op->u.mc_inject_v2.flags & XEN_MC_INJECT_CPU_BROADCAST )
+                       cpus_copy(cpumap, cpu_online_map);
+               else
+               {
+                       int gcw;
+
+                       cpus_clear(cpumap);
+                       xenctl_cpumap_to_cpumask(&cpumap,
+                                       &op->u.mc_inject_v2.cpumap);
+                       gcw = cpus_weight(cpumap);
+                       cpus_and(cpumap, cpu_online_map, cpumap);
+
+                       if ( cpus_empty(cpumap) )
+                               return x86_mcerr("No online CPU passed\n", 
-EINVAL);
+                       else if ( gcw != cpus_weight(cpumap) )
+                               dprintk(XENLOG_INFO,
+                                       "Not all required CPUs are online\n");
+               }
+
+               switch (op->u.mc_inject_v2.flags & XEN_MC_INJECT_TYPE_MASK)
+               {
+               case XEN_MC_INJECT_TYPE_MCE:
+                       if ( mce_broadcast &&
+                         !cpus_equal(cpumap, cpu_online_map) )
+                               printk("Not trigger MCE on all CPUs, may 
HANG!\n");
+                       on_selected_cpus(&cpumap, x86_mc_mceinject, NULL, 1);
+                       break;
+               case XEN_MC_INJECT_TYPE_CMCI:
+                       if ( !cmci_support )
+                               return x86_mcerr(
+                               "No CMCI supported in platform\n", -EINVAL);
+                       on_selected_cpus(&cpumap, x86_cmci_inject, NULL, 1);
+                       break;
+               default:
+                       return x86_mcerr("Wrong mca type\n", -EINVAL);
+               }
+               break;
+       }
+
        default:
                return x86_mcerr("do_mca: bad command", -EINVAL);
        }
diff -r b04b81248078 -r 05bfc5a472b6 xen/include/public/arch-x86/xen-mca.h
--- a/xen/include/public/arch-x86/xen-mca.h     Wed Jun 09 07:42:19 2010 +0100
+++ b/xen/include/public/arch-x86/xen-mca.h     Wed Jun 09 07:51:31 2010 +0100
@@ -404,6 +404,20 @@ struct xen_mc_mceinject {
        unsigned int mceinj_cpunr;      /* target processor id */
 };
 
+#if defined(__XEN__) || defined(__XEN_TOOLS__)
+#define XEN_MC_inject_v2        6
+#define XEN_MC_INJECT_TYPE_MASK     0x7
+#define XEN_MC_INJECT_TYPE_MCE      0x0
+#define XEN_MC_INJECT_TYPE_CMCI     0x1
+
+#define XEN_MC_INJECT_CPU_BROADCAST 0x8
+
+struct xen_mc_inject_v2 {
+       uint32_t flags;
+       struct xenctl_cpumap cpumap;
+};
+#endif
+
 struct xen_mc {
     uint32_t cmd;
     uint32_t interface_version; /* XEN_MCA_INTERFACE_VERSION */
@@ -413,6 +427,9 @@ struct xen_mc {
         struct xen_mc_physcpuinfo  mc_physcpuinfo;
         struct xen_mc_msrinject    mc_msrinject;
         struct xen_mc_mceinject    mc_mceinject;
+#if defined(__XEN__) || defined(__XEN_TOOLS__)
+        struct xen_mc_inject_v2    mc_inject_v2;
+#endif
     } u;
 };
 typedef struct xen_mc xen_mc_t;
diff -r b04b81248078 -r 05bfc5a472b6 xen/include/public/domctl.h
--- a/xen/include/public/domctl.h       Wed Jun 09 07:42:19 2010 +0100
+++ b/xen/include/public/domctl.h       Wed Jun 09 07:51:31 2010 +0100
@@ -36,11 +36,6 @@
 #include "grant_table.h"
 
 #define XEN_DOMCTL_INTERFACE_VERSION 0x00000007
-
-struct xenctl_cpumap {
-    XEN_GUEST_HANDLE_64(uint8) bitmap;
-    uint32_t nr_cpus;
-};
 
 /*
  * NB. xen_domctl.domain is an IN/OUT parameter for this operation.
diff -r b04b81248078 -r 05bfc5a472b6 xen/include/public/xen.h
--- a/xen/include/public/xen.h  Wed Jun 09 07:42:19 2010 +0100
+++ b/xen/include/public/xen.h  Wed Jun 09 07:51:31 2010 +0100
@@ -690,13 +690,22 @@ __DEFINE_XEN_GUEST_HANDLE(uint64, uint64
 
 /* Default definitions for macros used by domctl/sysctl. */
 #if defined(__XEN__) || defined(__XEN_TOOLS__)
+
 #ifndef uint64_aligned_t
 #define uint64_aligned_t uint64_t
 #endif
 #ifndef XEN_GUEST_HANDLE_64
 #define XEN_GUEST_HANDLE_64(name) XEN_GUEST_HANDLE(name)
 #endif
-#endif
+
+#ifndef __ASSEMBLY__
+struct xenctl_cpumap {
+    XEN_GUEST_HANDLE_64(uint8) bitmap;
+    uint32_t nr_cpus;
+};
+#endif
+
+#endif /* defined(__XEN__) || defined(__XEN_TOOLS__) */
 
 #endif /* __XEN_PUBLIC_XEN_H__ */
 
diff -r b04b81248078 -r 05bfc5a472b6 xen/include/xlat.lst
--- a/xen/include/xlat.lst      Wed Jun 09 07:42:19 2010 +0100
+++ b/xen/include/xlat.lst      Wed Jun 09 07:51:31 2010 +0100
@@ -2,6 +2,7 @@
 # ! - needs translation
 # ? - needs checking
 ?      dom0_vga_console_info           xen.h
+?   xenctl_cpumap               xen.h
 ?      mmu_update                      xen.h
 !      mmuext_op                       xen.h
 !      start_info                      xen.h

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] x86: add CMCI software injection interface, Xen patchbot-unstable <=