[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v3 21/21] x86/mm: add "pv_" prefix to new_guest_cr3
Also take the chance to change d to currd. This function can't be moved yet. It can only be moved with other functions. Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx> --- xen/arch/x86/mm.c | 18 +++++++++--------- xen/arch/x86/pv/emul-priv-op.c | 3 ++- xen/include/asm-x86/mm.h | 1 - xen/include/asm-x86/pv/mm.h | 7 +++++++ 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index 5687e29824..2493ea7fd3 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -2695,14 +2695,14 @@ int vcpu_destroy_pagetables(struct vcpu *v) return rc != -EINTR ? rc : -ERESTART; } -int new_guest_cr3(unsigned long mfn) +int pv_new_guest_cr3(unsigned long mfn) { struct vcpu *curr = current; - struct domain *d = curr->domain; + struct domain *currd = curr->domain; int rc; unsigned long old_base_mfn; - if ( is_pv_32bit_domain(d) ) + if ( is_pv_32bit_domain(currd) ) { unsigned long gt_mfn = pagetable_get_pfn(curr->arch.guest_table); l4_pgentry_t *pl4e = map_domain_page(_mfn(gt_mfn)); @@ -2748,9 +2748,9 @@ int new_guest_cr3(unsigned long mfn) return 0; } - rc = paging_mode_refcounts(d) - ? (!get_page_from_pagenr(mfn, d) ? 0 : -EINVAL) - : get_page_and_type_from_pagenr(mfn, PGT_root_page_table, d, 0, 1); + rc = paging_mode_refcounts(currd) + ? (!get_page_from_pagenr(mfn, currd) ? 0 : -EINVAL) + : get_page_and_type_from_pagenr(mfn, PGT_root_page_table, currd, 0, 1); switch ( rc ) { case 0: @@ -2766,7 +2766,7 @@ int new_guest_cr3(unsigned long mfn) invalidate_shadow_ldt(curr, 0); - if ( !VM_ASSIST(d, m2p_strict) && !paging_mode_refcounts(d) ) + if ( !VM_ASSIST(currd, m2p_strict) && !paging_mode_refcounts(currd) ) fill_ro_mpt(mfn); curr->arch.guest_table = pagetable_from_pfn(mfn); update_cr3(curr); @@ -2777,7 +2777,7 @@ int new_guest_cr3(unsigned long mfn) { struct page_info *page = mfn_to_page(old_base_mfn); - if ( paging_mode_refcounts(d) ) + if ( paging_mode_refcounts(currd) ) put_page(page); else switch ( rc = put_page_and_type_preemptible(page) ) @@ -3102,7 +3102,7 @@ long do_mmuext_op( else if ( unlikely(paging_mode_translate(currd)) ) rc = -EINVAL; else - rc = new_guest_cr3(op.arg1.mfn); + rc = pv_new_guest_cr3(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 85185b6b29..936757e03c 100644 --- a/xen/arch/x86/pv/emul-priv-op.c +++ b/xen/arch/x86/pv/emul-priv-op.c @@ -32,6 +32,7 @@ #include <asm/hypercall.h> #include <asm/mc146818rtc.h> #include <asm/p2m.h> +#include <asm/pv/mm.h> #include <asm/pv/traps.h> #include <asm/shared.h> #include <asm/traps.h> @@ -768,7 +769,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(page_to_mfn(page)); + rc = pv_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 19c80da995..f48ce7555d 100644 --- a/xen/include/asm-x86/mm.h +++ b/xen/include/asm-x86/mm.h @@ -534,7 +534,6 @@ void audit_domains(void); #endif -int new_guest_cr3(unsigned long pfn); void make_cr3(struct vcpu *v, unsigned long mfn); void update_cr3(struct vcpu *v); int vcpu_destroy_pagetables(struct vcpu *); diff --git a/xen/include/asm-x86/pv/mm.h b/xen/include/asm-x86/pv/mm.h index 8fd542e630..0192580b41 100644 --- a/xen/include/asm-x86/pv/mm.h +++ b/xen/include/asm-x86/pv/mm.h @@ -94,8 +94,12 @@ void pv_init_guest_l4_table(l4_pgentry_t[], const struct domain *, bool zap_ro_mpt); void pv_arch_init_memory(void); +int pv_new_guest_cr3(unsigned long pfn); + #else +#include <xen/errno.h> + static inline void pv_get_guest_eff_l1e(unsigned long addr, l1_pgentry_t *eff_l1e) {} @@ -119,6 +123,9 @@ static inline void pv_init_guest_l4_table(l4_pgentry_t[], const struct domain *, bool zap_ro_mpt) {} static inline void pv_arch_init_memory(void) {} + +static inline int pv_new_guest_cr3(unsigned long pfn) { return -EINVAL; } + #endif #endif /* __X86_PV_MM_H__ */ -- 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 |