WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-ia64-devel

[Xen-ia64-devel] Enabling hypercalls from VT-i domain

To: xen-ia64-devel <xen-ia64-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-ia64-devel] Enabling hypercalls from VT-i domain
From: DOI Tsunehisa <Doi.Tsunehisa@xxxxxxxxxxxxxx>
Date: Wed, 02 Aug 2006 19:34:23 +0900
Delivery-date: Wed, 02 Aug 2006 03:37:56 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-ia64-devel-request@lists.xensource.com?subject=help>
List-id: Discussion of the ia64 port of Xen <xen-ia64-devel.lists.xensource.com>
List-post: <mailto:xen-ia64-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-ia64-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 1.5.0.5 (Windows/20060719)
Hi all,

  My name is Tsunehisa Doi.

  We are porting Steven Smith's para drivers for full-VM to IPF.
In the xen-unstable.hg (cs: 10883-10885), it's enabling the hypercall
from HVM domain. Thus, I will post the enabling patch for IPF. This
patch includes:

  + cleanup the hypercall handling code for VT-i domain
    - delete the dead code in vmx_hypercall.c and vmx_ivt.S
    - the code is not used now, I think.
      * It's called with `break 0x1100' instruction. (current 0x1000)
      * The hypercall table for VT-i domain doesn't match the
        hypercall number.
      * The register used for hypercall are different with current
        version. (r16-r20 vs. r2,r4-r18)
  + enabling hypercalls from VT-i domain
    - modify the checker to permit hypercalls from VT-i domain.

Thanks,
- Tsunehisa Doi
# HG changeset patch
# User Doi.Tsunehisa@xxxxxxxxxxxxxx
# Node ID aafdb9899c4179b1221fc59a46600973ba630476
# Parent  4acc6d51f3893d2b0c33c021f459ac12482858d9
cleanup the hypercall handling code for VT-i domain

Signed-off-by: Tsunehisa Doi <Doi.Tsunehisa@xxxxxxxxxxxxxx>
Signed-off-by: Tomonari Horikoshi <t.horikoshi@xxxxxxxxxxxxxx>
Signed-off-by: Masaki Kanno <kanno.masaki@xxxxxxxxxxxxxx>

diff -r 4acc6d51f389 -r aafdb9899c41 xen/arch/ia64/vmx/vmx_hypercall.c
--- a/xen/arch/ia64/vmx/vmx_hypercall.c Tue Aug 01 14:58:20 2006 -0600
+++ b/xen/arch/ia64/vmx/vmx_hypercall.c Wed Aug 02 17:48:27 2006 +0900
@@ -35,180 +35,4 @@
 #include <asm/dom_fw.h>
 #include <xen/domain.h>
 
-extern long do_sched_op_compat(int cmd, unsigned long arg);
-
-void hyper_not_support(void)
-{
-    VCPU *vcpu=current;
-    vcpu_set_gr(vcpu, 8, -1, 0);
-    vmx_vcpu_increment_iip(vcpu);
-}
-
-void hyper_mmu_update(void)
-{
-    VCPU *vcpu=current;
-    u64 r32,r33,r34,r35,ret;
-    vcpu_get_gr_nat(vcpu,16,&r32);
-    vcpu_get_gr_nat(vcpu,17,&r33);
-    vcpu_get_gr_nat(vcpu,18,&r34);
-    vcpu_get_gr_nat(vcpu,19,&r35);
-    ret=vmx_do_mmu_update((mmu_update_t*)r32,r33,(u64 *)r34,r35);
-    vcpu_set_gr(vcpu, 8, ret, 0);
-    vmx_vcpu_increment_iip(vcpu);
-}
-
-void hyper_dom_mem_op(void)
-{
-    VCPU *vcpu=current;
-    u64 r32,r33,r34,r35,r36;
-    u64 ret;
-    vcpu_get_gr_nat(vcpu,16,&r32);
-    vcpu_get_gr_nat(vcpu,17,&r33);
-    vcpu_get_gr_nat(vcpu,18,&r34);
-    vcpu_get_gr_nat(vcpu,19,&r35);
-    vcpu_get_gr_nat(vcpu,20,&r36);
-//    ret=do_dom_mem_op(r32,(u64 *)r33,r34,r35,r36);
-    ret = 0;
-    printf("do_dom_mem return value: %lx\n", ret);
-    vcpu_set_gr(vcpu, 8, ret, 0);
-
-    /* Hard to define a special return value to indicate hypercall restart.
-     * So just add a new mark, which is SMP safe
-     */
-    if (vcpu->arch.hypercall_continuation == 1)
-       vcpu->arch.hypercall_continuation = 0;
-    else
-       vmx_vcpu_increment_iip(vcpu);
-}
-
-
-void hyper_sched_op_compat(void)
-{
-    VCPU *vcpu=current;
-    u64 r32,r33,ret;
-    vcpu_get_gr_nat(vcpu,16,&r32);
-    vcpu_get_gr_nat(vcpu,17,&r33);
-    ret=do_sched_op_compat(r32,r33);
-    vcpu_set_gr(vcpu, 8, ret, 0);
-
-    vmx_vcpu_increment_iip(vcpu);
-}
-
-void hyper_dom0_op(void)
-{
-    VCPU *vcpu=current;
-    u64 r32,ret;
-    vcpu_get_gr_nat(vcpu,16,&r32);
-    ret=do_dom0_op(guest_handle_from_ptr(r32, dom0_op_t));
-    vcpu_set_gr(vcpu, 8, ret, 0);
-
-    vmx_vcpu_increment_iip(vcpu);
-}
-
-void hyper_event_channel_op_compat(void)
-{
-    VCPU *vcpu=current;
-    u64 r32,ret;
-    vcpu_get_gr_nat(vcpu,16,&r32);
-    ret=do_event_channel_op_compat(guest_handle_from_ptr(r32, evtchn_op_t));
-    vcpu_set_gr(vcpu, 8, ret, 0);
-    vmx_vcpu_increment_iip(vcpu);
-}
-
-void hyper_xen_version(void)
-{
-    VCPU *vcpu=current;
-    u64 r32,r33,ret;
-    vcpu_get_gr_nat(vcpu,16,&r32);
-    vcpu_get_gr_nat(vcpu,17,&r33);
-    ret=do_xen_version((int )r32,guest_handle_from_ptr(r33, void));
-    vcpu_set_gr(vcpu, 8, ret, 0);
-    vmx_vcpu_increment_iip(vcpu);
-}
-/*
-static int do_lock_page(VCPU *vcpu, u64 va, u64 lock)
-{
-    ia64_rr rr;
-    thash_cb_t *hcb;
-    hcb = vmx_vcpu_get_vtlb(vcpu);
-    rr = vmx_vcpu_rr(vcpu, va);
-    return thash_lock_tc(hcb, va ,1U<<rr.ps, rr.rid, DSIDE_TLB, lock);
-}
- */
-/*
- * Lock guest page in vTLB, so that it's not relinquished by recycle
- * session when HV is servicing that hypercall.
- */
-
-/*
-void hyper_lock_page(void)
-{
-//TODO:
-    VCPU *vcpu=current;
-    u64 va,lock, ret;
-    vcpu_get_gr_nat(vcpu,16,&va);
-    vcpu_get_gr_nat(vcpu,17,&lock);
-    ret=do_lock_page(vcpu, va, lock);
-    vcpu_set_gr(vcpu, 8, ret, 0);
-
-    vmx_vcpu_increment_iip(vcpu);
-}
- */
-
-static int do_set_shared_page(VCPU *vcpu, u64 gpa)
-{
-    u64 o_info;
-    struct domain *d = vcpu->domain;
-    struct vcpu *v;
-    struct page_info *page;
-    if(vcpu->domain!=dom0)
-        return -EPERM;
-    o_info = (u64)vcpu->domain->shared_info;
- again:
-    d->shared_info= (shared_info_t *)domain_mpa_to_imva(vcpu->domain, gpa);
-    page = virt_to_page(d->shared_info);
-    if (get_page(page, d) == 0)
-        goto again;
-
-    /* Copy existing shared info into new page */
-    if (o_info) {
-       memcpy((void*)d->shared_info, (void*)o_info, PAGE_SIZE);
-       for_each_vcpu(d, v) {
-               v->vcpu_info = &d->shared_info->vcpu_info[v->vcpu_id];
-       }
-       /* If original page belongs to xen heap, then relinguish back
-        * to xen heap. Or else, leave to domain itself to decide.
-        */
-       if (likely(IS_XEN_HEAP_FRAME(virt_to_page(o_info))))
-               free_xenheap_page((void *)o_info);
-    } else
-        memset(d->shared_info, 0, PAGE_SIZE);
-    put_page(page);
-    return 0;
-}
-
-void hyper_set_shared_page(void)
-{
-    VCPU *vcpu=current;
-    u64 gpa,ret;
-    vcpu_get_gr_nat(vcpu,16,&gpa);
-
-    ret=do_set_shared_page(vcpu, gpa);
-    vcpu_set_gr(vcpu, 8, ret, 0);
-
-    vmx_vcpu_increment_iip(vcpu);
-}
-
-/*
-void hyper_grant_table_op(void)
-{
-    VCPU *vcpu=current;
-    u64 r32,r33,r34,ret;
-    vcpu_get_gr_nat(vcpu,16,&r32);
-    vcpu_get_gr_nat(vcpu,17,&r33);
-    vcpu_get_gr_nat(vcpu,18,&r34);
-
-    ret=do_grant_table_op((unsigned int)r32, (void *)r33, (unsigned int)r34);
-    vcpu_set_gr(vcpu, 8, ret, 0);
-}
-*/
+/* This file will include the hypercall code for VT-i domain, soon. */
diff -r 4acc6d51f389 -r aafdb9899c41 xen/arch/ia64/vmx/vmx_ivt.S
--- a/xen/arch/ia64/vmx/vmx_ivt.S       Tue Aug 01 14:58:20 2006 -0600
+++ b/xen/arch/ia64/vmx/vmx_ivt.S       Wed Aug 02 17:48:27 2006 +0900
@@ -423,7 +423,6 @@ ENTRY(vmx_break_fault)
     mov r31=pr
     mov r19=11
     mov r30=cr.iim
