[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] [IA64] minios: Clean up the hypervisor interface



# HG changeset patch
# User dietmar.hahn@xxxxxxxxxxxxxxxxxxx
# Date 1226909985 -3600
# Node ID 3dfe1a7c729e8821e7ffb9632b170c559b643d5b
# Parent  008b68ff60959e4afa46981995b5ec2ee8caef0e
[IA64] minios: Clean up the hypervisor interface

move all hypervisor calls to xencomm

Signed-off-by: Dietmar Hahn <dietmar.hahn@xxxxxxxxxxxxxxxxxxx>
---
 extras/mini-os/arch/ia64/xencomm.c           |  125 +++++++++++++++++++++++++++
 extras/mini-os/include/ia64/hypercall-ia64.h |  119 +------------------------
 extras/mini-os/include/ia64/os.h             |   15 ---
 3 files changed, 134 insertions(+), 125 deletions(-)

diff -r 008b68ff6095 -r 3dfe1a7c729e extras/mini-os/arch/ia64/xencomm.c
--- a/extras/mini-os/arch/ia64/xencomm.c        Tue Nov 18 10:33:55 2008 +0900
+++ b/extras/mini-os/arch/ia64/xencomm.c        Mon Nov 17 09:19:45 2008 +0100
@@ -24,6 +24,8 @@
 
 
 #include <os.h>
+#include <mini-os/errno.h>
+#include <mini-os/lib.h>
 #include <hypervisor.h>
 #include <xen/xencomm.h>
 #include <xen/grant_table.h>
@@ -38,6 +40,7 @@ struct xencomm_mini
 
 #define xen_guest_handle(hnd)  ((hnd).p)
 
+struct xencomm_handle;
 
 /* Translate virtual address to physical address.  */
 uint64_t
@@ -50,6 +53,16 @@ xencomm_vaddr_to_paddr(uint64_t vaddr)
                return __pa(vaddr);
 
        return 0;
+}
+
+/* Inline version.  To be used only on linear space (kernel space).  */
+static struct xencomm_handle *
+xencomm_create_inline(void *buffer)
+{
+       unsigned long paddr;
+
+       paddr = xencomm_vaddr_to_paddr((unsigned long)buffer);
+       return (struct xencomm_handle *)(paddr | XENCOMM_INLINE_FLAG);
 }
 
 #define min(a,b) (((a) < (b)) ? (a) : (b))
@@ -201,6 +214,14 @@ xencommize_mini_grant_table_op(struct xe
        return rc;
 }
 
+static inline int
+xencomm_arch_hypercall_grant_table_op(unsigned int cmd,
+                                      struct xencomm_handle *uop,
+                                      unsigned int count)
+{
+       return _hypercall3(int, grant_table_op, cmd, uop, count);
+}
+
 int
 xencomm_mini_hypercall_grant_table_op(unsigned int cmd, void *op,
                                       unsigned int count)
@@ -268,3 +289,107 @@ HYPERVISOR_suspend(unsigned long srec)
         return xencomm_arch_hypercall_suspend(xencomm_create_inline(&arg));
 }
 
