debuggers.hg

changeset 20929:a7546e45ca83

libxc: Export do_mca hypercall to user space tools.

This is mainly for software trigger MCE operation, so that test suites
can trigger software MCE.

Signed-off-by: Jiang, Yunhong <yunhong.jiang@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Feb 03 09:38:57 2010 +0000 (2010-02-03)
parents 09dd83d09f49
children 526af7ddb9bd
files tools/libxc/xc_misc.c tools/libxc/xenctrl.h
line diff
     1.1 --- a/tools/libxc/xc_misc.c	Wed Feb 03 09:38:00 2010 +0000
     1.2 +++ b/tools/libxc/xc_misc.c	Wed Feb 03 09:38:57 2010 +0000
     1.3 @@ -96,6 +96,27 @@ int xc_sched_id(int xc_handle,
     1.4      return 0;
     1.5  }
     1.6  
     1.7 +#if defined(__i386__) || defined(__x86_64__)
     1.8 +int xc_mca_op(int xc_handle, struct xen_mc *mc)
     1.9 +{
    1.10 +    int ret = 0;
    1.11 +    DECLARE_HYPERCALL;
    1.12 +
    1.13 +    mc->interface_version = XEN_MCA_INTERFACE_VERSION;
    1.14 +    if ( lock_pages(mc, sizeof(mc)) )
    1.15 +    {
    1.16 +        PERROR("Could not lock xen_mc memory\n");
    1.17 +        return -EINVAL;
    1.18 +    }
    1.19 +
    1.20 +    hypercall.op = __HYPERVISOR_mca;
    1.21 +    hypercall.arg[0] = (unsigned long)mc;
    1.22 +    ret = do_xen_hypercall(xc_handle, &hypercall);
    1.23 +    unlock_pages(mc, sizeof(mc));
    1.24 +    return ret;
    1.25 +}
    1.26 +#endif
    1.27 +
    1.28  int xc_perfc_control(int xc_handle,
    1.29                       uint32_t opcode,
    1.30                       xc_perfc_desc_t *desc,
     2.1 --- a/tools/libxc/xenctrl.h	Wed Feb 03 09:38:00 2010 +0000
     2.2 +++ b/tools/libxc/xenctrl.h	Wed Feb 03 09:38:57 2010 +0000
     2.3 @@ -37,6 +37,7 @@
     2.4  #if defined(__i386__) || defined(__x86_64__)
     2.5  #include <xen/foreign/x86_32.h>
     2.6  #include <xen/foreign/x86_64.h>
     2.7 +#include <xen/arch-x86/xen-mca.h>
     2.8  #endif
     2.9  
    2.10  #ifdef __ia64__
    2.11 @@ -1207,6 +1208,7 @@ int xc_cpuid_apply_policy(int xc,
    2.12                            domid_t domid);
    2.13  void xc_cpuid_to_str(const unsigned int *regs,
    2.14                       char **strs);
    2.15 +int xc_mca_op(int xc_handle, struct xen_mc *mc);
    2.16  #endif
    2.17  
    2.18  struct xc_px_val {