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-devel

[Xen-devel] RE: [PATCH] Export mca_op to user space tools

To: Keir Fraser <keir.fraser@xxxxxxxxxxxxx>
Subject: [Xen-devel] RE: [PATCH] Export mca_op to user space tools
From: "Jiang, Yunhong" <yunhong.jiang@xxxxxxxxx>
Date: Tue, 2 Feb 2010 14:41:13 +0800
Accept-language: en-US
Acceptlanguage: en-US
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Mon, 01 Feb 2010 22:41:52 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <C78C910B.8826%keir.fraser@xxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <C8EDE645B81E5141A8C6B2F73FD9265118FE9F18DB@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx> <C78C910B.8826%keir.fraser@xxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcqjIgFyEekwMgZ3R6+0bN00gi80AQAJiFVyAB+LdrA=
Thread-topic: [PATCH] Export mca_op to user space tools
Thanks for review.
Attached is the updated patch. I tried it on IA64 and it works.
I switch the changes to xc_misc.c, but I'm not sure if that's the right 
posotion, any comments are welcome.

--jyh

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@xxxxxxxxx>

--- a/tools/libxc/xc_misc.c     Mon Feb 01 20:38:33 2010 +0800
+++ b/tools/libxc/xc_misc.c     Mon Feb 01 20:43:15 2010 +0800
@@ -95,6 +95,27 @@ int xc_sched_id(int xc_handle,
 
     return 0;
 }
+
+#if defined(__i386__) || defined(__x86_64__)
+int xc_mca_op(int xc_handle, struct xen_mc *mc)
+{
+    int ret = 0;
+    DECLARE_HYPERCALL;
+
+    mc->interface_version = XEN_MCA_INTERFACE_VERSION;
+    if ( lock_pages(mc, sizeof(mc)) )
+    {
+        PERROR("Could not lock xen_mc memory\n");
+        return -EINVAL;
+    }
+
+    hypercall.op = __HYPERVISOR_mca;
+    hypercall.arg[0] = (unsigned long)mc;
+    ret = do_xen_hypercall(xc_handle, &hypercall);
+    unlock_pages(mc, sizeof(mc));
+    return ret;
+}
+#endif
 
 int xc_perfc_control(int xc_handle,
                      uint32_t opcode,
--- a/tools/libxc/xenctrl.h     Mon Feb 01 20:38:33 2010 +0800
+++ b/tools/libxc/xenctrl.h     Mon Feb 01 20:43:33 2010 +0800
@@ -37,6 +37,7 @@
 #if defined(__i386__) || defined(__x86_64__)
 #include <xen/foreign/x86_32.h>
 #include <xen/foreign/x86_64.h>
+#include <xen/arch-x86/xen-mca.h>
 #endif
 
 #ifdef __ia64__
@@ -1207,6 +1208,7 @@ int xc_cpuid_apply_policy(int xc,
                           domid_t domid);
 void xc_cpuid_to_str(const unsigned int *regs,
                      char **strs);
+int xc_mca_op(int xc_handle, struct xen_mc *mc);
 #endif
 
 struct xc_px_val {


>-----Original Message-----
>From: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
>[mailto:xen-devel-bounces@xxxxxxxxxxxxxxxxxxx] On Behalf Of Keir Fraser
>Sent: Monday, February 01, 2010 10:09 PM
>To: Jiang, Yunhong
>Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
>Subject: [Xen-devel] Re: [PATCH] Export mca_op to user space tools
>
>On 01/02/2010 09:36, "Jiang, Yunhong" <yunhong.jiang@xxxxxxxxx> wrote:
>
>> 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@xxxxxxxxx>
>
>This is bound to break the ia64 build. xc_mca_op() refers to 'struct xen_mc'
>which is only defined in an x86-specific header which is only included by
>xenctrl.h for x86 builds.
>
> -- Keir
>
>
>
>_______________________________________________
>Xen-devel mailing list
>Xen-devel@xxxxxxxxxxxxxxxxxxx
>http://lists.xensource.com/xen-devel

Attachment: export_mca.patch
Description: export_mca.patch

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>