# HG changeset patch # User yamahata@xxxxxxxxxxxxx # Node ID 34bd8163edb2d866d79fff47294643a401a35113 # Parent c6fdb5202a674778a11cea6b2859ea27881ad9d2 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. PATCHNAME: xenmem_reservation_op_work_around_linux Signed-off-by: Isaku Yamahata diff -r c6fdb5202a67 -r 34bd8163edb2 linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c --- a/linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c Mon May 8 11:42:41 2006 +0900 +++ b/linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c Mon May 8 11:42:42 2006 +0900 @@ -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 c6fdb5202a67 -r 34bd8163edb2 linux-2.6-xen-sparse/include/asm-ia64/hypercall.h --- a/linux-2.6-xen-sparse/include/asm-ia64/hypercall.h Mon May 8 11:42:41 2006 +0900 +++ b/linux-2.6-xen-sparse/include/asm-ia64/hypercall.h Mon May 8 11:42:42 2006 +0900 @@ -193,12 +193,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 +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(