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] [IA64] Add do_callback_ops

# HG changeset patch
# User awilliam@xxxxxxxxxxx
# Node ID d8659e39ff3cc8c147d6a5c2a13f7759a2ece27d
# Parent  23fe235cb6d3b3ff75b41608a40ceb0a96c6bd44
[IA64] Add do_callback_ops

Signed-off-by Kevin Tian <kevin.tian@xxxxxxxxx>
---
 linux-2.6-xen-sparse/include/asm-ia64/hypercall.h |   13 +++
 xen/arch/ia64/xen/hypercall.c                     |   84 ++++++++++++++++++++--
 xen/include/asm-ia64/domain.h                     |    2 
 xen/include/public/arch-ia64.h                    |    2 
 4 files changed, 94 insertions(+), 7 deletions(-)

diff -r 23fe235cb6d3 -r d8659e39ff3c 
linux-2.6-xen-sparse/include/asm-ia64/hypercall.h
--- a/linux-2.6-xen-sparse/include/asm-ia64/hypercall.h Tue May 23 08:18:48 
2006 -0600
+++ b/linux-2.6-xen-sparse/include/asm-ia64/hypercall.h Tue May 23 08:24:09 
2006 -0600
@@ -313,9 +313,20 @@ HYPERVISOR_suspend(
        return rc;
 }
 
+static inline int
+HYPERVISOR_callback_op(
+       int cmd, void *arg)
+{
+       return _hypercall2(int, callback_op, cmd, arg);
+}
+
 extern fastcall unsigned int __do_IRQ(unsigned int irq, struct pt_regs *regs);
 static inline void exit_idle(void) {}
-#define do_IRQ(irq, regs) __do_IRQ((irq), (regs))
+#define do_IRQ(irq, regs) ({                   \
+       irq_enter();                            \
+       __do_IRQ((irq), (regs));                \
+       irq_exit();                             \
+})
 
 #ifdef CONFIG_XEN_IA64_DOM0_VP
 #include <linux/err.h>
diff -r 23fe235cb6d3 -r d8659e39ff3c xen/arch/ia64/xen/hypercall.c
--- a/xen/arch/ia64/xen/hypercall.c     Tue May 23 08:18:48 2006 -0600
+++ b/xen/arch/ia64/xen/hypercall.c     Tue May 23 08:24:09 2006 -0600
@@ -25,9 +25,12 @@
 #include <asm/hw_irq.h>
 #include <public/physdev.h>
 #include <xen/domain.h>
+#include <public/callback.h>
+#include <xen/event.h>
 
 static long do_physdev_op_compat(XEN_GUEST_HANDLE(physdev_op_t) uop);
 static long do_physdev_op(int cmd, XEN_GUEST_HANDLE(void) arg);
+static long do_callback_op(int cmd, XEN_GUEST_HANDLE(void) arg);
 /* FIXME: where these declarations should be there ? */
 extern int dump_privop_counts_to_user(char *, int);
 extern int zero_privop_counts_to_user(char *, int);
@@ -67,7 +70,7 @@ hypercall_t ia64_hypercall_table[] =
        (hypercall_t)do_ni_hypercall,           /* do_acm_op */
        (hypercall_t)do_ni_hypercall,           /* do_nmi_op */
        (hypercall_t)do_sched_op,
-       (hypercall_t)do_ni_hypercall,           /*  */                          
/* 30 */
+       (hypercall_t)do_callback_op,            /*  */                  /* 30 */
        (hypercall_t)do_ni_hypercall,           /*  */
        (hypercall_t)do_event_channel_op,
        (hypercall_t)do_physdev_op,
@@ -200,11 +203,8 @@ fw_hypercall (struct pt_regs *regs)
                VCPU(v,pending_interruption) = 1;
 #endif
                if (regs->r28 == PAL_HALT_LIGHT) {
-                       int pi;
-#define SPURIOUS_VECTOR 15
-                       pi = vcpu_check_pending_interrupts(v);
-                       if (pi != SPURIOUS_VECTOR) {
-                               if (!VCPU(v,pending_interruption))
+                       if (vcpu_deliverable_interrupts(v) ||
+                               event_pending(v)) {
                                        idle_when_pending++;
                                vcpu_pend_unspecified_interrupt(v);
 //printf("idle w/int#%d pending!\n",pi);
@@ -435,3 +435,75 @@ long do_event_channel_op_compat(XEN_GUES
 
     return do_event_channel_op(op.cmd, guest_handle_from_ptr(&uop.p->u, void));
 }
+
+static long register_guest_callback(struct callback_register *reg)
+{
+    long ret = 0;
+    struct vcpu *v = current;
+
+    if (IS_VMM_ADDRESS(reg->address))
+        return -EINVAL;
+
+    switch ( reg->type )
+    {
+    case CALLBACKTYPE_event:
+        v->arch.event_callback_ip    = reg->address;
+        break;
+
+    case CALLBACKTYPE_failsafe:
+        v->arch.failsafe_callback_ip = reg->address;
+        break;
+
+    default:
+        ret = -EINVAL;
+        break;
+    }
+
+    return ret;
+}
+
+static long unregister_guest_callback(struct callback_unregister *unreg)
+{
+    return -EINVAL ;
+}
+
+/* First time to add callback to xen/ia64, so let's just stick to
+ * the newer callback interface.
+ */
+static long do_callback_op(int cmd, XEN_GUEST_HANDLE(void) arg)
+{
+    long ret;
+
+    switch ( cmd )
+    {
+    case CALLBACKOP_register:
+    {
+        struct callback_register reg;
+
+        ret = -EFAULT;
+        if ( copy_from_guest(&reg, arg, 1) )
+            break;
+
+        ret = register_guest_callback(&reg);
+    }
+    break;
+
+    case CALLBACKOP_unregister:
+    {
+        struct callback_unregister unreg;
+
+        ret = -EFAULT;
+        if ( copy_from_guest(&unreg, arg, 1) )
+            break;
+
+        ret = unregister_guest_callback(&unreg);
+    }
+    break;
+
+    default:
+        ret = -EINVAL;
+        break;
+    }
+
+    return ret;
+}
diff -r 23fe235cb6d3 -r d8659e39ff3c xen/include/asm-ia64/domain.h
--- a/xen/include/asm-ia64/domain.h     Tue May 23 08:18:48 2006 -0600
+++ b/xen/include/asm-ia64/domain.h     Tue May 23 08:24:09 2006 -0600
@@ -86,6 +86,8 @@ struct arch_vcpu {
        unsigned long xen_itm;
 
     mapped_regs_t *privregs; /* save the state of vcpu */
+    unsigned long event_callback_ip;           // event callback handler
+    unsigned long failsafe_callback_ip;        // Do we need it?
 
     /* These fields are copied from arch_domain to make access easier/faster
        in assembly code.  */
diff -r 23fe235cb6d3 -r d8659e39ff3c xen/include/public/arch-ia64.h
--- a/xen/include/public/arch-ia64.h    Tue May 23 08:18:48 2006 -0600
+++ b/xen/include/public/arch-ia64.h    Tue May 23 08:24:09 2006 -0600
@@ -320,6 +320,8 @@ struct arch_initrd_info {
 };
 typedef struct arch_initrd_info arch_initrd_info_t;
 
+typedef unsigned long xen_callback_t;
+
 #define IA64_COMMAND_LINE_SIZE 512
 struct vcpu_guest_context {
 #define VGCF_FPU_VALID (1<<0)

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [IA64] Add do_callback_ops, Xen patchbot-unstable <=