ia64/xen-unstable

changeset 9979:873a3451a81a

[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@valinux.co.jp>
author awilliam@xenbuild.aw
date Tue May 09 11:47:15 2006 -0600 (2006-05-09)
parents 5f0bdd0ef9dc
children 23694acabb72
files linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c linux-2.6-xen-sparse/include/asm-ia64/hypercall.h
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c	Tue May 09 11:46:00 2006 -0600
     1.2 +++ b/linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c	Tue May 09 11:47:15 2006 -0600
     1.3 @@ -35,6 +35,43 @@
     1.4  #define balloon_unlock(flags)	((void)flags)
     1.5  #endif
     1.6  
     1.7 +//XXX xen/ia64 copy_from_guest() is broken.
     1.8 +//    This is a temporal work around until it is fixed.
     1.9 +//    used by balloon.c netfront.c
    1.10 +int
    1.11 +ia64_xenmem_reservation_op(unsigned long op,
    1.12 +			   struct xen_memory_reservation* reservation__)
    1.13 +{
    1.14 +	struct xen_memory_reservation reservation = *reservation__;
    1.15 +	unsigned long* frame_list = reservation__->extent_start;
    1.16 +	unsigned long nr_extents = reservation__->nr_extents;
    1.17 +	int ret = 0;
    1.18 +
    1.19 +	BUG_ON(op != XENMEM_increase_reservation &&
    1.20 +	       op != XENMEM_decrease_reservation &&
    1.21 +	       op != XENMEM_populate_physmap);
    1.22 +
    1.23 +	while (nr_extents > 0) {
    1.24 +		int tmp_ret;
    1.25 +		volatile unsigned long dummy;
    1.26 +
    1.27 +		reservation.extent_start = frame_list;
    1.28 +		reservation.nr_extents = nr_extents;
    1.29 +
    1.30 +		dummy = frame_list[0];// re-install tlb entry before hypercall
    1.31 +		tmp_ret = ____HYPERVISOR_memory_op(op, &reservation);
    1.32 +		if (tmp_ret < 0) {
    1.33 +			if (ret == 0) {
    1.34 +				ret = tmp_ret;
    1.35 +			}
    1.36 +			break;
    1.37 +		}
    1.38 +		frame_list += tmp_ret;
    1.39 +		nr_extents -= tmp_ret;
    1.40 +		ret += tmp_ret;
    1.41 +	}
    1.42 +	return ret;
    1.43 +}
    1.44  
    1.45  //XXX same as i386, x86_64 contiguous_bitmap_set(), contiguous_bitmap_clear()
    1.46  // move those to lib/contiguous_bitmap?
     2.1 --- a/linux-2.6-xen-sparse/include/asm-ia64/hypercall.h	Tue May 09 11:46:00 2006 -0600
     2.2 +++ b/linux-2.6-xen-sparse/include/asm-ia64/hypercall.h	Tue May 09 11:47:15 2006 -0600
     2.3 @@ -195,12 +195,42 @@ HYPERVISOR_multicall(
     2.4      return _hypercall2(int, multicall, call_list, nr_calls);
     2.5  }
     2.6  
     2.7 +#ifndef CONFIG_XEN_IA64_DOM0_VP
     2.8  static inline int
     2.9  HYPERVISOR_memory_op(
    2.10      unsigned int cmd, void *arg)
    2.11  {
    2.12      return _hypercall2(int, memory_op, cmd, arg);
    2.13  }
    2.14 +#else
    2.15 +//XXX xen/ia64 copy_from_guest() is broken.
    2.16 +//    This is a temporal work around until it is fixed.
    2.17 +static inline int
    2.18 +____HYPERVISOR_memory_op(
    2.19 +    unsigned int cmd, void *arg)
    2.20 +{
    2.21 +    return _hypercall2(int, memory_op, cmd, arg);
    2.22 +}
    2.23 +
    2.24 +#include <xen/interface/memory.h>
    2.25 +int ia64_xenmem_reservation_op(unsigned long op,
    2.26 +		   struct xen_memory_reservation* reservation__);
    2.27 +static inline int
    2.28 +HYPERVISOR_memory_op(
    2.29 +    unsigned int cmd, void *arg)
    2.30 +{
    2.31 +    switch (cmd) {
    2.32 +    case XENMEM_increase_reservation:
    2.33 +    case XENMEM_decrease_reservation:
    2.34 +    case XENMEM_populate_physmap:
    2.35 +        return ia64_xenmem_reservation_op(cmd, 
    2.36 +                                          (struct xen_memory_reservation*)arg);
    2.37 +    default:
    2.38 +        return ____HYPERVISOR_memory_op(cmd, arg);
    2.39 +    }
    2.40 +    /* NOTREACHED */
    2.41 +}
    2.42 +#endif
    2.43  
    2.44  static inline int
    2.45  HYPERVISOR_event_channel_op(