diff -r ad5960696d68 xen/arch/x86/hvm/nestedhvm.c --- a/xen/arch/x86/hvm/nestedhvm.c Fri Apr 15 12:00:13 2011 +0200 +++ b/xen/arch/x86/hvm/nestedhvm.c Fri Apr 15 15:43:15 2011 +0200 @@ -61,7 +61,7 @@ nestedhvm_vcpu_reset(struct vcpu *v) nv->nv_vvmcxaddr = VMCX_EADDR; nv->nv_flushp2m = 0; nv->nv_p2m = NULL; + hvm_asid_flush_vcpu_asid(&nv->nv_n2asid); if ( hvm_funcs.nhvm_vcpu_reset ) hvm_funcs.nhvm_vcpu_reset(v); diff -r ad5960696d68 xen/arch/x86/hvm/svm/asid.c --- a/xen/arch/x86/hvm/svm/asid.c Fri Apr 15 12:00:13 2011 +0200 +++ b/xen/arch/x86/hvm/svm/asid.c Fri Apr 15 15:43:15 2011 +0200 @@ -43,10 +43,16 @@ asmlinkage void svm_asid_handle_vmrun(vo { struct vcpu *curr = current; struct vmcb_struct *vmcb = curr->arch.hvm_svm.vmcb; - struct hvm_vcpu_asid *p_asid = - nestedhvm_vcpu_in_guestmode(curr) - ? &vcpu_nestedhvm(curr).nv_n2asid : &curr->arch.hvm_vcpu.n1asid; - bool_t need_flush = hvm_asid_handle_vmenter(p_asid); + struct hvm_vcpu_asid *p_asid; + bool_t need_flush; + bool_t vcpu_guestmode = 0; + + if (nestedhvm_enabled(curr->domain) && nestedhvm_vcpu_in_guestmode(curr)) + vcpu_guestmode = 1; + + p_asid = vcpu_guestmode ? + &vcpu_nestedhvm(curr).nv_n2asid : &curr->arch.hvm_vcpu.n1asid; + need_flush = hvm_asid_handle_vmenter(p_asid); /* ASID 0 indicates that ASIDs are disabled. */ if ( p_asid->asid == 0 )