[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH RFC 04/12] x86/np2m: remove np2m_base from p2m_get_nestedp2m()
Remove np2m_base parameter as it should always match the value of EPTP in VMCS12. Signed-off-by: Sergey Dyasli <sergey.dyasli@xxxxxxxxxx> --- xen/arch/x86/hvm/svm/nestedsvm.c | 2 +- xen/arch/x86/hvm/vmx/vvmx.c | 3 +-- xen/arch/x86/mm/hap/nested_hap.c | 2 +- xen/arch/x86/mm/p2m.c | 8 ++++---- xen/include/asm-x86/p2m.h | 5 ++--- 5 files changed, 9 insertions(+), 11 deletions(-) diff --git a/xen/arch/x86/hvm/svm/nestedsvm.c b/xen/arch/x86/hvm/svm/nestedsvm.c index 8fd9c23a02..c3665aec01 100644 --- a/xen/arch/x86/hvm/svm/nestedsvm.c +++ b/xen/arch/x86/hvm/svm/nestedsvm.c @@ -411,7 +411,7 @@ static void nestedsvm_vmcb_set_nestedp2m(struct vcpu *v, ASSERT(v != NULL); ASSERT(vvmcb != NULL); ASSERT(n2vmcb != NULL); - p2m = p2m_get_nestedp2m(v, vvmcb->_h_cr3); + p2m = p2m_get_nestedp2m(v); n2vmcb->_h_cr3 = pagetable_get_paddr(p2m_get_pagetable(p2m)); } diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c index 56678127e1..1011829c15 100644 --- a/xen/arch/x86/hvm/vmx/vvmx.c +++ b/xen/arch/x86/hvm/vmx/vvmx.c @@ -1094,8 +1094,7 @@ static void load_shadow_guest_state(struct vcpu *v) uint64_t get_shadow_eptp(struct vcpu *v) { - uint64_t np2m_base = nvmx_vcpu_eptp_base(v); - struct p2m_domain *p2m = p2m_get_nestedp2m(v, np2m_base); + struct p2m_domain *p2m = p2m_get_nestedp2m(v); struct ept_data *ept = &p2m->ept; ept->mfn = pagetable_get_pfn(p2m_get_pagetable(p2m)); diff --git a/xen/arch/x86/mm/hap/nested_hap.c b/xen/arch/x86/mm/hap/nested_hap.c index 162afed46b..ed137fa784 100644 --- a/xen/arch/x86/mm/hap/nested_hap.c +++ b/xen/arch/x86/mm/hap/nested_hap.c @@ -212,7 +212,7 @@ nestedhvm_hap_nested_page_fault(struct vcpu *v, paddr_t *L2_gpa, uint8_t p2ma_21 = p2m_access_rwx; p2m = p2m_get_hostp2m(d); /* L0 p2m */ - nested_p2m = p2m_get_nestedp2m(v, nhvm_vcpu_p2m_base(v)); + nested_p2m = p2m_get_nestedp2m(v); /* walk the L1 P2M table */ rv = nestedhap_walk_L1_p2m(v, *L2_gpa, &L1_gpa, &page_order_21, &p2ma_21, diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c index bc330d8f52..e7bd0dbac8 100644 --- a/xen/arch/x86/mm/p2m.c +++ b/xen/arch/x86/mm/p2m.c @@ -1815,11 +1815,12 @@ static void assign_np2m(struct vcpu *v, struct p2m_domain *p2m) } struct p2m_domain * -p2m_get_nestedp2m(struct vcpu *v, uint64_t np2m_base) +p2m_get_nestedp2m(struct vcpu *v) { struct nestedvcpu *nv = &vcpu_nestedhvm(v); struct domain *d = v->domain; struct p2m_domain *p2m; + uint64_t np2m_base = nhvm_vcpu_p2m_base(v); /* Mask out low bits; this avoids collisions with P2M_BASE_EADDR */ np2m_base &= ~(0xfffull); @@ -1867,7 +1868,7 @@ p2m_get_p2m(struct vcpu *v) if (!nestedhvm_is_n2(v)) return p2m_get_hostp2m(v->domain); - return p2m_get_nestedp2m(v, nhvm_vcpu_p2m_base(v)); + return p2m_get_nestedp2m(v); } unsigned long paging_gva_to_gfn(struct vcpu *v, @@ -1882,13 +1883,12 @@ unsigned long paging_gva_to_gfn(struct vcpu *v, unsigned long l2_gfn, l1_gfn; struct p2m_domain *p2m; const struct paging_mode *mode; - uint64_t np2m_base = nhvm_vcpu_p2m_base(v); uint8_t l1_p2ma; unsigned int l1_page_order; int rv; /* translate l2 guest va into l2 guest gfn */ - p2m = p2m_get_nestedp2m(v, np2m_base); + p2m = p2m_get_nestedp2m(v); mode = paging_get_nestedmode(v); l2_gfn = mode->gva_to_gfn(v, p2m, va, pfec); diff --git a/xen/include/asm-x86/p2m.h b/xen/include/asm-x86/p2m.h index 0e39999387..cc1bab9eb7 100644 --- a/xen/include/asm-x86/p2m.h +++ b/xen/include/asm-x86/p2m.h @@ -360,10 +360,9 @@ struct p2m_domain { #define p2m_get_hostp2m(d) ((d)->arch.p2m) /* - * Assigns an np2m with the specified np2m_base to the specified vCPU - * and returns that np2m. + * Updates vCPU's n2pm to match its EPTP in VMCS12 and returns that np2m. */ -struct p2m_domain *p2m_get_nestedp2m(struct vcpu *v, uint64_t np2m_base); +struct p2m_domain *p2m_get_nestedp2m(struct vcpu *v); /* If vcpu is in host mode then behaviour matches p2m_get_hostp2m(). * If vcpu is in guest mode then behaviour matches p2m_get_nestedp2m(). -- 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |