ia64/xen-unstable

changeset 10203:a9d58ef8e4e7

[IA64] Add sal emulation to VTI domain

Signed-off-by Anthony.xu <anthony.xu@intel.com>
author awilliam@xenbuild.aw
date Wed May 31 11:28:03 2006 -0600 (2006-05-31)
parents 380f87e8003f
children 003157eafd66
files xen/arch/ia64/vmx/pal_emul.c xen/arch/ia64/vmx/vmx_process.c xen/include/asm-ia64/vmx_pal.h
line diff
     1.1 --- a/xen/arch/ia64/vmx/pal_emul.c	Wed May 31 11:27:59 2006 -0600
     1.2 +++ b/xen/arch/ia64/vmx/pal_emul.c	Wed May 31 11:28:03 2006 -0600
     1.3 @@ -21,6 +21,7 @@
     1.4  #include <asm/vmx_vcpu.h>
     1.5  #include <asm/pal.h>
     1.6  #include <asm/sal.h>
     1.7 +#include <asm/dom_fw.h>
     1.8  #include <asm/tlb.h>
     1.9  #include <asm/vmx_mm_def.h>
    1.10  
    1.11 @@ -42,7 +43,14 @@ set_pal_result (VCPU *vcpu,struct ia64_p
    1.12  	vcpu_set_gr(vcpu,11, result.v2,0);
    1.13  }
    1.14  
    1.15 +static void
    1.16 +set_sal_result (VCPU *vcpu,struct sal_ret_values result) {
    1.17  
    1.18 +	vcpu_set_gr(vcpu,8, result.r8,0);
    1.19 +	vcpu_set_gr(vcpu,9, result.r9,0);
    1.20 +	vcpu_set_gr(vcpu,10, result.r10,0);
    1.21 +	vcpu_set_gr(vcpu,11, result.r11,0);
    1.22 +}
    1.23  static struct ia64_pal_retval
    1.24  pal_cache_flush (VCPU *vcpu) {
    1.25  	UINT64 gr28,gr29, gr30, gr31;
    1.26 @@ -450,4 +458,12 @@ pal_emul( VCPU *vcpu) {
    1.27  		set_pal_result (vcpu, result);
    1.28  }
    1.29  
    1.30 -
    1.31 +void
    1.32 +sal_emul(VCPU *v) {
    1.33 +	struct sal_ret_values result;
    1.34 +	result = sal_emulator(vcpu_get_gr(v,32),vcpu_get_gr(v,33),
    1.35 +	                      vcpu_get_gr(v,34),vcpu_get_gr(v,35),
    1.36 +	                      vcpu_get_gr(v,36),vcpu_get_gr(v,37),
    1.37 +	                      vcpu_get_gr(v,38),vcpu_get_gr(v,39));
    1.38 +	set_sal_result(v, result);	
    1.39 +}
     2.1 --- a/xen/arch/ia64/vmx/vmx_process.c	Wed May 31 11:27:59 2006 -0600
     2.2 +++ b/xen/arch/ia64/vmx/vmx_process.c	Wed May 31 11:28:03 2006 -0600
     2.3 @@ -64,6 +64,7 @@ extern void itlb_fault (VCPU *vcpu, u64 
     2.4  extern void ivhpt_fault (VCPU *vcpu, u64 vadr);
     2.5  
     2.6  #define DOMN_PAL_REQUEST    0x110000
     2.7 +#define DOMN_SAL_REQUEST    0x110001
     2.8  
     2.9  static UINT64 vec2off[68] = {0x0,0x400,0x800,0xc00,0x1000, 0x1400,0x1800,
    2.10      0x1c00,0x2000,0x2400,0x2800,0x2c00,0x3000,0x3400,0x3800,0x3c00,0x4000,
    2.11 @@ -96,85 +97,6 @@ void vmx_reflect_interruption(UINT64 ifa
    2.12      inject_guest_interruption(vcpu, vector);
    2.13  }
    2.14  
    2.15 -static void
    2.16 -vmx_handle_hypercall (VCPU *v, REGS *regs)
    2.17 -{
    2.18 -    struct ia64_pal_retval y;
    2.19 -    struct sal_ret_values x;
    2.20 -    unsigned long i, sal_param[8];
    2.21 -
    2.22 -    switch (regs->r2) {
    2.23 -        case FW_HYPERCALL_PAL_CALL:
    2.24 -            //printf("*** PAL hypercall: index=%d\n",regs->r28);
    2.25 -            //FIXME: This should call a C routine
    2.26 -            y = pal_emulator_static(VCPU(v, vgr[12]));
    2.27 -            regs->r8 = y.status; regs->r9 = y.v0;
    2.28 -            regs->r10 = y.v1; regs->r11 = y.v2;
    2.29 -#if 0
    2.30 -            if (regs->r8)
    2.31 -                printk("Failed vpal emulation, with index:0x%lx\n",
    2.32 -                       VCPU(v, vgr[12]));
    2.33 -#endif
    2.34 -            break;
    2.35 -        case FW_HYPERCALL_SAL_CALL:
    2.36 -            for (i = 0; i < 8; i++)
    2.37 -                vcpu_get_gr_nat(v, 32+i, &sal_param[i]);
    2.38 -            x = sal_emulator(sal_param[0], sal_param[1],
    2.39 -                             sal_param[2], sal_param[3],
    2.40 -                             sal_param[4], sal_param[5],
    2.41 -                             sal_param[6], sal_param[7]);
    2.42 -            regs->r8 = x.r8; regs->r9 = x.r9;
    2.43 -            regs->r10 = x.r10; regs->r11 = x.r11;
    2.44 -#if 0
    2.45 -            if (regs->r8)
    2.46 -                printk("Failed vsal emulation, with index:0x%lx\n",
    2.47 -                       sal_param[0]);
    2.48 -#endif
    2.49 -            break;
    2.50 -        case FW_HYPERCALL_EFI_RESET_SYSTEM:
    2.51 -            printf("efi.reset_system called ");
    2.52 -            if (current->domain == dom0) {
    2.53 -                printf("(by dom0)\n ");
    2.54 -                (*efi.reset_system)(EFI_RESET_WARM,0,0,NULL);
    2.55 -            }
    2.56 -            printf("(not supported for non-0 domain)\n");
    2.57 -            regs->r8 = EFI_UNSUPPORTED;
    2.58 -            break;
    2.59 -        case FW_HYPERCALL_EFI_GET_TIME:
    2.60 -            {
    2.61 -                unsigned long *tv, *tc;
    2.62 -                vcpu_get_gr_nat(v, 32, (u64 *)&tv);
    2.63 -                vcpu_get_gr_nat(v, 33, (u64 *)&tc);
    2.64 -                printf("efi_get_time(%p,%p) called...",tv,tc);
    2.65 -                tv = __va(translate_domain_mpaddr((unsigned long)tv));
    2.66 -                if (tc) tc = __va(translate_domain_mpaddr((unsigned long)tc));
    2.67 -                regs->r8 = (*efi.get_time)((efi_time_t *)tv,(efi_time_cap_t *)tc);
    2.68 -                printf("and returns %lx\n",regs->r8);
    2.69 -            }
    2.70 -            break;
    2.71 -        case FW_HYPERCALL_EFI_SET_TIME:
    2.72 -        case FW_HYPERCALL_EFI_GET_WAKEUP_TIME:
    2.73 -        case FW_HYPERCALL_EFI_SET_WAKEUP_TIME:
    2.74 -            // FIXME: need fixes in efi.h from 2.6.9
    2.75 -        case FW_HYPERCALL_EFI_SET_VIRTUAL_ADDRESS_MAP:
    2.76 -            // FIXME: WARNING!! IF THIS EVER GETS IMPLEMENTED
    2.77 -            // SOME OF THE OTHER EFI EMULATIONS WILL CHANGE AS
    2.78 -            // POINTER ARGUMENTS WILL BE VIRTUAL!!
    2.79 -        case FW_HYPERCALL_EFI_GET_VARIABLE:
    2.80 -            // FIXME: need fixes in efi.h from 2.6.9
    2.81 -        case FW_HYPERCALL_EFI_GET_NEXT_VARIABLE:
    2.82 -        case FW_HYPERCALL_EFI_SET_VARIABLE:
    2.83 -        case FW_HYPERCALL_EFI_GET_NEXT_HIGH_MONO_COUNT:
    2.84 -            // FIXME: need fixes in efi.h from 2.6.9
    2.85 -            regs->r8 = EFI_UNSUPPORTED;
    2.86 -            break;
    2.87 -    }
    2.88 -#if 0
    2.89 -    if (regs->r8)
    2.90 -        printk("Failed vgfw emulation, with index:0x%lx\n",
    2.91 -               regs->r2);
    2.92 -#endif
    2.93 -}
    2.94  
    2.95  IA64FAULT
    2.96  vmx_ia64_handle_break (unsigned long ifa, struct pt_regs *regs, unsigned long isr, unsigned long iim)
    2.97 @@ -197,13 +119,17 @@ vmx_ia64_handle_break (unsigned long ifa
    2.98          if (!user_mode(regs)) {
    2.99              /* Allow hypercalls only when cpl = 0.  */
   2.100              if (iim == d->arch.breakimm) {
   2.101 -                vmx_handle_hypercall (v ,regs);
   2.102 -                vmx_vcpu_increment_iip(current);
   2.103 +                ia64_hypercall(regs);
   2.104 +                vmx_vcpu_increment_iip(v);
   2.105                  return IA64_NO_FAULT;
   2.106              }
   2.107              else if(iim == DOMN_PAL_REQUEST){
   2.108 -                pal_emul(current);
   2.109 -                vmx_vcpu_increment_iip(current);
   2.110 +                pal_emul(v);
   2.111 +                vmx_vcpu_increment_iip(v);
   2.112 +                return IA64_NO_FAULT;
   2.113 +            }else if(iim == DOMN_SAL_REQUEST){
   2.114 +                sal_emul(v);
   2.115 +                vmx_vcpu_increment_iip(v);
   2.116                  return IA64_NO_FAULT;
   2.117              }
   2.118          }
     3.1 --- a/xen/include/asm-ia64/vmx_pal.h	Wed May 31 11:27:59 2006 -0600
     3.2 +++ b/xen/include/asm-ia64/vmx_pal.h	Wed May 31 11:28:03 2006 -0600
     3.3 @@ -115,6 +115,7 @@ ia64_pal_vp_save (u64 *vpd, u64 pal_proc
     3.4  	return iprv.status;
     3.5  }
     3.6  extern void pal_emul(struct vcpu *vcpu);
     3.7 +extern void sal_emul(struct vcpu *vcpu);
     3.8  #define PAL_PROC_VM_BIT		(1UL << 40)
     3.9  #define PAL_PROC_VMSW_BIT	(1UL << 54)
    3.10  #endif /* _ASM_IA64_VT_PAL_H */