[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 2/2] Nested EPT: fixing issue of translate L2 gva to L1 gfn
On 12.02.14 03:08, Yang Zhang wrote: > From: Yang Zhang <yang.z.zhang@xxxxxxxxx> > > There is no way to translate L2 gva to L1 gfn directly. Why? > To do it, we need to get L2's gfn first. Then look up the virtual EPT to get > L1's gfn. > > Signed-off-by: Yang Zhang <yang.z.zhang@xxxxxxxxx> > --- > xen/arch/x86/mm/p2m.c | 25 ++++++++++++++++++++----- > 1 files changed, 20 insertions(+), 5 deletions(-) > > diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c > index 8f380ed..e92cfbe 100644 > --- a/xen/arch/x86/mm/p2m.c > +++ b/xen/arch/x86/mm/p2m.c > @@ -1605,22 +1605,37 @@ unsigned long paging_gva_to_gfn(struct vcpu *v, > && paging_mode_hap(v->domain) > && nestedhvm_is_n2(v) ) > { > - unsigned long gfn; > + unsigned long gfn, l1gfn, exit_qual; > struct p2m_domain *p2m; > const struct paging_mode *mode; > - uint32_t pfec_21 = *pfec; > uint64_t np2m_base = nhvm_vcpu_p2m_base(v); > + unsigned int page_order, exit_reason; > + int rc; > + uint8_t p2m_acc; > + struct nestedvmx *nvmx = &vcpu_2_nvmx(v); > > /* translate l2 guest va into l2 guest gfn */ > p2m = p2m_get_nestedp2m(v, np2m_base); > mode = paging_get_nestedmode(v); > gfn = mode->gva_to_gfn(v, p2m, va, pfec); > > + if ( gfn == INVALID_GFN ) > + return gfn; > + > /* translate l2 guest gfn into l1 guest gfn */ > - return hostmode->p2m_ga_to_gfn(v, hostp2m, np2m_base, > - gfn << PAGE_SHIFT, &pfec_21, NULL); > - } I think in p2m-ept.c you should override that function pointer to a EPT specific implementation. Christoph > + rc = nept_translate_l2ga(v, gfn << 12 , &page_order, 4, &l1gfn, > &p2m_acc, > + &exit_qual, &exit_reason); > + if ( rc == EPT_TRANSLATE_VIOLATION || rc == EPT_TRANSLATE_MISCONFIG ) > + { > + nvmx->ept.exit_reason = exit_reason; > + nvmx->ept.exit_qual = exit_qual; > + vcpu_nestedhvm(current).nv_vmexit_pending = 1; > + } > + if ( rc == EPT_TRANSLATE_RETRY ) > + *pfec = PFEC_page_paged; > > + return l1gfn; > + } > return hostmode->gva_to_gfn(v, hostp2m, va, pfec); > } > > _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |