xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Export mca_op to user space tools
@ 2010-02-01  9:36 Jiang, Yunhong
  2010-02-01 14:09 ` Keir Fraser
  0 siblings, 1 reply; 3+ messages in thread
From: Jiang, Yunhong @ 2010-02-01  9:36 UTC (permalink / raw)
  To: Keir Fraser; +Cc: xen-devel@lists.xensource.com

[-- Attachment #1: Type: text/plain, Size: 1606 bytes --]

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>

--- a/tools/libxc/xc_private.c	Sun Jan 31 20:25:54 2010 +0800
+++ b/tools/libxc/xc_private.c	Sun Jan 31 20:30:25 2010 +0800
@@ -242,6 +242,25 @@ void hcall_buf_release(void **addr, size
 }
 
 #endif
+
+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;
+}
 
 /* NB: arr must be locked */
 int xc_get_pfn_type_batch(int xc_handle, uint32_t dom,
--- a/tools/libxc/xenctrl.h	Sun Jan 31 20:25:54 2010 +0800
+++ b/tools/libxc/xenctrl.h	Sun Jan 31 20:26:01 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__
@@ -799,6 +800,7 @@ long xc_get_max_pages(int xc_handle, uin
 
 int xc_mmuext_op(int xc_handle, struct mmuext_op *op, unsigned int nr_ops,
                  domid_t dom);
+int xc_mca_op(int xc_handle, struct xen_mc *mc);
 
 int xc_memory_op(int xc_handle, int cmd, void *arg);
 



[-- Attachment #2: export_mcaop.patch --]
[-- Type: application/octet-stream, Size: 1550 bytes --]

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>

--- a/tools/libxc/xc_private.c	Sun Jan 31 20:25:54 2010 +0800
+++ b/tools/libxc/xc_private.c	Sun Jan 31 20:30:25 2010 +0800
@@ -242,6 +242,25 @@ void hcall_buf_release(void **addr, size
 }
 
 #endif
+
+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;
+}
 
 /* NB: arr must be locked */
 int xc_get_pfn_type_batch(int xc_handle, uint32_t dom,
--- a/tools/libxc/xenctrl.h	Sun Jan 31 20:25:54 2010 +0800
+++ b/tools/libxc/xenctrl.h	Sun Jan 31 20:26:01 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__
@@ -799,6 +800,7 @@ long xc_get_max_pages(int xc_handle, uin
 
 int xc_mmuext_op(int xc_handle, struct mmuext_op *op, unsigned int nr_ops,
                  domid_t dom);
+int xc_mca_op(int xc_handle, struct xen_mc *mc);
 
 int xc_memory_op(int xc_handle, int cmd, void *arg);
 

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Export mca_op to user space tools
  2010-02-01  9:36 [PATCH] Export mca_op to user space tools Jiang, Yunhong
@ 2010-02-01 14:09 ` Keir Fraser
  2010-02-02  6:41   ` Jiang, Yunhong
  0 siblings, 1 reply; 3+ messages in thread
From: Keir Fraser @ 2010-02-01 14:09 UTC (permalink / raw)
  To: Jiang, Yunhong; +Cc: xen-devel@lists.xensource.com

On 01/02/2010 09:36, "Jiang, Yunhong" <yunhong.jiang@intel.com> 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@intel.com>

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH] Export mca_op to user space tools
  2010-02-01 14:09 ` Keir Fraser
@ 2010-02-02  6:41   ` Jiang, Yunhong
  0 siblings, 0 replies; 3+ messages in thread
From: Jiang, Yunhong @ 2010-02-02  6:41 UTC (permalink / raw)
  To: Keir Fraser; +Cc: xen-devel@lists.xensource.com

[-- Attachment #1: Type: text/plain, Size: 2804 bytes --]

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@intel.com>

--- 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@lists.xensource.com
>[mailto:xen-devel-bounces@lists.xensource.com] On Behalf Of Keir Fraser
>Sent: Monday, February 01, 2010 10:09 PM
>To: Jiang, Yunhong
>Cc: xen-devel@lists.xensource.com
>Subject: [Xen-devel] Re: [PATCH] Export mca_op to user space tools
>
>On 01/02/2010 09:36, "Jiang, Yunhong" <yunhong.jiang@intel.com> 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@intel.com>
>
>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@lists.xensource.com
>http://lists.xensource.com/xen-devel

[-- Attachment #2: export_mca.patch --]
[-- Type: application/octet-stream, Size: 1567 bytes --]

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>

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

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-02-02  6:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-01  9:36 [PATCH] Export mca_op to user space tools Jiang, Yunhong
2010-02-01 14:09 ` Keir Fraser
2010-02-02  6:41   ` Jiang, Yunhong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).