+int
+HYPERVISOR_event_channel_op(int cmd, void *arg)
+{
+       int rc;
+       struct xencomm_handle *newArg;
+
+       newArg = xencomm_create_inline(arg);
+       rc = _hypercall2(int, event_channel_op, cmd, newArg);
+       if (unlikely(rc == -ENOSYS)) {
+               struct evtchn_op op;
+
+               op.cmd = SWAP(cmd);
+               memcpy(&op.u, arg, sizeof(op.u));
+               rc = _hypercall1(int, event_channel_op_compat, &op);
+       }
+       return rc;
+}
+
+static int
+xencomm_arch_xen_version(int cmd, struct xencomm_handle *arg)
+{
+       return _hypercall2(int, xen_version, cmd, arg);
+}
+
+static int
+xencomm_arch_xen_feature(int cmd, struct xencomm_handle *arg)
+{
+       struct xencomm_handle *newArg;
+
+       newArg = xencomm_create_inline(arg);
+       return _hypercall2(int, xen_version, cmd, newArg);
+}
+
+int
+HYPERVISOR_xen_version(int cmd, void *arg)
+{
+       switch(cmd) {
+               case XENVER_version:
+                       return xencomm_arch_xen_version(cmd, 0);
+               case XENVER_get_features:
+                       return xencomm_arch_xen_feature(cmd, arg);
+               default:
+                       return -1;
+       }
+}
+
+int
+HYPERVISOR_console_io(int cmd, int count, char *str)
+{
+       struct xencomm_handle *newStr;
+
+       newStr = xencomm_create_inline(str);
+       return _hypercall3(int, console_io, cmd, count, newStr);
+}
+
+int
+HYPERVISOR_sched_op_compat(int cmd, unsigned long arg)
+{
+       return _hypercall2(int, sched_op_compat, cmd, arg);
+}
+
+int
+HYPERVISOR_sched_op(int cmd, void *arg)
+{
+       struct xencomm_handle *newArg;
+
+       newArg = xencomm_create_inline(arg);
+       return _hypercall2(int, sched_op, cmd, newArg);
+}
+
+int
+HYPERVISOR_callback_op(int cmd, void *arg)
+{
+       struct xencomm_handle *newArg;
+
+       newArg = xencomm_create_inline(arg);
+       return _hypercall2(int, callback_op, cmd, newArg);
+}
+
+int
+HYPERVISOR_opt_feature(void *arg)
+{
+       struct xencomm_handle *new_arg;
+
+       new_arg = xencomm_create_inline(arg);
+
+       return _hypercall1(int, opt_feature, new_arg);
+}
+
+int
+HYPERVISOR_shutdown(unsigned int reason)
+{
+       struct sched_shutdown sched_shutdown = {
+               .reason = reason
+       };
+
+       int rc = HYPERVISOR_sched_op(SCHEDOP_shutdown, &sched_shutdown);
+
+       if (rc == -ENOSYS)
+               rc = HYPERVISOR_sched_op_compat(SCHEDOP_shutdown, reason);
+
+       return rc;
+}
+
diff -r 008b68ff6095 -r 3dfe1a7c729e 
extras/mini-os/include/ia64/hypercall-ia64.h
--- a/extras/mini-os/include/ia64/hypercall-ia64.h      Tue Nov 18 10:33:55 
2008 +0900
+++ b/extras/mini-os/include/ia64/hypercall-ia64.h      Mon Nov 17 09:19:45 
2008 +0100
@@ -34,8 +34,6 @@
 #ifndef __HYPERCALL_H__
 #define __HYPERCALL_H__
 
-#include <mini-os/lib.h>       /* memcpy() */
-#include <mini-os/errno.h>     /* ENOSYS() */
 #include <xen/event_channel.h>
 #include <xen/sched.h>
 #include <xen/version.h>
@@ -114,123 +112,24 @@ extern unsigned long __hypercall(unsigne
 })
 
 
-extern unsigned long xencomm_vaddr_to_paddr(unsigned long vaddr);
-struct xencomm_handle;
+int HYPERVISOR_event_channel_op(int cmd, void *arg);
 
-/* Inline version.  To be used only on linear space (kernel space).  */
-static inline struct xencomm_handle *
-xencomm_create_inline(void *buffer)
-{
-       unsigned long paddr;
+int HYPERVISOR_xen_version(int cmd, void *arg);
 
-       paddr = xencomm_vaddr_to_paddr((unsigned long)buffer);
-       return (struct xencomm_handle *)(paddr | XENCOMM_INLINE_FLAG);
-}
+int HYPERVISOR_console_io(int cmd, int count, char *str);
 
-static inline int
-xencomm_arch_event_channel_op(int cmd, void *arg)
-{
-       int rc;
-       struct xencomm_handle *newArg;
+int HYPERVISOR_sched_op_compat(int cmd, unsigned long arg);
 
-       newArg = xencomm_create_inline(arg);
-       rc = _hypercall2(int, event_channel_op, cmd, newArg);
-       if (unlikely(rc == -ENOSYS)) {
-               struct evtchn_op op;
+int HYPERVISOR_sched_op(int cmd, void *arg);
 
-               op.cmd = SWAP(cmd);
-               memcpy(&op.u, arg, sizeof(op.u));
-               rc = _hypercall1(int, event_channel_op_compat, &op);
-       }
-       return rc;
-}
-#define HYPERVISOR_event_channel_op xencomm_arch_event_channel_op
-
-static inline int
-xencomm_arch_xen_version(int cmd, struct xencomm_handle *arg)
-{
-       return _hypercall2(int, xen_version, cmd, arg);
-}
-
-static inline int
-xencomm_arch_xen_feature(int cmd, struct xencomm_handle *arg)
-{
-       struct xencomm_handle *newArg;
-
-       newArg = xencomm_create_inline(arg);
-       return _hypercall2(int, xen_version, cmd, newArg);
-}
-
-static inline int
-HYPERVISOR_xen_version(int cmd, void *arg)
-{
-       switch(cmd) {
-               case XENVER_version:
-                       return xencomm_arch_xen_version(cmd, 0);
-               case XENVER_get_features:
-                       return xencomm_arch_xen_feature(cmd, arg);
-               default:
-                       return -1;
-       }
-}
-
-static inline int
-xencomm_arch_console_io(int cmd, int count, char *str)
-{
-       struct xencomm_handle *newStr;
-
-       newStr = xencomm_create_inline(str);
-       return _hypercall3(int, console_io, cmd, count, newStr);
-}
-
-
-#define HYPERVISOR_console_io xencomm_arch_console_io
-
-static inline int
-HYPERVISOR_sched_op_compat(int cmd, unsigned long arg)
-{
-       return _hypercall2(int, sched_op_compat, cmd, arg);
-}
-
-static inline int
-xencomm_arch_sched_op(int cmd, void *arg)
-{
-       struct xencomm_handle *newArg;
-
-       newArg = xencomm_create_inline(arg);
-       return _hypercall2(int, sched_op, cmd, newArg);
-}
-
-#define HYPERVISOR_sched_op xencomm_arch_sched_op
-
-static inline int
-xencomm_arch_callback_op(int cmd, void *arg)
-{
-       struct xencomm_handle *newArg;
-
-       newArg = xencomm_create_inline(arg);
-       return _hypercall2(int, callback_op, cmd, newArg);
-}
-#define HYPERVISOR_callback_op xencomm_arch_callback_op
-
-static inline int
-xencomm_arch_hypercall_grant_table_op(unsigned int cmd,
-                                      struct xencomm_handle *uop,
-                                      unsigned int count)
-{
-       return _hypercall3(int, grant_table_op, cmd, uop, count);
-}
+int HYPERVISOR_callback_op(int cmd, void *arg);
 
 int HYPERVISOR_grant_table_op(unsigned int cmd, void *uop, unsigned int count);
 
-static inline int
-HYPERVISOR_opt_feature(void *arg)
-{
-       struct xencomm_handle *new_arg;
+int HYPERVISOR_opt_feature(void *arg);
 
-       new_arg = xencomm_create_inline(arg);
+int HYPERVISOR_suspend(unsigned long srec);
 
-       return _hypercall1(int, opt_feature, new_arg);
-}
+int HYPERVISOR_shutdown(unsigned int reason);
 
 #endif /* __HYPERCALL_H__ */
diff -r 008b68ff6095 -r 3dfe1a7c729e extras/mini-os/include/ia64/os.h
--- a/extras/mini-os/include/ia64/os.h  Tue Nov 18 10:33:55 2008 +0900
+++ b/extras/mini-os/include/ia64/os.h  Mon Nov 17 09:19:45 2008 +0100
@@ -192,21 +192,6 @@ __synch_cmpxchg(volatile void *ptr, uint
 
 extern shared_info_t *HYPERVISOR_shared_info;
 
-static inline int
-HYPERVISOR_shutdown(unsigned int reason)
-{
-       struct sched_shutdown sched_shutdown = {
-               .reason = reason
-       };
-
-       int rc = HYPERVISOR_sched_op(SCHEDOP_shutdown, &sched_shutdown);
-
-       if (rc == -ENOSYS)
-               rc = HYPERVISOR_sched_op_compat(SCHEDOP_shutdown, reason);
-
-       return rc;
-}
-
 
 /*
  * This code is from the originally os.h and should be put in a

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.