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

[Xen-changelog] [IA64] linux: XENMEM op work around



# HG changeset patch
# User awilliam@xxxxxxxxxxx
# Node ID 873a3451a81ab3462e424ffc2fb9449bcc9c5cf1
# Parent  5f0bdd0ef9dc97464eccf224a185202292159145
[IA64] linux: XENMEM op work around

xen/ia64 XENMEM_increase_reservation, XENMEM_decrease_reservation,
XENMEM_populate_reservation are broken.
work around for it.
This patch should be removed after those hypercalls are fixed.

Signed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
---
 linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c   |   37 ++++++++++++++++++++++
 linux-2.6-xen-sparse/include/asm-ia64/hypercall.h |   30 +++++++++++++++++
 2 files changed, 67 insertions(+)

diff -r 5f0bdd0ef9dc -r 873a3451a81a 
linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c
--- a/linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c   Tue May 09 11:46:00 
2006 -0600
+++ b/linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c   Tue May 09 11:47:15 
2006 -0600
@@ -35,6 +35,43 @@
 #define balloon_unlock(flags)  ((void)flags)
 #endif
 
+//XXX xen/ia64 copy_from_guest() is broken.
+//    This is a temporal work around until it is fixed.
+//    used by balloon.c netfront.c
+int
+ia64_xenmem_reservation_op(unsigned long op,
+                          struct xen_memory_reservation* reservation__)
+{
+       struct xen_memory_reservation reservation = *reservation__;
+       unsigned long* frame_list = reservation__->extent_start;
+       unsigned long nr_extents = reservation__->nr_extents;
+       int ret = 0;
+
+       BUG_ON(op != XENMEM_increase_reservation &&
+              op != XENMEM_decrease_reservation &&
+              op != XENMEM_populate_physmap);
+
+       while (nr_extents > 0) {
+               int tmp_ret;
+               volatile unsigned long dummy;
+
+               reservation.extent_start = frame_list;
+               reservation.nr_extents = nr_extents;
+
+               dummy = frame_list[0];// re-install tlb entry before hypercall
+               tmp_ret = ____HYPERVISOR_memory_op(op, &reservation);
+               if (tmp_ret < 0) {
+                       if (ret == 0) {
+                               ret = tmp_ret;
+                       }
+                       break;
+               }
+               frame_list += tmp_ret;
+               nr_extents -= tmp_ret;
+               ret += tmp_ret;
+       }
+       return ret;
+}
 
 //XXX same as i386, x86_64 contiguous_bitmap_set(), contiguous_bitmap_clear()
 // move those to lib/contiguous_bitmap?
diff -r 5f0bdd0ef9dc -r 873a3451a81a 
linux-2.6-xen-sparse/include/asm-ia64/hypercall.h
--- a/linux-2.6-xen-sparse/include/asm-ia64/hypercall.h Tue May 09 11:46:00 
2006 -0600
+++ b/linux-2.6-xen-sparse/include/asm-ia64/hypercall.h Tue May 09 11:47:15 
2006 -0600
@@ -195,12 +195,42 @@ HYPERVISOR_multicall(
     return _hypercall2(int, multicall, call_list, nr_calls);
 }
 
+#ifndef CONFIG_XEN_IA64_DOM0_VP
 static inline int
 HYPERVISOR_memory_op(
     unsigned int cmd, void *arg)
 {
     return _hypercall2(int, memory_op, cmd, arg);
 }
+#else
+//XXX xen/ia64 copy_from_guest() is broken.
+//    This is a temporal work around until it is fixed.
+static inline int
+____HYPERVISOR_memory_op(
+    unsigned int cmd, void *arg)
+{
+    return _hypercall2(int, memory_op, cmd, arg);
+}
+
+#include <xen/interface/memory.h>
+int ia64_xenmem_reservation_op(unsigned long op,
+                  struct xen_memory_reservation* reservation__);
+static inline int
+HYPERVISOR_memory_op(
+    unsigned int cmd, void *arg)
+{
+    switch (cmd) {
+    case XENMEM_increase_reservation:
+    case XENMEM_decrease_reservation:
+    case XENMEM_populate_physmap:
+        return ia64_xenmem_reservation_op(cmd, 
+                                          (struct xen_memory_reservation*)arg);
+    default:
+        return ____HYPERVISOR_memory_op(cmd, arg);
+    }
+    /* NOTREACHED */
+}
+#endif
 
 static inline int
 HYPERVISOR_event_channel_op(

_______________________________________________
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®.