ia64/xen-unstable

changeset 10923:b94d43606bcd

[IA64] cleanup the hypercall handling code for VT-i domain

Signed-off-by: Tsunehisa Doi <Doi.Tsunehisa@jp.fujitsu.com>
Signed-off-by: Tomonari Horikoshi <t.horikoshi@jp.fujitsu.com>
Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
author awilliam@xenbuild.aw
date Thu Aug 03 10:38:04 2006 -0600 (2006-08-03)
parents 561df7d9cecc
children 4151d83d0db9
files xen/arch/ia64/vmx/vmx_hypercall.c xen/arch/ia64/vmx/vmx_ivt.S
line diff
     1.1 --- a/xen/arch/ia64/vmx/vmx_hypercall.c	Wed Aug 02 15:09:56 2006 -0600
     1.2 +++ b/xen/arch/ia64/vmx/vmx_hypercall.c	Thu Aug 03 10:38:04 2006 -0600
     1.3 @@ -35,180 +35,4 @@
     1.4  #include <asm/dom_fw.h>
     1.5  #include <xen/domain.h>
     1.6  
     1.7 -extern long do_sched_op_compat(int cmd, unsigned long arg);
     1.8 -
     1.9 -void hyper_not_support(void)
    1.10 -{
    1.11 -    VCPU *vcpu=current;
    1.12 -    vcpu_set_gr(vcpu, 8, -1, 0);
    1.13 -    vmx_vcpu_increment_iip(vcpu);
    1.14 -}
    1.15 -
    1.16 -void hyper_mmu_update(void)
    1.17 -{
    1.18 -    VCPU *vcpu=current;
    1.19 -    u64 r32,r33,r34,r35,ret;
    1.20 -    vcpu_get_gr_nat(vcpu,16,&r32);
    1.21 -    vcpu_get_gr_nat(vcpu,17,&r33);
    1.22 -    vcpu_get_gr_nat(vcpu,18,&r34);
    1.23 -    vcpu_get_gr_nat(vcpu,19,&r35);
    1.24 -    ret=vmx_do_mmu_update((mmu_update_t*)r32,r33,(u64 *)r34,r35);
    1.25 -    vcpu_set_gr(vcpu, 8, ret, 0);
    1.26 -    vmx_vcpu_increment_iip(vcpu);
    1.27 -}
    1.28 -
    1.29 -void hyper_dom_mem_op(void)
    1.30 -{
    1.31 -    VCPU *vcpu=current;
    1.32 -    u64 r32,r33,r34,r35,r36;
    1.33 -    u64 ret;
    1.34 -    vcpu_get_gr_nat(vcpu,16,&r32);
    1.35 -    vcpu_get_gr_nat(vcpu,17,&r33);
    1.36 -    vcpu_get_gr_nat(vcpu,18,&r34);
    1.37 -    vcpu_get_gr_nat(vcpu,19,&r35);
    1.38 -    vcpu_get_gr_nat(vcpu,20,&r36);
    1.39 -//    ret=do_dom_mem_op(r32,(u64 *)r33,r34,r35,r36);
    1.40 -    ret = 0;
    1.41 -    printf("do_dom_mem return value: %lx\n", ret);
    1.42 -    vcpu_set_gr(vcpu, 8, ret, 0);
    1.43 -
    1.44 -    /* Hard to define a special return value to indicate hypercall restart.
    1.45 -     * So just add a new mark, which is SMP safe
    1.46 -     */
    1.47 -    if (vcpu->arch.hypercall_continuation == 1)
    1.48 -	vcpu->arch.hypercall_continuation = 0;
    1.49 -    else
    1.50 -	vmx_vcpu_increment_iip(vcpu);
    1.51 -}
    1.52 -
    1.53 -
    1.54 -void hyper_sched_op_compat(void)
    1.55 -{
    1.56 -    VCPU *vcpu=current;
    1.57 -    u64 r32,r33,ret;
    1.58 -    vcpu_get_gr_nat(vcpu,16,&r32);
    1.59 -    vcpu_get_gr_nat(vcpu,17,&r33);
    1.60 -    ret=do_sched_op_compat(r32,r33);
    1.61 -    vcpu_set_gr(vcpu, 8, ret, 0);
    1.62 -
    1.63 -    vmx_vcpu_increment_iip(vcpu);
    1.64 -}
    1.65 -
    1.66 -void hyper_dom0_op(void)
    1.67 -{
    1.68 -    VCPU *vcpu=current;
    1.69 -    u64 r32,ret;
    1.70 -    vcpu_get_gr_nat(vcpu,16,&r32);
    1.71 -    ret=do_dom0_op(guest_handle_from_ptr(r32, dom0_op_t));
    1.72 -    vcpu_set_gr(vcpu, 8, ret, 0);
    1.73 -
    1.74 -    vmx_vcpu_increment_iip(vcpu);
    1.75 -}
    1.76 -
    1.77 -void hyper_event_channel_op_compat(void)
    1.78 -{
    1.79 -    VCPU *vcpu=current;
    1.80 -    u64 r32,ret;
    1.81 -    vcpu_get_gr_nat(vcpu,16,&r32);
    1.82 -    ret=do_event_channel_op_compat(guest_handle_from_ptr(r32, evtchn_op_t));
    1.83 -    vcpu_set_gr(vcpu, 8, ret, 0);
    1.84 -    vmx_vcpu_increment_iip(vcpu);
    1.85 -}
    1.86 -
    1.87 -void hyper_xen_version(void)
    1.88 -{
    1.89 -    VCPU *vcpu=current;
    1.90 -    u64 r32,r33,ret;
    1.91 -    vcpu_get_gr_nat(vcpu,16,&r32);
    1.92 -    vcpu_get_gr_nat(vcpu,17,&r33);
    1.93 -    ret=do_xen_version((int )r32,guest_handle_from_ptr(r33, void));
    1.94 -    vcpu_set_gr(vcpu, 8, ret, 0);
    1.95 -    vmx_vcpu_increment_iip(vcpu);
    1.96 -}
    1.97 -/*
    1.98 -static int do_lock_page(VCPU *vcpu, u64 va, u64 lock)
    1.99 -{
   1.100 -    ia64_rr rr;
   1.101 -    thash_cb_t *hcb;
   1.102 -    hcb = vmx_vcpu_get_vtlb(vcpu);
   1.103 -    rr = vmx_vcpu_rr(vcpu, va);
   1.104 -    return thash_lock_tc(hcb, va ,1U<<rr.ps, rr.rid, DSIDE_TLB, lock);
   1.105 -}
   1.106 - */
   1.107 -/*
   1.108 - * Lock guest page in vTLB, so that it's not relinquished by recycle
   1.109 - * session when HV is servicing that hypercall.
   1.110 - */
   1.111 -
   1.112 -/*
   1.113 -void hyper_lock_page(void)
   1.114 -{
   1.115 -//TODO:
   1.116 -    VCPU *vcpu=current;
   1.117 -    u64 va,lock, ret;
   1.118 -    vcpu_get_gr_nat(vcpu,16,&va);
   1.119 -    vcpu_get_gr_nat(vcpu,17,&lock);
   1.120 -    ret=do_lock_page(vcpu, va, lock);
   1.121 -    vcpu_set_gr(vcpu, 8, ret, 0);
   1.122 -
   1.123 -    vmx_vcpu_increment_iip(vcpu);
   1.124 -}
   1.125 - */
   1.126 -
   1.127 -static int do_set_shared_page(VCPU *vcpu, u64 gpa)
   1.128 -{
   1.129 -    u64 o_info;
   1.130 -    struct domain *d = vcpu->domain;
   1.131 -    struct vcpu *v;
   1.132 -    struct page_info *page;
   1.133 -    if(vcpu->domain!=dom0)
   1.134 -        return -EPERM;
   1.135 -    o_info = (u64)vcpu->domain->shared_info;
   1.136 - again:
   1.137 -    d->shared_info= (shared_info_t *)domain_mpa_to_imva(vcpu->domain, gpa);
   1.138 -    page = virt_to_page(d->shared_info);
   1.139 -    if (get_page(page, d) == 0)
   1.140 -        goto again;
   1.141 -
   1.142 -    /* Copy existing shared info into new page */
   1.143 -    if (o_info) {
   1.144 -    	memcpy((void*)d->shared_info, (void*)o_info, PAGE_SIZE);
   1.145 -    	for_each_vcpu(d, v) {
   1.146 -	        v->vcpu_info = &d->shared_info->vcpu_info[v->vcpu_id];
   1.147 -    	}
   1.148 -    	/* If original page belongs to xen heap, then relinguish back
   1.149 -    	 * to xen heap. Or else, leave to domain itself to decide.
   1.150 -    	 */
   1.151 -    	if (likely(IS_XEN_HEAP_FRAME(virt_to_page(o_info))))
   1.152 -	    	free_xenheap_page((void *)o_info);
   1.153 -    } else
   1.154 -        memset(d->shared_info, 0, PAGE_SIZE);
   1.155 -    put_page(page);
   1.156 -    return 0;
   1.157 -}
   1.158 -
   1.159 -void hyper_set_shared_page(void)
   1.160 -{
   1.161 -    VCPU *vcpu=current;
   1.162 -    u64 gpa,ret;
   1.163 -    vcpu_get_gr_nat(vcpu,16,&gpa);
   1.164 -
   1.165 -    ret=do_set_shared_page(vcpu, gpa);
   1.166 -    vcpu_set_gr(vcpu, 8, ret, 0);
   1.167 -
   1.168 -    vmx_vcpu_increment_iip(vcpu);
   1.169 -}
   1.170 -
   1.171 -/*
   1.172 -void hyper_grant_table_op(void)
   1.173 -{
   1.174 -    VCPU *vcpu=current;
   1.175 -    u64 r32,r33,r34,ret;
   1.176 -    vcpu_get_gr_nat(vcpu,16,&r32);
   1.177 -    vcpu_get_gr_nat(vcpu,17,&r33);
   1.178 -    vcpu_get_gr_nat(vcpu,18,&r34);
   1.179 -
   1.180 -    ret=do_grant_table_op((unsigned int)r32, (void *)r33, (unsigned int)r34);
   1.181 -    vcpu_set_gr(vcpu, 8, ret, 0);
   1.182 -}
   1.183 -*/
   1.184 +/* This file will include the hypercall code for VT-i domain, soon. */
     2.1 --- a/xen/arch/ia64/vmx/vmx_ivt.S	Wed Aug 02 15:09:56 2006 -0600
     2.2 +++ b/xen/arch/ia64/vmx/vmx_ivt.S	Thu Aug 03 10:38:04 2006 -0600
     2.3 @@ -423,7 +423,6 @@ ENTRY(vmx_break_fault)
     2.4      mov r31=pr
     2.5      mov r19=11
     2.6      mov r30=cr.iim
     2.7 -    movl r29=0x1100
     2.8      ;;
     2.9  #ifdef VTI_DEBUG
    2.10      // break 0 is already handled in vmx_ia64_handle_break.
    2.11 @@ -431,9 +430,7 @@ ENTRY(vmx_break_fault)
    2.12      (p6) br.sptk vmx_fault_11
    2.13      ;;
    2.14  #endif
    2.15 -    cmp.eq  p6,p7=r29,r30
    2.16 -    (p6) br.dptk.few vmx_hypercall_dispatch
    2.17 -    (p7) br.sptk.many vmx_dispatch_break_fault
    2.18 +    br.sptk.many vmx_dispatch_break_fault
    2.19      ;;
    2.20      VMX_FAULT(11);
    2.21  END(vmx_break_fault)
    2.22 @@ -1140,33 +1137,6 @@ ENTRY(vmx_dispatch_break_fault)
    2.23  END(vmx_dispatch_break_fault)
    2.24  
    2.25  
    2.26 -ENTRY(vmx_hypercall_dispatch)
    2.27 -    VMX_SAVE_MIN_WITH_COVER
    2.28 -    ssm psr.ic
    2.29 -    ;;
    2.30 -    srlz.i                  // guarantee that interruption collection is on
    2.31 -    ;;
    2.32 -    (p15) ssm psr.i               // restore psr.i
    2.33 -    adds r3=8,r2                // set up second base pointer
    2.34 -    ;;
    2.35 -    VMX_SAVE_REST
    2.36 -    ;;
    2.37 -    movl r14=ia64_leave_hypervisor
    2.38 -    movl r2=hyper_call_table
    2.39 -    ;;
    2.40 -    mov rp=r14
    2.41 -    shladd r2=r15,3,r2
    2.42 -    ;;
    2.43 -    ld8 r2=[r2]
    2.44 -    ;;
    2.45 -    mov b6=r2
    2.46 -    ;;
    2.47 -    br.call.sptk.many b6=b6
    2.48 -    ;;
    2.49 -END(vmx_hypercall_dispatch)
    2.50 -
    2.51 -
    2.52 -
    2.53  ENTRY(vmx_dispatch_interrupt)
    2.54      VMX_SAVE_MIN_WITH_COVER_R19	// uses r31; defines r2 and r3
    2.55      ;;
    2.56 @@ -1187,39 +1157,3 @@ ENTRY(vmx_dispatch_interrupt)
    2.57      add out1=16,sp		// pass pointer to pt_regs as second arg
    2.58      br.call.sptk.many b6=ia64_handle_irq
    2.59  END(vmx_dispatch_interrupt)
    2.60 -
    2.61 -
    2.62 -
    2.63 -    .rodata
    2.64 -    .align 8
    2.65 -    .globl hyper_call_table
    2.66 -hyper_call_table:
    2.67 -    data8 hyper_not_support     //hyper_set_trap_table     /*  0 */
    2.68 -    data8 hyper_mmu_update
    2.69 -    data8 hyper_not_support     //hyper_set_gdt
    2.70 -    data8 hyper_not_support     //hyper_stack_switch
    2.71 -    data8 hyper_not_support     //hyper_set_callbacks
    2.72 -    data8 hyper_not_support     //hyper_fpu_taskswitch     /*  5 */
    2.73 -    data8 hyper_sched_op_compat
    2.74 -    data8 hyper_dom0_op
    2.75 -    data8 hyper_not_support     //hyper_set_debugreg
    2.76 -    data8 hyper_not_support     //hyper_get_debugreg
    2.77 -    data8 hyper_not_support     //hyper_update_descriptor  /* 10 */
    2.78 -    data8 hyper_not_support     //hyper_set_fast_trap
    2.79 -    data8 hyper_dom_mem_op
    2.80 -    data8 hyper_not_support     //hyper_multicall
    2.81 -    data8 hyper_not_support     //hyper_update_va_mapping
    2.82 -    data8 hyper_not_support     //hyper_set_timer_op       /* 15 */
    2.83 -    data8 hyper_event_channel_op_compat
    2.84 -    data8 hyper_xen_version
    2.85 -    data8 hyper_not_support     //hyper_console_io
    2.86 -    data8 hyper_not_support     //hyper_physdev_op
    2.87 -    data8 hyper_not_support     //hyper_grant_table_op     /* 20 */
    2.88 -    data8 hyper_not_support     //hyper_vm_assist
    2.89 -    data8 hyper_not_support     //hyper_update_va_mapping_otherdomain
    2.90 -    data8 hyper_not_support     //hyper_switch_vm86
    2.91 -    data8 hyper_not_support     //hyper_boot_vcpu
    2.92 -    data8 hyper_not_support     //hyper_ni_hypercall       /* 25 */
    2.93 -    data8 hyper_not_support     //hyper_mmuext_op
    2.94 -    data8 hyper_not_support     //tata8 hyper_lock_page
    2.95 -    data8 hyper_set_shared_page