-    movl r29=0x1100
     ;;
 #ifdef VTI_DEBUG
     // break 0 is already handled in vmx_ia64_handle_break.
@@ -431,9 +430,7 @@ ENTRY(vmx_break_fault)
     (p6) br.sptk vmx_fault_11
     ;;
 #endif
-    cmp.eq  p6,p7=r29,r30
-    (p6) br.dptk.few vmx_hypercall_dispatch
-    (p7) br.sptk.many vmx_dispatch_break_fault
+    br.sptk.many vmx_dispatch_break_fault
     ;;
     VMX_FAULT(11);
 END(vmx_break_fault)
@@ -1140,33 +1137,6 @@ END(vmx_dispatch_break_fault)
 END(vmx_dispatch_break_fault)
 
 
-ENTRY(vmx_hypercall_dispatch)
-    VMX_SAVE_MIN_WITH_COVER
-    ssm psr.ic
-    ;;
-    srlz.i                  // guarantee that interruption collection is on
-    ;;
-    (p15) ssm psr.i               // restore psr.i
-    adds r3=8,r2                // set up second base pointer
-    ;;
-    VMX_SAVE_REST
-    ;;
-    movl r14=ia64_leave_hypervisor
-    movl r2=hyper_call_table
-    ;;
-    mov rp=r14
-    shladd r2=r15,3,r2
-    ;;
-    ld8 r2=[r2]
-    ;;
-    mov b6=r2
-    ;;
-    br.call.sptk.many b6=b6
-    ;;
-END(vmx_hypercall_dispatch)
-
-
-
 ENTRY(vmx_dispatch_interrupt)
     VMX_SAVE_MIN_WITH_COVER_R19        // uses r31; defines r2 and r3
     ;;
@@ -1187,39 +1157,3 @@ ENTRY(vmx_dispatch_interrupt)
     add out1=16,sp             // pass pointer to pt_regs as second arg
     br.call.sptk.many b6=ia64_handle_irq
 END(vmx_dispatch_interrupt)
-
-
-
-    .rodata
-    .align 8
-    .globl hyper_call_table
-hyper_call_table:
-    data8 hyper_not_support     //hyper_set_trap_table     /*  0 */
-    data8 hyper_mmu_update
-    data8 hyper_not_support     //hyper_set_gdt
-    data8 hyper_not_support     //hyper_stack_switch
-    data8 hyper_not_support     //hyper_set_callbacks
-    data8 hyper_not_support     //hyper_fpu_taskswitch     /*  5 */
-    data8 hyper_sched_op_compat
-    data8 hyper_dom0_op
-    data8 hyper_not_support     //hyper_set_debugreg
-    data8 hyper_not_support     //hyper_get_debugreg
-    data8 hyper_not_support     //hyper_update_descriptor  /* 10 */
-    data8 hyper_not_support     //hyper_set_fast_trap
-    data8 hyper_dom_mem_op
-    data8 hyper_not_support     //hyper_multicall
-    data8 hyper_not_support     //hyper_update_va_mapping
-    data8 hyper_not_support     //hyper_set_timer_op       /* 15 */
-    data8 hyper_event_channel_op_compat
-    data8 hyper_xen_version
-    data8 hyper_not_support     //hyper_console_io
-    data8 hyper_not_support     //hyper_physdev_op
-    data8 hyper_not_support     //hyper_grant_table_op     /* 20 */
-    data8 hyper_not_support     //hyper_vm_assist
-    data8 hyper_not_support     //hyper_update_va_mapping_otherdomain
-    data8 hyper_not_support     //hyper_switch_vm86
-    data8 hyper_not_support     //hyper_boot_vcpu
-    data8 hyper_not_support     //hyper_ni_hypercall       /* 25 */
-    data8 hyper_not_support     //hyper_mmuext_op
-    data8 hyper_not_support     //tata8 hyper_lock_page
-    data8 hyper_set_shared_page
# HG changeset patch
# User Doi.Tsunehisa@xxxxxxxxxxxxxx
# Node ID e8de7b1474c04feadca10344aaddd8c1150faf32
# Parent  aafdb9899c4179b1221fc59a46600973ba630476
enabling hypercalls from VT-i domain

Signed-off-by: Tsunehisa Doi <Doi.Tsunehisa@xxxxxxxxxxxxxx>
Signed-off-by: Tomonari Horikoshi <t.horikoshi@xxxxxxxxxxxxxx>
Signed-off-by: Masaki Kanno <kanno.masaki@xxxxxxxxxxxxxx>

diff -r aafdb9899c41 -r e8de7b1474c0 xen/arch/ia64/xen/hypercall.c
--- a/xen/arch/ia64/xen/hypercall.c     Wed Aug 02 17:48:27 2006 +0900
+++ b/xen/arch/ia64/xen/hypercall.c     Wed Aug 02 17:52:43 2006 +0900
@@ -319,7 +319,7 @@ ia64_hypercall (struct pt_regs *regs)
 
        /* Hypercalls are only allowed by kernel.
           Kernel checks memory accesses.  */
-       if (privlvl != 2) {
+       if ((regs->cr_ipsr & IA64_PSR_VM) ? (privlvl != 0) : (privlvl != 2)) {
            /* FIXME: Return a better error value ?
               Reflection ? Illegal operation ?  */
            regs->r8 = -1;
_______________________________________________
Xen-ia64-devel mailing list
Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ia64-devel