[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] x86/mm: Use mfn_t for new_guest_cr3()
commit fe133170f6e75f88b080e441106df9edcf6e769b Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> AuthorDate: Wed Aug 30 12:15:49 2017 +0100 Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> CommitDate: Wed Aug 30 18:21:56 2017 +0100 x86/mm: Use mfn_t for new_guest_cr3() No functional change (as confirmed by diffing the assembly). Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Reviewed-by: Wei Liu <wei.liu2@xxxxxxxxxx> Acked-by: Jan Beulich <jbeulich@xxxxxxxx> --- xen/arch/x86/mm.c | 35 ++++++++++++++++++----------------- xen/arch/x86/pv/emul-priv-op.c | 2 +- xen/include/asm-x86/mm.h | 2 +- 3 files changed, 20 insertions(+), 19 deletions(-) diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index 1f23470..326cd33 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -2772,23 +2772,23 @@ int vcpu_destroy_pagetables(struct vcpu *v) return rc != -EINTR ? rc : -ERESTART; } -int new_guest_cr3(unsigned long mfn) +int new_guest_cr3(mfn_t mfn) { struct vcpu *curr = current; struct domain *d = curr->domain; int rc; - unsigned long old_base_mfn; + mfn_t old_base_mfn; if ( is_pv_32bit_domain(d) ) { - unsigned long gt_mfn = pagetable_get_pfn(curr->arch.guest_table); - l4_pgentry_t *pl4e = map_domain_page(_mfn(gt_mfn)); + mfn_t gt_mfn = pagetable_get_mfn(curr->arch.guest_table); + l4_pgentry_t *pl4e = map_domain_page(gt_mfn); rc = mod_l4_entry(pl4e, - l4e_from_pfn(mfn, + l4e_from_mfn(mfn, (_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_ACCESSED)), - gt_mfn, 0, curr); + mfn_x(gt_mfn), 0, curr); unmap_domain_page(pl4e); switch ( rc ) { @@ -2800,7 +2800,7 @@ int new_guest_cr3(unsigned long mfn) default: gdprintk(XENLOG_WARNING, "Error while installing new compat baseptr %" PRI_mfn "\n", - mfn); + mfn_x(mfn)); return rc; } @@ -2814,20 +2814,20 @@ int new_guest_cr3(unsigned long mfn) if ( unlikely(rc) ) return rc; - old_base_mfn = pagetable_get_pfn(curr->arch.guest_table); + old_base_mfn = pagetable_get_mfn(curr->arch.guest_table); /* * This is particularly important when getting restarted after the * previous attempt got preempted in the put-old-MFN phase. */ - if ( old_base_mfn == mfn ) + if ( mfn_eq(old_base_mfn, mfn) ) { write_ptbase(curr); return 0; } rc = paging_mode_refcounts(d) - ? (get_page_from_mfn(_mfn(mfn), d) ? 0 : -EINVAL) - : get_page_and_type_from_mfn(_mfn(mfn), PGT_root_page_table, d, 0, 1); + ? (get_page_from_mfn(mfn, d) ? 0 : -EINVAL) + : get_page_and_type_from_mfn(mfn, PGT_root_page_table, d, 0, 1); switch ( rc ) { case 0: @@ -2837,22 +2837,23 @@ int new_guest_cr3(unsigned long mfn) return -ERESTART; default: gdprintk(XENLOG_WARNING, - "Error while installing new baseptr %" PRI_mfn "\n", mfn); + "Error while installing new baseptr %" PRI_mfn "\n", + mfn_x(mfn)); return rc; } invalidate_shadow_ldt(curr, 0); if ( !VM_ASSIST(d, m2p_strict) && !paging_mode_refcounts(d) ) - fill_ro_mpt(_mfn(mfn)); - curr->arch.guest_table = pagetable_from_pfn(mfn); + fill_ro_mpt(mfn); + curr->arch.guest_table = pagetable_from_mfn(mfn); update_cr3(curr); write_ptbase(curr); - if ( likely(old_base_mfn != 0) ) + if ( likely(mfn_x(old_base_mfn) != 0) ) { - struct page_info *page = mfn_to_page(_mfn(old_base_mfn)); + struct page_info *page = mfn_to_page(old_base_mfn); if ( paging_mode_refcounts(d) ) put_page(page); @@ -3180,7 +3181,7 @@ long do_mmuext_op( else if ( unlikely(paging_mode_translate(currd)) ) rc = -EINVAL; else - rc = new_guest_cr3(op.arg1.mfn); + rc = new_guest_cr3(_mfn(op.arg1.mfn)); break; case MMUEXT_NEW_USER_BASEPTR: { diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c index af1624a..54a63c2 100644 --- a/xen/arch/x86/pv/emul-priv-op.c +++ b/xen/arch/x86/pv/emul-priv-op.c @@ -774,7 +774,7 @@ static int priv_op_write_cr(unsigned int reg, unsigned long val, page = get_page_from_gfn(currd, gfn, NULL, P2M_ALLOC); if ( !page ) break; - rc = new_guest_cr3(mfn_x(page_to_mfn(page))); + rc = new_guest_cr3(page_to_mfn(page)); put_page(page); switch ( rc ) diff --git a/xen/include/asm-x86/mm.h b/xen/include/asm-x86/mm.h index ec7ce3c..4c03a33 100644 --- a/xen/include/asm-x86/mm.h +++ b/xen/include/asm-x86/mm.h @@ -539,7 +539,7 @@ void audit_domains(void); #endif -int new_guest_cr3(unsigned long pfn); +int new_guest_cr3(mfn_t mfn); void make_cr3(struct vcpu *v, unsigned long mfn); void update_cr3(struct vcpu *v); int vcpu_destroy_pagetables(struct vcpu *); -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |