[Xen-ia64-devel] [PATCH]minios: reworking and clean up

2008-11-17 Thread Dietmar Hahn
Hi,

I did some reworking of mini-os code to get it compile fine again.
Further needed is the patch discussed last weak with Samuel Thibault on the 
list.
The attached patch cleans up the hypervisor calls.
Thanks.

Dietmar.
# HG changeset patch
# User [EMAIL PROTECTED]
# Date 1226909985 -3600
# Node ID bc50b227afe354b9550e80f2ce1a496268701c0d
# Parent  9bc00e9716cd8c7d3fe0ffd71b28d3235fc125ac
Clean up the hypervisor interface - move all hypervisor calls to xencomm

Signed-off-by: Dietmar Hahn [EMAIL PROTECTED]

diff -r 9bc00e9716cd -r bc50b227afe3 extras/mini-os/arch/ia64/xencomm.c
--- a/extras/mini-os/arch/ia64/xencomm.c	Fri Nov 07 19:34:59 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 9bc00e9716cd -r bc50b227afe3 extras/mini-os/include/ia64/hypercall-ia64.h
--- a/extras/mini-os/include/ia64/hypercall-ia64.h	Fri Nov 07 19:34:59 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 

[Xen-ia64-devel] [PATCH]minios: Fixed ctor and dtor linker warning

2008-11-17 Thread Dietmar Hahn
Hi,

the atteched patch fixes linker warnings.
Thanks.

Dietmar.
# HG changeset patch
# User [EMAIL PROTECTED]
# Date 1226910422 -3600
# Node ID 43f8fa6c7fd99b26c0c6ec9b237f2d98a774fc1d
# Parent  9bc00e9716cd8c7d3fe0ffd71b28d3235fc125ac
Fix ctor and dtor sections.

Signed-off-by: Dietmar Hahn [EMAIL PROTECTED]

diff -r 9bc00e9716cd -r 43f8fa6c7fd9 extras/mini-os/arch/ia64/minios-ia64.lds
--- a/extras/mini-os/arch/ia64/minios-ia64.lds	Fri Nov 07 19:34:59 2008 +0900
+++ b/extras/mini-os/arch/ia64/minios-ia64.lds	Mon Nov 17 09:27:02 2008 +0100
@@ -52,7 +52,8 @@ SECTIONS
   .fini_array : { *(.fini_array) }
   PROVIDE (__fini_array_end = .);
 
-  .ctors : {
+  .ctors : AT(ADDR(.ctors) - (((5(61))+0x1) - (1  20)))
+	{
 __CTOR_LIST__ = .;
 QUAD((__CTOR_END__ - __CTOR_LIST__) / 8 - 2)
 *(.ctors)
@@ -61,7 +62,8 @@ SECTIONS
 __CTOR_END__ = .;
 }
 
-  .dtors : {
+  .dtors : AT(ADDR(.dtors) - (((5(61))+0x1) - (1  20)))
+{
 __DTOR_LIST__ = .;
 QUAD((__DTOR_END__ - __DTOR_LIST__) / 8 - 2)
 *(.dtors)
___
Xen-ia64-devel mailing list
Xen-ia64-devel@lists.xensource.com
http://lists.xensource.com/xen-ia64-devel

Re: [Xen-ia64-devel] [PATCH] Fix a bug for XEN_VIRT_UC_BIT use.

2008-11-17 Thread Isaku Yamahata
applied, thanks.

On Mon, Nov 17, 2008 at 11:20:49AM +0800, Zhang, Xiantao wrote:
 Fix a bug for XEN_VIRT_UC_BIT use.
 
 Signed-off-by : Zhang Xiantao [EMAIL PROTECTED]
 
 diff -r 9bc00e9716cd xen/arch/ia64/vmx/vmx_ivt.S
 --- a/xen/arch/ia64/vmx/vmx_ivt.S Fri Nov 07 19:34:59 2008 +0900
 +++ b/xen/arch/ia64/vmx/vmx_ivt.S Mon Nov 17 11:12:58 2008 +0800
 @@ -314,7 +314,7 @@ vmx_alt_itlb_miss_vmm:
  movl r19=(((1  IA64_MAX_PHYS_BITS) - 1)  ~0xfff)
  ;;
  and r19=r19,r16 // clear ed, reserved bits, and PTE control bits
 -extr.u r18=r16,XEN_VIRT_UC_BIT, 15// extract UC bit
 +extr.u r18=r16,XEN_VIRT_UC_BIT, 1// extract UC bit
  ;;
  or r19=r17,r19  // insert PTE control bits into r19
  mov r20=IA64_GRANULE_SHIFT2

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

-- 
yamahata

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


Re: [Xen-ia64-devel] [PATCH]minios: reworking and clean up

2008-11-17 Thread Isaku Yamahata
Applied, thanks.

On Mon, Nov 17, 2008 at 10:00:15AM +0100, Dietmar Hahn wrote:
 Hi,
 
 I did some reworking of mini-os code to get it compile fine again.
 Further needed is the patch discussed last weak with Samuel Thibault on the 
 list.
 The attached patch cleans up the hypervisor calls.
 Thanks.
 
 Dietmar.

 # HG changeset patch
 # User [EMAIL PROTECTED]
 # Date 1226909985 -3600
 # Node ID bc50b227afe354b9550e80f2ce1a496268701c0d
 # Parent  9bc00e9716cd8c7d3fe0ffd71b28d3235fc125ac
 Clean up the hypervisor interface - move all hypervisor calls to xencomm
 
 Signed-off-by: Dietmar Hahn [EMAIL PROTECTED]
 
 diff -r 9bc00e9716cd -r bc50b227afe3 extras/mini-os/arch/ia64/xencomm.c
 --- a/extras/mini-os/arch/ia64/xencomm.c  Fri Nov 07 19:34:59 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 9bc00e9716cd -r bc50b227afe3 
 extras/mini-os/include/ia64/hypercall-ia64.h
 --- a/extras/mini-os/include/ia64/hypercall-ia64.hFri Nov 

Re: [Xen-ia64-devel] [PATCH]minios: Fixed ctor and dtor linker warning

2008-11-17 Thread Isaku Yamahata
Applied, thanks.

On Mon, Nov 17, 2008 at 10:07:00AM +0100, Dietmar Hahn wrote:
 Hi,
 
 the atteched patch fixes linker warnings.
 Thanks.
 
 Dietmar.

 # HG changeset patch
 # User [EMAIL PROTECTED]
 # Date 1226910422 -3600
 # Node ID 43f8fa6c7fd99b26c0c6ec9b237f2d98a774fc1d
 # Parent  9bc00e9716cd8c7d3fe0ffd71b28d3235fc125ac
 Fix ctor and dtor sections.
 
 Signed-off-by: Dietmar Hahn [EMAIL PROTECTED]
 
 diff -r 9bc00e9716cd -r 43f8fa6c7fd9 extras/mini-os/arch/ia64/minios-ia64.lds
 --- a/extras/mini-os/arch/ia64/minios-ia64.ldsFri Nov 07 19:34:59 
 2008 +0900
 +++ b/extras/mini-os/arch/ia64/minios-ia64.ldsMon Nov 17 09:27:02 
 2008 +0100
 @@ -52,7 +52,8 @@ SECTIONS
.fini_array : { *(.fini_array) }
PROVIDE (__fini_array_end = .);
  
 -  .ctors : {
 +  .ctors : AT(ADDR(.ctors) - (((5(61))+0x1) - (1  20)))
 + {
  __CTOR_LIST__ = .;
  QUAD((__CTOR_END__ - __CTOR_LIST__) / 8 - 2)
  *(.ctors)
 @@ -61,7 +62,8 @@ SECTIONS
  __CTOR_END__ = .;
  }
  
 -  .dtors : {
 +  .dtors : AT(ADDR(.dtors) - (((5(61))+0x1) - (1  20)))
 +{
  __DTOR_LIST__ = .;
  QUAD((__DTOR_END__ - __DTOR_LIST__) / 8 - 2)
  *(.dtors)

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

-- 
yamahata

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