[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v4 23/31] x86/mm: export more get/put page functions
Export some of the get/put functions so that we can move PV mm code trunk by trunk. When moving code is done some of the functions might be made static again. Also fix coding style issues and use bool when appropriate. Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx> --- xen/arch/x86/mm.c | 40 ++++++++++++++++++++-------------------- xen/include/asm-x86/mm.h | 17 +++++++++++++++-- 2 files changed, 35 insertions(+), 22 deletions(-) diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index 1fdae6e1e6..fb6485500f 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -555,9 +555,8 @@ bool get_page_from_mfn(mfn_t mfn, struct domain *d) } -static int get_page_and_type_from_mfn( - mfn_t mfn, unsigned long type, struct domain *d, - int partial, int preemptible) +int get_page_and_type_from_mfn(mfn_t mfn, unsigned long type, struct domain *d, + int partial, bool preemptible) { struct page_info *page = mfn_to_page(mfn_x(mfn)); int rc; @@ -940,7 +939,7 @@ get_page_from_l1e( * <0 => error code */ define_get_linear_pagetable(l2); -static int +int get_page_from_l2e( l2_pgentry_t l2e, unsigned long pfn, struct domain *d) { @@ -959,7 +958,8 @@ get_page_from_l2e( if ( !(l2e_get_flags(l2e) & _PAGE_PSE) ) { - rc = get_page_and_type_from_mfn(_mfn(mfn), PGT_l1_page_table, d, 0, 0); + rc = get_page_and_type_from_mfn(_mfn(mfn), PGT_l1_page_table, d, 0, + false); if ( unlikely(rc == -EINVAL) && get_l2_linear_pagetable(l2e, pfn, d) ) rc = 0; return rc; @@ -976,7 +976,7 @@ get_page_from_l2e( * <0 => error code */ define_get_linear_pagetable(l3); -static int +int get_page_from_l3e( l3_pgentry_t l3e, unsigned long pfn, struct domain *d, int partial) { @@ -992,8 +992,8 @@ get_page_from_l3e( return -EINVAL; } - rc = get_page_and_type_from_mfn( - _mfn(l3e_get_pfn(l3e)), PGT_l2_page_table, d, partial, 1); + rc = get_page_and_type_from_mfn(_mfn(l3e_get_pfn(l3e)), PGT_l2_page_table, + d, partial, true); if ( unlikely(rc == -EINVAL) && !is_pv_32bit_domain(d) && get_l3_linear_pagetable(l3e, pfn, d) ) @@ -1009,7 +1009,7 @@ get_page_from_l3e( * <0 => error code */ define_get_linear_pagetable(l4); -static int +int get_page_from_l4e( l4_pgentry_t l4e, unsigned long pfn, struct domain *d, int partial) { @@ -1025,8 +1025,8 @@ get_page_from_l4e( return -EINVAL; } - rc = get_page_and_type_from_mfn( - _mfn(l4e_get_pfn(l4e)), PGT_l3_page_table, d, partial, 1); + rc = get_page_and_type_from_mfn(_mfn(l4e_get_pfn(l4e)), PGT_l3_page_table, + d, partial, true); if ( unlikely(rc == -EINVAL) && get_l4_linear_pagetable(l4e, pfn, d) ) rc = 0; @@ -1097,7 +1097,7 @@ void put_page_from_l1e(l1_pgentry_t l1e, struct domain *l1e_owner) * NB. Virtual address 'l2e' maps to a machine address within frame 'pfn'. * Note also that this automatically deals correctly with linear p.t.'s. */ -static int put_page_from_l2e(l2_pgentry_t l2e, unsigned long pfn) +int put_page_from_l2e(l2_pgentry_t l2e, unsigned long pfn) { if ( !(l2e_get_flags(l2e) & _PAGE_PRESENT) || (l2e_get_pfn(l2e) == pfn) ) return 1; @@ -1117,8 +1117,8 @@ static int put_page_from_l2e(l2_pgentry_t l2e, unsigned long pfn) static int __put_page_type(struct page_info *, int preemptible); -static int put_page_from_l3e(l3_pgentry_t l3e, unsigned long pfn, - int partial, bool defer) +int put_page_from_l3e(l3_pgentry_t l3e, unsigned long pfn, int partial, + bool defer) { struct page_info *pg; @@ -1155,8 +1155,8 @@ static int put_page_from_l3e(l3_pgentry_t l3e, unsigned long pfn, return put_page_and_type_preemptible(pg); } -static int put_page_from_l4e(l4_pgentry_t l4e, unsigned long pfn, - int partial, bool defer) +int put_page_from_l4e(l4_pgentry_t l4e, unsigned long pfn, int partial, + bool defer) { if ( (l4e_get_flags(l4e) & _PAGE_PRESENT) && (l4e_get_pfn(l4e) != pfn) ) @@ -1340,7 +1340,7 @@ static int alloc_l3_table(struct page_info *page) else rc = get_page_and_type_from_mfn( _mfn(l3e_get_pfn(pl3e[i])), - PGT_l2_page_table | PGT_pae_xen_l2, d, partial, 1); + PGT_l2_page_table | PGT_pae_xen_l2, d, partial, true); } else if ( !is_guest_l3_slot(i) || (rc = get_page_from_l3e(pl3e[i], pfn, d, partial)) > 0 ) @@ -1992,7 +1992,7 @@ int get_page(struct page_info *page, struct domain *domain) * acquired reference again. * Due to get_page() reserving one reference, this call cannot fail. */ -static void get_page_light(struct page_info *page) +void get_page_light(struct page_info *page) { unsigned long x, nx, y = page->count_info; @@ -2525,7 +2525,7 @@ int pv_new_guest_cr3(unsigned long mfn) rc = paging_mode_refcounts(currd) ? (get_page_from_mfn(_mfn(mfn), currd) ? 0 : -EINVAL) : get_page_and_type_from_mfn(_mfn(mfn), PGT_root_page_table, - currd, 0, 1); + currd, 0, true); switch ( rc ) { case 0: @@ -2901,7 +2901,7 @@ long do_mmuext_op( if ( op.arg1.mfn != 0 ) { rc = get_page_and_type_from_mfn( - _mfn(op.arg1.mfn), PGT_root_page_table, currd, 0, 1); + _mfn(op.arg1.mfn), PGT_root_page_table, currd, 0, true); if ( unlikely(rc) ) { diff --git a/xen/include/asm-x86/mm.h b/xen/include/asm-x86/mm.h index a5662f327b..07d4c06fc3 100644 --- a/xen/include/asm-x86/mm.h +++ b/xen/include/asm-x86/mm.h @@ -339,10 +339,23 @@ int get_page_type(struct page_info *page, unsigned long type); int put_page_type_preemptible(struct page_info *page); int get_page_type_preemptible(struct page_info *page, unsigned long type); int put_old_guest_table(struct vcpu *); -int get_page_from_l1e( - l1_pgentry_t l1e, struct domain *l1e_owner, struct domain *pg_owner); +int get_page_from_l1e(l1_pgentry_t l1e, struct domain *l1e_owner, + struct domain *pg_owner); void put_page_from_l1e(l1_pgentry_t l1e, struct domain *l1e_owner); +int get_page_from_l2e(l2_pgentry_t l2e, unsigned long pfn, struct domain *d); +int put_page_from_l2e(l2_pgentry_t l2e, unsigned long pfn); +int get_page_from_l3e(l3_pgentry_t l3e, unsigned long pfn, struct domain *d, + int partial); +int put_page_from_l3e(l3_pgentry_t l3e, unsigned long pfn, int partial, + bool defer); +int get_page_from_l4e(l4_pgentry_t l4e, unsigned long pfn, struct domain *d, + int partial); +int put_page_from_l4e(l4_pgentry_t l4e, unsigned long pfn, int partial, + bool defer); +void get_page_light(struct page_info *page); bool get_page_from_mfn(mfn_t mfn, struct domain *d); +int get_page_and_type_from_mfn(mfn_t mfn, unsigned long type, struct domain *d, + int partial, bool preemptible); static inline void put_page_and_type(struct page_info *page) { -- 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 |