ia64/xen-unstable

changeset 5949:b6803bdaa95a

Add hypercall continuation support, or else dom_mem_op may fail.

Signed-off-by Kevin Tian <kevin.tian@intel.com>
author fred@xuni-t01.sc.intel.com
date Tue Aug 02 02:09:24 2005 -0800 (2005-08-02)
parents 7e5868cb1b91
children 7e74ac6fdea9
files xen/arch/ia64/vmx_hypercall.c xen/arch/ia64/xenmisc.c xen/include/asm-ia64/domain.h
line diff
     1.1 --- a/xen/arch/ia64/vmx_hypercall.c	Tue Aug 02 02:08:00 2005 -0800
     1.2 +++ b/xen/arch/ia64/vmx_hypercall.c	Tue Aug 02 02:09:24 2005 -0800
     1.3 @@ -29,6 +29,7 @@
     1.4  #include <asm/regionreg.h>
     1.5  #include <asm/page.h>
     1.6  #include <xen/mm.h>
     1.7 +#include <xen/multicall.h>
     1.8  
     1.9  
    1.10  void hyper_not_support(void)
    1.11 @@ -51,6 +52,42 @@ void hyper_mmu_update(void)
    1.12      vmx_vcpu_increment_iip(vcpu);
    1.13  }
    1.14  
    1.15 +unsigned long __hypercall_create_continuation(
    1.16 +    unsigned int op, unsigned int nr_args, ...)
    1.17 +{
    1.18 +    struct mc_state *mcs = &mc_state[smp_processor_id()];
    1.19 +    VCPU *vcpu = current;
    1.20 +    struct cpu_user_regs *regs = vcpu_regs(vcpu);
    1.21 +    unsigned int i;
    1.22 +    va_list args;
    1.23 +
    1.24 +    va_start(args, nr_args);
    1.25 +    if ( test_bit(_MCSF_in_multicall, &mcs->flags) ) {
    1.26 +	panic("PREEMPT happen in multicall\n");	// Not support yet
    1.27 +    } else {
    1.28 +	vmx_vcpu_set_gr(vcpu, 15, op, 0);
    1.29 +	for ( i = 0; i < nr_args; i++) {
    1.30 +	    switch (i) {
    1.31 +	    case 0: vmx_vcpu_set_gr(vcpu, 16, va_arg(args, unsigned long), 0);
    1.32 +		    break;
    1.33 +	    case 1: vmx_vcpu_set_gr(vcpu, 17, va_arg(args, unsigned long), 0);
    1.34 +		    break;
    1.35 +	    case 2: vmx_vcpu_set_gr(vcpu, 18, va_arg(args, unsigned long), 0);
    1.36 +		    break;
    1.37 +	    case 3: vmx_vcpu_set_gr(vcpu, 19, va_arg(args, unsigned long), 0);
    1.38 +		    break;
    1.39 +	    case 4: vmx_vcpu_set_gr(vcpu, 20, va_arg(args, unsigned long), 0);
    1.40 +		    break;
    1.41 +	    default: panic("Too many args for hypercall continuation\n");
    1.42 +		    break;
    1.43 +	    }
    1.44 +	}
    1.45 +    }
    1.46 +    vcpu->arch.hypercall_continuation = 1;
    1.47 +    va_end(args);
    1.48 +    return op;
    1.49 +}
    1.50 +
    1.51  void hyper_dom_mem_op(void)
    1.52  {
    1.53      VCPU *vcpu=current;
    1.54 @@ -65,7 +102,13 @@ void hyper_dom_mem_op(void)
    1.55      printf("do_dom_mem return value: %lx\n", ret);
    1.56      vmx_vcpu_set_gr(vcpu, 8, ret, 0);
    1.57  
    1.58 -    vmx_vcpu_increment_iip(vcpu);
    1.59 +    /* Hard to define a special return value to indicate hypercall restart.
    1.60 +     * So just add a new mark, which is SMP safe
    1.61 +     */
    1.62 +    if (vcpu->arch.hypercall_continuation == 1)
    1.63 +	vcpu->arch.hypercall_continuation = 0;
    1.64 +    else
    1.65 +	vmx_vcpu_increment_iip(vcpu);
    1.66  }
    1.67  
    1.68  
     2.1 --- a/xen/arch/ia64/xenmisc.c	Tue Aug 02 02:08:00 2005 -0800
     2.2 +++ b/xen/arch/ia64/xenmisc.c	Tue Aug 02 02:09:24 2005 -0800
     2.3 @@ -103,11 +103,13 @@ while(1);
     2.4  }
     2.5  #endif
     2.6  
     2.7 +#ifndef CONFIG_VTI
     2.8  unsigned long __hypercall_create_continuation(
     2.9  	unsigned int op, unsigned int nr_args, ...)
    2.10  {
    2.11  	printf("__hypercall_create_continuation: not implemented!!!\n");
    2.12  }
    2.13 +#endif
    2.14  
    2.15  ///////////////////////////////
    2.16  
     3.1 --- a/xen/include/asm-ia64/domain.h	Tue Aug 02 02:08:00 2005 -0800
     3.2 +++ b/xen/include/asm-ia64/domain.h	Tue Aug 02 02:09:24 2005 -0800
     3.3 @@ -88,6 +88,7 @@ struct arch_vcpu {
     3.4      thash_cb_t *vtlb;
     3.5      char irq_new_pending;
     3.6      char irq_new_condition;    // vpsr.i/vtpr change, check for pending VHPI
     3.7 +    char hypercall_continuation;
     3.8      //for phycial  emulation
     3.9      unsigned long old_rsc;
    3.10      int mode_flags;